mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
committed by
Rasmus Munk Larsen
parent
d537b51ede
commit
f3f2c676b5
@@ -68,6 +68,32 @@ class BlockImpl<XprType, BlockRows, BlockCols, true, Sparse>
|
|||||||
Index blockRows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
|
Index blockRows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
|
||||||
Index blockCols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
|
Index blockCols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
|
||||||
|
|
||||||
|
inline const Scalar* valuePtr() const { return m_matrix.valuePtr(); }
|
||||||
|
inline Scalar* valuePtr() { return m_matrix.valuePtr(); }
|
||||||
|
|
||||||
|
inline const StorageIndex* innerIndexPtr() const { return m_matrix.innerIndexPtr(); }
|
||||||
|
inline StorageIndex* innerIndexPtr() { return m_matrix.innerIndexPtr(); }
|
||||||
|
|
||||||
|
inline const StorageIndex* outerIndexPtr() const {
|
||||||
|
const StorageIndex* p = m_matrix.outerIndexPtr();
|
||||||
|
return p ? p + m_outerStart : 0;
|
||||||
|
}
|
||||||
|
inline StorageIndex* outerIndexPtr() {
|
||||||
|
StorageIndex* p = m_matrix.outerIndexPtr();
|
||||||
|
return p ? p + m_outerStart : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const StorageIndex* innerNonZeroPtr() const {
|
||||||
|
const StorageIndex* p = m_matrix.innerNonZeroPtr();
|
||||||
|
return p ? p + m_outerStart : 0;
|
||||||
|
}
|
||||||
|
inline StorageIndex* innerNonZeroPtr() {
|
||||||
|
StorageIndex* p = m_matrix.innerNonZeroPtr();
|
||||||
|
return p ? p + m_outerStart : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isCompressed() const { return m_matrix.innerNonZeroPtr() == 0; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typename internal::ref_selector<XprType>::non_const_type m_matrix;
|
typename internal::ref_selector<XprType>::non_const_type m_matrix;
|
||||||
Index m_outerStart;
|
Index m_outerStart;
|
||||||
|
|||||||
@@ -279,6 +279,22 @@ void sparse_block(const SparseMatrixType& ref) {
|
|||||||
++block_iterator;
|
++block_iterator;
|
||||||
++matrix_iterator;
|
++matrix_iterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test direct access methods
|
||||||
|
if (m2.isCompressed()) {
|
||||||
|
VERIFY(v.isCompressed());
|
||||||
|
VERIFY_IS_EQUAL(v.innerNonZeroPtr(), (const StorageIndex*)0);
|
||||||
|
} else {
|
||||||
|
VERIFY(!v.isCompressed());
|
||||||
|
if (SparseMatrixType::IsRowMajor) {
|
||||||
|
VERIFY_IS_EQUAL(v.innerNonZeroPtr(), m2.innerNonZeroPtr() + j0);
|
||||||
|
} else {
|
||||||
|
VERIFY_IS_EQUAL(v.innerNonZeroPtr(), m2.innerNonZeroPtr() + j0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
VERIFY_IS_EQUAL(v.valuePtr(), m2.valuePtr());
|
||||||
|
VERIFY_IS_EQUAL(v.innerIndexPtr(), m2.innerIndexPtr());
|
||||||
|
VERIFY_IS_EQUAL(v.outerIndexPtr(), m2.outerIndexPtr() + j0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user