23 #ifndef PLLL_INCLUDE_GUARD__MATRIX_OPS_HPP
24 #define PLLL_INCLUDE_GUARD__MATRIX_OPS_HPP
44 namespace implementation
48 template<
template<
typename DataType>
class Operator,
typename Data>
49 class expr :
private Operator<Data>
55 inline expr(
const Data & data)
56 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Data(data)))
59 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::expr(" << getAddress(*
this) <<
"; " << getAddress(data) <<
")");
62 inline expr(
const Operator<Data> & op,
const Data & data)
63 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Operator<Data>(op)) && noexcept(Data(data)))
64 : Operator<Data>(op), d_data(data)
66 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::expr(" << getAddress(*
this) <<
"; " << getAddress(op) <<
"; " << getAddress(data) <<
")");
76 enum { has_direct_access = Operator<Data>::has_direct_access };
78 typedef typename Operator<Data>::CoeffType CoeffType;
79 typedef typename Operator<Data>::CoeffType_Get CoeffType_Get;
80 typedef typename Operator<Data>::GetCoeffSteps_Type GetCoeffSteps_Type;
81 typedef typename Operator<Data>::ValueType ValueType;
85 typedef typename Operator<Data>::data_pointer_type data_pointer_type;
86 typedef typename Operator<Data>::data_ref_type data_ref_type;
88 template<
typename ResultType>
92 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::get_coeff(" << getAddress(*
this) <<
"; " << getAddress(result) <<
" " << i <<
" " << j <<
") const");
94 Operator<Data>::get_coeff(result, i, j, d_data);
97 inline bool get_coeff_alwayszero()
const
100 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::get_coeff_alwayszero(" << getAddress(*
this) <<
")");
102 return Operator<Data>::get_coeff_alwayszero(d_data);
108 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::get_coeff_steps(" << getAddress(*
this) <<
")");
110 return Operator<Data>::get_coeff_steps(i, j, d_data);
116 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::operator () (" << getAddress(*
this) <<
"; " << i <<
" " << j <<
")");
118 return Operator<Data>::operator()(i, j, d_data);
121 inline CoeffType_Get operator [] (
size_type i)
const
126 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::operator [] (" << getAddress(*
this) <<
"; " << i <<
")");
133 inline data_pointer_type data()
const
136 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::data(" << getAddress(*
this) <<
") const");
137 return Operator<Data>::data(d_data);
140 inline data_ref_type data(
size_type i)
const
143 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::data(" << getAddress(*
this) <<
"; " << i <<
")");
144 return Operator<Data>::data(d_data, i);
147 inline size_type rows()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
149 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::rows(" << getAddress(*
this) <<
")");
150 return Operator<Data>::rows(d_data);
153 inline size_type cols()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
155 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::cols(" << getAddress(*
this) <<
")");
156 return Operator<Data>::cols(d_data);
159 inline size_type size()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
161 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::size(" << getAddress(*
this) <<
")");
162 return Operator<Data>::size(d_data);
165 template<
unsigned SRows,
unsigned SCols>
169 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::block<" << SRows <<
" " << SCols <<
">(" << getAddress(*
this) <<
"; " << r_ofs <<
" " << c_ofs <<
") const");
177 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::block(" << getAddress(*
this) <<
"; " << r_ofs <<
" " << c_ofs <<
" " << rows <<
" " << cols <<
")");
185 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::row(" << getAddress(*
this) <<
"; " << row_index <<
") const");
193 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::col(" << getAddress(*
this) <<
"; " << col_index <<
") const");
200 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::transpose(" << getAddress(*
this) <<
") const");
204 inline ValueType evaluate()
const
207 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::evaluate(" << getAddress(*
this) <<
")");
208 return ValueType(*
this);
211 inline LazyEvalType lazy_evaluate()
const
214 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::lazy_evaluate(" << getAddress(*
this) <<
")");
215 return LazyEvalType(*
this);
218 template<
typename MatrixType>
219 inline bool involves_this_matrix(
const MatrixType & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
221 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::involves_this_matrix(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
222 return Operator<Data>::involves_this_matrix(A, d_data);
225 template<
typename MatrixType>
226 inline bool test_involvement(
const MatrixType & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
228 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::test_involvement(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
229 return Operator<Data>::test_involvement(A, d_data);
232 template<
typename T,
int R,
int C,
typename ST,
bool MO>
235 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::operator = (" << getAddress(*
this) <<
"; " << getAddress(m) <<
")");
241 template<
template<
typename>
class Op_,
typename Data_>
244 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::operator = (" << getAddress(*
this) <<
"; " << getAddress(m) <<
")");
250 #if __cplusplus >= 201103L
251 template<
typename T,
int R,
int C,
typename ST,
bool MO>
254 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::operator = (" << getAddress(*
this) <<
"; " << getAddress(m) <<
") [&&]");
256 assign(*
this, std::move(m));
260 template<
template<
typename>
class Op_,
typename Data_>
263 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::operator = (" << getAddress(*
this) <<
"; " << getAddress(m) <<
") [&&]");
265 assign(*
this, std::move(m));
270 template<
typename MatrixType>
271 void assign_resize(
const MatrixType & mat)
const
273 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::assign_resize(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
")");
277 Operator<Data>::assign_resize(mat, d_data);
280 #if __cplusplus >= 201103L
281 template<
typename MatrixType>
282 void move_resize(MatrixType && mat)
const
284 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::move_resize(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
")");
289 Operator<Data>::move_resize(std::move(mat), d_data);
292 template<
typename MatrixType>
293 void move_resize(
const MatrixType & mat)
const
295 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::expr::move_resize(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
")");
300 Operator<Data>::move_resize(mat, d_data);
304 typedef typename Operator<Data>::Enumerator Enumerator;
305 typedef typename Operator<Data>::RowEnumerator RowEnumerator;
306 typedef typename Operator<Data>::ColEnumerator ColEnumerator;
307 typedef typename Operator<Data>::ConstEnumerator ConstEnumerator;
308 typedef typename Operator<Data>::ConstRowEnumerator ConstRowEnumerator;
309 typedef typename Operator<Data>::ConstColEnumerator ConstColEnumerator;
310 typedef typename Operator<Data>::DefaultEnumerator DefaultEnumerator;
311 typedef typename Operator<Data>::DefaultRowEnumerator DefaultRowEnumerator;
312 typedef typename Operator<Data>::DefaultColEnumerator DefaultColEnumerator;
314 inline DefaultEnumerator enumerate()
const
317 return Operator<Data>::enumerate(d_data);
320 inline DefaultRowEnumerator enumerate_row(
size_type row)
const
323 return Operator<Data>::enumerate_row(row, d_data);
326 inline DefaultColEnumerator enumerate_col(
size_type col)
const
329 return Operator<Data>::enumerate_col(col, d_data);
332 typedef typename Operator<Data>::RowsEnumerator RowsEnumerator;
333 typedef typename Operator<Data>::ColsEnumerator ColsEnumerator;
334 typedef typename Operator<Data>::ConstRowsEnumerator ConstRowsEnumerator;
335 typedef typename Operator<Data>::ConstColsEnumerator ConstColsEnumerator;
336 typedef typename Operator<Data>::DefaultRowsEnumerator DefaultRowsEnumerator;
337 typedef typename Operator<Data>::DefaultColsEnumerator DefaultColsEnumerator;
339 inline DefaultRowsEnumerator enumerate_rows()
const
342 return Operator<Data>::enumerate_rows(d_data);
345 inline DefaultColsEnumerator enumerate_cols()
const
348 return Operator<Data>::enumerate_cols(d_data);
352 template<
typename Data>
356 typedef typename Data::CoeffType CoeffType;
357 typedef typename Data::CoeffType_Get CoeffType_Get;
358 typedef typename Data::GetCoeffSteps_Type GetCoeffSteps_Type;
359 typedef typename Data::ValueType ValueType;
360 typedef typename Data::data_pointer_type data_pointer_type;
361 typedef typename Data::data_ref_type data_ref_type;
370 has_direct_access = Data::has_direct_access };
372 template<
typename ResultType>
373 static inline void get_coeff(ResultType & result,
size_type i,
size_type j,
const Data & D)
374 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(D.get_coeff(result, i, j)))
376 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::identity_operation::get_coeff(" << getAddress(*
this) <<
"; " << getAddress(result) <<
" " << i <<
" " << j <<
" " << getAddress(D) <<
")");
377 D.get_coeff(result, i, j);
380 static inline bool get_coeff_alwayszero(
const Data & D)
381 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(D.get_coeff_alwayszero()))
383 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::identity_operation::get_coeff_alwayszero(" << getAddress(*
this) <<
"; " << getAddress(D) <<
")");
384 return D.get_coeff_alwayszero();
387 static inline GetCoeffSteps_Type get_coeff_steps(
size_type i,
size_type j,
const Data & D)
388 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(D.get_coeff_steps(i, j)))
390 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::identity_operation::get_coeff_steps(" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(D) <<
")");
391 return D.get_coeff_steps(i, j);
395 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(D(i, j)))
397 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::identity_operation::operator () (" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(D) <<
")");
401 static inline data_pointer_type data(
const Data & D)
402 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(D.data()))
404 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::identity_operation::data(" << getAddress(*
this) <<
";" << getAddress(D) <<
") const");
408 static inline data_ref_type data(
const Data & D,
size_type i)
409 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(D.data(i)))
411 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::identity_operation::data(" << getAddress(*
this) <<
"; " << getAddress(D) <<
" " << i <<
")");
415 static inline size_type rows(
const Data & D) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
417 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::identity_operation::rows(" << getAddress(*
this) <<
"; " << getAddress(D) <<
")");
421 static inline size_type cols(
const Data & D) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
423 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::identity_operation::cols(" << getAddress(*
this) <<
"; " << getAddress(D) <<
")");
427 static inline size_type size(
const Data & D) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
429 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::identity_operation::size(" << getAddress(*
this) <<
"; " << getAddress(D) <<
")");
433 template<
typename MatrixType>
434 static inline bool involves_this_matrix(
const MatrixType & matrix,
const Data & D) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
436 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::identity_operation::involves_this_matrix(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(D) <<
")");
437 return D.involves_this_matrix(matrix);
440 template<
typename MatrixType>
441 static inline bool test_involvement(
const MatrixType & matrix,
const Data & D) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
443 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::identity_operation::test_involvement(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(D) <<
")");
444 return D.test_involvement(matrix);
447 template<
typename MatrixType>
448 static void assign_resize(
const MatrixType & mat,
const Data & D)
450 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::identity_operation::assign_resize(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
" " << getAddress(D) <<
")");
451 D.assign_resize(mat);
454 #if __cplusplus >= 201103L
455 template<
typename MatrixType>
456 static void move_resize(MatrixType && mat,
const Data & D)
458 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::identity_operation::move_resize(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
" " << getAddress(D) <<
")");
459 D.move_resize(std::move(mat));
462 template<
typename MatrixType>
463 static void move_resize(
const MatrixType & mat,
const Data & D)
465 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::identity_operation::move_resize(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
" " << getAddress(D) <<
")");
470 typedef typename Data::Enumerator Enumerator;
471 typedef typename Data::RowEnumerator RowEnumerator;
472 typedef typename Data::ColEnumerator ColEnumerator;
473 typedef typename Data::ConstEnumerator ConstEnumerator;
474 typedef typename Data::ConstRowEnumerator ConstRowEnumerator;
475 typedef typename Data::ConstColEnumerator ConstColEnumerator;
476 typedef typename Data::DefaultEnumerator DefaultEnumerator;
477 typedef typename Data::DefaultRowEnumerator DefaultRowEnumerator;
478 typedef typename Data::DefaultColEnumerator DefaultColEnumerator;
480 static inline DefaultEnumerator enumerate(
const Data & data)
481 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(data.enumerate()))
483 return data.enumerate();
486 static inline DefaultRowEnumerator enumerate_row(
size_type row,
const Data & data)
487 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(data.enumerate_row(row)))
489 return data.enumerate_row(row);
492 static inline DefaultColEnumerator enumerate_col(
size_type col,
const Data & data)
493 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(data.enumerate_col(col)))
495 return data.enumerate_col(col);
498 typedef typename Data::RowsEnumerator RowsEnumerator;
499 typedef typename Data::ColsEnumerator ColsEnumerator;
500 typedef typename Data::ConstRowsEnumerator ConstRowsEnumerator;
501 typedef typename Data::ConstColsEnumerator ConstColsEnumerator;
502 typedef typename Data::DefaultRowsEnumerator DefaultRowsEnumerator;
503 typedef typename Data::DefaultColsEnumerator DefaultColsEnumerator;
505 static inline DefaultRowsEnumerator enumerate_rows(
const Data & data)
506 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(data.enumerate_rows()))
508 return data.enumerate_rows();
511 static inline DefaultColsEnumerator enumerate_cols(
const Data & data)
512 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(data.enumerate_cols()))
514 return data.enumerate_cols();
518 template<
typename MatrixType>
522 MatrixType & d_matrix;
525 enum { has_direct_access = MatrixType::has_direct_access };
527 typedef typename MatrixInfo<MatrixType>::Type CoeffType;
528 typedef typename MatrixInfo<MatrixType>::Type & CoeffType_Get;
529 typedef typename MatrixType::GetCoeffSteps_Type GetCoeffSteps_Type;
530 typedef MatrixType ValueType;
531 typedef MatrixType & LazyEvalType;
535 template<
typename ResultType>
537 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.get_coeff(result, i, j)))
539 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::get_coeff(" << getAddress(*
this) <<
"; " << getAddress(result) <<
" " << i <<
" " << j <<
") const");
540 d_matrix.get_coeff(result, i, j);
543 static inline bool get_coeff_alwayszero() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
545 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::get_coeff_alwayszero(" << getAddress(*
this) <<
")");
550 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.get_coeff_steps(i, j)))
552 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::get_zero_steps(" << getAddress(*
this) <<
"; " << i <<
" " << j <<
")");
553 return d_matrix.get_coeff_steps(i, j);
557 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix(i, j)))
559 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::operator () (" << getAddress(*
this) <<
"; " << i <<
" " << j <<
")");
560 return d_matrix(i, j);
563 inline CoeffType_Get operator [] (
size_type i)
const
564 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix[i]))
566 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::operator [] (" << getAddress(*
this) <<
"; " << i <<
")");
570 inline size_type rows()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
572 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::rows(" << getAddress(*
this) <<
")");
573 return d_matrix.rows();
576 inline size_type cols()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
578 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::cols(" << getAddress(*
this) <<
")");
579 return d_matrix.cols();
582 inline size_type size()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
584 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::size(" << getAddress(*
this) <<
")");
585 return d_matrix.size();
588 inline data_pointer_type data()
const
589 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.data()))
591 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::data(" << getAddress(*
this) <<
") const");
592 return d_matrix.data();
595 inline data_ref_type data(
size_type i)
const
596 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.data(i)))
598 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::data(" << getAddress(*
this) <<
"; " << i <<
")");
599 return d_matrix.data(i);
602 inline MatrixWrapper(MatrixType & matrix) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
605 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::MatrixWrapper(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
")");
608 inline MatrixType & evaluate()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
610 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::evaluate(" << getAddress(*
this) <<
")");
614 inline LazyEvalType lazy_evaluate()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
616 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::lazy_evaluate(" << getAddress(*
this) <<
")");
620 template<
typename QMatrixType>
621 inline bool involves_this_matrix(
const QMatrixType & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
623 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::involves_this_matrix(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
624 return d_matrix.involves_this_matrix(A);
627 template<
typename MatrixType_>
628 inline bool test_involvement(
const MatrixType_ & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
630 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::test_involvement(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
631 return d_matrix.test_involvement(A);
634 template<
typename MatrixType_>
635 void assign_resize(
const MatrixType_ & mat)
const
637 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::assign_resize(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
")");
638 d_matrix.assign_resize(mat);
641 #if __cplusplus >= 201103L
642 template<
typename MatrixType_>
643 void move_resize(MatrixType_ && mat)
const
645 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::move_resize(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
")");
646 d_matrix.move_resize(std::move(mat));
649 template<
typename MatrixType_>
650 void move_resize(
const MatrixType_ & mat)
const
652 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixWrapper::move_resize(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
")");
653 d_matrix.move_resize(mat);
657 typedef typename MatrixType::Enumerator Enumerator;
658 typedef typename MatrixType::Enumerator DefaultEnumerator;
659 typedef typename MatrixType::ConstEnumerator ConstEnumerator;
660 typedef typename MatrixType::RowEnumerator RowEnumerator;
661 typedef typename MatrixType::RowEnumerator DefaultRowEnumerator;
662 typedef typename MatrixType::ConstRowEnumerator ConstRowEnumerator;
663 typedef typename MatrixType::ColEnumerator ColEnumerator;
664 typedef typename MatrixType::ColEnumerator DefaultColEnumerator;
665 typedef typename MatrixType::ConstColEnumerator ConstColEnumerator;
667 inline DefaultEnumerator enumerate()
const
668 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.enumerate()))
670 return d_matrix.enumerate();
673 inline DefaultRowEnumerator enumerate_row(
size_type row)
const
674 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.enumerate_row(row)))
676 return d_matrix.enumerate_row(row);
679 inline DefaultColEnumerator enumerate_col(
size_type col)
const
680 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.enumerate_col(col)))
682 return d_matrix.enumerate_col(col);
685 typedef typename MatrixType::RowsEnumerator RowsEnumerator;
686 typedef typename MatrixType::ColsEnumerator ColsEnumerator;
687 typedef typename MatrixType::RowsEnumerator DefaultRowsEnumerator;
688 typedef typename MatrixType::ColsEnumerator DefaultColsEnumerator;
689 typedef typename MatrixType::ConstRowsEnumerator ConstRowsEnumerator;
690 typedef typename MatrixType::ConstColsEnumerator ConstColsEnumerator;
692 inline DefaultRowsEnumerator enumerate_rows()
const
693 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.enumerate_rows()))
695 return d_matrix.enumerate_rows();
698 inline DefaultColsEnumerator enumerate_cols()
const
699 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.enumerate_cols()))
701 return d_matrix.enumerate_cols();
705 template<
typename MatrixType>
709 const MatrixType & d_matrix;
712 enum { has_direct_access = MatrixType::has_direct_access };
714 typedef typename MatrixInfo<MatrixType>::Type CoeffType;
715 typedef const typename MatrixInfo<MatrixType>::Type & CoeffType_Get;
716 typedef typename MatrixType::GetCoeffSteps_Type GetCoeffSteps_Type;
717 typedef MatrixType ValueType;
718 typedef MatrixType & LazyEvalType;
722 template<
typename ResultType>
724 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.get_coeff(result, i, j)))
726 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ConstMatrixWrapper::get_coeff(" << getAddress(*
this) <<
"; " << getAddress(result) <<
" " << i <<
" " << j <<
") const");
727 d_matrix.get_coeff(result, i, j);
730 static inline bool get_coeff_alwayszero() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
732 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ConstMatrixWrapper::get_coeff_alwayszero(" << getAddress(*
this) <<
")");
737 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.get_coeff_steps(i, j)))
739 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ConstMatrixWrapper::get_zero_steps(" << getAddress(*
this) <<
"; " << i <<
" " << j <<
")");
740 return d_matrix.get_coeff_steps(i, j);
744 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix(i, j)))
746 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ConstMatrixWrapper::operator () (" << getAddress(*
this) <<
"; " << i <<
" " << j <<
")");
747 return d_matrix(i, j);
750 inline CoeffType_Get operator [] (
size_type i)
const
751 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix[i]))
753 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ConstMatrixWrapper::operator [] (" << getAddress(*
this) <<
"; " << i <<
")");
757 inline size_type rows()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
759 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ConstMatrixWrapper::rows(" << getAddress(*
this) <<
")");
760 return d_matrix.rows();
763 inline size_type cols()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
765 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ConstMatrixWrapper::cols(" << getAddress(*
this) <<
")");
766 return d_matrix.cols();
769 inline size_type size()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
771 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ConstMatrixWrapper::size(" << getAddress(*
this) <<
")");
772 return d_matrix.size();
775 inline data_pointer_type data()
const
776 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.data()))
778 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ConstMatrixWrapper::data(" << getAddress(*
this) <<
") const");
779 return d_matrix.data();
782 inline data_ref_type data(
size_type i)
const
783 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.data(i)))
785 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ConstMatrixWrapper::data(" << getAddress(*
this) <<
"; " << i <<
") const");
786 return d_matrix.data(i);
789 inline ConstMatrixWrapper(
const MatrixType & matrix) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
792 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ConstMatrixWrapper::ConstMatrixWrapper(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
")");
795 inline const MatrixType & evaluate()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
797 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ConstMatrixWrapper::evaluate(" << getAddress(*
this) <<
")");
801 inline LazyEvalType lazy_evaluate()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
803 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ConstMatrixWrapper::lazy_evaluate(" << getAddress(*
this) <<
")");
807 template<
typename QMatrixType>
808 inline bool involves_this_matrix(
const QMatrixType & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
810 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ConstMatrixWrapper::involves_this_matrix(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
811 return d_matrix.involves_this_matrix(A);
814 template<
typename MatrixType_>
815 inline bool test_involvement(
const MatrixType_ & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
817 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ConstMatrixWrapper::test_involvement(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
818 return d_matrix.test_involvement(A);
821 typedef void Enumerator;
822 typedef void RowEnumerator;
823 typedef void ColEnumerator;
824 typedef typename MatrixType::ConstEnumerator ConstEnumerator;
825 typedef typename MatrixType::ConstRowEnumerator ConstRowEnumerator;
826 typedef typename MatrixType::ConstColEnumerator ConstColEnumerator;
827 typedef typename MatrixType::ConstEnumerator DefaultEnumerator;
828 typedef typename MatrixType::ConstRowEnumerator DefaultRowEnumerator;
829 typedef typename MatrixType::ConstColEnumerator DefaultColEnumerator;
831 inline DefaultEnumerator enumerate()
const
832 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.enumerate()))
834 return d_matrix.enumerate();
837 inline DefaultRowEnumerator enumerate_row(
size_type row)
const
838 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.enumerate_row(row)))
840 return d_matrix.enumerate_row(row);
843 inline DefaultColEnumerator enumerate_col(
size_type col)
const
844 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.enumerate_col(col)))
846 return d_matrix.enumerate_col(col);
849 typedef void RowsEnumerator;
850 typedef void ColsEnumerator;
851 typedef typename MatrixType::ConstRowsEnumerator ConstRowsEnumerator;
852 typedef typename MatrixType::ConstColsEnumerator ConstColsEnumerator;
853 typedef typename MatrixType::ConstRowsEnumerator DefaultRowsEnumerator;
854 typedef typename MatrixType::ConstColsEnumerator DefaultColsEnumerator;
856 inline DefaultRowsEnumerator enumerate_rows()
const
857 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.enumerate_rows()))
859 return d_matrix.enumerate_rows();
862 inline DefaultColsEnumerator enumerate_cols()
const
863 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix.enumerate_cols()))
865 return d_matrix.enumerate_cols();
869 template<
typename MatrixType>
871 make_matrix_wrapper(MatrixType & matrix) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
873 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::make_matrix_wrapper(" << getAddress(matrix) <<
") [1]");
877 template<
typename MatrixType>
878 inline ConstMatrixWrapper<MatrixType>
879 make_matrix_wrapper(
const MatrixType & matrix) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
881 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::make_matrix_wrapper(" << getAddress(matrix) <<
") [2]");
882 return ConstMatrixWrapper<MatrixType>(matrix);
885 template<
typename MatrixType>
886 inline expr<identity_operation, MatrixWrapper<MatrixType> >
887 make_matrix_expression(MatrixType & matrix) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
889 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::make_matrix_expression(" << getAddress(matrix) <<
") [1]");
890 return expr<identity_operation, MatrixWrapper<MatrixType> >(MatrixWrapper<MatrixType>(matrix));
893 template<
typename MatrixType>
894 inline expr<identity_operation, ConstMatrixWrapper<MatrixType> >
895 make_matrix_expression(
const MatrixType & matrix) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
897 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::make_matrix_expression(" << getAddress(matrix) <<
") [2]");
898 return expr<identity_operation, ConstMatrixWrapper<MatrixType> >(ConstMatrixWrapper<MatrixType>(matrix));
901 template<
typename MatrixType>
905 #if __cplusplus >= 201103L
906 mutable std::unique_ptr<MatrixType> d_matrix;
908 mutable std::auto_ptr<MatrixType> d_matrix;
912 enum { has_direct_access = MatrixType::has_direct_access };
914 typedef typename MatrixInfo<MatrixType>::Type CoeffType;
915 #if __cplusplus >= 201103L
916 typedef typename MatrixInfo<MatrixType>::Type && CoeffType_Get;
919 typedef typename MatrixInfo<MatrixType>::Type & CoeffType_Get;
921 typedef typename MatrixType::GetCoeffSteps_Type GetCoeffSteps_Type;
922 typedef MatrixType ValueType;
923 typedef const MatrixType & LazyEvalType;
927 template<
typename ResultType>
929 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix->get_coeff(result, i, j)))
931 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::get_coeff(" << getAddress(*
this) <<
"; " << getAddress(result) <<
" " << i <<
" " << j <<
") const");
932 d_matrix->get_coeff(result, i, j);
935 static inline bool get_coeff_alwayszero() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
937 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::get_coeff_alwayszero(" << getAddress(*
this) <<
")");
942 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix->get_coeff_steps(i, j)))
944 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::get_zero_steps(" << getAddress(*
this) <<
"; " << i <<
" " << j <<
")");
945 return d_matrix->get_coeff_steps(i, j);
949 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept((*d_matrix)(i, j)))
951 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::operator () (" << getAddress(*
this) <<
"; " << i <<
" " << j <<
")");
952 #if __cplusplus >= 201103L
953 return std::move((*d_matrix)(i, j));
955 return (*d_matrix)(i, j);
959 inline CoeffType_Get operator [] (
size_type i)
const
960 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept((*d_matrix)[i]))
962 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::operator [] (" << getAddress(*
this) <<
"; " << i <<
")");
963 #if __cplusplus >= 201103L
964 return std::move((*d_matrix)[i]);
966 return (*d_matrix)[i];
970 inline size_type rows()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
972 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::rows(" << getAddress(*
this) <<
")");
973 return d_matrix->rows();
976 inline size_type cols()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
978 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::cols(" << getAddress(*
this) <<
")");
979 return d_matrix->cols();
982 inline size_type size()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
984 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::size(" << getAddress(*
this) <<
")");
985 return d_matrix->size();
988 inline data_pointer_type data()
const
989 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix->data()))
991 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::data(" << getAddress(*
this) <<
") const");
992 return d_matrix->data();
995 inline data_ref_type data(
size_type i)
const
996 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix->data(i)))
998 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::data(" << getAddress(*
this) <<
"; " << i <<
") const");
999 return d_matrix->data(i);
1002 template<
typename MatrixType_>
1004 : d_matrix(
new MatrixType(matrix))
1006 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::MatrixTemporaryWrapper(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
") [1]");
1009 #if __cplusplus >= 201103L
1011 : d_matrix(std::move(mtw.d_matrix))
1013 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::MatrixTemporaryWrapper(" << getAddress(*
this) <<
"; " << getAddress(mtw) <<
") [2]");
1017 : d_matrix(std::move(mtw.d_matrix))
1019 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::MatrixTemporaryWrapper(" << getAddress(*
this) <<
"; " << getAddress(mtw) <<
") [3&&]");
1022 template<
typename MatrixType_>
1024 : d_matrix(
new MatrixType(std::move(matrix)))
1026 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::MatrixTemporaryWrapper(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
") [4&&]");
1030 : d_matrix(mtw.d_matrix)
1032 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::MatrixTemporaryWrapper(" << getAddress(*
this) <<
"; " << getAddress(mtw) <<
") [2]");
1036 #if __cplusplus >= 201103L
1037 inline MatrixType && evaluate()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1039 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::evaluate(" << getAddress(*
this) <<
")");
1040 return std::move(*d_matrix);
1043 inline const MatrixType & evaluate()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1045 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::evaluate(" << getAddress(*
this) <<
")");
1050 inline LazyEvalType lazy_evaluate()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1052 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::lazy_evaluate(" << getAddress(*
this) <<
")");
1056 template<
typename QMatrixType>
1057 static inline bool involves_this_matrix(
const QMatrixType & A) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1059 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::involves_this_matrix(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
1063 template<
typename MatrixType_>
1064 static inline bool test_involvement(
const MatrixType_ & A) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1066 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::MatrixTemporaryWrapper::test_involvement(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
1070 typedef void Enumerator;
1071 typedef void RowEnumerator;
1072 typedef void ColEnumerator;
1073 typedef typename MatrixType::ConstEnumerator ConstEnumerator;
1074 typedef typename MatrixType::ConstRowEnumerator ConstRowEnumerator;
1075 typedef typename MatrixType::ConstColEnumerator ConstColEnumerator;
1076 typedef typename MatrixType::ConstEnumerator DefaultEnumerator;
1077 typedef typename MatrixType::ConstRowEnumerator DefaultRowEnumerator;
1078 typedef typename MatrixType::ConstColEnumerator DefaultColEnumerator;
1080 inline DefaultEnumerator enumerate()
const
1081 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix->enumerate()))
1083 return d_matrix->enumerate();
1086 inline DefaultRowEnumerator enumerate_row(
size_type row)
const
1087 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix->enumerate_row(row)))
1089 return d_matrix->enumerate_row(row);
1092 inline DefaultColEnumerator enumerate_col(
size_type col)
const
1093 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix->enumerate_col(col)))
1095 return d_matrix->enumerate_col(col);
1098 typedef void RowsEnumerator;
1099 typedef void ColsEnumerator;
1100 typedef typename MatrixType::ConstRowsEnumerator ConstRowsEnumerator;
1101 typedef typename MatrixType::ConstColsEnumerator ConstColsEnumerator;
1102 typedef typename MatrixType::ConstRowsEnumerator DefaultRowsEnumerator;
1103 typedef typename MatrixType::ConstColsEnumerator DefaultColsEnumerator;
1105 inline DefaultRowsEnumerator enumerate_rows()
const
1106 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix->enumerate_rows()))
1108 return d_matrix->enumerate_rows();
1111 inline DefaultColsEnumerator enumerate_cols()
const
1112 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_matrix->enumerate_cols()))
1114 return d_matrix->enumerate_cols();
1118 template<
template<
typename>
class Op,
typename Data>
1122 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::make_matrix_temporary_expression(" << getAddress(matrix) <<
") [1]");
1127 template<
typename MatrixType>
1128 inline expr<identity_operation, MatrixTemporaryWrapper<MatrixType> >
1129 make_matrix_temporary_expression(MatrixType & matrix)
1131 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::make_matrix_temporary_expression(" << getAddress(matrix) <<
") [2]");
1132 return expr<identity_operation, MatrixTemporaryWrapper<MatrixType> >(MatrixTemporaryWrapper<MatrixType>(matrix));
1135 template<
typename ScalarType>
1139 const ScalarType & d_scalar;
1142 typedef ScalarType ValueType;
1143 typedef const ScalarType & LazyEvalType;
1145 inline ScalarWrapper(
const ScalarType & scalar) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1148 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ScalarWrapper::ScalarWrapper(" << getAddress(*
this) <<
"; " << getAddress(scalar) <<
")");
1151 inline const ScalarType & evaluate()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1153 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ScalarWrapper::evaluate(" << getAddress(*
this) <<
")");
1157 inline LazyEvalType lazy_evaluate()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1159 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ScalarWrapper::lazy_evaluate(" << getAddress(*
this) <<
")");
1163 template<
typename MatrixType>
1164 static inline bool involves_this_matrix(
const MatrixType & A) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1166 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ScalarWrapper::involves_this_matrix(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
1170 template<
typename MatrixType>
1171 static inline bool test_involvement(
const MatrixType & A) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1173 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::ScalarWrapper::test_involvement(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
1178 template<
typename ScalarType>
1181 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::make_scalar_wrapper(" << getAddress(scalar) <<
")");
1185 template<
typename PairMatrices>
1189 typedef typename PairMatrices::first_type MTA;
1190 typedef typename PairMatrices::second_type MTB;
1198 typedef CoeffType CoeffType_Get;
1202 typename MatrixInfo<MTA>::StorageTraits,
1204 typedef void data_pointer_type;
1205 typedef void data_ref_type;
1207 enum { use_temporary_on_evaluate =
true,
1208 coeffs_are_simple_expressions =
false,
1210 can_assign_to =
false,
1211 can_move_from =
false,
1212 can_resize_rows =
false,
1213 can_resize_cols =
false,
1214 has_direct_access =
false };
1224 template<
typename ResultType>
1225 static inline void get_coeff(ResultType & result,
size_type i,
size_type j,
const std::pair<MTA, MTB> & AB)
1226 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
setZero(result)) &&
1227 noexcept(CoeffType()) &&
1229 (noexcept(AB.first.enumerate_row(i)) && noexcept(AB.second.enumerate_col(j)) &&
1230 noexcept(helper::make_type_lvalue<typename MTA::ConstRowEnumerator>().next()) &&
1231 noexcept(helper::make_type_lvalue<typename MTB::ConstColEnumerator>().next()) &&
1232 noexcept(result = helper::make_type_lvalue<typename MTA::ConstRowEnumerator>().current() * helper::make_type_lvalue<typename MTB::ConstColEnumerator>().current()) &&
1233 noexcept(result += helper::make_type_lvalue<typename MTA::ConstRowEnumerator>().current() * helper::make_type_lvalue<typename MTB::ConstColEnumerator>().current())) :
true))
1235 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_matrix_multiplication::get_coeff(" << getAddress(*
this) <<
"; " << getAddress(result) <<
" " << i <<
" " << j <<
" " << getAddress(AB) <<
") const");
1236 assert(i < rows(AB));
1237 assert(j < cols(AB));
1243 typename MTA::ConstRowEnumerator eA = AB.first.enumerate_row(i);
1244 typename MTB::ConstColEnumerator eB = AB.second.enumerate_col(j);
1245 result = eA.current() * eB.current();
1246 for (eA.next(), eB.next(); eA.has_current(); eA.next(), eB.next())
1247 result += eA.current() * eB.current();
1251 static inline bool get_coeff_alwayszero(
const std::pair<MTA, MTB> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1253 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_matrix_multiplication::get_coeff_alwayszero(" << getAddress(*
this) <<
"; " << getAddress(AB) <<
")");
1260 mutable typename MTA::ConstRowEnumerator d_eA;
1261 mutable typename MTB::ConstColEnumerator d_eB;
1264 inline GetCoeffSteps_Type(
typename MTA::ConstRowEnumerator eA,
typename MTB::ConstColEnumerator eB)
1265 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
typename MTA::ConstRowEnumerator(eA)) &&
1266 noexcept(
typename MTB::ConstColEnumerator(eB)))
1267 : d_eA(eA), d_eB(eB)
1274 inline Step1_Type step1()
const
1275 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_eA.current() * d_eB.current()))
1277 return d_eA.current() * d_eB.current();
1280 template<
typename ResultType>
1281 inline void step2(ResultType & result)
const
1282 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result += d_eA.current() * d_eB.current()))
1284 for (d_eA.next(), d_eB.next(); d_eA.has_current(); d_eA.next(), d_eB.next())
1285 result += d_eA.current() * d_eB.current();
1290 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
GetCoeffSteps_Type(AB.first.enumerate_row(i), AB.second.enumerate_col(j))))
1292 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_matrix_multiplication::get_coeff_steps(" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(AB) <<
")");
1293 assert(i < rows(AB));
1294 assert(j < cols(AB));
1298 inline CoeffType_Get operator () (
size_type i,
size_type j,
const std::pair<MTA, MTB> & AB)
const
1299 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
setZero(helper::make_type_lvalue<CoeffType>())) &&
1300 noexcept(CoeffType()) &&
1302 (noexcept(AB.first.enumerate_row(i)) && noexcept(AB.second.enumerate_col(j)) &&
1303 noexcept(helper::make_type_lvalue<typename MTA::ConstRowEnumerator>().next()) &&
1304 noexcept(helper::make_type_lvalue<typename MTB::ConstColEnumerator>().next()) &&
1305 noexcept(helper::make_type_lvalue<CoeffType>() = helper::make_type_lvalue<typename MTA::ConstRowEnumerator>().current() * helper::make_type_lvalue<typename MTB::ConstColEnumerator>().current()) &&
1306 noexcept(helper::make_type_lvalue<CoeffType>() += helper::make_type_lvalue<typename MTA::ConstRowEnumerator>().current() * helper::make_type_lvalue<typename MTB::ConstColEnumerator>().current())) : true))
1308 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_matrix_multiplication::operator () (" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(AB) <<
")");
1309 assert(i < rows(AB));
1310 assert(j < cols(AB));
1320 typename MTA::ConstRowEnumerator eA = AB.first.enumerate_row(i);
1321 typename MTB::ConstColEnumerator eB = AB.second.enumerate_col(j);
1322 CoeffType res = eA.current() * eB.current();
1323 for (eA.next(), eB.next(); eA.has_current(); eA.next(), eB.next())
1324 res += eA.current() * eB.current();
1329 static inline size_type rows(
const std::pair<MTA, MTB> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1331 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_matrix_multiplication::rows(" << getAddress(*
this) <<
"; " << getAddress(AB) <<
")");
1332 return AB.first.rows();
1335 static inline size_type cols(
const std::pair<MTA, MTB> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1337 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_matrix_multiplication::cols(" << getAddress(*
this) <<
"; " << getAddress(AB) <<
")");
1338 return AB.second.cols();
1341 static inline size_type size(
const std::pair<MTA, MTB> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1343 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_matrix_multiplication::size(" << getAddress(*
this) <<
"; " << getAddress(AB) <<
")");
1344 return AB.first.rows() * AB.second.cols();
1347 template<
typename MatrixType>
1348 static inline bool involves_this_matrix(
const MatrixType & matrix,
const std::pair<MTA, MTB> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1350 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_matrix_multiplication::involves_this_matrix(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(AB) <<
")");
1351 return AB.first.involves_this_matrix(matrix) || AB.second.involves_this_matrix(matrix);
1354 template<
typename MatrixType>
1355 static inline bool test_involvement(
const MatrixType & matrix,
const std::pair<MTA, MTB> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1357 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_matrix_multiplication::test_involvement(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(AB) <<
")");
1358 return AB.first.test_involvement(matrix) || AB.second.test_involvement(matrix);
1364 typename MTA::ConstRowEnumerator d_row;
1365 typename MTB::ConstColsEnumerator d_cols;
1371 inline ConstRowEnumerator(
typename MTA::ConstRowEnumerator row,
typename MTB::ConstColsEnumerator cols)
1372 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
typename MTA::ConstRowEnumerator(row)) &&
1373 noexcept(
typename MTB::ConstColsEnumerator(cols)))
1374 : d_row(row), d_cols(cols)
1378 inline Type current()
const
1379 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
setZero(helper::make_type_lvalue<Type>())) &&
1380 noexcept(helper::make_type_lvalue<Type>() = d_row.current() * d_cols.current().current()) &&
1381 noexcept(helper::make_type_lvalue<Type>() += d_row.current() * d_cols.current().current()))
1383 typename MTA::ConstRowEnumerator er = d_row;
1384 if (er.has_current())
1386 typename MTB::ConstColsEnumerator::Type ec = d_cols.current();
1387 Type result = er.current() * ec.current();
1388 for (er.next(), ec.next(); er.has_current(); er.next(), ec.next())
1389 result += er.current() * ec.current();
1400 template<
typename Result>
1401 inline void get_current(Result & result)
const
1402 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
setZero(result)) &&
1403 noexcept(result = d_row.current() * d_cols.current().current()) &&
1404 noexcept(result += d_row.current() * d_cols.current().current()))
1406 typename MTA::ConstRowEnumerator er = d_row;
1407 if (er.has_current())
1409 typename MTB::ConstColsEnumerator::Type ec = d_cols.current();
1410 result = er.current() * ec.current();
1411 for (er.next(), ec.next(); er.has_current(); er.next(), ec.next())
1412 result += er.current() * ec.current();
1419 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
GetCoeffSteps_Type(d_row, d_cols.current())))
1424 inline bool has_current()
const
1425 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_cols.has_current()))
1427 return d_cols.has_current();
1431 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_cols.next()))
1440 typename MTA::ConstRowsEnumerator d_rows;
1441 typename MTB::ConstColEnumerator d_col;
1447 inline ConstColEnumerator(
typename MTA::ConstRowsEnumerator rows,
typename MTB::ConstColEnumerator col)
1448 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
typename MTA::ConstRowsEnumerator(rows)) &&
1449 noexcept(
typename MTB::ConstColEnumerator(col)))
1450 : d_rows(rows), d_col(col)
1454 inline Type current()
const
1455 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
setZero(helper::make_type_lvalue<Type>())) &&
1456 noexcept(helper::make_type_lvalue<Type>() = d_rows.current().current() * d_col.current()) &&
1457 noexcept(helper::make_type_lvalue<Type>() += d_rows.current().current() * d_col.current()))
1459 typename MTA::ConstRowsEnumerator::Type er = d_rows.current();
1460 if (er.has_current())
1462 typename MTB::ConstColEnumerator ec = d_col;
1463 Type result = er.current() * ec.current();
1464 for (er.next(), ec.next(); er.has_current(); er.next(), ec.next())
1465 result += er.current() * ec.current();
1476 template<
typename Result>
1477 inline void get_current(Result & result)
const
1478 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
setZero(result)) &&
1479 noexcept(result = d_rows.current().current() * d_col.current()) &&
1480 noexcept(result += d_rows.current().current() * d_col.current()))
1482 typename MTA::ConstRowsEnumerator::Type er = d_rows.current();
1483 if (er.has_current())
1485 typename MTB::ConstColEnumerator ec = d_col;
1486 result = er.current() * ec.current();
1487 for (er.next(), ec.next(); er.has_current(); er.next(), ec.next())
1488 result += er.current() * ec.current();
1495 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
GetCoeffSteps_Type(d_rows.current(), d_col)))
1500 inline bool has_current()
const
1501 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_rows.has_current()))
1503 return d_rows.has_current();
1507 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_rows.next()))
1516 typename MTA::ConstRowsEnumerator d_rows;
1517 typename MTB::ConstColsEnumerator d_cols, d_cols_init;
1523 inline ConstEnumerator_Generic(
typename MTA::ConstRowsEnumerator rows,
typename MTB::ConstColsEnumerator cols)
1524 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
typename MTA::ConstRowsEnumerator(rows)) &&
1525 noexcept(
typename MTB::ConstColsEnumerator(cols)))
1526 : d_rows(rows), d_cols(cols), d_cols_init(d_cols)
1530 inline Type current()
const
1531 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
setZero(helper::make_type_lvalue<Type>())) &&
1532 noexcept(helper::make_type_lvalue<Type>() = d_rows.current().current() * d_cols.current().current()) &&
1533 noexcept(helper::make_type_lvalue<Type>() += d_rows.current().current() * d_cols.current().current()))
1535 typename MTA::ConstRowsEnumerator::Type er = d_rows.current();
1536 if (er.has_current())
1538 typename MTB::ConstColsEnumerator::Type ec = d_cols.current();
1539 Type result = er.current() * ec.current();
1540 for (er.next(), ec.next(); er.has_current(); er.next(), ec.next())
1541 result += er.current() * ec.current();
1552 template<
typename Result>
1553 inline void get_current(Result & result)
const
1554 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
setZero(result)) &&
1555 noexcept(result = d_rows.current().current() * d_cols.current().current()) &&
1556 noexcept(result += d_rows.current().current() * d_cols.current().current()))
1558 typename MTA::ConstRowsEnumerator::Type er = d_rows.current();
1559 if (er.has_current())
1561 typename MTB::ConstColsEnumerator::Type ec = d_cols.current();
1562 result = er.current() * ec.current();
1563 for (er.next(), ec.next(); er.has_current(); er.next(), ec.next())
1564 result += er.current() * ec.current();
1571 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
GetCoeffSteps_Type(d_rows.current(), d_cols.current())))
1576 inline bool has_current()
const
1577 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_cols.has_current()))
1579 return d_cols.has_current();
1583 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_cols.next()) && noexcept(d_cols.has_current()) &&
1584 noexcept(d_rows.next()) && noexcept(d_rows.has_current()) &&
1585 noexcept(d_cols = d_cols_init))
1588 if (!d_cols.has_current())
1591 if (d_rows.has_current())
1592 d_cols = d_cols_init;
1600 inline ConstEnumerator_OneRow(
typename MTA::ConstRowsEnumerator rows,
typename MTB::ConstColsEnumerator cols)
1601 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(rows.current()))
1610 inline ConstEnumerator_OneCol(
typename MTA::ConstRowsEnumerator rows,
typename MTB::ConstColsEnumerator cols)
1611 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(cols.current()))
1623 typedef void Enumerator;
1624 typedef void RowEnumerator;
1625 typedef void ColEnumerator;
1627 typedef ConstEnumerator DefaultEnumerator;
1631 static inline DefaultEnumerator enumerate(
const std::pair<MTA, MTB> & AB)
1632 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(AB.first.enumerate_rows()) && noexcept(AB.second.enumerate_cols()))
1634 return DefaultEnumerator(AB.first.enumerate_rows(), AB.second.enumerate_cols());
1637 static inline DefaultRowEnumerator enumerate_row(
size_type row,
const std::pair<MTA, MTB> & AB)
1638 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(AB.second.enumerate_row(row)) && noexcept(AB.second.enumerate_cols()))
1640 return DefaultRowEnumerator(AB.first.enumerate_row(row), AB.second.enumerate_cols());
1643 static inline DefaultColEnumerator enumerate_col(
size_type col,
const std::pair<MTA, MTB> & AB)
1644 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(AB.first.enumerate_rows()) && noexcept(AB.second.enumerate_col(col)))
1646 return DefaultColEnumerator(AB.first.enumerate_rows(), AB.second.enumerate_col(col));
1652 typename MTA::ConstRowsEnumerator d_rows;
1653 typename MTB::ConstColsEnumerator d_cols;
1659 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(AB.first.enumerate_rows()) && noexcept(AB.second.enumerate_cols()))
1660 : d_rows(AB.first.enumerate_rows()), d_cols(AB.second.enumerate_cols())
1664 Type current()
const
1665 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
ConstRowEnumerator(d_rows.current(), d_cols)))
1670 inline bool has_current()
const
1671 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_rows.has_current()))
1673 return d_rows.has_current();
1676 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_rows.next()))
1685 typename MTA::ConstRowsEnumerator d_rows;
1686 typename MTB::ConstColsEnumerator d_cols;
1692 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(AB.first.enumerate_rows()) && noexcept(AB.second.enumerate_cols()))
1693 : d_rows(AB.first.enumerate_rows()), d_cols(AB.second.enumerate_cols())
1697 Type current()
const PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
ConstColEnumerator(d_rows, d_cols.current())))
1702 inline bool has_current()
const PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_cols.has_current()))
1704 return d_cols.has_current();
1707 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_cols.next()))
1713 typedef void RowsEnumerator;
1714 typedef void ColsEnumerator;
1724 inline DefaultColsEnumerator enumerate_cols(
const std::pair<MTA, MTB> & AB)
const
1725 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultColsEnumerator(AB)))
1727 return DefaultColsEnumerator(AB);
1731 template<
typename OpA,
typename OpB>
1738 static inline ReturnType op(
const OpA & a,
const OpB & b)
1739 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(ReturnType(a * b)))
1744 template<
typename ResultType_>
1745 static inline void op(ResultType_ & result,
const OpA & a,
const OpB & b)
1746 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = a * b))
1752 template<
typename OpA,
typename OpB>
1759 static inline ReturnType op(
const OpA & a,
const OpB & b)
1760 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(ReturnType(b * a)))
1765 template<
typename ResultType_>
1766 static inline void op(ResultType_ & result,
const OpA & a,
const OpB & b)
1767 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = b * a))
1773 template<
typename OpA,
typename OpB>
1780 static inline ReturnType op(
const OpA & a,
const OpB & b)
1781 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(ReturnType(a / b)))
1786 template<
typename ResultType_>
1787 static inline void op(ResultType_ & result,
const OpA & a,
const OpB & b)
1788 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = a / b))
1794 template<
typename OpA,
typename OpB>
1801 static inline ReturnType op(
const OpA & a,
const OpB & b)
1802 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(ReturnType(a % b)))
1807 template<
typename ResultType_>
1808 static inline void op(ResultType_ & result,
const OpA & a,
const OpB & b)
1809 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = a % b))
1815 template<
template<
typename OpA,
typename OpB>
class Operation>
1819 template<
typename MatrixScalarPair>
1823 typedef typename MatrixScalarPair::first_type MT;
1824 typedef typename MatrixScalarPair::second_type ST;
1825 typedef Operation<typename plll::helper::remove_decorations<typename MT::CoeffType_Get>::Result,
1829 typedef typename Op::ResultType CoeffType;
1830 typedef typename Op::ReturnType CoeffType_Get;
1834 typename MatrixInfo<MT>::StorageTraits,
1836 typedef void data_pointer_type;
1837 typedef void data_ref_type;
1840 coeffs_are_simple_expressions =
true,
1842 can_assign_to =
false,
1843 can_move_from =
false,
1844 can_resize_rows =
false,
1845 can_resize_cols =
false,
1846 has_direct_access =
false };
1848 operation() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1853 template<
typename ResultType>
1854 static inline void get_coeff(ResultType & result,
size_type i,
size_type j,
const std::pair<MT, ST> & AB)
1855 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Op::op(result, AB.first(i, j), AB.second.evaluate())))
1857 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_scalar_operation::operation::get_coeff(" << getAddress(*
this) <<
"; " << getAddress(result) <<
" " << i <<
" " << j <<
" " << getAddress(AB) <<
") const");
1858 assert(i < rows(AB));
1859 assert(j < cols(AB));
1860 Op::op(result, AB.first(i, j), AB.second.evaluate());
1863 static inline bool get_coeff_alwayszero(
const std::pair<MT, ST> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1865 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_scalar_operation::operation::get_coeff_alwayszero(" << getAddress(*
this) <<
"; " << getAddress(AB) <<
")");
1872 typename Op::ReturnType d_value;
1876 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
typename Op::ReturnType(value)))
1881 #if __cplusplus >= 201103L
1883 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
typename Op::ReturnType(std::move(value))))
1884 : d_value(std::move(value))
1889 typedef const typename Op::ReturnType & Step1_Type;
1891 inline Step1_Type step1()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1896 template<
typename ResultType>
1897 inline void step2(ResultType & result)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1903 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
GetCoeffSteps_Type(Op::op(AB.first(i, j), AB.second.evaluate()))))
1905 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_scalar_operation::operation::get_coeff_steps(" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(AB) <<
")");
1906 assert(i < rows(AB));
1907 assert(j < cols(AB));
1911 inline CoeffType_Get operator () (
size_type i,
size_type j,
const std::pair<MT, ST> & AB)
const
1912 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Op::op(AB.first(i, j), AB.second.evaluate())))
1914 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_scalar_operation::operation::operator () (" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(AB) <<
")");
1915 assert(i < rows(AB));
1916 assert(j < cols(AB));
1917 return Op::op(AB.first(i, j), AB.second.evaluate());
1920 static inline size_type rows(
const std::pair<MT, ST> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1922 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_scalar_operation::operation::rows(" << getAddress(*
this) <<
"; " << getAddress(AB) <<
")");
1923 return AB.first.rows();
1926 static inline size_type cols(
const std::pair<MT, ST> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1928 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_scalar_operation::operation::cols(" << getAddress(*
this) <<
"; " << getAddress(AB) <<
")");
1929 return AB.first.cols();
1932 static inline size_type size(
const std::pair<MT, ST> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1934 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_scalar_operation::operation::size(" << getAddress(*
this) <<
"; " << getAddress(AB) <<
")");
1935 return AB.first.size();
1938 template<
typename MatrixType>
1939 static inline bool involves_this_matrix(
const MatrixType & matrix,
const std::pair<MT, ST> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1941 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_scalar_operation::operation::involves_this_matrix(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(AB) <<
")");
1942 return AB.first.involves_this_matrix(matrix);
1945 template<
typename MatrixType>
1946 static inline bool test_involvement(
const MatrixType & matrix,
const std::pair<MT, ST> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1948 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_scalar_operation::operation::test_involvement(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(AB) <<
")");
1949 return AB.first.test_involvement(matrix);
1952 template<
typename Enum>
1960 typedef CoeffType_Get Type;
1964 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Enum(e)))
1969 #if __cplusplus >= 201103L
1971 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Enum(std::move(e))))
1972 : d_enum(std::move(e)), d_B(B)
1977 inline Type current()
const
1978 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Op::op(d_enum.current(), d_B.evaluate())))
1980 return Op::op(d_enum.current(), d_B.evaluate());
1983 template<
typename Result>
1984 inline void get_current(Result & result)
const
1985 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Op::op(result, d_enum.current(), d_B.evaluate())))
1987 Op::op(result, d_enum.current(), d_B.evaluate());
1991 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
GetCoeffSteps_Type(Op::op(d_enum.current(), d_B.evaluate()))))
1996 inline bool has_current()
const
1997 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_enum.has_current()))
1999 return d_enum.has_current();
2003 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_enum.next()))
2009 typedef void Enumerator;
2012 typedef void RowEnumerator;
2015 typedef void ColEnumerator;
2020 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
DefaultEnumerator(AB.first.enumerate(), AB.second)))
2025 static inline DefaultRowEnumerator enumerate_row(
size_type row,
const std::pair<MT, ST> & AB)
2026 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultRowEnumerator(AB.first.enumerate_row(row), AB.second)))
2028 return DefaultRowEnumerator(AB.first.enumerate_row(row), AB.second);
2031 static inline DefaultColEnumerator enumerate_col(
size_type col,
const std::pair<MT, ST> & AB)
2032 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultColEnumerator(AB.first.enumerate_col(col), AB.second)))
2034 return DefaultColEnumerator(AB.first.enumerate_col(col), AB.second);
2037 template<
typename Enum_meta,
typename Enum>
2048 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Enum_meta(e)))
2053 #if __cplusplus >= 201103L
2055 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Enum_meta(std::move(e))))
2056 : d_enum(std::move(e)), d_B(B)
2061 inline Type current()
const
2062 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Type(d_enum.current(), d_B)))
2064 return Type(d_enum.current(), d_B);
2067 inline bool has_current()
const
2068 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_enum.has_current()))
2070 return d_enum.has_current();
2074 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_enum.next()))
2080 typedef void RowsEnumerator;
2081 typedef void ColsEnumerator;
2088 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
DefaultRowsEnumerator(AB.first.enumerate_rows(), AB.second)))
2093 inline DefaultColsEnumerator enumerate_cols(
const std::pair<MT, ST> & AB)
const
2094 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultColsEnumerator(AB.first.enumerate_cols(), AB.second)))
2096 return DefaultColsEnumerator(AB.first.enumerate_cols(), AB.second);
2101 template<
typename OpA,
typename OpB>
2108 static inline ReturnType op(
const OpA & a,
const OpB & b)
2109 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(ReturnType(a + b)))
2114 template<
typename ResultType_>
2115 static inline void op(ResultType_ & result,
const OpA & a,
const OpB & b)
2116 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = a + b))
2122 template<
typename OpA,
typename OpB>
2129 static inline ReturnType op(
const OpA & a,
const OpB & b)
2130 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(ReturnType(a - b)))
2135 template<
typename ResultType_>
2136 static inline void op(ResultType_ & result,
const OpA & a,
const OpB & b)
2137 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = a - b))
2143 template<
typename OpA,
typename OpB>
2150 static inline ReturnType op(
const OpA & a,
const OpB & b)
2151 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(ReturnType(a * b)))
2156 template<
typename ResultType_>
2157 static inline void op(ResultType_ & result,
const OpA & a,
const OpB & b)
2158 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = a * b))
2164 template<
typename OpA,
typename OpB>
2171 static inline ReturnType op(
const OpA & a,
const OpB & b)
2172 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(ReturnType(a / b)))
2177 template<
typename ResultType_>
2178 static inline void op(ResultType_ & result,
const OpA & a,
const OpB & b)
2179 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = a / b))
2185 template<
typename OpA,
typename OpB>
2192 static inline ReturnType op(
const OpA & a,
const OpB & b)
2193 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(ReturnType(a % b)))
2198 template<
typename ResultType_>
2199 static inline void op(ResultType_ & result,
const OpA & a,
const OpB & b)
2200 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = a % b))
2206 template<
template<
typename OpA,
typename OpB>
class Operation>
2210 template<
typename PairMatrices>
2214 typedef typename PairMatrices::first_type MTA;
2215 typedef typename PairMatrices::second_type MTB;
2216 typedef Operation<typename plll::helper::remove_decorations<typename MTA::CoeffType_Get>::Result,
2220 typedef typename Op::ResultType CoeffType;
2221 typedef typename Op::ReturnType CoeffType_Get;
2225 typename MatrixInfo<MTA>::StorageTraits,
2227 typedef void data_pointer_type;
2228 typedef void data_ref_type;
2231 coeffs_are_simple_expressions =
true,
2233 can_assign_to =
false,
2234 can_move_from =
false,
2235 can_resize_rows =
false,
2236 can_resize_cols =
false,
2237 has_direct_access =
false };
2239 operation() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2249 template<
typename ResultType>
2250 static inline void get_coeff(ResultType & result,
size_type i,
size_type j,
const std::pair<MTA, MTB> & AB)
2251 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Op::op(result, AB.first(i, j), AB.second(i, j))))
2253 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::componentwise_operation::operation::get_coeff(" << getAddress(*
this) <<
"; " << getAddress(result) <<
" " << i <<
" " << j <<
" " << getAddress(AB) <<
")");
2254 assert(i < rows(AB));
2255 assert(j < cols(AB));
2256 Op::op(result, AB.first(i, j), AB.second(i, j));
2259 static inline bool get_coeff_alwayszero(
const std::pair<MTA, MTB> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2261 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::componentwise_operation::operation::get_coeff_alwayszero(" << getAddress(*
this) <<
"; " << getAddress(AB) <<
")");
2265 class GetCoeffSteps_Type
2268 typename Op::ReturnType d_value;
2271 inline GetCoeffSteps_Type(
const typename Op::ReturnType & value)
2272 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
typename Op::ReturnType(value)))
2277 #if __cplusplus >= 201103L
2278 inline GetCoeffSteps_Type(
typename Op::ReturnType && value)
2279 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
typename Op::ReturnType(std::move(value))))
2280 : d_value(std::move(value))
2285 typedef const typename Op::ReturnType & Step1_Type;
2287 inline Step1_Type step1()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2292 template<
typename ResultType>
2293 inline void step2(ResultType & result)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2298 static inline GetCoeffSteps_Type get_coeff_steps(
size_type i,
size_type j,
const std::pair<MTA, MTB> & AB)
2299 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(GetCoeffSteps_Type(Op::op(AB.first(i, j), AB.second(i, j)))))
2301 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::componentwise_operation::operation::get_coeff_steps(" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(AB) <<
")");
2302 assert(i < rows(AB));
2303 assert(j < cols(AB));
2304 return GetCoeffSteps_Type(Op::op(AB.first(i, j), AB.second(i, j)));
2307 inline CoeffType_Get operator () (
size_type i,
size_type j,
const std::pair<MTA, MTB> & AB)
const
2308 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Op::op(AB.first(i, j), AB.second(i, j))))
2310 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::componentwise_operation::operation::operator () (" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(AB) <<
")");
2311 assert(i < rows(AB));
2312 assert(j < cols(AB));
2313 return Op::op(AB.first(i, j), AB.second(i, j));
2316 static inline size_type rows(
const std::pair<MTA, MTB> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2318 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::componentwise_operation::operation::rows(" << getAddress(*
this) <<
"; " << getAddress(AB) <<
")");
2319 return AB.first.rows();
2322 static inline size_type cols(
const std::pair<MTA, MTB> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2324 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::componentwise_operation::operation::cols(" << getAddress(*
this) <<
"; " << getAddress(AB) <<
")");
2325 return AB.first.cols();
2328 static inline size_type size(
const std::pair<MTA, MTB> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2330 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::componentwise_operation::operation::size(" << getAddress(*
this) <<
"; " << getAddress(AB) <<
")");
2331 return AB.first.rows() * AB.first.cols();
2334 template<
typename MatrixType>
2335 static inline bool involves_this_matrix(
const MatrixType & matrix,
const std::pair<MTA, MTB> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2337 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::componentwise_operation::operation::involves_this_matrix(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(AB) <<
")");
2338 return AB.first.involves_this_matrix(matrix) || AB.second.involves_this_matrix(matrix);
2341 template<
typename MatrixType>
2342 static inline bool test_involvement(
const MatrixType & matrix,
const std::pair<MTA, MTB> & AB) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2344 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::componentwise_operation::operation::test_involvement(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(AB) <<
")");
2345 return AB.first.test_involvement(matrix) || AB.second.test_involvement(matrix);
2348 template<
typename EnumA,
typename EnumB>
2356 typedef CoeffType_Get Type;
2359 inline CWEnumerator(
const EnumA & eA,
const EnumB & eB)
2360 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(EnumA(eA)) && noexcept(EnumB(eB)))
2361 : d_enum_A(eA), d_enum_B(eB)
2365 #if __cplusplus >= 201103L
2366 inline CWEnumerator(EnumA && eA, EnumB && eB)
2367 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(EnumA(std::move(eA))) && noexcept(EnumB(std::move(eB))))
2368 : d_enum_A(std::move(eA)), d_enum_B(std::move(eB))
2373 inline Type current()
const
2374 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Op::op(d_enum_A.current(), d_enum_B.current())))
2376 return Op::op(d_enum_A.current(), d_enum_B.current());
2379 template<
typename Result>
2380 inline void get_current(Result & result)
const
2381 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Op::op(result, d_enum_A.current(), d_enum_B.current())))
2383 Op::op(result, d_enum_A.current(), d_enum_B.current());
2386 inline GetCoeffSteps_Type get_current_steps()
const
2387 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(GetCoeffSteps_Type(Op::op(d_enum_A.current(), d_enum_B.current()))))
2389 return GetCoeffSteps_Type(Op::op(d_enum_A.current(), d_enum_B.current()));
2392 inline bool has_current()
const
2393 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_enum_A.has_current()))
2395 return d_enum_A.has_current();
2399 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_enum_A.next()) && noexcept(d_enum_B.next()))
2406 typedef void Enumerator;
2407 typedef CWEnumerator<typename MTA::ConstEnumerator, typename MTB::ConstEnumerator> ConstEnumerator;
2408 typedef CWEnumerator<typename MTA::ConstEnumerator, typename MTB::ConstEnumerator> DefaultEnumerator;
2409 typedef void RowEnumerator;
2410 typedef CWEnumerator<typename MTA::ConstRowEnumerator, typename MTB::ConstRowEnumerator> ConstRowEnumerator;
2411 typedef CWEnumerator<typename MTA::ConstRowEnumerator, typename MTB::ConstRowEnumerator> DefaultRowEnumerator;
2412 typedef void ColEnumerator;
2413 typedef CWEnumerator<typename MTA::ConstColEnumerator, typename MTB::ConstColEnumerator> ConstColEnumerator;
2414 typedef CWEnumerator<typename MTA::ConstColEnumerator, typename MTB::ConstColEnumerator> DefaultColEnumerator;
2416 static inline DefaultEnumerator enumerate(
const std::pair<MTA, MTB> & AB)
2417 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultEnumerator(AB.first.enumerate(), AB.second.enumerate())))
2419 return DefaultEnumerator(AB.first.enumerate(), AB.second.enumerate());
2422 static inline DefaultRowEnumerator enumerate_row(
size_type row,
const std::pair<MTA, MTB> & AB)
2423 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultRowEnumerator(AB.first.enumerate_row(row), AB.second.enumerate_row(row))))
2425 return DefaultRowEnumerator(AB.first.enumerate_row(row), AB.second.enumerate_row(row));
2428 static inline DefaultColEnumerator enumerate_col(
size_type col,
const std::pair<MTA, MTB> & AB)
2429 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultColEnumerator(AB.first.enumerate_col(col), AB.second.enumerate_col(col))))
2431 return DefaultColEnumerator(AB.first.enumerate_col(col), AB.second.enumerate_col(col));
2434 template<
typename Enum_meta_A,
typename Enum_meta_B,
typename Enum_A,
typename Enum_B>
2435 class CWEnumerator_meta
2438 Enum_meta_A d_enum_A;
2439 Enum_meta_B d_enum_B;
2442 typedef CWEnumerator<Enum_A, Enum_B> Type;
2444 inline CWEnumerator_meta(
const Enum_meta_A & eA,
const Enum_meta_B & eB)
2445 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Enum_meta_A(eA)) && noexcept(Enum_mbeta_B(eB)))
2446 : d_enum_A(eA), d_enum_B(eB)
2450 #if __cplusplus >= 201103L
2451 inline CWEnumerator_meta(Enum_meta_A && eA, Enum_meta_B && eB)
2452 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Enum_meta_A(std::move(eA))) && noexcept(Enum_mbeta_B(std::move(eB))))
2453 : d_enum_A(std::move(eA)), d_enum_B(std::move(eB))
2458 inline Type current()
const
2459 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Type(d_enum_A.current(), d_enum_B.current())))
2461 return Type(d_enum_A.current(), d_enum_B.current());
2464 inline bool has_current()
const
2465 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_enum_A.has_current()))
2467 return d_enum_A.has_current();
2471 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_enum_A.next()) && noexcept(d_enum_B.next()))
2478 typedef void RowsEnumerator;
2479 typedef void ColsEnumerator;
2480 typedef CWEnumerator_meta<
typename MTA::ConstRowsEnumerator,
typename MTB::ConstRowsEnumerator,
2481 typename MTA::ConstRowEnumerator,
typename MTB::ConstRowEnumerator> ConstRowsEnumerator;
2482 typedef CWEnumerator_meta<
typename MTA::ConstColsEnumerator,
typename MTB::ConstColsEnumerator,
2483 typename MTA::ConstColEnumerator,
typename MTB::ConstColEnumerator> ConstColsEnumerator;
2484 typedef ConstRowsEnumerator DefaultRowsEnumerator;
2485 typedef ConstColsEnumerator DefaultColsEnumerator;
2487 inline DefaultRowsEnumerator enumerate_rows(
const std::pair<MTA, MTB> & AB)
const
2488 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultRowsEnumerator(AB.first.enumerate_rows(), AB.second.enumerate_rows())))
2490 return DefaultRowsEnumerator(AB.first.enumerate_rows(), AB.second.enumerate_rows());
2493 inline DefaultColsEnumerator enumerate_cols(
const std::pair<MTA, MTB> & AB)
const
2494 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultColsEnumerator(AB.first.enumerate_cols(), AB.second.enumerate_cols())))
2496 return DefaultColsEnumerator(AB.first.enumerate_cols(), AB.second.enumerate_cols());
2501 template<
typename MTIn>
2510 typename MatrixInfo<MTIn>::StorageTraits,
2512 typedef void data_pointer_type;
2513 typedef void data_ref_type;
2516 coeffs_are_simple_expressions =
true,
2518 can_assign_to =
false,
2519 can_move_from =
false,
2520 can_resize_rows =
false,
2521 can_resize_cols =
false,
2522 has_direct_access =
false };
2529 template<
typename ResultType>
2530 static inline void get_coeff(ResultType & result,
size_type i,
size_type j,
const MTIn & A)
2531 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = -A(i, j)))
2533 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_negation::get_coeff(" << getAddress(*
this) <<
"; " << getAddress(result) <<
" " << i <<
" " << j <<
" " << getAddress(A) <<
") const");
2534 assert(i < rows(A));
2535 assert(j < cols(A));
2539 static inline bool get_coeff_alwayszero(
const MTIn & A) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2541 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_negation::get_coeff_alwayszero(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
2553 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Type(value)))
2558 #if __cplusplus >= 201103L
2560 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Type(std::move(value))))
2561 : d_value(std::move(value))
2566 typedef const Type & Step1_Type;
2568 inline Step1_Type step1()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2573 template<
typename ResultType>
2574 inline void step2(ResultType & result)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2582 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_negation::get_coeff_steps(" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(A) <<
")");
2583 assert(i < rows(A));
2584 assert(j < cols(A));
2589 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(-A(i, j)))
2591 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_negation::operator () (" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(A) <<
")");
2592 assert(i < rows(A));
2593 assert(j < cols(A));
2597 static inline size_type rows(
const MTIn & A) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2599 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_negation::rows(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
2603 static inline size_type cols(
const MTIn & A) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2605 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_negation::cols(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
2609 static inline size_type size(
const MTIn & A) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2611 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_negation::size(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
2612 return A.rows() * A.cols();
2615 template<
typename MatrixType>
2616 static inline bool involves_this_matrix(
const MatrixType & matrix,
const MTIn & A) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2618 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_negation::involves_this_matrix(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(A) <<
")");
2619 return A.involves_this_matrix(matrix);
2622 template<
typename MatrixType>
2623 static inline bool test_involvement(
const MatrixType & matrix,
const MTIn & A) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2625 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::matrix_negation::test_involvement(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(A) <<
")");
2626 return A.test_involvement(matrix);
2629 template<
typename Enum>
2636 typedef CoeffType_Get Type;
2640 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Enum(e)))
2645 #if __cplusplus >= 201103L
2647 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Enum(std::move(e))))
2648 : d_enum(std::move(e))
2653 inline Type current()
const
2654 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Type(-d_enum.current())))
2656 return -d_enum.current();
2659 template<
typename Result>
2660 inline void get_current(Result & result)
const
2661 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = -d_enum.current()))
2663 result = -d_enum.current();
2667 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
GetCoeffSteps_Type(-d_enum.current())))
2672 inline bool has_current()
const
2673 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_enum.has_current()))
2675 return d_enum.has_current();
2679 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_enum.next()))
2685 typedef void Enumerator;
2688 typedef void RowEnumerator;
2691 typedef void ColEnumerator;
2696 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
DefaultEnumerator(A.enumerate())))
2701 static inline DefaultRowEnumerator enumerate_row(
size_type row,
const MTIn & A)
2702 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultRowEnumerator(A.enumerate_row(row))))
2704 return DefaultRowEnumerator(A.enumerate_row(row));
2707 static inline DefaultColEnumerator enumerate_col(
size_type col,
const MTIn & A)
2708 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultColEnumerator(A.enumerate_col(col))))
2710 return DefaultColEnumerator(A.enumerate_col(col));
2713 template<
typename Enum_meta,
typename Enum>
2723 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Enum_meta(e)))
2728 #if __cplusplus >= 201103L
2730 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Enum_meta(std::move(e))))
2731 : d_enum(std::move(e))
2736 inline Type current()
const
2737 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Type(d_enum.current())))
2739 return Type(d_enum.current());
2742 inline bool has_current()
const
2743 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_enum.has_current()))
2745 return d_enum.has_current();
2749 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_enum.next()))
2755 typedef void RowsEnumerator;
2756 typedef void ColsEnumerator;
2768 inline DefaultColsEnumerator enumerate_cols(
const MTIn & A)
const
2769 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultColsEnumerator(A.enumerate_cols())))
2771 return DefaultColsEnumerator(A.enumerate_cols());
2775 template<
int Rows,
int Cols>
2776 template<
typename MT>
2783 typedef typename MT::CoeffType CoeffType;
2784 typedef typename MT::CoeffType_Get CoeffType_Get;
2785 typedef typename MT::GetCoeffSteps_Type GetCoeffSteps_Type;
2788 typename MatrixInfo<MT>::StorageTraits,
2790 typedef void data_pointer_type;
2791 typedef void data_ref_type;
2794 coeffs_are_simple_expressions =
true,
2798 can_resize_rows =
false,
2799 can_resize_cols =
false,
2800 has_direct_access =
false };
2802 template<
typename MT_>
2818 template<
typename ResultType>
2820 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = A(d_r_ofs + i, d_c_ofs + j)))
2822 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub::operation_generic::get_coeff(" << getAddress(*
this) <<
"; " << getAddress(result) <<
" " << i <<
" " << j <<
" " << getAddress(A) <<
") const");
2823 assert(i < rows(A));
2824 assert(j < cols(A));
2825 result = A(d_r_ofs + i, d_c_ofs + j);
2828 inline bool get_coeff_alwayszero(
const MT & A)
const
2829 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.get_coeff_alwayszero()))
2831 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub::operation_generic::get_coeff_alwayszero(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
2832 return A.get_coeff_alwayszero();
2835 inline GetCoeffSteps_Type get_coeff_steps(
size_type i,
size_type j,
const MT & A)
const
2836 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.get_coeff_steps(d_r_ofs + i, d_c_ofs + j)))
2838 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub::operation_generic::get_coeff_steps(" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(A) <<
")");
2839 assert(i < rows(A));
2840 assert(j < cols(A));
2841 return A.get_coeff_steps(d_r_ofs + i, d_c_ofs + j);
2845 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A(d_r_ofs + i, d_c_ofs + j)))
2847 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub::operation_generic::operator () (" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(A) <<
")");
2848 assert(i < rows(A));
2849 assert(j < cols(A));
2850 return A(d_r_ofs + i, d_c_ofs + j);
2853 inline size_type rows(
const MT & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2855 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub::operation_generic::rows(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
2859 inline size_type cols(
const MT & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2861 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub::operation_generic::cols(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
2865 inline size_type size(
const MT & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2867 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub::operation_generic::size(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
2871 template<
typename MatrixType>
2872 inline bool involves_this_matrix(
const MatrixType & matrix,
const MT & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2874 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub::operation_generic::involves_this_matrix(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(A) <<
")");
2875 return A.involves_this_matrix(matrix);
2878 template<
typename MatrixType>
2879 inline bool test_involvement(
const MatrixType & matrix,
const MT & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2881 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub::operation_generic::test_involvement(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(A) <<
")");
2882 return A.test_involvement(matrix);
2893 typedef CoeffType_Get Type;
2894 typedef typename MT::GetCoeffSteps_Type GetCoeffSteps_Type;
2896 template<
typename SType>
2897 inline Enumerator(
const SType & s,
const MT & A)
2898 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(MT(A)))
2900 d_r_ofs(s.d_r_ofs), d_c_ofs(s.d_c_ofs), d_row(0), d_col(0), d_A(A)
2904 inline Type current()
const
2905 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_A(d_r_ofs + d_row, d_c_ofs + d_col)))
2907 return d_A(d_r_ofs + d_row, d_c_ofs + d_col);
2910 template<
typename Result>
2911 inline void get_current(Result & result)
const
2912 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_A.get_coeffs(result, d_r_ofs + d_row, d_c_ofs + d_col)))
2914 d_A.get_coeffs(result, d_r_ofs + d_row, d_c_ofs + d_col);
2917 inline GetCoeffSteps_Type get_current_steps()
const
2918 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_A.get_coeff_steps(d_r_ofs + d_row, d_c_ofs + d_col)))
2920 return d_A.get_coeff_steps(d_r_ofs + d_row, d_c_ofs + d_col);
2923 inline bool has_current()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2925 return d_row < row_count_storage<Rows>::rows();
2928 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2946 typedef CoeffType_Get Type;
2947 typedef typename MT::GetCoeffSteps_Type GetCoeffSteps_Type;
2949 template<
typename SType>
2951 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(MT(A)))
2952 : d_A(A), d_row(s.d_r_ofs + row), d_col(s.d_c_ofs), d_left(s.cols(A))
2956 inline Type current()
const
2957 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_A(d_row, d_col)))
2959 return d_A(d_row, d_col);
2962 template<
typename Result>
2963 inline void get_current(Result & result)
const
2964 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_A.get_coeff(result, d_row, d_col)))
2966 d_A.get_coeff(result, d_row, d_col);
2969 inline GetCoeffSteps_Type get_current_steps()
const
2970 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_A.get_coeff_steps(d_row, d_col)))
2972 return d_A.get_coeff_steps(d_row, d_col);
2975 inline bool has_current()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2980 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2995 typedef CoeffType_Get Type;
2996 typedef typename MT::GetCoeffSteps_Type GetCoeffSteps_Type;
2998 template<
typename SType>
3000 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(MT(A)))
3001 : d_A(A), d_row(s.d_r_ofs), d_col(s.d_c_ofs + col), d_left(s.rows(A))
3005 inline Type current()
const
3006 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_A(d_row, d_col)))
3008 return d_A(d_row, d_col);
3011 template<
typename Result>
3012 inline void get_current(Result & result)
const
3013 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_A.get_coeff(result, d_row, d_col)))
3015 d_A.get_coeff(result, d_row, d_col);
3018 inline GetCoeffSteps_Type get_current_steps()
const
3019 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_A.get_coeff_steps(d_row, d_col)))
3021 return d_A.get_coeff_steps(d_row, d_col);
3024 inline bool has_current()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3029 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3053 inline DefaultRowEnumerator enumerate_row(
size_type row,
const MT & A)
3056 return DefaultRowEnumerator(*
this, row, A);
3059 inline DefaultColEnumerator enumerate_col(
size_type col,
const MT & A)
const
3060 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultColEnumerator(
helper::make_type_lvalue<
const operation_generic<MT> >(), col, A)))
3062 return DefaultColEnumerator(*
this, col, A);
3076 : d_data(data), d_A(A), d_row(0)
3080 inline Type current()
const
3081 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Type(*d_data, d_data->d_r_ofs + d_row, d_A)))
3083 return Type(*d_data, d_data->d_r_ofs + d_row, d_A);
3086 inline bool has_current()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3088 return d_row < d_data->rows(d_A);
3091 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3108 : d_data(data), d_A(A), d_col(0)
3112 inline Type current()
const
3113 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Type(*d_data, d_data->d_c_ofs + d_col, d_A)))
3115 return Type(*d_data, d_data->d_c_ofs + d_col, d_A);
3118 inline bool has_current()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3120 return d_col < d_data->cols(d_A);
3124 PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3144 inline DefaultColsEnumerator enumerate_col(
const MT & A)
const
3147 return DefaultColsEnumerator(
this, A);
3152 template<
typename MT>
3159 typedef typename MT::CoeffType CoeffType;
3160 typedef typename MT::CoeffType_Get CoeffType_Get;
3161 typedef typename MT::GetCoeffSteps_Type GetCoeffSteps_Type;
3164 typename MatrixInfo<MT>::StorageTraits,
3166 typedef typename MT::data_pointer_type data_pointer_type;
3167 typedef typename MT::data_ref_type data_ref_type;
3170 coeffs_are_simple_expressions =
true,
3174 can_resize_rows =
false,
3175 can_resize_cols =
false,
3176 has_direct_access = MT::has_direct_access };
3178 template<
typename MT_>
3180 PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3188 assert(d_r_ofs < data.rows());
3191 template<
typename ResultType>
3192 inline void get_coeff(ResultType & result,
size_type i,
size_type j,
const MT & A)
const
3193 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = A(d_r_ofs, j)))
3195 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_row::get_coeff(" << getAddress(*
this) <<
"; " << getAddress(result) <<
" " << i <<
" " << j <<
" " << getAddress(A) <<
") const");
3197 assert(j < cols(A));
3198 result = A(d_r_ofs, j);
3201 inline bool get_coeff_alwayszero(
const MT & A)
const
3202 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.get_coeff_alwayszero()))
3204 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_row::get_coeff_alwayszero(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
3205 return A.get_coeff_alwayszero();
3208 inline GetCoeffSteps_Type get_coeff_steps(
size_type i,
size_type j,
const MT & A)
const
3209 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.get_coeff_steps(d_r_ofs, j)))
3211 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_row::get_coeff_steps(" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(A) <<
")");
3213 assert(j < cols(A));
3214 return A.get_coeff_steps(d_r_ofs, j);
3218 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A(d_r_ofs, j)))
3220 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_row::operator () (" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(A) <<
")");
3222 assert(j < cols(A));
3223 return A(d_r_ofs, j);
3226 inline size_type rows(
const MT & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3228 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_row::rows(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
3232 inline size_type cols(
const MT & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3234 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_row::cols(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
3238 inline size_type size(
const MT & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3240 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_row::size(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
3244 inline data_pointer_type data(
const MT & A)
const
3245 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.data() + helper::make_type_lvalue<const operation_row>().d_r_ofs *
3246 helper::make_type_lvalue<const operation_row>().col_count_storage<Cols>::cols()))
3248 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_row::data(" << getAddress(*
this) <<
"; " << getAddress(A) <<
") const");
3252 inline data_ref_type data(
size_type i,
const MT & A)
const
3253 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.data(i + helper::make_type_lvalue<const operation_row>().d_r_ofs *
3254 helper::make_type_lvalue<const operation_row>().col_count_storage<Cols>::cols())))
3256 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_row::data(" << getAddress(*
this) <<
"; " << i <<
" " << getAddress(A) <<
") const");
3260 template<
typename MatrixType>
3261 inline bool involves_this_matrix(
const MatrixType & matrix,
const MT & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3263 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_row::involves_this_matrix(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(A) <<
")");
3264 return A.involves_this_matrix(matrix);
3267 template<
typename MatrixType>
3268 inline bool test_involvement(
const MatrixType & matrix,
const MT & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3270 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_row::test_involvement(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(A) <<
")");
3271 return A.test_involvement(matrix);
3274 typedef typename MT::RowEnumerator Enumerator;
3275 typedef typename MT::ConstRowEnumerator ConstEnumerator;
3276 typedef typename MT::DefaultRowEnumerator DefaultEnumerator;
3277 typedef typename MT::RowEnumerator RowEnumerator;
3278 typedef typename MT::ConstRowEnumerator ConstRowEnumerator;
3279 typedef typename MT::DefaultRowEnumerator DefaultRowEnumerator;
3289 typedef CoeffType_Get Type;
3290 typedef typename operation_row<MT>::GetCoeffSteps_Type GetCoeffSteps_Type;
3292 template<
typename SType>
3294 : d_A(A), d_row(s.d_r_ofs), d_col(col), d_first(
true)
3298 inline Type current()
const
3299 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_A(d_row, d_col)))
3301 return d_A(d_row, d_col);
3304 template<
typename Result>
3305 inline void get_current(Result & result)
const
3306 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_A.get_coeff(result, d_row, d_col)))
3308 d_A.get_coeff(result, d_row, d_col);
3311 inline GetCoeffSteps_Type get_current_steps()
const
3312 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_A.get_coeff_steps(d_row, d_col)))
3314 return d_A.get_coeff_steps(d_row, d_col);
3317 inline bool has_current()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3322 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3333 inline DefaultEnumerator enumerate(
const MT & A)
const
3334 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.enumerate_row(d_r_ofs)))
3336 return A.enumerate_row(d_r_ofs);
3339 inline DefaultRowEnumerator enumerate_row(
size_type row,
const MT & A)
const
3340 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.enumerate_row(d_r_ofs)))
3343 return A.enumerate_row(d_r_ofs);
3346 inline DefaultColEnumerator enumerate_col(
size_type col,
const MT & A)
const
3347 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultColEnumerator(
helper::make_type_lvalue<operation_row<MT> >(), col, A)))
3349 return DefaultColEnumerator(*
this, col, A);
3355 DefaultRowEnumerator d_row;
3359 typedef DefaultRowEnumerator Type;
3362 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultRowEnumerator(e)))
3363 : d_row(e), d_first(
true)
3367 inline Type current()
const
3368 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Type(d_row)))
3373 inline bool has_current()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3378 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3387 DefaultRowEnumerator d_row;
3393 const DefaultRowEnumerator * d_row;
3397 typedef CoeffType_Get Type;
3398 typedef typename DefaultRowEnumerator::GetCoeffSteps_Type GetCoeffSteps_Type;
3400 CustomColEnumerator(
const DefaultRowEnumerator & row) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3401 : d_row(&row), d_first(
true)
3405 inline Type current()
const
3406 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_row->current()))
3408 return d_row->current();
3411 template<
typename Result>
3412 inline void get_current(Result & result)
const
3413 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_row->get_current(result)))
3415 d_row->get_current(result);
3418 inline GetCoeffSteps_Type get_current_steps()
const
3419 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_row->get_current_steps()))
3421 return d_row->get_current_steps();
3424 inline bool has_current()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3429 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3438 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(RowEnumerator(row)))
3443 inline Type current() const
3444 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Type(d_row)))
3449 inline bool has_current() const
3450 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_row.has_current()))
3452 return d_row.has_current();
3456 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_row.next()))
3462 friend class RowsEnumerator;
3463 friend class ColsEnumerator;
3465 typedef RowsEnumerator ConstRowsEnumerator;
3466 typedef ColsEnumerator ConstColsEnumerator;
3467 typedef RowsEnumerator DefaultRowsEnumerator;
3468 typedef ColsEnumerator DefaultColsEnumerator;
3470 inline DefaultRowsEnumerator enumerate_rows(
const MT & A)
const
3471 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultRowsEnumerator(
helper::make_type_lvalue<
const operation_row<MT> >().enumerate_row(0, A))))
3473 return DefaultRowsEnumerator(enumerate_row(0, A));
3476 inline DefaultColsEnumerator enumerate_cols(
const MT & A)
const
3477 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultColsEnumerator(
helper::make_type_lvalue<
const operation_row<MT> >().enumerate_row(0, A))))
3479 return DefaultColsEnumerator(enumerate_row(0, A));
3484 template<
typename MT>
3491 typedef typename MT::CoeffType CoeffType;
3492 typedef typename MT::CoeffType_Get CoeffType_Get;
3493 typedef typename MT::GetCoeffSteps_Type GetCoeffSteps_Type;
3496 typename MatrixInfo<MT>::StorageTraits,
3498 typedef void data_pointer_type;
3499 typedef void data_ref_type;
3502 coeffs_are_simple_expressions =
true,
3506 can_resize_rows =
false,
3507 can_resize_cols =
false,
3508 has_direct_access =
false };
3510 template<
typename MT_>
3519 assert(d_c_ofs < data.cols());
3522 template<
typename ResultType>
3523 inline void get_coeff(ResultType & result,
size_type i,
size_type j,
const MT & A)
const
3524 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = A(i, d_c_ofs)))
3526 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_col::get_coeff(" << getAddress(*
this) <<
"; " << getAddress(result) <<
" " << i <<
" " << j <<
" " << getAddress(A) <<
") const");
3528 assert(j < cols(A));
3529 result = A(i, d_c_ofs);
3532 inline bool get_coeff_alwayszero(
const MT & A)
const
3533 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.get_coeff_alwayszero()))
3535 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_col::get_coeff_alwayszero(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
3536 return A.get_coeff_alwayszero();
3539 inline GetCoeffSteps_Type get_coeff_steps(
size_type i,
size_type j,
const MT & A)
const
3540 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.get_coeff_steps(i, d_c_ofs)))
3542 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_col::get_coeff_steps(" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(A) <<
")");
3544 assert(j < cols(A));
3545 return A.get_coeff_steps(i, d_c_ofs);
3549 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A(i, d_c_ofs)))
3551 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_col::operator () (" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(A) <<
")");
3553 assert(j < cols(A));
3554 return A(i, d_c_ofs);
3557 inline size_type rows(
const MT & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3559 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_col::rows(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
3563 inline size_type cols(
const MT & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3565 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_col::cols(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
3569 inline size_type size(
const MT & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3571 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_col::size(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
3575 template<
typename MatrixType>
3576 inline bool involves_this_matrix(
const MatrixType & matrix,
const MT & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3578 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_col::involves_this_matrix(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(A) <<
")");
3579 return A.involves_this_matrix(matrix);
3582 template<
typename MatrixType>
3583 inline bool test_involvement(
const MatrixType & matrix,
const MT & A)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3585 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::sub_1d::operation_col::test_involvement(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(A) <<
")");
3586 return A.test_involvement(matrix);
3589 typedef typename MT::ColEnumerator Enumerator;
3590 typedef typename MT::ConstColEnumerator ConstEnumerator;
3591 typedef typename MT::DefaultColEnumerator DefaultEnumerator;
3592 typedef typename MT::ColEnumerator ColEnumerator;
3593 typedef typename MT::ConstColEnumerator ConstColEnumerator;
3594 typedef typename MT::DefaultColEnumerator DefaultColEnumerator;
3604 typedef CoeffType_Get Type;
3605 typedef typename operation_col<MT>::GetCoeffSteps_Type GetCoeffSteps_Type;
3607 template<
typename SType>
3609 PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3610 : d_A(A), d_row(row), d_col(s.d_c_ofs), d_first(
true)
3614 inline Type current()
const
3615 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_A(d_row, d_col)))
3617 return d_A(d_row, d_col);
3620 template<
typename Result>
3621 inline void get_current(Result & result)
const
3622 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_A.get_coeff(result, d_row, d_col)))
3624 d_A.get_coeff(result, d_row, d_col);
3627 inline GetCoeffSteps_Type get_current_steps()
const
3628 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_A.get_coeff_steps(d_row, d_col)))
3630 return d_A.get_coeff_steps(d_row, d_col);
3633 inline bool has_current()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3638 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3649 inline DefaultEnumerator enumerate(
const MT & A)
const
3650 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.enumerate_col(d_c_ofs)))
3652 return A.enumerate_col(d_c_ofs);
3655 inline DefaultRowEnumerator enumerate_row(
size_type row,
const MT & A)
const
3658 return DefaultRowEnumerator(*
this, row, A);
3661 inline DefaultColEnumerator enumerate_col(
size_type col,
const MT & A)
const
3662 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.enumerate_col(d_c_ofs)))
3665 return A.enumerate_col(d_c_ofs);
3671 DefaultColEnumerator d_col;
3677 const DefaultColEnumerator & d_col;
3681 typedef CoeffType_Get Type;
3682 typedef typename DefaultColEnumerator::GetCoeffSteps_Type GetCoeffSteps_Type;
3684 CustomRowEnumerator(
const DefaultColEnumerator & col) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3685 : d_col(col), d_first(
true)
3689 inline Type current()
const
3690 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_col.current()))
3692 return d_col.current();
3695 template<
typename Result>
3696 inline void get_current(Result & result)
const
3697 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_col.get_current(result)))
3699 d_col.get_current(result);
3702 inline GetCoeffSteps_Type get_current_steps()
const
3703 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_col.get_current_steps()))
3705 return d_col.get_current_steps();
3708 inline bool has_current()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3713 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3722 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultColEnumerator(col)))
3727 inline Type current() const
3728 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Type(d_col)))
3733 inline bool has_current() const
3734 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_col.has_current()))
3736 return d_col.has_current();
3740 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_col.next()))
3749 DefaultColEnumerator d_col;
3753 typedef DefaultColEnumerator Type;
3756 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultColEnumerator(e)))
3757 : d_col(e), d_first(
true)
3761 inline Type current()
const
3762 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Type(d_col)))
3767 inline bool has_current()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3772 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3792 inline DefaultColsEnumerator enumerate_cols(
const MT & A)
const
3795 return DefaultColsEnumerator(enumerate_col(0, A));
3799 template<
typename MT>
3803 typedef typename MT::CoeffType CoeffType;
3804 typedef typename MT::CoeffType_Get CoeffType_Get;
3805 typedef typename MT::GetCoeffSteps_Type GetCoeffSteps_Type;
3808 typename MatrixInfo<MT>::StorageTraits,
3810 typedef void data_pointer_type;
3811 typedef void data_ref_type;
3814 coeffs_are_simple_expressions =
true,
3818 can_resize_rows =
false,
3819 can_resize_cols =
false,
3820 has_direct_access =
false };
3822 transpose() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3827 template<
typename ResultType>
3828 static inline void get_coeff(ResultType & result,
size_type i,
size_type j,
const MT & A)
3829 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = A(j, i)))
3831 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::transpose::get_coeff(" << getAddress(*
this) <<
"; " << getAddress(result) <<
" " << i <<
" " << j <<
" " << getAddress(A) <<
") const");
3832 assert(i < rows(A));
3833 assert(j < cols(A));
3837 static inline bool get_coeff_alwayszero(
const MT & A)
3838 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.get_coeff_alwayszero()))
3840 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::transpose::get_coeff_alwayszero(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
3841 return A.get_coeff_alwayszero();
3844 static inline GetCoeffSteps_Type get_coeff_steps(
size_type i,
size_type j,
const MT & A)
3845 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.get_coeff_steps(j, i)))
3847 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::transpose::get_coeff_steps(" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(A) <<
")");
3848 assert(i < rows(A));
3849 assert(j < cols(A));
3850 return A.get_coeff_steps(j, i);
3854 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(CoeffType_Get(A(j, i))))
3856 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::transpose::operator () (" << getAddress(*
this) <<
"; " << i <<
" " << j <<
" " << getAddress(A) <<
")");
3857 assert(i < rows(A));
3858 assert(j < cols(A));
3862 static inline size_type rows(
const MT & A) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3864 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::transpose::rows(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
3868 static inline size_type cols(
const MT & A) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3870 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::transpose::cols(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
3874 static inline size_type size(
const MT & A) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3876 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::transpose::size(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
3880 template<
typename MatrixType>
3881 static inline bool involves_this_matrix(
const MatrixType & matrix,
const MT & A) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3883 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::transpose::involves_this_matrix(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(A) <<
")");
3884 return A.involves_this_matrix(matrix);
3887 template<
typename MatrixType>
3888 static inline bool test_involvement(
const MatrixType & matrix,
const MT & A) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3890 PLLL_DEBUG_OUTPUT_MESSAGE(
"expressions::transpose::test_involvement(" << getAddress(*
this) <<
"; " << getAddress(matrix) <<
" " << getAddress(A) <<
")");
3891 return A.test_involvement(matrix);
3897 typename MT::DefaultColsEnumerator d_cols;
3898 typename MT::DefaultColsEnumerator::Type d_col;
3901 typedef typename MT::DefaultColsEnumerator::Type::Type Type;
3902 typedef typename MT::DefaultColsEnumerator::Type::GetCoeffSteps_Type GetCoeffSteps_Type;
3905 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
typename MT::DefaultColsEnumerator(matrix.enumerate_cols())) &&
3906 noexcept(
typename MT::DefaultColsEnumerator::Type(d_cols.current())))
3907 : d_cols(matrix.enumerate_cols()), d_col(d_cols.current())
3911 inline Type current()
const
3912 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(Type(d_col.current())))
3914 return d_col.current();
3917 template<
typename Result>
3918 inline void get_current(Result & result)
const
3919 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_col.current(result)))
3921 d_col.current(result);
3924 inline GetCoeffSteps_Type get_current_steps()
const
3925 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_col.get_current_steps()))
3927 return d_col.get_current_steps();
3930 inline bool has_current()
const
3931 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_col.has_current()))
3933 return d_col.has_current();
3937 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(d_col.next()) &&
3938 noexcept(d_col.has_current()) &&
3939 noexcept(d_cols.next()) &&
3940 noexcept(d_cols.has_current()) &&
3941 noexcept(d_col = d_cols.current()))
3944 if (!d_col.has_current())
3947 if (d_cols.has_current())
3948 d_col = d_cols.current();
3955 typedef typename MT::ColEnumerator RowEnumerator;
3956 typedef typename MT::RowEnumerator ColEnumerator;
3957 typedef typename MT::ConstColEnumerator ConstRowEnumerator;
3958 typedef typename MT::ConstRowEnumerator ConstColEnumerator;
3959 typedef typename MT::DefaultColEnumerator DefaultRowEnumerator;
3960 typedef typename MT::DefaultRowEnumerator DefaultColEnumerator;
3968 static inline DefaultRowEnumerator enumerate_row(
size_type row,
const MT & A)
3969 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.enumerate_col(row)))
3971 return A.enumerate_col(row);
3974 static inline DefaultColEnumerator enumerate_col(
size_type col,
const MT & A)
3975 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.enumerate_row(col)))
3977 return A.enumerate_row(col);
3980 typedef typename MT::ColsEnumerator RowsEnumerator;
3981 typedef typename MT::RowsEnumerator ColsEnumerator;
3982 typedef typename MT::ConstColsEnumerator ConstRowsEnumerator;
3983 typedef typename MT::ConstRowsEnumerator ConstColsEnumerator;
3984 typedef typename MT::DefaultColsEnumerator DefaultRowsEnumerator;
3985 typedef typename MT::DefaultRowsEnumerator DefaultColsEnumerator;
3987 inline DefaultRowsEnumerator enumerate_rows(
const MT & A)
const
3988 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultRowsEnumerator(A.enumerate_cols())))
3990 return DefaultRowsEnumerator(A.enumerate_cols());
3993 inline DefaultColsEnumerator enumerate_cols(
const MT & A)
const
3994 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(DefaultColsEnumerator(A.enumerate_rows())))
3996 return DefaultColsEnumerator(A.enumerate_rows());
4001 template<
typename MatrixType>
4007 is_expression =
true,
4008 only_defined_for_matrices = 1,
4009 can_move_from =
false,
4010 can_assign_to =
false,
4011 can_resize_rows =
false,
4012 can_resize_cols =
false,
4016 typedef typename MatrixInfo<MatrixType>::Type Type;
4017 typedef typename MatrixInfo<MatrixType>::StorageTraits StorageTraits;
4020 template<
typename MatrixType>
4021 struct MatrixInfo<const expressions::ConstMatrixWrapper<MatrixType> >
4026 is_expression =
true,
4027 only_defined_for_matrices = 1,
4028 can_move_from =
false,
4029 can_assign_to =
false,
4030 can_resize_rows =
false,
4031 can_resize_cols =
false,
4035 typedef typename MatrixInfo<MatrixType>::Type Type;
4036 typedef typename MatrixInfo<MatrixType>::StorageTraits StorageTraits;
4039 template<
typename MatrixType>
4045 is_expression =
true,
4046 only_defined_for_matrices = 1,
4054 typedef typename MatrixInfo<MatrixType>::Type Type;
4055 typedef typename MatrixInfo<MatrixType>::StorageTraits StorageTraits;
4058 template<
typename MatrixType>
4064 is_expression =
true,
4065 only_defined_for_matrices = 1,
4073 typedef typename MatrixInfo<MatrixType>::Type Type;
4074 typedef typename MatrixInfo<MatrixType>::StorageTraits StorageTraits;
4077 template<
typename MatrixType>
4078 struct MatrixInfo<expressions::MatrixTemporaryWrapper<MatrixType> >
4083 is_expression =
true,
4084 only_defined_for_matrices = 1,
4085 can_move_from =
true,
4086 can_assign_to =
false,
4087 can_resize_rows =
false,
4088 can_resize_cols =
false,
4089 use_temporary_on_evaluate =
false,
4090 coeffs_are_simple_expressions =
true };
4092 typedef typename MatrixInfo<MatrixType>::Type Type;
4093 typedef typename MatrixInfo<MatrixType>::StorageTraits StorageTraits;
4096 template<
typename MatrixType>
4097 struct MatrixInfo<const expressions::MatrixTemporaryWrapper<MatrixType> >
4102 is_expression =
true,
4103 only_defined_for_matrices = 1,
4104 can_move_from =
true,
4105 can_assign_to =
false,
4106 can_resize_rows =
false,
4107 can_resize_cols =
false,
4108 use_temporary_on_evaluate =
false,
4109 coeffs_are_simple_expressions =
true };
4111 typedef typename MatrixInfo<MatrixType>::Type Type;
4112 typedef typename MatrixInfo<MatrixType>::StorageTraits StorageTraits;
4115 template<
typename ScalarType>
4118 enum { is_matrix =
false,
4120 is_math_object =
true,
4121 is_expression =
true,
4122 can_move_from =
false,
4123 can_assign_to =
false,
4124 can_resize_rows =
false,
4125 can_resize_cols =
false,
4126 use_temporary_on_evaluate =
false,
4127 coeffs_are_simple_expressions =
true };
4128 typedef ScalarType Type;
4131 template<
typename ScalarType>
4134 enum { is_matrix =
false,
4136 is_math_object =
true,
4137 is_expression =
true,
4138 can_move_from =
false,
4139 can_assign_to =
false,
4140 can_resize_rows =
false,
4141 can_resize_cols =
false,
4142 use_temporary_on_evaluate =
false,
4143 coeffs_are_simple_expressions =
true };
4144 typedef ScalarType Type;
4149 template<
typename A,
bool A_is_matrix,
bool A_needs_wrapper,
typename B,
bool B_is_matrix,
bool B_needs_wrapper>
4152 template<
typename A,
typename B>
4159 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Mul_ReturnType(std::make_pair(a.lazy_evaluate(), b.lazy_evaluate()))))
4161 assert(a.cols() == b.rows());
4162 return Mul_ReturnType(std::make_pair(a.lazy_evaluate(), b.lazy_evaluate()));
4165 typedef void Div_ReturnType;
4166 typedef void Mod_ReturnType;
4171 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Add_ReturnType(std::make_pair(a, b))))
4173 assert(a.rows() == b.rows());
4174 assert(a.cols() == b.cols());
4181 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Sub_ReturnType(std::make_pair(a, b))))
4183 assert(a.rows() == b.rows());
4184 assert(a.cols() == b.cols());
4191 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
CwMul_ReturnType(std::make_pair(a, b))))
4193 assert(a.rows() == b.rows());
4194 assert(a.cols() == b.cols());
4201 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
CwDiv_ReturnType(std::make_pair(a, b))))
4203 assert(a.rows() == b.rows());
4204 assert(a.cols() == b.cols());
4211 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
CwMod_ReturnType(std::make_pair(a, b))))
4213 assert(a.rows() == b.rows());
4214 assert(a.cols() == b.cols());
4219 template<
typename A,
typename B>
4224 std::pair<expressions::ConstMatrixWrapper<A>,
typename B::LazyEvalType> >
Mul_ReturnType;
4227 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Mul_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a), b.lazy_evaluate()))))
4229 assert(a.cols() == b.rows());
4230 return Mul_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a), b.lazy_evaluate()));
4233 typedef void Div_ReturnType;
4234 typedef void Mod_ReturnType;
4237 std::pair<expressions::ConstMatrixWrapper<A>, B> >
Add_ReturnType;
4240 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Add_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a), b))))
4242 assert(a.rows() == b.rows());
4243 assert(a.cols() == b.cols());
4244 return Add_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a), b));
4248 std::pair<expressions::ConstMatrixWrapper<A>, B> >
Sub_ReturnType;
4251 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Sub_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a), b))))
4253 assert(a.rows() == b.rows());
4254 assert(a.cols() == b.cols());
4255 return Sub_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a), b));
4262 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
CwMul_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a), b))))
4264 assert(a.rows() == b.rows());
4265 assert(a.cols() == b.cols());
4266 return CwMul_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a), b));
4273 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
CwDiv_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a), b))))
4275 assert(a.rows() == b.rows());
4276 assert(a.cols() == b.cols());
4277 return CwDiv_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a), b));
4284 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
CwMod_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a), b))))
4286 assert(a.rows() == b.rows());
4287 assert(a.cols() == b.cols());
4288 return CwMod_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a), b));
4292 template<
typename A,
typename B>
4297 std::pair<typename A::LazyEvalType, expressions::ConstMatrixWrapper<B> > >
Mul_ReturnType;
4300 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Mul_ReturnType(std::make_pair(a.lazy_evaluate(), expressions::make_matrix_wrapper(b)))))
4302 assert(a.cols() == b.rows());
4303 return Mul_ReturnType(std::make_pair(a.lazy_evaluate(), expressions::make_matrix_wrapper(b)));
4306 typedef void Div_ReturnType;
4307 typedef void Mod_ReturnType;
4310 std::pair<A, expressions::ConstMatrixWrapper<B> > >
Add_ReturnType;
4313 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Add_ReturnType(std::make_pair(a, expressions::make_matrix_wrapper(b)))))
4315 assert(a.rows() == b.rows());
4316 assert(a.cols() == b.cols());
4317 return Add_ReturnType(std::make_pair(a, expressions::make_matrix_wrapper(b)));
4321 std::pair<A, expressions::ConstMatrixWrapper<B> > >
Sub_ReturnType;
4324 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Sub_ReturnType(std::make_pair(a, expressions::make_matrix_wrapper(b)))))
4326 assert(a.rows() == b.rows());
4327 assert(a.cols() == b.cols());
4328 return Sub_ReturnType(std::make_pair(a, expressions::make_matrix_wrapper(b)));
4335 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
CwMul_ReturnType(std::make_pair(a, expressions::make_matrix_wrapper(b)))))
4337 assert(a.rows() == b.rows());
4338 assert(a.cols() == b.cols());
4339 return CwMul_ReturnType(std::make_pair(a, expressions::make_matrix_wrapper(b)));
4346 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
CwDiv_ReturnType(std::make_pair(a, expressions::make_matrix_wrapper(b)))))
4348 assert(a.rows() == b.rows());
4349 assert(a.cols() == b.cols());
4350 return CwDiv_ReturnType(std::make_pair(a, expressions::make_matrix_wrapper(b)));
4357 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
CwMod_ReturnType(std::make_pair(a, expressions::make_matrix_wrapper(b)))))
4359 assert(a.rows() == b.rows());
4360 assert(a.cols() == b.cols());
4361 return CwMod_ReturnType(std::make_pair(a, expressions::make_matrix_wrapper(b)));
4365 template<
typename A,
typename B>
4370 std::pair<expressions::ConstMatrixWrapper<A>,
4374 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Mul_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4375 expressions::make_matrix_wrapper(b)))))
4377 assert(a.cols() == b.rows());
4378 return Mul_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4379 expressions::make_matrix_wrapper(b)));
4382 typedef void Div_ReturnType;
4383 typedef void Mod_ReturnType;
4386 std::pair<expressions::ConstMatrixWrapper<A>,
4390 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Add_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4391 expressions::make_matrix_wrapper(b)))))
4393 assert(a.rows() == b.rows());
4394 assert(a.cols() == b.cols());
4395 return Add_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4396 expressions::make_matrix_wrapper(b)));
4400 std::pair<expressions::ConstMatrixWrapper<A>,
4404 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Sub_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4405 expressions::make_matrix_wrapper(b)))))
4407 assert(a.rows() == b.rows());
4408 assert(a.cols() == b.cols());
4409 return Sub_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4410 expressions::make_matrix_wrapper(b)));
4414 std::pair<expressions::ConstMatrixWrapper<A>,
4418 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
CwMul_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4419 expressions::make_matrix_wrapper(b)))))
4421 assert(a.rows() == b.rows());
4422 assert(a.cols() == b.cols());
4423 return CwMul_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4424 expressions::make_matrix_wrapper(b)));
4428 std::pair<expressions::ConstMatrixWrapper<A>,
4432 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
CwDiv_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4433 expressions::make_matrix_wrapper(b)))))
4435 assert(a.rows() == b.rows());
4436 assert(a.cols() == b.cols());
4437 return CwDiv_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4438 expressions::make_matrix_wrapper(b)));
4442 std::pair<expressions::ConstMatrixWrapper<A>,
4446 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
CwMod_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4447 expressions::make_matrix_wrapper(b)))))
4449 assert(a.rows() == b.rows());
4450 assert(a.cols() == b.cols());
4451 return CwMod_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4452 expressions::make_matrix_wrapper(b)));
4456 template<
typename A,
typename B>
4464 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Mul_ReturnType(std::make_pair(b, expressions::make_scalar_wrapper(a)))))
4466 return Mul_ReturnType(std::make_pair(b, expressions::make_scalar_wrapper(a)));
4469 typedef void Div_ReturnType;
4470 typedef void Mod_ReturnType;
4471 typedef void Add_ReturnType;
4472 typedef void Sub_ReturnType;
4473 typedef void CwMul_ReturnType;
4474 typedef void CwDiv_ReturnType;
4475 typedef void CwMod_ReturnType;
4478 template<
typename A,
typename B>
4483 std::pair<expressions::ConstMatrixWrapper<B>,
4487 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Mul_ReturnType(std::make_pair(expressions::make_matrix_wrapper(b),
4488 expressions::make_scalar_wrapper(a)))))
4490 return Mul_ReturnType(std::make_pair(expressions::make_matrix_wrapper(b),
4491 expressions::make_scalar_wrapper(a)));
4494 typedef void Div_ReturnType;
4495 typedef void Mod_ReturnType;
4496 typedef void Add_ReturnType;
4497 typedef void Sub_ReturnType;
4498 typedef void CwMul_ReturnType;
4499 typedef void CwDiv_ReturnType;
4500 typedef void CwMod_ReturnType;
4503 template<
typename A,
typename B>
4511 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Mul_ReturnType(std::make_pair(a, expressions::make_scalar_wrapper(b)))))
4513 return Mul_ReturnType(std::make_pair(a, expressions::make_scalar_wrapper(b)));
4520 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Div_ReturnType(std::make_pair(a, expressions::make_scalar_wrapper(b)))))
4522 return Div_ReturnType(std::make_pair(a, expressions::make_scalar_wrapper(b)));
4529 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Mod_ReturnType(std::make_pair(a, expressions::make_scalar_wrapper(b)))))
4531 return Mod_ReturnType(std::make_pair(a, expressions::make_scalar_wrapper(b)));
4534 typedef void Add_ReturnType;
4535 typedef void Sub_ReturnType;
4536 typedef void CwMul_ReturnType;
4537 typedef void CwDiv_ReturnType;
4538 typedef void CwMod_ReturnType;
4541 template<
typename A,
typename B>
4546 std::pair<expressions::ConstMatrixWrapper<A>,
4550 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Mul_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4551 expressions::make_scalar_wrapper(b)))))
4553 return Mul_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4554 expressions::make_scalar_wrapper(b)));
4558 std::pair<expressions::ConstMatrixWrapper<A>,
4562 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Div_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4563 expressions::make_scalar_wrapper(b)))))
4565 return Div_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4566 expressions::make_scalar_wrapper(b)));
4570 std::pair<expressions::ConstMatrixWrapper<A>,
4574 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Mod_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4575 expressions::make_scalar_wrapper(b)))))
4577 return Mod_ReturnType(std::make_pair(expressions::make_matrix_wrapper(a),
4578 expressions::make_scalar_wrapper(b)));
4581 typedef void Add_ReturnType;
4582 typedef void Sub_ReturnType;
4583 typedef void CwMul_ReturnType;
4584 typedef void CwDiv_ReturnType;
4585 typedef void CwMod_ReturnType;
4588 template<
typename A,
typename B>
4594 typedef typename BMOII::Mul_ReturnType Mul_ReturnType;
4595 typedef typename BMOII::Div_ReturnType Div_ReturnType;
4596 typedef typename BMOII::Mod_ReturnType Mod_ReturnType;
4597 typedef typename BMOII::Add_ReturnType Add_ReturnType;
4598 typedef typename BMOII::Sub_ReturnType Sub_ReturnType;
4599 typedef typename BMOII::CwMul_ReturnType CwMul_ReturnType;
4600 typedef typename BMOII::CwDiv_ReturnType CwDiv_ReturnType;
4601 typedef typename BMOII::CwMod_ReturnType CwMod_ReturnType;
4603 inline static Mul_ReturnType multiply(
const A & a,
const B & b)
4604 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(BMOII::multiply(a, b)))
4606 return BMOII::multiply(a, b);
4609 inline static Div_ReturnType divide(
const A & a,
const B & b)
4610 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(BMOII::divide(a, b)))
4612 return BMOII::divide(a, b);
4615 inline static Mod_ReturnType modulo(
const A & a,
const B & b)
4616 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(BMOII::modulo(a, b)))
4618 return BMOII::modulo(a, b);
4621 inline static Add_ReturnType add(
const A & a,
const B & b)
4622 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
BMOII::add(a, b)))
4627 inline static Sub_ReturnType sub(
const A & a,
const B & b)
4628 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
BMOII::sub(a, b)))
4633 inline static CwMul_ReturnType componentwise_mul(
const A & a,
const B & b)
4639 inline static CwDiv_ReturnType componentwise_div(
const A & a,
const B & b)
4645 inline static CwMod_ReturnType componentwise_mod(
const A & a,
const B & b)
4654 template<
typename A,
bool A_needs_wrapper>
4657 template<
typename A>
4664 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Neg_ReturnType(a)))
4670 template<
typename A>
4677 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
Neg_ReturnType(expressions::make_matrix_wrapper(a))))
4683 template<
typename A>
4688 typedef typename UMOII::Neg_ReturnType Neg_ReturnType;
4690 inline static Neg_ReturnType negate(
const A & a)
4691 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(UMOII::negate(a)))
4693 return UMOII::negate(a);
4699 template<
typename MT1,
typename MT2>
4705 template<
typename MT2_>
4706 static inline void add_assign_impl(
const MT1 & A,
const MT2_ & B)
4707 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.enumerate()) && noexcept(B.enumerate()) &&
4708 noexcept(helper::make_type_lvalue<typename MT1::Enumerator>().has_current()) &&
4709 noexcept(helper::make_type_lvalue<typename MT2_::ConstEnumerator>().has_current()) &&
4710 noexcept(helper::make_type_lvalue<typename MT1::Enumerator>().next()) &&
4711 noexcept(helper::make_type_lvalue<typename MT2_::ConstEnumerator>().next()) &&
4712 noexcept(helper::make_type_lvalue<typename MT1::Enumerator>().current() += helper::make_type_lvalue<typename MT2_::ConstEnumerator>().current()))
4714 typename MT1::Enumerator eA = A.enumerate();
4715 typename MT2_::ConstEnumerator eB = B.enumerate();
4716 for (; eA.has_current(); eA.next(), eB.next())
4717 eA.current() += eB.current();
4722 template<
typename MT2_>
4723 static inline void sub_assign_impl(
const MT1 & A,
const MT2_ & B)
4724 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.enumerate()) && noexcept(B.enumerate()) &&
4725 noexcept(helper::make_type_lvalue<typename MT1::Enumerator>().has_current()) &&
4726 noexcept(helper::make_type_lvalue<typename MT2_::ConstEnumerator>().has_current()) &&
4727 noexcept(helper::make_type_lvalue<typename MT1::Enumerator>().next()) &&
4728 noexcept(helper::make_type_lvalue<typename MT2_::ConstEnumerator>().next()) &&
4729 noexcept(helper::make_type_lvalue<typename MT1::Enumerator>().current() -= helper::make_type_lvalue<typename MT2_::ConstEnumerator>().current()))
4731 typename MT1::Enumerator eA = A.enumerate();
4732 typename MT2_::ConstEnumerator eB = B.enumerate();
4733 for (; eA.has_current(); eA.next(), eB.next())
4734 eA.current() -= eB.current();
4739 template<
typename MT2_>
4741 #if __cplusplus >= 201103L
4746 assert(A.cols() == B.rows());
4752 #if __cplusplus >= 201103L
4753 A = std::move(temporary);
4759 template<
typename MT2_>
4760 static inline void mul_assign_cw_impl(
const MT1 & A,
const MT2_ & B)
4761 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.enumerate()) &&
4762 noexcept(helper::make_type_lvalue<typename MT1::Enumerator>().has_current()) &&
4763 noexcept(helper::make_type_lvalue<typename MT1::Enumerator>().next()) &&
4764 noexcept(helper::make_type_lvalue<typename MT1::Enumerator>().current() /= B))
4766 typename MT1::Enumerator eA = A.enumerate();
4767 for (; eA.has_current(); eA.next())
4771 template<
typename MT2_>
4773 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(mul_assign_cw_impl(A, B)))
4776 mul_assign_cw_impl(A, B);
4781 template<
typename MT2_>
4782 static inline void div_assign_impl(
const MT1 & A,
const MT2_ & B)
4783 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.enumerate()) &&
4784 noexcept(helper::make_type_lvalue<typename MT1::Enumerator>().has_current()) &&
4785 noexcept(helper::make_type_lvalue<typename MT1::Enumerator>().next()) &&
4786 noexcept(helper::make_type_lvalue<typename MT1::Enumerator>().current() /= B))
4788 typename MT1::Enumerator eA = A.enumerate();
4789 for (; eA.has_current(); eA.next())
4795 template<
typename MT2_>
4796 static inline void mod_assign_impl(
const MT1 & A,
const MT2_ & B)
4797 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.enumerate()) &&
4798 noexcept(helper::make_type_lvalue<typename MT1::Enumerator>().has_current()) &&
4799 noexcept(helper::make_type_lvalue<typename MT1::Enumerator>().next()) &&
4800 noexcept(helper::make_type_lvalue<typename MT1::Enumerator>().current() %= B))
4802 typename MT1::Enumerator eA = A.enumerate();
4803 for (; eA.has_current(); eA.next())
4808 static inline const MT1 & add_assign(
const MT1 & A,
const MT2 & B)
4812 (noexcept(add_assign_impl(A, B)) &&
4823 assert(A.rows() == B.rows());
4824 assert(A.cols() == B.cols());
4829 add_assign_impl(A, temporary);
4832 add_assign_impl(A, B);
4836 static inline const MT1 & sub_assign(
const MT1 & A,
const MT2 & B)
4840 (noexcept(sub_assign_impl(A, B)) &&
4851 assert(A.rows() == B.rows());
4852 assert(A.cols() == B.cols());
4857 sub_assign_impl(A, temporary);
4860 sub_assign_impl(A, B);
4864 static inline const MT1 & mul_assign(
const MT1 & A,
const MT2 & B)
4874 static inline const MT1 & div_assign(
const MT1 & A,
const MT2 & B)
4875 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(div_assign_impl(A, B)))
4880 div_assign_impl(A, B);
4884 static inline const MT1 & mod_assign(
const MT1 & A,
const MT2 & B)
4885 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(mod_assign_impl(A, B)))
4890 mod_assign_impl(A, B);
void assign(const implementation::expressions::expr< DestOp, DestData > &destination, const implementation::expressions::expr< SourceOp, SourceData > &source, helper::BoolToType< move > ittm)
Assigns the content of matrix source to matrix destination. Allows to force move. ...
implementation::BinaryMatrixOperationImpl< base_matrix< T, Rows, Cols, ST, true >, MT >::CwMod_ReturnType componentwise_mod(const base_matrix< T, Rows, Cols, ST, true > &A, const MT &B) PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(implementation::BinaryMatrixOperationImpl< base_matrix< T, Rows, Cols, ST, true >, MT >::componentwise_mod(A, B)))
Computes the componentwise modulo of A with B.
T & make_type_lvalue() PLLL_INTERNAL_NOTHROW_POSTFIX_ENFORCE
This is a pseudo-template which should only be used in expressions which are never evaluated...
implementation::binary_operation_impl< typename helper::remove_decorations< A >::Result, typename helper::remove_decorations< B >::Result, Op >::ResultType ResultType
void swap(base_matrix< T, R, C, ST, MO > &A, base_matrix< T, R, C, ST, MO > &B) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Swaps matrices A and B efficiently.
#define PLLL_INTERNAL_STATIC_CHECK(condition, IdentifierWhichIsAMessage)
Provides information on the result of a binary arithmetic operation.
void add(base_matrix< T, Rows, Cols, ST, true > &result, const MT1 &A, const MT2 &B) PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(assign(result, implementation::BinaryMatrixOperationImpl< MT1, MT2 >::add(A, B))))
Computes the sum of A and B and stores the result in result.
Represents a matrix with coefficients in T.
void setZero(Integer &)
Sets the given integer to zero.
implementation::remove_decorations_impl< A >::result Result
The stripped type.
implementation::unary_operation_impl< typename helper::remove_decorations< A >::Result, Op >::IntermediateType IntermediateType
implementation::binary_operation_impl< typename helper::remove_decorations< A >::Result, typename helper::remove_decorations< B >::Result, Op >::IntermediateType IntermediateType
Conversion from compile-time known bools to types.
implementation::BinaryMatrixOperationImpl< base_matrix< T, Rows, Cols, ST, true >, MT >::CwDiv_ReturnType componentwise_div(const base_matrix< T, Rows, Cols, ST, true > &A, const MT &B) PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(implementation::BinaryMatrixOperationImpl< base_matrix< T, Rows, Cols, ST, true >, MT >::componentwise_div(A, B)))
Computes the componentwise division of A with B.
implementation::BinaryMatrixOperationImpl< base_matrix< T, Rows, Cols, ST, true >, MT >::CwMul_ReturnType componentwise_mul(const base_matrix< T, Rows, Cols, ST, true > &A, const MT &B) PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(implementation::BinaryMatrixOperationImpl< base_matrix< T, Rows, Cols, ST, true >, MT >::componentwise_mul(A, B)))
Computes the componentwise multiplication of A with B.
void add(Integer &r, const Integer &a, const Integer &b)
Adds a and b and stores the result in r.
implementation::unary_operation_impl< typename helper::remove_decorations< A >::Result, Op >::ResultType ResultType
A type selector template.
void sub(base_matrix< T, Rows, Cols, ST, true > &result, const MT1 &A, const MT2 &B) PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(assign(result, implementation::BinaryMatrixOperationImpl< MT1, MT2 >::sub(A, B))))
Computes the difference of A and B and stores the result in result.
Represents a math matrix with coefficients in T.
void sub(Integer &r, const Integer &a, const Integer &b)
Subtracts b from a and stores the result in r.