* allow matrix dimensions to be 0 (also at compile time) and provide a specialization

of ei_matrix_array for size 0
* adapt many xprs to have the right storage order, now that it matters
* add static assert on expressions to check that vector xprs
  have the righ storage order
* adapt ei_plain_matrix_type_(column|row)_major
* implement assignment of selfadjointview to matrix
  (was before failing to compile) and add nestedExpression() methods
* expand product_symm test
* in ei_gemv_selector, use the PlainObject type instead of a custom Matrix<...> type
* fix VectorBlock and Block mistakes
This commit is contained in:
Benoit Jacob
2010-03-21 11:28:03 -04:00
parent 547269da35
commit 92da574ec2
19 changed files with 117 additions and 59 deletions

View File

@@ -48,13 +48,14 @@ template<typename Scalar, int Size, int OtherSize> void symm(int size = Size, in
typedef Matrix<Scalar, Size, Size> MatrixType;
typedef Matrix<Scalar, Size, OtherSize> Rhs1;
typedef Matrix<Scalar, OtherSize, Size> Rhs2;
typedef Matrix<Scalar, Size, OtherSize,RowMajor> Rhs3;
enum { order = OtherSize==1 ? 0 : RowMajor };
typedef Matrix<Scalar, Size, OtherSize,order> Rhs3;
int rows = size;
int cols = size;
MatrixType m1 = MatrixType::Random(rows, cols),
m2 = MatrixType::Random(rows, cols);
m2 = MatrixType::Random(rows, cols), m3;
m1 = (m1+m1.adjoint()).eval();
@@ -66,10 +67,14 @@ template<typename Scalar, int Size, int OtherSize> void symm(int size = Size, in
s2 = ei_random<Scalar>();
m2 = m1.template triangularView<Lower>();
m3 = m2.template selfadjointView<Lower>();
VERIFY_IS_EQUAL(m1, m3);
VERIFY_IS_APPROX(rhs12 = (s1*m2).template selfadjointView<Lower>() * (s2*rhs1),
rhs13 = (s1*m1) * (s2*rhs1));
m2 = m1.template triangularView<Upper>(); rhs12.setRandom(); rhs13 = rhs12;
m3 = m2.template selfadjointView<Upper>();
VERIFY_IS_EQUAL(m1, m3);
VERIFY_IS_APPROX(rhs12 += (s1*m2).template selfadjointView<Upper>() * (s2*rhs1),
rhs13 += (s1*m1) * (s2*rhs1));

View File

@@ -43,8 +43,9 @@ template<typename Scalar,int Size, int Cols> void trsolve(int size=Size,int cols
Matrix<Scalar,Size,Size,ColMajor> cmLhs(size,size);
Matrix<Scalar,Size,Size,RowMajor> rmLhs(size,size);
Matrix<Scalar,Size,Cols,ColMajor> cmRhs(size,cols), ref(size,cols);
Matrix<Scalar,Size,Cols,RowMajor> rmRhs(size,cols);
enum { order = Size==1 ? RowMajor : ColMajor };
Matrix<Scalar,Size,Cols,order> cmRhs(size,cols), ref(size,cols);
Matrix<Scalar,Size,Cols,order> rmRhs(size,cols);
cmLhs.setRandom(); cmLhs *= static_cast<RealScalar>(0.1); cmLhs.diagonal().array() += static_cast<RealScalar>(1);
rmLhs.setRandom(); rmLhs *= static_cast<RealScalar>(0.1); rmLhs.diagonal().array() += static_cast<RealScalar>(1);