Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #if defined EIGEN_TEST_PART_1 || defined EIGEN_TEST_PART_2 || defined EIGEN_TEST_PART_3 || defined EIGEN_TEST_PART_4
00026 #define EIGEN_DONT_ALIGN
00027 #elif defined EIGEN_TEST_PART_5 || defined EIGEN_TEST_PART_6 || defined EIGEN_TEST_PART_7 || defined EIGEN_TEST_PART_8
00028 #define EIGEN_DONT_ALIGN_STATICALLY
00029 #endif
00030
00031 #include "main.h"
00032 #include <Eigen/Dense>
00033
00034 template<typename MatrixType>
00035 void dontalign(const MatrixType& m)
00036 {
00037 typedef typename MatrixType::Index Index;
00038 typedef typename MatrixType::Scalar Scalar;
00039 typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
00040 typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType;
00041
00042 Index rows = m.rows();
00043 Index cols = m.cols();
00044
00045 MatrixType a = MatrixType::Random(rows,cols);
00046 SquareMatrixType square = SquareMatrixType::Random(rows,rows);
00047 VectorType v = VectorType::Random(rows);
00048
00049 VERIFY_IS_APPROX(v, square * square.colPivHouseholderQr().solve(v));
00050 square = square.inverse().eval();
00051 a = square * a;
00052 square = square*square;
00053 v = square * v;
00054 v = a.adjoint() * v;
00055 VERIFY(square.determinant() != Scalar(0));
00056
00057
00058 Scalar* array = internal::aligned_new<Scalar>(rows);
00059 v = VectorType::MapAligned(array, rows);
00060 internal::aligned_delete(array, rows);
00061 }
00062
00063 void test_dontalign()
00064 {
00065 #if defined EIGEN_TEST_PART_1 || defined EIGEN_TEST_PART_5
00066 dontalign(Matrix3d());
00067 dontalign(Matrix4f());
00068 #elif defined EIGEN_TEST_PART_2 || defined EIGEN_TEST_PART_6
00069 dontalign(Matrix3cd());
00070 dontalign(Matrix4cf());
00071 #elif defined EIGEN_TEST_PART_3 || defined EIGEN_TEST_PART_7
00072 dontalign(Matrix<float, 32, 32>());
00073 dontalign(Matrix<std::complex<float>, 32, 32>());
00074 #elif defined EIGEN_TEST_PART_4 || defined EIGEN_TEST_PART_8
00075 dontalign(MatrixXd(32, 32));
00076 dontalign(MatrixXcf(32, 32));
00077 #endif
00078 }