10 #ifndef EIGEN_SPARSE_CWISE_BINARY_OP_H 11 #define EIGEN_SPARSE_CWISE_BINARY_OP_H 35 template<
typename BinaryOp,
typename Lhs,
typename Rhs>
36 class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Sparse>
37 :
public SparseMatrixBase<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
40 typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived;
41 typedef SparseMatrixBase<Derived> Base;
42 EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
46 (!internal::is_same<
typename internal::traits<Lhs>::StorageKind,
47 typename internal::traits<Rhs>::StorageKind>::value)
48 || ((Lhs::Flags&
RowMajorBit) == (Rhs::Flags&RowMajorBit))),
49 THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH);
57 template<
typename XprType>
struct binary_sparse_evaluator;
59 template<
typename BinaryOp,
typename Lhs,
typename Rhs>
60 struct binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>, IteratorBased, IteratorBased>
61 : evaluator_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
64 typedef typename evaluator<Lhs>::InnerIterator LhsIterator;
65 typedef typename evaluator<Rhs>::InnerIterator RhsIterator;
66 typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> XprType;
67 typedef typename traits<XprType>::Scalar Scalar;
68 typedef typename XprType::StorageIndex StorageIndex;
75 EIGEN_STRONG_INLINE InnerIterator(
const binary_evaluator& aEval,
Index outer)
76 : m_lhsIter(aEval.m_lhsImpl,outer), m_rhsIter(aEval.m_rhsImpl,outer), m_functor(aEval.m_functor)
81 EIGEN_STRONG_INLINE InnerIterator& operator++()
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());
110 EIGEN_STRONG_INLINE Scalar value()
const {
return m_value; }
112 EIGEN_STRONG_INLINE StorageIndex index()
const {
return m_id; }
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 = evaluator<Lhs>::CoeffReadCost + evaluator<Rhs>::CoeffReadCost + 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;
152 template<
typename BinaryOp,
typename Lhs,
typename Rhs>
153 struct 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 row()
const {
return IsRowMajor ? m_rhsIter.outer() : m_id; }
197 EIGEN_STRONG_INLINE
Index col()
const {
return IsRowMajor ? m_id : m_rhsIter.outer(); }
199 EIGEN_STRONG_INLINE
operator bool()
const {
return m_id<m_innerSize; }
202 const evaluator<Lhs> &m_lhsEval;
203 RhsIterator m_rhsIter;
204 const BinaryOp& m_functor;
207 StorageIndex m_innerSize;
212 CoeffReadCost = evaluator<Lhs>::CoeffReadCost + evaluator<Rhs>::CoeffReadCost + functor_traits<BinaryOp>::Cost,
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;
239 template<
typename BinaryOp,
typename Lhs,
typename Rhs>
240 struct 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 row()
const {
return IsRowMajor ? m_lhsIter.outer() : m_id; }
284 EIGEN_STRONG_INLINE
Index col()
const {
return IsRowMajor ? m_id : m_lhsIter.outer(); }
286 EIGEN_STRONG_INLINE
operator bool()
const {
return m_id<m_innerSize; }
289 LhsIterator m_lhsIter;
290 const evaluator<Rhs> &m_rhsEval;
291 const BinaryOp& m_functor;
294 StorageIndex m_innerSize;
299 CoeffReadCost = evaluator<Lhs>::CoeffReadCost + evaluator<Rhs>::CoeffReadCost + functor_traits<BinaryOp>::Cost,
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;
332 template<
typename T1,
typename T2,
typename Lhs,
typename Rhs>
333 struct 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) {}
341 template<
typename T1,
typename T2,
typename Lhs,
typename Rhs>
342 struct 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) {}
350 template<
typename T1,
typename T2,
typename Lhs,
typename Rhs>
351 struct 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) {}
360 template<
typename Lhs,
typename Rhs>
361 struct binary_evaluator<CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs>, IteratorBased, IteratorBased>
362 : sparse_conjunction_evaluator<CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs> >
364 typedef CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs> XprType;
365 typedef sparse_conjunction_evaluator<XprType> Base;
366 explicit binary_evaluator(
const XprType& xpr) : Base(xpr) {}
369 template<
typename Lhs,
typename Rhs>
370 struct binary_evaluator<CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs>, IndexBased, IteratorBased>
371 : sparse_conjunction_evaluator<CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs> >
373 typedef CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs> XprType;
374 typedef sparse_conjunction_evaluator<XprType> Base;
375 explicit binary_evaluator(
const XprType& xpr) : Base(xpr) {}
378 template<
typename Lhs,
typename Rhs>
379 struct binary_evaluator<CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs>, IteratorBased, IndexBased>
380 : sparse_conjunction_evaluator<CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs> >
382 typedef CwiseBinaryOp<scalar_boolean_and_op, Lhs, Rhs> XprType;
383 typedef sparse_conjunction_evaluator<XprType> Base;
384 explicit binary_evaluator(
const XprType& xpr) : Base(xpr) {}
388 template<
typename XprType>
389 struct sparse_conjunction_evaluator<XprType, IteratorBased, IteratorBased>
390 : evaluator_base<XprType>
393 typedef typename XprType::Functor BinaryOp;
394 typedef typename XprType::Lhs LhsArg;
395 typedef typename XprType::Rhs RhsArg;
396 typedef typename evaluator<LhsArg>::InnerIterator LhsIterator;
397 typedef typename evaluator<RhsArg>::InnerIterator RhsIterator;
398 typedef typename XprType::StorageIndex StorageIndex;
399 typedef typename traits<XprType>::Scalar Scalar;
406 EIGEN_STRONG_INLINE InnerIterator(
const sparse_conjunction_evaluator& aEval,
Index outer)
407 : m_lhsIter(aEval.m_lhsImpl,outer), m_rhsIter(aEval.m_rhsImpl,outer), m_functor(aEval.m_functor)
409 while (m_lhsIter && m_rhsIter && (m_lhsIter.index() != m_rhsIter.index()))
411 if (m_lhsIter.index() < m_rhsIter.index())
418 EIGEN_STRONG_INLINE InnerIterator& operator++()
422 while (m_lhsIter && m_rhsIter && (m_lhsIter.index() != m_rhsIter.index()))
424 if (m_lhsIter.index() < m_rhsIter.index())
432 EIGEN_STRONG_INLINE Scalar value()
const {
return m_functor(m_lhsIter.value(), m_rhsIter.value()); }
434 EIGEN_STRONG_INLINE StorageIndex index()
const {
return m_lhsIter.index(); }
435 EIGEN_STRONG_INLINE
Index row()
const {
return m_lhsIter.row(); }
436 EIGEN_STRONG_INLINE
Index col()
const {
return m_lhsIter.col(); }
438 EIGEN_STRONG_INLINE
operator bool()
const {
return (m_lhsIter && m_rhsIter); }
441 LhsIterator m_lhsIter;
442 RhsIterator m_rhsIter;
443 const BinaryOp& m_functor;
448 CoeffReadCost = evaluator<LhsArg>::CoeffReadCost + evaluator<RhsArg>::CoeffReadCost + functor_traits<BinaryOp>::Cost,
449 Flags = XprType::Flags
452 explicit sparse_conjunction_evaluator(
const XprType& xpr)
453 : m_functor(xpr.functor()),
454 m_lhsImpl(xpr.lhs()),
457 EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<BinaryOp>::Cost);
458 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
461 inline Index nonZerosEstimate()
const {
462 return (std::min)(m_lhsImpl.nonZerosEstimate(), m_rhsImpl.nonZerosEstimate());
466 const BinaryOp m_functor;
467 evaluator<LhsArg> m_lhsImpl;
468 evaluator<RhsArg> m_rhsImpl;
472 template<
typename XprType>
473 struct sparse_conjunction_evaluator<XprType, IndexBased, IteratorBased>
474 : evaluator_base<XprType>
477 typedef typename XprType::Functor BinaryOp;
478 typedef typename XprType::Lhs LhsArg;
479 typedef typename XprType::Rhs RhsArg;
480 typedef evaluator<LhsArg> LhsEvaluator;
481 typedef typename evaluator<RhsArg>::InnerIterator RhsIterator;
482 typedef typename XprType::StorageIndex StorageIndex;
483 typedef typename traits<XprType>::Scalar Scalar;
492 EIGEN_STRONG_INLINE InnerIterator(
const sparse_conjunction_evaluator& aEval,
Index outer)
493 : m_lhsEval(aEval.m_lhsImpl), m_rhsIter(aEval.m_rhsImpl,outer), m_functor(aEval.m_functor), m_outer(outer)
496 EIGEN_STRONG_INLINE InnerIterator& operator++()
502 EIGEN_STRONG_INLINE Scalar value()
const 503 {
return m_functor(m_lhsEval.coeff(IsRowMajor?m_outer:m_rhsIter.index(),IsRowMajor?m_rhsIter.index():m_outer), m_rhsIter.value()); }
505 EIGEN_STRONG_INLINE StorageIndex index()
const {
return m_rhsIter.index(); }
506 EIGEN_STRONG_INLINE
Index row()
const {
return m_rhsIter.row(); }
507 EIGEN_STRONG_INLINE
Index col()
const {
return m_rhsIter.col(); }
509 EIGEN_STRONG_INLINE
operator bool()
const {
return m_rhsIter; }
512 const LhsEvaluator &m_lhsEval;
513 RhsIterator m_rhsIter;
514 const BinaryOp& m_functor;
520 CoeffReadCost = evaluator<LhsArg>::CoeffReadCost + evaluator<RhsArg>::CoeffReadCost + functor_traits<BinaryOp>::Cost,
525 explicit sparse_conjunction_evaluator(
const XprType& xpr)
526 : m_functor(xpr.functor()),
527 m_lhsImpl(xpr.lhs()),
530 EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<BinaryOp>::Cost);
531 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
534 inline Index nonZerosEstimate()
const {
535 return m_rhsImpl.nonZerosEstimate();
539 const BinaryOp m_functor;
540 evaluator<LhsArg> m_lhsImpl;
541 evaluator<RhsArg> m_rhsImpl;
545 template<
typename XprType>
546 struct sparse_conjunction_evaluator<XprType, IteratorBased, IndexBased>
547 : evaluator_base<XprType>
550 typedef typename XprType::Functor BinaryOp;
551 typedef typename XprType::Lhs LhsArg;
552 typedef typename XprType::Rhs RhsArg;
553 typedef typename evaluator<LhsArg>::InnerIterator LhsIterator;
554 typedef evaluator<RhsArg> RhsEvaluator;
555 typedef typename XprType::StorageIndex StorageIndex;
556 typedef typename traits<XprType>::Scalar Scalar;
565 EIGEN_STRONG_INLINE InnerIterator(
const sparse_conjunction_evaluator& aEval,
Index outer)
566 : m_lhsIter(aEval.m_lhsImpl,outer), m_rhsEval(aEval.m_rhsImpl), m_functor(aEval.m_functor), m_outer(outer)
569 EIGEN_STRONG_INLINE InnerIterator& operator++()
575 EIGEN_STRONG_INLINE Scalar value()
const 576 {
return m_functor(m_lhsIter.value(),
577 m_rhsEval.coeff(IsRowMajor?m_outer:m_lhsIter.index(),IsRowMajor?m_lhsIter.index():m_outer)); }
579 EIGEN_STRONG_INLINE StorageIndex index()
const {
return m_lhsIter.index(); }
580 EIGEN_STRONG_INLINE
Index row()
const {
return m_lhsIter.row(); }
581 EIGEN_STRONG_INLINE
Index col()
const {
return m_lhsIter.col(); }
583 EIGEN_STRONG_INLINE
operator bool()
const {
return m_lhsIter; }
586 LhsIterator m_lhsIter;
587 const evaluator<RhsArg> &m_rhsEval;
588 const BinaryOp& m_functor;
594 CoeffReadCost = evaluator<LhsArg>::CoeffReadCost + evaluator<RhsArg>::CoeffReadCost + functor_traits<BinaryOp>::Cost,
599 explicit sparse_conjunction_evaluator(
const XprType& xpr)
600 : m_functor(xpr.functor()),
601 m_lhsImpl(xpr.lhs()),
604 EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<BinaryOp>::Cost);
605 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
608 inline Index nonZerosEstimate()
const {
609 return m_lhsImpl.nonZerosEstimate();
613 const BinaryOp m_functor;
614 evaluator<LhsArg> m_lhsImpl;
615 evaluator<RhsArg> m_rhsImpl;
624 template<
typename Derived>
625 template<
typename OtherDerived>
626 EIGEN_STRONG_INLINE Derived &
627 SparseMatrixBase<Derived>::operator-=(
const SparseMatrixBase<OtherDerived> &other)
629 return derived() = derived() - other.derived();
632 template<
typename Derived>
633 template<
typename OtherDerived>
634 EIGEN_STRONG_INLINE Derived &
635 SparseMatrixBase<Derived>::operator+=(
const SparseMatrixBase<OtherDerived>& other)
637 return derived() = derived() + other.derived();
640 template<
typename Derived>
641 template<
typename OtherDerived>
642 Derived& SparseMatrixBase<Derived>::operator+=(
const DiagonalBase<OtherDerived>& other)
644 call_assignment_no_alias(derived(), other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());
648 template<
typename Derived>
649 template<
typename OtherDerived>
650 Derived& SparseMatrixBase<Derived>::operator-=(
const DiagonalBase<OtherDerived>& other)
652 call_assignment_no_alias(derived(), other.derived(), internal::sub_assign_op<Scalar,typename OtherDerived::Scalar>());
656 template<
typename Derived>
657 template<
typename OtherDerived>
658 EIGEN_STRONG_INLINE
const typename SparseMatrixBase<Derived>::template CwiseProductDenseReturnType<OtherDerived>::Type
659 SparseMatrixBase<Derived>::cwiseProduct(
const MatrixBase<OtherDerived> &other)
const 661 return typename CwiseProductDenseReturnType<OtherDerived>::Type(derived(), other.derived());
664 template<
typename DenseDerived,
typename SparseDerived>
665 EIGEN_STRONG_INLINE
const CwiseBinaryOp<internal::scalar_sum_op<typename DenseDerived::Scalar,typename SparseDerived::Scalar>,
const DenseDerived,
const SparseDerived>
666 operator+(
const MatrixBase<DenseDerived> &a,
const SparseMatrixBase<SparseDerived> &b)
668 return CwiseBinaryOp<internal::scalar_sum_op<typename DenseDerived::Scalar,typename SparseDerived::Scalar>,
const DenseDerived,
const SparseDerived>(a.derived(), b.derived());
671 template<
typename SparseDerived,
typename DenseDerived>
672 EIGEN_STRONG_INLINE
const CwiseBinaryOp<internal::scalar_sum_op<typename SparseDerived::Scalar,typename DenseDerived::Scalar>,
const SparseDerived,
const DenseDerived>
673 operator+(
const SparseMatrixBase<SparseDerived> &a,
const MatrixBase<DenseDerived> &b)
675 return CwiseBinaryOp<internal::scalar_sum_op<typename SparseDerived::Scalar,typename DenseDerived::Scalar>,
const SparseDerived,
const DenseDerived>(a.derived(), b.derived());
678 template<
typename DenseDerived,
typename SparseDerived>
679 EIGEN_STRONG_INLINE
const CwiseBinaryOp<internal::scalar_difference_op<typename DenseDerived::Scalar,typename SparseDerived::Scalar>,
const DenseDerived,
const SparseDerived>
680 operator-(
const MatrixBase<DenseDerived> &a,
const SparseMatrixBase<SparseDerived> &b)
682 return CwiseBinaryOp<internal::scalar_difference_op<typename DenseDerived::Scalar,typename SparseDerived::Scalar>,
const DenseDerived,
const SparseDerived>(a.derived(), b.derived());
685 template<
typename SparseDerived,
typename DenseDerived>
686 EIGEN_STRONG_INLINE
const CwiseBinaryOp<internal::scalar_difference_op<typename SparseDerived::Scalar,typename DenseDerived::Scalar>,
const SparseDerived,
const DenseDerived>
687 operator-(
const SparseMatrixBase<SparseDerived> &a,
const MatrixBase<DenseDerived> &b)
689 return CwiseBinaryOp<internal::scalar_difference_op<typename SparseDerived::Scalar,typename DenseDerived::Scalar>,
const SparseDerived,
const DenseDerived>(a.derived(), b.derived());
694 #endif // EIGEN_SPARSE_CWISE_BINARY_OP_H Namespace containing all symbols from the Eigen library.
Definition: Core:287
const unsigned int RowMajorBit
Definition: Constants.h:61
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
Definition: Eigen_Colamd.h:50