|
MOAB
4.9.3pre
|
#include <SparseBlock.h>


Public Types | |
| enum | { IsRowMajor = internal::traits<BlockType>::IsRowMajor } |
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 > | |
| BlockType & | operator= (const SparseMatrixBase< OtherDerived > &other) |
| BlockType & | operator= (const BlockType &other) |
| const Scalar * | valuePtr () const |
| Scalar * | valuePtr () |
| const StorageIndex * | innerIndexPtr () const |
| StorageIndex * | innerIndexPtr () |
| const StorageIndex * | outerIndexPtr () const |
| StorageIndex * | outerIndexPtr () |
| const StorageIndex * | innerNonZeroPtr () const |
| StorageIndex * | innerNonZeroPtr () |
| bool | isCompressed () const |
| Scalar & | coeffRef (Index row, Index col) |
| const Scalar | coeff (Index row, Index col) const |
| const Scalar | coeff (Index index) const |
| const Scalar & | lastCoeff () 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 |
Protected Types | |
| enum | { OuterSize = IsRowMajor ? BlockRows : BlockCols } |
| typedef Base::IndexVector | IndexVector |
Protected Attributes | |
| internal::ref_selector < SparseMatrixType > ::non_const_type | m_matrix |
| Index | m_outerStart |
| const internal::variable_if_dynamic < Index, OuterSize > | m_outerSize |
Private Types | |
| typedef internal::remove_all < typename SparseMatrixType::Nested > ::type | _MatrixTypeNested |
| typedef Block < SparseMatrixType, BlockRows, BlockCols, true > | BlockType |
| typedef SparseCompressedBase < Block< SparseMatrixType, BlockRows, BlockCols, true > > | Base |
Definition at line 96 of file SparseBlock.h.
typedef internal::remove_all<typename SparseMatrixType::Nested>::type Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::_MatrixTypeNested [private] |
Definition at line 99 of file SparseBlock.h.
typedef SparseCompressedBase<Block<SparseMatrixType,BlockRows,BlockCols,true> > Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::Base [private] |
Reimplemented from Eigen::SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >.
Reimplemented in Eigen::BlockImpl< const SparseMatrix< _Scalar, _Options, _StorageIndex >, BlockRows, BlockCols, true, Sparse >, and Eigen::BlockImpl< SparseMatrix< _Scalar, _Options, _StorageIndex >, BlockRows, BlockCols, true, Sparse >.
Definition at line 101 of file SparseBlock.h.
typedef Block<SparseMatrixType, BlockRows, BlockCols, true> Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::BlockType [private] |
Definition at line 100 of file SparseBlock.h.
typedef Base::IndexVector Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::IndexVector [protected] |
Reimplemented from Eigen::SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >.
Definition at line 107 of file SparseBlock.h.
| anonymous enum |
Definition at line 104 of file SparseBlock.h.
{ IsRowMajor = internal::traits<BlockType>::IsRowMajor };
anonymous enum [protected] |
Definition at line 108 of file SparseBlock.h.
{ OuterSize = IsRowMajor ? BlockRows : BlockCols };
| Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::sparse_matrix_block_impl | ( | SparseMatrixType & | xpr, |
| Index | i | ||
| ) | [inline] |
Definition at line 111 of file SparseBlock.h.
: m_matrix(xpr), m_outerStart(convert_index(i)), m_outerSize(OuterSize) {}
| Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::sparse_matrix_block_impl | ( | SparseMatrixType & | xpr, |
| Index | startRow, | ||
| Index | startCol, | ||
| Index | blockRows, | ||
| Index | blockCols | ||
| ) | [inline] |
Definition at line 115 of file SparseBlock.h.
: m_matrix(xpr), m_outerStart(convert_index(IsRowMajor ? startRow : startCol)), m_outerSize(convert_index(IsRowMajor ? blockRows : blockCols)) {}
| Index Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::blockCols | ( | ) | const [inline] |
Definition at line 272 of file SparseBlock.h.
{ return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
| Index Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::blockRows | ( | ) | const [inline] |
Definition at line 271 of file SparseBlock.h.
{ return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
| const Scalar Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::coeff | ( | Index | row, |
| Index | col | ||
| ) | const [inline] |
Definition at line 244 of file SparseBlock.h.
{
return m_matrix.coeff(row + (IsRowMajor ? m_outerStart : 0), col + (IsRowMajor ? 0 : m_outerStart));
}
| const Scalar Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::coeff | ( | Index | index | ) | const [inline] |
Definition at line 249 of file SparseBlock.h.
{
return m_matrix.coeff(IsRowMajor ? m_outerStart : index, IsRowMajor ? index : m_outerStart);
}
| Scalar& Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::coeffRef | ( | Index | row, |
| Index | col | ||
| ) | [inline] |
Definition at line 239 of file SparseBlock.h.
{
return m_matrix.coeffRef(row + (IsRowMajor ? m_outerStart : 0), col + (IsRowMajor ? 0 : m_outerStart));
}
| EIGEN_STRONG_INLINE Index Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::cols | ( | void | ) | const [inline] |
Reimplemented from Eigen::SparseMatrixBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >.
Definition at line 265 of file SparseBlock.h.
{ return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
| const StorageIndex* Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::innerIndexPtr | ( | ) | const [inline] |
Reimplemented from Eigen::SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >.
Definition at line 222 of file SparseBlock.h.
{ return m_matrix.innerIndexPtr(); }
| StorageIndex* Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::innerIndexPtr | ( | ) | [inline] |
Reimplemented from Eigen::SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >.
Definition at line 224 of file SparseBlock.h.
{ return m_matrix.innerIndexPtr(); }
| const StorageIndex* Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::innerNonZeroPtr | ( | ) | const [inline] |
Reimplemented from Eigen::SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >.
Definition at line 232 of file SparseBlock.h.
{ return isCompressed() ? 0 : (m_matrix.innerNonZeroPtr()+m_outerStart); }
| StorageIndex* Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::innerNonZeroPtr | ( | ) | [inline] |
Reimplemented from Eigen::SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >.
Definition at line 234 of file SparseBlock.h.
{ return isCompressed() ? 0 : (m_matrix.innerNonZeroPtr()+m_outerStart); }
| bool Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::isCompressed | ( | ) | const [inline] |
*this is in compressed form. Reimplemented from Eigen::SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >.
Definition at line 237 of file SparseBlock.h.
{ return m_matrix.innerNonZeroPtr()==0; }
| const Scalar& Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::lastCoeff | ( | ) | const [inline] |
Definition at line 254 of file SparseBlock.h.
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(sparse_matrix_block_impl);
eigen_assert(Base::nonZeros()>0);
if(m_matrix.isCompressed())
return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart+1]-1];
else
return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart]+m_matrix.innerNonZeroPtr()[m_outerStart]-1];
}
| const SparseMatrixType& Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::nestedExpression | ( | ) | const [inline] |
Definition at line 267 of file SparseBlock.h.
{ return m_matrix; }
| SparseMatrixType& Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::nestedExpression | ( | ) | [inline] |
Definition at line 268 of file SparseBlock.h.
{ return m_matrix; }
| BlockType& Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::operator= | ( | const SparseMatrixBase< OtherDerived > & | other | ) | [inline] |
Reimplemented from Eigen::SparseMatrixBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >.
Definition at line 120 of file SparseBlock.h.
{
typedef typename internal::remove_all<typename SparseMatrixType::Nested>::type _NestedMatrixType;
_NestedMatrixType& matrix = m_matrix;
// This assignment is slow if this vector set is not empty
// and/or it is not at the end of the nonzeros of the underlying matrix.
// 1 - eval to a temporary to avoid transposition and/or aliasing issues
Ref<const SparseMatrix<Scalar, IsRowMajor ? RowMajor : ColMajor, StorageIndex> > tmp(other.derived());
eigen_internal_assert(tmp.outerSize()==m_outerSize.value());
// 2 - let's check whether there is enough allocated memory
Index nnz = tmp.nonZeros();
Index start = m_outerStart==0 ? 0 : matrix.outerIndexPtr()[m_outerStart]; // starting position of the current block
Index end = m_matrix.outerIndexPtr()[m_outerStart+m_outerSize.value()]; // ending position of the current block
Index block_size = end - start; // available room in the current block
Index tail_size = m_matrix.outerIndexPtr()[m_matrix.outerSize()] - end;
Index free_size = m_matrix.isCompressed()
? Index(matrix.data().allocatedSize()) + block_size
: block_size;
bool update_trailing_pointers = false;
if(nnz>free_size)
{
// realloc manually to reduce copies
typename SparseMatrixType::Storage newdata(m_matrix.data().allocatedSize() - block_size + nnz);
internal::smart_copy(m_matrix.valuePtr(), m_matrix.valuePtr() + start, newdata.valuePtr());
internal::smart_copy(m_matrix.innerIndexPtr(), m_matrix.innerIndexPtr() + start, newdata.indexPtr());
internal::smart_copy(tmp.valuePtr(), tmp.valuePtr() + nnz, newdata.valuePtr() + start);
internal::smart_copy(tmp.innerIndexPtr(), tmp.innerIndexPtr() + nnz, newdata.indexPtr() + start);
internal::smart_copy(matrix.valuePtr()+end, matrix.valuePtr()+end + tail_size, newdata.valuePtr()+start+nnz);
internal::smart_copy(matrix.innerIndexPtr()+end, matrix.innerIndexPtr()+end + tail_size, newdata.indexPtr()+start+nnz);
newdata.resize(m_matrix.outerIndexPtr()[m_matrix.outerSize()] - block_size + nnz);
matrix.data().swap(newdata);
update_trailing_pointers = true;
}
else
{
if(m_matrix.isCompressed())
{
// no need to realloc, simply copy the tail at its respective position and insert tmp
matrix.data().resize(start + nnz + tail_size);
internal::smart_memmove(matrix.valuePtr()+end, matrix.valuePtr() + end+tail_size, matrix.valuePtr() + start+nnz);
internal::smart_memmove(matrix.innerIndexPtr()+end, matrix.innerIndexPtr() + end+tail_size, matrix.innerIndexPtr() + start+nnz);
update_trailing_pointers = true;
}
internal::smart_copy(tmp.valuePtr(), tmp.valuePtr() + nnz, matrix.valuePtr() + start);
internal::smart_copy(tmp.innerIndexPtr(), tmp.innerIndexPtr() + nnz, matrix.innerIndexPtr() + start);
}
// update outer index pointers and innerNonZeros
if(IsVectorAtCompileTime)
{
if(!m_matrix.isCompressed())
matrix.innerNonZeroPtr()[m_outerStart] = StorageIndex(nnz);
matrix.outerIndexPtr()[m_outerStart] = StorageIndex(start);
}
else
{
StorageIndex p = StorageIndex(start);
for(Index k=0; k<m_outerSize.value(); ++k)
{
Index nnz_k = tmp.innerVector(k).nonZeros();
if(!m_matrix.isCompressed())
matrix.innerNonZeroPtr()[m_outerStart+k] = StorageIndex(nnz_k);
matrix.outerIndexPtr()[m_outerStart+k] = p;
p += nnz_k;
}
}
if(update_trailing_pointers)
{
StorageIndex offset = internal::convert_index<StorageIndex>(nnz - block_size);
for(Index k = m_outerStart + m_outerSize.value(); k<=matrix.outerSize(); ++k)
{
matrix.outerIndexPtr()[k] += offset;
}
}
return derived();
}
| BlockType& Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::operator= | ( | const BlockType & | other | ) | [inline] |
Definition at line 212 of file SparseBlock.h.
{
return operator=<BlockType>(other);
}
| const StorageIndex* Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::outerIndexPtr | ( | ) | const [inline] |
Reimplemented from Eigen::SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >.
Definition at line 227 of file SparseBlock.h.
{ return m_matrix.outerIndexPtr() + m_outerStart; }
| StorageIndex* Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::outerIndexPtr | ( | ) | [inline] |
Reimplemented from Eigen::SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >.
Definition at line 229 of file SparseBlock.h.
{ return m_matrix.outerIndexPtr() + m_outerStart; }
| EIGEN_STRONG_INLINE Index Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::rows | ( | void | ) | const [inline] |
Reimplemented from Eigen::SparseMatrixBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >.
Definition at line 264 of file SparseBlock.h.
{ return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
| Index Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::startCol | ( | ) | const [inline] |
Definition at line 270 of file SparseBlock.h.
{ return IsRowMajor ? 0 : m_outerStart; }
| Index Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::startRow | ( | ) | const [inline] |
Definition at line 269 of file SparseBlock.h.
{ return IsRowMajor ? m_outerStart : 0; }
| const Scalar* Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::valuePtr | ( | ) | const [inline] |
Reimplemented from Eigen::SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >.
Definition at line 217 of file SparseBlock.h.
{ return m_matrix.valuePtr(); }
| Scalar* Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::valuePtr | ( | ) | [inline] |
Reimplemented from Eigen::SparseCompressedBase< Block< SparseMatrixType, BlockRows, BlockCols, true > >.
Definition at line 219 of file SparseBlock.h.
{ return m_matrix.valuePtr(); }
internal::ref_selector<SparseMatrixType>::non_const_type Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::m_matrix [protected] |
Definition at line 276 of file SparseBlock.h.
const internal::variable_if_dynamic<Index, OuterSize> Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::m_outerSize [protected] |
Definition at line 278 of file SparseBlock.h.
Index Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::m_outerStart [protected] |
Definition at line 277 of file SparseBlock.h.