mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-15 07:10:37 +08:00
* let a = foo() work when a is a row-vector xpr and foo() returns a ReturnByValue col-vector
* remove a few useless resize() in evalTo() implementations
This commit is contained in:
parent
3565e89be2
commit
4293a4d1af
@ -232,17 +232,19 @@ class DenseStorageBase : public _Base<Derived>
|
||||
* remain row-vectors and vectors remain vectors.
|
||||
*/
|
||||
template<typename OtherDerived>
|
||||
EIGEN_STRONG_INLINE void resizeLike(const DenseBase<OtherDerived>& other)
|
||||
EIGEN_STRONG_INLINE void resizeLike(const EigenBase<OtherDerived>& _other)
|
||||
{
|
||||
const OtherDerived& other = _other.derived();
|
||||
const int othersize = other.rows()*other.cols();
|
||||
if(RowsAtCompileTime == 1)
|
||||
{
|
||||
ei_assert(other.rows() == 1 || other.cols() == 1);
|
||||
resize(1, other.size());
|
||||
resize(1, othersize);
|
||||
}
|
||||
else if(ColsAtCompileTime == 1)
|
||||
{
|
||||
ei_assert(other.rows() == 1 || other.cols() == 1);
|
||||
resize(other.size(), 1);
|
||||
resize(othersize, 1);
|
||||
}
|
||||
else resize(other.rows(), other.cols());
|
||||
}
|
||||
@ -343,7 +345,7 @@ class DenseStorageBase : public _Base<Derived>
|
||||
template<typename OtherDerived>
|
||||
EIGEN_STRONG_INLINE Derived& operator=(const EigenBase<OtherDerived> &other)
|
||||
{
|
||||
resize(other.derived().rows(), other.derived().cols());
|
||||
_resize_to_match(other);
|
||||
Base::operator=(other.derived());
|
||||
return this->derived();
|
||||
}
|
||||
@ -424,7 +426,7 @@ class DenseStorageBase : public _Base<Derived>
|
||||
* remain row-vectors and vectors remain vectors.
|
||||
*/
|
||||
template<typename OtherDerived>
|
||||
EIGEN_STRONG_INLINE void _resize_to_match(const DenseBase<OtherDerived>& other)
|
||||
EIGEN_STRONG_INLINE void _resize_to_match(const EigenBase<OtherDerived>& other)
|
||||
{
|
||||
#ifdef EIGEN_NO_AUTOMATIC_RESIZING
|
||||
ei_assert((this->size()==0 || (IsVectorAtCompileTime ? (this->size() == other.size())
|
||||
|
@ -439,8 +439,6 @@ struct ei_solve_retval<PartialPivLU<_MatrixType>, Rhs>
|
||||
const int size = dec().matrixLU().rows();
|
||||
ei_assert(rhs().rows() == size);
|
||||
|
||||
dst.resize(size, rhs().cols());
|
||||
|
||||
// Step 1
|
||||
dst = dec().permutationP() * rhs();
|
||||
|
||||
|
@ -432,7 +432,6 @@ struct ei_solve_retval<ColPivHouseholderQR<_MatrixType>, Rhs>
|
||||
{
|
||||
const int rows = dec().rows(), cols = dec().cols(),
|
||||
nonzero_pivots = dec().nonzeroPivots();
|
||||
dst.resize(cols, rhs().cols());
|
||||
ei_assert(rhs().rows() == rows);
|
||||
|
||||
if(nonzero_pivots == 0)
|
||||
|
@ -341,7 +341,6 @@ struct ei_solve_retval<FullPivHouseholderQR<_MatrixType>, Rhs>
|
||||
template<typename Dest> void evalTo(Dest& dst) const
|
||||
{
|
||||
const int rows = dec().rows(), cols = dec().cols();
|
||||
dst.resize(cols, rhs().cols());
|
||||
ei_assert(rhs().rows() == rows);
|
||||
|
||||
// FIXME introduce nonzeroPivots() and use it here. and more generally,
|
||||
|
@ -217,7 +217,6 @@ struct ei_solve_retval<HouseholderQR<_MatrixType>, Rhs>
|
||||
template<typename Dest> void evalTo(Dest& dst) const
|
||||
{
|
||||
const int rows = dec().rows(), cols = dec().cols();
|
||||
dst.resize(cols, rhs().cols());
|
||||
const int rank = std::min(rows, cols);
|
||||
ei_assert(rhs().rows() == rows);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user