Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols > Class Template Reference

#include <SparseBlock.h>

+ Inheritance diagram for Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >:

Public Types

enum  { IsRowMajor = internal::traits<BlockType>::IsRowMajor }
 
- Public Types inherited from Eigen::SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >
typedef SparseMatrixBase< Block< SparseMatrixType, BlockRows, BlockCols, true > > Base
 
- Public Types inherited from Eigen::SparseMatrixBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >
enum  
 
typedef internal::traits< Block< SparseMatrixType, BlockRows, BlockCols, true > >::Scalar Scalar
 
typedef Scalar value_type
 
typedef internal::packet_traits< Scalar >::type PacketScalar
 
typedef internal::traits< Block< SparseMatrixType, BlockRows, BlockCols, true > >::StorageKind StorageKind
 
typedef internal::traits< Block< SparseMatrixType, BlockRows, BlockCols, true > >::StorageIndex StorageIndex
 
typedef internal::add_const_on_value_type_if_arithmetic< typename internal::packet_traits< Scalar >::type >::type PacketReturnType
 
typedef SparseMatrixBase StorageBaseType
 
typedef Matrix< StorageIndex, Dynamic, 1 > IndexVector
 
typedef Matrix< Scalar, Dynamic, 1 > ScalarVector
 
typedef std::conditional_t< NumTraits< Scalar >::IsComplex, CwiseUnaryOp< internal::scalar_conjugate_op< Scalar >, Eigen::Transpose< const Block< SparseMatrixType, BlockRows, BlockCols, true > > >, Transpose< const Block< SparseMatrixType, BlockRows, BlockCols, true > > > AdjointReturnType
 
typedef Transpose< Block< SparseMatrixType, BlockRows, BlockCols, true > > TransposeReturnType
 
typedef Transpose< const Block< SparseMatrixType, BlockRows, BlockCols, true > > ConstTransposeReturnType
 
typedef SparseMatrix< Scalar, Flags &RowMajorBit ? RowMajor :ColMajor, StorageIndexPlainObject
 
typedef NumTraits< Scalar >::Real RealScalar
 
typedef std::conditional_t< HasDirectAccess_, const Scalar &, ScalarCoeffReturnType
 
typedef CwiseNullaryOp< internal::scalar_constant_op< Scalar >, Matrix< Scalar, Dynamic, Dynamic > > ConstantReturnType
 
typedef Matrix< Scalar, RowsAtCompileTime, ColsAtCompileTimeDenseMatrixType
 
typedef Matrix< Scalar, internal::max_size_prefer_dynamic(RowsAtCompileTime, ColsAtCompileTime), internal::max_size_prefer_dynamic(RowsAtCompileTime, ColsAtCompileTime)> SquareMatrixType
 
typedef EigenBase< Block< SparseMatrixType, BlockRows, BlockCols, true > > Base
 
- Public Types inherited from Eigen::EigenBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >
typedef Eigen::Index Index
 The interface type of indices. More...
 
typedef internal::traits< Block< SparseMatrixType, BlockRows, BlockCols, true > >::StorageKind StorageKind
 

Public Member Functions

 sparse_matrix_block_impl (SparseMatrixType &xpr, Index i)
 
 sparse_matrix_block_impl (SparseMatrixType &xpr, Index startRow, Index startCol, Index blockRows, Index blockCols)
 
template<typename OtherDerived >
BlockTypeoperator= (const SparseMatrixBase< OtherDerived > &other)
 
BlockTypeoperator= (const BlockType &other)
 
const ScalarvaluePtr () const
 
ScalarvaluePtr ()
 
const StorageIndexinnerIndexPtr () const
 
StorageIndexinnerIndexPtr ()
 
const StorageIndexouterIndexPtr () const
 
StorageIndexouterIndexPtr ()
 
const StorageIndexinnerNonZeroPtr () const
 
StorageIndexinnerNonZeroPtr ()
 
bool isCompressed () const
 
ScalarcoeffRef (Index row, Index col)
 
const Scalar coeff (Index row, Index col) const
 
const Scalar coeff (Index index) const
 
const ScalarlastCoeff () const
 
EIGEN_STRONG_INLINE Index rows () const
 
EIGEN_STRONG_INLINE Index cols () const
 
const SparseMatrixType & nestedExpression () const
 
