Rasmus Munk Larsen | 2434cfd | 2023-12-06 12:02:41 -0800 | [diff] [blame] | 1 | MatrixXf M1 = MatrixXf::Random(3, 8); |
Googler | 45874d8 | 2019-08-21 12:06:47 -0700 | [diff] [blame] | 2 | cout << "Column major input:" << endl << M1 << "\n"; |
Rasmus Munk Larsen | 2434cfd | 2023-12-06 12:02:41 -0800 | [diff] [blame] | 3 | Map<MatrixXf, 0, OuterStride<> > M2(M1.data(), M1.rows(), (M1.cols() + 2) / 3, OuterStride<>(M1.outerStride() * 3)); |
Googler | 45874d8 | 2019-08-21 12:06:47 -0700 | [diff] [blame] | 4 | cout << "1 column over 3:" << endl << M2 << "\n"; |
| 5 | |
Rasmus Munk Larsen | 2434cfd | 2023-12-06 12:02:41 -0800 | [diff] [blame] | 6 | typedef Matrix<float, Dynamic, Dynamic, RowMajor> RowMajorMatrixXf; |
Googler | 45874d8 | 2019-08-21 12:06:47 -0700 | [diff] [blame] | 7 | RowMajorMatrixXf M3(M1); |
| 8 | cout << "Row major input:" << endl << M3 << "\n"; |
Rasmus Munk Larsen | 2434cfd | 2023-12-06 12:02:41 -0800 | [diff] [blame] | 9 | Map<RowMajorMatrixXf, 0, Stride<Dynamic, 3> > M4(M3.data(), M3.rows(), (M3.cols() + 2) / 3, |
| 10 | Stride<Dynamic, 3>(M3.outerStride(), 3)); |
Rasmus Munk Larsen | e810da0 | 2020-03-25 17:33:10 -0700 | [diff] [blame] | 11 | cout << "1 column over 3:" << endl << M4 << "\n"; |