Go to the documentation of this file.
10 #ifndef EIGEN_SPARSEASSIGN_H
11 #define EIGEN_SPARSEASSIGN_H
15 template<
typename Derived>
16 template<
typename OtherDerived>
23 template<
typename Derived>
24 template<
typename OtherDerived>
28 other.evalTo(derived());
32 template<
typename Derived>
33 template<
typename OtherDerived>
42 template<
typename Derived>
70 template<
typename DstXprType,
typename SrcXprType>
77 SrcEvaluatorType srcEvaluator(src);
80 const Index outerEvaluationSize = (SrcEvaluatorType::Flags&
RowMajorBit) ? src.rows() : src.cols();
81 if ((!transpose) && src.isRValue())
84 dst.resize(src.rows(), src.cols());
86 dst.reserve((
std::min)(src.rows()*src.cols(), (
std::max)(src.rows(),src.cols())*2));
87 for (
Index j=0;
j<outerEvaluationSize; ++
j)
90 for (
typename SrcEvaluatorType::InnerIterator it(srcEvaluator,
j); it; ++it)
93 dst.insertBackByOuterInner(
j,it.index()) =
v;
103 "the transpose operation is supposed to be handled in SparseMatrix::operator=");
108 DstXprType temp(src.rows(), src.cols());
110 temp.reserve((
std::min)(src.rows()*src.cols(), (
std::max)(src.rows(),src.cols())*2));
111 for (
Index j=0;
j<outerEvaluationSize; ++
j)
114 for (
typename SrcEvaluatorType::InnerIterator it(srcEvaluator,
j); it; ++it)
117 temp.insertBackByOuterInner(Flip?it.index():
j,Flip?
j:it.index()) =
v;
122 dst = temp.markAsRValue();
127 template<
typename DstXprType,
typename SrcXprType,
typename Functor>
137 template<
typename DstXprType,
typename SrcXprType,
typename Functor,
typename Weak>
150 for (
Index j=0;
j<outerEvaluationSize; ++
j)
152 func.assignCoeff(dstEval.coeffRef(
i.row(),
i.col()),
i.value());
157 template<
typename DstXprType,
typename Func1,
typename Func2>
160 template<
typename SrcXprType,
typename InitialFunc>
162 void run(DstXprType &dst,
const SrcXprType &src,
const InitialFunc& )
164 #ifdef EIGEN_SPARSE_ASSIGNMENT_FROM_DENSE_OP_SPARSE_PLUGIN
173 template<
typename Lhs,
typename Rhs,
typename Scalar>
179 #ifdef EIGEN_SPARSE_ASSIGNMENT_FROM_SPARSE_ADD_DENSE_PLUGIN
189 template<
typename Lhs,
typename Rhs,
typename Scalar>
195 #ifdef EIGEN_SPARSE_ASSIGNMENT_FROM_SPARSE_SUB_DENSE_PLUGIN
205 #define EIGEN_CATCH_ASSIGN_DENSE_OP_SPARSE(ASSIGN_OP,BINOP,ASSIGN_OP2) \
206 template< typename DstXprType, typename Lhs, typename Rhs, typename Scalar> \
207 struct Assignment<DstXprType, CwiseBinaryOp<internal::BINOP<Scalar,Scalar>, const Lhs, const Rhs>, internal::ASSIGN_OP<typename DstXprType::Scalar,Scalar>, \
209 typename internal::enable_if< internal::is_same<typename internal::evaluator_traits<Lhs>::Shape,DenseShape>::value \
210 || internal::is_same<typename internal::evaluator_traits<Rhs>::Shape,DenseShape>::value>::type> \
211 : assignment_from_dense_op_sparse<DstXprType, internal::ASSIGN_OP<typename DstXprType::Scalar,typename Lhs::Scalar>, internal::ASSIGN_OP2<typename DstXprType::Scalar,typename Rhs::Scalar> > \
225 template<
typename DstXprType,
typename DecType,
typename RhsType,
typename Scalar>
233 if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
234 dst.resize(dstRows, dstCols);
236 src.
dec()._solve_impl(src.
rhs(), dst);
244 template<
typename DstXprType,
typename SrcXprType,
typename Functor>
250 template<
int Options,
typename AssignFunc>
254 template<
typename DstDerived>
256 { dst.
derived().diagonal() = src.diagonal(); }
258 template<
typename DstDerived>
260 { dst.
derived().diagonal() += src.diagonal(); }
262 template<
typename DstDerived>
264 { dst.
derived().diagonal() -= src.diagonal(); }
270 #endif // EIGEN_SPARSEASSIGN_H
Solve< DecType, RhsType > SrcXprType
#define EIGEN_DEVICE_FUNC
void assignDiagonal(const DiagXpr diagXpr, const Func &assignFunc)
static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op< Scalar, Scalar > &)
Namespace containing all symbols from the Eigen library.
A versatible sparse matrix representation.
Generic expression where a coefficient-wise binary operator is applied to two expressions.
const unsigned int RowMajorBit
void assign_sparse_to_sparse(DstXprType &dst, const SrcXprType &src)
Derived & operator=(const EigenBase< OtherDerived > &other)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_assignment_no_alias(Dst &dst, const Src &src, const Func &func)
const EIGEN_DEVICE_FUNC Decomposition & dec() const
const EIGEN_DEVICE_FUNC RhsType & rhs() const
DstXprType::StorageIndex StorageIndex
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const InitialFunc &)
DstXprType::Scalar Scalar
#define EIGEN_SPARSE_ASSIGNMENT_FROM_SPARSE_SUB_DENSE_PLUGIN
#define EIGEN_STRONG_INLINE
static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op< typename DstXprType::Scalar, typename SrcXprType::Scalar > &)
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::enable_if< internal::is_same< typename internal::evaluator_traits< Rhs >::Shape, DenseShape >::value >::type run(DstXprType &dst, const CwiseBinaryOp< internal::scalar_sum_op< Scalar, Scalar >, const Lhs, const Rhs > &src, const internal::assign_op< typename DstXprType::Scalar, Scalar > &)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize_if_allowed(DstXprType &dst, const SrcXprType &src, const Functor &)
Pseudo expression representing a solving operation.
static void run(DstXprType &dst, const SrcXprType &src, const Functor &func)
static void run(SparseMatrixBase< DstDerived > &dst, const SrcXprType &src, const internal::sub_assign_op< typename DstXprType::Scalar, typename SrcXprType::Scalar > &)
Array< int, Dynamic, 1 > v
Base class of any sparse matrices or sparse expressions.
const Derived & derived() const
static void run(SparseMatrix< Scalar, Options, StorageIndex > &dst, const SrcXprType &src, const AssignFunc &func)
#define EIGEN_SPARSE_ASSIGNMENT_FROM_SPARSE_ADD_DENSE_PLUGIN
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
const int OuterRandomAccessPattern
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::enable_if< internal::is_same< typename internal::evaluator_traits< Rhs >::Shape, DenseShape >::value >::type run(DstXprType &dst, const CwiseBinaryOp< internal::scalar_difference_op< Scalar, Scalar >, const Lhs, const Rhs > &src, const internal::assign_op< typename DstXprType::Scalar, Scalar > &)
static void run(SparseMatrixBase< DstDerived > &dst, const SrcXprType &src, const internal::add_assign_op< typename DstXprType::Scalar, typename SrcXprType::Scalar > &)
static void run(SparseMatrixBase< DstDerived > &dst, const SrcXprType &src, const internal::assign_op< typename DstXprType::Scalar, typename SrcXprType::Scalar > &)
EIGEN_CATCH_ASSIGN_DENSE_OP_SPARSE(assign_op, scalar_sum_op, add_assign_op)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
#define EIGEN_SPARSE_ASSIGNMENT_FROM_DENSE_OP_SPARSE_PLUGIN
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:35:33