10 #ifndef EIGEN_SPARSE_CWISE_BINARY_OP_H 11 #define EIGEN_SPARSE_CWISE_BINARY_OP_H 35 template<
typename BinaryOp,
typename Lhs,
typename Rhs>
49 THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH);
59 template<
typename BinaryOp,
typename Lhs,
typename Rhs>
76 : m_lhsIter(aEval.m_lhsImpl,outer), m_rhsIter(aEval.m_rhsImpl,outer), m_functor(aEval.m_functor)
83 if (m_lhsIter && m_rhsIter && (m_lhsIter.index() == m_rhsIter.index()))
85 m_id = m_lhsIter.
index();
86 m_value = m_functor(m_lhsIter.value(), m_rhsIter.value());
90 else if (m_lhsIter && (!m_rhsIter || (m_lhsIter.index() < m_rhsIter.index())))
92 m_id = m_lhsIter.index();
93 m_value = m_functor(m_lhsIter.value(),
Scalar(0));
96 else if (m_rhsIter && (!m_lhsIter || (m_lhsIter.index() > m_rhsIter.index())))
98 m_id = m_rhsIter.index();
99 m_value = m_functor(
Scalar(0), m_rhsIter.value());
130 Flags = XprType::Flags
134 : m_functor(xpr.functor()),
135 m_lhsImpl(xpr.lhs()),
143 return m_lhsImpl.nonZerosEstimate() + m_rhsImpl.nonZerosEstimate();
153 template<
typename BinaryOp,
typename Lhs,
typename Rhs>
170 : m_lhsEval(aEval.m_lhsImpl), m_rhsIter(aEval.m_rhsImpl,outer), m_functor(aEval.m_functor), m_value(0), m_id(-1), m_innerSize(aEval.m_expr.rhs().innerSize())
180 Scalar lhsVal = m_lhsEval.coeff(IsRowMajor?m_rhsIter.outer():m_id,
181 IsRowMajor?m_id:m_rhsIter.outer());
182 if(m_rhsIter && m_rhsIter.index()==m_id)
184 m_value = m_functor(lhsVal, m_rhsIter.value());
188 m_value = m_functor(lhsVal,
Scalar(0));
215 Flags = XprType::Flags
219 : m_functor(xpr.functor()),
220 m_lhsImpl(xpr.lhs()),
221 m_rhsImpl(xpr.rhs()),
229 return m_expr.size();
240 template<
typename BinaryOp,
typename Lhs,
typename Rhs>
257 : m_lhsIter(aEval.m_lhsImpl,outer), m_rhsEval(aEval.m_rhsImpl), m_functor(aEval.m_functor), m_value(0), m_id(-1), m_innerSize(aEval.m_expr.lhs().innerSize())
267 Scalar rhsVal = m_rhsEval.coeff(IsRowMajor?m_lhsIter.outer():m_id,
268 IsRowMajor?m_id:m_lhsIter.outer());
269 if(m_lhsIter && m_lhsIter.index()==m_id)
271 m_value = m_functor(m_lhsIter.value(), rhsVal);
275 m_value = m_functor(
Scalar(0),rhsVal);
302 Flags = XprType::Flags
306 : m_functor(xpr.functor()),
307 m_lhsImpl(xpr.lhs()),
308 m_rhsImpl(xpr.rhs()),
316 return m_expr.size();
333 template<
typename T1,
typename T2,
typename Lhs,
typename Rhs>
342 template<
typename T1,
typename T2,
typename Lhs,
typename Rhs>
351 template<
typename T1,
typename T2,
typename Lhs,
typename Rhs>
361 template<
typename T1,
typename T2,
typename Lhs,
typename Rhs>
371 template<
typename Lhs,
typename Rhs>
380 template<
typename Lhs,
typename Rhs>
389 template<
typename Lhs,
typename Rhs>
399 template<
typename XprType>
418 : m_lhsIter(aEval.m_lhsImpl,outer), m_rhsIter(aEval.m_rhsImpl,outer), m_functor(aEval.m_functor)
420 while (m_lhsIter && m_rhsIter && (m_lhsIter.index() != m_rhsIter.index()))
422 if (m_lhsIter.index() < m_rhsIter.index())
433 while (m_lhsIter && m_rhsIter && (m_lhsIter.index() != m_rhsIter.index()))
435 if (m_lhsIter.index() < m_rhsIter.index())
461 Flags = XprType::Flags
465 : m_functor(xpr.functor()),
466 m_lhsImpl(xpr.lhs()),
474 return (
std::min)(m_lhsImpl.nonZerosEstimate(), m_rhsImpl.nonZerosEstimate());
484 template<
typename XprType>
505 : m_lhsEval(aEval.m_lhsImpl), m_rhsIter(aEval.m_rhsImpl,outer), m_functor(aEval.m_functor), m_outer(outer)
515 {
return m_functor(m_lhsEval.coeff(IsRowMajor?m_outer:m_rhsIter.index(),IsRowMajor?m_rhsIter.index():m_outer), m_rhsIter.value()); }
534 Flags = XprType::Flags
538 : m_functor(xpr.functor()),
539 m_lhsImpl(xpr.lhs()),
547 return m_rhsImpl.nonZerosEstimate();
557 template<
typename XprType>
578 : m_lhsIter(aEval.m_lhsImpl,outer), m_rhsEval(aEval.m_rhsImpl), m_functor(aEval.m_functor), m_outer(outer)
588 {
return m_functor(m_lhsIter.value(),
589 m_rhsEval.coeff(IsRowMajor?m_outer:m_lhsIter.index(),IsRowMajor?m_lhsIter.index():m_outer)); }
608 Flags = XprType::Flags
612 : m_functor(xpr.functor()),
613 m_lhsImpl(xpr.lhs()),
621 return m_lhsImpl.nonZerosEstimate();
636 template<
typename Derived>
637 template<
typename OtherDerived>
644 template<
typename Derived>
645 template<
typename OtherDerived>
652 template<
typename Derived>
653 template<
typename OtherDerived>
657 return derived() = derived() - other.
derived();
660 template<
typename Derived>
661 template<
typename OtherDerived>
665 return derived() = derived() + other.
derived();
668 template<
typename Derived>
669 template<
typename OtherDerived>
676 template<
typename Derived>
677 template<
typename OtherDerived>
684 template<
typename Derived>
685 template<
typename OtherDerived>
692 template<
typename DenseDerived,
typename SparseDerived>
696 return CwiseBinaryOp<internal::scalar_sum_op<typename DenseDerived::Scalar,typename SparseDerived::Scalar>,
const DenseDerived,
const SparseDerived>(a.derived(), b.
derived());
699 template<
typename SparseDerived,
typename DenseDerived>
703 return CwiseBinaryOp<internal::scalar_sum_op<typename SparseDerived::Scalar,typename DenseDerived::Scalar>,
const SparseDerived,
const DenseDerived>(a.
derived(), b.derived());
706 template<
typename DenseDerived,
typename SparseDerived>
710 return CwiseBinaryOp<internal::scalar_difference_op<typename DenseDerived::Scalar,typename SparseDerived::Scalar>,
const DenseDerived,
const SparseDerived>(a.derived(), b.
derived());
713 template<
typename SparseDerived,
typename DenseDerived>
717 return CwiseBinaryOp<internal::scalar_difference_op<typename SparseDerived::Scalar,typename DenseDerived::Scalar>,
const SparseDerived,
const DenseDerived>(a.
derived(), b.derived());
722 #endif // EIGEN_SPARSE_CWISE_BINARY_OP_H evaluator< Lhs > m_lhsImpl
EIGEN_STRONG_INLINE Index outer() const
Index nonZerosEstimate() const
EIGEN_STRONG_INLINE Scalar value() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_assignment_no_alias(Dst &dst, const Src &src, const Func &func)
evaluator< Rhs > m_rhsImpl
EIGEN_STRONG_INLINE Index col() const
#define EIGEN_STRONG_INLINE
evaluator< Rhs > m_rhsImpl
evaluator< LhsArg > m_lhsImpl
EIGEN_STRONG_INLINE Scalar value() const
const BinaryOp & m_functor
EIGEN_STRONG_INLINE Index index() const
CwiseBinaryOp< scalar_product_op< T1, T2 >, Lhs, Rhs > XprType
Index nonZerosEstimate() const
EIGEN_STRONG_INLINE Scalar value() const
EIGEN_STRONG_INLINE InnerIterator(const sparse_conjunction_evaluator &aEval, Index outer)
traits< XprType >::Scalar Scalar
Index nonZerosEstimate() const
evaluator< Rhs >::InnerIterator RhsIterator
XprType::StorageIndex StorageIndex
CwiseBinaryOp< scalar_boolean_and_op, Lhs, Rhs > XprType
EIGEN_STRONG_INLINE StorageIndex index() const
sparse_conjunction_evaluator< XprType > Base
XprType::Functor BinaryOp
Derived & operator+=(const SparseMatrixBase< OtherDerived > &other)
XprType::Functor BinaryOp
Namespace containing all symbols from the Eigen library.
binary_evaluator(const XprType &xpr)
EIGEN_STRONG_INLINE InnerIterator(const sparse_conjunction_evaluator &aEval, Index outer)
sparse_conjunction_evaluator< XprType > Base
EIGEN_STRONG_INLINE Index row() const
EIGEN_STRONG_INLINE InnerIterator & operator++()
static const Pose3 T2(Rot3::Rodrigues(0.3, 0.2, 0.1), P2)
EIGEN_STRONG_INLINE const CwiseBinaryOp< internal::scalar_sum_op< typename DenseDerived::Scalar, typename SparseDerived::Scalar >, const DenseDerived, const SparseDerived > operator+(const MatrixBase< DenseDerived > &a, const SparseMatrixBase< SparseDerived > &b)
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
EIGEN_STRONG_INLINE InnerIterator & operator++()
evaluator< RhsArg > m_rhsImpl
CwiseBinaryOp< scalar_boolean_and_op, Lhs, Rhs > XprType
const evaluator< RhsArg > & m_rhsEval
Index nonZerosEstimate() const
EIGEN_STRONG_INLINE Index row() const
Index nonZerosEstimate() const
EIGEN_STRONG_INLINE StorageIndex index() const
binary_evaluator(const XprType &xpr)
const unsigned int RowMajorBit
sparse_conjunction_evaluator< XprType > Base
EIGEN_STRONG_INLINE Index col() const
EIGEN_STRONG_INLINE Index row() const
evaluator< Lhs >::InnerIterator LhsIterator
sparse_conjunction_evaluator(const XprType &xpr)
traits< XprType >::Scalar Scalar
EIGEN_STRONG_INLINE Index outer() const
XprType::StorageIndex StorageIndex
traits< XprType >::Scalar Scalar
traits< XprType >::Scalar Scalar
EIGEN_STRONG_INLINE InnerIterator(const sparse_conjunction_evaluator &aEval, Index outer)
evaluator< Rhs >::InnerIterator RhsIterator
EIGEN_STRONG_INLINE Index outer() const
EIGEN_STRONG_INLINE Index row() const
binary_evaluator(const XprType &xpr)
EIGEN_STRONG_INLINE Scalar value() const
sparse_conjunction_evaluator< XprType > Base
#define EIGEN_INTERNAL_CHECK_COST_VALUE(C)
Generic expression where a coefficient-wise binary operator is applied to two expressions.
const BinaryOp & m_functor
const LhsEvaluator & m_lhsEval
EIGEN_STRONG_INLINE Index col() const
#define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
evaluator< LhsArg > LhsEvaluator
EIGEN_STRONG_INLINE StorageIndex index() const
EIGEN_STRONG_INLINE Index outer() const
binary_evaluator(const XprType &xpr)
const BinaryOp & m_functor
binary_evaluator(const XprType &xpr)
Base class of any sparse matrices or sparse expressions.
EIGEN_STRONG_INLINE const CwiseProductDenseReturnType< OtherDerived >::Type cwiseProduct(const MatrixBase< OtherDerived > &other) const
CwiseBinaryOp< BinaryOp, Lhs, Rhs > XprType
EIGEN_STRONG_INLINE InnerIterator(const binary_evaluator &aEval, Index outer)
XprType::StorageIndex StorageIndex
const evaluator< Rhs > & m_rhsEval
CwiseBinaryOp< scalar_quotient_op< T1, T2 >, Lhs, Rhs > XprType
EIGEN_STRONG_INLINE Index col() const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
evaluator< LhsArg >::InnerIterator LhsIterator
XprType::StorageIndex StorageIndex
Eigen::Triplet< double > T
const BinaryOp & m_functor
EIGEN_STRONG_INLINE Scalar value() const
binary_evaluator(const XprType &xpr)
sparse_conjunction_evaluator< XprType > Base
EIGEN_STRONG_INLINE Index row() const
EIGEN_STRONG_INLINE const CwiseBinaryOp< internal::scalar_difference_op< typename DenseDerived::Scalar, typename SparseDerived::Scalar >, const DenseDerived, const SparseDerived > operator-(const MatrixBase< DenseDerived > &a, const SparseMatrixBase< SparseDerived > &b)
sparse_conjunction_evaluator(const XprType &xpr)
EIGEN_STRONG_INLINE InnerIterator(const binary_evaluator &aEval, Index outer)
evaluator< RhsArg > m_rhsImpl
EIGEN_STRONG_INLINE Index outer() const
evaluator< Lhs >::InnerIterator LhsIterator
CwiseBinaryOp< scalar_boolean_and_op, Lhs, Rhs > XprType
const BinaryOp & m_functor
binary_evaluator(const XprType &xpr)
CwiseBinaryOp< BinaryOp, Lhs, Rhs > XprType
sparse_conjunction_evaluator< XprType > Base
binary_evaluator(const XprType &xpr)
evaluator< RhsArg > RhsEvaluator
EIGEN_STRONG_INLINE InnerIterator & operator++()
CwiseBinaryOp< BinaryOp, Lhs, Rhs > XprType
traits< XprType >::Scalar Scalar
EIGEN_STRONG_INLINE StorageIndex index() const
XprType::StorageIndex StorageIndex
evaluator< LhsArg > m_lhsImpl
evaluator< Lhs > m_lhsImpl
EIGEN_STRONG_INLINE Index col() const
XprType::Functor BinaryOp
CwiseBinaryOp< BinaryOp, Lhs, Rhs > Derived
evaluator< RhsArg >::InnerIterator RhsIterator
XprType::StorageIndex StorageIndex
EIGEN_STRONG_INLINE InnerIterator(const binary_evaluator &aEval, Index outer)
CwiseBinaryOp< scalar_product_op< T1, T2 >, Lhs, Rhs > XprType
sparse_conjunction_evaluator< XprType > Base
static const Similarity3 T1(R, Point3(3.5, -8.2, 4.2), 1)
EIGEN_STRONG_INLINE Index col() const
evaluator< Rhs > m_rhsImpl
traits< XprType >::Scalar Scalar
binary_evaluator(const XprType &xpr)
EIGEN_STRONG_INLINE Index outer() const
Derived & operator-=(const SparseMatrixBase< OtherDerived > &other)
EIGEN_STRONG_INLINE Scalar value() const
const Derived & derived() const
SparseMatrixBase< Derived > Base
const evaluator< Lhs > & m_lhsEval
evaluator< LhsArg >::InnerIterator LhsIterator
EIGEN_STRONG_INLINE InnerIterator & operator++()
sparse_conjunction_evaluator(const XprType &xpr)
#define eigen_internal_assert(x)
evaluator< Lhs > m_lhsImpl
binary_evaluator(const XprType &xpr)
CwiseBinaryOp< scalar_product_op< T1, T2 >, Lhs, Rhs > XprType
evaluator< RhsArg > m_rhsImpl
EIGEN_STRONG_INLINE Index row() const
EIGEN_STRONG_INLINE InnerIterator & operator++()
evaluator< RhsArg >::InnerIterator RhsIterator
EIGEN_DEVICE_FUNC Derived & derived()
Base class for all dense matrices, vectors, and expressions.
EIGEN_STRONG_INLINE InnerIterator & operator++()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_assignment(Dst &dst, const Src &src)
EIGEN_STRONG_INLINE StorageIndex index() const
const BinaryOp & m_functor
Index nonZerosEstimate() const
EIGEN_STRONG_INLINE StorageIndex index() const
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 operator++(bfloat16 &a)
EIGEN_DEVICE_FUNC const Derived & derived() const
An InnerIterator allows to loop over the element of any matrix expression.
evaluator< LhsArg > m_lhsImpl