aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Transpose.h
diff options
context:
space:
mode:
authorGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2013-02-20 14:03:14 +0000
committerGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2013-02-20 14:03:14 +0000
commit986f60127d9a44891cdce2abad7ae17f504bd35d (patch)
treec00529edd4d2bcfdc76c55f12df2c4d19cbe0eb8 /Eigen/src/Core/Transpose.h
parenta054b4ee2763dad9304ec99cc3acc05db8925e6f (diff)
Guard against transposeInPlace on non-square non-resizable matrix.
Inspired by question by Martin Drozdik at stackoverflow.com/q/14954983
Diffstat (limited to 'Eigen/src/Core/Transpose.h')
-rw-r--r--Eigen/src/Core/Transpose.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h
index 34944e055..2bc828e19 100644
--- a/Eigen/src/Core/Transpose.h
+++ b/Eigen/src/Core/Transpose.h
@@ -278,7 +278,7 @@ struct inplace_transpose_selector<MatrixType,false> { // non square matrix
* m = m.transpose().eval();
* \endcode
* and is faster and also safer because in the latter line of code, forgetting the eval() results
- * in a bug caused by aliasing.
+ * in a bug caused by \ref TopicAliasing "aliasing".
*
* Notice however that this method is only useful if you want to replace a matrix by its own transpose.
* If you just need the transpose of a matrix, use transpose().
@@ -289,6 +289,8 @@ struct inplace_transpose_selector<MatrixType,false> { // non square matrix
template<typename Derived>
inline void DenseBase<Derived>::transposeInPlace()
{
+ eigen_assert((rows() == cols() || (RowsAtCompileTime == Dynamic && ColsAtCompileTime == Dynamic))
+ && "transposeInPlace() called on a non-square non-resizable matrix");
internal::inplace_transpose_selector<Derived>::run(derived());
}