10#ifndef EIGEN_INDEXED_VIEW_H
11#define EIGEN_INDEXED_VIEW_H
17template<
typename XprType,
typename RowIndices,
typename ColIndices>
24 MaxRowsAtCompileTime = RowsAtCompileTime !=
Dynamic ? int(RowsAtCompileTime) :
Dynamic,
25 MaxColsAtCompileTime = ColsAtCompileTime !=
Dynamic ? int(ColsAtCompileTime) :
Dynamic,
28 IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1
29 : (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0
34 InnerIncr = IsRowMajor ? ColIncr : RowIncr,
35 OuterIncr = IsRowMajor ? RowIncr : ColIncr,
37 HasSameStorageOrderAsXprType = (IsRowMajor == XprTypeIsRowMajor),
41 InnerSize = XprTypeIsRowMajor ? ColsAtCompileTime : RowsAtCompileTime,
42 IsBlockAlike = InnerIncr==1 && OuterIncr==1,
45 InnerStrideAtCompileTime = InnerIncr<0 || InnerIncr==
DynamicIndex || XprInnerStride==
Dynamic ?
Dynamic : XprInnerStride * InnerIncr,
46 OuterStrideAtCompileTime = OuterIncr<0 || OuterIncr==
DynamicIndex || XprOuterstride==
Dynamic ?
Dynamic : XprOuterstride * OuterIncr,
57 FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ?
LinearAccessBit : 0,
66template<
typename XprType,
typename RowIndices,
typename ColIndices,
typename StorageKind>
108template<
typename XprType,
typename RowIndices,
typename ColIndices>
117 typedef typename internal::remove_all<XprType>::type NestedExpression;
119 template<
typename T0,
typename T1>
125 Index rows()
const {
return internal::index_list_size(m_rowIndices); }
128 Index cols()
const {
return internal::index_list_size(m_colIndices); }
131 const typename internal::remove_all<XprType>::type&
135 typename internal::remove_reference<XprType>::type&
139 const RowIndices&
rowIndices()
const {
return m_rowIndices; }
145 MatrixTypeNested m_xpr;
146 RowIndices m_rowIndices;
152template<
typename XprType,
typename RowIndices,
typename ColIndices,
typename StorageKind>
163template<
typename ArgType,
typename RowIndices,
typename ColIndices>
183 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
186 typedef typename XprType::Scalar Scalar;
187 typedef typename XprType::CoeffReturnType CoeffReturnType;
189 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
190 CoeffReturnType coeff(
Index row,
Index col)
const
192 eigen_assert(m_xpr.rowIndices()[row] >= 0 && m_xpr.rowIndices()[row] < m_xpr.nestedExpression().rows()
193 && m_xpr.colIndices()[col] >= 0 && m_xpr.colIndices()[col] < m_xpr.nestedExpression().cols());
194 return m_argImpl.coeff(m_xpr.rowIndices()[row], m_xpr.colIndices()[col]);
197 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
200 eigen_assert(m_xpr.rowIndices()[row] >= 0 && m_xpr.rowIndices()[row] < m_xpr.nestedExpression().rows()
201 && m_xpr.colIndices()[col] >= 0 && m_xpr.colIndices()[col] < m_xpr.nestedExpression().cols());
202 return m_argImpl.coeffRef(m_xpr.rowIndices()[row], m_xpr.colIndices()[col]);
205 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
206 Scalar& coeffRef(
Index index)
208 EIGEN_STATIC_ASSERT_LVALUE(
XprType)
209 Index row = XprType::RowsAtCompileTime == 1 ? 0 : index;
210 Index col = XprType::RowsAtCompileTime == 1 ? index : 0;
211 eigen_assert(m_xpr.rowIndices()[row] >= 0 && m_xpr.rowIndices()[row] < m_xpr.nestedExpression().rows()
212 && m_xpr.colIndices()[col] >= 0 && m_xpr.colIndices()[col] < m_xpr.nestedExpression().cols());
213 return m_argImpl.coeffRef( m_xpr.rowIndices()[row], m_xpr.colIndices()[col]);
216 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
217 const Scalar& coeffRef(
Index index)
const
219 Index row = XprType::RowsAtCompileTime == 1 ? 0 : index;
220 Index col = XprType::RowsAtCompileTime == 1 ? index : 0;
221 eigen_assert(m_xpr.rowIndices()[row] >= 0 && m_xpr.rowIndices()[row] < m_xpr.nestedExpression().rows()
222 && m_xpr.colIndices()[col] >= 0 && m_xpr.colIndices()[col] < m_xpr.nestedExpression().cols());
223 return m_argImpl.coeffRef( m_xpr.rowIndices()[row], m_xpr.colIndices()[col]);
226 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
227 const CoeffReturnType coeff(
Index index)
const
229 Index row = XprType::RowsAtCompileTime == 1 ? 0 : index;
230 Index col = XprType::RowsAtCompileTime == 1 ? index : 0;
231 eigen_assert(m_xpr.rowIndices()[row] >= 0 && m_xpr.rowIndices()[row] < m_xpr.nestedExpression().rows()
232 && m_xpr.colIndices()[col] >= 0 && m_xpr.colIndices()[col] < m_xpr.nestedExpression().cols());
233 return m_argImpl.coeff( m_xpr.rowIndices()[row], m_xpr.colIndices()[col]);
Definition IndexedView.h:155
Expression of a non-sequential sub-matrix defined by arbitrary sequences of row and column indices.
Definition IndexedView.h:110
const RowIndices & rowIndices() const
Definition IndexedView.h:139
const ColIndices & colIndices() const
Definition IndexedView.h:142
Index cols() const
Definition IndexedView.h:128
internal::remove_reference< XprType >::type & nestedExpression()
Definition IndexedView.h:136
const internal::remove_all< XprType >::type & nestedExpression() const
Definition IndexedView.h:132
Index rows() const
Definition IndexedView.h:125
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
const unsigned int LinearAccessBit
Short version: means the expression can be seen as 1D vector.
Definition Constants.h:130
const unsigned int DirectAccessBit
Means that the underlying array of coefficients can be directly accessed as a plain strided array.
Definition Constants.h:155
const unsigned int LvalueBit
Means the expression has a coeffRef() method, i.e.
Definition Constants.h:144
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:66
Namespace containing all symbols from the Eigen library.
Definition LDLT.h:16
const int UndefinedIncr
This value means that the increment to go from one value to another in a sequence is not constant for...
Definition Constants.h:31
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
const int DynamicIndex
This value means that a signed quantity (e.g., a signed index) is not known at compile-time,...
Definition Constants.h:27
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time,...
Definition Constants.h:22
Definition Constants.h:542
Definition CoreEvaluators.h:111
Definition CoreEvaluators.h:91
Definition XprHelper.h:501
Definition IndexedViewHelper.h:75
Definition DenseCoeffsBase.h:659
Definition XprHelper.h:660
Definition DenseCoeffsBase.h:671
Definition ForwardDeclarations.h:17
Definition CoreEvaluators.h:65