mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-22 01:29:35 +08:00
Add a default ctor to evaluator<SparseVector>.
Needed for evaluator<Solve>.
This commit is contained in:
parent
4d226ab5b5
commit
fc7180cda8
@ -411,6 +411,7 @@ struct evaluator<SparseVector<_Scalar,_Options,_Index> >
|
|||||||
: evaluator_base<SparseVector<_Scalar,_Options,_Index> >
|
: evaluator_base<SparseVector<_Scalar,_Options,_Index> >
|
||||||
{
|
{
|
||||||
typedef SparseVector<_Scalar,_Options,_Index> SparseVectorType;
|
typedef SparseVector<_Scalar,_Options,_Index> SparseVectorType;
|
||||||
|
typedef evaluator_base<SparseVectorType> Base;
|
||||||
typedef typename SparseVectorType::InnerIterator InnerIterator;
|
typedef typename SparseVectorType::InnerIterator InnerIterator;
|
||||||
typedef typename SparseVectorType::ReverseInnerIterator ReverseInnerIterator;
|
typedef typename SparseVectorType::ReverseInnerIterator ReverseInnerIterator;
|
||||||
|
|
||||||
@ -419,19 +420,21 @@ struct evaluator<SparseVector<_Scalar,_Options,_Index> >
|
|||||||
Flags = SparseVectorType::Flags
|
Flags = SparseVectorType::Flags
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit evaluator(const SparseVectorType &mat) : m_matrix(mat)
|
evaluator() : Base() {}
|
||||||
|
|
||||||
|
explicit evaluator(const SparseVectorType &mat) : m_matrix(&mat)
|
||||||
{
|
{
|
||||||
EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
|
EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Index nonZerosEstimate() const {
|
inline Index nonZerosEstimate() const {
|
||||||
return m_matrix.nonZeros();
|
return m_matrix->nonZeros();
|
||||||
}
|
}
|
||||||
|
|
||||||
operator SparseVectorType&() { return m_matrix.const_cast_derived(); }
|
operator SparseVectorType&() { return m_matrix->const_cast_derived(); }
|
||||||
operator const SparseVectorType&() const { return m_matrix; }
|
operator const SparseVectorType&() const { return *m_matrix; }
|
||||||
|
|
||||||
const SparseVectorType &m_matrix;
|
const SparseVectorType *m_matrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
template< typename Dest, typename Src>
|
template< typename Dest, typename Src>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user