mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-27 07:29:52 +08:00
Fusion the two similar specialization of Sparse2Dense Assignment.
This change also fixes a compilation issue with MSVC<=2013.
This commit is contained in:
parent
7a5f83ca60
commit
568d488a27
@ -136,9 +136,13 @@ struct Assignment<DstXprType, SrcXprType, Functor, Sparse2Sparse, Scalar>
|
||||
template< typename DstXprType, typename SrcXprType, typename Functor>
|
||||
struct Assignment<DstXprType, SrcXprType, Functor, Sparse2Dense>
|
||||
{
|
||||
typedef typename DstXprType::Scalar Scalar;
|
||||
static void run(DstXprType &dst, const SrcXprType &src, const Functor &func)
|
||||
{
|
||||
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
|
||||
|
||||
if(internal::is_same<Functor,internal::assign_op<Scalar> >::value)
|
||||
dst.setZero();
|
||||
|
||||
internal::evaluator<SrcXprType> srcEval(src);
|
||||
internal::evaluator<DstXprType> dstEval(dst);
|
||||
@ -149,23 +153,6 @@ struct Assignment<DstXprType, SrcXprType, Functor, Sparse2Dense>
|
||||
}
|
||||
};
|
||||
|
||||
template< typename DstXprType, typename SrcXprType>
|
||||
struct Assignment<DstXprType, SrcXprType, internal::assign_op<typename DstXprType::Scalar>, Sparse2Dense>
|
||||
{
|
||||
static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op<typename DstXprType::Scalar> &)
|
||||
{
|
||||
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
|
||||
|
||||
dst.setZero();
|
||||
internal::evaluator<SrcXprType> srcEval(src);
|
||||
internal::evaluator<DstXprType> dstEval(dst);
|
||||
const Index outerEvaluationSize = (internal::evaluator<SrcXprType>::Flags&RowMajorBit) ? src.rows() : src.cols();
|
||||
for (Index j=0; j<outerEvaluationSize; ++j)
|
||||
for (typename internal::evaluator<SrcXprType>::InnerIterator i(srcEval,j); i; ++i)
|
||||
dstEval.coeffRef(i.row(),i.col()) = i.value();
|
||||
}
|
||||
};
|
||||
|
||||
// Specialization for "dst = dec.solve(rhs)"
|
||||
// NOTE we need to specialize it for Sparse2Sparse to avoid ambiguous specialization error
|
||||
template<typename DstXprType, typename DecType, typename RhsType, typename Scalar>
|
||||
|
Loading…
Reference in New Issue
Block a user