mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
big reorganisation of asserts, so that:
0) asserts are only done in the public API, except for a few ones explicitly named eigen_internal_assert. 1) internal asserts are disabled unless EIGEN_INTERNAL_DEBUGGING is defined. This limits the impact of debugging on performance. 2) no 'unused argument' warnings anymore when compiling with -DNDEBUG
This commit is contained in:
@@ -51,13 +51,11 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols> >,
|
||||
|
||||
const Scalar& _read(int row, int col) const
|
||||
{
|
||||
EIGEN_CHECK_RANGES(*this, row, col);
|
||||
return array()[row + col * Storage::_rows()];
|
||||
}
|
||||
|
||||
Scalar& _write(int row, int col)
|
||||
{
|
||||
EIGEN_CHECK_RANGES(*this, row, col);
|
||||
return array()[row + col * Storage::_rows()];
|
||||
}
|
||||
|
||||
@@ -80,9 +78,23 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols> >,
|
||||
EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Matrix, *=)
|
||||
EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Matrix, /=)
|
||||
|
||||
explicit Matrix() : Storage() {}
|
||||
explicit Matrix(int dim) : Storage(dim) {}
|
||||
explicit Matrix(int rows, int cols) : Storage(rows, cols) {}
|
||||
explicit Matrix() : Storage()
|
||||
{
|
||||
assert(RowsAtCompileTime > 0 && ColsAtCompileTime > 0);
|
||||
}
|
||||
explicit Matrix(int dim) : Storage(dim)
|
||||
{
|
||||
assert(dim > 0);
|
||||
assert((RowsAtCompileTime == 1
|
||||
&& (ColsAtCompileTime == Dynamic || ColsAtCompileTime == dim))
|
||||
|| (ColsAtCompileTime == 1
|
||||
&& (RowsAtCompileTime == Dynamic || RowsAtCompileTime == dim)));
|
||||
}
|
||||
explicit Matrix(int rows, int cols) : Storage(rows, cols)
|
||||
{
|
||||
assert(rows > 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows)
|
||||
&& cols > 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols));
|
||||
}
|
||||
template<typename OtherDerived>
|
||||
Matrix(const MatrixBase<Scalar, OtherDerived>& other)
|
||||
: Storage(other.rows(), other.cols())
|
||||
|
||||
Reference in New Issue
Block a user