mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-21 17:19:36 +08:00
Add static assertion on selfadjoint-view's UpLo parameter.
(grafted from d820ab9edc0b38af4cdb3d545714a0c9083e5a78 )
This commit is contained in:
parent
c24844195d
commit
74daf12e52
@ -71,7 +71,9 @@ template<typename _MatrixType, unsigned int UpLo> class SelfAdjointView
|
|||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
explicit inline SelfAdjointView(MatrixType& matrix) : m_matrix(matrix)
|
explicit inline SelfAdjointView(MatrixType& matrix) : m_matrix(matrix)
|
||||||
{}
|
{
|
||||||
|
EIGEN_STATIC_ASSERT(UpLo==Lower || UpLo==Upper,SELFADJOINTVIEW_ACCEPTS_UPPER_AND_LOWER_MODE_ONLY);
|
||||||
|
}
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
inline Index rows() const { return m_matrix.rows(); }
|
inline Index rows() const { return m_matrix.rows(); }
|
||||||
|
@ -101,7 +101,8 @@
|
|||||||
THIS_TYPE_IS_NOT_SUPPORTED=1,
|
THIS_TYPE_IS_NOT_SUPPORTED=1,
|
||||||
STORAGE_KIND_MUST_MATCH=1,
|
STORAGE_KIND_MUST_MATCH=1,
|
||||||
STORAGE_INDEX_MUST_MATCH=1,
|
STORAGE_INDEX_MUST_MATCH=1,
|
||||||
CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY=1
|
CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY=1,
|
||||||
|
SELFADJOINTVIEW_ACCEPTS_UPPER_AND_LOWER_MODE_ONLY=1
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
// Public License v. 2.0. If a copy of the MPL was not distributed
|
// Public License v. 2.0. If a copy of the MPL was not distributed
|
||||||
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
#define EIGEN_NO_STATIC_ASSERT
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
// This file tests the basic selfadjointView API,
|
// This file tests the basic selfadjointView API,
|
||||||
@ -45,6 +46,9 @@ template<typename MatrixType> void selfadjoint(const MatrixType& m)
|
|||||||
m4 = m2;
|
m4 = m2;
|
||||||
m4 -= m1.template selfadjointView<Lower>();
|
m4 -= m1.template selfadjointView<Lower>();
|
||||||
VERIFY_IS_APPROX(m4, m2-m3);
|
VERIFY_IS_APPROX(m4, m2-m3);
|
||||||
|
|
||||||
|
VERIFY_RAISES_ASSERT(m2.template selfadjointView<StrictlyUpper>());
|
||||||
|
VERIFY_RAISES_ASSERT(m2.template selfadjointView<UnitLower>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void bug_159()
|
void bug_159()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user