UpperMatrix.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_UPPERMATRIX_H_
36 #define _BLAZE_MATH_ADAPTORS_UPPERMATRIX_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
55 #include <blaze/math/Exception.h>
56 #include <blaze/math/Forward.h>
57 #include <blaze/math/Functions.h>
82 #include <blaze/util/Assert.h>
83 #include <blaze/util/EnableIf.h>
85 #include <blaze/util/TrueType.h>
87 #include <blaze/util/Unused.h>
88 
89 
90 namespace blaze {
91 
92 //=================================================================================================
93 //
94 // UPPERMATRIX OPERATORS
95 //
96 //=================================================================================================
97 
98 //*************************************************************************************************
101 template< typename MT, bool SO, bool DF >
102 inline void reset( UpperMatrix<MT,SO,DF>& m );
103 
104 template< typename MT, bool SO, bool DF >
105 inline void reset( UpperMatrix<MT,SO,DF>& m, size_t i );
106 
107 template< typename MT, bool SO, bool DF >
108 inline void clear( UpperMatrix<MT,SO,DF>& m );
109 
110 template< typename MT, bool SO, bool DF >
111 inline bool isDefault( const UpperMatrix<MT,SO,DF>& m );
112 
113 template< typename MT, bool SO, bool DF >
114 inline bool isIntact( const UpperMatrix<MT,SO,DF>& m );
115 
116 template< typename MT, bool SO, bool DF >
117 inline void swap( UpperMatrix<MT,SO,DF>& a, UpperMatrix<MT,SO,DF>& b ) noexcept;
119 //*************************************************************************************************
120 
121 
122 //*************************************************************************************************
129 template< typename MT // Type of the adapted matrix
130  , bool SO // Storage order of the adapted matrix
131  , bool DF > // Density flag
132 inline void reset( UpperMatrix<MT,SO,DF>& m )
133 {
134  m.reset();
135 }
136 //*************************************************************************************************
137 
138 
139 //*************************************************************************************************
152 template< typename MT // Type of the adapted matrix
153  , bool SO // Storage order of the adapted matrix
154  , bool DF > // Density flag
155 inline void reset( UpperMatrix<MT,SO,DF>& m, size_t i )
156 {
157  m.reset( i );
158 }
159 //*************************************************************************************************
160 
161 
162 //*************************************************************************************************
169 template< typename MT // Type of the adapted matrix
170  , bool SO // Storage order of the adapted matrix
171  , bool DF > // Density flag
172 inline void clear( UpperMatrix<MT,SO,DF>& m )
173 {
174  m.clear();
175 }
176 //*************************************************************************************************
177 
178 
179 //*************************************************************************************************
200 template< typename MT // Type of the adapted matrix
201  , bool SO // Storage order of the adapted matrix
202  , bool DF > // Density flag
203 inline bool isDefault( const UpperMatrix<MT,SO,DF>& m )
204 {
205  return isDefault( m.matrix_ );
206 }
207 //*************************************************************************************************
208 
209 
210 //*************************************************************************************************
231 template< typename MT // Type of the adapted matrix
232  , bool SO // Storage order of the adapted matrix
233  , bool DF > // Density flag
234 inline bool isIntact( const UpperMatrix<MT,SO,DF>& m )
235 {
236  return m.isIntact();
237 }
238 //*************************************************************************************************
239 
240 
241 //*************************************************************************************************
249 template< typename MT // Type of the adapted matrix
250  , bool SO // Storage order of the adapted matrix
251  , bool DF > // Density flag
252 inline void swap( UpperMatrix<MT,SO,DF>& a, UpperMatrix<MT,SO,DF>& b ) noexcept
253 {
254  a.swap( b );
255 }
256 //*************************************************************************************************
257 
258 
259 //*************************************************************************************************
282 template< InversionFlag IF // Inversion algorithm
283  , typename MT // Type of the dense matrix
284  , bool SO > // Storage order of the dense matrix
285 inline void invert( UpperMatrix<MT,SO,true>& m )
286 {
288 
289  if( IF == asUniLower ) {
290  BLAZE_INTERNAL_ASSERT( isIdentity( m ), "Violation of preconditions detected" );
291  return;
292  }
293 
294  constexpr InversionFlag flag( ( IF == byLU || IF == asGeneral || IF == asUpper )
295  ? ( asUpper )
296  : ( ( IF == asUniUpper )
297  ?( asUniUpper )
298  :( asDiagonal ) ) );
299 
300  invert<flag>( derestrict( m ) );
301 
302  BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
303 }
305 //*************************************************************************************************
306 
307 
308 //*************************************************************************************************
327 template< typename MT1, bool SO1, typename MT2, typename MT3, typename MT4, bool SO2 >
328 inline void lu( const UpperMatrix<MT1,SO1,true>& A, DenseMatrix<MT2,SO1>& L,
329  DenseMatrix<MT3,SO1>& U, Matrix<MT4,SO2>& P )
330 {
332 
337 
342 
343  typedef ElementType_<MT2> ET2;
344  typedef ElementType_<MT4> ET4;
345 
346  const size_t n( (~A).rows() );
347 
348  DerestrictTrait_<MT2> L2( derestrict( ~L ) );
349 
350  (~U) = A;
351 
352  resize( ~L, n, n );
353  reset( L2 );
354 
355  resize( ~P, n, n );
356  reset( ~P );
357 
358  for( size_t i=0UL; i<n; ++i ) {
359  L2(i,i) = ET2(1);
360  (~P)(i,i) = ET4(1);
361  }
362 }
364 //*************************************************************************************************
365 
366 
367 //*************************************************************************************************
383 template< typename MT // Type of the adapted matrix
384  , bool SO // Storage order of the adapted matrix
385  , bool DF // Density flag
386  , typename VT > // Type of the right-hand side dense vector
387 inline bool tryAssign( const UpperMatrix<MT,SO,DF>& lhs,
388  const DenseVector<VT,false>& rhs, size_t row, size_t column )
389 {
391 
392  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
393  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
394  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.rows() - row, "Invalid number of rows" );
395 
396  UNUSED_PARAMETER( lhs );
397 
398  const size_t ibegin( ( column < row )?( 0UL ):( column - row + 1UL ) );
399 
400  for( size_t i=ibegin; i<(~rhs).size(); ++i ) {
401  if( !isDefault( (~rhs)[i] ) )
402  return false;
403  }
404 
405  return true;
406 }
408 //*************************************************************************************************
409 
410 
411 //*************************************************************************************************
427 template< typename MT // Type of the adapted matrix
428  , bool SO // Storage order of the adapted matrix
429  , bool DF // Density flag
430  , typename VT > // Type of the right-hand side dense vector
431 inline bool tryAssign( const UpperMatrix<MT,SO,DF>& lhs,
432  const DenseVector<VT,true>& rhs, size_t row, size_t column )
433 {
435 
436  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
437  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
438  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.columns() - column, "Invalid number of columns" );
439 
440  UNUSED_PARAMETER( lhs );
441 
442  if( row <= column )
443  return true;
444 
445  const size_t iend( min( row - column, (~rhs).size() ) );
446 
447  for( size_t i=0UL; i<iend; ++i ) {
448  if( !isDefault( (~rhs)[i] ) )
449  return false;
450  }
451 
452  return true;
453 }
455 //*************************************************************************************************
456 
457 
458 //*************************************************************************************************
474 template< typename MT // Type of the adapted matrix
475  , bool SO // Storage order of the adapted matrix
476  , bool DF // Density flag
477  , typename VT > // Type of the right-hand side sparse vector
478 inline bool tryAssign( const UpperMatrix<MT,SO,DF>& lhs,
479  const SparseVector<VT,false>& rhs, size_t row, size_t column )
480 {
482 
483  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
484  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
485  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.rows() - row, "Invalid number of rows" );
486 
487  UNUSED_PARAMETER( lhs );
488 
489  typedef typename VT::ConstIterator RhsIterator;
490 
491  const RhsIterator last( (~rhs).end() );
492  RhsIterator element( (~rhs).lowerBound( ( column < row )?( 0UL ):( column - row + 1UL ) ) );
493 
494  for( ; element!=last; ++element ) {
495  if( !isDefault( element->value() ) )
496  return false;
497  }
498 
499  return true;
500 }
502 //*************************************************************************************************
503 
504 
505 //*************************************************************************************************
521 template< typename MT // Type of the adapted matrix
522  , bool SO // Storage order of the adapted matrix
523  , bool DF // Density flag
524  , typename VT > // Type of the right-hand side sparse vector
525 inline bool tryAssign( const UpperMatrix<MT,SO,DF>& lhs,
526  const SparseVector<VT,true>& rhs, size_t row, size_t column )
527 {
529 
530  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
531  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
532  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.columns() - column, "Invalid number of columns" );
533 
534  UNUSED_PARAMETER( lhs );
535 
536  typedef typename VT::ConstIterator RhsIterator;
537 
538  if( row <= column )
539  return true;
540 
541  const RhsIterator last( (~rhs).lowerBound( row - column ) );
542 
543  for( RhsIterator element=(~rhs).begin(); element!=last; ++element ) {
544  if( !isDefault( element->value() ) )
545  return false;
546  }
547 
548  return true;
549 }
551 //*************************************************************************************************
552 
553 
554 //*************************************************************************************************
570 template< typename MT1 // Type of the adapted matrix
571  , bool SO // Storage order of the adapted matrix
572  , bool DF // Density flag
573  , typename MT2 > // Type of the right-hand side dense matrix
574 inline bool tryAssign( const UpperMatrix<MT1,SO,DF>& lhs,
575  const DenseMatrix<MT2,false>& rhs, size_t row, size_t column )
576 {
578 
579  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
580  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
581  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
582  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
583 
584  UNUSED_PARAMETER( lhs );
585 
586  const size_t M( (~rhs).rows() );
587  const size_t N( (~rhs).columns() );
588 
589  if( column + 1UL >= row + M )
590  return true;
591 
592  const size_t ibegin( ( column < row )?( 0UL ):( column - row + 1UL ) );
593 
594  for( size_t i=ibegin; i<M; ++i )
595  {
596  const size_t jend( min( row + i - column, N ) );
597 
598  for( size_t j=0UL; j<jend; ++j ) {
599  if( !isDefault( (~rhs)(i,j) ) )
600  return false;
601  }
602  }
603 
604  return true;
605 }
607 //*************************************************************************************************
608 
609 
610 //*************************************************************************************************
626 template< typename MT1 // Type of the adapted matrix
627  , bool SO // Storage order of the adapted matrix
628  , bool DF // Density flag
629  , typename MT2 > // Type of the right-hand side dense matrix
630 inline bool tryAssign( const UpperMatrix<MT1,SO,DF>& lhs,
631  const DenseMatrix<MT2,true>& rhs, size_t row, size_t column )
632 {
634 
635  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
636  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
637  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
638  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
639 
640  UNUSED_PARAMETER( lhs );
641 
642  const size_t M( (~rhs).rows() );
643  const size_t N( (~rhs).columns() );
644 
645  if( column + 1UL >= row + M )
646  return true;
647 
648  const size_t jend( min( row + M - column - 1UL, N ) );
649 
650  for( size_t j=0UL; j<jend; ++j )
651  {
652  const bool containsDiagonal( column + j >= row );
653  const size_t ibegin( ( containsDiagonal )?( column + j - row + 1UL ):( 0UL ) );
654 
655  for( size_t i=ibegin; i<M; ++i ) {
656  if( !isDefault( (~rhs)(i,j) ) )
657  return false;
658  }
659  }
660 
661  return true;
662 }
664 //*************************************************************************************************
665 
666 
667 //*************************************************************************************************
683 template< typename MT1 // Type of the adapted matrix
684  , bool SO // Storage order of the adapted matrix
685  , bool DF // Density flag
686  , typename MT2 > // Type of the right-hand side sparse matrix
687 inline bool tryAssign( const UpperMatrix<MT1,SO,DF>& lhs,
688  const SparseMatrix<MT2,false>& rhs, size_t row, size_t column )
689 {
691 
692  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
693  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
694  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
695  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
696 
697  UNUSED_PARAMETER( lhs );
698 
699  typedef typename MT2::ConstIterator RhsIterator;
700 
701  const size_t M( (~rhs).rows() );
702  const size_t N( (~rhs).columns() );
703 
704  if( column + 1UL >= row + M )
705  return true;
706 
707  const size_t ibegin( ( column < row )?( 0UL ):( column - row + 1UL ) );
708 
709  for( size_t i=ibegin; i<M; ++i )
710  {
711  const size_t index( row + i - column );
712  const RhsIterator last( (~rhs).lowerBound( i, min( index, N ) ) );
713 
714  for( RhsIterator element=(~rhs).begin(i); element!=last; ++element ) {
715  if( !isDefault( element->value() ) )
716  return false;
717  }
718  }
719 
720  return true;
721 }
723 //*************************************************************************************************
724 
725 
726 //*************************************************************************************************
742 template< typename MT1 // Type of the adapted matrix
743  , bool SO // Storage order of the adapted matrix
744  , bool DF // Density flag
745  , typename MT2 > // Type of the right-hand side sparse matrix
746 inline bool tryAssign( const UpperMatrix<MT1,SO,DF>& lhs,
747  const SparseMatrix<MT2,true>& rhs, size_t row, size_t column )
748 {
750 
751  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
752  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
753  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
754  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
755 
756  UNUSED_PARAMETER( lhs );
757 
758  typedef typename MT2::ConstIterator RhsIterator;
759 
760  const size_t M( (~rhs).rows() );
761  const size_t N( (~rhs).columns() );
762 
763  if( column + 1UL >= row + M )
764  return true;
765 
766  const size_t jend( min( row + M - column - 1UL, N ) );
767 
768  for( size_t j=0UL; j<jend; ++j )
769  {
770  const bool containsDiagonal( column + j >= row );
771  const size_t index( ( containsDiagonal )?( column + j - row + 1UL ):( 0UL ) );
772 
773  const RhsIterator last( (~rhs).end(j) );
774  RhsIterator element( (~rhs).lowerBound( index, j ) );
775 
776  for( ; element!=last; ++element ) {
777  if( !isDefault( element->value() ) )
778  return false;
779  }
780  }
781 
782  return true;
783 }
785 //*************************************************************************************************
786 
787 
788 //*************************************************************************************************
804 template< typename MT // Type of the adapted matrix
805  , bool SO // Storage order of the adapted matrix
806  , bool DF // Density flag
807  , typename VT // Type of the right-hand side vector
808  , bool TF > // Transpose flag of the right-hand side vector
809 inline bool tryAddAssign( const UpperMatrix<MT,SO,DF>& lhs,
810  const Vector<VT,TF>& rhs, size_t row, size_t column )
811 {
812  return tryAssign( lhs, ~rhs, row, column );
813 }
815 //*************************************************************************************************
816 
817 
818 //*************************************************************************************************
834 template< typename MT1 // Type of the adapted matrix
835  , bool SO1 // Storage order of the adapted matrix
836  , bool DF // Density flag
837  , typename MT2 // Type of the right-hand side matrix
838  , bool SO2 > // Storage order of the right-hand side matrix
839 inline bool tryAddAssign( const UpperMatrix<MT1,SO1,DF>& lhs,
840  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
841 {
842  return tryAssign( lhs, ~rhs, row, column );
843 }
845 //*************************************************************************************************
846 
847 
848 //*************************************************************************************************
864 template< typename MT // Type of the adapted matrix
865  , bool SO // Storage order of the adapted matrix
866  , bool DF // Density flag
867  , typename VT // Type of the right-hand side vector
868  , bool TF > // Transpose flag of the right-hand side vector
869 inline bool trySubAssign( const UpperMatrix<MT,SO,DF>& lhs,
870  const Vector<VT,TF>& rhs, size_t row, size_t column )
871 {
872  return tryAssign( lhs, ~rhs, row, column );
873 }
875 //*************************************************************************************************
876 
877 
878 //*************************************************************************************************
894 template< typename MT1 // Type of the adapted matrix
895  , bool SO1 // Storage order of the adapted matrix
896  , bool DF // Density flag
897  , typename MT2 // Type of the right-hand side matrix
898  , bool SO2 > // Storage order of the right-hand side matrix
899 inline bool trySubAssign( const UpperMatrix<MT1,SO1,DF>& lhs,
900  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
901 {
902  return tryAssign( lhs, ~rhs, row, column );
903 }
905 //*************************************************************************************************
906 
907 
908 //*************************************************************************************************
922 template< typename MT // Type of the adapted matrix
923  , bool SO // Storage order of the adapted matrix
924  , bool DF > // Density flag
925 inline MT& derestrict( UpperMatrix<MT,SO,DF>& m )
926 {
927  return m.matrix_;
928 }
930 //*************************************************************************************************
931 
932 
933 
934 
935 //=================================================================================================
936 //
937 // ROWS SPECIALIZATIONS
938 //
939 //=================================================================================================
940 
941 //*************************************************************************************************
943 template< typename MT, bool SO, bool DF >
944 struct Rows< UpperMatrix<MT,SO,DF> > : public Rows<MT>
945 {};
947 //*************************************************************************************************
948 
949 
950 
951 
952 //=================================================================================================
953 //
954 // COLUMNS SPECIALIZATIONS
955 //
956 //=================================================================================================
957 
958 //*************************************************************************************************
960 template< typename MT, bool SO, bool DF >
961 struct Columns< UpperMatrix<MT,SO,DF> > : public Columns<MT>
962 {};
964 //*************************************************************************************************
965 
966 
967 
968 
969 //=================================================================================================
970 //
971 // ISSQUARE SPECIALIZATIONS
972 //
973 //=================================================================================================
974 
975 //*************************************************************************************************
977 template< typename MT, bool SO, bool DF >
978 struct IsSquare< UpperMatrix<MT,SO,DF> > : public TrueType
979 {};
981 //*************************************************************************************************
982 
983 
984 
985 
986 //=================================================================================================
987 //
988 // ISUPPER SPECIALIZATIONS
989 //
990 //=================================================================================================
991 
992 //*************************************************************************************************
994 template< typename MT, bool SO, bool DF >
995 struct IsUpper< UpperMatrix<MT,SO,DF> > : public TrueType
996 {};
998 //*************************************************************************************************
999 
1000 
1001 
1002 
1003 //=================================================================================================
1004 //
1005 // ISADAPTOR SPECIALIZATIONS
1006 //
1007 //=================================================================================================
1008 
1009 //*************************************************************************************************
1011 template< typename MT, bool SO, bool DF >
1012 struct IsAdaptor< UpperMatrix<MT,SO,DF> > : public TrueType
1013 {};
1015 //*************************************************************************************************
1016 
1017 
1018 
1019 
1020 //=================================================================================================
1021 //
1022 // ISRESTRICTED SPECIALIZATIONS
1023 //
1024 //=================================================================================================
1025 
1026 //*************************************************************************************************
1028 template< typename MT, bool SO, bool DF >
1029 struct IsRestricted< UpperMatrix<MT,SO,DF> > : public TrueType
1030 {};
1032 //*************************************************************************************************
1033 
1034 
1035 
1036 
1037 //=================================================================================================
1038 //
1039 // HASCONSTDATAACCESS SPECIALIZATIONS
1040 //
1041 //=================================================================================================
1042 
1043 //*************************************************************************************************
1045 template< typename MT, bool SO >
1046 struct HasConstDataAccess< UpperMatrix<MT,SO,true> > : public TrueType
1047 {};
1049 //*************************************************************************************************
1050 
1051 
1052 
1053 
1054 //=================================================================================================
1055 //
1056 // ISALIGNED SPECIALIZATIONS
1057 //
1058 //=================================================================================================
1059 
1060 //*************************************************************************************************
1062 template< typename MT, bool SO, bool DF >
1063 struct IsAligned< UpperMatrix<MT,SO,DF> > : public BoolConstant< IsAligned<MT>::value >
1064 {};
1066 //*************************************************************************************************
1067 
1068 
1069 
1070 
1071 //=================================================================================================
1072 //
1073 // ISPADDED SPECIALIZATIONS
1074 //
1075 //=================================================================================================
1076 
1077 //*************************************************************************************************
1079 template< typename MT, bool SO, bool DF >
1080 struct IsPadded< UpperMatrix<MT,SO,DF> > : public BoolConstant< IsPadded<MT>::value >
1081 {};
1083 //*************************************************************************************************
1084 
1085 
1086 
1087 
1088 //=================================================================================================
1089 //
1090 // ISRESIZABLE SPECIALIZATIONS
1091 //
1092 //=================================================================================================
1093 
1094 //*************************************************************************************************
1096 template< typename MT, bool SO, bool DF >
1097 struct IsResizable< UpperMatrix<MT,SO,DF> > : public BoolConstant< IsResizable<MT>::value >
1098 {};
1100 //*************************************************************************************************
1101 
1102 
1103 
1104 
1105 //=================================================================================================
1106 //
1107 // REMOVEADAPTOR SPECIALIZATIONS
1108 //
1109 //=================================================================================================
1110 
1111 //*************************************************************************************************
1113 template< typename MT, bool SO, bool DF >
1114 struct RemoveAdaptor< UpperMatrix<MT,SO,DF> >
1115 {
1116  using Type = MT;
1117 };
1119 //*************************************************************************************************
1120 
1121 
1122 
1123 
1124 //=================================================================================================
1125 //
1126 // DERESTRICTTRAIT SPECIALIZATIONS
1127 //
1128 //=================================================================================================
1129 
1130 //*************************************************************************************************
1132 template< typename MT, bool SO, bool DF >
1133 struct DerestrictTrait< UpperMatrix<MT,SO,DF> >
1134 {
1135  using Type = MT&;
1136 };
1138 //*************************************************************************************************
1139 
1140 
1141 
1142 
1143 //=================================================================================================
1144 //
1145 // ADDTRAIT SPECIALIZATIONS
1146 //
1147 //=================================================================================================
1148 
1149 //*************************************************************************************************
1151 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1152 struct AddTrait< UpperMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
1153 {
1154  using Type = AddTrait_< MT, StaticMatrix<T,M,N,SO2> >;
1155 };
1156 
1157 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1158 struct AddTrait< StaticMatrix<T,M,N,SO1>, UpperMatrix<MT,SO2,DF> >
1159 {
1160  using Type = AddTrait_< StaticMatrix<T,M,N,SO1>, MT >;
1161 };
1162 
1163 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1164 struct AddTrait< UpperMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
1165 {
1166  using Type = AddTrait_< MT, HybridMatrix<T,M,N,SO2> >;
1167 };
1168 
1169 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1170 struct AddTrait< HybridMatrix<T,M,N,SO1>, UpperMatrix<MT,SO2,DF> >
1171 {
1172  using Type = AddTrait_< HybridMatrix<T,M,N,SO1>, MT >;
1173 };
1174 
1175 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1176 struct AddTrait< UpperMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
1177 {
1178  using Type = AddTrait_< MT, DynamicMatrix<T,SO2> >;
1179 };
1180 
1181 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1182 struct AddTrait< DynamicMatrix<T,SO1>, UpperMatrix<MT,SO2,DF> >
1183 {
1184  using Type = AddTrait_< DynamicMatrix<T,SO1>, MT >;
1185 };
1186 
1187 template< typename MT, bool SO1, bool DF, typename T, bool AF, bool PF, bool SO2 >
1188 struct AddTrait< UpperMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
1189 {
1190  using Type = AddTrait_< MT, CustomMatrix<T,AF,PF,SO2> >;
1191 };
1192 
1193 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF >
1194 struct AddTrait< CustomMatrix<T,AF,PF,SO1>, UpperMatrix<MT,SO2,DF> >
1195 {
1196  using Type = AddTrait_< CustomMatrix<T,AF,PF,SO1>, MT >;
1197 };
1198 
1199 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1200 struct AddTrait< UpperMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
1201 {
1202  using Type = AddTrait_< MT, CompressedMatrix<T,SO2> >;
1203 };
1204 
1205 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1206 struct AddTrait< CompressedMatrix<T,SO1>, UpperMatrix<MT,SO2,DF> >
1207 {
1208  using Type = AddTrait_< CompressedMatrix<T,SO1>, MT >;
1209 };
1210 
1211 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
1212 struct AddTrait< UpperMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
1213 {
1214  using Type = AddTrait_<MT1,MT2>;
1215 };
1216 
1217 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
1218 struct AddTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, UpperMatrix<MT2,SO2,DF2> >
1219 {
1220  using Type = AddTrait_<MT1,MT2>;
1221 };
1222 
1223 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1224 struct AddTrait< UpperMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
1225 {
1226  using Type = AddTrait_<MT1,MT2>;
1227 };
1228 
1229 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1230 struct AddTrait< HermitianMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1231 {
1232  using Type = AddTrait_<MT1,MT2>;
1233 };
1234 
1235 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1236 struct AddTrait< UpperMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1237 {
1238  using Type = AddTrait_<MT1,MT2>;
1239 };
1240 
1241 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1242 struct AddTrait< LowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1243 {
1244  using Type = AddTrait_<MT1,MT2>;
1245 };
1246 
1247 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1248 struct AddTrait< UpperMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
1249 {
1250  using Type = AddTrait_<MT1,MT2>;
1251 };
1252 
1253 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1254 struct AddTrait< UniLowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1255 {
1256  using Type = AddTrait_<MT1,MT2>;
1257 };
1258 
1259 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1260 struct AddTrait< UpperMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2> >
1261 {
1262  using Type = AddTrait_<MT1,MT2>;
1263 };
1264 
1265 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1266 struct AddTrait< StrictlyLowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1267 {
1268  using Type = AddTrait_<MT1,MT2>;
1269 };
1270 
1271 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1272 struct AddTrait< UpperMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1273 {
1274  using Type = UpperMatrix< AddTrait_<MT1,MT2> >;
1275 };
1277 //*************************************************************************************************
1278 
1279 
1280 
1281 
1282 //=================================================================================================
1283 //
1284 // SUBTRAIT SPECIALIZATIONS
1285 //
1286 //=================================================================================================
1287 
1288 //*************************************************************************************************
1290 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1291 struct SubTrait< UpperMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
1292 {
1293  using Type = SubTrait_< MT, StaticMatrix<T,M,N,SO2> >;
1294 };
1295 
1296 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1297 struct SubTrait< StaticMatrix<T,M,N,SO1>, UpperMatrix<MT,SO2,DF> >
1298 {
1299  using Type = SubTrait_< StaticMatrix<T,M,N,SO1>, MT >;
1300 };
1301 
1302 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1303 struct SubTrait< UpperMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
1304 {
1305  using Type = SubTrait_< MT, HybridMatrix<T,M,N,SO2> >;
1306 };
1307 
1308 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1309 struct SubTrait< HybridMatrix<T,M,N,SO1>, UpperMatrix<MT,SO2,DF> >
1310 {
1311  using Type = SubTrait_< HybridMatrix<T,M,N,SO1>, MT >;
1312 };
1313 
1314 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1315 struct SubTrait< UpperMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
1316 {
1317  using Type = SubTrait_< MT, DynamicMatrix<T,SO2> >;
1318 };
1319 
1320 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1321 struct SubTrait< DynamicMatrix<T,SO1>, UpperMatrix<MT,SO2,DF> >
1322 {
1323  using Type = SubTrait_< DynamicMatrix<T,SO1>, MT >;
1324 };
1325 
1326 template< typename MT, bool SO1, bool DF, typename T, bool AF, bool PF, bool SO2 >
1327 struct SubTrait< UpperMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
1328 {
1329  using Type = SubTrait_< MT, CustomMatrix<T,AF,PF,SO2> >;
1330 };
1331 
1332 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF >
1333 struct SubTrait< CustomMatrix<T,AF,PF,SO1>, UpperMatrix<MT,SO2,DF> >
1334 {
1335  using Type = SubTrait_< CustomMatrix<T,AF,PF,SO1>, MT >;
1336 };
1337 
1338 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1339 struct SubTrait< UpperMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
1340 {
1341  using Type = SubTrait_< MT, CompressedMatrix<T,SO2> >;
1342 };
1343 
1344 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1345 struct SubTrait< CompressedMatrix<T,SO1>, UpperMatrix<MT,SO2,DF> >
1346 {
1347  using Type = SubTrait_< CompressedMatrix<T,SO1>, MT >;
1348 };
1349 
1350 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
1351 struct SubTrait< UpperMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
1352 {
1353  using Type = SubTrait_<MT1,MT2>;
1354 };
1355 
1356 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
1357 struct SubTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, UpperMatrix<MT2,SO2,DF2> >
1358 {
1359  using Type = SubTrait_<MT1,MT2>;
1360 };
1361 
1362 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1363 struct SubTrait< UpperMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
1364 {
1365  using Type = SubTrait_<MT1,MT2>;
1366 };
1367 
1368 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1369 struct SubTrait< HermitianMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1370 {
1371  using Type = SubTrait_<MT1,MT2>;
1372 };
1373 
1374 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1375 struct SubTrait< UpperMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1376 {
1377  using Type = SubTrait_<MT1,MT2>;
1378 };
1379 
1380 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1381 struct SubTrait< LowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1382 {
1383  using Type = SubTrait_<MT1,MT2>;
1384 };
1385 
1386 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1387 struct SubTrait< UpperMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
1388 {
1389  using Type = SubTrait_<MT1,MT2>;
1390 };
1391 
1392 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1393 struct SubTrait< UniLowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1394 {
1395  using Type = SubTrait_<MT1,MT2>;
1396 };
1397 
1398 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1399 struct SubTrait< UpperMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2> >
1400 {
1401  using Type = SubTrait_<MT1,MT2>;
1402 };
1403 
1404 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1405 struct SubTrait< StrictlyLowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1406 {
1407  using Type = SubTrait_<MT1,MT2>;
1408 };
1409 
1410 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1411 struct SubTrait< UpperMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1412 {
1413  using Type = UpperMatrix< SubTrait_<MT1,MT2> >;
1414 };
1416 //*************************************************************************************************
1417 
1418 
1419 
1420 
1421 //=================================================================================================
1422 //
1423 // MULTTRAIT SPECIALIZATIONS
1424 //
1425 //=================================================================================================
1426 
1427 //*************************************************************************************************
1429 template< typename MT, bool SO, bool DF, typename T >
1430 struct MultTrait< UpperMatrix<MT,SO,DF>, T, EnableIf_< IsNumeric<T> > >
1431 {
1432  using Type = UpperMatrix< MultTrait_<MT,T> >;
1433 };
1434 
1435 template< typename T, typename MT, bool SO, bool DF >
1436 struct MultTrait< T, UpperMatrix<MT,SO,DF>, EnableIf_< IsNumeric<T> > >
1437 {
1438  using Type = UpperMatrix< MultTrait_<T,MT> >;
1439 };
1440 
1441 template< typename MT, bool SO, bool DF, typename T, size_t N >
1442 struct MultTrait< UpperMatrix<MT,SO,DF>, StaticVector<T,N,false> >
1443 {
1444  using Type = MultTrait_< MT, StaticVector<T,N,false> >;
1445 };
1446 
1447 template< typename T, size_t N, typename MT, bool SO, bool DF >
1448 struct MultTrait< StaticVector<T,N,true>, UpperMatrix<MT,SO,DF> >
1449 {
1450  using Type = MultTrait_< StaticVector<T,N,true>, MT >;
1451 };
1452 
1453 template< typename MT, bool SO, bool DF, typename T, size_t N >
1454 struct MultTrait< UpperMatrix<MT,SO,DF>, HybridVector<T,N,false> >
1455 {
1456  using Type = MultTrait_< MT, HybridVector<T,N,false> >;
1457 };
1458 
1459 template< typename T, size_t N, typename MT, bool SO, bool DF >
1460 struct MultTrait< HybridVector<T,N,true>, UpperMatrix<MT,SO,DF> >
1461 {
1462  using Type = MultTrait_< HybridVector<T,N,true>, MT >;
1463 };
1464 
1465 template< typename MT, bool SO, bool DF, typename T >
1466 struct MultTrait< UpperMatrix<MT,SO,DF>, DynamicVector<T,false> >
1467 {
1468  using Type = MultTrait_< MT, DynamicVector<T,false> >;
1469 };
1470 
1471 template< typename T, typename MT, bool SO, bool DF >
1472 struct MultTrait< DynamicVector<T,true>, UpperMatrix<MT,SO,DF> >
1473 {
1474  using Type = MultTrait_< DynamicVector<T,true>, MT >;
1475 };
1476 
1477 template< typename MT, bool SO, bool DF, typename T, bool AF, bool PF >
1478 struct MultTrait< UpperMatrix<MT,SO,DF>, CustomVector<T,AF,PF,false> >
1479 {
1480  using Type = MultTrait_< MT, CustomVector<T,AF,PF,false> >;
1481 };
1482 
1483 template< typename T, bool AF, bool PF, typename MT, bool SO, bool DF >
1484 struct MultTrait< CustomVector<T,AF,PF,true>, UpperMatrix<MT,SO,DF> >
1485 {
1486  using Type = MultTrait_< CustomVector<T,AF,PF,true>, MT >;
1487 };
1488 
1489 template< typename MT, bool SO, bool DF, typename T >
1490 struct MultTrait< UpperMatrix<MT,SO,DF>, CompressedVector<T,false> >
1491 {
1492  using Type = MultTrait_< MT, CompressedVector<T,false> >;
1493 };
1494 
1495 template< typename T, typename MT, bool SO, bool DF >
1496 struct MultTrait< CompressedVector<T,true>, UpperMatrix<MT,SO,DF> >
1497 {
1498  using Type = MultTrait_< CompressedVector<T,true>, MT >;
1499 };
1500 
1501 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1502 struct MultTrait< UpperMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
1503 {
1504  using Type = MultTrait_< MT, StaticMatrix<T,M,N,SO2> >;
1505 };
1506 
1507 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1508 struct MultTrait< StaticMatrix<T,M,N,SO1>, UpperMatrix<MT,SO2,DF> >
1509 {
1510  using Type = MultTrait_< StaticMatrix<T,M,N,SO1>, MT >;
1511 };
1512 
1513 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1514 struct MultTrait< UpperMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
1515 {
1516  using Type = MultTrait_< MT, HybridMatrix<T,M,N,SO2> >;
1517 };
1518 
1519 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1520 struct MultTrait< HybridMatrix<T,M,N,SO1>, UpperMatrix<MT,SO2,DF> >
1521 {
1522  using Type = MultTrait_< HybridMatrix<T,M,N,SO1>, MT >;
1523 };
1524 
1525 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1526 struct MultTrait< UpperMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
1527 {
1528  using Type = MultTrait_< MT, DynamicMatrix<T,SO2> >;
1529 };
1530 
1531 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1532 struct MultTrait< DynamicMatrix<T,SO1>, UpperMatrix<MT,SO2,DF> >
1533 {
1534  using Type = MultTrait_< DynamicMatrix<T,SO1>, MT >;
1535 };
1536 
1537 template< typename MT, bool SO1, bool DF, typename T, bool AF, bool PF, bool SO2 >
1538 struct MultTrait< UpperMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
1539 {
1540  using Type = MultTrait_< MT, CustomMatrix<T,AF,PF,SO2> >;
1541 };
1542 
1543 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF >
1544 struct MultTrait< CustomMatrix<T,AF,PF,SO1>, UpperMatrix<MT,SO2,DF> >
1545 {
1546  using Type = MultTrait_< CustomMatrix<T,AF,PF,SO1>, MT >;
1547 };
1548 
1549 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1550 struct MultTrait< UpperMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
1551 {
1552  using Type = MultTrait_< MT, CompressedMatrix<T,SO2> >;
1553 };
1554 
1555 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1556 struct MultTrait< CompressedMatrix<T,SO1>, UpperMatrix<MT,SO2,DF> >
1557 {
1558  using Type = MultTrait_< CompressedMatrix<T,SO1>, MT >;
1559 };
1560 
1561 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
1562 struct MultTrait< UpperMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
1563 {
1564  using Type = MultTrait_<MT1,MT2>;
1565 };
1566 
1567 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
1568 struct MultTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, UpperMatrix<MT2,SO2,DF2> >
1569 {
1570  using Type = MultTrait_<MT1,MT2>;
1571 };
1572 
1573 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1574 struct MultTrait< UpperMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
1575 {
1576  using Type = MultTrait_<MT1,MT2>;
1577 };
1578 
1579 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1580 struct MultTrait< HermitianMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1581 {
1582  using Type = MultTrait_<MT1,MT2>;
1583 };
1584 
1585 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1586 struct MultTrait< UpperMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1587 {
1588  using Type = MultTrait_<MT1,MT2>;
1589 };
1590 
1591 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1592 struct MultTrait< LowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1593 {
1594  using Type = MultTrait_<MT1,MT2>;
1595 };
1596 
1597 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1598 struct MultTrait< UpperMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
1599 {
1600  using Type = MultTrait_<MT1,MT2>;
1601 };
1602 
1603 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1604 struct MultTrait< UniLowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1605 {
1606  using Type = MultTrait_<MT1,MT2>;
1607 };
1608 
1609 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1610 struct MultTrait< UpperMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2> >
1611 {
1612  using Type = MultTrait_<MT1,MT2>;
1613 };
1614 
1615 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1616 struct MultTrait< StrictlyLowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1617 {
1618  using Type = MultTrait_<MT1,MT2>;
1619 };
1620 
1621 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1622 struct MultTrait< UpperMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1623 {
1624  using Type = UpperMatrix< MultTrait_<MT1,MT2> >;
1625 };
1627 //*************************************************************************************************
1628 
1629 
1630 
1631 
1632 //=================================================================================================
1633 //
1634 // DIVTRAIT SPECIALIZATIONS
1635 //
1636 //=================================================================================================
1637 
1638 //*************************************************************************************************
1640 template< typename MT, bool SO, bool DF, typename T >
1641 struct DivTrait< UpperMatrix<MT,SO,DF>, T, EnableIf_< IsNumeric<T> > >
1642 {
1643  using Type = UpperMatrix< DivTrait_<MT,T> >;
1644 };
1646 //*************************************************************************************************
1647 
1648 
1649 
1650 
1651 //=================================================================================================
1652 //
1653 // FOREACHTRAIT SPECIALIZATIONS
1654 //
1655 //=================================================================================================
1656 
1657 //*************************************************************************************************
1659 template< typename MT, bool SO, bool DF >
1660 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Abs >
1661 {
1662  using Type = UpperMatrix< ForEachTrait_<MT,Abs> >;
1663 };
1664 
1665 template< typename MT, bool SO, bool DF >
1666 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Floor >
1667 {
1668  using Type = UpperMatrix< ForEachTrait_<MT,Floor> >;
1669 };
1670 
1671 template< typename MT, bool SO, bool DF >
1672 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Ceil >
1673 {
1674  using Type = UpperMatrix< ForEachTrait_<MT,Ceil> >;
1675 };
1676 
1677 template< typename MT, bool SO, bool DF >
1678 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Conj >
1679 {
1680  using Type = UpperMatrix< ForEachTrait_<MT,Conj> >;
1681 };
1682 
1683 template< typename MT, bool SO, bool DF >
1684 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Real >
1685 {
1686  using Type = UpperMatrix< ForEachTrait_<MT,Real> >;
1687 };
1688 
1689 template< typename MT, bool SO, bool DF >
1690 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Imag >
1691 {
1692  using Type = UpperMatrix< ForEachTrait_<MT,Imag> >;
1693 };
1694 
1695 template< typename MT, bool SO, bool DF >
1696 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Sin >
1697 {
1698  using Type = UpperMatrix< ForEachTrait_<MT,Sin> >;
1699 };
1700 
1701 template< typename MT, bool SO, bool DF >
1702 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Asin >
1703 {
1704  using Type = UpperMatrix< ForEachTrait_<MT,Asin> >;
1705 };
1706 
1707 template< typename MT, bool SO, bool DF >
1708 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Sinh >
1709 {
1710  using Type = UpperMatrix< ForEachTrait_<MT,Sinh> >;
1711 };
1712 
1713 template< typename MT, bool SO, bool DF >
1714 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Asinh >
1715 {
1716  using Type = UpperMatrix< ForEachTrait_<MT,Asinh> >;
1717 };
1718 
1719 template< typename MT, bool SO, bool DF >
1720 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Tan >
1721 {
1722  using Type = UpperMatrix< ForEachTrait_<MT,Tan> >;
1723 };
1724 
1725 template< typename MT, bool SO, bool DF >
1726 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Atan >
1727 {
1728  using Type = UpperMatrix< ForEachTrait_<MT,Atan> >;
1729 };
1730 
1731 template< typename MT, bool SO, bool DF >
1732 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Tanh >
1733 {
1734  using Type = UpperMatrix< ForEachTrait_<MT,Tanh> >;
1735 };
1736 
1737 template< typename MT, bool SO, bool DF >
1738 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Atanh >
1739 {
1740  using Type = UpperMatrix< ForEachTrait_<MT,Atanh> >;
1741 };
1742 
1743 template< typename MT, bool SO, bool DF >
1744 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Erf >
1745 {
1746  using Type = UpperMatrix< ForEachTrait_<MT,Erf> >;
1747 };
1749 //*************************************************************************************************
1750 
1751 
1752 
1753 
1754 //=================================================================================================
1755 //
1756 // MATHTRAIT SPECIALIZATIONS
1757 //
1758 //=================================================================================================
1759 
1760 //*************************************************************************************************
1762 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1763 struct MathTrait< UpperMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1764 {
1765  using HighType = UpperMatrix< typename MathTrait<MT1,MT2>::HighType >;
1766  using LowType = UpperMatrix< typename MathTrait<MT1,MT2>::LowType >;
1767 };
1769 //*************************************************************************************************
1770 
1771 
1772 
1773 
1774 //=================================================================================================
1775 //
1776 // SUBMATRIXTRAIT SPECIALIZATIONS
1777 //
1778 //=================================================================================================
1779 
1780 //*************************************************************************************************
1782 template< typename MT, bool SO, bool DF >
1783 struct SubmatrixTrait< UpperMatrix<MT,SO,DF> >
1784 {
1785  using Type = SubmatrixTrait_<MT>;
1786 };
1788 //*************************************************************************************************
1789 
1790 
1791 
1792 
1793 //=================================================================================================
1794 //
1795 // ROWTRAIT SPECIALIZATIONS
1796 //
1797 //=================================================================================================
1798 
1799 //*************************************************************************************************
1801 template< typename MT, bool SO, bool DF >
1802 struct RowTrait< UpperMatrix<MT,SO,DF> >
1803 {
1804  using Type = RowTrait_<MT>;
1805 };
1807 //*************************************************************************************************
1808 
1809 
1810 
1811 
1812 //=================================================================================================
1813 //
1814 // COLUMNTRAIT SPECIALIZATIONS
1815 //
1816 //=================================================================================================
1817 
1818 //*************************************************************************************************
1820 template< typename MT, bool SO, bool DF >
1821 struct ColumnTrait< UpperMatrix<MT,SO,DF> >
1822 {
1823  using Type = ColumnTrait_<MT>;
1824 };
1826 //*************************************************************************************************
1827 
1828 } // namespace blaze
1829 
1830 #endif
Header file for auxiliary alias declarations.
Header file for mathematical functions.
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
Header file for the row trait.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
Header file for the dense matrix inversion flags.
UpperMatrix specialization for dense matrices.
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:188
Flag for the inversion of a diagonal matrix.
Definition: InversionFlag.h:115
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
Flag for the inversion of a general matrix (same as byLU).
Definition: InversionFlag.h:108
UpperMatrix specialization for sparse matrices.
Flag for the inversion of a upper unitriangular matrix.
Definition: InversionFlag.h:114
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1669
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
Flag for the inversion of a upper triangular matrix.
Definition: InversionFlag.h:113
Constraint on the data type.
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT > >, ColumnExprTrait_< MT > > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:126
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Constraint on the data type.
Header file for the IsSquare type trait.
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:741
Constraint on the data type.
Flag for the LU-based matrix inversion.
Definition: InversionFlag.h:103
Header file for the multiplication trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
void lu(const DenseMatrix< MT1, SO1 > &A, DenseMatrix< MT2, SO1 > &L, DenseMatrix< MT3, SO1 > &U, Matrix< MT4, SO2 > &P)
LU decomposition of the given dense matrix.
Definition: LU.h:219
Header file for the Columns type trait.
Header file for the implementation of a fixed-size matrix.
Header file for the IsAligned type trait.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:330
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:538
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:254
Header file for the RemoveAdaptor type trait.
Constraint on the data type.
Matrix adapter for upper triangular matrices.
Definition: Forward.h:55
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
Header file for the IsPadded type trait.
Header file for the IsAdaptor type trait.
InversionFlag
Inversion flag.The InversionFlag type enumeration represents the different types of matrix inversion ...
Definition: InversionFlag.h:101
Header file for the DerestrictTrait class template.
Constraint on the data type.
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT > >, RowExprTrait_< MT > > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:126
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
Header file for run time assertion macros.
Header file for the addition trait.
Header file for the division trait.
Header file for the submatrix trait.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
Header file for the column trait.
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:258
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a BLAS compatible data type (i...
Definition: BLASCompatible.h:61
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
Header file for the mathematical trait.
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:314
Header file for the for-each trait.
Header file for the isDivisor shim.
Header file for the IntegralConstant class template.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:240
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
Header file for the IsUpper type trait.
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the implementation of the base template of the UpperMatrix.
Flag for the inversion of a lower unitriangular matrix.
Definition: InversionFlag.h:112
Header file for the IsResizable type trait.
Header file for the IsRestricted type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the TrueType type/value trait base class.
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is an identity matrix.
Definition: DenseMatrix.h:1593