59 typedef typename remove_reference<XprTypeNested>::type _XprTypeNested;
63 RowsAtCompileTime = MatrixRows == 0 ? 0 :
BlockRows,
64 ColsAtCompileTime = MatrixCols == 0 ? 0 :
BlockCols,
66 : RowsAtCompileTime != Dynamic ? int(RowsAtCompileTime)
69 : ColsAtCompileTime != Dynamic ? int(ColsAtCompileTime)
73 IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1
74 : (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0
76 HasSameStorageOrderAsXprType = (IsRowMajor == XprTypeIsRowMajor),
77 InnerSize = IsRowMajor ?
int(ColsAtCompileTime) : int(RowsAtCompileTime),
78 InnerStrideAtCompileTime = HasSameStorageOrderAsXprType
81 OuterStrideAtCompileTime = HasSameStorageOrderAsXprType
173template<
typename XprType,
int BlockRows,
int BlockCols,
bool InnerPanel,
bool HasDirectAccess>
class BlockImpl_dense
204 : m_xpr(
xpr), m_startRow(startRow), m_startCol(startCol),
212 Index startRow, Index startCol,
213 Index blockRows, Index blockCols)
214 : m_xpr(
xpr), m_startRow(startRow), m_startCol(startCol),
215 m_blockRows(blockRows), m_blockCols(blockCols)
222 inline Scalar& coeffRef(Index rowId, Index colId)
224 EIGEN_STATIC_ASSERT_LVALUE(XprType)
225 return m_xpr.const_cast_derived()
226 .coeffRef(rowId + m_startRow.value(), colId + m_startCol.value());
230 inline const Scalar& coeffRef(Index rowId, Index colId)
const
232 return m_xpr.derived()
233 .coeffRef(rowId + m_startRow.value(), colId + m_startCol.value());
237 EIGEN_STRONG_INLINE
const CoeffReturnType coeff(Index rowId, Index colId)
const
239 return m_xpr.coeff(rowId + m_startRow.value(), colId + m_startCol.value());
243 inline Scalar& coeffRef(Index index)
245 EIGEN_STATIC_ASSERT_LVALUE(XprType)
246 return m_xpr.const_cast_derived()
247 .coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index),
248 m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0));
252 inline const Scalar& coeffRef(Index index)
const
254 return m_xpr.const_cast_derived()
255 .coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index),
256 m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0));
260 inline const CoeffReturnType coeff(Index index)
const
263 .coeff(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index),
264 m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0));
267 template<
int LoadMode>
268 inline PacketScalar packet(Index rowId, Index colId)
const
270 return m_xpr.template packet<Unaligned>
271 (rowId + m_startRow.value(), colId + m_startCol.value());
274 template<
int LoadMode>
275 inline void writePacket(Index rowId, Index colId,
const PacketScalar& val)
277 m_xpr.const_cast_derived().template writePacket<Unaligned>
278 (rowId + m_startRow.value(), colId + m_startCol.value(), val);
281 template<
int LoadMode>
282 inline PacketScalar packet(Index index)
const
284 return m_xpr.template packet<Unaligned>
285 (m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index),
286 m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0));
289 template<
int LoadMode>
290 inline void writePacket(Index index,
const PacketScalar& val)
292 m_xpr.const_cast_derived().template writePacket<Unaligned>
293 (m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index),
294 m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0), val);
297 #ifdef EIGEN_PARSED_BY_DOXYGEN
299 EIGEN_DEVICE_FUNC
inline const Scalar* data()
const;
300 EIGEN_DEVICE_FUNC
inline Index innerStride()
const;
301 EIGEN_DEVICE_FUNC
inline Index outerStride()
const;
305 const typename internal::remove_all<typename XprType::Nested>::type& nestedExpression()
const
311 StorageIndex startRow()
const
313 return m_startRow.value();
317 StorageIndex startCol()
const
319 return m_startCol.value();
324 const typename XprType::Nested m_xpr;
325 const internal::variable_if_dynamic<StorageIndex, XprType::RowsAtCompileTime == 1 ? 0 : Dynamic> m_startRow;
326 const internal::variable_if_dynamic<StorageIndex, XprType::ColsAtCompileTime == 1 ? 0 : Dynamic> m_startCol;
327 const internal::variable_if_dynamic<StorageIndex, RowsAtCompileTime> m_blockRows;
328 const internal::variable_if_dynamic<StorageIndex, ColsAtCompileTime> m_blockCols;
334 :
public MapBase<Block<XprType, BlockRows, BlockCols, InnerPanel> >
351 || ((
BlockRows==XprType::RowsAtCompileTime) && (
BlockCols==1) && ( XprTypeIsRowMajor)) ?
xpr.innerStride() :
xpr.outerStride()),
363 :
Base(
xpr.data()+
xpr.innerStride()*(XprTypeIsRowMajor?startCol:startRow) +
xpr.outerStride()*(XprTypeIsRowMajor?startRow:startCol)),
373 Index startRow, Index startCol,
374 Index blockRows, Index blockCols)
375 :
Base(
xpr.data()+
xpr.innerStride()*(XprTypeIsRowMajor?startCol:startRow) +
xpr.outerStride()*(XprTypeIsRowMajor?startRow:startCol), blockRows, blockCols),
382 const typename internal::remove_all<typename XprType::Nested>::type& nestedExpression()
const
392 ? m_xpr.innerStride()
393 : m_xpr.outerStride();
400 return m_outerStride;
409 #ifndef EIGEN_PARSED_BY_DOXYGEN
412 inline BlockImpl_dense(XprType&
xpr,
const Scalar* data, Index blockRows, Index blockCols)
413 : Base(data, blockRows, blockCols), m_xpr(
xpr)
424 ? m_xpr.outerStride()
425 : m_xpr.innerStride();
428 typename XprType::Nested m_xpr;