10 #ifndef EIGEN_SPARSEUTIL_H 11 #define EIGEN_SPARSEUTIL_H 14 #include "./InternalHeaderCheck.h" 19 #define EIGEN_DBG_SPARSE(X) 21 #define EIGEN_DBG_SPARSE(X) X 24 #define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \ 25 template <typename OtherDerived> \ 26 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) { return Base::operator Op(other); } 31 #define EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, Op) \ 32 template <typename Other> \ 33 EIGEN_STRONG_INLINE Derived& operator Op(const Other & scalar) { \ 34 return Base::operator Op(scalar); \ 37 #define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATORS(Derived) EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, =) 39 #define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived) EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) 41 const int CoherentAccessPattern = 0x1;
42 const int InnerRandomAccessPattern = 0x2 | CoherentAccessPattern;
43 const int OuterRandomAccessPattern = 0x4 | CoherentAccessPattern;
44 const int RandomAccessPattern = 0x8 | OuterRandomAccessPattern | InnerRandomAccessPattern;
46 template <
typename Scalar_,
int Flags_ = 0,
typename StorageIndex_ =
int>
48 template <
typename Scalar_,
int Flags_ = 0,
typename StorageIndex_ =
int>
51 template <
typename MatrixType,
unsigned int UpLo>
53 template <
typename Lhs,
typename Rhs>
54 class SparseDiagonalProduct;
55 template <
typename MatrixType>
58 template <
typename Lhs,
typename Rhs>
59 class SparseSparseProduct;
60 template <
typename Lhs,
typename Rhs>
61 class SparseTimeDenseProduct;
62 template <
typename Lhs,
typename Rhs>
63 class DenseTimeSparseProduct;
64 template <
typename Lhs,
typename Rhs,
bool Transpose>
65 class SparseDenseOuterProduct;
67 template <
typename Lhs,
typename Rhs>
68 struct SparseSparseProductReturnType;
69 template <
typename Lhs,
typename Rhs,
70 int InnerSize = internal::min_size_prefer_fixed(internal::traits<Lhs>::ColsAtCompileTime,
71 internal::traits<Rhs>::RowsAtCompileTime)>
72 struct DenseSparseProductReturnType;
74 template <
typename Lhs,
typename Rhs,
75 int InnerSize = internal::min_size_prefer_fixed(internal::traits<Lhs>::ColsAtCompileTime,
76 internal::traits<Rhs>::RowsAtCompileTime)>
77 struct SparseDenseProductReturnType;
78 template <
typename MatrixType,
int UpLo>
79 class SparseSymmetricPermutationProduct;
83 template <
typename T,
int Rows,
int Cols,
int Flags>
87 struct eval<T,
Sparse> : sparse_eval<T, traits<T>::RowsAtCompileTime, traits<T>::ColsAtCompileTime, traits<T>::Flags> {
90 template <
typename T,
int Cols,
int Flags>
91 struct sparse_eval<T, 1, Cols, Flags> {
92 typedef typename traits<T>::Scalar Scalar_;
93 typedef typename traits<T>::StorageIndex StorageIndex_;
99 template <
typename T,
int Rows,
int Flags>
100 struct sparse_eval<T, Rows, 1, Flags> {
101 typedef typename traits<T>::Scalar Scalar_;
102 typedef typename traits<T>::StorageIndex StorageIndex_;
105 typedef SparseVector<Scalar_, ColMajor, StorageIndex_> type;
109 template <
typename T,
int Rows,
int Cols,
int Flags>
111 typedef typename traits<T>::Scalar Scalar_;
112 typedef typename traits<T>::StorageIndex StorageIndex_;
116 typedef SparseMatrix<Scalar_, Options_, StorageIndex_> type;
119 template <
typename T,
int Flags>
120 struct sparse_eval<T, 1, 1, Flags> {
121 typedef typename traits<T>::Scalar Scalar_;
124 typedef Matrix<Scalar_, 1, 1> type;
127 template <
typename T>
128 struct plain_matrix_type<T, Sparse> {
129 typedef typename traits<T>::Scalar Scalar_;
130 typedef typename traits<T>::StorageIndex StorageIndex_;
134 typedef SparseMatrix<Scalar_, Options_, StorageIndex_> type;
137 template <
typename T>
138 struct plain_object_eval<T, Sparse>
139 : sparse_eval<T, traits<T>::RowsAtCompileTime, traits<T>::ColsAtCompileTime, evaluator<T>::Flags> {};
141 template <
typename Decomposition,
typename RhsType>
142 struct solve_traits<Decomposition, RhsType, Sparse> {
143 typedef typename sparse_eval<RhsType, RhsType::RowsAtCompileTime, RhsType::ColsAtCompileTime,
144 traits<RhsType>::Flags>::type PlainObject;
147 template <
typename Derived>
148 struct generic_xpr_base<Derived, MatrixXpr, Sparse> {
149 typedef SparseMatrixBase<Derived> type;
152 struct SparseTriangularShape {
153 static std::string debugName() {
return "SparseTriangularShape"; }
155 struct SparseSelfAdjointShape {
156 static std::string debugName() {
return "SparseSelfAdjointShape"; }
160 struct glue_shapes<SparseShape, SelfAdjointShape> {
161 typedef SparseSelfAdjointShape type;
164 struct glue_shapes<SparseShape, TriangularShape> {
165 typedef SparseTriangularShape type;
169 struct LowerBoundIndex {
170 LowerBoundIndex() : value(-1), found(false) {}
171 LowerBoundIndex(
Index val,
bool ok) : value(val), found(ok) {}
186 template <typename Scalar, typename StorageIndex = typename SparseMatrix<Scalar>::StorageIndex>
189 Triplet() : m_row(0), m_col(0), m_value(0) {}
191 Triplet(
const StorageIndex& i,
const StorageIndex& j,
const Scalar& v = Scalar(0)) : m_row(i), m_col(j), m_value(v) {}
194 const StorageIndex&
row()
const {
return m_row; }
197 const StorageIndex&
col()
const {
return m_col; }
200 const Scalar&
value()
const {
return m_value; }
203 StorageIndex m_row, m_col;
209 #endif // EIGEN_SPARSEUTIL_H const StorageIndex & col() const
Definition: SparseUtil.h:197
Definition: Constants.h:318
const StorageIndex & row() const
Definition: SparseUtil.h:194
Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1
Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix.
Definition: SparseSelfAdjointView.h:52
const unsigned int RowMajorBit
Definition: Constants.h:70
a sparse vector class
Definition: SparseUtil.h:49
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:82
Expression of a dense or sparse matrix with zero or too small values removed.
Definition: ForwardDeclarations.h:177
Definition: Constants.h:522
A small structure to hold a non zero as a triplet (i,j,value).
Definition: SparseUtil.h:187
const Scalar & value() const
Definition: SparseUtil.h:200
Definition: Constants.h:320