SparseMatrixType & nestedExpression ()
 
Index startRow () const
 
Index startCol () const
 
Index blockRows () const
 
Index blockCols () const
 
- Public Member Functions inherited from Eigen::SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >
Index nonZeros () const
 
const ScalarvaluePtr () const
 
ScalarvaluePtr ()
 
const StorageIndexinnerIndexPtr () const
 
StorageIndexinnerIndexPtr ()
 
const StorageIndexouterIndexPtr () const
 
StorageIndexouterIndexPtr ()
 
const StorageIndexinnerNonZeroPtr () const
 
StorageIndexinnerNonZeroPtr ()
 
bool isCompressed () const
 
const Map< const Array< Scalar, Dynamic, 1 > > coeffs () const
 
Map< Array< Scalar, Dynamic, 1 > > coeffs ()
 
void sortInnerIndices (Index begin, Index end)
 
void sortInnerIndices ()
 
Index innerIndicesAreSorted (Index begin, Index end) const
 
Index innerIndicesAreSorted () const
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator= (const EigenBase< OtherDerived > &other)
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator= (const ReturnByValue< OtherDerived > &other)
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator= (const SparseMatrixBase< OtherDerived > &other)
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator= (const Block< SparseMatrixType, BlockRows, BlockCols, true > &other)
 
- Public Member Functions inherited from Eigen::SparseMatrixBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator= (const EigenBase< OtherDerived > &other)
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator= (const ReturnByValue< OtherDerived > &other)
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator= (const SparseMatrixBase< OtherDerived > &other)
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator= (const Block< SparseMatrixType, BlockRows, BlockCols, true > &other)
 
const Block< SparseMatrixType, BlockRows, BlockCols, true > & derived () const
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & derived ()
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & const_cast_derived () const
 
Index rows () const
 
Index cols () const
 
Index size () const
 
bool isVector () const
 
Index outerSize () const
 
Index innerSize () const
 
bool isRValue () const
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & markAsRValue ()
 
 SparseMatrixBase ()
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator+= (const SparseMatrixBase< OtherDerived > &other)
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator+= (const DiagonalBase< OtherDerived > &other)
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator+= (const EigenBase< OtherDerived > &other)
 
EIGEN_STRONG_INLINE Block< SparseMatrixType, BlockRows, BlockCols, true > & operator+= (const SparseMatrixBase< OtherDerived > &other)
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator-= (const SparseMatrixBase< OtherDerived > &other)
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator-= (const DiagonalBase< OtherDerived > &other)
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator-= (const EigenBase< OtherDerived > &other)
 
EIGEN_STRONG_INLINE Block< SparseMatrixType, BlockRows, BlockCols, true > & operator-= (const SparseMatrixBase< OtherDerived > &other)
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator*= (const Scalar &other)
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator*= (const SparseMatrixBase< OtherDerived > &other)
 
Block< SparseMatrixType, BlockRows, BlockCols, true > & operator/= (const Scalar &other)
 
EIGEN_STRONG_INLINE const CwiseProductDenseReturnType< OtherDerived >::Type cwiseProduct (const MatrixBase< OtherDerived > &other) const
 
EIGEN_STRONG_INLINE const SparseMatrixBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >::template CwiseProductDenseReturnType< OtherDerived >::Type cwiseProduct (const MatrixBase< OtherDerived > &other) const
 
const Product< Block< SparseMatrixType, BlockRows, BlockCols, true >, OtherDerived > operator* (const DiagonalBase< OtherDerived > &other) const
 
const Product< Block< SparseMatrixType, BlockRows, BlockCols, true >, OtherDerived, AliasFreeProduct > operator* (const SparseMatrixBase< OtherDerived > &other) const
 
const Product< Block< SparseMatrixType, BlockRows, BlockCols, true >, OtherDerived > operator* (const MatrixBase< OtherDerived > &other) const
 
SparseSymmetricPermutationProduct< Block< SparseMatrixType, BlockRows, BlockCols, true >, Upper|Lower > twistedBy (const PermutationMatrix< Dynamic, Dynamic, StorageIndex > &perm) const
 
const TriangularView< const Block< SparseMatrixType, BlockRows, BlockCols, true >, Mode > triangularView () const
 
ConstSelfAdjointViewReturnType< UpLo >::Type selfadjointView () const
 
