10 #ifndef EIGEN_SPARSE_BLOCKFORDYNAMICMATRIX_H
11 #define EIGEN_SPARSE_BLOCKFORDYNAMICMATRIX_H
25 template<
typename _Scalar,
int _Options,
typename _Index,
int Size>
26 class SparseInnerVectorSet<DynamicSparseMatrix<_Scalar, _Options, _Index>, Size>
27 :
public SparseMatrixBase<SparseInnerVectorSet<DynamicSparseMatrix<_Scalar, _Options, _Index>, Size> >
29 typedef DynamicSparseMatrix<_Scalar, _Options, _Index>
MatrixType;
32 enum { IsRowMajor = internal::traits<SparseInnerVectorSet>::IsRowMajor };
35 class InnerIterator:
public MatrixType::InnerIterator
38 inline InnerIterator(
const SparseInnerVectorSet& xpr,
Index outer)
39 :
MatrixType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
41 inline Index row()
const {
return IsRowMajor ? m_outer : this->index(); }
42 inline Index col()
const {
return IsRowMajor ? this->index() : m_outer; }
48 : m_matrix(
matrix), m_outerStart(outerStart), m_outerSize(outerSize)
54 : m_matrix(
matrix), m_outerStart(outer), m_outerSize(Size)
60 template<
typename OtherDerived>
61 inline SparseInnerVectorSet& operator=(
const SparseMatrixBase<OtherDerived>&
other)
66 DynamicSparseMatrix<Scalar,IsRowMajor?RowMajorBit:0> aux(
other);
67 *
this = aux.markAsRValue();
72 for (
Index j=0;
j<m_outerSize.value(); ++
j)
74 SparseVector<Scalar,IsRowMajor ? RowMajorBit : 0> aux(
other.innerVector(
j));
75 m_matrix.const_cast_derived()._data()[m_outerStart+
j].swap(aux._data());
81 inline SparseInnerVectorSet& operator=(
const SparseInnerVectorSet&
other)
83 return operator=<SparseInnerVectorSet>(
other);
86 Index nonZeros()
const
89 for (
Index j=0;
j<m_outerSize.value(); ++
j)
90 count += m_matrix._data()[m_outerStart+
j].size();
94 const Scalar& lastCoeff()
const
98 return m_matrix.data()[m_outerStart].vale(m_matrix.data()[m_outerStart].size()-1);
112 const typename MatrixType::Nested m_matrix;
114 const internal::variable_if_dynamic<Index, Size> m_outerSize;
122 #endif // EIGEN_SPARSE_BLOCKFORDYNAMICMATRIX_H