mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-30 18:25:11 +08:00
SparseVector::assign: it is not always possible to reserve according to given non-zeros.
This commit is contained in:
parent
4bb0fff151
commit
ee244d54f4
@ -56,7 +56,7 @@ enum {
|
|||||||
template< typename Dest, typename Src,
|
template< typename Dest, typename Src,
|
||||||
int AssignmentKind = !bool(Src::IsVectorAtCompileTime) ? SVA_RuntimeSwitch
|
int AssignmentKind = !bool(Src::IsVectorAtCompileTime) ? SVA_RuntimeSwitch
|
||||||
: (((Src::Flags&RowMajorBit)==RowMajorBit) && (Src::RowsAtCompileTime==1))
|
: (((Src::Flags&RowMajorBit)==RowMajorBit) && (Src::RowsAtCompileTime==1))
|
||||||
|| (((Src::Flags&RowMajorBit)==0) && (Src::ColsAtCompileTime==1)) ? SVA_Inner
|
|| ((((Src::Flags&RowMajorBit)==0) && (Src::ColsAtCompileTime==1))) ? SVA_Inner
|
||||||
: SVA_Outer>
|
: SVA_Outer>
|
||||||
struct sparse_vector_assign_selector;
|
struct sparse_vector_assign_selector;
|
||||||
|
|
||||||
@ -257,7 +257,6 @@ class SparseVector
|
|||||||
inline SparseVector& operator=(const SparseMatrixBase<OtherDerived>& other)
|
inline SparseVector& operator=(const SparseMatrixBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
SparseVector tmp(other.size());
|
SparseVector tmp(other.size());
|
||||||
tmp.reserve(other.nonZeros());
|
|
||||||
internal::sparse_vector_assign_selector<SparseVector,OtherDerived>::run(tmp,other.derived());
|
internal::sparse_vector_assign_selector<SparseVector,OtherDerived>::run(tmp,other.derived());
|
||||||
this->swap(tmp);
|
this->swap(tmp);
|
||||||
return *this;
|
return *this;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user