SelfAdjointViewReturnType< UpLo >::Type selfadjointView ()
 
SparseMatrixBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >::template ConstSelfAdjointViewReturnType< UpLo >::Type selfadjointView () const
 
SparseMatrixBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >::template SelfAdjointViewReturnType< UpLo >::Type selfadjointView ()
 
Scalar dot (const MatrixBase< OtherDerived > &other) const
 
Scalar dot (const SparseMatrixBase< OtherDerived > &other) const
 
internal::traits< Block< SparseMatrixType, BlockRows, BlockCols, true > >::Scalar dot (const MatrixBase< OtherDerived > &other) const
 
internal::traits< Block< SparseMatrixType, BlockRows, BlockCols, true > >::Scalar dot (const SparseMatrixBase< OtherDerived > &other) const
 
RealScalar squaredNorm () const
 
RealScalar norm () const
 
RealScalar blueNorm () const
 
TransposeReturnType transpose ()
 
const ConstTransposeReturnType transpose () const
 
const AdjointReturnType adjoint () const
 
DenseMatrixType toDense () const
 
bool isApprox (const SparseMatrixBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
 
bool isApprox (const MatrixBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
 
const internal::eval< Block< SparseMatrixType, BlockRows, BlockCols, true > >::type eval () const
 
Scalar sum () const
 
const SparseView< Block< SparseMatrixType, BlockRows, BlockCols, true > > pruned (const Scalar &reference=Scalar(0), const RealScalar &epsilon=NumTraits< Scalar >::dummy_precision()) const
 
- Public Member Functions inherited from Eigen::EigenBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >
constexpr EIGEN_DEVICE_FUNC Block< SparseMatrixType, BlockRows, BlockCols, true > & derived ()
 
constexpr EIGEN_DEVICE_FUNC const Block< SparseMatrixType, BlockRows, BlockCols, true > & derived () const
 
EIGEN_DEVICE_FUNC Block< SparseMatrixType, BlockRows, BlockCols, true > & const_cast_derived () const
 
EIGEN_DEVICE_FUNC const Block< SparseMatrixType, BlockRows, BlockCols, true > & const_derived () const
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size () const EIGEN_NOEXCEPT
 
EIGEN_DEVICE_FUNC void evalTo (Dest &dst) const
 
EIGEN_DEVICE_FUNC void addTo (Dest &dst) const
 
EIGEN_DEVICE_FUNC void subTo (Dest &dst) const
 
EIGEN_DEVICE_FUNC void applyThisOnTheRight (Dest &dst) const
 
EIGEN_DEVICE_FUNC void applyThisOnTheLeft (Dest &dst) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DeviceWrapper< Block< SparseMatrixType, BlockRows, BlockCols, true >, Device > device (Device &device)
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DeviceWrapper< const Block< SparseMatrixType, BlockRows, BlockCols, true >, Device > device (Device &device) const
 

Protected Types

enum  { OuterSize = IsRowMajor ? BlockRows : BlockCols }
 
typedef Base::IndexVector IndexVector
 
- Protected Types inherited from Eigen::SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >
typedef Base::IndexVector IndexVector
 

Protected Attributes

internal::ref_selector< SparseMatrixType >::non_const_type m_matrix
 
Index m_outerStart
 
const internal::variable_if_dynamic< Index, OuterSizem_outerSize
 
- Protected Attributes inherited from Eigen::SparseMatrixBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >
bool m_isRValue
 

Private Types

typedef internal::remove_all_t< typename SparseMatrixType::Nested > MatrixTypeNested_
 
typedef Block< SparseMatrixType, BlockRows, BlockCols, true > BlockType
 
typedef SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > > Base
 

Additional Inherited Members

- Protected Member Functions inherited from Eigen::SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >
Eigen::Map< IndexVectorinnerNonZeros ()
 
const Eigen::Map< const IndexVectorinnerNonZeros () const
 
 SparseCompressedBase ()
 
internal::LowerBoundIndex lower_bound (Index row, Index col) const
 
- Protected Member Functions inherited from Eigen::SparseMatrixBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >
Block< SparseMatrixType, BlockRows, BlockCols, true > & assign (const OtherDerived &other)
 
void assignGeneric (const OtherDerived &other)
 
- Static Protected Member Functions inherited from Eigen::SparseMatrixBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >
static StorageIndex convert_index (const Index idx)
 

Member Typedef Documentation

◆ Base

template<typename SparseMatrixType , int BlockRows, int BlockCols>
typedef SparseCompressedBase<Block<SparseMatrixType, BlockRows, BlockCols, true> > Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::Base
private

◆ BlockType

template<typename SparseMatrixType , int BlockRows, int BlockCols>
typedef Block<SparseMatrixType, BlockRows, BlockCols, true> Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::BlockType
private

◆ IndexVector

template<typename SparseMatrixType , int BlockRows, int BlockCols>
typedef Base::IndexVector Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::IndexVector
protected

◆ MatrixTypeNested_

template<typename SparseMatrixType , int BlockRows, int BlockCols>
typedef internal::remove_all_t<typename SparseMatrixType::Nested> Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::MatrixTypeNested_
private

Member Enumeration Documentation

◆ anonymous enum

template<typename SparseMatrixType , int BlockRows, int BlockCols>
anonymous enum
Enumerator
IsRowMajor 
100 { IsRowMajor = internal::traits<BlockType>::IsRowMajor };
@ IsRowMajor
Definition: SparseBlock.h:100

◆ anonymous enum

template<typename SparseMatrixType , int BlockRows, int BlockCols>
anonymous enum
protected
Enumerator
OuterSize 
104 { OuterSize = IsRowMajor ? BlockRows : BlockCols };
@ OuterSize
Definition: SparseBlock.h:104

Constructor & Destructor Documentation

◆ sparse_matrix_block_impl() [1/2]

template<typename SparseMatrixType , int BlockRows, int BlockCols>
Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::sparse_matrix_block_impl ( SparseMatrixType &  xpr,
Index  i 
)
inline
int i
Definition: BiCGSTAB_step_by_step.cpp:9
static StorageIndex convert_index(const Index idx)
Definition: SparseMatrixBase.h:391
internal::ref_selector< SparseMatrixType >::non_const_type m_matrix
Definition: SparseBlock.h:253
const internal::variable_if_dynamic< Index, OuterSize > m_outerSize
Definition: SparseBlock.h:255
Index m_outerStart
Definition: SparseBlock.h:254

◆ sparse_matrix_block_impl() [2/2]

template<typename SparseMatrixType , int BlockRows, int BlockCols>
Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::sparse_matrix_block_impl ( SparseMatrixType &  xpr,
Index  startRow,
Index  startCol,
Index  blockRows,
Index  blockCols 
)
inline
112  : m_matrix(xpr),
Index blockRows() const
Definition: SparseBlock.h:249
Index startCol() const
Definition: SparseBlock.h:248
Index blockCols() const
Definition: SparseBlock.h:250
Index startRow() const
Definition: SparseBlock.h:247

Member Function Documentation

◆ blockCols()

◆ blockRows()

◆ coeff() [1/2]

◆ coeff() [2/2]

◆ coeffRef()

◆ cols()

◆ innerIndexPtr() [1/2]

template<typename SparseMatrixType , int BlockRows, int BlockCols>
StorageIndex* Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::innerIndexPtr ( )
inline

◆ innerIndexPtr() [2/2]

template<typename SparseMatrixType , int BlockRows, int BlockCols>
const StorageIndex* Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::innerIndexPtr ( ) const
inline

◆ innerNonZeroPtr() [1/2]

◆ innerNonZeroPtr() [2/2]

◆ isCompressed()

template<typename SparseMatrixType , int BlockRows, int BlockCols>
bool Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::isCompressed ( ) const
inline

◆ lastCoeff()

template<typename SparseMatrixType , int BlockRows, int BlockCols>
const Scalar& Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::lastCoeff ( ) const
inline
233  {
236  if (m_matrix.isCompressed())
237  return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart + 1] - 1];
238  else
239  return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart] + m_matrix.innerNonZeroPtr()[m_outerStart] - 1];
240  }
#define eigen_assert(x)
Definition: Macros.h:910
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
Definition: StaticAssert.h:36
sparse_matrix_block_impl(SparseMatrixType &xpr, Index i)
Definition: SparseBlock.h:107

