mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
a lot of cleaning and fixes
This commit is contained in:
@@ -324,14 +324,14 @@ SparseMatrixBase<Derived>::operator+=(const SparseMatrixBase<OtherDerived>& othe
|
||||
// {
|
||||
// return EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE(_expression(), other.derived());
|
||||
// }
|
||||
//
|
||||
// template<typename ExpressionType>
|
||||
// template<typename OtherDerived>
|
||||
// EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE
|
||||
// SparseCwise<ExpressionType>::operator*(const MatrixBase<OtherDerived> &other) const
|
||||
// {
|
||||
// return EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE(_expression(), other.derived());
|
||||
// }
|
||||
|
||||
template<typename Derived>
|
||||
template<typename OtherDerived>
|
||||
EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE
|
||||
SparseMatrixBase<Derived>::cwiseProduct(const MatrixBase<OtherDerived> &other) const
|
||||
{
|
||||
return EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE(derived(), other.derived());
|
||||
}
|
||||
|
||||
// template<typename ExpressionType>
|
||||
// template<typename OtherDerived>
|
||||
|
||||
@@ -121,24 +121,24 @@ class CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>::InnerIterator
|
||||
const ViewOp m_functor;
|
||||
};
|
||||
|
||||
// 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();
|
||||
// }
|
||||
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
|
||||
|
||||
@@ -133,7 +133,7 @@ class ei_sparse_diagonal_product_inner_iterator_selector
|
||||
public:
|
||||
inline ei_sparse_diagonal_product_inner_iterator_selector(
|
||||
const SparseDiagonalProductType& expr, int outer)
|
||||
: Base(expr.rhs().innerVector(outer) .cwise()* expr.lhs().diagonal(), 0)
|
||||
: Base(expr.rhs().innerVector(outer) .cwiseProduct(expr.lhs().diagonal()), 0)
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -165,7 +165,7 @@ class ei_sparse_diagonal_product_inner_iterator_selector
|
||||
public:
|
||||
inline ei_sparse_diagonal_product_inner_iterator_selector(
|
||||
const SparseDiagonalProductType& expr, int outer)
|
||||
: Base(expr.lhs().innerVector(outer) .cwise()* expr.rhs().diagonal().transpose().nestByValue(), 0)
|
||||
: Base(expr.lhs().innerVector(outer) .cwiseProduct(expr.rhs().diagonal().transpose().nestByValue()), 0)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
@@ -109,9 +109,19 @@ template<typename Derived> class SparseMatrixBase : public AnyMatrixBase<Derived
|
||||
Transpose<Derived>
|
||||
>::ret AdjointReturnType;
|
||||
|
||||
// typedef Matrix<typename ei_traits<Derived>::Scalar,
|
||||
// ei_traits<Derived>::RowsAtCompileTime,
|
||||
// ei_traits<Derived>::ColsAtCompileTime,
|
||||
// AutoAlign | (ei_traits<Derived>::Flags&RowMajorBit ? RowMajor : ColMajor),
|
||||
// ei_traits<Derived>::MaxRowsAtCompileTime,
|
||||
// ei_traits<Derived>::MaxColsAtCompileTime
|
||||
// > PlainMatrixType;
|
||||
|
||||
#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::SparseMatrixBase
|
||||
#include "../Core/CwiseUnaryOps.h"
|
||||
#include "../Core/CwiseBinaryOps.h"
|
||||
#include "../plugins/CommonCwiseUnaryOps.h"
|
||||
#include "../plugins/CommonCwiseBinaryOps.h"
|
||||
#include "../plugins/MatrixCwiseUnaryOps.h"
|
||||
#include "../plugins/MatrixCwiseBinaryOps.h"
|
||||
#undef EIGEN_CURRENT_STORAGE_BASE_CLASS
|
||||
|
||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||
@@ -307,8 +317,24 @@ template<typename Derived> class SparseMatrixBase : public AnyMatrixBase<Derived
|
||||
// template<typename Lhs,typename Rhs>
|
||||
// Derived& operator+=(const Flagged<Product<Lhs,Rhs,CacheFriendlyProduct>, 0, EvalBeforeNestingBit | EvalBeforeAssigningBit>& other);
|
||||
|
||||
// Derived& operator*=(const Scalar& other);
|
||||
// Derived& operator/=(const Scalar& other);
|
||||
Derived& operator*=(const Scalar& other);
|
||||
Derived& operator/=(const Scalar& other);
|
||||
|
||||
#define EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE \
|
||||
CwiseBinaryOp< \
|
||||
ei_scalar_product_op< \
|
||||
typename ei_scalar_product_traits< \
|
||||
typename ei_traits<Derived>::Scalar, \
|
||||
typename ei_traits<OtherDerived>::Scalar \
|
||||
>::ReturnType \
|
||||
>, \
|
||||
Derived, \
|
||||
OtherDerived \
|
||||
>
|
||||
|
||||
template<typename OtherDerived>
|
||||
EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE
|
||||
cwiseProduct(const MatrixBase<OtherDerived> &other) const;
|
||||
|
||||
// const SparseCwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived>
|
||||
// operator*(const Scalar& scalar) const;
|
||||
|
||||
Reference in New Issue
Block a user