aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-07-26 12:08:28 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-07-26 12:08:28 +0000
commitf997a3e9020605d66aeb5a546b37bbfa1c69ef22 (patch)
tree4f18169cc0c1f14925aaded9b017696baa3a6e19
parentb466c266a0081685d27855684f22d7ccc5fb10ea (diff)
update the inverse test a little
make use of static asserts in Map fix 2 warnings in CacheFriendlyProduct: unused var 'Vectorized'
-rw-r--r--Eigen/src/Core/CacheFriendlyProduct.h2
-rw-r--r--Eigen/src/Core/Map.h9
-rw-r--r--test/inverse.cpp7
3 files changed, 9 insertions, 9 deletions
diff --git a/Eigen/src/Core/CacheFriendlyProduct.h b/Eigen/src/Core/CacheFriendlyProduct.h
index a54f1743f..c3efbacaf 100644
--- a/Eigen/src/Core/CacheFriendlyProduct.h
+++ b/Eigen/src/Core/CacheFriendlyProduct.h
@@ -406,7 +406,6 @@ EIGEN_DONT_INLINE static void ei_cache_friendly_product_colmajor_times_vector(
const int peels = 2;
const int PacketAlignedMask = PacketSize-1;
const int PeelAlignedMask = PacketSize*peels-1;
- const bool Vectorized = sizeof(Packet) != sizeof(Scalar);
// How many coeffs of the result do we have to skip to be aligned.
// Here we assume data are at least aligned on the base scalar type that is mandatory anyway.
@@ -571,7 +570,6 @@ EIGEN_DONT_INLINE static void ei_cache_friendly_product_rowmajor_times_vector(
// const int peels = 2;
const int PacketAlignedMask = PacketSize-1;
// const int PeelAlignedMask = PacketSize*peels-1;
- const bool Vectorized = sizeof(Packet) != sizeof(Scalar);
const int size = rhsSize;
// How many coeffs of the result do we have to skip to be aligned.
diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h
index 13664eebc..e6f8cdcbd 100644
--- a/Eigen/src/Core/Map.h
+++ b/Eigen/src/Core/Map.h
@@ -127,8 +127,7 @@ template<typename MatrixType, int Alignment> class Map
inline Map(const Scalar* data) : m_data(data), m_rows(RowsAtCompileTime), m_cols(ColsAtCompileTime)
{
- ei_assert(RowsAtCompileTime != Dynamic && ColsAtCompileTime != Dynamic);
- ei_assert(RowsAtCompileTime > 0 && ColsAtCompileTime > 0);
+ EIGEN_STATIC_ASSERT_FIXED_SIZE(MatrixType)
}
inline Map(const Scalar* data, int size)
@@ -136,11 +135,9 @@ template<typename MatrixType, int Alignment> class Map
m_rows(RowsAtCompileTime == Dynamic ? size : RowsAtCompileTime),
m_cols(ColsAtCompileTime == Dynamic ? size : ColsAtCompileTime)
{
+ EIGEN_STATIC_ASSERT_VECTOR_ONLY(MatrixType)
ei_assert(size > 0);
- ei_assert((RowsAtCompileTime == 1
- && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == size))
- || (ColsAtCompileTime == 1
- && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == size)));
+ ei_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == size);
}
inline Map(const Scalar* data, int rows, int cols)
diff --git a/test/inverse.cpp b/test/inverse.cpp
index 5614c987d..9c7c6524c 100644
--- a/test/inverse.cpp
+++ b/test/inverse.cpp
@@ -2,6 +2,7 @@
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
+// Copyright (C) 2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -53,15 +54,19 @@ template<typename MatrixType> void inverse(const MatrixType& m)
VERIFY_IS_APPROX(identity, m1 * m1.inverse() );
VERIFY_IS_APPROX(m1, m1.inverse().inverse() );
+
+ // since for the general case we implement separately row-major and col-major, test that
+ VERIFY_IS_APPROX(m1.transpose().inverse(), m1.inverse().transpose());
}
void test_inverse()
{
- for(int i = 0; i < 1; i++) {
+ for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( inverse(Matrix<double,1,1>()) );
CALL_SUBTEST( inverse(Matrix2d()) );
CALL_SUBTEST( inverse(Matrix3f()) );
CALL_SUBTEST( inverse(Matrix4f()) );
+ CALL_SUBTEST( inverse(MatrixXf(8,8)) );
CALL_SUBTEST( inverse(MatrixXcd(7,7)) );
}
}