Tutorial_SlicingCol.cpp
Go to the documentation of this file.
1 MatrixXf M1 = MatrixXf::Random(3,8);
2 cout << "Column major input:" << endl << M1 << "\n";
3 Map<MatrixXf,0,OuterStride<> > M2(M1.data(), M1.rows(), (M1.cols()+2)/3, OuterStride<>(M1.outerStride()*3));
4 cout << "1 column over 3:" << endl << M2 << "\n";
5 
6 typedef Matrix<float,Dynamic,Dynamic,RowMajor> RowMajorMatrixXf;
8 cout << "Row major input:" << endl << M3 << "\n";
9 Map<RowMajorMatrixXf,0,Stride<Dynamic,3> > M4(M3.data(), M3.rows(), (M3.cols()+2)/3,
10  Stride<Dynamic,3>(M3.outerStride(),3));
11 cout << "1 column over 3:" << endl << M4 << "\n";
RowMajorMatrixXf M3(M1)
cout<< "Row major input:"<< endl<< M3<< "\n";Map< RowMajorMatrixXf, 0, Stride< Dynamic, 3 > > M4(M3.data(), M3.rows(),(M3.cols()+2)/3, Stride< Dynamic, 3 >(M3.outerStride(), 3))
cout<< "1 column over 3:"<< endl<< M2<< "\n";typedef Matrix< float, Dynamic, Dynamic, RowMajor > RowMajorMatrixXf
MatrixXf M1
cout<< "Column major input:"<< endl<< M1<< "\n";Map< MatrixXf, 0, OuterStride<> > M2(M1.data(), M1.rows(),(M1.cols()+2)/3, OuterStride<>(M1.outerStride() *3))
Matrix< float, Dynamic, Dynamic > MatrixXf
Dynamic×Dynamic matrix of type float.
Definition: Matrix.h:501