Difference between revisions of "CPP/Boost/Numeric/Matrix"
From ProgrammingExamples
< CPP
Daviddoria (Talk | contribs) (Created page with '==Matrix.cpp== <source lang="cpp"> #include <boost/numeric/ublas/matrix.hpp> #include <boost/numeric/ublas/io.hpp> int main () { using namespace boost::numeric::ublas; matr…') |
Daviddoria (Talk | contribs) |
||
Line 21: | Line 21: | ||
return 0; | return 0; | ||
} | } | ||
+ | </source> | ||
+ | |||
+ | ==CMakeLists.txt== | ||
+ | <source lang="cmake"> | ||
+ | cmake_minimum_required(VERSION 2.6) | ||
+ | |||
+ | Project(Matrix) | ||
+ | ADD_EXECUTABLE(Matrix Matrix.cpp) | ||
+ | |||
</source> | </source> |
Latest revision as of 11:39, 23 January 2011
Matrix.cpp
#include <boost/numeric/ublas/matrix.hpp> #include <boost/numeric/ublas/io.hpp> int main () { using namespace boost::numeric::ublas; matrix<double> m (3, 3); for (unsigned i = 0; i < m.size1 (); ++ i) { for (unsigned j = 0; j < m.size2 (); ++ j) { m (i, j) = 3 * i + j; } } std::cout << m << std::endl; return 0; }
CMakeLists.txt
cmake_minimum_required(VERSION 2.6) Project(Matrix) ADD_EXECUTABLE(Matrix Matrix.cpp)