Constructors and initialization

For the sake of efficiency, the default constructor for a matrix/vector will not initialize the elements:
    exmat::Mat<DenseMatCon<float, 3, 3> > m1;
    exmat::Mat<DenseMatCon<float, 0, 0> > m2;
    exmat::Mat<DenseMatCon<float, 0, 0> > m3(exmat::Dim(3), exmat::Dim(3));
The third constructor initialize a dynamic matrix with dimension 3x3
Note:
The dimension of a dynamic sized matrix resultant from an default constructor is 1x1
To set all the elements to zero use, for example
    exmat::Mat<DenseMatCon<float, 3, 3> > m1(0.0f);
    exmat::Mat<DenseMatCon<float, 3, 3> > m2 = 0.0f;
    exmat::Mat<DenseMatCon<float, 0, 0> > m3(exmat::Dim(3), exmat::Dim(3), 0.0f);

You can initialize the elements using a string with space separating the values

    exmat::Mat<DenseRowVecCon<float, 3> > v1("1 2 3");
    exmat::Mat<DenseMatCon<float, 2, 2> > m1("1 2 3 4");
Note:
The elements specified in the string will be assigned to the matrix row-wise
You can also initialize the dimension of a dynamic sized matrix/vector in the string as well:
    exmat::Mat<DenseColVecCon<float, 0> > v1("3 1 2 3");
    exmat::Mat<DenseMatCon<float, 0, 0> > m1("2 2 1 2 3 4");
where the first(two) element in the string is treated as the size(dimension) of the vector(matrix)

See also:
Example: Initialization
Go to the next section : Accessing elements
Generated on Sat May 6 23:12:04 2006 for Exmat by  doxygen 1.4.6-NO