10#ifndef EIGEN_SPARSEMATRIX_H
11#define EIGEN_SPARSEMATRIX_H
46template<
typename _Scalar,
int _Options,
typename _StorageIndex>
63template<
typename _Scalar,
int _Options,
typename _StorageIndex,
int DiagIndex>
77 ColsAtCompileTime = 1,
79 MaxColsAtCompileTime = 1,
84template<
typename _Scalar,
int _Options,
typename _StorageIndex,
int DiagIndex>
86 :
public traits<Diagonal<SparseMatrix<_Scalar, _Options, _StorageIndex>, DiagIndex> >
95template<
typename _Scalar,
int _Options,
typename _StorageIndex>
102 template<
typename,
typename,
typename,
typename,
typename>
108 using Base::operator+=;
109 using Base::operator-=;
217 eigen_assert(
end>=start &&
"you probably called coeffRef on a non finalized matrix");
270 #ifdef EIGEN_PARSED_BY_DOXYGEN
283 template<
class SizesType>
284 inline void reserve(
const SizesType& reserveSizes);
286 template<
class SizesType>
287 inline void reserve(
const SizesType& reserveSizes,
const typename SizesType::value_type& enableif =
291 SizesType::value_type())
298 template<
class SizesType>
303 Index totalReserveSize = 0;
314 newOuterIndex[j] =
count;
316 totalReserveSize += reserveSizes[j];
323 for(
Index i=innerNNZ-1; i>=0; --i)
345 newOuterIndex[j] =
count;
347 StorageIndex toReserve = std::max<StorageIndex>(reserveSizes[j], alreadyReserved);
359 for(
Index i=innerNNZ-1; i>=0; --i)
445 template<
typename InputIterators>
448 template<
typename InputIterators,
typename DupFunctor>
453 template<
typename DupFunctor>
489 oldStart = nextOldStart;
512 prune(default_prunning_func(reference,epsilon));
522 template<
typename KeepFunc>
523 void prune(
const KeepFunc& keep = KeepFunc())
534 for(
Index i=previousStart; i<
end; ++i)
559 if (this->
rows() == rows && this->
cols() == cols)
return;
579 else if (innerChange < 0)
597 while (n > 0 &&
m_data.
index(start+n-1) >= newInnerSize) --n;
604 if (outerChange == 0)
667 check_template_parameters();
675 check_template_parameters();
680 template<
typename OtherDerived>
685 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
686 check_template_parameters();
692 #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
693 EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
700 template<
typename OtherDerived,
unsigned int UpLo>
704 check_template_parameters();
712 check_template_parameters();
717 template<
typename OtherDerived>
721 check_template_parameters();
727 template<
typename OtherDerived>
731 check_template_parameters();
765 else if(
this!=&other)
767 #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
768 EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
784#ifndef EIGEN_PARSED_BY_DOXYGEN
785 template<
typename OtherDerived>
789 template<
typename Lhs,
typename Rhs>
793 template<
typename OtherDerived>
799 s <<
"Nonzero entries:\n";
802 for (Index i=0; i<m.nonZeros(); ++i)
803 s <<
"(" << m.m_data.value(i) <<
"," << m.m_data.index(i) <<
") ";
807 for (Index i=0; i<m.outerSize(); ++i)
809 Index p = m.m_outerIndex[i];
810 Index pe = m.m_outerIndex[i]+m.m_innerNonZeros[i];
813 s <<
"(" << m.m_data.value(k) <<
"," << m.m_data.index(k) <<
") ";
815 for (; k<m.m_outerIndex[i+1]; ++k) {
822 s <<
"Outer pointers:\n";
823 for (
Index i=0; i<m.outerSize(); ++i) {
824 s << m.m_outerIndex[i] <<
" ";
826 s <<
" $" << std::endl;
827 if(!m.isCompressed())
829 s <<
"Inner non zeros:\n";
830 for (Index i=0; i<m.outerSize(); ++i) {
831 s << m.m_innerNonZeros[i] <<
" ";
833 s <<
" $" << std::endl;
837 s << static_cast<const SparseMatrixBase<SparseMatrix>&>(m);
851# ifdef EIGEN_SPARSEMATRIX_PLUGIN
852# include EIGEN_SPARSEMATRIX_PLUGIN
857 template<
typename Other>
860 resize(other.rows(), other.cols());
900 eigen_assert(m_innerNonZeros[outer]<=(m_outerIndex[outer+1] - m_outerIndex[outer]));
902 Index p = m_outerIndex[outer] + m_innerNonZeros[outer]++;
926 template<
typename DiagXpr,
typename Func>
929 Index n = diagXpr.size();
934 if((this->rows()!=n) || (this->cols()!=n))
938 if(m_data.
size()==0 || overwrite)
941 this->makeCompressed();
942 this->resizeNonZeros(n);
951 bool isComp = isCompressed();
953 std::vector<IndexPosPair> newEntries;
956 for(
Index i = 0; i<n; ++i)
963 assignFunc.assignCoeff(m_data.
value(p), diaEval.coeff(i));
965 else if((!isComp) && m_innerNonZeros[i] < (m_outerIndex[i+1]-m_outerIndex[i]))
968 m_data.
moveChunk(p, p+1, m_outerIndex[i]+m_innerNonZeros[i]-p);
969 m_innerNonZeros[i]++;
972 assignFunc.assignCoeff(m_data.
value(p), diaEval.coeff(i));
987 for(
Index k=0; k<n_entries;++k)
989 Index i = newEntries[k].i;
990 Index p = newEntries[k].p;
993 for(
Index j=prev_i;j<i;++j)
994 m_outerIndex[j+1] += k;
996 m_innerNonZeros[i]++;
1001 assignFunc.assignCoeff(newData.
value(p+k), diaEval.coeff(i));
1006 for(
Index j=prev_i+1;j<=m_outerSize;++j)
1007 m_outerIndex[j] += n_entries;
1009 m_data.
swap(newData);
1015 static void check_template_parameters()
1021 struct default_prunning_func {
1022 default_prunning_func(
const Scalar& ref,
const RealScalar& eps) : reference(ref), epsilon(eps) {}
1034template<
typename InputIterator,
typename SparseMatrixType,
typename DupFunctor>
1035void set_from_triplets(
const InputIterator& begin,
const InputIterator&
end, SparseMatrixType& mat, DupFunctor dup_func)
1037 enum { IsRowMajor = SparseMatrixType::IsRowMajor };
1038 typedef typename SparseMatrixType::Scalar Scalar;
1039 typedef typename SparseMatrixType::StorageIndex StorageIndex;
1045 typename SparseMatrixType::IndexVector wi(trMat.
outerSize());
1047 for(InputIterator it(begin); it!=
end; ++it)
1049 eigen_assert(it->row()>=0 && it->row()<mat.rows() && it->col()>=0 && it->col()<mat.cols());
1050 wi(IsRowMajor ? it->col() : it->row())++;
1055 for(InputIterator it(begin); it!=
end; ++it)
1106template<
typename Scalar,
int _Options,
typename _StorageIndex>
1107template<
typename InputIterators>
1122template<
typename Scalar,
int _Options,
typename _StorageIndex>
1123template<
typename InputIterators,
typename DupFunctor>
1126 internal::set_from_triplets<InputIterators, SparseMatrix<Scalar,_Options,_StorageIndex>, DupFunctor>(begin,
end, *
this, dup_func);
1130template<
typename Scalar,
int _Options,
typename _StorageIndex>
1131template<
typename DupFunctor>
1140 for(
Index j=0; j<outerSize(); ++j)
1143 Index oldEnd = m_outerIndex[j]+m_innerNonZeros[j];
1144 for(
Index k=m_outerIndex[j]; k<oldEnd; ++k)
1160 m_outerIndex[j] = start;
1162 m_outerIndex[m_outerSize] =
count;
1166 m_innerNonZeros = 0;
1167 m_data.
resize(m_outerIndex[m_outerSize]);
1170template<
typename Scalar,
int _Options,
typename _StorageIndex>
1171template<
typename OtherDerived>
1175 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
1177 #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
1178 EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
1182 if (needToTranspose)
1184 #ifdef EIGEN_SPARSE_TRANSPOSED_COPY_PLUGIN
1185 EIGEN_SPARSE_TRANSPOSED_COPY_PLUGIN
1194 OtherCopy otherCopy(other.
derived());
1195 OtherCopyEval otherCopyEval(otherCopy);
1202 for (
Index j=0; j<otherCopy.outerSize(); ++j)
1203 for (
typename OtherCopyEval::InnerIterator it(otherCopyEval, j); it; ++it)
1213 positions[j] =
count;
1222 for (
typename OtherCopyEval::InnerIterator it(otherCopyEval, j); it; ++it)
1224 Index pos = positions[it.index()]++;
1236 initAssignment(other.
derived());
1239 return Base::operator=(other.
derived());
1243template<
typename _Scalar,
int _Options,
typename _StorageIndex>
1257 m_data.
reserve(2*m_innerSize);
1263 memset(m_innerNonZeros, 0, (m_outerSize)*
sizeof(
StorageIndex));
1268 for(
Index j=1; j<=m_outerSize; ++j)
1269 m_outerIndex[j] =
end;
1276 for(
Index j=0; j<m_outerSize; ++j)
1277 m_innerNonZeros[j] = m_outerIndex[j+1]-m_outerIndex[j];
1286 if(m_outerIndex[outer]==data_end)
1294 while(j>=0 && m_innerNonZeros[j]==0)
1295 m_outerIndex[j--] = p;
1298 ++m_innerNonZeros[outer];
1309 for(
Index k=outer+1; k<=m_outerSize; ++k)
1310 if(m_outerIndex[k]==data_end)
1311 m_outerIndex[k] = new_end;
1313 return m_data.
value(p);
1318 if(m_outerIndex[outer+1]==data_end && m_outerIndex[outer]+m_innerNonZeros[outer]==m_data.
size())
1323 ++m_innerNonZeros[outer];
1334 for(
Index k=outer+1; k<=m_outerSize; ++k)
1335 if(m_outerIndex[k]==data_end)
1336 m_outerIndex[k] = new_end;
1340 Index startId = m_outerIndex[outer];
1341 Index p = m_outerIndex[outer]+m_innerNonZeros[outer]-1;
1342 while ( (p > startId) && (m_data.
index(p-1) > inner) )
1360 return insertUncompressed(
row,
col);
1363template<
typename _Scalar,
int _Options,
typename _StorageIndex>
1371 Index room = m_outerIndex[outer+1] - m_outerIndex[outer];
1379 Index startId = m_outerIndex[outer];
1380 Index p = startId + m_innerNonZeros[outer];
1381 while ( (p > startId) && (m_data.
index(p-1) > inner) )
1387 eigen_assert((p<=startId || m_data.
index(p-1)!=inner) &&
"you cannot insert an element that already exists, you must call coeffRef to this end");
1389 m_innerNonZeros[outer]++;
1391 m_data.
index(p) = inner;
1395template<
typename _Scalar,
int _Options,
typename _StorageIndex>
1403 Index previousOuter = outer;
1404 if (m_outerIndex[outer+1]==0)
1407 while (previousOuter>=0 && m_outerIndex[previousOuter]==0)
1412 m_outerIndex[outer+1] = m_outerIndex[outer];
1418 bool isLastVec = (!(previousOuter==-1 && m_data.
size()!=0))
1419 && (std::size_t(m_outerIndex[outer+1]) == m_data.
size());
1421 std::size_t startId = m_outerIndex[outer];
1423 std::size_t p = m_outerIndex[outer+1];
1424 ++m_outerIndex[outer+1];
1426 double reallocRatio = 1;
1430 if (m_data.
size()==0)
1439 double nnzEstimate = double(m_outerIndex[outer])*double(m_outerSize)/double(outer+1);
1440 reallocRatio = (nnzEstimate-double(m_data.
size()))/
double(m_data.
size());
1451 if (previousOuter==-1)
1455 for (
Index k=0; k<=(outer+1); ++k)
1456 m_outerIndex[k] = 0;
1458 while(m_outerIndex[k]==0)
1459 m_outerIndex[k++] = 1;
1460 while (k<=m_outerSize && m_outerIndex[k]!=0)
1461 m_outerIndex[k++]++;
1464 k = m_outerIndex[k]-1;
1477 while (j<=m_outerSize && m_outerIndex[j]!=0)
1478 m_outerIndex[j++]++;
1481 Index k = m_outerIndex[j]-1;
1491 while ( (p > startId) && (m_data.
index(p-1) > inner) )
1498 m_data.
index(p) = inner;
1504template<
typename _Scalar,
int _Options,
typename _StorageIndex>
1506 :
evaluator<SparseCompressedBase<SparseMatrix<_Scalar,_Options,_StorageIndex> > >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ColXpr col(Index i)
This is the const version of col().
Definition: BlockMethods.h:1097
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE RowXpr row(Index i)
This is the const version of row(). */.
Definition: BlockMethods.h:1118
internal::enable_if< internal::valid_indexed_view_overload< RowIndices, ColIndices >::value &&internal::traits< typenameEIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::ReturnAsIndexedView, typenameEIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::type operator()(const RowIndices &rowIndices, const ColIndices &colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
Definition: IndexedViewMethods.h:73
#define EIGEN_COMP_MSVC
Definition: Macros.h:124
#define eigen_internal_assert(x)
Definition: Macros.h:1053
#define EIGEN_UNUSED_VARIABLE(var)
Definition: Macros.h:1086
#define EIGEN_DONT_INLINE
Definition: Macros.h:950
#define eigen_assert(x)
Definition: Macros.h:1047
#define EIGEN_STRONG_INLINE
Definition: Macros.h:927
#define EIGEN_DBG_SPARSE(X)
Definition: SparseUtil.h:18
#define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
Definition: SparseUtil.h:43
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition: StaticAssert.h:127
and restrictions which apply to each piece of software is included later in this file and or inside of the individual applicable source files The disclaimer of warranty in the WPILib license above applies to all code in and nothing in any of the other licenses gives permission to use the names of FIRST nor the names of the WPILib contributors to endorse or promote products derived from this software The following pieces of software have additional or alternate and or Google Inc All rights reserved Redistribution and use in source and binary with or without are permitted provided that the following conditions are this list of conditions and the following disclaimer *Redistributions in binary form must reproduce the above copyright this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution *Neither the name of Google Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable or merely the Work and Derivative Works thereof Contribution shall mean any work of including the original version of the Work and any modifications or additions to that Work or Derivative Works that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner For the purposes of this submitted means any form of or written communication sent to the Licensor or its including but not limited to communication on electronic mailing source code control and issue tracking systems that are managed or on behalf the Licensor for the purpose of discussing and improving the but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as Not a Contribution Contributor shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work Grant of Copyright License Subject to the terms and conditions of this each Contributor hereby grants to You a non no royalty free
Definition: ThirdPartyNotices.txt:151
General-purpose arrays with easy API for coefficient-wise operations.
Definition: Array.h:47
Definition: DiagonalMatrix.h:19
EIGEN_DEVICE_FUNC const Derived & derived() const
Definition: DiagonalMatrix.h:41
Expression of a diagonal/subdiagonal/superdiagonal in a matrix.
Definition: Diagonal.h:65
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:96
Sparse matrix.
Definition: MappedSparseMatrix.h:34
Expression of the product of two arbitrary matrices or vectors.
Definition: Product.h:75
Definition: ReturnByValue.h:52
EIGEN_DEVICE_FUNC void evalTo(Dest &dst) const
Definition: ReturnByValue.h:61
Definition: SparseCompressedBase.h:159
Definition: SparseCompressedBase.h:245
Common base class for sparse [compressed]-{row|column}-storage format.
Definition: SparseCompressedBase.h:38
Index nonZeros() const
Definition: SparseCompressedBase.h:56
Derived & operator=(const EigenBase< OtherDerived > &other)
Definition: SparseAssign.h:17
bool isCompressed() const
Definition: SparseCompressedBase.h:107
@ IsRowMajor
Definition: SparseMatrixBase.h:100
Definition: SparseMatrix.h:875
SingletonVector(Index i, Index v)
Definition: SparseMatrix.h:880
StorageIndex operator[](Index i) const
Definition: SparseMatrix.h:884
StorageIndex value_type
Definition: SparseMatrix.h:879
Base class of any sparse matrices or sparse expressions.
Definition: SparseMatrixBase.h:28
internal::traits< SparseMatrix< _Scalar, _Options, _StorageIndex > >::StorageIndex StorageIndex
The integer type used to store indices within a SparseMatrix.
Definition: SparseMatrixBase.h:43
const Derived & derived() const
Definition: SparseMatrixBase.h:143
Index size() const
Definition: SparseMatrixBase.h:181
Index rows() const
Definition: SparseMatrixBase.h:176
bool isRValue() const
Definition: SparseMatrixBase.h:194
internal::traits< SparseMatrix< _Scalar, _Options, _StorageIndex > >::Scalar Scalar
Definition: SparseMatrixBase.h:31
@ Flags
This stores expression Flags flags which may or may not be inherited by new expressions constructed f...
Definition: SparseMatrixBase.h:95
Derived & const_cast_derived() const
Definition: SparseMatrixBase.h:145
NumTraits< Scalar >::Real RealScalar
This is the "real scalar" type; if the Scalar type is already real numbers (e.g.
Definition: SparseMatrixBase.h:128
Index cols() const
Definition: SparseMatrixBase.h:178
static StorageIndex convert_index(const Index idx)
Definition: SparseMatrixBase.h:389
A versatible sparse matrix representation.
Definition: SparseMatrix.h:98
const Storage & data() const
Definition: SparseMatrix.h:186
SparseMatrix & operator=(const EigenBase< OtherDerived > &other)
Definition: SparseMatrix.h:786
Index m_outerSize
Definition: SparseMatrix.h:129
void prune(const Scalar &reference, const RealScalar &epsilon=NumTraits< RealScalar >::dummy_precision())
Suppresses all nonzeros which are much smaller than reference under the tolerance epsilon.
Definition: SparseMatrix.h:510
void prune(const KeepFunc &keep=KeepFunc())
Turns the matrix into compressed format, and suppresses all nonzeros which do not satisfy the predica...
Definition: SparseMatrix.h:523
Index innerSize() const
Definition: SparseMatrix.h:143
Base::InnerIterator InnerIterator
Definition: SparseMatrix.h:114
void reserve(Index reserveSize)
Preallocates reserveSize non zeros.
Definition: SparseMatrix.h:264
SparseMatrix(const DiagonalBase< OtherDerived > &other)
Copy constructor with in-place evaluation.
Definition: SparseMatrix.h:728
StorageIndex * outerIndexPtr()
Definition: SparseMatrix.h:172
void reserve(const SizesType &reserveSizes, const typename SizesType::value_type &enableif=typename SizesType::value_type())
Definition: SparseMatrix.h:287
void startVec(Index outer)
Definition: SparseMatrix.h:415
const StorageIndex * innerNonZeroPtr() const
Definition: SparseMatrix.h:177
StorageIndex * m_outerIndex
Definition: SparseMatrix.h:131
StorageIndex * m_innerNonZeros
Definition: SparseMatrix.h:132
~SparseMatrix()
Destructor.
Definition: SparseMatrix.h:842
void resizeNonZeros(Index size)
Definition: SparseMatrix.h:649
Scalar * valuePtr()
Definition: SparseMatrix.h:154
const ConstDiagonalReturnType diagonal() const
Definition: SparseMatrix.h:655
Storage & data()
Definition: SparseMatrix.h:184
SparseMatrix(const ReturnByValue< OtherDerived > &other)
Copy constructor with in-place evaluation.
Definition: SparseMatrix.h:718
Index outerSize() const
Definition: SparseMatrix.h:145
Scalar & insertBackByOuterInnerUnordered(Index outer, Index inner)
Definition: SparseMatrix.h:405
SparseMatrix(const SparseMatrixBase< OtherDerived > &other)
Constructs a sparse matrix from the sparse expression other.
Definition: SparseMatrix.h:681
void finalize()
Definition: SparseMatrix.h:425
Scalar coeff(Index row, Index col) const
Definition: SparseMatrix.h:190
void assignDiagonal(const DiagXpr diagXpr, const Func &assignFunc)
Definition: SparseMatrix.h:927
Storage m_data
Definition: SparseMatrix.h:133
internal::CompressedStorage< Scalar, StorageIndex > Storage
Definition: SparseMatrix.h:119
void sumupDuplicates()
Definition: SparseMatrix.h:451
SparseMatrix & operator=(const SparseMatrix &other)
Definition: SparseMatrix.h:759
SparseMatrix & operator=(const Product< Lhs, Rhs, AliasFreeProduct > &other)
void makeCompressed()
Turns the matrix into the compressed format.
Definition: SparseMatrix.h:467
friend std::ostream & operator<<(std::ostream &s, const SparseMatrix &m)
Definition: SparseMatrix.h:796
Index rows() const
Definition: SparseMatrix.h:138
SparseMatrix()
Default constructor yielding an empty 0 x 0 matrix.
Definition: SparseMatrix.h:664
SparseMatrix(Index rows, Index cols)
Constructs a rows x cols empty matrix.
Definition: SparseMatrix.h:672
SparseMatrix< Scalar,(Flags &~RowMajorBit)|(IsRowMajor?RowMajorBit:0)> TransposedSparseMatrix
Definition: SparseMatrix.h:127
Base::ReverseInnerIterator ReverseInnerIterator
Definition: SparseMatrix.h:115
void uncompress()
Turns the matrix into the uncompressed mode.
Definition: SparseMatrix.h:498
const StorageIndex * innerIndexPtr() const
Definition: SparseMatrix.h:159
const StorageIndex * outerIndexPtr() const
Definition: SparseMatrix.h:168
bool isCompressed() const
Definition: SparseCompressedBase.h:107
void collapseDuplicates(DupFunctor dup_func=DupFunctor())
Definition: SparseMatrix.h:1132
void setIdentity()
Sets *this to the identity matrix.
Definition: SparseMatrix.h:749
void conservativeResize(Index rows, Index cols)
Resizes the matrix to a rows x cols matrix leaving old values untouched.
Definition: SparseMatrix.h:556
Scalar & insertBackByOuterInner(Index outer, Index inner)
Definition: SparseMatrix.h:393
Base::IndexVector IndexVector
Definition: SparseMatrix.h:124
Index cols() const
Definition: SparseMatrix.h:140
EIGEN_DONT_INLINE Scalar & insertCompressed(Index row, Index col)
Definition: SparseMatrix.h:1396
SparseMatrix(const SparseSelfAdjointView< OtherDerived, UpLo > &other)
Constructs a sparse matrix from the sparse selfadjoint view other.
Definition: SparseMatrix.h:701
Scalar & insert(Index row, Index col)
Definition: SparseMatrix.h:1244
@ Options
Definition: SparseMatrix.h:121
Scalar & insertBack(Index row, Index col)
Definition: SparseMatrix.h:386
const Scalar * valuePtr() const
Definition: SparseMatrix.h:150
StorageIndex * innerNonZeroPtr()
Definition: SparseMatrix.h:181
StorageIndex * innerIndexPtr()
Definition: SparseMatrix.h:163
EIGEN_STRONG_INLINE Scalar & insertBackUncompressed(Index row, Index col)
Definition: SparseMatrix.h:894
Index m_innerSize
Definition: SparseMatrix.h:130
Scalar & insertByOuterInner(Index j, Index i)
Definition: SparseMatrix.h:460
void setFromTriplets(const InputIterators &begin, const InputIterators &end)
Fill the matrix *this with the list of triplets defined by the iterator range begin - end.
Definition: SparseMatrix.h:1108
Base::ScalarVector ScalarVector
Definition: SparseMatrix.h:125
void reserveInnerVectors(const SizesType &reserveSizes)
Definition: SparseMatrix.h:299
MappedSparseMatrix< Scalar, Flags > Map
Definition: SparseMatrix.h:111
void setZero()
Removes all non zeros but keep allocated memory.
Definition: SparseMatrix.h:253
void setFromTriplets(const InputIterators &begin, const InputIterators &end, DupFunctor dup_func)
The same as setFromTriplets but when duplicates are met the functor dup_func is applied:
Definition: SparseMatrix.h:1124
@ IsRowMajor
Definition: SparseMatrixBase.h:100
Scalar & coeffRef(Index row, Index col)
Definition: SparseMatrix.h:208
void swap(SparseMatrix &other)
Swaps the content of two sparse matrices of the same type.
Definition: SparseMatrix.h:737
Diagonal< SparseMatrix > DiagonalReturnType
Definition: SparseMatrix.h:112
EIGEN_DONT_INLINE SparseMatrix & operator=(const SparseMatrixBase< OtherDerived > &other)
void initAssignment(const Other &other)
Definition: SparseMatrix.h:858
SparseMatrix(const SparseMatrix &other)
Copy constructor (it performs a deep copy)
Definition: SparseMatrix.h:709
EIGEN_DONT_INLINE Scalar & insertUncompressed(Index row, Index col)
Definition: SparseMatrix.h:1364
DiagonalReturnType diagonal()
Definition: SparseMatrix.h:661
void resize(Index rows, Index cols)
Resizes the matrix to a rows x cols matrix and initializes it to zero.
Definition: SparseMatrix.h:626
Diagonal< const SparseMatrix > ConstDiagonalReturnType
Definition: SparseMatrix.h:113
Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix.
Definition: SparseSelfAdjointView.h:45
a sparse vector class
Definition: SparseVector.h:66
void reserve(Index size)
Definition: CompressedStorage.h:76
Index size() const
Definition: CompressedStorage.h:109
void moveChunk(Index from, Index to, Index chunkSize)
Definition: CompressedStorage.h:210
Index allocatedSize() const
Definition: CompressedStorage.h:110
Scalar atInRange(Index start, Index end, Index key, const Scalar &defaultValue=Scalar(0)) const
Like at(), but the search is performed in the range [start,end)
Definition: CompressedStorage.h:159
Scalar & value(Index i)
Definition: CompressedStorage.h:118
const Scalar * valuePtr() const
Definition: CompressedStorage.h:113
void clear()
Definition: CompressedStorage.h:111
void append(const Scalar &v, Index i)
Definition: CompressedStorage.h:101
StorageIndex & index(Index i)
Definition: CompressedStorage.h:121
void squeeze()
Definition: CompressedStorage.h:83
void resize(Index size, double reserveSizeFactor=0)
Definition: CompressedStorage.h:89
void swap(CompressedStorage &other)
Definition: CompressedStorage.h:62
const StorageIndex * indexPtr() const
Definition: CompressedStorage.h:115
Index searchLowerIndex(Index key) const
Definition: CompressedStorage.h:125
constexpr auto count() -> size_t
Definition: core.h:1204
type
Definition: core.h:575
@ ColMajor
Storage order is column major (see TopicStorageOrders).
Definition: Constants.h:319
@ RowMajor
Storage order is row major (see TopicStorageOrders).
Definition: Constants.h:321
const unsigned int LvalueBit
Means the expression has a coeffRef() method, i.e.
Definition: Constants.h:144
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition: Constants.h:66
const unsigned int CompressedAccessBit
Means that the underlying coefficients can be accessed through pointers to the sparse (un)compressed ...
Definition: Constants.h:191
constexpr common_t< T1, T2 > max(const T1 x, const T2 y) noexcept
Compile-time pairwise maximum function.
Definition: max.hpp:35
constexpr common_t< T1, T2 > min(const T1 x, const T2 y) noexcept
Compile-time pairwise minimum function.
Definition: min.hpp:35
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_assignment_no_alias(Dst &dst, const Src &src, const Func &func)
Definition: AssignEvaluator.h:873
EIGEN_DEVICE_FUNC IndexDest convert_index(const IndexSrc &idx)
Definition: XprHelper.h:31
EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
Definition: MathFunctions.h:1940
EIGEN_DEVICE_FUNC void throw_std_bad_alloc()
Definition: Memory.h:67
EIGEN_DEVICE_FUNC void smart_copy(const T *start, const T *end, T *target)
Definition: Memory.h:515
void set_from_triplets(const InputIterator &begin, const InputIterator &end, SparseMatrixType &mat, DupFunctor dup_func)
Definition: SparseMatrix.h:1035
EIGEN_STRONG_INLINE void swap(T &a, T &b)
Definition: Meta.h:766
static EIGEN_DEPRECATED const end_t end
Definition: IndexedViewHelper.h:181
Namespace containing all symbols from the Eigen library.
Definition: Core:141
const unsigned int NestByRefBit
Definition: Constants.h:169
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
const int InnerRandomAccessPattern
Definition: SparseUtil.h:48
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time,...
Definition: Constants.h:22
auto reserve(std::back_insert_iterator< Container > it, size_t n) -> checked_ptr< typename Container::value_type >
Definition: format.h:509
Definition: Eigen_Colamd.h:50
void swap(wpi::SmallPtrSet< T, N > &LHS, wpi::SmallPtrSet< T, N > &RHS)
Implement std::swap in terms of SmallPtrSet swap.
Definition: SmallPtrSet.h:512
The type used to identify a dense storage.
Definition: Constants.h:507
Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor Matrix...
Definition: EigenBase.h:30
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:39
EIGEN_DEVICE_FUNC Derived & derived()
Definition: EigenBase.h:46
The type used to identify a matrix expression.
Definition: Constants.h:522
Holds information about the various numeric (i.e.
Definition: NumTraits.h:233
The type used to identify a general sparse storage.
Definition: Constants.h:510
Definition: SparseMatrix.h:907
Index i
Definition: SparseMatrix.h:909
Index p
Definition: SparseMatrix.h:910
IndexPosPair(Index a_i, Index a_p)
Definition: SparseMatrix.h:908
Definition: AssignEvaluator.h:824
Definition: SparseUtil.h:144
SparseMatrix< _Scalar, _Options, _StorageIndex > SparseMatrixType
Definition: SparseMatrix.h:1509
evaluator< SparseCompressedBase< SparseMatrix< _Scalar, _Options, _StorageIndex > > > Base
Definition: SparseMatrix.h:1508
evaluator(const SparseMatrixType &mat)
Definition: SparseMatrix.h:1511
evaluator()
Definition: SparseMatrix.h:1510
Definition: CoreEvaluators.h:91
Definition: XprHelper.h:458
Definition: XprHelper.h:417
T type
Definition: Meta.h:126
T type
Definition: Meta.h:114
Definition: BinaryFunctors.h:33
MatrixXpr XprKind
Definition: SparseMatrix.h:73
remove_reference< MatrixTypeNested >::type _MatrixTypeNested
Definition: SparseMatrix.h:68
_StorageIndex StorageIndex
Definition: SparseMatrix.h:72
_Scalar Scalar
Definition: SparseMatrix.h:70
SparseMatrix< _Scalar, _Options, _StorageIndex > MatrixType
Definition: SparseMatrix.h:66
ref_selector< MatrixType >::type MatrixTypeNested
Definition: SparseMatrix.h:67
Dense StorageKind
Definition: SparseMatrix.h:71
_StorageIndex StorageIndex
Definition: SparseMatrix.h:50
Sparse StorageKind
Definition: SparseMatrix.h:51
MatrixXpr XprKind
Definition: SparseMatrix.h:52
_Scalar Scalar
Definition: SparseMatrix.h:49
Definition: ForwardDeclarations.h:17