00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef EIGEN_SPARSEUTIL_H
00026 #define EIGEN_SPARSEUTIL_H
00027
00028 #ifdef NDEBUG
00029 #define EIGEN_DBG_SPARSE(X)
00030 #else
00031 #define EIGEN_DBG_SPARSE(X) X
00032 #endif
00033
00034 #define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \
00035 template<typename OtherDerived> \
00036 EIGEN_STRONG_INLINE Derived& operator Op(const Eigen::SparseMatrixBase<OtherDerived>& other) \
00037 { \
00038 return Base::operator Op(other.derived()); \
00039 } \
00040 EIGEN_STRONG_INLINE Derived& operator Op(const Derived& other) \
00041 { \
00042 return Base::operator Op(other); \
00043 }
00044
00045 #define EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, Op) \
00046 template<typename Other> \
00047 EIGEN_STRONG_INLINE Derived& operator Op(const Other& scalar) \
00048 { \
00049 return Base::operator Op(scalar); \
00050 }
00051
00052 #define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATORS(Derived) \
00053 EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, =) \
00054 EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, +=) \
00055 EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, -=) \
00056 EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, *=) \
00057 EIGEN_SPARSE_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, /=)
00058
00059 #define _EIGEN_SPARSE_GENERIC_PUBLIC_INTERFACE(Derived, BaseClass) \
00060 typedef BaseClass Base; \
00061 typedef typename Eigen::ei_traits<Derived>::Scalar Scalar; \
00062 typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
00063 typedef typename Eigen::ei_nested<Derived>::type Nested; \
00064 enum { RowsAtCompileTime = Eigen::ei_traits<Derived>::RowsAtCompileTime, \
00065 ColsAtCompileTime = Eigen::ei_traits<Derived>::ColsAtCompileTime, \
00066 Flags = Eigen::ei_traits<Derived>::Flags, \
00067 CoeffReadCost = Eigen::ei_traits<Derived>::CoeffReadCost, \
00068 SizeAtCompileTime = Base::SizeAtCompileTime, \
00069 IsVectorAtCompileTime = Base::IsVectorAtCompileTime };
00070
00071 #define EIGEN_SPARSE_GENERIC_PUBLIC_INTERFACE(Derived) \
00072 _EIGEN_SPARSE_GENERIC_PUBLIC_INTERFACE(Derived, Eigen::SparseMatrixBase<Derived>)
00073
00074 enum SparseBackend {
00075 DefaultBackend,
00076 Taucs,
00077 Cholmod,
00078 SuperLU,
00079 UmfPack
00080 };
00081
00082
00083 enum {
00084 CompleteFactorization = 0x0000,
00085 IncompleteFactorization = 0x0001,
00086 MemoryEfficient = 0x0002,
00087
00088
00089 SupernodalMultifrontal = 0x0010,
00090 SupernodalLeftLooking = 0x0020,
00091
00092
00093 NaturalOrdering = 0x0100,
00094 MinimumDegree_AT_PLUS_A = 0x0200,
00095 MinimumDegree_ATA = 0x0300,
00096 ColApproxMinimumDegree = 0x0400,
00097 Metis = 0x0500,
00098 Scotch = 0x0600,
00099 Chaco = 0x0700,
00100 OrderingMask = 0x0f00
00101 };
00102
00103 template<typename Derived> class SparseMatrixBase;
00104 template<typename _Scalar, int _Flags = 0> class SparseMatrix;
00105 template<typename _Scalar, int _Flags = 0> class DynamicSparseMatrix;
00106 template<typename _Scalar, int _Flags = 0> class SparseVector;
00107 template<typename _Scalar, int _Flags = 0> class MappedSparseMatrix;
00108
00109 template<typename MatrixType> class SparseTranspose;
00110 template<typename MatrixType, int Size> class SparseInnerVectorSet;
00111 template<typename Derived> class SparseCwise;
00112 template<typename UnaryOp, typename MatrixType> class SparseCwiseUnaryOp;
00113 template<typename BinaryOp, typename Lhs, typename Rhs> class SparseCwiseBinaryOp;
00114 template<typename ExpressionType,
00115 unsigned int Added, unsigned int Removed> class SparseFlagged;
00116 template<typename Lhs, typename Rhs> class SparseDiagonalProduct;
00117
00118 template<typename Lhs, typename Rhs> struct ei_sparse_product_mode;
00119 template<typename Lhs, typename Rhs, int ProductMode = ei_sparse_product_mode<Lhs,Rhs>::value> struct SparseProductReturnType;
00120
00121 const int CoherentAccessPattern = 0x1;
00122 const int InnerRandomAccessPattern = 0x2 | CoherentAccessPattern;
00123 const int OuterRandomAccessPattern = 0x4 | CoherentAccessPattern;
00124 const int RandomAccessPattern = 0x8 | OuterRandomAccessPattern | InnerRandomAccessPattern;
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137 template<typename T> class ei_eval<T,IsSparse>
00138 {
00139 typedef typename ei_traits<T>::Scalar _Scalar;
00140 enum {
00141 _Flags = ei_traits<T>::Flags
00142 };
00143
00144 public:
00145 typedef SparseMatrix<_Scalar, _Flags> type;
00146 };
00147
00148 #endif // EIGEN_SPARSEUTIL_H