References eigen_assert, EIGEN_STATIC_ASSERT_VECTOR_ONLY, Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::m_matrix, Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::m_outerStart, and Eigen::SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >::nonZeros().

◆ nestedExpression() [1/2]

template<typename SparseMatrixType , int BlockRows, int BlockCols>
SparseMatrixType& Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::nestedExpression ( )
inline

◆ nestedExpression() [2/2]

template<typename SparseMatrixType , int BlockRows, int BlockCols>
const SparseMatrixType& Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::nestedExpression ( ) const
inline

◆ operator=() [1/2]

template<typename SparseMatrixType , int BlockRows, int BlockCols>
BlockType& Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::operator= ( const BlockType other)
inline
203 { return operator= <BlockType>(other); }
Block< SparseMatrixType, BlockRows, BlockCols, true > BlockType
Definition: SparseBlock.h:95

◆ operator=() [2/2]

template<typename SparseMatrixType , int BlockRows, int BlockCols>
template<typename OtherDerived >
BlockType& Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::operator= ( const SparseMatrixBase< OtherDerived > &  other)
inline
117  {
118  typedef internal::remove_all_t<typename SparseMatrixType::Nested> NestedMatrixType_;
119  NestedMatrixType_& matrix = m_matrix;
120  // This assignment is slow if this vector set is not empty
121  // and/or it is not at the end of the nonzeros of the underlying matrix.
122 
123  // 1 - eval to a temporary to avoid transposition and/or aliasing issues
124  Ref<const SparseMatrix<Scalar, IsRowMajor ? RowMajor : ColMajor, StorageIndex> > tmp(other.derived());
125  eigen_internal_assert(tmp.outerSize() == m_outerSize.value());
126 
127  // 2 - let's check whether there is enough allocated memory
128  Index nnz = tmp.nonZeros();
129  Index start =
130  m_outerStart == 0 ? 0 : m_matrix.outerIndexPtr()[m_outerStart]; // starting position of the current block
131  Index end = m_matrix.outerIndexPtr()[m_outerStart + m_outerSize.value()]; // ending position of the current block
132  Index block_size = end - start; // available room in the current block
133  Index tail_size = m_matrix.outerIndexPtr()[m_matrix.outerSize()] - end;
134 
135  Index free_size = m_matrix.isCompressed() ? Index(matrix.data().allocatedSize()) + block_size : block_size;
136 
137  Index tmp_start = tmp.outerIndexPtr()[0];
138 
139  bool update_trailing_pointers = false;
140  if (nnz > free_size) {
141  // realloc manually to reduce copies
142  typename SparseMatrixType::Storage newdata(m_matrix.data().allocatedSize() - block_size + nnz);
143 
144  internal::smart_copy(m_matrix.valuePtr(), m_matrix.valuePtr() + start, newdata.valuePtr());
145  internal::smart_copy(m_matrix.innerIndexPtr(), m_matrix.innerIndexPtr() + start, newdata.indexPtr());
146 
147  internal::smart_copy(tmp.valuePtr() + tmp_start, tmp.valuePtr() + tmp_start + nnz, newdata.valuePtr() + start);
148  internal::smart_copy(tmp.innerIndexPtr() + tmp_start, tmp.innerIndexPtr() + tmp_start + nnz,
149  newdata.indexPtr() + start);
150 
151  internal::smart_copy(matrix.valuePtr() + end, matrix.valuePtr() + end + tail_size,
152  newdata.valuePtr() + start + nnz);
153  internal::smart_copy(matrix.innerIndexPtr() + end, matrix.innerIndexPtr() + end + tail_size,
154  newdata.indexPtr() + start + nnz);
155 
156  newdata.resize(m_matrix.outerIndexPtr()[m_matrix.outerSize()] - block_size + nnz);
157 
158  matrix.data().swap(newdata);
159 
160  update_trailing_pointers = true;
161  } else {
162  if (m_matrix.isCompressed() && nnz != block_size) {
163  // no need to realloc, simply copy the tail at its respective position and insert tmp
164  matrix.data().resize(start + nnz + tail_size);
165 
166  internal::smart_memmove(matrix.valuePtr() + end, matrix.valuePtr() + end + tail_size,
167  matrix.valuePtr() + start + nnz);
168  internal::smart_memmove(matrix.innerIndexPtr() + end, matrix.innerIndexPtr() + end + tail_size,
169  matrix.innerIndexPtr() + start + nnz);
170 
171  update_trailing_pointers = true;
172  }
173 
174  internal::smart_copy(tmp.valuePtr() + tmp_start, tmp.valuePtr() + tmp_start + nnz, matrix.valuePtr() + start);
175  internal::smart_copy(tmp.innerIndexPtr() + tmp_start, tmp.innerIndexPtr() + tmp_start + nnz,
176  matrix.innerIndexPtr() + start);
177  }
178 
179  // update outer index pointers and innerNonZeros
180  if (IsVectorAtCompileTime) {
181  if (!m_matrix.isCompressed()) matrix.innerNonZeroPtr()[m_outerStart] = StorageIndex(nnz);
182  matrix.outerIndexPtr()[m_outerStart] = StorageIndex(start);
183  } else {
185  for (Index k = 0; k < m_outerSize.value(); ++k) {
186  StorageIndex nnz_k = internal::convert_index<StorageIndex>(tmp.innerVector(k).nonZeros());
187  if (!m_matrix.isCompressed()) matrix.innerNonZeroPtr()[m_outerStart + k] = nnz_k;
188  matrix.outerIndexPtr()[m_outerStart + k] = p;
189  p += nnz_k;
190  }
191  }
192 
193  if (update_trailing_pointers) {
194  StorageIndex offset = internal::convert_index<StorageIndex>(nnz - block_size);
195  for (Index k = m_outerStart + m_outerSize.value(); k <= matrix.outerSize(); ++k) {
196  matrix.outerIndexPtr()[k] += offset;
197  }
198  }
199 
200  return derived();
201  }
#define eigen_internal_assert(x)
Definition: Macros.h:916
float * p
Definition: Tutorial_Map_using.cpp:9
internal::traits< Block< SparseMatrixType, BlockRows, BlockCols, true > >::StorageIndex StorageIndex
Definition: SparseMatrixBase.h:44
const Block< SparseMatrixType, BlockRows, BlockCols, true > & derived() const
Definition: SparseMatrixBase.h:144
Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor >, 0, Eigen::OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition: common.h:85
static constexpr lastp1_t end
Definition: IndexedViewHelper.h:79
char char char int int * k
Definition: level2_impl.h:374
Eigen::Matrix< Scalar, Dynamic, Dynamic, ColMajor > tmp
Definition: level3_impl.h:365
EIGEN_DEVICE_FUNC void smart_copy(const T *start, const T *end, T *target)
Definition: Memory.h:569
void smart_memmove(const T *start, const T *end, T *target)
Definition: Memory.h:594
void start(const unsigned &i)
(Re-)start i-th timer
Definition: oomph_utilities.cc:243
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:43

