mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-23 01:59:38 +08:00
adapt CwiseBinaryOp and the Sparse counter part
This commit is contained in:
parent
1c9a2d246f
commit
63bcc1c0fb
@ -87,7 +87,7 @@ template<typename ExpressionType> class Cwise
|
|||||||
|
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
const EIGEN_CWISE_PRODUCT_RETURN_TYPE
|
const EIGEN_CWISE_PRODUCT_RETURN_TYPE
|
||||||
operator*(const MatrixBase<OtherDerived> &other) const;
|
operator*(const AnyMatrixBase<OtherDerived> &other) const;
|
||||||
|
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
const EIGEN_CWISE_BINOP_RETURN_TYPE(ei_scalar_quotient_op)
|
const EIGEN_CWISE_BINOP_RETURN_TYPE(ei_scalar_quotient_op)
|
||||||
@ -183,32 +183,4 @@ template<typename ExpressionType> class Cwise
|
|||||||
Cwise& operator=(const Cwise&);
|
Cwise& operator=(const Cwise&);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \returns a Cwise wrapper of *this providing additional coefficient-wise operations
|
|
||||||
*
|
|
||||||
* Example: \include MatrixBase_cwise_const.cpp
|
|
||||||
* Output: \verbinclude MatrixBase_cwise_const.out
|
|
||||||
*
|
|
||||||
* \sa class Cwise, cwise()
|
|
||||||
*/
|
|
||||||
template<typename Derived>
|
|
||||||
inline const Cwise<Derived>
|
|
||||||
MatrixBase<Derived>::cwise() const
|
|
||||||
{
|
|
||||||
return derived();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \returns a Cwise wrapper of *this providing additional coefficient-wise operations
|
|
||||||
*
|
|
||||||
* Example: \include MatrixBase_cwise.cpp
|
|
||||||
* Output: \verbinclude MatrixBase_cwise.out
|
|
||||||
*
|
|
||||||
* \sa class Cwise, cwise() const
|
|
||||||
*/
|
|
||||||
template<typename Derived>
|
|
||||||
inline Cwise<Derived>
|
|
||||||
MatrixBase<Derived>::cwise()
|
|
||||||
{
|
|
||||||
return derived();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // EIGEN_CWISE_H
|
#endif // EIGEN_CWISE_H
|
||||||
|
@ -78,13 +78,24 @@ struct ei_traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename BinaryOp, typename Lhs, typename Rhs, typename StorageType>
|
||||||
|
class CwiseBinaryOpImpl;
|
||||||
|
|
||||||
template<typename BinaryOp, typename Lhs, typename Rhs>
|
template<typename BinaryOp, typename Lhs, typename Rhs>
|
||||||
class CwiseBinaryOp : ei_no_assignment_operator,
|
class CwiseBinaryOp : ei_no_assignment_operator,
|
||||||
public MatrixBase<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
|
public CwiseBinaryOpImpl<
|
||||||
|
BinaryOp, Lhs, Rhs,
|
||||||
|
typename ei_promote_storage_type<typename ei_traits<Lhs>::StorageType,
|
||||||
|
typename ei_traits<Rhs>::StorageType>::ret>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseBinaryOp)
|
typedef typename CwiseBinaryOpImpl<
|
||||||
|
BinaryOp, Lhs, Rhs,
|
||||||
|
typename ei_promote_storage_type<typename ei_traits<Lhs>::StorageType,
|
||||||
|
typename ei_traits<Rhs>::StorageType>::ret>::Base Base;
|
||||||
|
EIGEN_GENERIC_PUBLIC_INTERFACE_NEW(CwiseBinaryOp)
|
||||||
|
|
||||||
typedef typename ei_traits<CwiseBinaryOp>::LhsNested LhsNested;
|
typedef typename ei_traits<CwiseBinaryOp>::LhsNested LhsNested;
|
||||||
typedef typename ei_traits<CwiseBinaryOp>::RhsNested RhsNested;
|
typedef typename ei_traits<CwiseBinaryOp>::RhsNested RhsNested;
|
||||||
typedef typename ei_traits<CwiseBinaryOp>::_LhsNested _LhsNested;
|
typedef typename ei_traits<CwiseBinaryOp>::_LhsNested _LhsNested;
|
||||||
@ -112,28 +123,6 @@ class CwiseBinaryOp : ei_no_assignment_operator,
|
|||||||
EIGEN_STRONG_INLINE int rows() const { return m_lhs.rows(); }
|
EIGEN_STRONG_INLINE int rows() const { return m_lhs.rows(); }
|
||||||
EIGEN_STRONG_INLINE int cols() const { return m_lhs.cols(); }
|
EIGEN_STRONG_INLINE int cols() const { return m_lhs.cols(); }
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE const Scalar coeff(int row, int col) const
|
|
||||||
{
|
|
||||||
return m_functor(m_lhs.coeff(row, col), m_rhs.coeff(row, col));
|
|
||||||
}
|
|
||||||
|
|
||||||
template<int LoadMode>
|
|
||||||
EIGEN_STRONG_INLINE PacketScalar packet(int row, int col) const
|
|
||||||
{
|
|
||||||
return m_functor.packetOp(m_lhs.template packet<LoadMode>(row, col), m_rhs.template packet<LoadMode>(row, col));
|
|
||||||
}
|
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE const Scalar coeff(int index) const
|
|
||||||
{
|
|
||||||
return m_functor(m_lhs.coeff(index), m_rhs.coeff(index));
|
|
||||||
}
|
|
||||||
|
|
||||||
template<int LoadMode>
|
|
||||||
EIGEN_STRONG_INLINE PacketScalar packet(int index) const
|
|
||||||
{
|
|
||||||
return m_functor.packetOp(m_lhs.template packet<LoadMode>(index), m_rhs.template packet<LoadMode>(index));
|
|
||||||
}
|
|
||||||
|
|
||||||
const _LhsNested& lhs() const { return m_lhs; }
|
const _LhsNested& lhs() const { return m_lhs; }
|
||||||
const _RhsNested& rhs() const { return m_rhs; }
|
const _RhsNested& rhs() const { return m_rhs; }
|
||||||
const BinaryOp& functor() const { return m_functor; }
|
const BinaryOp& functor() const { return m_functor; }
|
||||||
@ -144,6 +133,42 @@ class CwiseBinaryOp : ei_no_assignment_operator,
|
|||||||
const BinaryOp m_functor;
|
const BinaryOp m_functor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename BinaryOp, typename Lhs, typename Rhs>
|
||||||
|
class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Dense>
|
||||||
|
: public MatrixBase<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived;
|
||||||
|
EIGEN_DENSE_PUBLIC_INTERFACE( Derived )
|
||||||
|
|
||||||
|
EIGEN_STRONG_INLINE const Scalar coeff(int row, int col) const
|
||||||
|
{
|
||||||
|
return derived().functor()(derived().lhs().coeff(row, col),
|
||||||
|
derived().rhs().coeff(row, col));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int LoadMode>
|
||||||
|
EIGEN_STRONG_INLINE PacketScalar packet(int row, int col) const
|
||||||
|
{
|
||||||
|
return derived().functor().packetOp(derived().lhs().template packet<LoadMode>(row, col),
|
||||||
|
derived().rhs().template packet<LoadMode>(row, col));
|
||||||
|
}
|
||||||
|
|
||||||
|
EIGEN_STRONG_INLINE const Scalar coeff(int index) const
|
||||||
|
{
|
||||||
|
return derived().functor()(derived().lhs().coeff(index),
|
||||||
|
derived().rhs().coeff(index));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int LoadMode>
|
||||||
|
EIGEN_STRONG_INLINE PacketScalar packet(int index) const
|
||||||
|
{
|
||||||
|
return derived().functor().packetOp(derived().lhs().template packet<LoadMode>(index),
|
||||||
|
derived().rhs().template packet<LoadMode>(index));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**\returns an expression of the difference of \c *this and \a other
|
/**\returns an expression of the difference of \c *this and \a other
|
||||||
*
|
*
|
||||||
* \note If you want to substract a given scalar from all coefficients, see Cwise::operator-().
|
* \note If you want to substract a given scalar from all coefficients, see Cwise::operator-().
|
||||||
@ -210,7 +235,7 @@ MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other)
|
|||||||
template<typename ExpressionType>
|
template<typename ExpressionType>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_STRONG_INLINE const EIGEN_CWISE_PRODUCT_RETURN_TYPE
|
EIGEN_STRONG_INLINE const EIGEN_CWISE_PRODUCT_RETURN_TYPE
|
||||||
Cwise<ExpressionType>::operator*(const MatrixBase<OtherDerived> &other) const
|
Cwise<ExpressionType>::operator*(const AnyMatrixBase<OtherDerived> &other) const
|
||||||
{
|
{
|
||||||
return EIGEN_CWISE_PRODUCT_RETURN_TYPE(_expression(), other.derived());
|
return EIGEN_CWISE_PRODUCT_RETURN_TYPE(_expression(), other.derived());
|
||||||
}
|
}
|
||||||
|
@ -1,112 +1,114 @@
|
|||||||
|
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
/** \internal Represents a scalar multiple of a matrix */
|
|
||||||
typedef CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, Derived> ScalarMultipleReturnType;
|
/** \internal Represents a scalar multiple of a matrix */
|
||||||
/** \internal Represents a quotient of a matrix by a scalar*/
|
typedef CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, Derived> ScalarMultipleReturnType;
|
||||||
typedef CwiseUnaryOp<ei_scalar_quotient1_op<Scalar>, Derived> ScalarQuotient1ReturnType;
|
/** \internal Represents a quotient of a matrix by a scalar*/
|
||||||
/** \internal the return type of MatrixBase::conjugate() */
|
typedef CwiseUnaryOp<ei_scalar_quotient1_op<Scalar>, Derived> ScalarQuotient1ReturnType;
|
||||||
typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
|
/** \internal the return type of MatrixBase::conjugate() */
|
||||||
|
typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
|
||||||
const CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Derived>,
|
const CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Derived>,
|
||||||
const Derived&
|
const Derived&
|
||||||
>::ret ConjugateReturnType;
|
>::ret ConjugateReturnType;
|
||||||
/** \internal the return type of MatrixBase::real() const */
|
/** \internal the return type of MatrixBase::real() const */
|
||||||
typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
|
typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
|
||||||
const CwiseUnaryOp<ei_scalar_real_op<Scalar>, Derived>,
|
const CwiseUnaryOp<ei_scalar_real_op<Scalar>, Derived>,
|
||||||
const Derived&
|
const Derived&
|
||||||
>::ret RealReturnType;
|
>::ret RealReturnType;
|
||||||
/** \internal the return type of MatrixBase::real() */
|
/** \internal the return type of MatrixBase::real() */
|
||||||
typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
|
typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
|
||||||
CwiseUnaryView<ei_scalar_real_op<Scalar>, Derived>,
|
CwiseUnaryView<ei_scalar_real_op<Scalar>, Derived>,
|
||||||
Derived&
|
Derived&
|
||||||
>::ret NonConstRealReturnType;
|
>::ret NonConstRealReturnType;
|
||||||
/** \internal the return type of MatrixBase::imag() const */
|
/** \internal the return type of MatrixBase::imag() const */
|
||||||
typedef CwiseUnaryOp<ei_scalar_imag_op<Scalar>, Derived> ImagReturnType;
|
typedef CwiseUnaryOp<ei_scalar_imag_op<Scalar>, Derived> ImagReturnType;
|
||||||
/** \internal the return type of MatrixBase::imag() */
|
/** \internal the return type of MatrixBase::imag() */
|
||||||
typedef CwiseUnaryView<ei_scalar_imag_op<Scalar>, Derived> NonConstImagReturnType;
|
typedef CwiseUnaryView<ei_scalar_imag_op<Scalar>, Derived> NonConstImagReturnType;
|
||||||
|
|
||||||
#endif // not EIGEN_PARSED_BY_DOXYGEN
|
#endif // not EIGEN_PARSED_BY_DOXYGEN
|
||||||
|
|
||||||
/** \returns an expression of the opposite of \c *this
|
/** \returns an expression of the opposite of \c *this
|
||||||
*/
|
*/
|
||||||
EIGEN_STRONG_INLINE const CwiseUnaryOp<ei_scalar_opposite_op<typename ei_traits<Derived>::Scalar>,Derived>
|
EIGEN_STRONG_INLINE const CwiseUnaryOp<ei_scalar_opposite_op<typename ei_traits<Derived>::Scalar>,Derived>
|
||||||
operator-() const { return derived(); }
|
operator-() const { return derived(); }
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE Derived& operator*=(const Scalar& other)
|
EIGEN_STRONG_INLINE Derived& operator*=(const Scalar& other)
|
||||||
{ return *this = *this * other; }
|
{ return *this = *this * other; }
|
||||||
EIGEN_STRONG_INLINE Derived& operator/=(const Scalar& other)
|
EIGEN_STRONG_INLINE Derived& operator/=(const Scalar& other)
|
||||||
{ return *this = *this / other; }
|
{ return *this = *this / other; }
|
||||||
|
|
||||||
/** \returns an expression of \c *this scaled by the scalar factor \a scalar */
|
/** \returns an expression of \c *this scaled by the scalar factor \a scalar */
|
||||||
EIGEN_STRONG_INLINE const ScalarMultipleReturnType
|
EIGEN_STRONG_INLINE const ScalarMultipleReturnType
|
||||||
operator*(const Scalar& scalar) const
|
operator*(const Scalar& scalar) const
|
||||||
{
|
{
|
||||||
return CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, Derived>
|
return CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, Derived>
|
||||||
(derived(), ei_scalar_multiple_op<Scalar>(scalar));
|
(derived(), ei_scalar_multiple_op<Scalar>(scalar));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EIGEN_PARSED_BY_DOXYGEN
|
#ifdef EIGEN_PARSED_BY_DOXYGEN
|
||||||
const ScalarMultipleReturnType operator*(const RealScalar& scalar) const;
|
const ScalarMultipleReturnType operator*(const RealScalar& scalar) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** \returns an expression of \c *this divided by the scalar value \a scalar */
|
/** \returns an expression of \c *this divided by the scalar value \a scalar */
|
||||||
EIGEN_STRONG_INLINE const CwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<Derived>::Scalar>, Derived>
|
EIGEN_STRONG_INLINE const CwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<Derived>::Scalar>, Derived>
|
||||||
operator/(const Scalar& scalar) const
|
operator/(const Scalar& scalar) const
|
||||||
{
|
{
|
||||||
return CwiseUnaryOp<ei_scalar_quotient1_op<Scalar>, Derived>
|
return CwiseUnaryOp<ei_scalar_quotient1_op<Scalar>, Derived>
|
||||||
(derived(), ei_scalar_quotient1_op<Scalar>(scalar));
|
(derived(), ei_scalar_quotient1_op<Scalar>(scalar));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Overloaded for efficient real matrix times complex scalar value */
|
/** Overloaded for efficient real matrix times complex scalar value */
|
||||||
EIGEN_STRONG_INLINE const CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,std::complex<Scalar> >, Derived>
|
EIGEN_STRONG_INLINE const CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,std::complex<Scalar> >, Derived>
|
||||||
operator*(const std::complex<Scalar>& scalar) const
|
operator*(const std::complex<Scalar>& scalar) const
|
||||||
{
|
{
|
||||||
return CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,std::complex<Scalar> >, Derived>
|
return CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,std::complex<Scalar> >, Derived>
|
||||||
(*static_cast<const Derived*>(this), ei_scalar_multiple2_op<Scalar,std::complex<Scalar> >(scalar));
|
(*static_cast<const Derived*>(this), ei_scalar_multiple2_op<Scalar,std::complex<Scalar> >(scalar));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline friend const ScalarMultipleReturnType
|
inline friend const ScalarMultipleReturnType
|
||||||
operator*(const Scalar& scalar, const MatrixBase& matrix)
|
operator*(const Scalar& scalar, const Self& matrix)
|
||||||
{ return matrix*scalar; }
|
{ return matrix*scalar; }
|
||||||
|
|
||||||
inline friend const CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,std::complex<Scalar> >, Derived>
|
inline friend const CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,std::complex<Scalar> >, Derived>
|
||||||
operator*(const std::complex<Scalar>& scalar, const MatrixBase& matrix)
|
operator*(const std::complex<Scalar>& scalar, const Self& matrix)
|
||||||
{ return matrix*scalar; }
|
{ return matrix*scalar; }
|
||||||
|
|
||||||
/** \returns an expression of *this with the \a Scalar type casted to
|
/** \returns an expression of *this with the \a Scalar type casted to
|
||||||
* \a NewScalar.
|
* \a NewScalar.
|
||||||
*
|
*
|
||||||
* The template parameter \a NewScalar is the type we are casting the scalars to.
|
* The template parameter \a NewScalar is the type we are casting the scalars to.
|
||||||
*
|
*
|
||||||
* \sa class CwiseUnaryOp
|
* \sa class CwiseUnaryOp
|
||||||
*/
|
*/
|
||||||
template<typename NewType>
|
template<typename NewType>
|
||||||
typename ei_cast_return_type<Derived,const CwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived> >::type
|
typename ei_cast_return_type<Derived,const CwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived> >::type
|
||||||
cast() const
|
cast() const
|
||||||
{
|
{
|
||||||
return derived();
|
return derived();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \returns an expression of the complex conjugate of \c *this.
|
/** \returns an expression of the complex conjugate of \c *this.
|
||||||
*
|
*
|
||||||
* \sa adjoint() */
|
* \sa adjoint() */
|
||||||
EIGEN_STRONG_INLINE ConjugateReturnType
|
EIGEN_STRONG_INLINE ConjugateReturnType
|
||||||
conjugate() const
|
conjugate() const
|
||||||
{
|
{
|
||||||
return ConjugateReturnType(derived());
|
return ConjugateReturnType(derived());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \returns a read-only expression of the real part of \c *this.
|
/** \returns a read-only expression of the real part of \c *this.
|
||||||
*
|
*
|
||||||
* \sa imag() */
|
* \sa imag() */
|
||||||
EIGEN_STRONG_INLINE RealReturnType
|
EIGEN_STRONG_INLINE RealReturnType
|
||||||
real() const { return derived(); }
|
real() const { return derived(); }
|
||||||
|
|
||||||
/** \returns an read-only expression of the imaginary part of \c *this.
|
/** \returns an read-only expression of the imaginary part of \c *this.
|
||||||
*
|
*
|
||||||
* \sa real() */
|
* \sa real() */
|
||||||
EIGEN_STRONG_INLINE const ImagReturnType
|
EIGEN_STRONG_INLINE const ImagReturnType
|
||||||
imag() const { return derived(); }
|
imag() const { return derived(); }
|
||||||
|
|
||||||
/** \returns an expression of a custom coefficient-wise unary operator \a func of *this
|
/** \returns an expression of a custom coefficient-wise unary operator \a func of *this
|
||||||
*
|
*
|
||||||
* The template parameter \a CustomUnaryOp is the type of the functor
|
* The template parameter \a CustomUnaryOp is the type of the functor
|
||||||
* of the custom unary operator.
|
* of the custom unary operator.
|
||||||
@ -117,14 +119,14 @@
|
|||||||
*
|
*
|
||||||
* \sa class CwiseUnaryOp, class CwiseBinarOp, MatrixBase::operator-, Cwise::abs
|
* \sa class CwiseUnaryOp, class CwiseBinarOp, MatrixBase::operator-, Cwise::abs
|
||||||
*/
|
*/
|
||||||
template<typename CustomUnaryOp>
|
template<typename CustomUnaryOp>
|
||||||
EIGEN_STRONG_INLINE const CwiseUnaryOp<CustomUnaryOp, Derived>
|
EIGEN_STRONG_INLINE const CwiseUnaryOp<CustomUnaryOp, Derived>
|
||||||
unaryExpr(const CustomUnaryOp& func = CustomUnaryOp()) const
|
unaryExpr(const CustomUnaryOp& func = CustomUnaryOp()) const
|
||||||
{
|
{
|
||||||
return CwiseUnaryOp<CustomUnaryOp, Derived>(derived(), func);
|
return CwiseUnaryOp<CustomUnaryOp, Derived>(derived(), func);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \returns an expression of a custom coefficient-wise unary operator \a func of *this
|
/** \returns an expression of a custom coefficient-wise unary operator \a func of *this
|
||||||
*
|
*
|
||||||
* The template parameter \a CustomUnaryOp is the type of the functor
|
* The template parameter \a CustomUnaryOp is the type of the functor
|
||||||
* of the custom unary operator.
|
* of the custom unary operator.
|
||||||
@ -135,24 +137,45 @@
|
|||||||
*
|
*
|
||||||
* \sa class CwiseUnaryOp, class CwiseBinarOp, MatrixBase::operator-, Cwise::abs
|
* \sa class CwiseUnaryOp, class CwiseBinarOp, MatrixBase::operator-, Cwise::abs
|
||||||
*/
|
*/
|
||||||
template<typename CustomViewOp>
|
template<typename CustomViewOp>
|
||||||
EIGEN_STRONG_INLINE const CwiseUnaryView<CustomViewOp, Derived>
|
EIGEN_STRONG_INLINE const CwiseUnaryView<CustomViewOp, Derived>
|
||||||
unaryViewExpr(const CustomViewOp& func = CustomViewOp()) const
|
unaryViewExpr(const CustomViewOp& func = CustomViewOp()) const
|
||||||
{
|
{
|
||||||
return CwiseUnaryView<CustomViewOp, Derived>(derived(), func);
|
return CwiseUnaryView<CustomViewOp, Derived>(derived(), func);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \returns a non const expression of the real part of \c *this.
|
/** \returns a non const expression of the real part of \c *this.
|
||||||
*
|
*
|
||||||
* \sa imag() */
|
* \sa imag() */
|
||||||
EIGEN_STRONG_INLINE NonConstRealReturnType
|
EIGEN_STRONG_INLINE NonConstRealReturnType
|
||||||
real() { return derived(); }
|
real() { return derived(); }
|
||||||
|
|
||||||
/** \returns a non const expression of the imaginary part of \c *this.
|
/** \returns a non const expression of the imaginary part of \c *this.
|
||||||
*
|
*
|
||||||
* \sa real() */
|
* \sa real() */
|
||||||
EIGEN_STRONG_INLINE NonConstImagReturnType
|
EIGEN_STRONG_INLINE NonConstImagReturnType
|
||||||
imag() { return derived(); }
|
imag() { return derived(); }
|
||||||
|
|
||||||
const Cwise<Derived> cwise() const;
|
/** \returns a Cwise wrapper of *this providing additional coefficient-wise operations
|
||||||
Cwise<Derived> cwise();
|
*
|
||||||
|
* Example: \include MatrixBase_cwise_const.cpp
|
||||||
|
* Output: \verbinclude MatrixBase_cwise_const.out
|
||||||
|
*
|
||||||
|
* \sa class Cwise, cwise()
|
||||||
|
*/
|
||||||
|
inline const Cwise<Derived> cwise() const
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \returns a Cwise wrapper of *this providing additional coefficient-wise operations
|
||||||
|
*
|
||||||
|
* Example: \include MatrixBase_cwise.cpp
|
||||||
|
* Output: \verbinclude MatrixBase_cwise.out
|
||||||
|
*
|
||||||
|
* \sa class Cwise, cwise() const
|
||||||
|
*/
|
||||||
|
inline Cwise<Derived> cwise()
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
@ -62,6 +62,7 @@ template<typename Derived> class MatrixBase
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
|
typedef MatrixBase Self;
|
||||||
using ei_special_scalar_op_base<Derived,typename ei_traits<Derived>::Scalar,
|
using ei_special_scalar_op_base<Derived,typename ei_traits<Derived>::Scalar,
|
||||||
typename NumTraits<typename ei_traits<Derived>::Scalar>::Real>::operator*;
|
typename NumTraits<typename ei_traits<Derived>::Scalar>::Real>::operator*;
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ template<typename MatrixType, int Size>
|
|||||||
struct ei_traits<SparseInnerVectorSet<MatrixType, Size> >
|
struct ei_traits<SparseInnerVectorSet<MatrixType, Size> >
|
||||||
{
|
{
|
||||||
typedef typename ei_traits<MatrixType>::Scalar Scalar;
|
typedef typename ei_traits<MatrixType>::Scalar Scalar;
|
||||||
|
typedef typename ei_traits<MatrixType>::StorageType StorageType;
|
||||||
enum {
|
enum {
|
||||||
IsRowMajor = (int(MatrixType::Flags)&RowMajorBit)==RowMajorBit,
|
IsRowMajor = (int(MatrixType::Flags)&RowMajorBit)==RowMajorBit,
|
||||||
Flags = MatrixType::Flags,
|
Flags = MatrixType::Flags,
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
// License and a copy of the GNU General Public License along with
|
// License and a copy of the GNU General Public License along with
|
||||||
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
#ifndef EIGEN_SPARSE_CWISE_H
|
#ifndef EIGEN_SPARSE_CWISE_H
|
||||||
#define EIGEN_SPARSE_CWISE_H
|
#define EIGEN_SPARSE_CWISE_H
|
||||||
|
|
||||||
@ -158,18 +160,20 @@ template<typename ExpressionType> class SparseCwise
|
|||||||
ExpressionTypeNested m_matrix;
|
ExpressionTypeNested m_matrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Derived>
|
// template<typename Derived>
|
||||||
inline const SparseCwise<Derived>
|
// inline const SparseCwise<Derived>
|
||||||
SparseMatrixBase<Derived>::cwise() const
|
// SparseMatrixBase<Derived>::cwise() const
|
||||||
{
|
// {
|
||||||
return derived();
|
// return derived();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
template<typename Derived>
|
// template<typename Derived>
|
||||||
inline SparseCwise<Derived>
|
// inline SparseCwise<Derived>
|
||||||
SparseMatrixBase<Derived>::cwise()
|
// SparseMatrixBase<Derived>::cwise()
|
||||||
{
|
// {
|
||||||
return derived();
|
// return derived();
|
||||||
}
|
// }
|
||||||
|
|
||||||
#endif // EIGEN_SPARSE_CWISE_H
|
#endif // EIGEN_SPARSE_CWISE_H
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -42,72 +42,56 @@
|
|||||||
// 4 - dense op dense product dense
|
// 4 - dense op dense product dense
|
||||||
// generic dense
|
// generic dense
|
||||||
|
|
||||||
template<typename BinaryOp, typename Lhs, typename Rhs>
|
// template<typename BinaryOp, typename Lhs, typename Rhs>
|
||||||
struct ei_traits<SparseCwiseBinaryOp<BinaryOp, Lhs, Rhs> >
|
// struct ei_traits<SparseCwiseBinaryOp<BinaryOp, Lhs, Rhs> >
|
||||||
{
|
// {
|
||||||
typedef typename ei_result_of<
|
// typedef typename ei_result_of<
|
||||||
BinaryOp(
|
// BinaryOp(
|
||||||
typename Lhs::Scalar,
|
// typename Lhs::Scalar,
|
||||||
typename Rhs::Scalar
|
// typename Rhs::Scalar
|
||||||
)
|
// )
|
||||||
>::type Scalar;
|
// >::type Scalar;
|
||||||
typedef typename Lhs::Nested LhsNested;
|
// typedef typename ei_promote_storage_type<typename ei_traits<Lhs>::StorageType,
|
||||||
typedef typename Rhs::Nested RhsNested;
|
// typename ei_traits<Rhs>::StorageType>::ret StorageType;
|
||||||
typedef typename ei_unref<LhsNested>::type _LhsNested;
|
// typedef typename Lhs::Nested LhsNested;
|
||||||
typedef typename ei_unref<RhsNested>::type _RhsNested;
|
// typedef typename Rhs::Nested RhsNested;
|
||||||
enum {
|
// typedef typename ei_unref<LhsNested>::type _LhsNested;
|
||||||
LhsCoeffReadCost = _LhsNested::CoeffReadCost,
|
// typedef typename ei_unref<RhsNested>::type _RhsNested;
|
||||||
RhsCoeffReadCost = _RhsNested::CoeffReadCost,
|
// enum {
|
||||||
LhsFlags = _LhsNested::Flags,
|
// LhsCoeffReadCost = _LhsNested::CoeffReadCost,
|
||||||
RhsFlags = _RhsNested::Flags,
|
// RhsCoeffReadCost = _RhsNested::CoeffReadCost,
|
||||||
RowsAtCompileTime = Lhs::RowsAtCompileTime,
|
// LhsFlags = _LhsNested::Flags,
|
||||||
ColsAtCompileTime = Lhs::ColsAtCompileTime,
|
// RhsFlags = _RhsNested::Flags,
|
||||||
MaxRowsAtCompileTime = Lhs::MaxRowsAtCompileTime,
|
// RowsAtCompileTime = Lhs::RowsAtCompileTime,
|
||||||
MaxColsAtCompileTime = Lhs::MaxColsAtCompileTime,
|
// ColsAtCompileTime = Lhs::ColsAtCompileTime,
|
||||||
Flags = (int(LhsFlags) | int(RhsFlags)) & HereditaryBits,
|
// MaxRowsAtCompileTime = Lhs::MaxRowsAtCompileTime,
|
||||||
CoeffReadCost = LhsCoeffReadCost + RhsCoeffReadCost + ei_functor_traits<BinaryOp>::Cost
|
// MaxColsAtCompileTime = Lhs::MaxColsAtCompileTime,
|
||||||
};
|
// Flags = (int(LhsFlags) | int(RhsFlags)) & HereditaryBits,
|
||||||
};
|
// CoeffReadCost = LhsCoeffReadCost + RhsCoeffReadCost + ei_functor_traits<BinaryOp>::Cost
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
|
||||||
|
template<> struct ei_promote_storage_type<Dense,Sparse>
|
||||||
|
{ typedef Sparse ret; };
|
||||||
|
|
||||||
|
template<> struct ei_promote_storage_type<Sparse,Dense>
|
||||||
|
{ typedef Sparse ret; };
|
||||||
|
|
||||||
template<typename BinaryOp, typename Lhs, typename Rhs>
|
template<typename BinaryOp, typename Lhs, typename Rhs>
|
||||||
class SparseCwiseBinaryOp : ei_no_assignment_operator,
|
class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Sparse>
|
||||||
public SparseMatrixBase<SparseCwiseBinaryOp<BinaryOp, Lhs, Rhs> >
|
: public SparseMatrixBase<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
class InnerIterator;
|
class InnerIterator;
|
||||||
|
|
||||||
EIGEN_SPARSE_GENERIC_PUBLIC_INTERFACE(SparseCwiseBinaryOp)
|
typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived;
|
||||||
typedef typename ei_traits<SparseCwiseBinaryOp>::LhsNested LhsNested;
|
EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
|
||||||
typedef typename ei_traits<SparseCwiseBinaryOp>::RhsNested RhsNested;
|
// typedef typename ei_traits<SparseCwiseBinaryOp>::LhsNested LhsNested;
|
||||||
typedef typename ei_unref<LhsNested>::type _LhsNested;
|
// typedef typename ei_traits<SparseCwiseBinaryOp>::RhsNested RhsNested;
|
||||||
typedef typename ei_unref<RhsNested>::type _RhsNested;
|
// typedef typename ei_unref<LhsNested>::type _LhsNested;
|
||||||
|
// typedef typename ei_unref<RhsNested>::type _RhsNested;
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE SparseCwiseBinaryOp(const Lhs& lhs, const Rhs& rhs, const BinaryOp& func = BinaryOp())
|
|
||||||
: m_lhs(lhs), m_rhs(rhs), m_functor(func)
|
|
||||||
{
|
|
||||||
EIGEN_STATIC_ASSERT((_LhsNested::Flags&RowMajorBit)==(_RhsNested::Flags&RowMajorBit),
|
|
||||||
BOTH_MATRICES_MUST_HAVE_THE_SAME_STORAGE_ORDER)
|
|
||||||
EIGEN_STATIC_ASSERT((ei_functor_allows_mixing_real_and_complex<BinaryOp>::ret
|
|
||||||
? int(ei_is_same_type<typename Lhs::RealScalar, typename Rhs::RealScalar>::ret)
|
|
||||||
: int(ei_is_same_type<typename Lhs::Scalar, typename Rhs::Scalar>::ret)),
|
|
||||||
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
|
|
||||||
// require the sizes to match
|
|
||||||
EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs, Rhs)
|
|
||||||
ei_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
|
|
||||||
}
|
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE int rows() const { return m_lhs.rows(); }
|
|
||||||
EIGEN_STRONG_INLINE int cols() const { return m_lhs.cols(); }
|
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE const _LhsNested& lhs() const { return m_lhs; }
|
|
||||||
EIGEN_STRONG_INLINE const _RhsNested& rhs() const { return m_rhs; }
|
|
||||||
EIGEN_STRONG_INLINE const BinaryOp& functor() const { return m_functor; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const LhsNested m_lhs;
|
|
||||||
const RhsNested m_rhs;
|
|
||||||
const BinaryOp m_functor;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename BinaryOp, typename Lhs, typename Rhs, typename Derived,
|
template<typename BinaryOp, typename Lhs, typename Rhs, typename Derived,
|
||||||
@ -116,15 +100,15 @@ template<typename BinaryOp, typename Lhs, typename Rhs, typename Derived,
|
|||||||
class ei_sparse_cwise_binary_op_inner_iterator_selector;
|
class ei_sparse_cwise_binary_op_inner_iterator_selector;
|
||||||
|
|
||||||
template<typename BinaryOp, typename Lhs, typename Rhs>
|
template<typename BinaryOp, typename Lhs, typename Rhs>
|
||||||
class SparseCwiseBinaryOp<BinaryOp,Lhs,Rhs>::InnerIterator
|
class CwiseBinaryOpImpl<BinaryOp,Lhs,Rhs,Sparse>::InnerIterator
|
||||||
: public ei_sparse_cwise_binary_op_inner_iterator_selector<BinaryOp,Lhs,Rhs, typename SparseCwiseBinaryOp<BinaryOp,Lhs,Rhs>::InnerIterator>
|
: public ei_sparse_cwise_binary_op_inner_iterator_selector<BinaryOp,Lhs,Rhs,typename CwiseBinaryOpImpl<BinaryOp,Lhs,Rhs,Sparse>::InnerIterator>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef ei_sparse_cwise_binary_op_inner_iterator_selector<
|
typedef ei_sparse_cwise_binary_op_inner_iterator_selector<
|
||||||
BinaryOp,Lhs,Rhs, InnerIterator> Base;
|
BinaryOp,Lhs,Rhs, InnerIterator> Base;
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE InnerIterator(const SparseCwiseBinaryOp& binOp, int outer)
|
EIGEN_STRONG_INLINE InnerIterator(const CwiseBinaryOpImpl& binOp, int outer)
|
||||||
: Base(binOp,outer)
|
: Base(binOp.derived(),outer)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -141,7 +125,7 @@ class SparseCwiseBinaryOp<BinaryOp,Lhs,Rhs>::InnerIterator
|
|||||||
template<typename BinaryOp, typename Lhs, typename Rhs, typename Derived>
|
template<typename BinaryOp, typename Lhs, typename Rhs, typename Derived>
|
||||||
class ei_sparse_cwise_binary_op_inner_iterator_selector<BinaryOp, Lhs, Rhs, Derived, IsSparse, IsSparse>
|
class ei_sparse_cwise_binary_op_inner_iterator_selector<BinaryOp, Lhs, Rhs, Derived, IsSparse, IsSparse>
|
||||||
{
|
{
|
||||||
typedef SparseCwiseBinaryOp<BinaryOp, Lhs, Rhs> CwiseBinaryXpr;
|
typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> CwiseBinaryXpr;
|
||||||
typedef typename ei_traits<CwiseBinaryXpr>::Scalar Scalar;
|
typedef typename ei_traits<CwiseBinaryXpr>::Scalar Scalar;
|
||||||
typedef typename ei_traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
|
typedef typename ei_traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
|
||||||
typedef typename ei_traits<CwiseBinaryXpr>::_RhsNested _RhsNested;
|
typedef typename ei_traits<CwiseBinaryXpr>::_RhsNested _RhsNested;
|
||||||
@ -204,7 +188,7 @@ template<typename T, typename Lhs, typename Rhs, typename Derived>
|
|||||||
class ei_sparse_cwise_binary_op_inner_iterator_selector<ei_scalar_product_op<T>, Lhs, Rhs, Derived, IsSparse, IsSparse>
|
class ei_sparse_cwise_binary_op_inner_iterator_selector<ei_scalar_product_op<T>, Lhs, Rhs, Derived, IsSparse, IsSparse>
|
||||||
{
|
{
|
||||||
typedef ei_scalar_product_op<T> BinaryFunc;
|
typedef ei_scalar_product_op<T> BinaryFunc;
|
||||||
typedef SparseCwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr;
|
typedef CwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr;
|
||||||
typedef typename CwiseBinaryXpr::Scalar Scalar;
|
typedef typename CwiseBinaryXpr::Scalar Scalar;
|
||||||
typedef typename ei_traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
|
typedef typename ei_traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
|
||||||
typedef typename _LhsNested::InnerIterator LhsIterator;
|
typedef typename _LhsNested::InnerIterator LhsIterator;
|
||||||
@ -257,7 +241,7 @@ template<typename T, typename Lhs, typename Rhs, typename Derived>
|
|||||||
class ei_sparse_cwise_binary_op_inner_iterator_selector<ei_scalar_product_op<T>, Lhs, Rhs, Derived, IsSparse, IsDense>
|
class ei_sparse_cwise_binary_op_inner_iterator_selector<ei_scalar_product_op<T>, Lhs, Rhs, Derived, IsSparse, IsDense>
|
||||||
{
|
{
|
||||||
typedef ei_scalar_product_op<T> BinaryFunc;
|
typedef ei_scalar_product_op<T> BinaryFunc;
|
||||||
typedef SparseCwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr;
|
typedef CwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr;
|
||||||
typedef typename CwiseBinaryXpr::Scalar Scalar;
|
typedef typename CwiseBinaryXpr::Scalar Scalar;
|
||||||
typedef typename ei_traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
|
typedef typename ei_traits<CwiseBinaryXpr>::_LhsNested _LhsNested;
|
||||||
typedef typename ei_traits<CwiseBinaryXpr>::RhsNested RhsNested;
|
typedef typename ei_traits<CwiseBinaryXpr>::RhsNested RhsNested;
|
||||||
@ -297,7 +281,7 @@ template<typename T, typename Lhs, typename Rhs, typename Derived>
|
|||||||
class ei_sparse_cwise_binary_op_inner_iterator_selector<ei_scalar_product_op<T>, Lhs, Rhs, Derived, IsDense, IsSparse>
|
class ei_sparse_cwise_binary_op_inner_iterator_selector<ei_scalar_product_op<T>, Lhs, Rhs, Derived, IsDense, IsSparse>
|
||||||
{
|
{
|
||||||
typedef ei_scalar_product_op<T> BinaryFunc;
|
typedef ei_scalar_product_op<T> BinaryFunc;
|
||||||
typedef SparseCwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr;
|
typedef CwiseBinaryOp<BinaryFunc, Lhs, Rhs> CwiseBinaryXpr;
|
||||||
typedef typename CwiseBinaryXpr::Scalar Scalar;
|
typedef typename CwiseBinaryXpr::Scalar Scalar;
|
||||||
typedef typename ei_traits<CwiseBinaryXpr>::_RhsNested _RhsNested;
|
typedef typename ei_traits<CwiseBinaryXpr>::_RhsNested _RhsNested;
|
||||||
typedef typename _RhsNested::InnerIterator RhsIterator;
|
typedef typename _RhsNested::InnerIterator RhsIterator;
|
||||||
@ -337,11 +321,11 @@ class ei_sparse_cwise_binary_op_inner_iterator_selector<ei_scalar_product_op<T>,
|
|||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_STRONG_INLINE const SparseCwiseBinaryOp<ei_scalar_difference_op<typename ei_traits<Derived>::Scalar>,
|
EIGEN_STRONG_INLINE const CwiseBinaryOp<ei_scalar_difference_op<typename ei_traits<Derived>::Scalar>,
|
||||||
Derived, OtherDerived>
|
Derived, OtherDerived>
|
||||||
SparseMatrixBase<Derived>::operator-(const SparseMatrixBase<OtherDerived> &other) const
|
SparseMatrixBase<Derived>::operator-(const SparseMatrixBase<OtherDerived> &other) const
|
||||||
{
|
{
|
||||||
return SparseCwiseBinaryOp<ei_scalar_difference_op<Scalar>,
|
return CwiseBinaryOp<ei_scalar_difference_op<Scalar>,
|
||||||
Derived, OtherDerived>(derived(), other.derived());
|
Derived, OtherDerived>(derived(), other.derived());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,10 +339,10 @@ SparseMatrixBase<Derived>::operator-=(const SparseMatrixBase<OtherDerived> &othe
|
|||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_STRONG_INLINE const SparseCwiseBinaryOp<ei_scalar_sum_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
|
EIGEN_STRONG_INLINE const CwiseBinaryOp<ei_scalar_sum_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
|
||||||
SparseMatrixBase<Derived>::operator+(const SparseMatrixBase<OtherDerived> &other) const
|
SparseMatrixBase<Derived>::operator+(const SparseMatrixBase<OtherDerived> &other) const
|
||||||
{
|
{
|
||||||
return SparseCwiseBinaryOp<ei_scalar_sum_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
|
return CwiseBinaryOp<ei_scalar_sum_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
@ -369,21 +353,21 @@ SparseMatrixBase<Derived>::operator+=(const SparseMatrixBase<OtherDerived>& othe
|
|||||||
return *this = derived() + other.derived();
|
return *this = derived() + other.derived();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ExpressionType>
|
// template<typename ExpressionType>
|
||||||
template<typename OtherDerived>
|
// template<typename OtherDerived>
|
||||||
EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE
|
// EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE
|
||||||
SparseCwise<ExpressionType>::operator*(const SparseMatrixBase<OtherDerived> &other) const
|
// SparseCwise<ExpressionType>::operator*(const SparseMatrixBase<OtherDerived> &other) const
|
||||||
{
|
// {
|
||||||
return EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE(_expression(), other.derived());
|
// return EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE(_expression(), other.derived());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
template<typename ExpressionType>
|
// template<typename ExpressionType>
|
||||||
template<typename OtherDerived>
|
// template<typename OtherDerived>
|
||||||
EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE
|
// EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE
|
||||||
SparseCwise<ExpressionType>::operator*(const MatrixBase<OtherDerived> &other) const
|
// SparseCwise<ExpressionType>::operator*(const MatrixBase<OtherDerived> &other) const
|
||||||
{
|
// {
|
||||||
return EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE(_expression(), other.derived());
|
// return EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE(_expression(), other.derived());
|
||||||
}
|
// }
|
||||||
|
|
||||||
// template<typename ExpressionType>
|
// template<typename ExpressionType>
|
||||||
// template<typename OtherDerived>
|
// template<typename OtherDerived>
|
||||||
@ -401,42 +385,12 @@ SparseCwise<ExpressionType>::operator*(const MatrixBase<OtherDerived> &other) co
|
|||||||
// return EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(ei_scalar_quotient_op)(_expression(), other.derived());
|
// return EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(ei_scalar_quotient_op)(_expression(), other.derived());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
template<typename ExpressionType>
|
|
||||||
template<typename OtherDerived>
|
|
||||||
inline ExpressionType& SparseCwise<ExpressionType>::operator*=(const SparseMatrixBase<OtherDerived> &other)
|
|
||||||
{
|
|
||||||
return m_matrix.const_cast_derived() = _expression() * other.derived();
|
|
||||||
}
|
|
||||||
|
|
||||||
// template<typename ExpressionType>
|
// template<typename ExpressionType>
|
||||||
// template<typename OtherDerived>
|
// template<typename OtherDerived>
|
||||||
// inline ExpressionType& SparseCwise<ExpressionType>::operator/=(const SparseMatrixBase<OtherDerived> &other)
|
// inline ExpressionType& SparseCwise<ExpressionType>::operator*=(const SparseMatrixBase<OtherDerived> &other)
|
||||||
// {
|
// {
|
||||||
// return m_matrix.const_cast_derived() = *this / other;
|
// return m_matrix.const_cast_derived() = _expression() * other.derived();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
template<typename ExpressionType>
|
|
||||||
template<typename OtherDerived>
|
|
||||||
EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(ei_scalar_min_op)
|
|
||||||
SparseCwise<ExpressionType>::min(const SparseMatrixBase<OtherDerived> &other) const
|
|
||||||
{
|
|
||||||
return EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(ei_scalar_min_op)(_expression(), other.derived());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename ExpressionType>
|
|
||||||
template<typename OtherDerived>
|
|
||||||
EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(ei_scalar_max_op)
|
|
||||||
SparseCwise<ExpressionType>::max(const SparseMatrixBase<OtherDerived> &other) const
|
|
||||||
{
|
|
||||||
return EIGEN_SPARSE_CWISE_BINOP_RETURN_TYPE(ei_scalar_max_op)(_expression(), other.derived());
|
|
||||||
}
|
|
||||||
|
|
||||||
// template<typename Derived>
|
|
||||||
// template<typename CustomBinaryOp, typename OtherDerived>
|
|
||||||
// EIGEN_STRONG_INLINE const CwiseBinaryOp<CustomBinaryOp, Derived, OtherDerived>
|
|
||||||
// SparseMatrixBase<Derived>::binaryExpr(const SparseMatrixBase<OtherDerived> &other, const CustomBinaryOp& func) const
|
|
||||||
// {
|
|
||||||
// return CwiseBinaryOp<CustomBinaryOp, Derived, OtherDerived>(derived(), other.derived(), func);
|
|
||||||
// }
|
|
||||||
|
|
||||||
#endif // EIGEN_SPARSE_CWISE_BINARY_OP_H
|
#endif // EIGEN_SPARSE_CWISE_BINARY_OP_H
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// This file is part of Eigen, a lightweight C++ template library
|
// This file is part of Eigen, a lightweight C++ template library
|
||||||
// for linear algebra.
|
// for linear algebra.
|
||||||
//
|
//
|
||||||
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
|
// Copyright (C) 2008-2009 Gael Guennebaud <g.gael@free.fr>
|
||||||
//
|
//
|
||||||
// Eigen is free software; you can redistribute it and/or
|
// Eigen is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU Lesser General Public
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
@ -39,7 +39,7 @@
|
|||||||
// };
|
// };
|
||||||
|
|
||||||
template<typename UnaryOp, typename MatrixType>
|
template<typename UnaryOp, typename MatrixType>
|
||||||
class CwiseUnaryOpImp<UnaryOp,MatrixType,Sparse>
|
class CwiseUnaryOpImpl<UnaryOp,MatrixType,Sparse>
|
||||||
: public SparseMatrixBase<CwiseUnaryOp<UnaryOp, MatrixType> >
|
: public SparseMatrixBase<CwiseUnaryOp<UnaryOp, MatrixType> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -55,12 +55,12 @@ template<typename UnaryOp, typename MatrixType>
|
|||||||
class CwiseUnaryOpImpl<UnaryOp,MatrixType,Sparse>::InnerIterator
|
class CwiseUnaryOpImpl<UnaryOp,MatrixType,Sparse>::InnerIterator
|
||||||
{
|
{
|
||||||
typedef typename CwiseUnaryOpImpl::Scalar Scalar;
|
typedef typename CwiseUnaryOpImpl::Scalar Scalar;
|
||||||
typedef typename ei_traits<CwiseUnaryOpImpl>::_MatrixTypeNested _MatrixTypeNested;
|
typedef typename ei_traits<Derived>::_MatrixTypeNested _MatrixTypeNested;
|
||||||
typedef typename _MatrixTypeNested::InnerIterator MatrixTypeIterator;
|
typedef typename _MatrixTypeNested::InnerIterator MatrixTypeIterator;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE InnerIterator(const SparseCwiseUnaryOp& unaryOp, int outer)
|
EIGEN_STRONG_INLINE InnerIterator(const CwiseUnaryOpImpl& unaryOp, int outer)
|
||||||
: m_iter(unaryOp.nestedExpression(),outer), m_functor(unaryOp._functor())
|
: m_iter(unaryOp.derived().nestedExpression(),outer), m_functor(unaryOp.derived()._functor())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE InnerIterator& operator++()
|
EIGEN_STRONG_INLINE InnerIterator& operator++()
|
||||||
@ -80,7 +80,7 @@ class CwiseUnaryOpImpl<UnaryOp,MatrixType,Sparse>::InnerIterator
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename ViewOp, typename MatrixType>
|
template<typename ViewOp, typename MatrixType>
|
||||||
class CwiseUnaryOpImp<ViewOp,MatrixType,Sparse>
|
class CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>
|
||||||
: public SparseMatrixBase<CwiseUnaryView<ViewOp, MatrixType> >
|
: public SparseMatrixBase<CwiseUnaryView<ViewOp, MatrixType> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -96,18 +96,19 @@ template<typename ViewOp, typename MatrixType>
|
|||||||
class CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>::InnerIterator
|
class CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>::InnerIterator
|
||||||
{
|
{
|
||||||
typedef typename CwiseUnaryViewImpl::Scalar Scalar;
|
typedef typename CwiseUnaryViewImpl::Scalar Scalar;
|
||||||
typedef typename ei_traits<SparseCwiseUnaryOp>::_MatrixTypeNested _MatrixTypeNested;
|
typedef typename ei_traits<Derived>::_MatrixTypeNested _MatrixTypeNested;
|
||||||
typedef typename _MatrixTypeNested::InnerIterator MatrixTypeIterator;
|
typedef typename _MatrixTypeNested::InnerIterator MatrixTypeIterator;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE InnerIterator(const CwiseUnaryViewImpl& unaryView, int outer)
|
EIGEN_STRONG_INLINE InnerIterator(const CwiseUnaryViewImpl& unaryView, int outer)
|
||||||
: m_iter(unaryView.nestedExpression(),outer), m_functor(unaryView._functor())
|
: m_iter(unaryView.derived().nestedExpression(),outer), m_functor(unaryView.derived()._functor())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE InnerIterator& operator++()
|
EIGEN_STRONG_INLINE InnerIterator& operator++()
|
||||||
{ ++m_iter; return *this; }
|
{ ++m_iter; return *this; }
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE Scalar value() const { return m_functor(m_iter.value()); }
|
EIGEN_STRONG_INLINE Scalar value() const { return m_functor(m_iter.value()); }
|
||||||
|
EIGEN_STRONG_INLINE Scalar& valueRef() { return m_functor(m_iter.valueRef()); }
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE int index() const { return m_iter.index(); }
|
EIGEN_STRONG_INLINE int index() const { return m_iter.index(); }
|
||||||
EIGEN_STRONG_INLINE int row() const { return m_iter.row(); }
|
EIGEN_STRONG_INLINE int row() const { return m_iter.row(); }
|
||||||
@ -117,97 +118,27 @@ class CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>::InnerIterator
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
MatrixTypeIterator m_iter;
|
MatrixTypeIterator m_iter;
|
||||||
const UnaryOp m_functor;
|
const ViewOp m_functor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// template<typename Derived>
|
||||||
/*
|
// EIGEN_STRONG_INLINE Derived&
|
||||||
template<typename Derived>
|
// SparseMatrixBase<Derived>::operator*=(const Scalar& other)
|
||||||
template<typename CustomUnaryOp>
|
// {
|
||||||
EIGEN_STRONG_INLINE const SparseCwiseUnaryOp<CustomUnaryOp, Derived>
|
// for (int j=0; j<outerSize(); ++j)
|
||||||
SparseMatrixBase<Derived>::unaryExpr(const CustomUnaryOp& func) const
|
// for (typename Derived::InnerIterator i(derived(),j); i; ++i)
|
||||||
{
|
// i.valueRef() *= other;
|
||||||
return SparseCwiseUnaryOp<CustomUnaryOp, Derived>(derived(), func);
|
// return derived();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
template<typename Derived>
|
// template<typename Derived>
|
||||||
EIGEN_STRONG_INLINE const SparseCwiseUnaryOp<ei_scalar_opposite_op<typename ei_traits<Derived>::Scalar>,Derived>
|
// EIGEN_STRONG_INLINE Derived&
|
||||||
SparseMatrixBase<Derived>::operator-() const
|
// SparseMatrixBase<Derived>::operator/=(const Scalar& other)
|
||||||
{
|
// {
|
||||||
return derived();
|
// for (int j=0; j<outerSize(); ++j)
|
||||||
}
|
// for (typename Derived::InnerIterator i(derived(),j); i; ++i)
|
||||||
|
// i.valueRef() /= other;
|
||||||
template<typename ExpressionType>
|
// return derived();
|
||||||
EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_UNOP_RETURN_TYPE(ei_scalar_abs_op)
|
// }
|
||||||
SparseCwise<ExpressionType>::abs() const
|
|
||||||
{
|
|
||||||
return _expression();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename ExpressionType>
|
|
||||||
EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_UNOP_RETURN_TYPE(ei_scalar_abs2_op)
|
|
||||||
SparseCwise<ExpressionType>::abs2() const
|
|
||||||
{
|
|
||||||
return _expression();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Derived>
|
|
||||||
EIGEN_STRONG_INLINE typename SparseMatrixBase<Derived>::ConjugateReturnType
|
|
||||||
SparseMatrixBase<Derived>::conjugate() const
|
|
||||||
{
|
|
||||||
return ConjugateReturnType(derived());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Derived>
|
|
||||||
EIGEN_STRONG_INLINE const typename SparseMatrixBase<Derived>::RealReturnType
|
|
||||||
SparseMatrixBase<Derived>::real() const { return derived(); }
|
|
||||||
|
|
||||||
template<typename Derived>
|
|
||||||
EIGEN_STRONG_INLINE const typename SparseMatrixBase<Derived>::ImagReturnType
|
|
||||||
SparseMatrixBase<Derived>::imag() const { return derived(); }
|
|
||||||
|
|
||||||
template<typename Derived>
|
|
||||||
template<typename NewType>
|
|
||||||
EIGEN_STRONG_INLINE const SparseCwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived>
|
|
||||||
SparseMatrixBase<Derived>::cast() const
|
|
||||||
{
|
|
||||||
return derived();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Derived>
|
|
||||||
EIGEN_STRONG_INLINE const SparseCwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived>
|
|
||||||
SparseMatrixBase<Derived>::operator*(const Scalar& scalar) const
|
|
||||||
{
|
|
||||||
return SparseCwiseUnaryOp<ei_scalar_multiple_op<Scalar>, Derived>
|
|
||||||
(derived(), ei_scalar_multiple_op<Scalar>(scalar));
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Derived>
|
|
||||||
EIGEN_STRONG_INLINE const SparseCwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<Derived>::Scalar>, Derived>
|
|
||||||
SparseMatrixBase<Derived>::operator/(const Scalar& scalar) const
|
|
||||||
{
|
|
||||||
return SparseCwiseUnaryOp<ei_scalar_quotient1_op<Scalar>, Derived>
|
|
||||||
(derived(), ei_scalar_quotient1_op<Scalar>(scalar));
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Derived>
|
|
||||||
EIGEN_STRONG_INLINE Derived&
|
|
||||||
SparseMatrixBase<Derived>::operator*=(const Scalar& other)
|
|
||||||
{
|
|
||||||
for (int j=0; j<outerSize(); ++j)
|
|
||||||
for (typename Derived::InnerIterator i(derived(),j); i; ++i)
|
|
||||||
i.valueRef() *= other;
|
|
||||||
return derived();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Derived>
|
|
||||||
EIGEN_STRONG_INLINE Derived&
|
|
||||||
SparseMatrixBase<Derived>::operator/=(const Scalar& other)
|
|
||||||
{
|
|
||||||
for (int j=0; j<outerSize(); ++j)
|
|
||||||
for (typename Derived::InnerIterator i(derived(),j); i; ++i)
|
|
||||||
i.valueRef() /= other;
|
|
||||||
return derived();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
#endif // EIGEN_SPARSE_CWISE_UNARY_OP_H
|
#endif // EIGEN_SPARSE_CWISE_UNARY_OP_H
|
||||||
|
@ -107,9 +107,9 @@ class SparseDiagonalProduct
|
|||||||
template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
|
template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
|
||||||
class ei_sparse_diagonal_product_inner_iterator_selector
|
class ei_sparse_diagonal_product_inner_iterator_selector
|
||||||
<Lhs,Rhs,SparseDiagonalProductType,SDP_IsDiagonal,SDP_IsSparseRowMajor>
|
<Lhs,Rhs,SparseDiagonalProductType,SDP_IsDiagonal,SDP_IsSparseRowMajor>
|
||||||
: public SparseCwiseUnaryOp<ei_scalar_multiple_op<typename Lhs::Scalar>,Rhs>::InnerIterator
|
: public CwiseUnaryOp<ei_scalar_multiple_op<typename Lhs::Scalar>,Rhs>::InnerIterator
|
||||||
{
|
{
|
||||||
typedef typename SparseCwiseUnaryOp<ei_scalar_multiple_op<typename Lhs::Scalar>,Rhs>::InnerIterator Base;
|
typedef typename CwiseUnaryOp<ei_scalar_multiple_op<typename Lhs::Scalar>,Rhs>::InnerIterator Base;
|
||||||
public:
|
public:
|
||||||
inline ei_sparse_diagonal_product_inner_iterator_selector(
|
inline ei_sparse_diagonal_product_inner_iterator_selector(
|
||||||
const SparseDiagonalProductType& expr, int outer)
|
const SparseDiagonalProductType& expr, int outer)
|
||||||
@ -120,12 +120,12 @@ class ei_sparse_diagonal_product_inner_iterator_selector
|
|||||||
template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
|
template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
|
||||||
class ei_sparse_diagonal_product_inner_iterator_selector
|
class ei_sparse_diagonal_product_inner_iterator_selector
|
||||||
<Lhs,Rhs,SparseDiagonalProductType,SDP_IsDiagonal,SDP_IsSparseColMajor>
|
<Lhs,Rhs,SparseDiagonalProductType,SDP_IsDiagonal,SDP_IsSparseColMajor>
|
||||||
: public SparseCwiseBinaryOp<
|
: public CwiseBinaryOp<
|
||||||
ei_scalar_product_op<typename Lhs::Scalar>,
|
ei_scalar_product_op<typename Lhs::Scalar>,
|
||||||
SparseInnerVectorSet<Rhs,1>,
|
SparseInnerVectorSet<Rhs,1>,
|
||||||
typename Lhs::DiagonalVectorType>::InnerIterator
|
typename Lhs::DiagonalVectorType>::InnerIterator
|
||||||
{
|
{
|
||||||
typedef typename SparseCwiseBinaryOp<
|
typedef typename CwiseBinaryOp<
|
||||||
ei_scalar_product_op<typename Lhs::Scalar>,
|
ei_scalar_product_op<typename Lhs::Scalar>,
|
||||||
SparseInnerVectorSet<Rhs,1>,
|
SparseInnerVectorSet<Rhs,1>,
|
||||||
typename Lhs::DiagonalVectorType>::InnerIterator Base;
|
typename Lhs::DiagonalVectorType>::InnerIterator Base;
|
||||||
@ -139,9 +139,9 @@ class ei_sparse_diagonal_product_inner_iterator_selector
|
|||||||
template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
|
template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
|
||||||
class ei_sparse_diagonal_product_inner_iterator_selector
|
class ei_sparse_diagonal_product_inner_iterator_selector
|
||||||
<Lhs,Rhs,SparseDiagonalProductType,SDP_IsSparseColMajor,SDP_IsDiagonal>
|
<Lhs,Rhs,SparseDiagonalProductType,SDP_IsSparseColMajor,SDP_IsDiagonal>
|
||||||
: public SparseCwiseUnaryOp<ei_scalar_multiple_op<typename Rhs::Scalar>,Lhs>::InnerIterator
|
: public CwiseUnaryOp<ei_scalar_multiple_op<typename Rhs::Scalar>,Lhs>::InnerIterator
|
||||||
{
|
{
|
||||||
typedef typename SparseCwiseUnaryOp<ei_scalar_multiple_op<typename Rhs::Scalar>,Lhs>::InnerIterator Base;
|
typedef typename CwiseUnaryOp<ei_scalar_multiple_op<typename Rhs::Scalar>,Lhs>::InnerIterator Base;
|
||||||
public:
|
public:
|
||||||
inline ei_sparse_diagonal_product_inner_iterator_selector(
|
inline ei_sparse_diagonal_product_inner_iterator_selector(
|
||||||
const SparseDiagonalProductType& expr, int outer)
|
const SparseDiagonalProductType& expr, int outer)
|
||||||
@ -152,12 +152,12 @@ class ei_sparse_diagonal_product_inner_iterator_selector
|
|||||||
template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
|
template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
|
||||||
class ei_sparse_diagonal_product_inner_iterator_selector
|
class ei_sparse_diagonal_product_inner_iterator_selector
|
||||||
<Lhs,Rhs,SparseDiagonalProductType,SDP_IsSparseRowMajor,SDP_IsDiagonal>
|
<Lhs,Rhs,SparseDiagonalProductType,SDP_IsSparseRowMajor,SDP_IsDiagonal>
|
||||||
: public SparseCwiseBinaryOp<
|
: public CwiseBinaryOp<
|
||||||
ei_scalar_product_op<typename Rhs::Scalar>,
|
ei_scalar_product_op<typename Rhs::Scalar>,
|
||||||
SparseInnerVectorSet<Lhs,1>,
|
SparseInnerVectorSet<Lhs,1>,
|
||||||
NestByValue<Transpose<typename Rhs::DiagonalVectorType> > >::InnerIterator
|
NestByValue<Transpose<typename Rhs::DiagonalVectorType> > >::InnerIterator
|
||||||
{
|
{
|
||||||
typedef typename SparseCwiseBinaryOp<
|
typedef typename CwiseBinaryOp<
|
||||||
ei_scalar_product_op<typename Rhs::Scalar>,
|
ei_scalar_product_op<typename Rhs::Scalar>,
|
||||||
SparseInnerVectorSet<Lhs,1>,
|
SparseInnerVectorSet<Lhs,1>,
|
||||||
NestByValue<Transpose<typename Rhs::DiagonalVectorType> > >::InnerIterator Base;
|
NestByValue<Transpose<typename Rhs::DiagonalVectorType> > >::InnerIterator Base;
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
// You should have received a copy of the GNU Lesser General Public
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
// License and a copy of the GNU General Public License along with
|
// License and a copy of the GNU General Public License along with
|
||||||
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#if 0
|
||||||
#ifndef EIGEN_SPARSE_EXPRESSIONMAKER_H
|
#ifndef EIGEN_SPARSE_EXPRESSIONMAKER_H
|
||||||
#define EIGEN_SPARSE_EXPRESSIONMAKER_H
|
#define EIGEN_SPARSE_EXPRESSIONMAKER_H
|
||||||
|
|
||||||
@ -46,3 +46,4 @@ struct MakeCwiseBinaryOp<Func,A,B,IsSparse>
|
|||||||
// TODO complete the list
|
// TODO complete the list
|
||||||
|
|
||||||
#endif // EIGEN_SPARSE_EXPRESSIONMAKER_H
|
#endif // EIGEN_SPARSE_EXPRESSIONMAKER_H
|
||||||
|
#endif
|
@ -45,7 +45,7 @@ template<typename Derived> class SparseMatrixBase : public AnyMatrixBase<Derived
|
|||||||
|
|
||||||
typedef typename ei_traits<Derived>::Scalar Scalar;
|
typedef typename ei_traits<Derived>::Scalar Scalar;
|
||||||
typedef typename ei_packet_traits<Scalar>::type PacketScalar;
|
typedef typename ei_packet_traits<Scalar>::type PacketScalar;
|
||||||
// typedef typename Derived::InnerIterator InnerIterator;
|
typedef SparseMatrixBase Self;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ template<typename Derived> class SparseMatrixBase : public AnyMatrixBase<Derived
|
|||||||
// typedef SparseCwiseUnaryOp<ei_scalar_imag_op<Scalar>, Derived> ImagReturnType;
|
// typedef SparseCwiseUnaryOp<ei_scalar_imag_op<Scalar>, Derived> ImagReturnType;
|
||||||
/** \internal the return type of MatrixBase::adjoint() */
|
/** \internal the return type of MatrixBase::adjoint() */
|
||||||
typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
|
typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
|
||||||
SparseCwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, SparseNestByValue<Eigen::Transpose<Derived> > >,
|
CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, SparseNestByValue<Eigen::Transpose<Derived> > >,
|
||||||
Transpose<Derived>
|
Transpose<Derived>
|
||||||
>::ret AdjointReturnType;
|
>::ret AdjointReturnType;
|
||||||
|
|
||||||
@ -127,6 +127,9 @@ template<typename Derived> class SparseMatrixBase : public AnyMatrixBase<Derived
|
|||||||
*/
|
*/
|
||||||
typedef typename ei_meta_if<_HasDirectAccess, const Scalar&, Scalar>::ret CoeffReturnType;
|
typedef typename ei_meta_if<_HasDirectAccess, const Scalar&, Scalar>::ret CoeffReturnType;
|
||||||
|
|
||||||
|
/** \internal Represents a matrix with all coefficients equal to one another*/
|
||||||
|
typedef CwiseNullaryOp<ei_scalar_constant_op<Scalar>,Matrix<Scalar,Dynamic,Dynamic> > ConstantReturnType;
|
||||||
|
|
||||||
/** type of the equivalent square matrix */
|
/** type of the equivalent square matrix */
|
||||||
typedef Matrix<Scalar,EIGEN_ENUM_MAX(RowsAtCompileTime,ColsAtCompileTime),
|
typedef Matrix<Scalar,EIGEN_ENUM_MAX(RowsAtCompileTime,ColsAtCompileTime),
|
||||||
EIGEN_ENUM_MAX(RowsAtCompileTime,ColsAtCompileTime)> SquareMatrixType;
|
EIGEN_ENUM_MAX(RowsAtCompileTime,ColsAtCompileTime)> SquareMatrixType;
|
||||||
@ -289,11 +292,11 @@ template<typename Derived> class SparseMatrixBase : public AnyMatrixBase<Derived
|
|||||||
// const SparseCwiseUnaryOp<ei_scalar_opposite_op<typename ei_traits<Derived>::Scalar>,Derived> operator-() const;
|
// const SparseCwiseUnaryOp<ei_scalar_opposite_op<typename ei_traits<Derived>::Scalar>,Derived> operator-() const;
|
||||||
|
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
const SparseCwiseBinaryOp<ei_scalar_sum_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
|
const CwiseBinaryOp<ei_scalar_sum_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
|
||||||
operator+(const SparseMatrixBase<OtherDerived> &other) const;
|
operator+(const SparseMatrixBase<OtherDerived> &other) const;
|
||||||
|
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
const SparseCwiseBinaryOp<ei_scalar_difference_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
|
const CwiseBinaryOp<ei_scalar_difference_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
|
||||||
operator-(const SparseMatrixBase<OtherDerived> &other) const;
|
operator-(const SparseMatrixBase<OtherDerived> &other) const;
|
||||||
|
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
@ -517,8 +520,8 @@ template<typename Derived> class SparseMatrixBase : public AnyMatrixBase<Derived
|
|||||||
// { return (cwise() != other).any(); }
|
// { return (cwise() != other).any(); }
|
||||||
|
|
||||||
|
|
||||||
template<typename NewType>
|
// template<typename NewType>
|
||||||
const SparseCwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived> cast() const;
|
// const SparseCwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived> cast() const;
|
||||||
|
|
||||||
/** \returns the matrix or vector obtained by evaluating this expression.
|
/** \returns the matrix or vector obtained by evaluating this expression.
|
||||||
*
|
*
|
||||||
|
@ -123,11 +123,7 @@ template<typename _Scalar, int _Flags = 0> class SparseVector;
|
|||||||
template<typename _Scalar, int _Flags = 0> class MappedSparseMatrix;
|
template<typename _Scalar, int _Flags = 0> class MappedSparseMatrix;
|
||||||
|
|
||||||
template<typename MatrixType> class SparseNestByValue;
|
template<typename MatrixType> class SparseNestByValue;
|
||||||
// template<typename MatrixType> class SparseTranspose;
|
|
||||||
template<typename MatrixType, int Size> class SparseInnerVectorSet;
|
template<typename MatrixType, int Size> class SparseInnerVectorSet;
|
||||||
template<typename Derived> class SparseCwise;
|
|
||||||
template<typename UnaryOp, typename MatrixType> class SparseCwiseUnaryOp;
|
|
||||||
template<typename BinaryOp, typename Lhs, typename Rhs> class SparseCwiseBinaryOp;
|
|
||||||
template<typename ExpressionType,
|
template<typename ExpressionType,
|
||||||
unsigned int Added, unsigned int Removed> class SparseFlagged;
|
unsigned int Added, unsigned int Removed> class SparseFlagged;
|
||||||
template<typename ExpressionType, int Mode> class SparseTriangular;
|
template<typename ExpressionType, int Mode> class SparseTriangular;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user