17 #ifndef HPP_CONSTRAINTS_MATRIX_VIEW_HH 18 #define HPP_CONSTRAINTS_MATRIX_VIEW_HH 23 #include <hpp/util/indent.hh> 27 # define HPP_EIGEN_USE_EVALUATOR EIGEN_VERSION_AT_LEAST(3,2,92) 47 static size_type
cardinal (
const segments_t&
a);
53 template <
typename Derived>
55 (
const Eigen::ArrayBase<Derived>&
array);
59 static void sort (segments_t&
a);
64 static void shrink (segments_t&
a);
67 static bool overlap (
const segment_t&
a,
const segment_t&
b);
70 static segments_t
sum (
const segment_t&
a,
const segment_t&
b);
73 static void add (segments_t&
a,
const segment_t&
b);
76 static void add (segments_t&
a,
const segments_t&
b);
79 static segments_t
difference (
const segment_t&
a,
const segment_t&
b);
83 static segments_t
difference (
const segments_t&
a,
const segment_t&
b);
87 static segments_t
difference (
const segment_t&
a,
const segments_t&
b);
91 static segments_t
difference (
const segments_t&
a,
const segments_t&
b);
99 static segments_t
split (segments_t& segments,
const size_type&
cardinal);
107 static segments_t
extract (
const segments_t& segments, size_type start,
111 template <
typename ArgType,
int _Rows,
int _Cols,
bool _allRows,
bool _allCols>
class MatrixBlockView;
123 template <
bool _allRows = false,
bool _allCols = false>
class MatrixBlocks;
131 template <
typename First,
typename Second>
132 static inline First&
run (First& f, Second&) {
return f; }
135 template <
typename First,
typename Second>
136 static inline Second&
run (First&, Second& s) {
return s; }
143 template <
typename In0_t,
typename In1_t>
empty_struct (In0_t, In1_t) {}
144 static inline Index
size() {
return 1; }
145 inline const Index&
operator[](
const Index& i)
const {
return i; }
147 template <
bool If>
struct get_if {
template <
typename T1,
typename T2>
static EIGEN_STRONG_INLINE T1
run (T1 then, T2 Else) { (void)Else;
return then; } };
148 template <>
struct get_if<false> {
template <
typename T1,
typename T2>
static EIGEN_STRONG_INLINE T2
run (T1 then, T2 Else) { (void)then;
return Else; } };
150 template <
bool _allRows,
bool _allCols>
157 typedef typename internal::conditional<_allRows, internal::empty_struct, BlockIndex::segments_t>::type
RowIndices_t;
158 typedef typename internal::conditional<_allCols, internal::empty_struct, BlockIndex::segments_t>::type
ColIndices_t;
161 template <
bool _allRows,
bool _allCols>
168 typedef typename internal::conditional<_allRows, internal::empty_struct, const BlockIndex::segments_t&>::type
RowIndices_t;
169 typedef typename internal::conditional<_allCols, internal::empty_struct, const BlockIndex::segments_t&>::type
ColIndices_t;
172 template <
typename ArgType,
int _Rows,
int _Cols,
bool _allRows,
bool _allCols>
175 # if HPP_EIGEN_USE_EVALUATOR 176 typedef typename ArgType::StorageIndex StorageIndex;
177 # else // HPP_EIGEN_USE_EVALUATOR 178 typedef typename ArgType::Index
Index;
179 # endif // HPP_EIGEN_USE_EVALUATOR 181 typedef typename traits<ArgType>::XprKind
XprKind;
184 # if !HPP_EIGEN_USE_EVALUATOR 185 CoeffReadCost = ArgType::CoeffReadCost,
186 # endif // !HPP_EIGEN_USE_EVALUATOR 187 Flags = ~PacketAccessBit & ~DirectAccessBit & ~ActualPacketAccessBit & ~LinearAccessBit & ArgType::Flags,
188 RowsAtCompileTime = (_allRows ? ArgType::RowsAtCompileTime : _Rows),
189 ColsAtCompileTime = (_allCols ? ArgType::ColsAtCompileTime : _Cols),
190 MaxRowsAtCompileTime = ArgType::MaxRowsAtCompileTime,
191 MaxColsAtCompileTime = ArgType::MaxColsAtCompileTime
195 # if HPP_EIGEN_USE_EVALUATOR 196 template<
typename Derived,
typename ArgType,
int _Rows,
int _Cols,
bool _allRows,
bool _allCols,
typename Functor,
typename Scalar>
197 struct Assignment<Derived,
MatrixBlockView <ArgType, _Rows, _Cols, _allRows, _allCols>, Functor, Dense2Dense, Scalar> {
199 static EIGEN_STRONG_INLINE
void run(Derived& dst,
const OtherDerived& src,
const Functor& func) {
200 dst.resize(src.rows(), src.cols());
201 typedef Block<Derived> BlockDerived;
202 typedef Assignment<BlockDerived, typename OtherDerived::BlockConstXprType, Functor> AssignmentType;
203 for (
typename OtherDerived::block_iterator
b (src);
b.valid(); ++
b) {
204 BlockDerived bdst (dst.block(
b.ro(),
b.co(),
b.rs(),
b.cs()));
205 AssignmentType::run(bdst, src._block(
b), func);
209 # else // HPP_EIGEN_USE_EVALUATOR 210 template<
typename Derived,
typename ArgType,
int _Rows,
int _Cols,
bool _allRows,
bool _allCols>
211 struct assign_selector<Derived,
MatrixBlockView <ArgType, _Rows, _Cols, _allRows, _allCols>,false,false> {
213 static EIGEN_STRONG_INLINE Derived&
run(Derived& dst,
const OtherDerived& other) { other.
writeTo(dst);
return dst; }
214 template<
typename ActualDerived,
typename ActualOtherDerived>
215 static EIGEN_STRONG_INLINE Derived&
evalTo(ActualDerived& dst,
const ActualOtherDerived& other) { other.evalTo(dst);
return dst; }
217 template<
typename Derived,
typename ArgType,
int _Rows,
int _Cols,
bool _allRows,
bool _allCols>
218 struct assign_selector<Derived,
MatrixBlockView <ArgType, _Rows, _Cols, _allRows, _allCols>,false,true> {
220 static EIGEN_STRONG_INLINE Derived&
run(Derived& dst,
const OtherDerived& other) { other.
writeTo(dst.transpose());
return dst; }
221 template<
typename ActualDerived,
typename ActualOtherDerived>
222 static EIGEN_STRONG_INLINE Derived&
evalTo(ActualDerived& dst,
const ActualOtherDerived& other) { Transpose<ActualDerived> dstTrans(dst); other.evalTo(dstTrans);
return dst; }
224 # endif // HPP_EIGEN_USE_EVALUATOR 227 template <
typename Src,
typename _ArgType,
int _Rows,
int _Cols,
bool _allRows,
bool _allCols>
231 static void run (
const Src& src, Dst& dst) {
233 dst.
_block(
b) = src.block(
b.ro(),
b.co(),
b.rs(),
b.cs());
236 template <
typename _ArgType,
int _Rows,
int _Cols,
bool _allRows,
bool _allCols,
typename Dst>
240 static void run (
const Src& src, Dst& dst) {
242 dst.block(
b.ro(),
b.co(),
b.rs(),
b.cs()) = src.
_block(
b);
245 template <
typename _ArgType ,
int _Rows ,
int _Cols ,
bool _allRows ,
bool _allCols ,
246 typename _ArgType2,
int _Rows2,
int _Cols2,
bool _allRows2,
bool _allCols2>
253 static void run (
const Src& src, Dst& dst) {
264 template <
typename ReturnType,
typename View,
bool AllRows = View::AllRows,
bool AllCols = View::AllCols>
268 template <
typename Derived>
269 static ReturnType
run (Derived&
d, size_type
r, size_type
c, size_type rs, size_type cs)
271 return ReturnType (d, r, c, rs, cs);
274 template <
typename ReturnType,
typename View>
278 template <
typename Derived>
279 static ReturnType
run (Derived&
d, size_type
r, size_type, size_type rs, size_type)
281 return d.middleRows (r, rs);
284 template <
typename ReturnType,
typename View>
288 template <
typename Derived>
289 static ReturnType
run (Derived&
d, size_type, size_type
c, size_type, size_type cs)
291 return d.middleCols (c, cs);
295 struct dont_print_indices {
template <
typename BlockIndexType>
static void run (std::ostream&,
const BlockIndexType&) {} };
297 template <
typename BlockIndexType>
298 static void run (std::ostream& os,
const BlockIndexType& bi) {
299 for (std::size_t i = 0; i < bi.size(); ++i)
300 os <<
"[ " << bi[i].first <<
", " << bi[i].second <<
"], ";
304 # if HPP_EIGEN_USE_EVALUATOR 305 template <
typename ArgType,
int _Rows,
int _Cols,
bool _allRows,
bool _allCols>
306 struct unary_evaluator <MatrixBlockView <ArgType, _Rows, _Cols, _allRows, _allCols> >
307 : evaluator_base <MatrixBlockView <ArgType, _Rows, _Cols, _allRows, _allCols> >
312 CoeffReadCost = evaluator<ArgType>::CoeffReadCost,
313 Flags = ~PacketAccessBit & ~DirectAccessBit & ~ActualPacketAccessBit & ~LinearAccessBit & ArgType::Flags,
316 EIGEN_DEVICE_FUNC
explicit unary_evaluator (
const XprType& view)
320 const XprType& m_view;
322 # endif // HPP_EIGEN_USE_EVALUATOR 325 #define EIGEN_MATRIX_BLOCKS_PUBLIC_INTERFACE(Derived) \ 327 AllRows = _allRows, \ 330 typedef MatrixBlocksBase<Derived> Base; \ 331 typedef typename Base::size_type size_type; \ 332 typedef typename Base::segments_t segments_t; \ 333 typedef typename Base::segment_t segment_t; \ 334 typedef typename Base::RowIndices_t RowIndices_t; \ 335 typedef typename Base::ColIndices_t ColIndices_t; 340 template <
typename Derived>
345 AllRows = internal::traits<Derived>::AllRows,
346 AllCols = internal::traits<Derived>::AllCols,
347 OneDimension = bool(AllRows) || bool(AllCols)
359 template <
typename MatrixType,
int _Rows = MatrixType::RowsAtCompileTime,
int _Cols = MatrixType::ColsAtCompileTime>
struct View {
363 Derived
const&
derived ()
const {
return static_cast<Derived const&
> (*this); }
364 Derived &
derived () {
return static_cast<Derived &
> (*this); }
370 template <
typename MatrixType>
371 EIGEN_STRONG_INLINE
typename View<MatrixType>::type
lview(
const MatrixBase<MatrixType>& other)
const {
372 MatrixType&
o =
const_cast<MatrixBase<MatrixType>&
>(other).derived();
373 if (Derived::OneDimension)
374 return typename View<MatrixType>::type (o, nbIndices(), indices());
376 return typename View<MatrixType>::type (o, nbRows(), rows(), nbCols(), cols());
383 template <
typename MatrixType>
384 EIGEN_STRONG_INLINE
typename View<const MatrixType>::type
rview(
const MatrixBase<MatrixType>& other)
const {
385 if (Derived::OneDimension)
386 return typename View<const MatrixType>::type (other.derived(), nbIndices(), indices());
388 return typename View<const MatrixType>::type (other.derived(), nbRows(), rows(), nbCols(), cols());
420 inline const RowIndices_t&
rows()
const 422 return derived().rows();
427 inline const ColIndices_t&
cols()
const 429 return derived().cols();
446 return derived().nbRows();
453 return derived().nbCols();
460 (size_type i, size_type j, size_type ni, size_type nj)
const 470 (size_type i, size_type ni)
const 480 (size_type j, size_type nj)
const 494 template <
bool _allRows,
bool _allCols>
508 const segments_t& cols) :
528 const size_type& nbCols,
const ColIndices_t& cols) :
529 m_nbRows(nbRows), m_nbCols(nbCols), m_rows(rows), m_cols(cols)
546 : m_nbRows(_allRows ? 0 : size)
547 , m_nbCols(_allCols ? 0 : size)
548 , m_rows(1,
BlockIndex::segment_t (start, size))
549 , m_cols(1,
BlockIndex::segment_t (start, size))
560 , m_rows(idx), m_cols(idx)
568 : m_nbRows(_allRows ? 0 : idx.second)
569 , m_nbCols(_allCols ? 0 : idx.second)
570 , m_rows(segments_t(1,idx)), m_cols(segments_t(1,idx))
574 template <
typename MBDerived>
576 : m_nbRows(other.nbRows())
577 , m_nbCols(other.nbCols())
578 , m_rows(other.rows()), m_cols(other.cols())
581 (
bool(AllRows) ==
bool(MBDerived::AllRows)) && (
bool(AllCols) ==
bool(MBDerived::AllCols)),
582 YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
602 inline void addRow (
const size_type& row,
const size_type
size)
604 m_rows.push_back(segment_t (row, size));
611 inline void addCol (
const size_type& col,
const size_type
size)
613 m_cols.push_back(segment_t (col, size));
621 template<
bool Sort,
bool Shrink,
bool Cardinal>
623 update<Sort, Shrink, Cardinal> (m_rows, m_nbRows);
630 template<
bool Sort,
bool Shrink,
bool Cardinal>
632 update<Sort, Shrink, Cardinal> (m_cols, m_nbCols);
637 inline const RowIndices_t&
rows()
const 644 inline const ColIndices_t&
cols()
const 663 template<
bool Sort,
bool Shrink,
bool Cardinal>
665 update<Sort, Shrink, Cardinal> (
675 template<
bool Sort,
bool Shrink,
bool Cardinal>
676 static inline void update(segments_t&
b, size_type& idx) {
684 template <
bool _allRows,
bool _allCols>
695 const size_type& nbCols,
const ColIndices_t& cols) :
696 m_nbRows(nbRows), m_nbCols(nbCols),
697 m_rows (rows ), m_cols (cols )
701 template <
typename Derived1,
typename Derived2>
705 m_rows (rows. indices()), m_cols (cols. indices())
707 EIGEN_STATIC_ASSERT(
bool(Derived1::OneDimension) &&
bool (Derived2::OneDimension),
708 YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
717 : m_nbRows(_allRows ? 0 : nidx)
718 , m_nbCols(_allCols ? 0 : nidx)
719 , m_rows(idx), m_cols(idx)
725 , m_nbRows(other.nbRows())
726 , m_nbCols(other.nbCols())
727 , m_rows(other.rows())
728 , m_cols(other.cols())
733 inline const RowIndices_t& rows()
const 740 inline const ColIndices_t& cols()
const 747 inline const size_type& nbRows()
const 754 inline const size_type& nbCols()
const 759 const size_type m_nbRows, m_nbCols;
765 template <
typename Derived>
766 std::ostream& operator<< (std::ostream& os, const MatrixBlocksBase<Derived>& mbi)
768 typedef typename internal::conditional<Derived::AllRows, internal::dont_print_indices, internal::print_indices>::type row_printer;
769 typedef typename internal::conditional<Derived::AllCols, internal::dont_print_indices, internal::print_indices>::type col_printer;
770 if (!Derived::AllRows) {
772 row_printer::run (os, mbi.rows());
775 if (!Derived::AllCols) {
777 col_printer::run (os, mbi.cols());
811 template <
typename _ArgType,
int _Rows = _ArgType::RowsAtCompileTime,
int _Cols = _ArgType::ColsAtCompileTime,
bool _allRows = false,
bool _allCols = false>
812 class MatrixBlockView :
public MatrixBase< MatrixBlockView<_ArgType, _Rows, _Cols, _allRows, _allCols> >
825 internal::variable_if_dynamic<size_type, (_allRows ? 0 : Dynamic) >
_ro;
826 internal::variable_if_dynamic<size_type, (_allCols ? 0 : Dynamic) >
_co;
829 size_type
ro()
const {
return _ro.value(); }
831 size_type
co()
const {
return _co.value(); }
843 _ro.setValue(_ro.value() + rs());
845 if (row == (size_type)view.
m_rows.size()) {
848 _co.setValue(_co.value() + cs());
858 && (col < (size_type)internal::get_if<AllCols>::run(1, view.
m_cols.size()));
861 typedef MatrixBase< MatrixBlockView<_ArgType, _Rows, _Cols, _allRows, _allCols> >
Base;
864 typedef Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime>
PlainObject;
872 template <typename Derived>
874 typedef Block<Derived,
875 (AllRows ? Derived::RowsAtCompileTime : Eigen::Dynamic),
876 (AllCols ? Derived::ColsAtCompileTime : Eigen::Dynamic),
877 (AllCols ? (bool)Derived::IsRowMajor
878 : (AllRows ? (
bool)!Derived::IsRowMajor :
false)
886 typedef typename internal::conditional<_allRows, const internal::empty_struct, const Indices_t& >::type
RowIndices_t;
887 typedef typename internal::conditional<_allCols, const internal::empty_struct, const Indices_t& >::type
ColIndices_t;
892 const RowIndices_t rows,
const size_type& nbCols,
893 const ColIndices_t cols) :
894 m_arg (arg), m_nbRows(nbRows), m_rows(rows), m_nbCols(nbCols),
901 const Indices_t& indices) :
902 m_arg (arg), m_nbRows(_allRows ? arg.rows() : nbIndices),
903 m_rows(indices), m_nbCols(_allCols ? arg.cols() : nbIndices),
907 EIGEN_STRONG_INLINE size_type
rows()
const {
return m_nbRows; }
908 EIGEN_STRONG_INLINE size_type
cols()
const {
return m_nbCols; }
910 EIGEN_STRONG_INLINE CoeffReturnType
coeff (size_type index)
const 912 assert(
false &&
"It is not possible to access the coefficients of " 913 "MatrixBlockView this way.");
915 EIGEN_STRONG_INLINE CoeffReturnType
coeff (size_type row, size_type col)
918 assert(
false &&
"It is not possible to access the coefficients of " 919 "MatrixBlockView this way.");
921 EIGEN_STRONG_INLINE Scalar&
coeffRef (size_type index)
923 assert(
false &&
"It is not possible to access the coefficients of " 924 "MatrixBlockView this way.");
926 EIGEN_STRONG_INLINE Scalar&
coeffRef (size_type row,
const size_type& col)
928 assert(
false &&
"It is not possible to access the coefficients of " 929 "MatrixBlockView this way.");
931 template <
typename Dest>
932 EIGEN_STRONG_INLINE
void evalTo (Dest& dst)
const {
936 template <
typename Dest>
937 EIGEN_STRONG_INLINE
void writeTo (Dest& dst)
const {
938 dst.resize(rows(), cols());
939 evalTo(dst.derived());
948 template <
typename OtherDerived>
949 EIGEN_STRONG_INLINE
MatrixBlockView& operator= (
const EigenBase<OtherDerived>& other) {
950 EIGEN_STATIC_ASSERT_LVALUE(
ArgType);
955 EIGEN_STRONG_INLINE size_type
_blocks()
const {
return m_rows.size() * m_cols.size(); }
959 ::template run <ArgType> (m_arg, b.
ri(), b.
ci(), b.
rs(), b.
cs());
964 ::template run <const ArgType> (m_arg, b.
ri(), b.
ci(), b.
rs(), b.
cs());
968 EIGEN_STRONG_INLINE
bool isZero (
const RealScalar& prec = NumTraits<Scalar>::dummy_precision())
const 972 block.ri(), block.ci(),
973 block.rs(), block.cs())
993 # undef HPP_EIGEN_USE_EVALUATOR 996 template <
int Option>
999 return os <<
"[ " << s.first <<
", " << s.first + s.second <<
" ]";
1004 #endif // HPP_CONSTRAINTS_MATRIX_VIEW_HH static segments_t split(segments_t &segments, const size_type &cardinal)
void addCol(const size_type &col, const size_type size)
Definition: matrix-view.hh:611
Matrix< Scalar, RowsAtCompileTime, ColsAtCompileTime > PlainObject
Definition: matrix-view.hh:864
MatrixBlocksRef< AllCols, AllRows > transpose() const
Definition: matrix-view.hh:391
MatrixBlockView< ArgType, _Rows, _Cols, _allRows, _allCols > OtherDerived
Definition: matrix-view.hh:219
internal::variable_if_dynamic< size_type,(_allRows ? 0 :Dynamic) > _ro
Definition: matrix-view.hh:825
Definition: matrix-view.hh:127
MatrixIndices_t::segments_t Indices_t
Definition: matrix-view.hh:885
MatrixXd::Index Index
Definition: matrix-view.hh:140
const RowIndices_t & rows() const
Definition: matrix-view.hh:420
static ReturnType run(Derived &d, size_type r, size_type, size_type rs, size_type)
Definition: matrix-view.hh:279
const MatrixBlockView & view
Definition: matrix-view.hh:823
Definition: matrix-view.hh:123
MatrixBlocks(size_type start, size_type size)
Definition: matrix-view.hh:545
size_type cs() const
number of ColS
Definition: matrix-view.hh:839
MatrixBlocksRef< true, AllCols > keepCols() const
Definition: matrix-view.hh:402
const size_type & nbCols() const
Definition: matrix-view.hh:658
internal::variable_if_dynamic< size_type,(_allCols ? 0 :Dynamic) > _co
Definition: matrix-view.hh:826
MatrixBlockView(ArgType &arg, const size_type &nbRows, const RowIndices_t rows, const size_type &nbCols, const ColIndices_t cols)
Definition: matrix-view.hh:891
static size_type cardinal(const segments_t &a)
Definition: matrix-view.hh:37
empty_struct(In0_t, In1_t)
Definition: matrix-view.hh:143
Definition: matrix-view.hh:130
internal::conditional< _allRows, internal::empty_struct, const BlockIndex::segments_t & >::type RowIndices_t
Definition: matrix-view.hh:168
size_type ro() const
Row in the Output matrix
Definition: matrix-view.hh:829
static void run(const Src &src, Dst &dst)
Definition: matrix-view.hh:240
const ColIndices_t & cols() const
Definition: matrix-view.hh:427
const Derived & d
Definition: matrix-view-operation.hh:126
Block< Derived,(AllRows ? Derived::RowsAtCompileTime :Eigen::Dynamic),(AllCols ? Derived::ColsAtCompileTime :Eigen::Dynamic),(AllCols ?(bool) Derived::IsRowMajor :(AllRows ?(bool)!Derived::IsRowMajor :false))> type
Definition: matrix-view.hh:879
traits< ArgType >::XprKind XprKind
Definition: matrix-view.hh:181
HPP_UTIL_DLLAPI std::ostream & iendl(std::ostream &o)
block_iterator(const MatrixBlockView &v)
Definition: matrix-view.hh:827
ArgType::Scalar Scalar
Definition: matrix-view.hh:182
EIGEN_STRONG_INLINE BlockXprType _block(const block_iterator &b)
Definition: matrix-view.hh:956
Definition: matrix-view.hh:296
MatrixBase< MatrixBlockView< _ArgType, _Rows, _Cols, _allRows, _allCols > > Base
Definition: matrix-view.hh:861
Derived & derived()
Definition: matrix-view.hh:364
EIGEN_STRONG_INLINE void evalTo(Dest &dst) const
Definition: matrix-view.hh:932
void updateIndices()
Definition: matrix-view.hh:664
block_t< ArgType >::type BlockXprType
Definition: matrix-view.hh:881
MatrixBlockView< _ArgType, _Rows, _Cols, _allRows, _allCols > Dst
Definition: matrix-view.hh:230
EIGEN_STRONG_INLINE block_iterator _block_iterator() const
Definition: matrix-view.hh:966
size_type m_nbRows
Definition: matrix-view.hh:670
Definition: matrix-view.hh:147
MatrixBlockView< MatrixType, _Rows, _Cols, AllRows, AllCols > type
Definition: matrix-view.hh:360
MatrixBlocks(const segments_t &idx)
Definition: matrix-view.hh:557
static First & run(First &f, Second &)
Definition: matrix-view.hh:132
static void run(const Src &src, Dst &dst)
Definition: matrix-view.hh:231
MatrixBlocks(const size_type &nbRows, const RowIndices_t &rows, const size_type &nbCols, const ColIndices_t &cols)
Definition: matrix-view.hh:527
internal::remove_all< ArgType >::type NestedExpression
Definition: matrix-view.hh:868
static EIGEN_STRONG_INLINE Derived & evalTo(ActualDerived &dst, const ActualOtherDerived &other)
Definition: matrix-view.hh:215
std::vector< segment_t > segments_t
vector of segments
Definition: matrix-view.hh:43
static segments_t difference(const segment_t &a, const segment_t &b)
Compute the set difference between two segments.
size_type co() const
Col in the Output matrix
Definition: matrix-view.hh:831
#define EIGEN_MATRIX_BLOCKS_PUBLIC_INTERFACE(Derived)
Definition: matrix-view.hh:325
void clearRows()
Clear rows.
Definition: matrix-view.hh:586
hpp::constraints::size_type size_type
Definition: matrix-view.hh:815
std::pair< size_type, size_type > segment_t
Definition: fwd.hh:68
static EIGEN_STRONG_INLINE Derived & evalTo(ActualDerived &dst, const ActualOtherDerived &other)
Definition: matrix-view.hh:222
MatrixBlockView< ArgType, _Rows, _Cols, _allRows, _allCols > OtherDerived
Definition: matrix-view.hh:212
ColIndices_t m_cols
Definition: matrix-view.hh:672
static ReturnType run(Derived &d, size_type r, size_type c, size_type rs, size_type cs)
Definition: matrix-view.hh:269
EIGEN_STRONG_INLINE size_type rows() const
Definition: matrix-view.hh:907
void addRow(const size_type &row, const size_type size)
Definition: matrix-view.hh:602
EIGEN_STRONG_INLINE size_type _blocks() const
Definition: matrix-view.hh:955
const size_type & nbCols() const
Definition: matrix-view.hh:451
MatrixBlocksBase()
Empty constructor.
Definition: matrix-view.hh:488
static void run(std::ostream &os, const BlockIndexType &bi)
Definition: matrix-view.hh:298
EIGEN_STRONG_INLINE Scalar & coeffRef(size_type index)
Definition: matrix-view.hh:921
EIGEN_STRONG_INLINE void writeTo(Dest &dst) const
Definition: matrix-view.hh:937
MatrixBlocks(const segment_t &idx)
Definition: matrix-view.hh:567
block_iterator operator++(int)
Definition: matrix-view.hh:855
bool valid() const
Definition: matrix-view.hh:856
block_iterator & operator++()
Definition: matrix-view.hh:841
static void run(const Src &src, Dst &dst)
Definition: matrix-view.hh:253
Definition: matrix-view.hh:139
EIGEN_STRONG_INLINE const BlockConstXprType _block(const block_iterator &b) const
Definition: matrix-view.hh:961
MatrixBlocks< _allRows, _allCols > MatrixIndices_t
Definition: matrix-view.hh:884
hpp::constraints::size_type size_type
Index of vector or matrix.
Definition: matrix-view.hh:39
static void shrink(segments_t &a)
assert(d.lhs()._blocks()==d.rhs()._blocks())
static void add(segments_t &a, const segment_t &b)
In place addition of a segment_t to segments_t.
Definition: matrix-view.hh:341
Definition: matrix-view.hh:111
static segments_t fromLogicalExpression(const Eigen::ArrayBase< Derived > &array)
Definition: matrix-view.hh:20
const size_type & nbIndices() const
Definition: matrix-view.hh:437
Definition: matrix-view.hh:265
MatrixBlockView< _ArgType, _Rows, _Cols, _allRows, _allCols > Src
Definition: matrix-view.hh:251
size_type ri() const
Row in the Input matrix
Definition: matrix-view.hh:833
empty_struct()
Definition: matrix-view.hh:141
BlockIndex::segments_t segments_t
vector of segments
Definition: matrix-view.hh:354
size_type ci() const
Col in the Input matrix
Definition: matrix-view.hh:835
Definition: matrix-view.hh:295
RowIndices_t m_rows
Definition: matrix-view.hh:671
EIGEN_STRONG_INLINE Scalar & coeffRef(size_type row, const size_type &col)
Definition: matrix-view.hh:926
internal::conditional< _allRows, const internal::empty_struct, const Indices_t &>::type RowIndices_t
Definition: matrix-view.hh:886
MatrixBlockView< _ArgType2, _Rows2, _Cols2, _allRows2, _allCols2 > Dst
Definition: matrix-view.hh:252
block_t< const ArgType >::type BlockConstXprType
Definition: matrix-view.hh:882
static EIGEN_STRONG_INLINE T1 run(T1 then, T2 Else)
Definition: matrix-view.hh:147
View::size_type size_type
Definition: matrix-view.hh:267
const size_type & nbRows() const
Definition: matrix-view.hh:651
static void sort(segments_t &a)
const segments_t & indices() const
Definition: matrix-view.hh:413
EIGEN_STRONG_INLINE View< const MatrixType >::type rview(const MatrixBase< MatrixType > &other) const
Definition: matrix-view.hh:384
static Index size()
Definition: matrix-view.hh:144
ColIndices_t m_cols
Definition: matrix-view.hh:983
_ArgType ArgType
Definition: matrix-view.hh:866
MatrixBlockView< _ArgType, _Rows, _Cols, _allRows, _allCols > Src
Definition: matrix-view.hh:239
ArgType & m_arg
Definition: matrix-view.hh:979
Definition: matrix-view.hh:822
static EIGEN_STRONG_INLINE Derived & run(Derived &dst, const OtherDerived &other)
Definition: matrix-view.hh:220
const Index & operator[](const Index &i) const
Definition: matrix-view.hh:145
MatrixBlocks(const MatrixBlocksBase< MBDerived > &other)
Copy constructor.
Definition: matrix-view.hh:575
RowIndices_t m_rows
Definition: matrix-view.hh:981
EIGEN_STRONG_INLINE CoeffReturnType coeff(size_type index) const
Definition: matrix-view.hh:910
size_type m_nbRows
Definition: matrix-view.hh:980
EIGEN_STRONG_INLINE PlainObject eval() const
Definition: matrix-view.hh:942
static EIGEN_STRONG_INLINE T2 run(T1 then, T2 Else)
Definition: matrix-view.hh:148
internal::conditional< _allCols, internal::empty_struct, const BlockIndex::segments_t & >::type ColIndices_t
Definition: matrix-view.hh:169
std::pair< size_type, size_type > segment_t
Interval of indices [first, first + second - 1].
Definition: matrix-view.hh:41
EIGEN_STRONG_INLINE View< MatrixType >::type lview(const MatrixBase< MatrixType > &other) const
Definition: matrix-view.hh:371
static bool overlap(const segment_t &a, const segment_t &b)
Whether two segments overlap.
static void run(std::ostream &, const BlockIndexType &)
Definition: matrix-view.hh:295
size_type m_nbCols
Definition: matrix-view.hh:982
MatrixBlocksRef< AllRows, true > keepRows() const
Definition: matrix-view.hh:396
const ColIndices_t & cols() const
Definition: matrix-view.hh:644
internal::traits< Derived >::ColIndices_t ColIndices_t
Definition: matrix-view.hh:356
static segments_t sum(const segment_t &a, const segment_t &b)
Compute the union of tws segments.
ArgType::Index Index
Definition: matrix-view.hh:178
void clearCols()
Clear cols.
Definition: matrix-view.hh:593
EIGEN_STRONG_INLINE size_type cols() const
Definition: matrix-view.hh:908
View::size_type size_type
Definition: matrix-view.hh:277
pinocchio::size_type size_type
Definition: fwd.hh:35
Smaller matrix composed by concatenation of the blocks.
Definition: matrix-view.hh:359
static Second & run(First &, Second &s)
Definition: matrix-view.hh:136
EIGEN_STRONG_INLINE CoeffReturnType coeff(size_type row, size_type col) const
Definition: matrix-view.hh:915
internal::traits< Derived >::RowIndices_t RowIndices_t
Definition: matrix-view.hh:355
Derived const & derived() const
Definition: matrix-view.hh:363
MatrixBlockView(ArgType &arg, const size_type &nbIndices, const Indices_t &indices)
Valid only when _allRows or _allCols is true.
Definition: matrix-view.hh:900
const size_type & nbRows() const
Definition: matrix-view.hh:444
empty_struct(In_t)
Definition: matrix-view.hh:142
View::size_type size_type
Definition: matrix-view.hh:287
const RowIndices_t & rows() const
Definition: matrix-view.hh:637
MatrixBlocksBase(const MatrixBlocksBase &)
Copy constructor.
Definition: matrix-view.hh:491
void updateCols()
Definition: matrix-view.hh:631
MatrixBlocks(const segments_t &rows, const segments_t &cols)
Definition: matrix-view.hh:507
static EIGEN_STRONG_INLINE Derived & run(Derived &dst, const OtherDerived &other)
Definition: matrix-view.hh:213
static std::ostream & run(std::ostream &os, const constraints::segment_t &s)
Definition: matrix-view.hh:998
internal::ref_selector< ArgType >::type ArgTypeNested
Definition: matrix-view.hh:867
hpp::constraints::size_type size_type
Index of vector or matrix.
Definition: matrix-view.hh:350
EIGEN_STRONG_INLINE bool isZero(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: matrix-view.hh:968
internal::conditional< _allRows, internal::empty_struct, BlockIndex::segments_t >::type RowIndices_t
Definition: matrix-view.hh:157
traits< ArgType >::StorageKind StorageKind
Definition: matrix-view.hh:180
size_type row
Definition: matrix-view.hh:824
static segments_t extract(const segments_t &segments, size_type start, size_type cardinal)
BlockIndex::segment_t segment_t
Interval of indices [first, first + second - 1].
Definition: matrix-view.hh:352
internal::conditional< _allCols, const internal::empty_struct, const Indices_t &>::type ColIndices_t
Definition: matrix-view.hh:887
internal::conditional< _allCols, internal::empty_struct, BlockIndex::segments_t >::type ColIndices_t
Definition: matrix-view.hh:158
static ReturnType run(Derived &d, size_type, size_type c, size_type, size_type cs)
Definition: matrix-view.hh:289
Definition: matrix-view.hh:226
void updateRows()
Definition: matrix-view.hh:622
size_type rs() const
number of RowS
Definition: matrix-view.hh:837
Definition: matrix-view.hh:873