23 #ifndef PLLL_INCLUDE_GUARD__MATRIX_HPP
24 #define PLLL_INCLUDE_GUARD__MATRIX_HPP
34 #if __cplusplus >= 201103L
49 #ifndef PLLL_DEBUG_MATRIX_DEBUG
50 #define PLLL_DEBUG_OUTPUT_MESSAGE(msg)
52 #define PLLL_DEBUG_OUTPUT_MESSAGE(msg) { std::cout << msg << "\n"; }
55 inline void * getAddress(
const T & t) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
57 return &
const_cast<T &
>(t);
61 inline void * getAddress(
const T * t);
75 namespace implementation
77 template<
typename S,
bool def>
92 const S & ref()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
105 const S & ref()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
143 namespace implementation
145 template<
typename MatrixType>
148 enum { is_matrix =
false,
150 is_math_object =
false,
151 is_expression =
false,
152 can_move_from =
false,
153 can_assign_to =
false,
154 can_resize_rows =
false,
155 can_resize_cols =
false,
156 use_temporary_on_evaluate =
false,
157 coeffs_are_simple_expressions =
false };
158 enum { rows = 0, cols = 0 };
160 typedef void StorageTraits;
164 template<
typename T,
int Rows,
int Cols,
typename StorageTraits,
bool MathObject>
167 namespace implementation
169 template<
typename T,
int Rows,
int Cols,
typename ST,
bool MO>
172 enum { is_matrix =
true,
175 is_expression =
false,
176 only_defined_for_matrices = 1,
177 can_move_from =
true,
178 can_assign_to =
true,
179 can_resize_rows = Rows < 0,
180 can_resize_cols = Cols < 0,
181 use_temporary_on_evaluate =
false,
182 coeffs_are_simple_expressions =
true };
183 enum { rows = Rows, cols = Cols };
185 typedef ST StorageTraits;
188 template<
typename T,
int Rows,
int Cols,
typename ST,
bool MO>
191 enum { is_matrix =
true,
194 is_expression =
false,
195 only_defined_for_matrices = 1,
196 can_move_from =
false,
197 can_assign_to =
true,
198 can_resize_rows =
false,
199 can_resize_cols =
false,
200 use_temporary_on_evaluate =
false,
201 coeffs_are_simple_expressions =
true };
202 enum { rows = Rows, cols = Cols };
204 typedef ST StorageTraits;
208 #if __cplusplus < 201103L
209 template<
typename T,
int Rows,
int Cols,
typename StorageTraits>
212 namespace implementation
214 template<
typename T,
int Rows,
int Cols,
typename ST>
217 enum { is_matrix =
true,
219 is_math_object =
true,
220 is_expression =
false,
221 only_defined_for_matrices = 1,
222 can_move_from =
true,
223 can_assign_to =
true,
224 can_resize_rows = Rows < 0,
225 can_resize_cols = Cols < 0,
226 use_temporary_on_evaluate =
false,
227 coeffs_are_simple_expressions =
true };
228 enum { rows = Rows, cols = Cols };
230 typedef ST StorageTraits;
233 template<
typename T,
int Rows,
int Cols,
typename ST>
236 enum { is_matrix =
true,
238 is_math_object =
true,
239 is_expression =
false,
240 only_defined_for_matrices = 1,
241 can_move_from =
false,
242 can_assign_to =
true,
243 can_resize_rows =
false,
244 can_resize_cols =
false,
245 use_temporary_on_evaluate =
false,
246 coeffs_are_simple_expressions =
true };
247 enum { rows = Rows, cols = Cols };
249 typedef ST StorageTraits;
253 template<
typename T,
int Cols,
typename StorageTraits,
bool MO>
256 namespace implementation
258 template<
typename T,
int Cols,
typename ST,
bool MO>
261 enum { is_matrix =
true,
264 is_expression =
false,
265 only_defined_for_matrices = 1,
266 can_move_from =
true,
267 can_assign_to =
true,
268 can_resize_rows =
false,
269 can_resize_cols = Cols < 0,
270 use_temporary_on_evaluate =
false,
271 coeffs_are_simple_expressions =
true };
272 enum { rows = 1, cols = Cols };
274 typedef ST StorageTraits;
277 template<
typename T,
int Cols,
typename ST,
bool MO>
280 enum { is_matrix =
true,
283 is_expression =
false,
284 only_defined_for_matrices = 1,
285 can_move_from =
false,
286 can_assign_to =
true,
287 can_resize_rows =
false,
288 can_resize_cols =
false,
289 use_temporary_on_evaluate =
false,
290 coeffs_are_simple_expressions =
true };
291 enum { rows = 1, cols = Cols };
293 typedef ST StorageTraits;
297 template<
typename T,
int Rows,
typename StorageTraits,
bool MO>
300 namespace implementation
302 template<
typename T,
int Rows,
typename ST,
bool MO>
305 enum { is_matrix =
true,
308 is_expression =
false,
309 only_defined_for_matrices = 1,
310 can_move_from =
true,
311 can_assign_to =
true,
312 can_resize_rows = Rows < 0,
313 can_resize_cols =
false,
314 use_temporary_on_evaluate =
false,
315 coeffs_are_simple_expressions =
true };
316 enum { rows = Rows, cols = 1 };
318 typedef ST StorageTraits;
321 template<
typename T,
int Rows,
typename ST,
bool MO>
324 enum { is_matrix =
true,
327 is_expression =
false,
328 only_defined_for_matrices = 1,
329 can_move_from =
false,
330 can_assign_to =
true,
331 can_resize_rows =
false,
332 can_resize_cols =
false,
333 use_temporary_on_evaluate =
false,
334 coeffs_are_simple_expressions =
true };
335 enum { rows = Rows, cols = 1 };
337 typedef ST StorageTraits;
341 template<
typename T,
int Cols,
typename StorageTraits>
344 namespace implementation
346 template<
typename T,
int Cols,
typename ST>
349 enum { is_matrix =
true,
351 is_math_object =
true,
352 is_expression =
false,
353 only_defined_for_matrices = 1,
354 can_move_from =
true,
355 can_assign_to =
true,
356 can_resize_rows =
false,
357 can_resize_cols = Cols < 0,
358 use_temporary_on_evaluate =
false,
359 coeffs_are_simple_expressions =
true };
360 enum { rows = 1, cols = Cols };
362 typedef ST StorageTraits;
365 template<
typename T,
int Cols,
typename ST>
368 enum { is_matrix =
true,
370 is_math_object =
true,
371 is_expression =
false,
372 only_defined_for_matrices = 1,
373 can_move_from =
false,
374 can_assign_to =
true,
375 can_resize_rows =
false,
376 can_resize_cols =
false,
377 use_temporary_on_evaluate =
false,
378 coeffs_are_simple_expressions =
true };
379 enum { rows = 1, cols = Cols };
381 typedef ST StorageTraits;
385 template<
typename T,
int Rows,
typename StorageTraits>
388 namespace implementation
390 template<
typename T,
int Rows,
typename ST>
393 enum { is_matrix =
true,
395 is_math_object =
true,
396 is_expression =
false,
397 only_defined_for_matrices = 1,
398 can_move_from =
true,
399 can_assign_to =
true,
400 can_resize_rows = Rows < 0,
401 can_resize_cols =
false,
402 use_temporary_on_evaluate =
false,
403 coeffs_are_simple_expressions =
true };
404 enum { rows = Rows, cols = 1 };
406 typedef ST StorageTraits;
409 template<
typename T,
int Rows,
typename ST>
412 enum { is_matrix =
true,
414 is_math_object =
true,
415 is_expression =
false,
416 only_defined_for_matrices = 1,
417 can_move_from =
false,
418 can_assign_to =
true,
419 can_resize_rows =
false,
420 can_resize_cols =
false,
421 use_temporary_on_evaluate =
false,
422 coeffs_are_simple_expressions =
true };
423 enum { rows = Rows, cols = 1 };
425 typedef ST StorageTraits;
430 namespace implementation
432 namespace expressions
434 template<
template<
typename DataType>
class Operator,
typename Data>
437 template<
typename Data>
438 class identity_operation;
440 template<
typename MatrixType>
443 template<
typename MatrixType>
444 class ConstMatrixWrapper;
446 template<
typename MatrixType>
447 inline MatrixWrapper<MatrixType> make_matrix_wrapper(MatrixType &) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE;
449 template<typename MatrixType>
450 inline ConstMatrixWrapper<MatrixType> make_matrix_wrapper(const MatrixType &) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE;
452 template<typename MatrixType>
453 inline expr<identity_operation, MatrixWrapper<MatrixType> > make_matrix_expression(MatrixType &) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE;
455 template<typename MatrixType>
456 inline expr<identity_operation, ConstMatrixWrapper<MatrixType> > make_matrix_expression(const MatrixType &) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE;
458 template<typename MatrixType>
459 class MatrixTemporaryWrapper;
461 template<typename ScalarType>
464 template<typename ScalarType>
465 inline ScalarWrapper<ScalarType> make_scalar_wrapper(const ScalarType &) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE;
467 template<typename PairMatrices>
468 class matrix_matrix_multiplication;
470 template<typename OpA, typename OpB>
473 template<typename OpA, typename OpB>
476 template<typename OpA, typename OpB>
479 template<typename OpA, typename OpB>
482 template<template<typename OpA, typename OpB> class Operation>
483 class matrix_scalar_operation;
485 template<typename OpA, typename OpB>
488 template<typename OpA, typename OpB>
491 template<typename OpA, typename OpB>
494 template<typename OpA, typename OpB>
497 template<typename OpA, typename OpB>
500 template<template<typename OpA, typename OpB> class Operation>
501 class componentwise_operation;
503 template<typename MTIn>
504 class matrix_negation;
506 template<
int Rows,
int Cols>
510 template<
typename MT>
518 template<
typename MT>
521 template<
typename MT>
525 template<
typename MT>
529 template<
template<
typename DataType>
class Operator,
typename Data>
533 is_const = Operator<Data>::is_const,
535 is_expression =
true,
536 only_defined_for_matrices = 1,
537 can_move_from = Operator<Data>::can_move_from,
538 can_assign_to = Operator<Data>::can_assign_to,
539 can_resize_rows = Operator<Data>::can_resize_rows,
540 can_resize_cols = Operator<Data>::can_resize_cols,
541 use_temporary_on_evaluate = Operator<Data>::use_temporary_on_evaluate,
542 coeffs_are_simple_expressions = Operator<Data>::coeffs_are_simple_expressions };
548 template<
template<
typename DataType>
class Operator,
typename Data>
552 is_const = Operator<Data>::is_const,
554 is_expression =
true,
555 only_defined_for_matrices = 1,
556 can_move_from = Operator<Data>::can_move_from,
557 can_assign_to = Operator<Data>::can_assign_to,
558 can_resize_rows = Operator<Data>::can_resize_rows,
559 can_resize_cols = Operator<Data>::can_resize_cols,
560 use_temporary_on_evaluate = Operator<Data>::use_temporary_on_evaluate,
561 coeffs_are_simple_expressions = Operator<Data>::coeffs_are_simple_expressions };
572 template<
typename T,
int R,
int C,
typename ST,
bool MO>
582 template<
typename T,
int R1,
int C1,
int R2,
int C2,
typename ST,
bool MO1,
bool MO2>
591 namespace implementation
595 template<
template<
typename AData>
class AOp,
typename AData,
template<
typename BData>
class BOp,
typename BData>
597 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(A.enumerate()) && noexcept(B.enumerate()) &&
598 noexcept(
helper::make_type_lvalue<
typename implementation::expressions::expr<AOp, AData>::Enumerator>().has_current()) &&
605 template<
template<
typename AData>
class AOp,
typename AData,
template<
typename BData>
class BOp,
typename BData>
612 void swap(
const implementation::expressions::expr<AOp, AData> & A,
const implementation::expressions::expr<BOp, BData> & B)
613 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(implementation::do_swap(A, B)));
615 template<
template<
typename AData>
class AOp,
typename AData,
616 typename BT,
int BRows,
int BCols,
typename BST,
bool BMO>
623 void swap(
const implementation::expressions::expr<AOp, AData> & A, base_matrix<BT, BRows, BCols, BST, BMO> & B)
624 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
linalg::swap(A, implementation::expressions::make_matrix_expression(B))));
626 template<
typename AT,
int ARows,
int ACols,
typename AST,
bool AMO,
627 template<
typename BData>
class BOp,
typename BData>
634 void swap(base_matrix<AT, ARows, ACols, AST, AMO> & A,
const implementation::expressions::expr<BOp, BData> & B)
635 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
linalg::swap(implementation::expressions::make_matrix_expression(A), B)));
638 int ARows,
int ACols,
typename AST,
bool AMO,
639 int BRows,
int BCols,
typename BST,
bool BMO>
646 void swap(base_matrix<T, ARows, ACols, AST, AMO> & A, base_matrix<T, BRows, BCols, BST, BMO> & B)
647 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
linalg::swap(implementation::expressions::make_matrix_expression(A), implementation::expressions::make_matrix_expression(B))));
653 template<
template<
typename SourceData>
class SourceOp,
typename SourceData,
template<
typename DestData>
class DestOp,
typename DestData,
bool move>
662 void assign(
const implementation::expressions::expr<DestOp, DestData> & destination,
665 template<
template<
typename SourceData>
class SourceOp,
typename SourceData,
template<
typename DestData>
class DestOp,
typename DestData>
672 inline void assign(
const implementation::expressions::expr<DestOp, DestData> & destination,
673 const implementation::expressions::expr<SourceOp, SourceData> & source);
675 template<
typename SourceT,
int SourceRows,
int SourceCols,
typename SourceST,
bool SourceMO,
template<
typename DestData>
class DestOp,
typename DestData>
682 inline void assign(
const implementation::expressions::expr<DestOp, DestData> & destination,
683 const base_matrix<SourceT, SourceRows, SourceCols, SourceST, SourceMO> & source);
685 template<
template<
typename SourceData>
class SourceOp,
typename SourceData,
typename DestT,
int DestRows,
int DestCols,
typename DestST,
bool DestMO>
692 inline void assign(base_matrix<DestT, DestRows, DestCols, DestST, DestMO> & destination,
693 const implementation::expressions::expr<SourceOp, SourceData> & source);
695 template<
typename SourceT,
int SourceRows,
int SourceCols,
typename SourceST,
bool SourceMO,
696 typename DestT,
int DestRows,
int DestCols,
typename DestST,
bool DestMO>
703 inline void assign(base_matrix<DestT, DestRows, DestCols, DestST, DestMO> & destination,
704 const base_matrix<SourceT, SourceRows, SourceCols, SourceST, SourceMO> & source);
706 #if __cplusplus >= 201103L
707 template<
typename SourceT,
int SourceRows,
int SourceCols,
typename SourceST,
bool SourceMO,
template<
typename DestData>
class DestOp,
typename DestData>
714 inline void assign(
const implementation::expressions::expr<DestOp, DestData> & destination,
715 base_matrix<SourceT, SourceRows, SourceCols, SourceST, SourceMO> && source);
717 template<
typename SourceT,
int SourceRows,
int SourceCols,
typename SourceST,
bool SourceMO,
718 typename DestT,
int DestRows,
int DestCols,
typename DestST,
bool DestMO>
725 inline void assign(base_matrix<DestT, DestRows, DestCols, DestST, DestMO> & destination,
726 base_matrix<SourceT, SourceRows, SourceCols, SourceST, SourceMO> && source);
733 template<
template<
typename SourceData>
class SourceOp,
typename SourceData,
template<
typename DestData>
class DestOp,
typename DestData,
bool move>
743 inline void transpose(
const implementation::expressions::expr<DestOp, DestData> & destination,
746 template<
template<
typename SourceData>
class SourceOp,
typename SourceData,
template<
typename DestData>
class DestOp,
typename DestData>
755 inline void transpose(
const implementation::expressions::expr<DestOp, DestData> & destination,
756 const implementation::expressions::expr<SourceOp, SourceData> & source);
758 template<
typename SourceT,
int SourceRows,
int SourceCols,
typename SourceST,
bool SourceMO,
template<
typename DestData>
class DestOp,
typename DestData>
767 inline void transpose(
const implementation::expressions::expr<DestOp, DestData> & destination,
768 const base_matrix<SourceT, SourceRows, SourceCols, SourceST, SourceMO> & source);
770 template<
template<
typename SourceData>
class SourceOp,
typename SourceData,
typename DestT,
int DestRows,
int DestCols,
typename DestST,
bool DestMO>
779 inline void transpose(base_matrix<DestT, DestRows, DestCols, DestST, DestMO> & destination,
780 const implementation::expressions::expr<SourceOp, SourceData> & source);
782 template<
typename SourceT,
int SourceRows,
int SourceCols,
typename SourceST,
bool SourceMO,
783 typename DestT,
int DestRows,
int DestCols,
typename DestST,
bool DestMO>
792 inline void transpose(base_matrix<DestT, DestRows, DestCols, DestST, DestMO> & destination,
793 const base_matrix<SourceT, SourceRows, SourceCols, SourceST, SourceMO> & source);
795 #if __cplusplus >= 201103L
796 template<
typename SourceT,
int SourceRows,
int SourceCols,
typename SourceST,
bool SourceMO,
template<
typename DestData>
class DestOp,
typename DestData>
805 inline void transpose(
const implementation::expressions::expr<DestOp, DestData> & destination,
806 base_matrix<SourceT, SourceRows, SourceCols, SourceST, SourceMO> && source);
808 template<
typename SourceT,
int SourceRows,
int SourceCols,
typename SourceST,
bool SourceMO,
809 typename DestT,
int DestRows,
int DestCols,
typename DestST,
bool DestMO>
818 inline void transpose(base_matrix<DestT, DestRows, DestCols, DestST, DestMO> & destination,
819 base_matrix<SourceT, SourceRows, SourceCols, SourceST, SourceMO> && source);
826 namespace implementation
843 assert(r.rows() == Rows);
846 static inline void set_rows(
size_type r) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
851 static inline size_type rows() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
859 other.set_rows(Rows);
886 inline void set_rows(
size_type rows) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
891 inline size_type rows()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
899 unsigned r = other.rows();
900 other.set_rows(d_rows);
920 assert(c.cols() == Cols);
923 static inline void set_cols(
size_type c) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
928 static inline size_type cols() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
936 other.set_cols(Cols);
963 inline void set_cols(
size_type cols) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
968 inline size_type cols()
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
976 unsigned r = other.cols();
977 other.set_cols(d_cols);
987 template<
typename T,
int Rows = Flexible,
int Cols = Flexible,
typename StorageTraits = storage_traits<T>,
bool MathObject = false>
1021 enum { has_direct_access =
true };
1023 #ifdef PLLL_INTERNAL_NO_TEMPLATE_FRIENDS
1026 template<
typename TT,
int R,
int C,
typename ST,
bool MO>
1027 friend void swap(base_matrix<TT, R, C, ST, MO> &, base_matrix<TT, R, C, ST, MO> &) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE;
1029 template<typename TT,
int R1,
int C1,
int R2,
int C2, typename ST,
bool MO1,
bool MO2>
1030 friend
void swap(
base_matrix<TT, R1, C1, ST, MO1> &,
base_matrix<TT, R2, C2, ST, MO2> &) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE;
1032 template<typename TT,
int RR,
int CC, typename SSTT,
bool MMOO>
1036 inline static
void set_zero(typename StorageTraits::ref_type e, helper::BoolToType<true>)
1037 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(
setZero(e)))
1042 inline static void set_zero(
typename StorageTraits::ref_type, helper::BoolToType<false>)
1043 PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1047 inline static void set_zero(
typename StorageTraits::ref_type e)
1048 PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(set_zero(e, helper::BoolToType<MathObject>())))
1050 set_zero(e, helper::BoolToType<MathObject>());
1054 typename StorageTraits::pointer_type d_data;
1056 template<
typename MatrixType>
1057 inline void create_from(
const MatrixType & mat, helper::BoolToType<true>)
1059 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::create_from(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [1]");
1060 d_data = StorageTraits::clone(mat.data(), implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
1061 StorageTraits::check(d_data, implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
1064 template<
typename MatrixType>
1065 inline void create_from(
const MatrixType & mat, helper::BoolToType<false>)
1067 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::create_from(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [2]");
1068 d_data = StorageTraits::alloc_dontconstruct(implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
1069 StorageTraits::check(d_data, implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
1070 if (mat.get_coeff_alwayszero())
1072 size_type s = implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols();
1073 for (
size_type index = 0; index < s; ++index)
1075 StorageTraits::construct(d_data[index]);
1076 set_zero(d_data[index]);
1081 typename MatrixType::ConstEnumerator e = mat.enumerate();
1082 for (
size_type index = 0; e.has_current(); e.next(), ++index)
1083 if (implementation::MatrixInfo<MatrixType>::coeffs_are_simple_expressions)
1084 StorageTraits::copy_construct(d_data[index], e.current());
1087 typename MatrixType::ConstEnumerator::GetCoeffSteps_Type coeff = e.get_current_steps();
1088 StorageTraits::copy_construct(d_data[index], coeff.step1());
1089 coeff.step2(d_data[index]);
1092 StorageTraits::check(d_data, implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
1095 #if __cplusplus >= 201103L
1096 template<
typename MatrixType>
1097 inline void move_from(MatrixType && mat, helper::BoolToType<true>)
1099 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::create_from(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [1&&]");
1100 d_data = StorageTraits::clone_move(mat.data(), implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
1101 StorageTraits::check(d_data, implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
1104 template<
typename MatrixType>
1105 inline void move_from(MatrixType && mat, helper::BoolToType<false>)
1107 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::create_from(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [2&&]");
1108 d_data = StorageTraits::alloc_dontconstruct(implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
1109 StorageTraits::check(d_data, implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
1110 if (mat.get_coeff_alwayszero())
1112 size_type s = implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols();
1113 for (
size_type index = 0; index < s; ++index)
1115 StorageTraits::construct(d_data[index]);
1116 set_zero(d_data[index]);
1121 typename MatrixType::ConstEnumerator e = mat.enumerate();
1122 for (
size_type index = 0; e.has_current(); e.next(), ++index)
1123 if (implementation::MatrixInfo<MatrixType>::coeffs_are_simple_expressions)
1124 StorageTraits::move_construct(d_data[index], std::move(e.current()));
1127 typename MatrixType::ConstEnumerator::GetCoeffSteps_Type coeff = e.get_current_steps();
1128 StorageTraits::copy_construct(d_data[index], coeff.step1());
1129 coeff.step2(d_data[index]);
1132 StorageTraits::check(d_data, implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
1151 : d_data(StorageTraits::alloc(implementation::row_count_storage<Rows>::
rows() * implementation::col_count_storage<Cols>::
cols()))
1153 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::base_matrix(" << getAddress(*
this) <<
")");
1163 : implementation::row_count_storage<Rows>(mat), implementation::col_count_storage<Cols>(mat),
1164 d_data(StorageTraits::clone(mat.d_data, implementation::row_count_storage<Rows>::
rows() * implementation::col_count_storage<Cols>::
cols()))
1166 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::base_matrix(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [0]");
1175 template<
int Rs,
int Cs,
bool MO>
1177 : implementation::row_count_storage<Rows>(mat), implementation::col_count_storage<Cols>(mat),
1178 d_data(StorageTraits::clone(mat.d_data, implementation::row_count_storage<Rows>::
rows() * implementation::col_count_storage<Cols>::
cols()))
1180 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::base_matrix(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [1]");
1188 #if __cplusplus >= 201103L
1196 : implementation::row_count_storage<Rows>(mat), implementation::col_count_storage<Cols>(mat), d_data(mat.d_data)
1198 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::base_matrix(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [1&&a]");
1210 template<
int Rs,
int Cs,
bool MO>
1211 base_matrix(base_matrix<T, Rs, Cs, StorageTraits, MO> && mat) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1212 : implementation::row_count_storage<Rows>(mat), implementation::col_count_storage<Cols>(mat), d_data(mat.d_data)
1214 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::base_matrix(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [1&&]");
1217 if (Rows >= 0) assert(static_cast<size_type>(Rows) == implementation::row_count_storage<Rows>::rows());
1218 if (Cols >= 0) assert(static_cast<size_type>(Cols) == implementation::col_count_storage<Cols>::cols());
1222 StorageTraits::check(d_data, implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
1231 template<
typename S,
int Rs,
int Cs,
typename ST,
bool MO>
1233 : implementation::row_count_storage<Rows>(mat), implementation::col_count_storage<Cols>(mat),
1234 d_data(StorageTraits::clone(mat.d_data, implementation::row_count_storage<Rows>::
rows() * implementation::col_count_storage<Cols>::
cols()))
1236 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::base_matrix(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [2]");
1244 #if __cplusplus >= 201103L
1250 template<
typename S,
int Rs,
int Cs,
typename ST,
bool MO>
1252 : implementation::row_count_storage<Rows>(mat), implementation::col_count_storage<Cols>(mat),
1253 d_data(StorageTraits::clone_move(mat.d_data, implementation::row_count_storage<Rows>::
rows() * implementation::col_count_storage<Cols>::
cols()))
1255 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::base_matrix(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [2&&]");
1269 template<
template<
typename>
class Op,
typename Data>
1271 : implementation::row_count_storage<Rows>(mat.
rows()), implementation::col_count_storage<Cols>(mat.
cols()), d_data(NULL)
1273 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::base_matrix(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [3]");
1284 #if __cplusplus >= 201103L
1290 template<
template<
typename>
class Op,
typename Data>
1292 : implementation::row_count_storage<Rows>(mat.
rows()), implementation::col_count_storage<Cols>(mat.
cols()), d_data(NULL)
1294 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::base_matrix(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [3&&]");
1319 : implementation::row_count_storage<Rows>(entries), implementation::col_count_storage<Cols>(entries),
1320 d_data(StorageTraits::alloc(implementation::row_count_storage<Rows>::
rows() * implementation::col_count_storage<Cols>::
cols()))
1322 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::base_matrix(" << getAddress(*
this) <<
"; " << entries <<
") [4]");
1337 : implementation::row_count_storage<Rows>(entries), implementation::col_count_storage<Cols>(entries),
1338 d_data(StorageTraits::alloc(implementation::row_count_storage<Rows>::
rows() * implementation::col_count_storage<Cols>::
cols()))
1340 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::base_matrix(" << getAddress(*
this) <<
"; " << entries <<
") [4b]");
1355 template<
typename S,
bool def>
1357 : implementation::row_count_storage<Rows>(entries), implementation::col_count_storage<Cols>(entries),
1358 d_data(StorageTraits::alloc(i.ref(), implementation::row_count_storage<Rows>::
rows() * implementation::col_count_storage<Cols>::
cols()))
1360 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::base_matrix(" << getAddress(*
this) <<
"; " << entries <<
" " << getAddress(i.ref()) <<
") [5]");
1373 : implementation::row_count_storage<Rows>(rows), implementation::col_count_storage<Cols>(cols),
1374 d_data(StorageTraits::alloc(implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols()))
1376 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::base_matrix(" << getAddress(*
this) <<
"; " << rows <<
" " << cols <<
") [6]");
1377 if (Rows >= 0) assert(rows == static_cast<size_type>(Rows));
1378 if (Cols >= 0) assert(cols == static_cast<size_type>(Cols));
1390 template<
typename S,
bool def>
1392 : implementation::row_count_storage<Rows>(rows), implementation::col_count_storage<Cols>(cols),
1393 d_data(StorageTraits::alloc(i.ref(), implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols()))
1395 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::base_matrix(" << getAddress(*
this) <<
"; " << rows <<
" " << cols <<
" " << getAddress(i.ref()) <<
") [7]");
1396 if (Rows >= 0) assert(rows == static_cast<size_type>(Rows));
1397 if (Cols >= 0) assert(cols == static_cast<size_type>(Cols));
1407 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::~base_matrix(" << getAddress(*
this) <<
")");
1418 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::operator = (" << getAddress(*
this) <<
"; " << getAddress(m) <<
") [0]");
1430 template<
typename T_,
int Rows_,
int Cols_,
typename StorageTraits_,
bool MathObject_>
1433 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::operator = (" << getAddress(*
this) <<
"; " << getAddress(m) <<
") [1]");
1445 template<
template<
typename>
class Op,
typename Data>
1448 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::operator = (" << getAddress(*
this) <<
"; " << getAddress(m) <<
") [2]");
1456 #if __cplusplus >= 201103L
1463 PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1465 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::operator = (" << getAddress(*
this) <<
"; " << getAddress(m) <<
") [0&&]");
1470 m.implementation::row_count_storage<Rows>::set_rows(0);
1471 m.implementation::col_count_storage<Cols>::set_cols(0);
1483 template<
typename T_,
int Rows_,
int Cols_,
typename StorageTraits_,
bool MathObject_>
1484 base_matrix<T, Rows, Cols, StorageTraits, MathObject> &
operator = (base_matrix<T_, Rows_, Cols_, StorageTraits_, MathObject_> && m)
1486 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::operator = (" << getAddress(*
this) <<
"; " << getAddress(m) <<
") [1&&]");
1487 StorageTraits::check(d_data, implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
1488 assign(*
this, std::move(m));
1489 StorageTraits::check(d_data, implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
1498 template<
template<
typename>
class Op,
typename Data>
1499 base_matrix<T, Rows, Cols, StorageTraits, MathObject> &
operator = (implementation::expressions::expr<Op, Data> && m)
1501 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::operator = (" << getAddress(*
this) <<
"; " << getAddress(m) <<
") [2&&]");
1502 PLLL_INTERNAL_STATIC_CHECK((implementation::MatrixInfo<implementation::expressions::expr<Op, Data> >::is_matrix), RequiresMatrixType);
1503 StorageTraits::check(d_data, implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
1504 assign(*
this, std::move(m));
1505 StorageTraits::check(d_data, implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
1517 template<
typename ResultType>
1521 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::get_coeff(" << getAddress(*
this) <<
"; " << getAddress(result) <<
" " << i <<
" " << j <<
") const");
1536 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::get_coeff_alwayszero(" << getAddress(*
this) <<
") const");
1546 friend class base_matrix<T, Rows, Cols, StorageTraits, MathObject>;
1549 typename StorageTraits::constref_type d_value;
1551 inline GetCoeffSteps_Type(
typename StorageTraits::constref_type value) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1575 template<
typename ResultType>
1576 inline void step2(ResultType & result)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1594 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::get_coeff_steps(" << getAddress(*
this) <<
"; " << i <<
" " << j <<
") const");
1610 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::operator () (" << getAddress(*
this) <<
"; " << i <<
" " << j <<
") const");
1626 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::operator () (" << getAddress(*
this) <<
"; " << i <<
" " << j <<
")");
1644 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::operator [] (" << getAddress(*
this) <<
"; " << i <<
") const");
1662 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::operator [] (" << getAddress(*
this) <<
"; " << i <<
")");
1674 inline typename StorageTraits::constpointer_type
data() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1676 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::data(" << getAddress(*
this) <<
") const");
1686 inline typename StorageTraits::pointer_type
data() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1688 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::data(" << getAddress(*
this) <<
")");
1699 inline typename StorageTraits::constref_type
data(
size_type i)
const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1701 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::data(" << getAddress(*
this) <<
"; " << i <<
") const");
1712 inline typename StorageTraits::ref_type
data(
size_type i) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
1714 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::data(" << getAddress(*
this) <<
"; " << i <<
")");
1726 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::rows(" << getAddress(*
this) <<
") const");
1737 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::cols(" << getAddress(*
this) <<
") const");
1748 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::size(" << getAddress(*
this) <<
") const");
1761 template<
unsigned SRows,
unsigned SCols>
1766 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::block<" << SRows <<
" " << SCols <<
">(" << getAddress(*
this) <<
"; " << r_ofs <<
" " << c_ofs <<
")");
1770 r_ofs, c_ofs, *
this),
1771 implementation::expressions::make_matrix_wrapper(*
this));
1785 template<
unsigned SRows,
unsigned SCols>
1790 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::block<" << SRows <<
" " << SCols <<
">(" << getAddress(*
this) <<
"; " << r_ofs <<
" " << c_ofs <<
") const");
1794 r_ofs, c_ofs, *
this),
1795 implementation::expressions::make_matrix_wrapper(*
this));
1814 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::block(" << getAddress(*
this) <<
"; " << r_ofs <<
" " << c_ofs <<
" " << rows <<
" " << cols <<
")");
1818 r_ofs, c_ofs, *
this),
1819 implementation::expressions::make_matrix_wrapper(*
this));
1838 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::block(" << getAddress(*
this) <<
"; " << r_ofs <<
" " << c_ofs <<
" " << rows <<
" " << cols <<
") const");
1842 r_ofs, c_ofs, *
this),
1843 implementation::expressions::make_matrix_wrapper(*
this));
1856 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::row(" << getAddress(*
this) <<
"; " << row_index <<
")");
1861 implementation::expressions::make_matrix_wrapper(*
this));
1874 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::row(" << getAddress(*
this) <<
"; " << row_index <<
") const");
1879 implementation::expressions::make_matrix_wrapper(*
this));
1892 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::col(" << getAddress(*
this) <<
"; " << col_index <<
")");
1897 implementation::expressions::make_matrix_wrapper(*
this));
1910 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::col(" << getAddress(*
this) <<
"; " << col_index <<
") const");
1915 implementation::expressions::make_matrix_wrapper(*
this));
1927 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::transpose(" << getAddress(*
this) <<
")");
1930 (implementation::expressions::make_matrix_wrapper(*
this));
1942 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::transpose(" << getAddress(*
this) <<
") const");
1945 (implementation::expressions::make_matrix_wrapper(*
this));
1959 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::resize(" << getAddress(*
this) <<
"; " << new_size <<
") [1]");
1962 assert(((Cols == 1) && ((Rows < 0) || (new_size == static_cast<size_type>(Rows)))) ||
1963 ((Rows == 1) && ((Cols < 0) || (new_size == static_cast<size_type>(Cols)))));
1968 #if __cplusplus >= 201103L
1969 typename StorageTraits::pointer_type new_data = StorageTraits::clone_move(d_data, new_size,
1973 typename StorageTraits::pointer_type new_data = StorageTraits::clone(d_data, new_size,
1997 template<
typename S,
bool def>
2000 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::resize(" << getAddress(*
this) <<
"; " << new_size <<
" " << getAddress(init.ref()) <<
") [1]");
2003 assert(((Cols == 1) && ((Rows < 0) || (new_size == static_cast<size_type>(Rows)))) ||
2004 ((Rows == 1) && ((Cols < 0) || (new_size == static_cast<size_type>(Cols)))));
2009 #if __cplusplus >= 201103L
2010 typename StorageTraits::pointer_type new_data = StorageTraits::clone_move(d_data, new_size,
2014 typename StorageTraits::pointer_type new_data = StorageTraits::clone(d_data, new_size,
2038 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::resize(" << getAddress(*
this) <<
"; " << new_rows <<
" " << new_cols <<
") [2]");
2041 assert((Rows < 0) || (new_rows == static_cast<size_type>(Rows)));
2042 assert((Cols < 0) || (new_cols == static_cast<size_type>(Cols)));
2045 typename StorageTraits::pointer_type new_data = StorageTraits::alloc_dontconstruct(new_rows * new_cols);
2048 size_type source_index = 0, dest_index = 0;
2051 for (
size_type j = (Cols < 0 ? min_cols : Cols); j > 0; --j, ++source_index, ++dest_index)
2052 #
if __cplusplus >= 201103L
2053 StorageTraits::move_construct(new_data[dest_index], std::move(d_data[source_index]));
2055 StorageTraits::copy_construct(new_data[dest_index], d_data[source_index]);
2060 StorageTraits::construct(new_data[dest_index]);
2069 for (; s > 0; --s, ++dest_index)
2070 StorageTraits::construct(new_data[dest_index]);
2090 template<
typename S,
bool def>
2093 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::resize(" << getAddress(*
this) <<
"; " << new_rows <<
" " << new_cols <<
" " << getAddress(init.ref()) <<
") [3]");
2096 assert((Rows < 0) || (new_rows == static_cast<size_type>(Rows)));
2097 assert((Cols < 0) || (new_cols == static_cast<size_type>(Cols)));
2100 typename StorageTraits::pointer_type new_data = StorageTraits::alloc_dontconstruct(new_rows * new_cols);
2103 size_type source_index = 0, dest_index = 0;
2106 for (
size_type j = (Cols < 0 ? min_cols : Cols); j > 0; --j, ++source_index, ++dest_index)
2107 #
if __cplusplus >= 201103L
2108 StorageTraits::move_construct(new_data[dest_index], std::move(d_data[source_index]));
2110 StorageTraits::copy_construct(new_data[dest_index], d_data[source_index]);
2115 StorageTraits::copy_construct(new_data[dest_index], init.ref());
2124 for (; s > 0; --s, ++dest_index)
2125 StorageTraits::copy_construct(new_data[dest_index], init.ref());
2145 template<
typename MatrixType>
2148 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::assign_resize(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
")");
2150 assert((Rows < 0) || (mat.rows() ==
static_cast<size_type>(Rows)));
2151 assert((Cols < 0) || (mat.cols() ==
static_cast<size_type>(Cols)));
2153 size_type new_rows = mat.rows(), new_cols = mat.cols();
2155 typename StorageTraits::pointer_type new_data = StorageTraits::alloc_dontconstruct(new_rows * new_cols);
2157 if (mat.get_coeff_alwayszero())
2160 for (
size_type index = 0; index < s; ++index)
2162 StorageTraits::construct(new_data[index]);
2163 set_zero(new_data[index]);
2168 typename MatrixType::ConstEnumerator e = mat.enumerate();
2169 for (
size_type index = 0; e.has_current(); e.next(), ++index)
2171 StorageTraits::copy_construct(new_data[index], e.current());
2174 typename MatrixType::ConstEnumerator::GetCoeffSteps_Type coeff = e.get_current_steps();
2175 StorageTraits::copy_construct(new_data[index], coeff.step1());
2176 coeff.step2(new_data[index]);
2189 #if __cplusplus >= 201103L
2193 *
this = std::move(mat);
2205 template<
typename MatrixType>
2208 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::assign_resize(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
")");
2211 assert((Rows < 0) || (mat.rows() ==
static_cast<size_type>(Rows)));
2212 assert((Cols < 0) || (mat.cols() ==
static_cast<size_type>(Cols)));
2214 size_type new_rows = mat.rows(), new_cols = mat.cols();
2215 StorageTraits::check(d_data, implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
2216 typename StorageTraits::pointer_type new_data = StorageTraits::alloc_dontconstruct(new_rows * new_cols);
2218 if (mat.get_coeff_alwayszero())
2220 size_type s = implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols();
2221 for (
size_type index = 0; index < s; ++index)
2223 StorageTraits::construct(new_data[index]);
2224 set_zero(new_data[index]);
2229 typename MatrixType::ConstEnumerator e = mat.enumerate();
2230 for (
size_type index = 0; e.has_current(); e.next(), ++index)
2231 if (implementation::MatrixInfo<MatrixType>::coeffs_are_simple_expressions)
2232 StorageTraits::move_construct(new_data[index], std::move(e.current()));
2235 typename MatrixType::ConstEnumerator::GetCoeffSteps_Type coeff = e.get_current_steps();
2236 StorageTraits::copy_construct(new_data[index], coeff.step1());
2237 coeff.step2(new_data[index]);
2241 StorageTraits::check(d_data, implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
2242 StorageTraits::free(d_data, implementation::row_count_storage<Rows>::rows() * implementation::col_count_storage<Cols>::cols());
2245 implementation::row_count_storage<Rows>::set_rows(new_rows);
2246 implementation::col_count_storage<Cols>::set_cols(new_cols);
2258 template<
typename MatrixType>
2261 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::assign_resize(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
")");
2264 assert((Rows < 0) || (mat.rows() ==
static_cast<size_type>(Rows)));
2265 assert((Cols < 0) || (mat.cols() ==
static_cast<size_type>(Cols)));
2267 size_type new_rows = mat.rows(), new_cols = mat.cols();
2268 typename StorageTraits::pointer_type new_data = StorageTraits::alloc_dontconstruct(new_rows * new_cols);
2270 if (mat.get_coeff_alwayszero())
2273 for (
size_type index = 0; index < s; ++index)
2275 StorageTraits::construct(new_data[index]);
2276 set_zero(new_data[index]);
2281 typename MatrixType::ConstEnumerator e = mat.enumerate();
2282 for (
size_type index = 0; e.has_current(); e.next(), ++index)
2284 StorageTraits::copy_construct(new_data[index], e.current());
2287 typename MatrixType::ConstEnumerator::GetCoeffSteps_Type coeff = e.get_current_steps();
2288 StorageTraits::copy_construct(new_data[index], coeff.step1());
2289 coeff.step2(new_data[index]);
2307 template<
typename MatrixType>
2310 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::swap(" << getAddress(*
this) <<
"; " << getAddress(B) <<
")");
2325 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::involves_this_matrix(" << getAddress(*
this) <<
"; " << getAddress(A) <<
") [1]");
2337 template<
typename MatrixType>
2340 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::involves_this_matrix(" << getAddress(*
this) <<
"; " << getAddress(A) <<
") [2]");
2352 template<
typename MatrixType>
2355 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_matrix::test_involvement(" << getAddress(*
this) <<
"; " << getAddress(A) <<
")");
2356 return A.involves_this_matrix(*
this);
2359 class ConstEnumerator;
2387 : d_entry(entry), d_left(left)
2406 template<
typename Result>
2407 inline void get_current(Result & result)
const PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = *d_entry))
2438 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2469 : d_entry(e.d_entry), d_left(e.d_left)
2473 #if __cplusplus >= 201103L
2475 : d_entry(e.d_entry), d_left(e.d_left)
2480 inline ConstEnumerator(
const T * entry,
size_type left) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2481 : d_entry(entry), d_left(left)
2500 template<
typename Result>
2501 inline void get_current(Result & result)
const PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = *d_entry))
2532 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2539 typedef Enumerator DefaultEnumerator;
2541 typedef Enumerator RowEnumerator;
2542 typedef ConstEnumerator ConstRowEnumerator;
2543 typedef DefaultEnumerator DefaultRowEnumerator;
2545 class ConstColEnumerator;
2590 template<
typename Result>
2591 inline void get_current(Result & result)
const PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = *d_entry))
2622 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2655 #if __cplusplus >= 201103L
2657 : implementation::col_count_storage<Cols>(e), d_left(e.d_left), d_entry(e.d_entry)
2662 inline ConstColEnumerator(
const T * entry,
size_type left,
size_type cols) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2682 template<
typename Result>
2683 inline void get_current(Result & result)
const PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result = *d_entry))
2714 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2721 typedef ColEnumerator DefaultColEnumerator;
2728 inline Enumerator
enumerate() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2730 return Enumerator(d_data,
size());
2738 inline ConstEnumerator
enumerate() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2740 return ConstEnumerator(d_data,
size());
2752 return RowEnumerator(d_data +
row *
cols(),
cols());
2764 return ConstRowEnumerator(d_data +
row *
cols(),
cols());
2776 return ColEnumerator(d_data +
col,
rows(),
cols());
2788 return ConstColEnumerator(d_data +
col,
rows(),
cols());
2791 class ConstRowsEnumerator;
2842 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2871 #if __cplusplus >= 201103L
2873 : implementation::col_count_storage<Cols>(e), d_left(e.d_left), d_entry(e.d_entry)
2878 inline ConstRowsEnumerator(
const T * entry,
size_type rows,
size_type cols) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2909 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2916 class ConstColsEnumerator;
2968 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
2997 #if __cplusplus >= 201103L
2999 : implementation::row_count_storage<Rows>(e), d_left(e.d_left), d_entry(e.d_entry)
3004 inline ConstColsEnumerator(
const T * entry,
size_type rows,
size_type cols) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3035 inline void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3042 typedef RowsEnumerator DefaultRowsEnumerator;
3043 typedef ColsEnumerator DefaultColsEnumerator;
3052 return RowsEnumerator(d_data,
rows(),
cols());
3060 inline ConstRowsEnumerator
enumerate_rows() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3062 return ConstRowsEnumerator(d_data,
rows(),
cols());
3072 return ColsEnumerator(d_data,
rows(),
cols());
3080 inline ConstColsEnumerator
enumerate_cols() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
3082 return ConstColsEnumerator(d_data,
rows(),
cols());
3086 #if __cplusplus >= 201103L
3087 template<
typename T,
int Rows = Flexible,
int Cols = Flexible,
typename StorageTraits = storage_traits<T> >
3110 using math_matrix = base_matrix<T, Rows, Cols, StorageTraits, true>;
3112 template<
typename T,
int Cols = Flexible,
typename StorageTraits = storage_traits<T>,
bool MathObject = false>
3131 using base_rowvector = base_matrix<T, 1, Cols, StorageTraits, MathObject>;
3133 template<
typename T,
int Rows = Flexible,
typename StorageTraits = storage_traits<T>,
bool MathObject = false>
3152 using base_colvector = base_matrix<T, Rows, 1, StorageTraits, MathObject>;
3154 template<
typename T,
int Cols = Flexible,
typename StorageTraits = storage_traits<T> >
3169 using math_rowvector = base_rowvector<T, Cols, StorageTraits, true>;
3171 template<
typename T,
int Rows = Flexible,
typename StorageTraits = storage_traits<T> >
3186 using math_colvector = base_colvector<T, Rows, StorageTraits, true>;
3192 template<
typename T,
int Rows = Flexible,
int Cols = Flexible,
typename StorageTraits = storage_traits<T> >
3215 class math_matrix :
public base_matrix<T, Rows, Cols, StorageTraits, true>
3218 enum { has_direct_access = base_matrix<T, Rows, Cols, StorageTraits, true>::has_direct_access };
3226 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_matrix::math_matrix(" << getAddress(*
this) <<
") [1]");
3236 : base_matrix<T, Rows, Cols, StorageTraits, true>(mat)
3238 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_matrix::math_matrix(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [2]");
3247 : base_matrix<T, Rows, Cols, StorageTraits, true>(mat)
3249 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_matrix::math_matrix(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [3]");
3258 : base_matrix<T, Rows, Cols, StorageTraits, true>(mat)
3260 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_matrix::math_matrix(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [3.b]");
3268 template<
typename S,
int Rs,
int Cs,
typename ST,
bool MO>
3270 : base_matrix<T, Rows, Cols, StorageTraits, true>(mat)
3272 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_matrix::math_matrix(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [4]");
3280 template<
typename MatrixType>
3282 : base_matrix<T, Rows, Cols, StorageTraits, true>(mat)
3284 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_matrix::math_matrix(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [5]");
3297 : base_matrix<T, Rows, Cols, StorageTraits, true>(entries)
3299 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_matrix::math_matrix(" << getAddress(*
this) <<
"; " << entries <<
") [6]");
3312 : base_matrix<T, Rows, Cols, StorageTraits, true>(entries)
3314 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_matrix::math_matrix(" << getAddress(*
this) <<
"; " << entries <<
") [6b]");
3327 template<
typename S,
bool def>
3329 : base_matrix<T, Rows, Cols, StorageTraits, true>(entries, i)
3331 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_matrix::math_matrix(" << getAddress(*
this) <<
"; " << entries <<
" " << getAddress(i.ref()) <<
") [7]");
3342 : base_matrix<T, Rows, Cols, StorageTraits, true>(rows, cols)
3344 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_matrix::math_matrix(" << getAddress(*
this) <<
"; " << rows <<
" " << cols <<
") [8]");
3355 template<
typename S,
bool def>
3357 : base_matrix<T, Rows, Cols, StorageTraits, true>(rows, cols, i)
3359 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_matrix::math_matrix(" << getAddress(*
this) <<
"; " << rows <<
" " << cols <<
" " << getAddress(i.ref()) <<
") [9]");
3367 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_matrix::~math_matrix(" << getAddress(*
this) <<
")");
3375 template<
typename MatrixType>
3378 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_matrix::operator = (" << getAddress(*
this) <<
"; " << getAddress(m) <<
")");
3406 template<
typename T,
int Cols = Flexible,
typename StorageTraits = storage_traits<T>,
bool MathObject = false>
3407 class base_rowvector :
public base_matrix<T, 1, Cols, StorageTraits, MathObject>
3410 enum { has_direct_access = base_matrix<T, 1, Cols, StorageTraits, MathObject>::has_direct_access };
3418 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_rowvector::base_rowvector(" << getAddress(*
this) <<
") [1]");
3428 : base_matrix<T, 1, Cols, StorageTraits, MathObject>(mat)
3430 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_rowvector::base_rowvector(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [2]");
3439 : base_matrix<T, 1, Cols, StorageTraits, MathObject>(mat)
3441 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_rowvector::base_rowvector(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [3]");
3449 template<
typename S,
int Rs,
int Cs,
typename ST,
bool MO>
3451 : base_matrix<T, 1, Cols, StorageTraits, MathObject>(mat)
3453 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_rowvector::base_rowvector(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [4]");
3461 template<
typename MatrixType>
3463 : base_matrix<T, 1, Cols, StorageTraits, MathObject>(mat)
3465 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_rowvector::base_rowvector(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [5]");
3475 : base_matrix<T, 1, Cols, StorageTraits, MathObject>(entries)
3477 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_rowvector::base_rowvector(" << getAddress(*
this) <<
"; " << entries <<
") [6]");
3487 : base_matrix<T, 1, Cols, StorageTraits, MathObject>(entries)
3489 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_rowvector::base_rowvector(" << getAddress(*
this) <<
"; " << entries <<
") [6b]");
3499 template<
typename S,
bool def>
3501 : base_matrix<T, 1, Cols, StorageTraits, MathObject>(entries, i)
3503 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_rowvector::base_rowvector(" << getAddress(*
this) <<
"; " << entries <<
" " << getAddress(i.ref()) <<
") [7]");
3514 : base_matrix<T, 1, Cols, StorageTraits, MathObject>(rows, cols)
3516 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_rowvector::base_rowvector(" << getAddress(*
this) <<
"; " << rows <<
" " << cols <<
") [8]");
3527 template<
typename S,
bool def>
3529 : base_matrix<T, 1, Cols, StorageTraits, MathObject>(rows, cols, i)
3531 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_rowvector::base_rowvector(" << getAddress(*
this) <<
"; " << rows <<
" " << cols <<
" " << getAddress(i.ref()) <<
") [9]");
3539 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_rowvector::~base_rowvector(" << getAddress(*
this) <<
")");
3547 template<
typename MatrixType>
3550 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_rowvector::operator = (" << getAddress(*
this) <<
"; " << getAddress(m) <<
")");
3578 template<
typename T,
int Rows = Flexible,
typename StorageTraits = storage_traits<T>,
bool MathObject = false>
3579 class base_colvector :
public base_matrix<T, Rows, 1, StorageTraits, MathObject>
3582 enum { has_direct_access = base_matrix<T, Rows, 1, StorageTraits, MathObject>::has_direct_access };
3590 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_colvector::base_colvector(" << getAddress(*
this) <<
") [1]");
3600 : base_matrix<T, Rows, 1, StorageTraits, MathObject>(mat)
3602 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_colvector::base_colvector(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [2]");
3611 : base_matrix<T, Rows, 1, StorageTraits, MathObject>(mat)
3613 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_colvector::base_colvector(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [3]");
3621 template<
typename S,
int Rs,
int Cs,
typename ST,
bool MO>
3623 : base_matrix<T, Rows, 1, StorageTraits, MathObject>(mat)
3625 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_colvector::base_colvector(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [4]");
3633 template<
typename MatrixType>
3635 : base_matrix<T, Rows, 1, StorageTraits, MathObject>(mat)
3637 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_colvector::base_colvector(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [5]");
3647 : base_matrix<T, Rows, 1, StorageTraits, MathObject>(entries)
3649 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_colvector::base_colvector(" << getAddress(*
this) <<
"; " << entries <<
") [6]");
3659 : base_matrix<T, Rows, 1, StorageTraits, MathObject>(entries)
3661 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_colvector::base_colvector(" << getAddress(*
this) <<
"; " << entries <<
") [6b]");
3671 template<
typename S,
bool def>
3673 : base_matrix<T, Rows, 1, StorageTraits, MathObject>(entries, i)
3675 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_colvector::base_colvector(" << getAddress(*
this) <<
"; " << entries <<
" " << getAddress(i.ref()) <<
") [7]");
3686 : base_matrix<T, Rows, 1, StorageTraits, MathObject>(rows, cols)
3688 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_colvector::base_colvector(" << getAddress(*
this) <<
"; " << rows <<
" " << cols <<
") [8]");
3699 template<
typename S,
bool def>
3701 : base_matrix<T, Rows, 1, StorageTraits, MathObject>(rows, cols, i)
3703 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_colvector::base_colvector(" << getAddress(*
this) <<
"; " << rows <<
" " << cols <<
" " << getAddress(i.ref()) <<
") [9]");
3711 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_colvector::~base_colvector(" << getAddress(*
this) <<
")");
3719 template<
typename MatrixType>
3722 PLLL_DEBUG_OUTPUT_MESSAGE(
"base_colvector::operator = (" << getAddress(*
this) <<
"; " << getAddress(m) <<
")");
3746 template<
typename T,
int Cols = Flexible,
typename StorageTraits = storage_traits<T> >
3747 class math_rowvector :
public base_rowvector<T, Cols, StorageTraits, true>
3750 enum { has_direct_access = base_rowvector<T, Cols, StorageTraits, true>::has_direct_access };
3758 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_rowvector::math_rowvector(" << getAddress(*
this) <<
") [1]");
3770 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_rowvector::math_rowvector(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [2]");
3781 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_rowvector::math_rowvector(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [3]");
3789 template<
typename S,
int Rs,
int Cs,
typename ST,
bool MO>
3793 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_rowvector::math_rowvector(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [4]");
3801 template<
typename MatrixType>
3805 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_rowvector::math_rowvector(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [5]");
3817 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_rowvector::math_rowvector(" << getAddress(*
this) <<
"; " << entries <<
") [6]");
3829 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_rowvector::math_rowvector(" << getAddress(*
this) <<
"; " << entries <<
") [6b]");
3839 template<
typename S,
bool def>
3843 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_rowvector::math_rowvector(" << getAddress(*
this) <<
"; " << entries <<
" " << getAddress(i.ref()) <<
") [7]");
3856 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_rowvector::math_rowvector(" << getAddress(*
this) <<
"; " << rows <<
" " << cols <<
") [8]");
3867 template<
typename S,
bool def>
3871 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_rowvector::math_rowvector(" << getAddress(*
this) <<
"; " << rows <<
" " << cols <<
" " << getAddress(i.ref()) <<
") [9]");
3879 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_rowvector::~math_rowvector(" << getAddress(*
this) <<
")");
3887 template<
typename MatrixType>
3890 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_rowvector::operator = (" << getAddress(*
this) <<
"; " << getAddress(m) <<
")");
3914 template<
typename T,
int Rows = Flexible,
typename StorageTraits = storage_traits<T> >
3915 class math_colvector :
public base_colvector<T, Rows, StorageTraits, true>
3918 enum { has_direct_access = base_colvector<T, Rows, StorageTraits, true>::has_direct_access };
3926 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_colvector::math_colvector(" << getAddress(*
this) <<
") [1]");
3938 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_colvector::math_colvector(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [2]");
3949 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_colvector::math_colvector(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [3]");
3957 template<
typename S,
int Rs,
int Cs,
typename ST,
bool MO>
3961 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_colvector::math_colvector(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [4]");
3969 template<
typename MatrixType>
3973 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_colvector::math_colvector(" << getAddress(*
this) <<
"; " << getAddress(mat) <<
") [5]");
3985 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_colvector::math_colvector(" << getAddress(*
this) <<
"; " << entries <<
") [6]");
3997 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_colvector::math_colvector(" << getAddress(*
this) <<
"; " << entries <<
") [6b]");
4007 template<
typename S,
bool def>
4011 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_colvector::math_colvector(" << getAddress(*
this) <<
"; " << entries <<
" " << getAddress(i.ref()) <<
") [7]");
4024 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_colvector::math_colvector(" << getAddress(*
this) <<
"; " << rows <<
" " << cols <<
") [8]");
4035 template<
typename S,
bool def>
4039 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_colvector::math_colvector(" << getAddress(*
this) <<
"; " << rows <<
" " << cols <<
" " << getAddress(i.ref()) <<
") [9]");
4047 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_colvector::~math_colvector(" << getAddress(*
this) <<
")");
4055 template<
typename MatrixType>
4058 PLLL_DEBUG_OUTPUT_MESSAGE(
"math_colvector::operator = (" << getAddress(*
this) <<
"; " << getAddress(m) <<
")");
4072 namespace implementation
4074 template<
typename MatrixType,
int Rows,
int Cols,
bool forceGeneric>
4078 static void print(std::ostream & s,
const MatrixType & mat)
4080 PLLL_DEBUG_OUTPUT_MESSAGE(
"MatrixPrinter::operator () (" << getAddress(s) <<
" " << getAddress(mat) <<
") [0]");
4081 s <<
"mat<" << mat.rows() <<
"," << mat.cols() <<
">[";
4083 for (
typename MatrixType::ConstRowsEnumerator re = mat.enumerate_rows(); re.has_current(); re.next())
4091 for (
typename MatrixType::ConstRowsEnumerator::Type e = re.current(); e.has_current(); e.next())
4105 template<
typename MatrixType,
int Rows>
4109 static void print(std::ostream & s,
const MatrixType & mat)
4111 PLLL_DEBUG_OUTPUT_MESSAGE(
"MatrixPrinter::operator () (" << getAddress(s) <<
" " << getAddress(mat) <<
") [1]");
4112 s <<
"vec<" << mat.rows() <<
">[";
4114 for (
typename MatrixType::ConstEnumerator e = mat.enumerate(); e.has_current(); e.next())
4137 template<
typename MatrixType,
bool forceGeneric>
4140 PLLL_DEBUG_OUTPUT_MESSAGE(
"print_matrix(" << getAddress(s) <<
" " << getAddress(mat) <<
")");
4156 template<
typename MatrixType>
4157 inline void print_matrix(std::ostream & s,
const MatrixType & mat,
bool forceGeneric =
false)
4159 PLLL_DEBUG_OUTPUT_MESSAGE(
"print_matrix(" << getAddress(s) <<
" " << getAddress(mat) <<
" " << forceGeneric <<
")");
4161 print_matrix<MatrixType, true>(s, mat);
4163 print_matrix<MatrixType, false>(s, mat);
4174 template<
typename T,
int Rows,
int Cols,
typename ST,
bool MO>
4175 inline std::ostream & operator << (std::ostream & s, const base_matrix<T, Rows, Cols, ST, MO> & mat)
4177 PLLL_DEBUG_OUTPUT_MESSAGE(
"operator << (" << getAddress(s) <<
" " << getAddress(mat) <<
") [1]");
4190 template<
template<
typename DataType>
class Operator,
typename Data>
4191 inline std::ostream & operator << (std::ostream & s, const implementation::expressions::expr<Operator, Data> & mat)
4193 PLLL_DEBUG_OUTPUT_MESSAGE(
"operator << (" << getAddress(s) <<
" " << getAddress(mat) <<
") [4]");
4202 namespace implementation
4204 template<
typename MatrixType,
int Rows,
int Cols>
4208 template<
typename S>
4209 static inline bool scan(std::istream & s, MatrixType & mat,
const S & DefaultObject)
4211 PLLL_DEBUG_OUTPUT_MESSAGE(
"MatrixScanner::operator () (" << getAddress(s) <<
" " << getAddress(mat) <<
") [0]");
4212 if (!s)
return false;
4215 while (std::isspace(c) && s)
4217 if (!s)
return false;
4219 bool is_vector =
false;
4220 int mrows = -1, mcols = -1;
4234 while (std::isspace(c) && s)
4241 if (!s || (mrows < 0))
4243 if ((Rows >= 0) && (mrows != Rows))
4249 while (std::isspace(c) && s)
4254 while (std::isspace(c) && s)
4259 if (!s || (mcols < 0))
4261 if ((Cols >= 0) && (mcols != Cols))
4267 while (std::isspace(c) && s)
4278 if ((Cols >= 0) && (mcols != Cols))
4293 while (std::isspace(c) && s)
4298 if (!s || (mrows < 0))
4300 if ((Rows >= 0) && (mrows != Rows))
4306 while (std::isspace(c) && s)
4316 while (std::isspace(c) && s)
4318 if ((c !=
'[') || !s)
4321 std::list<typename implementation::MatrixInfo<MatrixType>::Type> vals;
4326 while (std::isspace(c) && s)
4336 while (std::isspace(c) && s)
4351 while (std::isspace(c) && s)
4357 if ((c ==
']') && (i == cols))
4364 vals.push_back(DefaultObject);
4379 while (std::isspace(c) && s)
4385 while (std::isspace(c) && s)
4401 if ((static_cast<size_type>(mrows) != rows) || (static_cast<size_type>(mcols) != cols))
4408 typename std::list<typename implementation::MatrixInfo<MatrixType>::Type>::iterator it = vals.begin();
4409 if ((mat.rows() != rows) || (mat.cols() != cols))
4410 mat.resize(rows, cols,
Initialize(DefaultObject));
4411 for (
typename MatrixType::Enumerator e = mat.enumerate(); e.has_current(); e.next(), ++it)
4412 #
if __cplusplus >= 201103L
4413 e.current() = std::move(*it);
4420 static inline bool scan(std::istream & s, MatrixType & mat)
4422 typename implementation::MatrixInfo<MatrixType>::Type def;
4423 return scan(s, mat, def);
4438 template<
typename MatrixType>
4441 PLLL_DEBUG_OUTPUT_MESSAGE(
"scan_matrix(" << getAddress(s) <<
" " << getAddress(mat) <<
")");
4457 template<
typename MatrixType>
4460 PLLL_DEBUG_OUTPUT_MESSAGE(
"scan_matrix(" << getAddress(s) <<
" " << getAddress(mat) <<
")");
4478 template<
typename MatrixType,
typename T>
4479 inline bool scan_matrix(std::istream & s, MatrixType & mat,
const T & default_object)
4481 PLLL_DEBUG_OUTPUT_MESSAGE(
"scan_matrix(" << getAddress(s) <<
" " << getAddress(mat) <<
" " << getAddress(default_object) <<
")");
4499 template<
typename MatrixType,
typename T>
4500 inline bool scan_matrix(std::istream & s,
const MatrixType & mat,
const T & default_object)
4502 PLLL_DEBUG_OUTPUT_MESSAGE(
"scan_matrix(" << getAddress(s) <<
" " << getAddress(mat) <<
" " << getAddress(default_object) <<
")");
4518 template<
typename T,
int Rows,
int Cols,
typename ST,
bool MO>
4521 PLLL_DEBUG_OUTPUT_MESSAGE(
"operator >> (" << getAddress(s) <<
" " << getAddress(mat) <<
") [1]");
4523 s.setstate(std::ios_base::failbit);
4537 template<
template<
typename DataType>
class Op,
typename Data>
4540 PLLL_DEBUG_OUTPUT_MESSAGE(
"operator >> (" << getAddress(s) <<
" " << getAddress(mat) <<
") [2]");
4543 s.setstate(std::ios_base::failbit);
base_rowvector(size_type entries)
Creates a row vector with entries entries. Its coefficients are default-constructed.
math_rowvector(int entries)
Creates a row vector with entries entries. Its coefficients are default-constructed.
~math_matrix() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Releases the memory allocated for the matrix.
base_colvector()
Creates a new column vector. The dimensions are set to zero if no compile-time dimensions were specif...
bool has_current() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns true if a current element exists and can be queried by the current(), get_current() and get_c...
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. ...
math_colvector(size_type rows, size_type cols, const implementation::Initialize_Impl< S, def > &i)
Creates a column vector with cols entries. Its coefficients are copy-constructed from i...
math_colvector(const MatrixType &mat)
Creates a copy of the column vector mat.
const T & Type
The final type of the coefficients.
ColEnumerator enumerate_col(size_type col) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Enumerates all entries of the given column.
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...
Memory management for matrix and vector operations.
Allows to retrieve a coefficient of the matrix in two steps.
ConstRowEnumerator enumerate_row(size_type row) const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Enumerates all entries of the given row.
base_matrix(size_type entries, const implementation::Initialize_Impl< S, def > &i)
Creates a vector with entries entries. Its coefficients are copy-constructed from i...
base_rowvector< T, Cols, StorageTraits, MathObject > & operator=(const MatrixType &m)
Copies the contents of the row vector m into *this.
math_matrix(const math_matrix< T, Rows, Cols, StorageTraits > &mat)
Creates a copy of the matrix mat.
RowEnumerator enumerate_row(size_type row) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Enumerates all entries of the given row.
math_matrix(size_type entries, const implementation::Initialize_Impl< S, def > &i)
Creates a vector with entries entries. Its coefficients are copy-constructed from i...
An enumerator for a matrix' column.
Type current() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns the current matrix entry.
StorageTraits::constref_type data(size_type i) const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns a (raw) reference to the i-th entry.
const T & Type
The final type of the coefficients.
Enumerates over all rows. For every row, a RowsEnumerator::RowEnumerator object is returned which all...
math_rowvector()
Creates a new row vector. The dimensions are set to zero if no compile-time dimensions were specified...
void resize(size_type new_rows, size_type new_cols, const implementation::Initialize_Impl< S, def > &init)
Resizes the matrix to new_rows times new_cols entries. If the new matrix has entries which cannot be ...
std::istream & operator>>(std::istream &s, base_matrix< T, Rows, Cols, ST, MO > &mat)
Reads a matrix from the input stream s and stores it in mat.
size_type rows() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns the number of rows of the matrix.
bool has_current() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns true if a current row exists and can be queried by the current() method.
void get_current(Result &result) const PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result=*d_entry))
Creates a copy of the current matrix entry in result.
void resize(size_type new_size)
Resizes the vector to new_size entries. If new_size exceeds the current size, new elements are defaul...
base_matrix(const base_matrix< T, Rs, Cs, StorageTraits, MO > &mat)
Creates a copy of the matrix mat.
size_type size() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns the number of entries of the matrix. This equals rows() * cols().
void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Goes to the next element.
Enumerates over all columns. For every column, a ColsEnumerator::ColEnumerator object is returned whi...
~base_matrix() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Releases the memory allocated for the matrix.
Operator instantiations for matrices and vectors.
Type current() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns the current matrix entry.
base_colvector(const base_matrix< T, Rows, 1, StorageTraits, MO > &mat)
Creates a copy of the column vector mat.
~math_colvector() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Releases the memory allocated for the column vector.
base_colvector(size_type rows, size_type cols)
Creates a column vector with cols entries. Its coefficients are default-constructed.
math_rowvector(size_type rows, size_type cols)
Creates a row vector with cols entries. Its coefficients are default-constructed. ...
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)
implementation::expressions::expr< implementation::expressions::sub< SRows, SCols >::template operation_generic, implementation::expressions::ConstMatrixWrapper< base_matrix< T, Rows, Cols, StorageTraits, MathObject > > > block(size_type r_ofs, size_type c_ofs) const
Returns a submatrix of SRows rows and SCols columns starting at (r_ofs, c_ofs).
math_matrix(const base_matrix< T, Rows, Cols, StorageTraits, MO > &mat)
Creates a copy of the matrix mat.
void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Goes to the next element.
Operator definitions for matrices and vectors.
void step2(ResultType &result) const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Modifies the result returned by step1() to contain the full coefficient.
base_rowvector(const base_matrix< T, 1, Cols, StorageTraits, MO > &mat)
Creates a copy of the row vector mat.
bool has_current() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns true if a current column exists and can be queried by the current() method.
math_colvector(const base_matrix< T, Rows, 1, StorageTraits, MO > &mat)
Creates a copy of the column vector mat.
base_matrix(int entries)
Creates a vector with entries entries. Its coefficients are default-constructed.
void get_current(Result &result) const PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result=*d_entry))
Creates a copy of the current matrix entry in result.
math_rowvector(size_type entries, const implementation::Initialize_Impl< S, def > &i)
Creates a row vector with entries entries. Its coefficients are copy-constructed from i...
base_rowvector(size_type rows, size_type cols, const implementation::Initialize_Impl< S, def > &i)
Creates a row vector with cols entries. Its coefficients are copy-constructed from i...
implementation::expressions::expr< implementation::expressions::sub_1d< Rows >::template operation_col, implementation::expressions::MatrixWrapper< base_matrix< T, Rows, Cols, StorageTraits, MathObject > > > col(size_type col_index)
Returns the col_index-th column of this matrix.
base_rowvector()
Creates a new row vector. The dimensions are set to zero if no compile-time dimensions were specified...
math_colvector(int entries)
Creates a column vector with entries entries. Its coefficients are default-constructed.
Represents a matrix with coefficients in T.
math_rowvector< T, Cols, StorageTraits > & operator=(const MatrixType &m)
Copies the contents of the row vector m into *this.
base_matrix(size_type rows, size_type cols, const implementation::Initialize_Impl< S, def > &i)
Creates a matrix with rows times cols entries. Its coefficients are copy-constructed from i...
Represents a row vector with coefficients in T.
implementation::Initialize_Impl< S, false > Initialize(const S &ref) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Creates an initializer object to initialize with the given reference.
bool test_involvement(const MatrixType &A) const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
For the underlying matrices U of the current expression, calls A.involves_this_matrix(U). Returns true if any of these returns true.
math_rowvector(const math_rowvector< T, Cols, StorageTraits > &mat)
Creates a copy of the row vector mat.
math_colvector(size_type rows, size_type cols)
Creates a column vector with cols entries. Its coefficients are default-constructed.
GetCoeffSteps_Type get_current_steps() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns a GetCoeffSteps_Type object for the current entry.
math_matrix(const base_matrix< T, Rows, Cols, StorageTraits, false > &mat)
Creates a copy of the matrix mat.
base_colvector(size_type rows, size_type cols, const implementation::Initialize_Impl< S, def > &i)
Creates a column vector with cols entries. Its coefficients are copy-constructed from i...
implementation::expressions::expr< implementation::expressions::sub_1d< Rows >::template operation_col, implementation::expressions::ConstMatrixWrapper< base_matrix< T, Rows, Cols, StorageTraits, MathObject > > > col(size_type col_index) const
Returns the col_index-th column of this matrix.
math_matrix(size_type rows, size_type cols, const implementation::Initialize_Impl< S, def > &i)
Creates a matrix with rows times cols entries. Its coefficients are copy-constructed from i...
math_matrix(int entries)
Creates a vector with entries entries. Its coefficients are default-constructed.
GetCoeffSteps_Type get_current_steps() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns a GetCoeffSteps_Type object for the current entry.
math_matrix()
Creates a new matrix. The dimensions are set to zero if no compile-time dimensions were specified...
base_colvector(const base_matrix< S, Rs, Cs, ST, MO > &mat)
Creates a copy of the column vector mat.
base_matrix< T, Rows, Cols, StorageTraits, MathObject > & operator=(const base_matrix< T, Rows, Cols, StorageTraits, MathObject > &m)
Copies the contents of the matrix m into *this.
RowsEnumerator enumerate_rows() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Enumerates all rows. For each row, a row enumerator is given.
void get_current(Result &result) const PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result=*d_entry))
Creates a copy of the current matrix entry in result.
RowEnumerator Type
The row enumerator type.
size_type cols() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns the number of columns of the matrix.
implementation::expressions::expr< implementation::expressions::sub< Flexible, Flexible >::template operation_generic, implementation::expressions::MatrixWrapper< base_matrix< T, Rows, Cols, StorageTraits, MathObject > > > block(size_type r_ofs, size_type c_ofs, size_type rows, size_type cols)
Returns a submatrix of rows rows and cols columns starting at (r_ofs, c_ofs).
void get_coeff(ResultType &result, size_type i, size_type j) const PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result=d_data[i *implementation::col_count_storage< Cols >::cols()+j]))
Retrieves the coefficient (i, j) and stores its value into result.
void setZero(Integer &)
Sets the given integer to zero.
GetCoeffSteps_Type get_current_steps() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns a GetCoeffSteps_Type object for the current entry.
math_colvector(size_type entries)
Creates a column vector with entries entries. Its coefficients are default-constructed.
ConstRowsEnumerator enumerate_rows() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Enumerates all rows. For each row, a row enumerator is given.
void print_matrix(std::ostream &s, const MatrixType &mat)
Prints the given matrix mat to the output stream s.
ConstColsEnumerator enumerate_cols() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Enumerates all columns. For each column, a column enumerator is given.
StorageTraits::constpointer_type data_pointer_type
Return type for the method data() const.
ColEnumerator Type
The row enumerator type.
Enumerates over all columns. For every column, a ConstColsEnumerator::ColEnumerator object is returne...
base_colvector< T, Rows, StorageTraits, MathObject > & operator=(const MatrixType &m)
Copies the contents of the column vector m into *this.
math_rowvector(size_type entries)
Creates a row vector with entries entries. Its coefficients are default-constructed.
bool has_current() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns true if a current column exists and can be queried by the current() method.
void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Goes to the next element.
math_rowvector(const base_matrix< T, 1, Cols, StorageTraits, MO > &mat)
Creates a copy of the row vector mat.
T & Type
The final type of the coefficients.
~base_colvector() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Releases the memory allocated for the column vector.
math_matrix< T, Rows, Cols, StorageTraits > & operator=(const MatrixType &m)
Copies the contents of the matrix m into *this.
base_colvector(const MatrixType &mat)
Creates a copy of the column vector mat.
ConstColEnumerator enumerate_col(size_type col) const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Enumerates all entries of the given column.
StorageTraits::constref_type operator[](size_type i) const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Retrieves and returns the i-th entry of the vector.
StorageTraits::pointer_type data() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns a pointer to the raw data of the matrix.
bool involves_this_matrix(const base_matrix< T, Rows, Cols, StorageTraits, MathObject > &A) const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Tests whether this matrix (or expression) involves A.
base_matrix< T, Rows, Cols, StorageTraits, MathObject >::GetCoeffSteps_Type GetCoeffSteps_Type
The intermediate type of the coefficients, which is returned by current().
implementation::expressions::expr< implementation::expressions::transpose, implementation::expressions::MatrixWrapper< base_matrix< T, Rows, Cols, StorageTraits, MathObject > > > transpose() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns the transpose of this matrix.
math_rowvector(size_type rows, size_type cols, const implementation::Initialize_Impl< S, def > &i)
Creates a row vector with cols entries. Its coefficients are copy-constructed from i...
bool involves_this_matrix(const MatrixType &A) const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Tests whether this matrix (or expression) involves A.
void resize(size_type new_size, const implementation::Initialize_Impl< S, def > &init)
Resizes the vector to new_size entries. If new_size exceeds the current size, new elements are copy-c...
~base_rowvector() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Releases the memory allocated for the row vector.
base_matrix< T, Rows, Cols, StorageTraits, MathObject >::GetCoeffSteps_Type GetCoeffSteps_Type
The intermediate type of the coefficients, which is returned by current().
base_matrix(const base_matrix< S, Rs, Cs, ST, MO > &mat)
Creates a copy of the matrix mat.
base_rowvector(const base_rowvector< T, Cols, StorageTraits > &mat)
Creates a copy of the row vector mat.
StorageTraits::constref_type data_ref_type
Return type for the method data(size_type) const.
math_rowvector(const MatrixType &mat)
Creates a copy of the row vector mat.
implementation::expressions::expr< implementation::expressions::sub< Flexible, Flexible >::template operation_generic, implementation::expressions::ConstMatrixWrapper< base_matrix< T, Rows, Cols, StorageTraits, MathObject > > > block(size_type r_ofs, size_type c_ofs, size_type rows, size_type cols) const
Returns a submatrix of rows rows and cols columns starting at (r_ofs, c_ofs).
Enumerates over all rows. For every row, a ConstRowsEnumerator::RowEnumerator object is returned whic...
ConstColEnumerator Type
The row enumerator type.
Conversion from compile-time known bools to types.
Type current() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns the current matrix entry.
StorageTraits::constref_type operator()(size_type i, size_type j) const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Retrieves and returns the coefficient (i, j).
base_colvector(size_type entries)
Creates a column vector with entries entries. Its coefficients are default-constructed.
void transpose(const implementation::expressions::expr< DestOp, DestData > &destination, const implementation::expressions::expr< SourceOp, SourceData > &source, helper::BoolToType< move > ittm)
Transposes the content of matrix source and stores the result in the matrix destination. Allows to force move.
base_matrix< T, Rows, Cols, StorageTraits, MathObject >::GetCoeffSteps_Type GetCoeffSteps_Type
The intermediate type of the coefficients, which is returned by current().
base_matrix(size_type rows, size_type cols)
Creates a matrix with rows times cols entries. Its coefficients are default-constructed.
bool get_coeff_alwayszero() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Queries whether all coefficients are definitely zero.
math_colvector(const base_matrix< S, Rs, Cs, ST, MO > &mat)
Creates a copy of the column vector mat.
Represents a math row vector with coefficients in T.
void swap(plll::arithmetic::Integer &, plll::arithmetic::Integer &) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Swaps two plll::arithmetic::Integer objects.
base_rowvector(const MatrixType &mat)
Creates a copy of the row vector mat.
An enumerator for a matrix' column.
math_matrix(size_type entries)
Creates a vector with entries entries. Its coefficients are default-constructed.
math_colvector< T, Rows, StorageTraits > & operator=(const MatrixType &m)
Copies the contents of the column vector m into *this.
base_rowvector(size_type rows, size_type cols)
Creates a row vector with cols entries. Its coefficients are default-constructed. ...
GetCoeffSteps_Type get_current_steps() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns a GetCoeffSteps_Type object for the current entry.
void move_resize(const MatrixType &mat)
Resizes the matrix to fit the format of mat and moves the contents of mat to the matrix.
void assign_resize(const MatrixType &mat)
Resizes the matrix to fit the format of mat and assigns the contents of mat to the matrix...
bool has_current() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns true if a current element exists and can be queried by the current(), get_current() and get_c...
bool scan_matrix(std::istream &s, MatrixType &mat)
Reads a matrix from the input stream s and stores it in mat.
T & Type
The final type of the coefficients.
base_colvector(size_type entries, const implementation::Initialize_Impl< S, def > &i)
Creates a column vector with entries entries. Its coefficients are copy-constructed from i...
base_matrix(const implementation::expressions::expr< Op, Data > &mat)
Creates a copy of the matrix mat.
base_rowvector(const base_matrix< S, Rs, Cs, ST, MO > &mat)
Creates a copy of the row vector mat.
StorageTraits::constref_type Step1_Type
The return type for step1().
Represents a math column vector with coefficients in T.
void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Goes to the next element.
Type current() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns a current row's enumerator.
base_matrix< T, Rows, Cols, StorageTraits, MathObject >::GetCoeffSteps_Type GetCoeffSteps_Type
The intermediate type of the coefficients, which is returned by current().
void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Goes to the next element.
math_colvector(const math_colvector< T, Rows, StorageTraits > &mat)
Creates a copy of the column vector mat.
StorageTraits::ref_type data(size_type i) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns a (raw) reference to the i-th entry.
base_colvector(const base_colvector< T, Rows, StorageTraits > &mat)
Creates a copy of the column vector mat.
base_rowvector(int entries)
Creates a row vector with entries entries. Its coefficients are default-constructed.
implementation::expressions::expr< implementation::expressions::sub< SRows, SCols >::template operation_generic, implementation::expressions::MatrixWrapper< base_matrix< T, Rows, Cols, StorageTraits, MathObject > > > block(size_type r_ofs, size_type c_ofs)
Returns a submatrix of SRows rows and SCols columns starting at (r_ofs, c_ofs).
Type current() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns the current matrix entry.
Type current() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns a current row's enumerator.
implementation::expressions::expr< implementation::expressions::sub_1d< Cols >::template operation_row, implementation::expressions::MatrixWrapper< base_matrix< T, Rows, Cols, StorageTraits, MathObject > > > row(size_type row_index)
Returns the row_index-th row of this matrix.
ColsEnumerator enumerate_cols() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Enumerates all columns. For each column, a column enumerator is given.
math_matrix(const MatrixType &mat)
Creates a copy of the matrix mat.
void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Goes to the next element.
math_matrix(const base_matrix< S, Rs, Cs, ST, MO > &mat)
Creates a copy of the matrix mat.
math_colvector(size_type entries, const implementation::Initialize_Impl< S, def > &i)
Creates a column vector with entries entries. Its coefficients are copy-constructed from i...
void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Goes to the next element.
base_matrix(const base_matrix< T, Rows, Cols, StorageTraits, MathObject > &mat)
Creates a copy of the matrix mat.
StorageTraits::constpointer_type data() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns a pointer to the raw data of the matrix.
void resize(size_type new_rows, size_type new_cols)
Resizes the matrix to new_rows times new_cols entries. If the new matrix has entries which cannot be ...
ConstRowEnumerator Type
The row enumerator type.
base_rowvector(size_type entries, const implementation::Initialize_Impl< S, def > &i)
Creates a row vector with entries entries. Its coefficients are copy-constructed from i...
base_matrix()
Creates a new matrix. The dimensions are set to zero if no compile-time dimensions were specified...
void swap(MatrixType &B)
Swaps the contents of this matrix with the matrix B.
math_rowvector(const base_matrix< S, Rs, Cs, ST, MO > &mat)
Creates a copy of the row vector mat.
void get_current(Result &result) const PLLL_INTERNAL_NOTHROW_POSTFIX_CONDITIONAL(noexcept(result=*d_entry))
Creates a copy of the current matrix entry in result.
Type current() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns a current column's enumerator.
base_colvector(int entries)
Creates a column vector with entries entries. Its coefficients are default-constructed.
Type current() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns a current column's enumerator.
bool has_current() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns true if a current element exists and can be queried by the current(), get_current() and get_c...
implementation::expressions::expr< implementation::expressions::sub_1d< Cols >::template operation_row, implementation::expressions::ConstMatrixWrapper< base_matrix< T, Rows, Cols, StorageTraits, MathObject > > > row(size_type row_index) const
Returns the row_index-th row of this matrix.
An enumerator for matrix elements.
implementation::expressions::expr< implementation::expressions::transpose, implementation::expressions::ConstMatrixWrapper< base_matrix< T, Rows, Cols, StorageTraits, MathObject > > > transpose() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns the transpose of this matrix.
base_matrix(size_type entries)
Creates a vector with entries entries. Its coefficients are default-constructed.
math_colvector()
Creates a new column vector. The dimensions are set to zero if no compile-time dimensions were specif...
Represents a column vector with coefficients in T.
Represents a math matrix with coefficients in T.
bool has_current() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns true if a current row exists and can be queried by the current() method.
An enumerator for matrix elements.
void next() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Goes to the next element.
bool has_current() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns true if a current element exists and can be queried by the current(), get_current() and get_c...
Step1_Type step1() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Retrieves the coefficient as a simple expression. The result should be stored in a variable of the fi...
Enumerator enumerate() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Enumerates all entries of the current matrix.
~math_rowvector() PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Releases the memory allocated for the row vector.
math_matrix(size_type rows, size_type cols)
Creates a matrix with rows times cols entries. Its coefficients are default-constructed.
ConstEnumerator enumerate() const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Enumerates all entries of the current matrix.
GetCoeffSteps_Type get_coeff_steps(size_type i, size_type j) const PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
Returns a object of type GetCoeffSteps_Type which constructs the coefficient at (i, j).