10 #ifndef EIGEN_SPARSEUTIL_H
11 #define EIGEN_SPARSEUTIL_H
18 #define EIGEN_DBG_SPARSE(X)
20 #define EIGEN_DBG_SPARSE(X) X
23 #define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \
24 template<typename OtherDerived> \
25 EIGEN_STRONG_INLINE Derived& operator Op(const Eigen::SparseMatrixBase<OtherDerived>& other) \
27 return Base::operator Op(other.derived()); \
29 EIGEN_STRONG_INLINE Derived& operator Op(const Derived& other) \
31 return Base::operator Op(other); \
34 #define EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, Op) \
35 template<typename Other> \
36 EIGEN_STRONG_INLINE Derived& operator Op(const Other& scalar) \
38 return Base::operator Op(scalar); \
41 #define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATORS(Derived) \
42 EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, =)
45 #define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived) \
46 EIGEN_GENERIC_PUBLIC_INTERFACE(Derived)
54 template<
typename Scalar_,
int Flags_ = 0,
typename StorageIndex_ =
int>
class SparseMatrix;
55 template<
typename Scalar_,
int Flags_ = 0,
typename StorageIndex_ =
int>
class SparseVector;
59 template<
typename MatrixType>
class SparseView;
67 template<
typename Lhs,
typename Rhs,
70 template<
typename Lhs,
typename Rhs,
76 template<
typename T,
int Rows,
int Cols,
int Flags>
struct sparse_eval;
78 template<
typename T>
struct eval<
T,
Sparse>
79 : sparse_eval<T, traits<T>::RowsAtCompileTime,traits<T>::ColsAtCompileTime,traits<T>::Flags>
82 template<
typename T,
int Cols,
int Flags>
struct sparse_eval<
T,1,Cols,Flags> {
83 typedef typename traits<T>::Scalar Scalar_;
84 typedef typename traits<T>::StorageIndex StorageIndex_;
89 template<
typename T,
int Rows,
int Flags>
struct sparse_eval<
T,Rows,1,Flags> {
90 typedef typename traits<T>::Scalar Scalar_;
91 typedef typename traits<T>::StorageIndex StorageIndex_;
93 typedef SparseVector<Scalar_, ColMajor, StorageIndex_> type;
97 template<
typename T,
int Rows,
int Cols,
int Flags>
struct sparse_eval {
98 typedef typename traits<T>::Scalar Scalar_;
99 typedef typename traits<T>::StorageIndex StorageIndex_;
102 typedef SparseMatrix<Scalar_, Options_, StorageIndex_> type;
105 template<
typename T,
int Flags>
struct sparse_eval<
T,1,1,Flags> {
106 typedef typename traits<T>::Scalar Scalar_;
108 typedef Matrix<Scalar_, 1, 1> type;
111 template<
typename T>
struct plain_matrix_type<
T,Sparse>
113 typedef typename traits<T>::Scalar Scalar_;
114 typedef typename traits<T>::StorageIndex StorageIndex_;
117 typedef SparseMatrix<Scalar_, Options_, StorageIndex_> type;
121 struct plain_object_eval<
T,Sparse>
122 : sparse_eval<T, traits<T>::RowsAtCompileTime,traits<T>::ColsAtCompileTime, evaluator<T>::Flags>
125 template<
typename Decomposition,
typename RhsType>
126 struct solve_traits<Decomposition,RhsType,Sparse>
128 typedef typename sparse_eval<RhsType, RhsType::RowsAtCompileTime, RhsType::ColsAtCompileTime,traits<RhsType>::Flags>::type PlainObject;
131 template<
typename Derived>
132 struct generic_xpr_base<Derived, MatrixXpr, Sparse>
134 typedef SparseMatrixBase<Derived> type;
137 struct SparseTriangularShape {
static std::string debugName() {
return "SparseTriangularShape"; } };
138 struct SparseSelfAdjointShape {
static std::string debugName() {
return "SparseSelfAdjointShape"; } };
140 template<>
struct glue_shapes<SparseShape,SelfAdjointShape> {
typedef SparseSelfAdjointShape type; };
141 template<>
struct glue_shapes<SparseShape,TriangularShape > {
typedef SparseTriangularShape type; };
144 struct LowerBoundIndex {
145 LowerBoundIndex() : value(-1), found(false) {}
146 LowerBoundIndex(
Index val,
bool ok) : value(val), found(ok) {}
161 template<typename Scalar, typename StorageIndex=typename SparseMatrix<Scalar>::StorageIndex >
167 Triplet(
const StorageIndex&
i,
const StorageIndex&
j,
const Scalar&
v = Scalar(0))
Array< int, Dynamic, 1 > v
A versatible sparse matrix representation.
Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix.
Expression of a dense or sparse matrix with zero or too small values removed.
const Scalar & value() const
const StorageIndex & col() const
Triplet(const StorageIndex &i, const StorageIndex &j, const Scalar &v=Scalar(0))
const StorageIndex & row() const
const unsigned int RowMajorBit
constexpr int min_size_prefer_fixed(A a, B b)
const int OuterRandomAccessPattern
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
const int InnerRandomAccessPattern
const int RandomAccessPattern
const int CoherentAccessPattern