mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix EIGEN_NO_AUTOMATIC_RESIZING not resizing empty destinations
libeigen/eigen!2219 Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
@@ -810,6 +810,9 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize_if_allowed(DstXprTyp
|
||||
(dst.size() == 0 || (DstXprType::IsVectorAtCompileTime ? (dst.size() == src.size())
|
||||
: (dst.rows() == dstRows && dst.cols() == dstCols))) &&
|
||||
"Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
|
||||
if (dst.size() == 0) {
|
||||
dst.resize(dstRows, dstCols);
|
||||
}
|
||||
#else
|
||||
dst.resize(dstRows, dstCols);
|
||||
eigen_assert(dst.rows() == dstRows && dst.cols() == dstCols);
|
||||
|
||||
@@ -685,6 +685,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
|
||||
eigen_assert((this->size() == 0 || (IsVectorAtCompileTime ? (this->size() == other.size())
|
||||
: (rows() == other.rows() && cols() == other.cols()))) &&
|
||||
"Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
|
||||
if (this->size() == 0) resizeLike(other);
|
||||
EIGEN_ONLY_USED_FOR_DEBUG(other);
|
||||
#else
|
||||
resizeLike(other);
|
||||
|
||||
Reference in New Issue
Block a user