10#ifndef EIGEN_SPARSE_CWISE_BINARY_OP_H
11#define EIGEN_SPARSE_CWISE_BINARY_OP_H
13#include "./InternalHeaderCheck.h"
37template<
typename BinaryOp,
typename Lhs,
typename Rhs>
38class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Sparse>
39 :
public SparseMatrixBase<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
42 typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived;
43 typedef SparseMatrixBase<Derived> Base;
44 EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
46 (!internal::is_same<
typename internal::traits<Lhs>::StorageKind,
47 typename internal::traits<Rhs>::StorageKind>::value)
49 THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH)
56template<
typename XprType>
struct binary_sparse_evaluator;
58template<
typename BinaryOp,
typename Lhs,
typename Rhs>
59struct binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>, IteratorBased, IteratorBased>
60 : evaluator_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
63 typedef typename evaluator<Lhs>::InnerIterator LhsIterator;
64 typedef typename evaluator<Rhs>::InnerIterator RhsIterator;
65 typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> XprType;
66 typedef typename traits<XprType>::Scalar Scalar;
67 typedef typename XprType::StorageIndex StorageIndex;
74 EIGEN_STRONG_INLINE InnerIterator(
const binary_evaluator& aEval,
Index outer)
75 : m_lhsIter(aEval.m_lhsImpl,outer), m_rhsIter(aEval.m_rhsImpl,outer), m_functor(aEval.m_functor)
80 EIGEN_STRONG_INLINE InnerIterator& operator++()
82 if (m_lhsIter && m_rhsIter && (m_lhsIter.index() == m_rhsIter.index()))
84 m_id = m_lhsIter.index();
85 m_value = m_functor(m_lhsIter.value(), m_rhsIter.value());
89 else if (m_lhsIter && (!m_rhsIter || (m_lhsIter.index() < m_rhsIter.index())))
91 m_id = m_lhsIter.index();
92 m_value = m_functor(m_lhsIter.value(), Scalar(0));
95 else if (m_rhsIter && (!m_lhsIter || (m_lhsIter.index() > m_rhsIter.index())))
97 m_id = m_rhsIter.index();
98 m_value = m_functor(Scalar(0), m_rhsIter.value());
109 EIGEN_STRONG_INLINE Scalar value()
const {
return m_value; }
111 EIGEN_STRONG_INLINE StorageIndex index()
const {
return m_id; }
112 EIGEN_STRONG_INLINE
Index outer()
const {
return m_lhsIter.outer(); }
113 EIGEN_STRONG_INLINE
Index row()
const {
return Lhs::IsRowMajor ? m_lhsIter.row() : index(); }
114 EIGEN_STRONG_INLINE
Index col()
const {
return Lhs::IsRowMajor ? index() : m_lhsIter.col(); }
116 EIGEN_STRONG_INLINE
operator bool()
const {
return m_id>=0; }
119 LhsIterator m_lhsIter;
120 RhsIterator m_rhsIter;
121 const BinaryOp& m_functor;
128 CoeffReadCost = int(evaluator<Lhs>::CoeffReadCost) + int(evaluator<Rhs>::CoeffReadCost) + int(functor_traits<BinaryOp>::Cost),
129 Flags = XprType::Flags
132 explicit binary_evaluator(
const XprType& xpr)
133 : m_functor(xpr.functor()),
134 m_lhsImpl(xpr.lhs()),
137 EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<BinaryOp>::Cost);
138 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
141 inline Index nonZerosEstimate()
const {
142 return m_lhsImpl.nonZerosEstimate() + m_rhsImpl.nonZerosEstimate();
146 const BinaryOp m_functor;
147 evaluator<Lhs> m_lhsImpl;
148 evaluator<Rhs> m_rhsImpl;
152template<
typename BinaryOp,
typename Lhs,
typename Rhs>
153struct binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>, IndexBased, IteratorBased>
154 : evaluator_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
157 typedef typename evaluator<Rhs>::InnerIterator RhsIterator;
158 typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> XprType;
159 typedef typename traits<XprType>::Scalar Scalar;
160 typedef typename XprType::StorageIndex StorageIndex;
168 EIGEN_STRONG_INLINE InnerIterator(
const binary_evaluator& aEval,
Index outer)
169 : 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())
174 EIGEN_STRONG_INLINE InnerIterator& operator++()
179 Scalar lhsVal = m_lhsEval.coeff(IsRowMajor?m_rhsIter.outer():m_id,
180 IsRowMajor?m_id:m_rhsIter.outer());
181 if(m_rhsIter && m_rhsIter.index()==m_id)
183 m_value = m_functor(lhsVal, m_rhsIter.value());
187 m_value = m_functor(lhsVal, Scalar(0));
193 EIGEN_STRONG_INLINE Scalar value()
const { eigen_internal_assert(m_id<m_innerSize);
return m_value; }
195 EIGEN_STRONG_INLINE StorageIndex index()
const {
return m_id; }
196 EIGEN_STRONG_INLINE
Index outer()
const {
return m_rhsIter.outer(); }
197 EIGEN_STRONG_INLINE
Index row()
const {
return IsRowMajor ? m_rhsIter.outer() : m_id; }
198 EIGEN_STRONG_INLINE
Index col()
const {
return IsRowMajor ? m_id : m_rhsIter.outer(); }
200 EIGEN_STRONG_INLINE
operator bool()
const {
return m_id<m_innerSize; }
203 const evaluator<Lhs> &m_lhsEval;
204 RhsIterator m_rhsIter;
205 const BinaryOp& m_functor;
208 StorageIndex m_innerSize;
213 CoeffReadCost = int(evaluator<Lhs>::CoeffReadCost) + int(evaluator<Rhs>::CoeffReadCost) + int(functor_traits<BinaryOp>::Cost),
214 Flags = XprType::Flags
217 explicit binary_evaluator(
const XprType& xpr)
218 : m_functor(xpr.functor()),
219 m_lhsImpl(xpr.lhs()),
220 m_rhsImpl(xpr.rhs()),
223 EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<BinaryOp>::Cost);
224 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
227 inline Index nonZerosEstimate()
const {
228 return m_expr.size();
232 const BinaryOp m_functor;
233 evaluator<Lhs> m_lhsImpl;
234 evaluator<Rhs> m_rhsImpl;
235 const XprType &m_expr;
239template<
typename BinaryOp,
typename Lhs,
typename Rhs>
240struct binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>, IteratorBased, IndexBased>
241 : evaluator_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
244 typedef typename evaluator<Lhs>::InnerIterator LhsIterator;
245 typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> XprType;
246 typedef typename traits<XprType>::Scalar Scalar;
247 typedef typename XprType::StorageIndex StorageIndex;
255 EIGEN_STRONG_INLINE InnerIterator(
const binary_evaluator& aEval,
Index outer)
256 : 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())
261 EIGEN_STRONG_INLINE InnerIterator& operator++()
266 Scalar rhsVal = m_rhsEval.coeff(IsRowMajor?m_lhsIter.outer():m_id,
267 IsRowMajor?m_id:m_lhsIter.outer());
268 if(m_lhsIter && m_lhsIter.index()==m_id)
270 m_value = m_functor(m_lhsIter.value(), rhsVal);
274 m_value = m_functor(Scalar(0),rhsVal);
280 EIGEN_STRONG_INLINE Scalar value()
const { eigen_internal_assert(m_id<m_innerSize);
return m_value; }
282 EIGEN_STRONG_INLINE StorageIndex index()
const {
return m_id; }
283 EIGEN_STRONG_INLINE
Index outer()
const {
return m_lhsIter.outer(); }
284 EIGEN_STRONG_INLINE
Index row()
const {
return IsRowMajor ? m_lhsIter.outer() : m_id; }
285 EIGEN_STRONG_INLINE
Index col()
const {
return IsRowMajor ? m_id : m_lhsIter.outer(); }
287 EIGEN_STRONG_INLINE
operator bool()
const {
return m_id<m_innerSize; }
290 LhsIterator m_lhsIter;
291 const evaluator<Rhs> &m_rhsEval;
292 const BinaryOp& m_functor;
295 StorageIndex m_innerSize;
300 CoeffReadCost = int(evaluator<Lhs>::CoeffReadCost) + int(evaluator<Rhs>::CoeffReadCost) + int(functor_traits<BinaryOp>::Cost),
301 Flags = XprType::Flags
304 explicit binary_evaluator(
const XprType& xpr)
305 : m_functor(xpr.functor()),
306 m_lhsImpl(xpr.lhs()),
307 m_rhsImpl(xpr.rhs()),
310 EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<BinaryOp>::Cost);
311 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
314 inline Index nonZerosEstimate()
const {
315 return m_expr.size();
319 const BinaryOp m_functor;
320 evaluator<Lhs> m_lhsImpl;
321 evaluator<Rhs> m_rhsImpl;
322 const XprType &m_expr;
326 typename LhsKind =
typename evaluator_traits<typename T::Lhs>::Kind,
327 typename RhsKind =
typename evaluator_traits<typename T::Rhs>::Kind,
328 typename LhsScalar =
typename traits<typename T::Lhs>::Scalar,
329 typename RhsScalar =
typename traits<typename T::Rhs>::Scalar>
struct sparse_conjunction_evaluator;
332template<
typename T1,
typename T2,
typename Lhs,
typename Rhs>
333struct binary_evaluator<CwiseBinaryOp<scalar_product_op<T1,T2>, Lhs, Rhs>, IteratorBased, IteratorBased>
334 : sparse_conjunction_evaluator<CwiseBinaryOp<scalar_product_op<T1,T2>, Lhs, Rhs> >
336 typedef CwiseBinaryOp<scalar_product_op<T1,T2>, Lhs, Rhs> XprType;
337 typedef sparse_conjunction_evaluator<XprType> Base;
338 explicit binary_evaluator(
const XprType& xpr) : Base(xpr) {}
341template<
typename T1,
typename T2,
typename Lhs,
typename Rhs>
342struct binary_evaluator<CwiseBinaryOp<scalar_product_op<T1,T2>, Lhs, Rhs>, IndexBased, IteratorBased>
343 : sparse_conjunction_evaluator<CwiseBinaryOp<scalar_product_op<T1,T2>, Lhs, Rhs> >
345 typedef CwiseBinaryOp<scalar_product_op<T1,T2>, Lhs, Rhs> XprType;
346 typedef sparse_conjunction_evaluator<XprType> Base;
347 explicit binary_evaluator(
const XprType& xpr) : Base(xpr) {}
350template<
typename T1,
typename T2,
typename Lhs,
typename Rhs>
351struct binary_evaluator<CwiseBinaryOp<scalar_product_op<T1,T2>, Lhs, Rhs>, IteratorBased, IndexBased>
352 : sparse_conjunction_evaluator<CwiseBinaryOp<scalar_product_op<T1,T2>, Lhs, Rhs> >
354 typedef CwiseBinaryOp<scalar_product_op<T1,T2>, Lhs, Rhs> XprType;
355 typedef sparse_conjunction_evaluator<XprType> Base;
356 explicit binary_evaluator(
const XprType& xpr) : Base(xpr) {}
360template<
typename T1,
typename T2,
typename Lhs,
typename Rhs>
361struct binary_evaluator<CwiseBinaryOp<scalar_quotient_op<T1,T2>, Lhs, Rhs>, IteratorBased, IndexBased>
362 : sparse_conjunction_evaluator<CwiseBinaryOp<scalar_quotient_op<T1,T2>, Lhs, Rhs> >
364 typedef CwiseBinaryOp<scalar_quotient_op<T1,T2>, Lhs, Rhs> XprType;
365 typedef sparse_conjunction_evaluator<XprType> Base;
366 explicit binary_evaluator(
const XprType& xpr) : Base(xpr) {}
370template<
typename Lhs,
typename Rhs>
371struct binary_evaluator<CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs>, IteratorBased, IteratorBased>
372 : sparse_conjunction_evaluator<CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs> >
374 typedef CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs> XprType;
375 typedef sparse_conjunction_evaluator<XprType> Base;
376 explicit binary_evaluator(
const XprType& xpr) : Base(xpr) {}
379template<
typename Lhs,
typename Rhs>
380struct binary_evaluator<CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs>, IndexBased, IteratorBased>
381 : sparse_conjunction_evaluator<CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs> >
383 typedef CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs> XprType;
384 typedef sparse_conjunction_evaluator<XprType> Base;
385 explicit binary_evaluator(
const XprType& xpr) : Base(xpr) {}
388template<
typename Lhs,
typename Rhs>
389struct binary_evaluator<CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs>, IteratorBased, IndexBased>
390 : sparse_conjunction_evaluator<CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs> >
392 typedef CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs> XprType;
393 typedef sparse_conjunction_evaluator<XprType> Base;
394 explicit binary_evaluator(
const XprType& xpr) : Base(xpr) {}
398template<
typename XprType>
399struct sparse_conjunction_evaluator<XprType, IteratorBased, IteratorBased>
400 : evaluator_base<XprType>
403 typedef typename XprType::Functor BinaryOp;
404 typedef typename XprType::Lhs LhsArg;
405 typedef typename XprType::Rhs RhsArg;
406 typedef typename evaluator<LhsArg>::InnerIterator LhsIterator;
407 typedef typename evaluator<RhsArg>::InnerIterator RhsIterator;
408 typedef typename XprType::StorageIndex StorageIndex;
409 typedef typename traits<XprType>::Scalar Scalar;
416 EIGEN_STRONG_INLINE InnerIterator(
const sparse_conjunction_evaluator& aEval,
Index outer)
417 : m_lhsIter(aEval.m_lhsImpl,outer), m_rhsIter(aEval.m_rhsImpl,outer), m_functor(aEval.m_functor)
419 while (m_lhsIter && m_rhsIter && (m_lhsIter.index() != m_rhsIter.index()))
421 if (m_lhsIter.index() < m_rhsIter.index())
428 EIGEN_STRONG_INLINE InnerIterator& operator++()
432 while (m_lhsIter && m_rhsIter && (m_lhsIter.index() != m_rhsIter.index()))
434 if (m_lhsIter.index() < m_rhsIter.index())
442 EIGEN_STRONG_INLINE Scalar value()
const {
return m_functor(m_lhsIter.value(), m_rhsIter.value()); }
444 EIGEN_STRONG_INLINE StorageIndex index()
const {
return m_lhsIter.index(); }
445 EIGEN_STRONG_INLINE
Index outer()
const {
return m_lhsIter.outer(); }
446 EIGEN_STRONG_INLINE
Index row()
const {
return m_lhsIter.row(); }
447 EIGEN_STRONG_INLINE
Index col()
const {
return m_lhsIter.col(); }
449 EIGEN_STRONG_INLINE
operator bool()
const {
return (m_lhsIter && m_rhsIter); }
452 LhsIterator m_lhsIter;
453 RhsIterator m_rhsIter;
454 const BinaryOp& m_functor;
459 CoeffReadCost = int(evaluator<LhsArg>::CoeffReadCost) + int(evaluator<RhsArg>::CoeffReadCost) + int(functor_traits<BinaryOp>::Cost),
460 Flags = XprType::Flags
463 explicit sparse_conjunction_evaluator(
const XprType& xpr)
464 : m_functor(xpr.functor()),
465 m_lhsImpl(xpr.lhs()),
468 EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<BinaryOp>::Cost);
469 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
472 inline Index nonZerosEstimate()
const {
473 return (std::min)(m_lhsImpl.nonZerosEstimate(), m_rhsImpl.nonZerosEstimate());
477 const BinaryOp m_functor;
478 evaluator<LhsArg> m_lhsImpl;
479 evaluator<RhsArg> m_rhsImpl;
483template<
typename XprType>
484struct sparse_conjunction_evaluator<XprType, IndexBased, IteratorBased>
485 : evaluator_base<XprType>
488 typedef typename XprType::Functor BinaryOp;
489 typedef typename XprType::Lhs LhsArg;
490 typedef typename XprType::Rhs RhsArg;
491 typedef evaluator<LhsArg> LhsEvaluator;
492 typedef typename evaluator<RhsArg>::InnerIterator RhsIterator;
493 typedef typename XprType::StorageIndex StorageIndex;
494 typedef typename traits<XprType>::Scalar Scalar;
503 EIGEN_STRONG_INLINE InnerIterator(
const sparse_conjunction_evaluator& aEval,
Index outer)
504 : m_lhsEval(aEval.m_lhsImpl), m_rhsIter(aEval.m_rhsImpl,outer), m_functor(aEval.m_functor), m_outer(outer)
507 EIGEN_STRONG_INLINE InnerIterator& operator++()
513 EIGEN_STRONG_INLINE Scalar value()
const
514 {
return m_functor(m_lhsEval.coeff(IsRowMajor?m_outer:m_rhsIter.index(),IsRowMajor?m_rhsIter.index():m_outer), m_rhsIter.value()); }
516 EIGEN_STRONG_INLINE StorageIndex index()
const {
return m_rhsIter.index(); }
517 EIGEN_STRONG_INLINE
Index outer()
const {
return m_rhsIter.outer(); }
518 EIGEN_STRONG_INLINE
Index row()
const {
return m_rhsIter.row(); }
519 EIGEN_STRONG_INLINE
Index col()
const {
return m_rhsIter.col(); }
521 EIGEN_STRONG_INLINE
operator bool()
const {
return m_rhsIter; }
524 const LhsEvaluator &m_lhsEval;
525 RhsIterator m_rhsIter;
526 const BinaryOp& m_functor;
532 CoeffReadCost = int(evaluator<LhsArg>::CoeffReadCost) + int(evaluator<RhsArg>::CoeffReadCost) + int(functor_traits<BinaryOp>::Cost),
533 Flags = XprType::Flags
536 explicit sparse_conjunction_evaluator(
const XprType& xpr)
537 : m_functor(xpr.functor()),
538 m_lhsImpl(xpr.lhs()),
541 EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<BinaryOp>::Cost);
542 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
545 inline Index nonZerosEstimate()
const {
546 return m_rhsImpl.nonZerosEstimate();
550 const BinaryOp m_functor;
551 evaluator<LhsArg> m_lhsImpl;
552 evaluator<RhsArg> m_rhsImpl;
556template<
typename XprType>
557struct sparse_conjunction_evaluator<XprType, IteratorBased, IndexBased>
558 : evaluator_base<XprType>
561 typedef typename XprType::Functor BinaryOp;
562 typedef typename XprType::Lhs LhsArg;
563 typedef typename XprType::Rhs RhsArg;
564 typedef typename evaluator<LhsArg>::InnerIterator LhsIterator;
565 typedef evaluator<RhsArg> RhsEvaluator;
566 typedef typename XprType::StorageIndex StorageIndex;
567 typedef typename traits<XprType>::Scalar Scalar;
576 EIGEN_STRONG_INLINE InnerIterator(
const sparse_conjunction_evaluator& aEval,
Index outer)
577 : m_lhsIter(aEval.m_lhsImpl,outer), m_rhsEval(aEval.m_rhsImpl), m_functor(aEval.m_functor), m_outer(outer)
580 EIGEN_STRONG_INLINE InnerIterator& operator++()
586 EIGEN_STRONG_INLINE Scalar value()
const
587 {
return m_functor(m_lhsIter.value(),
588 m_rhsEval.coeff(IsRowMajor?m_outer:m_lhsIter.index(),IsRowMajor?m_lhsIter.index():m_outer)); }
590 EIGEN_STRONG_INLINE StorageIndex index()
const {
return m_lhsIter.index(); }
591 EIGEN_STRONG_INLINE
Index outer()
const {
return m_lhsIter.outer(); }
592 EIGEN_STRONG_INLINE
Index row()
const {
return m_lhsIter.row(); }
593 EIGEN_STRONG_INLINE
Index col()
const {
return m_lhsIter.col(); }
595 EIGEN_STRONG_INLINE
operator bool()
const {
return m_lhsIter; }
598 LhsIterator m_lhsIter;
599 const evaluator<RhsArg> &m_rhsEval;
600 const BinaryOp& m_functor;
606 CoeffReadCost = int(evaluator<LhsArg>::CoeffReadCost) + int(evaluator<RhsArg>::CoeffReadCost) + int(functor_traits<BinaryOp>::Cost),
607 Flags = XprType::Flags
610 explicit sparse_conjunction_evaluator(
const XprType& xpr)
611 : m_functor(xpr.functor()),
612 m_lhsImpl(xpr.lhs()),
615 EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<BinaryOp>::Cost);
616 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
619 inline Index nonZerosEstimate()
const {
620 return m_lhsImpl.nonZerosEstimate();
624 const BinaryOp m_functor;
625 evaluator<LhsArg> m_lhsImpl;
626 evaluator<RhsArg> m_rhsImpl;
635template<
typename Derived>
636template<
typename OtherDerived>
637Derived& SparseMatrixBase<Derived>::operator+=(
const EigenBase<OtherDerived> &other)
639 call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());
643template<
typename Derived>
644template<
typename OtherDerived>
645Derived& SparseMatrixBase<Derived>::operator-=(
const EigenBase<OtherDerived> &other)
647 call_assignment(derived(), other.derived(), internal::assign_op<Scalar,typename OtherDerived::Scalar>());
651template<
typename Derived>
652template<
typename OtherDerived>
653EIGEN_STRONG_INLINE Derived &
654SparseMatrixBase<Derived>::operator-=(
const SparseMatrixBase<OtherDerived> &other)
656 return derived() = derived() - other.derived();
659template<
typename Derived>
660template<
typename OtherDerived>
661EIGEN_STRONG_INLINE Derived &
662SparseMatrixBase<Derived>::operator+=(
const SparseMatrixBase<OtherDerived>& other)
664 return derived() = derived() + other.derived();
667template<
typename Derived>
668template<
typename OtherDerived>
669Derived& SparseMatrixBase<Derived>::operator+=(
const DiagonalBase<OtherDerived>& other)
671 call_assignment_no_alias(derived(), other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());
675template<
typename Derived>
676template<
typename OtherDerived>
677Derived& SparseMatrixBase<Derived>::operator-=(
const DiagonalBase<OtherDerived>& other)
679 call_assignment_no_alias(derived(), other.derived(), internal::sub_assign_op<Scalar,typename OtherDerived::Scalar>());
683template<
typename Derived>
684template<
typename OtherDerived>
685EIGEN_STRONG_INLINE
const typename SparseMatrixBase<Derived>::template CwiseProductDenseReturnType<OtherDerived>::Type
686SparseMatrixBase<Derived>::cwiseProduct(
const MatrixBase<OtherDerived> &other)
const
688 return typename CwiseProductDenseReturnType<OtherDerived>::Type(derived(), other.derived());
691template<
typename DenseDerived,
typename SparseDerived>
692EIGEN_STRONG_INLINE
const CwiseBinaryOp<internal::scalar_sum_op<typename DenseDerived::Scalar,typename SparseDerived::Scalar>,
const DenseDerived,
const SparseDerived>
693operator+(
const MatrixBase<DenseDerived> &a,
const SparseMatrixBase<SparseDerived> &b)
695 return CwiseBinaryOp<internal::scalar_sum_op<typename DenseDerived::Scalar,typename SparseDerived::Scalar>,
const DenseDerived,
const SparseDerived>(a.derived(), b.derived());
698template<
typename SparseDerived,
typename DenseDerived>
699EIGEN_STRONG_INLINE
const CwiseBinaryOp<internal::scalar_sum_op<typename SparseDerived::Scalar,typename DenseDerived::Scalar>,
const SparseDerived,
const DenseDerived>
700operator+(
const SparseMatrixBase<SparseDerived> &a,
const MatrixBase<DenseDerived> &b)
702 return CwiseBinaryOp<internal::scalar_sum_op<typename SparseDerived::Scalar,typename DenseDerived::Scalar>,
const SparseDerived,
const DenseDerived>(a.derived(), b.derived());
705template<
typename DenseDerived,
typename SparseDerived>
706EIGEN_STRONG_INLINE
const CwiseBinaryOp<internal::scalar_difference_op<typename DenseDerived::Scalar,typename SparseDerived::Scalar>,
const DenseDerived,
const SparseDerived>
707operator-(
const MatrixBase<DenseDerived> &a,
const SparseMatrixBase<SparseDerived> &b)
709 return CwiseBinaryOp<internal::scalar_difference_op<typename DenseDerived::Scalar,typename SparseDerived::Scalar>,
const DenseDerived,
const SparseDerived>(a.derived(), b.derived());
712template<
typename SparseDerived,
typename DenseDerived>
713EIGEN_STRONG_INLINE
const CwiseBinaryOp<internal::scalar_difference_op<typename SparseDerived::Scalar,typename DenseDerived::Scalar>,
const SparseDerived,
const DenseDerived>
714operator-(
const SparseMatrixBase<SparseDerived> &a,
const MatrixBase<DenseDerived> &b)
716 return CwiseBinaryOp<internal::scalar_difference_op<typename SparseDerived::Scalar,typename DenseDerived::Scalar>,
const SparseDerived,
const DenseDerived>(a.derived(), b.derived());
const unsigned int RowMajorBit
Definition: Constants.h:68
Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:59