#include <colvartypes.h>
Public Member Functions | |
| void | alloc () |
| Allocation routine, used by all constructors. | |
| void | reset () |
| Set all elements to zero. | |
| matrix2d () | |
| Default constructor. | |
| matrix2d (T const **m) | |
| Constructor from a 2-d C array. | |
| matrix2d (matrix2d< T, outer_length, inner_length > const &m) | |
| Copy constructor. | |
| matrix2d< T, outer_length, inner_length > & | operator= (matrix2d< T, outer_length, inner_length > const &m) |
| Assignment. | |
| ~matrix2d () | |
| Destructor. | |
| T ** | c_array () |
| Return the 2-d C array. | |
| operator T ** () | |
| Return the 2-d C array. | |
Protected Attributes | |
| T ** | array |
| Underlying C array. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, matrix2d< T, outer_length, inner_length > const &m) |
| Formatted output. | |
Definition at line 277 of file colvartypes.h.
|
|||||||||
|
Default constructor.
Definition at line 305 of file colvartypes.h.
|
|
||||||||||
|
Constructor from a 2-d C array.
Definition at line 312 of file colvartypes.h. 00313 {
00314 this->alloc();
00315 for (size_t i = 0; i < outer_length; i++) {
00316 for (size_t j = 0; j < inner_length; j++)
00317 array[i][j] = m[i][j];
00318 }
00319 }
|
|
||||||||||
|
Copy constructor.
Definition at line 322 of file colvartypes.h. 00323 {
00324 this->alloc();
00325 for (size_t i = 0; i < outer_length; i++) {
00326 for (size_t j = 0; j < inner_length; j++)
00327 this->array[i][j] = m.array[i][j];
00328 }
00329 }
|
|
|||||||||
|
Destructor.
Definition at line 343 of file colvartypes.h. 00343 {
00344 for (size_t i = 0; i < outer_length; i++) {
00345 delete [] array[i];
00346 }
00347 delete [] array;
00348 }
|
|
|||||||||
|
Allocation routine, used by all constructors.
Definition at line 287 of file colvartypes.h. 00287 {
00288 array = new T * [outer_length];
00289 for (size_t i = 0; i < outer_length; i++) {
00290 array[i] = new T [inner_length];
00291 }
00292 }
|
|
|||||||||
|
Return the 2-d C array.
Definition at line 351 of file colvartypes.h. 00351 { return array; }
|
|
|||||||||
|
Return the 2-d C array.
Definition at line 354 of file colvartypes.h. 00354 { return array; }
|
|
||||||||||
|
Assignment.
Definition at line 333 of file colvartypes.h. 00334 {
00335 for (size_t i = 0; i < outer_length; i++) {
00336 for (size_t j = 0; j < inner_length; j++)
00337 this->array[i][j] = m.array[i][j];
00338 }
00339 return *this;
00340 }
|
|
|||||||||
|
Set all elements to zero.
Definition at line 295 of file colvartypes.h. 00296 {
00297 for (size_t i = 0; i < outer_length; i++) {
00298 for (size_t j = 0; j < inner_length; j++) {
00299 array[i][j] = T (0.0);
00300 }
00301 }
00302 }
|
|
||||||||||||||||
|
Formatted output.
Definition at line 381 of file colvartypes.h. 00383 {
00384 std::streamsize const w = os.width();
00385 std::streamsize const p = os.precision();
00386
00387 os << "(";
00388 for (size_t i = 0; i < outer_length; i++) {
00389 os << " ( ";
00390 for (size_t j = 0; j < inner_length-1; j++) {
00391 os.width (w);
00392 os.precision (p);
00393 os << m.array[i][j] << " , ";
00394 }
00395 os.width (w);
00396 os.precision (p);
00397 os << m.array[i][inner_length-1] << " )";
00398 }
00399
00400 os << " )";
00401 return os;
00402 }
|
|
|||||
|
Underlying C array.
Definition at line 282 of file colvartypes.h. Referenced by colvarmodule::matrix2d< colvarmodule::real, 3, 3 >::matrix2d(), and colvarmodule::matrix2d< colvarmodule::real, 3, 3 >::operator=(). |
1.3.9.1