MCPcopy Create free account
hub / github.com/abess-team/abess / SparseMatrix

Class SparseMatrix

python/include/Eigen/src/SparseCore/SparseMatrix.h:96–915  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94
95template<typename _Scalar, int _Options, typename _StorageIndex>
96class SparseMatrix
97 : public SparseCompressedBase<SparseMatrix<_Scalar, _Options, _StorageIndex> >
98{
99 typedef SparseCompressedBase<SparseMatrix> Base;
100 using Base::convert_index;
101 friend class SparseVector<_Scalar,0,_StorageIndex>;
102 public:
103 using Base::isCompressed;
104 using Base::nonZeros;
105 EIGEN_SPARSE_PUBLIC_INTERFACE(SparseMatrix)
106 using Base::operator+=;
107 using Base::operator-=;
108
109 typedef MappedSparseMatrix<Scalar,Flags> Map;
110 typedef Diagonal<SparseMatrix> DiagonalReturnType;
111 typedef Diagonal<const SparseMatrix> ConstDiagonalReturnType;
112 typedef typename Base::InnerIterator InnerIterator;
113 typedef typename Base::ReverseInnerIterator ReverseInnerIterator;
114
115
116 using Base::IsRowMajor;
117 typedef internal::CompressedStorage<Scalar,StorageIndex> Storage;
118 enum {
119 Options = _Options
120 };
121
122 typedef typename Base::IndexVector IndexVector;
123 typedef typename Base::ScalarVector ScalarVector;
124 protected:
125 typedef SparseMatrix<Scalar,(Flags&~RowMajorBit)|(IsRowMajor?RowMajorBit:0)> TransposedSparseMatrix;
126
127 Index m_outerSize;
128 Index m_innerSize;
129 StorageIndex* m_outerIndex;
130 StorageIndex* m_innerNonZeros; // optional, if null then the data is compressed
131 Storage m_data;
132
133 public:
134
135 /** \returns the number of rows of the matrix */
136 inline Index rows() const { return IsRowMajor ? m_outerSize : m_innerSize; }
137 /** \returns the number of columns of the matrix */
138 inline Index cols() const { return IsRowMajor ? m_innerSize : m_outerSize; }
139
140 /** \returns the number of rows (resp. columns) of the matrix if the storage order column major (resp. row major) */
141 inline Index innerSize() const { return m_innerSize; }
142 /** \returns the number of columns (resp. rows) of the matrix if the storage order column major (resp. row major) */
143 inline Index outerSize() const { return m_outerSize; }
144
145 /** \returns a const pointer to the array of values.
146 * This function is aimed at interoperability with other libraries.
147 * \sa innerIndexPtr(), outerIndexPtr() */
148 inline const Scalar* valuePtr() const { return m_data.valuePtr(); }
149 /** \returns a non-const pointer to the array of values.
150 * This function is aimed at interoperability with other libraries.
151 * \sa innerIndexPtr(), outerIndexPtr() */
152 inline Scalar* valuePtr() { return m_data.valuePtr(); }
153

Callers

nothing calls this directly

Calls 14

smart_copyFunction · 0.85
convert_indexFunction · 0.85
searchLowerIndexMethod · 0.80
appendMethod · 0.80
swapFunction · 0.70
rowsFunction · 0.50
colsFunction · 0.50
indexMethod · 0.45
valueMethod · 0.45
sizeMethod · 0.45
isRValueMethod · 0.45
isCompressedMethod · 0.45

Tested by

no test coverage detected