next up previous contents
Next: 2.3.2 List(Comma) Initializer Up: 2.3 Accessor Methods Previous: 2.3 Accessor Methods   Contents

2.3.1 Array Initializer: load

The load method takes one argument, the address of the beginning of a contiguous block of data to be loaded row-wise, as is the C++ convention, into the element storage area. No offsets are necessary and the address must be of type tData* relative to the definition below:

Definition:

  template < typename tData, int tRows, int tCols >
  void load(tData* tArray);

Examples:

  float r[2][3] = {{1.0,2.0,3.0},{4.0,5.0,6.0}};
  Matrix < double, 3, 3 > R;

  R.load(&r[0][0]);

There are many different possible and valid pointer and address combinations; be careful. Two point are important. If the size of the input array or block is larger than the matrix only the fist $(tRows*tCols)$ elements will be loaded.If the size of the input array or block is smaller than $(tRows*tCols)$, the values of the remaining elements are not deterministic. For more examples, see Section 2.2.3.



Andrew Douglas 2005-03-15