matrix-block.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2019 INRIA
3 //
4 
5 #ifndef __pinocchio_math_matrix_block_hpp__
6 #define __pinocchio_math_matrix_block_hpp__
7 
8 #include <Eigen/Core>
9 
10 namespace pinocchio
11 {
12  template<int NV>
13  struct SizeDepType
14  {
15  template<class Mat>
17  {
18  typedef typename Mat::template FixedSegmentReturnType<NV>::Type Type;
19  typedef typename Mat::template ConstFixedSegmentReturnType<NV>::Type ConstType;
20  };
21 
22  template<typename D>
24  const Eigen::MatrixBase<D> & mat,
25  typename Eigen::DenseBase<D>::Index start,
27  {
29  return mat.template segment<NV>(start);
30  }
31 
32  template<typename D>
34  Eigen::MatrixBase<D> & mat,
35  typename Eigen::DenseBase<D>::Index start,
37  {
39  return mat.template segment<NV>(start);
40  }
41 
42  template<class Mat>
43  struct ColsReturn
44  {
45  typedef typename Mat::template NColsBlockXpr<NV>::Type Type;
46  typedef typename Mat::template ConstNColsBlockXpr<NV>::Type ConstType;
47  };
48 
49  template<typename D>
51  const Eigen::MatrixBase<D> & mat,
52  typename Eigen::DenseBase<D>::Index start,
54  {
56  return mat.template middleCols<NV>(start);
57  }
58 
59  template<typename D>
61  Eigen::MatrixBase<D> & mat,
62  typename Eigen::DenseBase<D>::Index start,
64  {
66  return mat.template middleCols<NV>(start);
67  }
68 
69  template<class Mat>
70  struct RowsReturn
71  {
72  typedef typename Mat::template NRowsBlockXpr<NV>::Type Type;
73  typedef typename Mat::template ConstNRowsBlockXpr<NV>::Type ConstType;
74  };
75 
76  template<typename D>
78  const Eigen::MatrixBase<D> & mat,
79  typename Eigen::DenseBase<D>::Index start,
81  {
83  return mat.template middleRows<NV>(start);
84  }
85 
86  template<typename D>
88  Eigen::MatrixBase<D> & mat,
89  typename Eigen::DenseBase<D>::Index start,
91  {
93  return mat.template middleRows<NV>(start);
94  }
95 
96  template<class Mat>
97  struct BlockReturn
98  {
99  typedef Eigen::Block<Mat, NV, NV> Type;
100  typedef const Eigen::Block<const Mat, NV, NV> ConstType;
101  };
102 
103  template<typename D>
105  const Eigen::MatrixBase<D> & mat,
106  typename Eigen::DenseBase<D>::Index row_id,
107  typename Eigen::DenseBase<D>::Index col_id,
108  typename Eigen::DenseBase<D>::Index row_size_block = NV,
109  typename Eigen::DenseBase<D>::Index col_size_block = NV)
110  {
111  PINOCCHIO_UNUSED_VARIABLE(row_size_block);
112  PINOCCHIO_UNUSED_VARIABLE(col_size_block);
113  return mat.template block<NV, NV>(row_id, col_id);
114  }
115 
116  template<typename D>
117  static typename BlockReturn<D>::Type block(
118  Eigen::MatrixBase<D> & mat,
119  typename Eigen::DenseBase<D>::Index row_id,
120  typename Eigen::DenseBase<D>::Index col_id,
121  typename Eigen::DenseBase<D>::Index row_size_block = NV,
122  typename Eigen::DenseBase<D>::Index col_size_block = NV)
123  {
124  PINOCCHIO_UNUSED_VARIABLE(row_size_block);
125  PINOCCHIO_UNUSED_VARIABLE(col_size_block);
126  return mat.template block<NV, NV>(row_id, col_id);
127  }
128  };
129 
130  template<>
132  {
133  template<class Mat>
134  struct SegmentReturn
135  {
136  typedef typename Mat::SegmentReturnType Type;
137  typedef typename Mat::ConstSegmentReturnType ConstType;
138  };
139 
140  template<typename D>
142  const Eigen::MatrixBase<D> & mat,
143  typename Eigen::DenseBase<D>::Index start,
145  {
146  return mat.segment(start, size);
147  }
148 
149  template<typename D>
151  Eigen::MatrixBase<D> & mat,
152  typename Eigen::DenseBase<D>::Index start,
154  {
155  return mat.segment(start, size);
156  }
157 
158  template<class Mat>
159  struct ColsReturn
160  {
161  typedef typename Mat::ColsBlockXpr Type;
162  typedef typename Mat::ConstColsBlockXpr ConstType;
163  };
164 
165  template<typename D>
167  const Eigen::MatrixBase<D> & mat,
168  typename Eigen::DenseBase<D>::Index start,
170  {
171  return mat.middleCols(start, size);
172  }
173 
174  template<typename D>
176  Eigen::MatrixBase<D> & mat,
177  typename Eigen::DenseBase<D>::Index start,
179  {
180  return mat.middleCols(start, size);
181  }
182 
183  template<class Mat>
184  struct RowsReturn
185  {
186  typedef typename Mat::RowsBlockXpr Type;
187  typedef typename Mat::ConstRowsBlockXpr ConstType;
188  };
189 
190  template<typename D>
192  const Eigen::MatrixBase<D> & mat,
193  typename Eigen::DenseBase<D>::Index start,
195  {
196  return mat.middleRows(start, size);
197  }
198 
199  template<typename D>
201  Eigen::MatrixBase<D> & mat,
202  typename Eigen::DenseBase<D>::Index start,
204  {
205  return mat.middleRows(start, size);
206  }
207 
208  template<class Mat>
209  struct BlockReturn
210  {
211  typedef Eigen::Block<Mat> Type;
212  typedef const Eigen::Block<const Mat> ConstType;
213  };
214 
215  template<typename D>
217  const Eigen::MatrixBase<D> & mat,
218  typename Eigen::DenseBase<D>::Index row_id,
219  typename Eigen::DenseBase<D>::Index col_id,
220  typename Eigen::DenseBase<D>::Index row_size_block,
221  typename Eigen::DenseBase<D>::Index col_size_block)
222  {
223  return mat.block(row_id, col_id, row_size_block, col_size_block);
224  }
225 
226  template<typename D>
227  static typename BlockReturn<D>::Type block(
228  Eigen::MatrixBase<D> & mat,
229  typename Eigen::DenseBase<D>::Index row_id,
230  typename Eigen::DenseBase<D>::Index col_id,
231  typename Eigen::DenseBase<D>::Index row_size_block,
232  typename Eigen::DenseBase<D>::Index col_size_block)
233  {
234  return mat.block(row_id, col_id, row_size_block, col_size_block);
235  }
236  };
237 } // namespace pinocchio
238 
239 #endif // ifndef __pinocchio_math_matrix_block_hpp__
pinocchio::SizeDepType
Definition: matrix-block.hpp:13
pinocchio::SizeDepType::ColsReturn::ConstType
Mat::template ConstNColsBlockXpr< NV >::Type ConstType
Definition: matrix-block.hpp:46
pinocchio::SizeDepType< Eigen::Dynamic >::middleRows
static RowsReturn< D >::ConstType middleRows(const Eigen::MatrixBase< D > &mat, typename Eigen::DenseBase< D >::Index start, typename Eigen::DenseBase< D >::Index size)
Definition: matrix-block.hpp:191
pinocchio::SizeDepType< Eigen::Dynamic >::SegmentReturn::ConstType
Mat::ConstSegmentReturnType ConstType
Definition: matrix-block.hpp:137
Eigen
pinocchio::SizeDepType< Eigen::Dynamic >::RowsReturn::ConstType
Mat::ConstRowsBlockXpr ConstType
Definition: matrix-block.hpp:187
pinocchio::SizeDepType::middleCols
static ColsReturn< D >::ConstType middleCols(const Eigen::MatrixBase< D > &mat, typename Eigen::DenseBase< D >::Index start, typename Eigen::DenseBase< D >::Index size=NV)
Definition: matrix-block.hpp:50
pinocchio::SizeDepType< Eigen::Dynamic >::middleCols
static ColsReturn< D >::Type middleCols(Eigen::MatrixBase< D > &mat, typename Eigen::DenseBase< D >::Index start, typename Eigen::DenseBase< D >::Index size)
Definition: matrix-block.hpp:175
pinocchio::SizeDepType< Eigen::Dynamic >::segment
static SegmentReturn< D >::ConstType segment(const Eigen::MatrixBase< D > &mat, typename Eigen::DenseBase< D >::Index start, typename Eigen::DenseBase< D >::Index size)
Definition: matrix-block.hpp:141
pinocchio::SizeDepType::block
static BlockReturn< D >::Type block(Eigen::MatrixBase< D > &mat, typename Eigen::DenseBase< D >::Index row_id, typename Eigen::DenseBase< D >::Index col_id, typename Eigen::DenseBase< D >::Index row_size_block=NV, typename Eigen::DenseBase< D >::Index col_size_block=NV)
Definition: matrix-block.hpp:117
pinocchio::SizeDepType< Eigen::Dynamic >::middleCols
static ColsReturn< D >::ConstType middleCols(const Eigen::MatrixBase< D > &mat, typename Eigen::DenseBase< D >::Index start, typename Eigen::DenseBase< D >::Index size)
Definition: matrix-block.hpp:166
pinocchio::SizeDepType::SegmentReturn
Definition: matrix-block.hpp:16
pinocchio::SizeDepType< Eigen::Dynamic >::RowsReturn::Type
Mat::RowsBlockXpr Type
Definition: matrix-block.hpp:186
pinocchio::SizeDepType::BlockReturn
Definition: matrix-block.hpp:97
pinocchio::Index
PINOCCHIO_COMPILER_DIAGNOSTIC_POP typedef std::size_t Index
Definition: multibody/fwd.hpp:22
pinocchio::SizeDepType::BlockReturn::ConstType
const typedef Eigen::Block< const Mat, NV, NV > ConstType
Definition: matrix-block.hpp:100
pinocchio::SizeDepType::RowsReturn
Definition: matrix-block.hpp:70
pinocchio::SizeDepType< Eigen::Dynamic >::SegmentReturn::Type
Mat::SegmentReturnType Type
Definition: matrix-block.hpp:136
pinocchio::Dynamic
const int Dynamic
Definition: fwd.hpp:140
pinocchio::SizeDepType< Eigen::Dynamic >::BlockReturn::ConstType
const typedef Eigen::Block< const Mat > ConstType
Definition: matrix-block.hpp:212
mat
mat
pinocchio::SizeDepType::ColsReturn::Type
Mat::template NColsBlockXpr< NV >::Type Type
Definition: matrix-block.hpp:45
size
FCL_REAL size() const
pinocchio::SizeDepType::middleRows
static RowsReturn< D >::ConstType middleRows(const Eigen::MatrixBase< D > &mat, typename Eigen::DenseBase< D >::Index start, typename Eigen::DenseBase< D >::Index size=NV)
Definition: matrix-block.hpp:77
pinocchio::SizeDepType::segment
static SegmentReturn< D >::ConstType segment(const Eigen::MatrixBase< D > &mat, typename Eigen::DenseBase< D >::Index start, typename Eigen::DenseBase< D >::Index size=NV)
Definition: matrix-block.hpp:23
pinocchio::SizeDepType< Eigen::Dynamic >::ColsReturn::Type
Mat::ColsBlockXpr Type
Definition: matrix-block.hpp:161
pinocchio::SizeDepType::RowsReturn::ConstType
Mat::template ConstNRowsBlockXpr< NV >::Type ConstType
Definition: matrix-block.hpp:73
pinocchio::SizeDepType::middleRows
static RowsReturn< D >::Type middleRows(Eigen::MatrixBase< D > &mat, typename Eigen::DenseBase< D >::Index start, typename Eigen::DenseBase< D >::Index size=NV)
Definition: matrix-block.hpp:87
pinocchio::SizeDepType< Eigen::Dynamic >::block
static BlockReturn< D >::Type block(Eigen::MatrixBase< D > &mat, typename Eigen::DenseBase< D >::Index row_id, typename Eigen::DenseBase< D >::Index col_id, typename Eigen::DenseBase< D >::Index row_size_block, typename Eigen::DenseBase< D >::Index col_size_block)
Definition: matrix-block.hpp:227
pinocchio::SizeDepType::BlockReturn::Type
Eigen::Block< Mat, NV, NV > Type
Definition: matrix-block.hpp:99
pinocchio::SizeDepType::middleCols
static ColsReturn< D >::Type middleCols(Eigen::MatrixBase< D > &mat, typename Eigen::DenseBase< D >::Index start, typename Eigen::DenseBase< D >::Index size=NV)
Definition: matrix-block.hpp:60
pinocchio::SizeDepType< Eigen::Dynamic >::block
static BlockReturn< D >::ConstType block(const Eigen::MatrixBase< D > &mat, typename Eigen::DenseBase< D >::Index row_id, typename Eigen::DenseBase< D >::Index col_id, typename Eigen::DenseBase< D >::Index row_size_block, typename Eigen::DenseBase< D >::Index col_size_block)
Definition: matrix-block.hpp:216
pinocchio::SizeDepType::ColsReturn
Definition: matrix-block.hpp:43
pinocchio::SizeDepType< Eigen::Dynamic >::segment
static SegmentReturn< D >::Type segment(Eigen::MatrixBase< D > &mat, typename Eigen::DenseBase< D >::Index start, typename Eigen::DenseBase< D >::Index size)
Definition: matrix-block.hpp:150
pinocchio::SizeDepType< Eigen::Dynamic >::BlockReturn::Type
Eigen::Block< Mat > Type
Definition: matrix-block.hpp:211
pinocchio::SizeDepType::block
static BlockReturn< D >::ConstType block(const Eigen::MatrixBase< D > &mat, typename Eigen::DenseBase< D >::Index row_id, typename Eigen::DenseBase< D >::Index col_id, typename Eigen::DenseBase< D >::Index row_size_block=NV, typename Eigen::DenseBase< D >::Index col_size_block=NV)
Definition: matrix-block.hpp:104
pinocchio::SizeDepType< Eigen::Dynamic >::ColsReturn::ConstType
Mat::ConstColsBlockXpr ConstType
Definition: matrix-block.hpp:162
dcrba.NV
NV
Definition: dcrba.py:514
pinocchio::SizeDepType::segment
static SegmentReturn< D >::Type segment(Eigen::MatrixBase< D > &mat, typename Eigen::DenseBase< D >::Index start, typename Eigen::DenseBase< D >::Index size=NV)
Definition: matrix-block.hpp:33
pinocchio::SizeDepType::RowsReturn::Type
Mat::template NRowsBlockXpr< NV >::Type Type
Definition: matrix-block.hpp:72
pinocchio::SizeDepType::SegmentReturn::Type
Mat::template FixedSegmentReturnType< NV >::Type Type
Definition: matrix-block.hpp:18
pinocchio::SizeDepType::SegmentReturn::ConstType
Mat::template ConstFixedSegmentReturnType< NV >::Type ConstType
Definition: matrix-block.hpp:19
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
pinocchio::SizeDepType< Eigen::Dynamic >::middleRows
static RowsReturn< D >::Type middleRows(Eigen::MatrixBase< D > &mat, typename Eigen::DenseBase< D >::Index start, typename Eigen::DenseBase< D >::Index size)
Definition: matrix-block.hpp:200
PINOCCHIO_UNUSED_VARIABLE
#define PINOCCHIO_UNUSED_VARIABLE(var)
Helper to declare that a parameter is unused.
Definition: include/pinocchio/macros.hpp:67


pinocchio
Author(s):
autogenerated on Sat Jun 1 2024 02:40:37