Tutorial_simple_example_dynamic_size.cpp
Go to the documentation of this file.
00001 #include <Eigen/Core>
00002 #include <iostream>
00003 
00004 using namespace Eigen;
00005 
00006 int main()
00007 {
00008   for (int size=1; size<=4; ++size)
00009   {
00010     MatrixXi m(size,size+1);         // a (size)x(size+1)-matrix of int's
00011     for (int j=0; j<m.cols(); ++j)   // loop over columns
00012       for (int i=0; i<m.rows(); ++i) // loop over rows
00013         m(i,j) = i+j*m.rows();       // to access matrix coefficients,
00014                                      // use operator()(int,int)
00015     std::cout << m << "\n\n";
00016   }
00017 
00018   VectorXf v(4); // a vector of 4 float's
00019   // to access vector coefficients, use either operator () or operator []
00020   v[0] = 1; v[1] = 2; v(2) = 3; v(3) = 4;
00021   std::cout << "\nv:\n" << v << std::endl;
00022 }


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:33:27