aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/adjoint.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-08-15 22:19:29 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-08-15 22:19:29 +0200
commit239ada95b7680c75f793086eaa35fe7ec1047204 (patch)
tree88a7f107a3866e1c7f284feb818fbbc2cd22ffa3 /test/adjoint.cpp
parenta3e6047c25a4cbc2153974e04fe124c5776a23c0 (diff)
add overloads of lazyAssign to detect common aliasing issue with
transpose and adjoint
Diffstat (limited to 'test/adjoint.cpp')
-rw-r--r--test/adjoint.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/test/adjoint.cpp b/test/adjoint.cpp
index 300650338..964658c65 100644
--- a/test/adjoint.cpp
+++ b/test/adjoint.cpp
@@ -21,7 +21,7 @@
// You should have received a copy of the GNU Lesser General Public
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
-#define EIGEN_NO_ASSERTION_CHECKING
+
#include "main.h"
template<typename MatrixType> void adjoint(const MatrixType& m)
@@ -110,7 +110,6 @@ template<typename MatrixType> void adjoint(const MatrixType& m)
m3.transposeInPlace();
VERIFY_IS_APPROX(m3,m1.conjugate());
-
}
void test_adjoint()
@@ -125,5 +124,16 @@ void test_adjoint()
}
// test a large matrix only once
CALL_SUBTEST( adjoint(Matrix<float, 100, 100>()) );
+
+ {
+ MatrixXcf a(10,10), b(10,10);
+ VERIFY_RAISES_ASSERT(a = a.transpose());
+ VERIFY_RAISES_ASSERT(a = a.transpose() + b);
+ VERIFY_RAISES_ASSERT(a = b + a.transpose());
+ VERIFY_RAISES_ASSERT(a = a.conjugate().transpose());
+ VERIFY_RAISES_ASSERT(a = a.adjoint());
+ VERIFY_RAISES_ASSERT(a = a.adjoint() + b);
+ VERIFY_RAISES_ASSERT(a = b + a.adjoint());
+ }
}