/* * Expression Template Matrix Library * * Copyright (C) 2004 - 2004 Ricky Lung <mtlung@users.sourceforge.net> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * A simple example to show the basic usage of exmat */ #include <iostream> // The all-in-one header for exmat #include "../include/exmat.h" using std::cout; using std::endl; using namespace exmat; // Define the vector type (column vector of type float, size 3) typedef Vec<DenseColVecCon<float, 3> > Vec3f; // Define the matrix type (dense matrix of type float, dimension 3x3) typedef Mat<DenseMatCon<float,3,3> > Mat3x3f; int main() { Vec3f v1(0), v2(0); // Initialize the vectors with zero Mat3x3f m1; // Assign some values to the matrix using comma operator m1 = 1, 2, 3, 4, 5, 6, 7, 8, 9; // Accessing individual element v2[1] = 1; // Using [] operator (zero based index) v2(2) = 2; // Using () operator (zero based index) v1 = m1 * v2; cout << v1; return 0; }