| 18 | |
| 19 | template<typename MatrixType> |
| 20 | void dontalign(const MatrixType& m) |
| 21 | { |
| 22 | typedef typename MatrixType::Index Index; |
| 23 | typedef typename MatrixType::Scalar Scalar; |
| 24 | typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; |
| 25 | typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType; |
| 26 | |
| 27 | Index rows = m.rows(); |
| 28 | Index cols = m.cols(); |
| 29 | |
| 30 | MatrixType a = MatrixType::Random(rows,cols); |
| 31 | SquareMatrixType square = SquareMatrixType::Random(rows,rows); |
| 32 | VectorType v = VectorType::Random(rows); |
| 33 | |
| 34 | VERIFY_IS_APPROX(v, square * square.colPivHouseholderQr().solve(v)); |
| 35 | square = square.inverse().eval(); |
| 36 | a = square * a; |
| 37 | square = square*square; |
| 38 | v = square * v; |
| 39 | v = a.adjoint() * v; |
| 40 | VERIFY(square.determinant() != Scalar(0)); |
| 41 | |
| 42 | // bug 219: MapAligned() was giving an assert with EIGEN_DONT_ALIGN, because Map Flags were miscomputed |
| 43 | Scalar* array = internal::aligned_new<Scalar>(rows); |
| 44 | v = VectorType::MapAligned(array, rows); |
| 45 | internal::aligned_delete(array, rows); |
| 46 | } |
| 47 | |
| 48 | void test_dontalign() |
| 49 | { |