add auto transposition for vectors

This commit is contained in:
Gael Guennebaud 2009-04-30 12:09:45 +00:00
parent 7029ed6b88
commit facee57b8d

View File

@ -239,7 +239,10 @@ class SparseVector
template<typename OtherDerived> template<typename OtherDerived>
inline SparseVector& operator=(const SparseMatrixBase<OtherDerived>& other) inline SparseVector& operator=(const SparseMatrixBase<OtherDerived>& other)
{ {
return Base::operator=(other); if (int(RowsAtCompileTime)!=int(OtherDerived::RowsAtCompileTime))
return Base::operator=(other.transpose());
else
return Base::operator=(other);
} }
// const bool needToTranspose = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit); // const bool needToTranspose = (Flags & RowMajorBit) != (OtherDerived::Flags & RowMajorBit);