humoto
blockmatrix_kronecker.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4  @copyright 2014-2017 INRIA. Licensed under the Apache License, Version 2.0.
5  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
6 
7  @brief
8 */
9 
10 #pragma once
11 
12 namespace etools
13 {
14 #define EIGENTOOLS_PARENT_CLASS_SHORTHAND BlockMatrixBase< const typename TypeWithoutConst<t_MatrixType>::Type, \
15  t_block_rows_num, t_block_cols_num, t_sparsity_type>
16  /**
17  * @brief Represents block kronecker product "Identity(size) [X] Matrix".
18  *
19  * @tparam t_MatrixType type of raw matrix
20  * @tparam t_block_rows_num number of rows in one block
21  * @tparam t_block_cols_num number of columns in one block
22  * @tparam t_sparsity_type sparsity type
23  */
24  template< class t_MatrixType,
25  int t_block_rows_num,
26  int t_block_cols_num,
27  MatrixSparsityType::Type t_sparsity_type>
29  {
30  private:
31  std::ptrdiff_t identity_size_;
32 
33 
34  protected:
35  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::operator();
36  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::matrix_;
37  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::num_blocks_hor_;
38  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::num_blocks_vert_;
39  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::multiplyRight;
40  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::column;
41  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::block_rows_num_;
42  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::block_cols_num_;
43 
44 
45  /**
46  * @brief Conversion to a matrix
47  *
48  * @tparam t_Derived Eigen template parameter
49  *
50  * @param[out] output matrix
51  */
52  template<class t_Derived>
53  void evaluateWithoutInitialization(const Eigen::MatrixBase<t_Derived> & output) const
54  {
55  Eigen::MatrixBase<t_Derived> & out = const_cast< Eigen::MatrixBase<t_Derived> & > (output);
56 
57  for (std::ptrdiff_t j = 0; j < num_blocks_hor_; ++j)
58  {
59  std::ptrdiff_t primary_block_col = j * identity_size_;
60 
61  for (std::ptrdiff_t i = 0; i < num_blocks_vert_; ++i)
62  {
63  std::ptrdiff_t primary_block_row = i * identity_size_;
64 
65  for(std::ptrdiff_t k = 0; k < identity_size_; ++k)
66  {
67  out.block( (primary_block_row + k)*EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM,
68  (primary_block_col + k)*EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM,
69  EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM,
70  EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM) = (*this)(i, j);
71  }
72  }
73  }
74  }
75 
76 
77  public:
78  typedef typename EIGENTOOLS_PARENT_CLASS_SHORTHAND::DecayedRawMatrix DecayedRawMatrix;
79 
80 
81  /**
82  * @brief this * BlockMatrix<DIAGONAL>
83  *
84  * @tparam t_Derived Eigen parameter
85  * @tparam t_DBMMatrixType raw diagonal block matrix type
86  * @tparam t_dbm_block_rows_num number of rows in a block of the diagonal matrix
87  * @tparam t_dbm_block_cols_num number of columns in a block of the diagonal matrix
88  *
89  * @param[out] result result of multiplication
90  * @param[in] dbm diagonal block matrix
91  */
92  template< class t_Derived,
93  typename t_DBMMatrixType,
94  int t_dbm_block_rows_num,
95  int t_dbm_block_cols_num>
96  void multiplyRight( Eigen::PlainObjectBase<t_Derived> &result,
97  const BlockMatrixBase< t_DBMMatrixType,
98  t_dbm_block_rows_num,
99  t_dbm_block_cols_num,
100  MatrixSparsityType::DIAGONAL> &dbm) const
101  {
102  EIGENTOOLS_ASSERT(dbm.getBlockRowsNum() == EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM*identity_size_,
103  "Block sizes do not match.");
104  EIGENTOOLS_ASSERT(num_blocks_hor_ == dbm.getNumberOfBlocksVertical(),
105  "Numbers of blocks do not match.");
106  EIGENTOOLS_ASSERT(num_blocks_hor_*EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM*identity_size_ == dbm.getNumberOfRows(),
107  "Sizes of matrices do not match.");
108 
109 
110  result.resize(identity_size_ * matrix_.rows(), dbm.getNumberOfColumns());
111  if (num_blocks_hor_ != 0)
112  {
113  Eigen::VectorXi indices;
114 
115  indices.resize(identity_size_ * matrix_.rows());
116 
117  for (std::ptrdiff_t i = 0; i < identity_size_; ++i)
118  {
119  for (std::ptrdiff_t j = 0; j < num_blocks_vert_; ++j)
120  {
121  indices.segment(j*EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM*identity_size_ + i*EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM, EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM) =
122  Eigen::VectorXi::LinSpaced( EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM,
123  i*matrix_.rows() + j*EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM,
124  i*matrix_.rows() + (j+1)*EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM - 1);
125  }
126  }
127 
128 
129  std::ptrdiff_t dbm_block_cols = dbm.getNumberOfColumns() / num_blocks_hor_;
130 
131  for (std::ptrdiff_t i = 0; i < identity_size_; ++i)
132  {
133  for (std::ptrdiff_t j = 0; j < num_blocks_hor_; ++j)
134  {
135  result.block(i*matrix_.rows(), dbm_block_cols*j, matrix_.rows(), dbm_block_cols).noalias() =
136  column(j)
137  *
138  dbm(j).block(i*EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM, 0, EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM, dbm_block_cols);
139  }
140  }
141 
142  result = (Eigen::PermutationWrapper<Eigen::VectorXi> (indices)).transpose() * result;
143  }
144  }
145 
146 
147  /*
148  // this is slower
149  template< typename t_DBMMatrixType,
150  int t_dbm_block_rows_num,
151  int t_dbm_block_cols_num>
152  void multiplyRight( Eigen::MatrixBaseXd &result,
153  const BlockMatrixBase< t_DBMMatrixType,
154  t_dbm_block_rows_num,
155  t_dbm_block_cols_num,
156  MatrixSparsityType::DIAGONAL> &dbm) const
157  {
158  EIGENTOOLS_ASSERT(dbm.getBlockRowsNum() == EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM*identity_size_,
159  "Block sizes do not match.");
160  EIGENTOOLS_ASSERT(num_blocks_hor_ == dbm.getNumberOfBlocksVertical(),
161  "Numbers of blocks do not match.");
162  EIGENTOOLS_ASSERT(num_blocks_hor_*EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM*identity_size_ == dbm.getNumberOfRows(),
163  "Sizes of matrices do not match.");
164 
165 
166  result.resize(identity_size_ * matrix_.rows(), dbm.getNumberOfColumns());
167 
168  BlockMatrixInterface< t_block_rows_num,
169  t_dbm_block_cols_num,
170  MatrixSparsityType::NONE >
171  result_bmi( result,
172  t_block_rows_num == MatrixBlockSizeType::DYNAMIC ? EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM : MatrixBlockSizeType::UNDEFINED,
173  t_dbm_block_cols_num == MatrixBlockSizeType::DYNAMIC ? dbm.getBlockRowsNum() : MatrixBlockSizeType::UNDEFINED);
174 
175 
176  std::ptrdiff_t dbm_block_cols = dbm.getBlockColsNum();
177 
178  for (std::ptrdiff_t j = 0; j < num_blocks_hor_; ++j)
179  {
180  for (std::ptrdiff_t k = 0; k < identity_size_; ++k)
181  {
182  for (std::ptrdiff_t i = 0; i < num_blocks_vert_; ++i)
183  {
184  result_bmi(i*identity_size_ + k, j).noalias() =
185  (*this)(i,j)
186  *
187  dbm(j).block( k*EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM,
188  0,
189  EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM,
190  dbm_block_cols);
191  }
192  }
193  }
194  }
195  */
196 
197 
198 
199  /**
200  * @brief this * Vector
201  *
202  * @tparam t_DerivedOutput Eigen template parameter
203  * @tparam t_Scalar Eigen template parameter
204  * @tparam t_vector_size Eigen template parameter
205  * @tparam t_vector_options Eigen template parameter
206  *
207  * @param[out] result result of multiplication
208  * @param[in] vector
209  */
210  template< class t_DerivedOutput,
211  typename t_Scalar,
212  int t_vector_size,
213  int t_vector_options>
214  void multiplyRight( Eigen::PlainObjectBase<t_DerivedOutput> &result,
215  const Eigen::Matrix<t_Scalar, t_vector_size, 1, t_vector_options> & vector) const
216  {
217  EIGENTOOLS_DYNAMIC_VECTOR(typename Eigen::PlainObjectBase<t_DerivedOutput>::Scalar) result_part;
218  EIGENTOOLS_DYNAMIC_VECTOR(typename Eigen::PlainObjectBase<t_DerivedOutput>::Scalar) vector_part;
219 
220 
221  result.resize(identity_size_ * matrix_.rows());
222 
223  vector_part.resize(matrix_.cols());
224 
225  for (std::ptrdiff_t i = 0; i < identity_size_; ++i)
226  {
227  for (std::ptrdiff_t j = 0; j < num_blocks_hor_; ++j)
228  {
229  vector_part.segment(j*EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM, EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM) =
230  vector.segment(j*EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM*identity_size_ + i*EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM, EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM);
231  }
232 
233  result_part.noalias() = matrix_ * vector_part;
234 
235  for (std::ptrdiff_t j = 0; j < num_blocks_vert_; ++j)
236  {
237  result.segment(j*EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM*identity_size_ + i*EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM, EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM) =
238  result_part.segment(j*EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM, EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM);
239  }
240  }
241  }
242 
243 
244 
245  /**
246  * @brief Conversion to Matrix
247  *
248  * @return Matrix
249  */
250  DecayedRawMatrix evaluate() const
251  {
252  DecayedRawMatrix output;
253  evaluate(output);
254  return(output);
255  }
256 
257 
258 
259  /**
260  * @brief Conversion to a matrix
261  *
262  * @tparam t_Derived Eigen template parameter
263  *
264  * @param[out] output matrix
265  */
266  template<class t_Derived>
267  void evaluate(Eigen::PlainObjectBase<t_Derived> & output) const
268  {
269  output.setZero(identity_size_ * matrix_.rows(),
270  identity_size_ * matrix_.cols());
271  evaluateWithoutInitialization(output);
272  }
273 
274 
275  /**
276  * @brief Conversion to a matrix
277  *
278  * @tparam t_Derived Eigen template parameter
279  * @tparam t_rows Eigen template parameter
280  * @tparam t_cols Eigen template parameter
281  * @tparam t_flag Eigen template parameter
282  *
283  * @param[out] output matrix block of appropriate size
284  */
285  template<class t_Derived, int t_rows, int t_cols, bool t_flag>
286  void evaluate(Eigen::Block<t_Derived, t_rows, t_cols, t_flag> output) const
287  {
288  output.setZero();
289  evaluateWithoutInitialization(output);
290  }
291 
292 
293 
294  /**
295  * @brief Constructor
296  *
297  * @param[in] matrix
298  * @param[in] identity_size
299  * @param[in] block_rows_num number of rows in a block if t_block_rows_num = MatrixBlockSizeType::DYNAMIC
300  * @param[in] block_cols_num number of cols in a block if t_block_cols_num = MatrixBlockSizeType::DYNAMIC
301  */
302  BlockKroneckerProductBase( const DecayedRawMatrix & matrix,
303  const std::ptrdiff_t identity_size = 1,
304  const std::ptrdiff_t block_rows_num = MatrixBlockSizeType::UNDEFINED,
305  const std::ptrdiff_t block_cols_num = MatrixBlockSizeType::UNDEFINED) :
306  EIGENTOOLS_PARENT_CLASS_SHORTHAND(matrix, block_rows_num, block_cols_num)
307  {
308  EIGENTOOLS_ASSERT( identity_size > 1,
309  "Identity size cannot be less than 2.");
310  identity_size_ = identity_size;
311  }
312  };
313 #undef EIGENTOOLS_PARENT_CLASS_SHORTHAND
314 
315 
316 
317 #define EIGENTOOLS_PARENT_CLASS_SHORTHAND BlockMatrixBase< const typename TypeWithoutConst<t_MatrixType>::Type, \
318  t_block_rows_num, t_block_cols_num, MatrixSparsityType::LEFT_LOWER_TRIANGULAR>
319  /**
320  * @brief Represents block kronecker product "Identity(size) [X] Matrix",
321  * without computing it explicitly.
322  *
323  * @tparam t_MatrixType type of raw matrix
324  * @tparam t_block_rows_num number of rows in one block
325  * @tparam t_block_cols_num number of columns in one block
326  */
327  template< class t_MatrixType,
328  int t_block_rows_num,
329  int t_block_cols_num>
331  t_block_rows_num,
332  t_block_cols_num,
333  MatrixSparsityType::LEFT_LOWER_TRIANGULAR>
335  {
336  private:
337  std::ptrdiff_t identity_size_;
338 
339 
340  protected:
341  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::operator();
342  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::matrix_;
343  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::num_blocks_hor_;
344  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::num_blocks_vert_;
345  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::multiplyRight;
346  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::column;
347  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::block_rows_num_;
348  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::block_cols_num_;
349 
350 
351  /**
352  * @brief Conversion to a matrix
353  *
354  * @tparam t_Derived Eigen template parameter
355  *
356  * @param[out] output matrix
357  */
358  template<class t_Derived>
359  void evaluateWithoutInitialization(const Eigen::MatrixBase<t_Derived> & output) const
360  {
361  Eigen::MatrixBase<t_Derived> & out = const_cast< Eigen::MatrixBase<t_Derived> & > (output);
362 
363  for (std::ptrdiff_t j = 0; j < num_blocks_hor_; ++j)
364  {
365  std::ptrdiff_t primary_block_col = j * identity_size_;
366 
367  for (std::ptrdiff_t i = j; i < num_blocks_vert_; ++i)
368  {
369  std::ptrdiff_t primary_block_row = i * identity_size_;
370 
371  for(std::ptrdiff_t k = 0; k < identity_size_; ++k)
372  {
373  out.block( (primary_block_row + k)*EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM,
374  (primary_block_col + k)*EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM,
375  EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM,
376  EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM) = (*this)(i, j);
377  }
378  }
379  }
380  }
381 
382 
383  public:
384  typedef typename EIGENTOOLS_PARENT_CLASS_SHORTHAND::DecayedRawMatrix DecayedRawMatrix;
385 
386 
387  /**
388  * @brief this<LEFT_LOWER_TRIANGULAR> * BlockMatrix<DIAGONAL>
389  *
390  * @tparam t_Derived Eigen parameter
391  * @tparam t_DBMMatrixType raw diagonal block matrix type
392  * @tparam t_dbm_block_rows_num number of rows in a block of the diagonal matrix
393  * @tparam t_dbm_block_cols_num number of columns in a block of the diagonal matrix
394  *
395  * @param[out] result result of multiplication
396  * @param[in] dbm diagonal block matrix
397  */
398  template< class t_Derived,
399  typename t_DBMMatrixType,
400  int t_dbm_block_rows_num,
401  int t_dbm_block_cols_num>
402  void multiplyRight( Eigen::PlainObjectBase<t_Derived> &result,
403  const BlockMatrixBase< t_DBMMatrixType,
404  t_dbm_block_rows_num,
405  t_dbm_block_cols_num,
406  MatrixSparsityType::DIAGONAL> &dbm) const
407  {
408  EIGENTOOLS_ASSERT(dbm.getBlockRowsNum() == EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM*identity_size_,
409  "Block sizes do not match.");
410  EIGENTOOLS_ASSERT(num_blocks_hor_ == dbm.getNumberOfBlocksVertical(),
411  "Numbers of blocks do not match.");
412  EIGENTOOLS_ASSERT(num_blocks_hor_*EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM*identity_size_ == dbm.getNumberOfRows(),
413  "Sizes of matrices do not match.");
414 
415  result.setZero(identity_size_ * matrix_.rows(), dbm.getNumberOfColumns());
416  if (num_blocks_hor_ != 0)
417  {
418  Eigen::VectorXi indices;
419 
420  indices.resize(identity_size_ * matrix_.rows());
421 
422  for (std::ptrdiff_t i = 0; i < identity_size_; ++i)
423  {
424  for (std::ptrdiff_t j = 0; j < num_blocks_vert_; ++j)
425  {
426  indices.segment(j*EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM*identity_size_ + i*EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM, EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM) =
427  Eigen::VectorXi::LinSpaced( EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM,
428  i*matrix_.rows() + j*EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM,
429  i*matrix_.rows() + (j+1)*EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM - 1);
430  }
431  }
432 
433 
434  std::ptrdiff_t dbm_block_cols = dbm.getNumberOfColumns() / num_blocks_hor_;
435 
436  for (std::ptrdiff_t i = 0; i < identity_size_; ++i)
437  {
438  for (std::ptrdiff_t j = 0; j < num_blocks_hor_; ++j)
439  {
440  result.block(i*matrix_.rows() + j*EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM, dbm_block_cols*j, (num_blocks_vert_ - j) * EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM, dbm_block_cols).noalias() =
441  column(j, j)
442  *
443  dbm(j).block(i*EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM, 0, EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM, dbm_block_cols);
444  }
445  }
446 
447  result = (Eigen::PermutationWrapper<Eigen::VectorXi> (indices)).transpose() * result;
448  }
449  }
450 
451 
452 
453  /**
454  * @brief Conversion to Matrix
455  *
456  * @return Matrix
457  */
458  DecayedRawMatrix evaluate() const
459  {
460  DecayedRawMatrix output;
461  evaluate(output);
462  return(output);
463  }
464 
465 
466 
467  /**
468  * @brief Conversion to a matrix
469  *
470  * @tparam t_Derived Eigen template parameter
471  *
472  * @param[out] output matrix
473  */
474  template<class t_Derived>
475  void evaluate(Eigen::PlainObjectBase<t_Derived> & output) const
476  {
477  output.setZero(identity_size_ * matrix_.rows(),
478  identity_size_ * matrix_.cols());
479  evaluateWithoutInitialization(output);
480  }
481 
482 
483  /**
484  * @brief Conversion to a matrix
485  *
486  * @tparam t_Derived Eigen template parameter
487  * @tparam t_rows Eigen template parameter
488  * @tparam t_cols Eigen template parameter
489  * @tparam t_flag Eigen template parameter
490  *
491  * @param[out] output matrix block of appropriate size
492  */
493  template<class t_Derived, int t_rows, int t_cols, bool t_flag>
494  void evaluate(Eigen::Block<t_Derived, t_rows, t_cols, t_flag> output) const
495  {
496  output.setZero();
497  evaluateWithoutInitialization(output);
498  }
499 
500 
501  /**
502  * @brief Constructor
503  *
504  * @param[in] matrix
505  * @param[in] identity_size
506  * @param[in] block_rows_num number of rows in a block if t_block_rows_num = MatrixBlockSizeType::DYNAMIC
507  * @param[in] block_cols_num number of cols in a block if t_block_cols_num = MatrixBlockSizeType::DYNAMIC
508  */
509  BlockKroneckerProductBase( const DecayedRawMatrix & matrix,
510  const std::ptrdiff_t identity_size = 1,
511  const std::ptrdiff_t block_rows_num = MatrixBlockSizeType::UNDEFINED,
512  const std::ptrdiff_t block_cols_num = MatrixBlockSizeType::UNDEFINED) :
513  EIGENTOOLS_PARENT_CLASS_SHORTHAND(matrix, block_rows_num, block_cols_num)
514  {
515  EIGENTOOLS_ASSERT( identity_size > 1,
516  "Identity size cannot be less than 2.");
517  identity_size_ = identity_size;
518  }
519  };
520 #undef EIGENTOOLS_PARENT_CLASS_SHORTHAND
521 
522 
523 
524 #define EIGENTOOLS_PARENT_CLASS_SHORTHAND BlockMatrixBase< const typename TypeWithoutConst<t_MatrixType>::Type, \
525  1, 1, t_sparsity_type>
526  /**
527  * @brief Represents block kronecker product "Identity(size) [X] Matrix",
528  * without computing it explicitly.
529  *
530  * @tparam t_MatrixType type of raw matrix
531  * @tparam t_sparsity_type sparsity type
532  */
533  template< class t_MatrixType,
534  MatrixSparsityType::Type t_sparsity_type>
535  class EIGENTOOLS_VISIBILITY_ATTRIBUTE BlockKroneckerProductBase<t_MatrixType, 1, 1, t_sparsity_type>
537  {
538  private:
539  std::ptrdiff_t identity_size_;
540 
541 
542  protected:
543  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::operator();
544  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::matrix_;
545  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::num_blocks_hor_;
546  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::num_blocks_vert_;
547  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::multiplyRight;
548  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::column;
549  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::block_rows_num_;
550  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::block_cols_num_;
551 
552 
553  /**
554  * @brief Conversion to a matrix
555  *
556  * @tparam t_Derived Eigen template parameter
557  *
558  * @param[out] output matrix
559  */
560  template<class t_Derived>
561  void evaluateWithoutInitialization(const Eigen::MatrixBase<t_Derived> & output) const
562  {
563  Eigen::MatrixBase<t_Derived> & out = const_cast< Eigen::MatrixBase<t_Derived> & > (output);
564 
565  for (std::ptrdiff_t j = 0; j < num_blocks_hor_; ++j)
566  {
567  std::ptrdiff_t primary_block_col = j * identity_size_;
568 
569  for (std::ptrdiff_t i = 0; i < num_blocks_vert_; ++i)
570  {
571  std::ptrdiff_t primary_block_row = i * identity_size_;
572 
573  for(std::ptrdiff_t k = 0; k < identity_size_; ++k)
574  {
575  out(primary_block_row + k,
576  primary_block_col + k) = (*this)(i, j);
577  }
578  }
579  }
580  }
581 
582 
583  public:
584  typedef typename EIGENTOOLS_PARENT_CLASS_SHORTHAND::DecayedRawMatrix DecayedRawMatrix;
585 
586 
587  /**
588  * @brief this * BlockMatrix<DIAGONAL>
589  *
590  * @tparam t_Derived Eigen parameter
591  * @tparam t_DBMMatrixType raw diagonal block matrix type
592  * @tparam t_dbm_block_rows_num number of rows in a block of the diagonal matrix
593  * @tparam t_dbm_block_cols_num number of columns in a block of the diagonal matrix
594  *
595  * @param[out] result result of multiplication
596  * @param[in] dbm diagonal block matrix
597  */
598  template< class t_Derived,
599  typename t_DBMMatrixType,
600  int t_dbm_block_rows_num,
601  int t_dbm_block_cols_num>
602  void multiplyRight( Eigen::PlainObjectBase<t_Derived> &result,
603  const BlockMatrixBase< t_DBMMatrixType,
604  t_dbm_block_rows_num,
605  t_dbm_block_cols_num,
606  MatrixSparsityType::DIAGONAL> &dbm) const
607  {
608  EIGENTOOLS_ASSERT(dbm.getBlockRowsNum() == identity_size_,
609  "Block sizes do not match.");
610  EIGENTOOLS_ASSERT(num_blocks_hor_ == dbm.getNumberOfBlocksVertical(),
611  "Numbers of blocks do not match.");
612  EIGENTOOLS_ASSERT(num_blocks_hor_*identity_size_ == dbm.getNumberOfRows(),
613  "Sizes of matrices do not match.");
614 
615 
617  t_dbm_block_rows_num,
618  t_dbm_block_cols_num,
619  MatrixSparsityType::NONE > result_bmi(result);
620 
621  result_bmi.resize(num_blocks_vert_, dbm.getNumberOfBlocksHorizontal());
622 
623  if (num_blocks_hor_ != 0)
624  {
625  for (std::ptrdiff_t j = 0; j < dbm.getNumberOfBlocksHorizontal(); ++j)
626  {
627  for (std::ptrdiff_t i = 0; i < num_blocks_vert_; ++i)
628  {
629  // dbm.getNumberOfBlocksHorizontal() = num_blocks_hor_
630  result_bmi(i,j) = EIGENTOOLS_PARENT_CLASS_SHORTHAND::operator()(i,j) * dbm(j);
631  }
632  }
633  }
634  }
635 
636 
637 
638  /**
639  * @brief this * Vector
640  *
641  * @tparam t_DerivedOutput Eigen template parameter
642  * @tparam t_Scalar Eigen template parameter
643  * @tparam t_vector_size Eigen template parameter
644  * @tparam t_vector_options Eigen template parameter
645  *
646  * @param[out] result result of multiplication
647  * @param[in] vector
648  */
649  template< class t_DerivedOutput,
650  typename t_Scalar,
651  int t_vector_size,
652  int t_vector_options>
653  void multiplyRight( Eigen::PlainObjectBase<t_DerivedOutput> &result,
654  const Eigen::Matrix<t_Scalar, t_vector_size, 1, t_vector_options> & vector) const
655  {
656  result.setZero(identity_size_ * matrix_.rows());
657 
658  for (std::ptrdiff_t j = 0; j < num_blocks_hor_; ++j)
659  {
660  for (std::ptrdiff_t i = 0; i < num_blocks_vert_; ++i)
661  {
662  result.segment(i*identity_size_, identity_size_)
663  += EIGENTOOLS_PARENT_CLASS_SHORTHAND::operator()(i,j)
664  *
665  vector.segment(j*identity_size_, identity_size_);
666  }
667  }
668  }
669 
670 
671 
672  /**
673  * @brief Conversion to Matrix
674  *
675  * @return Matrix
676  */
677  DecayedRawMatrix evaluate() const
678  {
679  DecayedRawMatrix output;
680  evaluate(output);
681  return(output);
682  }
683 
684 
685 
686  /**
687  * @brief Conversion to a matrix
688  *
689  * @tparam t_Derived Eigen template parameter
690  *
691  * @param[out] output matrix
692  */
693  template<class t_Derived>
694  void evaluate(Eigen::PlainObjectBase<t_Derived> & output) const
695  {
696  output.setZero(identity_size_ * matrix_.rows(),
697  identity_size_ * matrix_.cols());
698  evaluateWithoutInitialization(output);
699  }
700 
701 
702  /**
703  * @brief Conversion to a matrix
704  *
705  * @tparam t_Derived Eigen template parameter
706  * @tparam t_rows Eigen template parameter
707  * @tparam t_cols Eigen template parameter
708  * @tparam t_flag Eigen template parameter
709  *
710  * @param[out] output matrix block of appropriate size
711  */
712  template<class t_Derived, int t_rows, int t_cols, bool t_flag>
713  void evaluate(Eigen::Block<t_Derived, t_rows, t_cols, t_flag> output) const
714  {
715  output.setZero();
716  evaluateWithoutInitialization(output);
717  }
718 
719 
720 
721  /**
722  * @brief Constructor
723  *
724  * @param[in] matrix
725  * @param[in] identity_size
726  * @param[in] block_rows_num number of rows in a block if t_block_rows_num = MatrixBlockSizeType::DYNAMIC
727  * @param[in] block_cols_num number of cols in a block if t_block_cols_num = MatrixBlockSizeType::DYNAMIC
728  */
729  BlockKroneckerProductBase( const DecayedRawMatrix & matrix,
730  const std::ptrdiff_t identity_size = 1,
731  const std::ptrdiff_t block_rows_num = MatrixBlockSizeType::UNDEFINED,
732  const std::ptrdiff_t block_cols_num = MatrixBlockSizeType::UNDEFINED) :
733  EIGENTOOLS_PARENT_CLASS_SHORTHAND(matrix, block_rows_num, block_cols_num)
734  {
735  EIGENTOOLS_ASSERT( identity_size > 1,
736  "Identity size cannot be less than 2.");
737  identity_size_ = identity_size;
738  }
739  };
740 #undef EIGENTOOLS_PARENT_CLASS_SHORTHAND
741 
742 
743 #define EIGENTOOLS_PARENT_CLASS_SHORTHAND BlockMatrixBase< const typename TypeWithoutConst<t_MatrixType>::Type, \
744  1, 1, MatrixSparsityType::LEFT_LOWER_TRIANGULAR>
745  /**
746  * @brief Represents block kronecker product "Identity(size) [X] Matrix",
747  * without computing it explicitly.
748  *
749  * @tparam t_MatrixType type of raw matrix
750  */
751  template<class t_MatrixType>
752  class EIGENTOOLS_VISIBILITY_ATTRIBUTE BlockKroneckerProductBase<t_MatrixType, 1, 1, MatrixSparsityType::LEFT_LOWER_TRIANGULAR>
754  {
755  private:
756  std::ptrdiff_t identity_size_;
757 
758 
759  protected:
760  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::operator();
761  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::matrix_;
762  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::num_blocks_hor_;
763  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::num_blocks_vert_;
764  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::multiplyRight;
765  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::column;
766  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::block_rows_num_;
767  using EIGENTOOLS_PARENT_CLASS_SHORTHAND::block_cols_num_;
768 
769 
770  /**
771  * @brief Conversion to a matrix
772  *
773  * @tparam t_Derived Eigen template parameter
774  *
775  * @param[out] output matrix
776  */
777  template<class t_Derived>
778  void evaluateWithoutInitialization(const Eigen::MatrixBase<t_Derived> & output) const
779  {
780  Eigen::MatrixBase<t_Derived> & out = const_cast< Eigen::MatrixBase<t_Derived> & > (output);
781 
782  for (std::ptrdiff_t j = 0; j < num_blocks_hor_; ++j)
783  {
784  std::ptrdiff_t primary_block_col = j * identity_size_;
785 
786  for (std::ptrdiff_t i = j; i < num_blocks_vert_; ++i)
787  {
788  std::ptrdiff_t primary_block_row = i * identity_size_;
789 
790  for(std::ptrdiff_t k = 0; k < identity_size_; ++k)
791  {
792  out(primary_block_row + k,
793  primary_block_col + k) = (*this)(i, j);
794  }
795  }
796  }
797  }
798 
799 
800  public:
801  typedef typename EIGENTOOLS_PARENT_CLASS_SHORTHAND::DecayedRawMatrix DecayedRawMatrix;
802 
803 
804  /**
805  * @brief this<LEFT_LOWER_TRIANGULAR> * BlockMatrix<DIAGONAL>
806  *
807  * @tparam t_Derived Eigen parameter
808  * @tparam t_DBMMatrixType raw diagonal block matrix type
809  * @tparam t_dbm_block_rows_num number of rows in a block of the diagonal matrix
810  * @tparam t_dbm_block_cols_num number of columns in a block of the diagonal matrix
811  *
812  * @param[out] result result of multiplication
813  * @param[in] dbm diagonal block matrix
814  */
815  template< class t_Derived,
816  typename t_DBMMatrixType,
817  int t_dbm_block_rows_num,
818  int t_dbm_block_cols_num>
819  void multiplyRight( Eigen::PlainObjectBase<t_Derived> &result,
820  const BlockMatrixBase< t_DBMMatrixType,
821  t_dbm_block_rows_num,
822  t_dbm_block_cols_num,
823  MatrixSparsityType::DIAGONAL> &dbm) const
824  {
825  EIGENTOOLS_ASSERT(dbm.getBlockRowsNum() == identity_size_,
826  "Block sizes do not match.");
827  EIGENTOOLS_ASSERT(num_blocks_hor_ == dbm.getNumberOfBlocksVertical(),
828  "Numbers of blocks do not match.");
829  EIGENTOOLS_ASSERT(num_blocks_hor_*identity_size_ == dbm.getNumberOfRows(),
830  "Sizes of matrices do not match.");
831 
832 
833 
835  t_dbm_block_rows_num,
836  t_dbm_block_cols_num,
837  MatrixSparsityType::NONE > result_bmi(result);
838 
839  result_bmi.setZero(num_blocks_vert_, dbm.getNumberOfBlocksHorizontal());
840 
841  if (num_blocks_hor_ != 0)
842  {
843  for (std::ptrdiff_t j = 0; j < dbm.getNumberOfBlocksHorizontal(); ++j)
844  {
845  for (std::ptrdiff_t i = j; i < num_blocks_vert_; ++i)
846  {
847  // dbm.getNumberOfBlocksHorizontal() = num_blocks_hor_
848  result_bmi(i,j) = EIGENTOOLS_PARENT_CLASS_SHORTHAND::operator()(i,j) * dbm(j);
849  }
850  }
851  }
852  }
853 
854 
855 
856  /**
857  * @brief BlockMatrix<DIAGONAL> * this<LEFT_LOWER_TRIANGULAR>
858  *
859  * @tparam t_Derived Eigen template parameter
860  * @tparam t_DBMMatrixType raw diagonal block matrix type
861  * @tparam t_dbm_block_rows_num number of rows in a block of the diagonal matrix
862  * @tparam t_dbm_block_cols_num number of columns in a block of the diagonal matrix
863  *
864  * @param[out] result result of multiplication
865  * @param[in] dbm diagonal block matrix
866  */
867  template< class t_Derived,
868  typename t_DBMMatrixType,
869  int t_dbm_block_rows_num,
870  int t_dbm_block_cols_num>
871  void multiplyLeft( Eigen::PlainObjectBase<t_Derived> &result,
872  const BlockMatrixBase< t_DBMMatrixType,
873  t_dbm_block_rows_num,
874  t_dbm_block_cols_num,
875  MatrixSparsityType::DIAGONAL> &dbm) const
876  {
877  EIGENTOOLS_ASSERT(dbm.getBlockRowsNum() == identity_size_,
878  "Block sizes do not match.");
879  EIGENTOOLS_ASSERT(num_blocks_hor_ == dbm.getNumberOfBlocksVertical(),
880  "Numbers of blocks do not match.");
881  EIGENTOOLS_ASSERT(num_blocks_hor_*identity_size_ == dbm.getNumberOfRows(),
882  "Sizes of matrices do not match.");
883 
884 
886  t_dbm_block_rows_num,
887  t_dbm_block_cols_num,
888  MatrixSparsityType::NONE > result_bmi(result);
889 
890  result_bmi.setZero(num_blocks_vert_, dbm.getNumberOfBlocksHorizontal());
891 
892  if (num_blocks_hor_ != 0)
893  {
894  for (std::ptrdiff_t j = 0; j < num_blocks_hor_; ++j)
895  {
896  for (std::ptrdiff_t i = j; i < dbm.getNumberOfBlocksVertical(); ++i)
897  {
898  result_bmi(i,j) = dbm(i) * EIGENTOOLS_PARENT_CLASS_SHORTHAND::operator()(i,j);
899  }
900  }
901  }
902  }
903 
904 
905 
906  /**
907  * @brief Conversion to Matrix
908  *
909  * @return Matrix
910  */
911  DecayedRawMatrix evaluate() const
912  {
913  DecayedRawMatrix output;
914  evaluate(output);
915  return(output);
916  }
917 
918 
919 
920  /**
921  * @brief Conversion to a matrix
922  *
923  * @tparam t_Derived Eigen template parameter
924  *
925  * @param[out] output matrix
926  */
927  template<class t_Derived>
928  void evaluate(Eigen::PlainObjectBase<t_Derived> & output) const
929  {
930  output.setZero(identity_size_ * matrix_.rows(),
931  identity_size_ * matrix_.cols());
932  evaluateWithoutInitialization(output);
933  }
934 
935 
936  /**
937  * @brief Conversion to a matrix
938  *
939  * @tparam t_Derived Eigen template parameter
940  * @tparam t_rows Eigen template parameter
941  * @tparam t_cols Eigen template parameter
942  * @tparam t_flag Eigen template parameter
943  *
944  * @param[out] output matrix block of appropriate size
945  */
946  template<class t_Derived, int t_rows, int t_cols, bool t_flag>
947  void evaluate(Eigen::Block<t_Derived, t_rows, t_cols, t_flag> output) const
948  {
949  output.setZero();
950  evaluateWithoutInitialization(output);
951  }
952 
953 
954  /**
955  * @brief Constructor
956  *
957  * @param[in] matrix
958  * @param[in] identity_size
959  * @param[in] block_rows_num number of rows in a block if t_block_rows_num = MatrixBlockSizeType::DYNAMIC
960  * @param[in] block_cols_num number of cols in a block if t_block_cols_num = MatrixBlockSizeType::DYNAMIC
961  */
962  BlockKroneckerProductBase( const DecayedRawMatrix & matrix,
963  const std::ptrdiff_t identity_size = 1,
964  const std::ptrdiff_t block_rows_num = MatrixBlockSizeType::UNDEFINED,
965  const std::ptrdiff_t block_cols_num = MatrixBlockSizeType::UNDEFINED) :
966  EIGENTOOLS_PARENT_CLASS_SHORTHAND(matrix, block_rows_num, block_cols_num)
967  {
968  EIGENTOOLS_ASSERT( identity_size > 1,
969  "Identity size cannot be less than 2.");
970  identity_size_ = identity_size;
971  }
972  };
973 #undef EIGENTOOLS_PARENT_CLASS_SHORTHAND
974 
975 
976  // ===========================================================================
977  // ===========================================================================
978  // ===========================================================================
979 
980 
981  /**
982  * @addtogroup BlockMatrixOperators
983  * @{
984  */
985 
986 
987  /**
988  * @brief BlockKroneckerProduct * Vector
989  *
990  * @tparam t_MatrixType type of raw matrix
991  * @tparam t_block_rows_num number of rows in one block
992  * @tparam t_block_cols_num number of columns in one block
993  * @tparam t_sparsity_type sparsity type
994  * @tparam t_Scalar vector type
995  * @tparam t_vector_size vector size
996  * @tparam t_vector_options vector options
997  *
998  * @param[in] bm block matrix
999  * @param[in] vector vector
1000  *
1001  * @return result of multiplication
1002  */
1003  template< class t_MatrixType,
1004  int t_block_rows_num,
1005  int t_block_cols_num,
1006  MatrixSparsityType::Type t_sparsity_type,
1007  typename t_Scalar,
1008  int t_vector_size,
1009  int t_vector_options >
1013  t_block_rows_num,
1014  t_block_cols_num,
1015  t_sparsity_type> & bm,
1016  const Eigen::Matrix<t_Scalar,
1017  t_vector_size,
1018  1,
1019  t_vector_options> & vector)
1020  {
1022  bm.multiplyRight(result, vector);
1023  return (result);
1024  }
1025 
1026 
1027  /**
1028  * @brief BlockKroneckerProduct * BlockMatrix
1029  *
1030  * @tparam t_right_MatrixType type of raw matrix
1031  * @tparam t_left_block_rows_num number of rows in one block
1032  * @tparam t_left_block_cols_num number of columns in one block
1033  * @tparam t_left_sparsity_type sparsity type
1034  * @tparam t_right_MatrixType type of raw matrix
1035  * @tparam t_right_block_rows_num number of rows in one block
1036  * @tparam t_right_block_cols_num number of columns in one block
1037  * @tparam t_right_sparsity_type sparsity type
1038  *
1039  * @param[in] left BlockKroneckerProduct
1040  * @param[in] right BlockMatrix
1041  *
1042  * @return result of multiplication
1043  */
1044  template< typename t_left_MatrixType,
1045  int t_left_block_rows_num,
1046  int t_left_block_cols_num,
1047  MatrixSparsityType::Type t_left_sparsity_type,
1048  typename t_right_MatrixType,
1049  int t_right_block_rows_num,
1050  int t_right_block_cols_num,
1051  MatrixSparsityType::Type t_right_sparsity_type>
1054  operator* ( const BlockKroneckerProductBase<t_left_MatrixType,
1055  t_left_block_rows_num,
1056  t_left_block_cols_num,
1057  t_left_sparsity_type> & left,
1058  const BlockMatrixBase< t_right_MatrixType,
1059  t_right_block_rows_num,
1060  t_right_block_cols_num,
1061  t_right_sparsity_type> & right)
1062  {
1064  left.multiplyRight(result, right);
1065  return (result);
1066  }
1067 
1068 
1069 
1070  /**
1071  * @anchor eigentools_bkp_by_bm
1072  * @brief BlockKroneckerProduct * BlockMatrix
1073  *
1074  * @tparam t_left_MatrixType type of raw matrix
1075  * @tparam t_left_block_rows_num number of rows in one block
1076  * @tparam t_left_block_cols_num number of columns in one block
1077  * @tparam t_left_sparsity_type sparsity type
1078  * @tparam t_right_MatrixType type of raw matrix
1079  * @tparam t_right_block_rows_num number of rows in one block
1080  * @tparam t_right_block_cols_num number of columns in one block
1081  * @tparam t_right_sparsity_type sparsity type
1082  *
1083  * @param[in] left BlockKroneckerProduct
1084  * @param[in] right BlockMatrix
1085  *
1086  * @return result of multiplication
1087  */
1088  template< typename t_left_MatrixType,
1089  int t_left_block_rows_num,
1090  int t_left_block_cols_num,
1091  MatrixSparsityType::Type t_left_sparsity_type,
1092  typename t_right_MatrixType,
1093  int t_right_block_rows_num,
1094  int t_right_block_cols_num,
1095  MatrixSparsityType::Type t_right_sparsity_type>
1098  operator* ( const BlockMatrixBase< t_left_MatrixType,
1099  t_left_block_rows_num,
1100  t_left_block_cols_num,
1101  t_left_sparsity_type> & left,
1102  const BlockKroneckerProductBase<t_right_MatrixType,
1103  t_right_block_rows_num,
1104  t_right_block_cols_num,
1105  t_right_sparsity_type> & right)
1106  {
1108  right.multiplyLeft(result, left);
1109  return (result);
1110  }
1111 
1112 
1113  // BlockMatrixOperators
1114  /**
1115  * @}
1116  */
1117 } // etools
void evaluate(Eigen::PlainObjectBase< t_Derived > &output) const
Conversion to a matrix.
Type modifier (drop reference and &#39;const&#39;)
BlockKroneckerProductBase(const DecayedRawMatrix &matrix, const std::ptrdiff_t identity_size=1, const std::ptrdiff_t block_rows_num=MatrixBlockSizeType::UNDEFINED, const std::ptrdiff_t block_cols_num=MatrixBlockSizeType::UNDEFINED)
Constructor.
#define EIGENTOOLS_BLOCKMATRIX_BLOCK_COLS_NUM
void evaluate(Eigen::Block< t_Derived, t_rows, t_cols, t_flag > output) const
Conversion to a matrix.
void multiplyRight(Eigen::PlainObjectBase< t_Derived > &result, const BlockMatrixBase< t_DBMMatrixType, t_dbm_block_rows_num, t_dbm_block_cols_num, MatrixSparsityType::DIAGONAL > &dbm) const
this * BlockMatrix<DIAGONAL>
BlockMatrixBase< const typename TypeWithoutConst< t_MatrixType >::Type, 1, 1, t_sparsity_type >::DecayedRawMatrix DecayedRawMatrix
BlockMatrixBase< const typename TypeWithoutConst< t_MatrixType >::Type, t_block_rows_num, t_block_cols_num, t_sparsity_type >::DecayedRawMatrix DecayedRawMatrix
EIGENTOOLS_VISIBILITY_ATTRIBUTE operator*(const BlockMatrixBase< t_MatrixType, t_block_rows_num, t_block_cols_num, t_sparsity_type > &bm, const Eigen::MatrixBase< t_Derived > &matrix)
&#39;BlockMatrixBase * Eigen::Matrix&#39; operator
void multiplyRight(Eigen::PlainObjectBase< t_Derived > &result, const BlockMatrixBase< t_DBMMatrixType, t_dbm_block_rows_num, t_dbm_block_cols_num, MatrixSparsityType::DIAGONAL > &dbm) const
this<LEFT_LOWER_TRIANGULAR> * BlockMatrix<DIAGONAL>
void evaluate(Eigen::PlainObjectBase< t_Derived > &output) const
Conversion to a matrix.
BlockMatrixBase< const typename TypeWithoutConst< t_MatrixType >::Type, t_block_rows_num, t_block_cols_num, MatrixSparsityType::LEFT_LOWER_TRIANGULAR >::DecayedRawMatrix DecayedRawMatrix
#define EIGENTOOLS_VISIBILITY_ATTRIBUTE
Definition: eigentools.h:21
Base class of a block matrix.
void multiplyRight(Eigen::PlainObjectBase< t_DerivedOutput > &result, const Eigen::Matrix< t_Scalar, t_vector_size, 1, t_vector_options > &vector) const
this * Vector
void evaluateWithoutInitialization(const Eigen::MatrixBase< t_Derived > &output) const
Conversion to a matrix.
#define EIGENTOOLS_PARENT_CLASS_SHORTHAND
#define EIGENTOOLS_DYNAMIC_VECTOR(Scalar)
Definition: eigentools.h:49
#define EIGENTOOLS_DYNAMIC_MATRIX(Scalar)
Definition: eigentools.h:46
#define EIGENTOOLS_ASSERT(condition, message)
Definition: eigentools.h:20
void multiplyRight(Eigen::PlainObjectBase< t_DerivedOutput > &result, const Eigen::Matrix< t_Scalar, t_vector_size, 1, t_vector_options > &vector) const
this * Vector
void multiplyLeft(Eigen::PlainObjectBase< t_Derived > &result, const BlockMatrixBase< t_DBMMatrixType, t_dbm_block_rows_num, t_dbm_block_cols_num, MatrixSparsityType::DIAGONAL > &dbm) const
BlockMatrix<DIAGONAL> * this<LEFT_LOWER_TRIANGULAR>
void evaluate(Eigen::Block< t_Derived, t_rows, t_cols, t_flag > output) const
Conversion to a matrix.
DecayedRawMatrix evaluate() const
Conversion to Matrix.
void evaluate(Eigen::Block< t_Derived, t_rows, t_cols, t_flag > output) const
Conversion to a matrix.
BlockKroneckerProductBase(const DecayedRawMatrix &matrix, const std::ptrdiff_t identity_size=1, const std::ptrdiff_t block_rows_num=MatrixBlockSizeType::UNDEFINED, const std::ptrdiff_t block_cols_num=MatrixBlockSizeType::UNDEFINED)
Constructor.
void multiplyRight(Eigen::PlainObjectBase< t_Derived > &result, const BlockMatrixBase< t_DBMMatrixType, t_dbm_block_rows_num, t_dbm_block_cols_num, MatrixSparsityType::DIAGONAL > &dbm) const
this<LEFT_LOWER_TRIANGULAR> * BlockMatrix<DIAGONAL>
BlockKroneckerProductBase(const DecayedRawMatrix &matrix, const std::ptrdiff_t identity_size=1, const std::ptrdiff_t block_rows_num=MatrixBlockSizeType::UNDEFINED, const std::ptrdiff_t block_cols_num=MatrixBlockSizeType::UNDEFINED)
Constructor.
This namespace contains various functions operating on Eigen matrices and vectors.
Definition: blockmatrix.h:19
void evaluate(Eigen::PlainObjectBase< t_Derived > &output) const
Conversion to a matrix.
Sparsity type of a matrix.
BlockKroneckerProductBase(const DecayedRawMatrix &matrix, const std::ptrdiff_t identity_size=1, const std::ptrdiff_t block_rows_num=MatrixBlockSizeType::UNDEFINED, const std::ptrdiff_t block_cols_num=MatrixBlockSizeType::UNDEFINED)
Constructor.
void evaluateWithoutInitialization(const Eigen::MatrixBase< t_Derived > &output) const
Conversion to a matrix.
void evaluate(Eigen::Block< t_Derived, t_rows, t_cols, t_flag > output) const
Conversion to a matrix.
#define EIGENTOOLS_BLOCKMATRIX_BLOCK_ROWS_NUM
BlockMatrixBase< const typename TypeWithoutConst< t_MatrixType >::Type, 1, 1, MatrixSparsityType::LEFT_LOWER_TRIANGULAR >::DecayedRawMatrix DecayedRawMatrix
void evaluateWithoutInitialization(const Eigen::MatrixBase< t_Derived > &output) const
Conversion to a matrix.
void multiplyRight(Eigen::PlainObjectBase< t_Derived > &result, const BlockMatrixBase< t_DBMMatrixType, t_dbm_block_rows_num, t_dbm_block_cols_num, MatrixSparsityType::DIAGONAL > &dbm) const
this * BlockMatrix<DIAGONAL>
Represents block kronecker product "Identity(size) [X] Matrix".