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; }
47 inline SparseInnerVectorSet(
const MatrixType&
matrix,
Index outerStart,
Index outerSize)
48 : m_matrix(matrix), m_outerStart(outerStart), m_outerSize(outerSize)
50 eigen_assert( (outerStart>=0) && ((outerStart+outerSize)<=matrix.outerSize()) );
53 inline SparseInnerVectorSet(
const MatrixType& matrix,
Index outer)
54 : m_matrix(matrix), m_outerStart(outer), m_outerSize(Size)
57 eigen_assert( (outer>=0) && (outer<matrix.outerSize()) );
60 template<
typename OtherDerived>
61 inline SparseInnerVectorSet& operator=(
const SparseMatrixBase<OtherDerived>&
other)
63 if (IsRowMajor != ((OtherDerived::Flags&
RowMajorBit)==RowMajorBit))
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
#define EIGEN_STRONG_INLINE
Namespace containing all symbols from the Eigen library.
const unsigned int RowMajorBit
#define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)