MCPcopy Create free account
hub / github.com/TinyMPC/TinyMPC / SparseMatrix

Class SparseMatrix

include/Eigen/Eigen/src/SparseCore/SparseMatrix.h:123–1159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121
122template<typename Scalar_, int Options_, typename StorageIndex_>
123class SparseMatrix
124 : public SparseCompressedBase<SparseMatrix<Scalar_, Options_, StorageIndex_> >
125{
126 typedef SparseCompressedBase<SparseMatrix> Base;
127 using Base::convert_index;
128 friend class SparseVector<Scalar_,0,StorageIndex_>;
129 template<typename, typename, typename, typename, typename>
130 friend struct internal::Assignment;
131 public:
132 using Base::isCompressed;
133 using Base::nonZeros;
134 EIGEN_SPARSE_PUBLIC_INTERFACE(SparseMatrix)
135 using Base::operator+=;
136 using Base::operator-=;
137
138 typedef Eigen::Map<SparseMatrix<Scalar,Options_,StorageIndex>> Map;
139 typedef Diagonal<SparseMatrix> DiagonalReturnType;
140 typedef Diagonal<const SparseMatrix> ConstDiagonalReturnType;
141 typedef typename Base::InnerIterator InnerIterator;
142 typedef typename Base::ReverseInnerIterator ReverseInnerIterator;
143
144
145 using Base::IsRowMajor;
146 typedef internal::CompressedStorage<Scalar,StorageIndex> Storage;
147 enum {
148 Options = Options_
149 };
150
151 typedef typename Base::IndexVector IndexVector;
152 typedef typename Base::ScalarVector ScalarVector;
153 protected:
154 typedef SparseMatrix<Scalar, IsRowMajor ? ColMajor : RowMajor, StorageIndex> TransposedSparseMatrix;
155
156 Index m_outerSize;
157 Index m_innerSize;
158 StorageIndex* m_outerIndex;
159 StorageIndex* m_innerNonZeros; // optional, if null then the data is compressed
160 Storage m_data;
161
162 public:
163
164 /** \returns the number of rows of the matrix */
165 inline Index rows() const { return IsRowMajor ? m_outerSize : m_innerSize; }
166 /** \returns the number of columns of the matrix */
167 inline Index cols() const { return IsRowMajor ? m_innerSize : m_outerSize; }
168
169 /** \returns the number of rows (resp. columns) of the matrix if the storage order column major (resp. row major) */
170 inline Index innerSize() const { return m_innerSize; }
171 /** \returns the number of columns (resp. rows) of the matrix if the storage order column major (resp. row major) */
172 inline Index outerSize() const { return m_outerSize; }
173
174 /** \returns a const pointer to the array of values.
175 * This function is aimed at interoperability with other libraries.
176 * \sa innerIndexPtr(), outerIndexPtr() */
177 inline const Scalar* valuePtr() const { return m_data.valuePtr(); }
178 /** \returns a non-const pointer to the array of values.
179 * This function is aimed at interoperability with other libraries.
180 * \sa innerIndexPtr(), outerIndexPtr() */

Callers

nothing calls this directly

Calls 13

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

Tested by

no test coverage detected