References Eigen::SparseMatrixBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >::derived(), Eigen::SparseMatrixBase< Derived >::derived(), eigen_internal_assert, Eigen::placeholders::end, Eigen::SparseMatrixBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >::IsVectorAtCompileTime, k, Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::m_matrix, Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::m_outerSize, Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::m_outerStart, matrix(), p, Eigen::internal::smart_copy(), Eigen::internal::smart_memmove(), oomph::CumulativeTimings::start(), tmp, and Eigen::internal::variable_if_dynamic< T, Value >::value().

◆ outerIndexPtr() [1/2]

template<typename SparseMatrixType , int BlockRows, int BlockCols>
StorageIndex* Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::outerIndexPtr ( )
inline

◆ outerIndexPtr() [2/2]

template<typename SparseMatrixType , int BlockRows, int BlockCols>
const StorageIndex* Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::outerIndexPtr ( ) const
inline

◆ rows()

◆ startCol()

template<typename SparseMatrixType , int BlockRows, int BlockCols>
Index Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::startCol ( ) const
inline

◆ startRow()

template<typename SparseMatrixType , int BlockRows, int BlockCols>
Index Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::startRow ( ) const
inline

◆ valuePtr() [1/2]

template<typename SparseMatrixType , int BlockRows, int BlockCols>
Scalar* Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::valuePtr ( )
inline

◆ valuePtr() [2/2]

template<typename SparseMatrixType , int BlockRows, int BlockCols>
const Scalar* Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::valuePtr ( ) const
inline

Member Data Documentation

◆ m_matrix

template<typename SparseMatrixType , int BlockRows, int BlockCols>
internal::ref_selector<SparseMatrixType>::non_const_type Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::m_matrix
protected

◆ m_outerSize

◆ m_outerStart


The documentation for this class was generated from the following file: