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>
83 #include <blaze/util/Assert.h>
84 #include <blaze/util/EnableIf.h>
86 #include <blaze/util/TrueType.h>
88 #include <blaze/util/Unused.h>
89 
90 
91 namespace blaze {
92 
93 //=================================================================================================
94 //
95 // UPPERMATRIX OPERATORS
96 //
97 //=================================================================================================
98 
99 //*************************************************************************************************
102 template< typename MT, bool SO, bool DF >
103 inline void reset( UpperMatrix<MT,SO,DF>& m );
104 
105 template< typename MT, bool SO, bool DF >
106 inline void reset( UpperMatrix<MT,SO,DF>& m, size_t i );
107 
108 template< typename MT, bool SO, bool DF >
109 inline void clear( UpperMatrix<MT,SO,DF>& m );
110 
111 template< bool RF, typename MT, bool SO, bool DF >
112 inline bool isDefault( const UpperMatrix<MT,SO,DF>& m );
113 
114 template< typename MT, bool SO, bool DF >
115 inline bool isIntact( const UpperMatrix<MT,SO,DF>& m );
116 
117 template< typename MT, bool SO, bool DF >
118 inline void swap( UpperMatrix<MT,SO,DF>& a, UpperMatrix<MT,SO,DF>& b ) noexcept;
120 //*************************************************************************************************
121 
122 
123 //*************************************************************************************************
130 template< typename MT // Type of the adapted matrix
131  , bool SO // Storage order of the adapted matrix
132  , bool DF > // Density flag
133 inline void reset( UpperMatrix<MT,SO,DF>& m )
134 {
135  m.reset();
136 }
137 //*************************************************************************************************
138 
139 
140 //*************************************************************************************************
153 template< typename MT // Type of the adapted matrix
154  , bool SO // Storage order of the adapted matrix
155  , bool DF > // Density flag
156 inline void reset( UpperMatrix<MT,SO,DF>& m, size_t i )
157 {
158  m.reset( i );
159 }
160 //*************************************************************************************************
161 
162 
163 //*************************************************************************************************
170 template< typename MT // Type of the adapted matrix
171  , bool SO // Storage order of the adapted matrix
172  , bool DF > // Density flag
173 inline void clear( UpperMatrix<MT,SO,DF>& m )
174 {
175  m.clear();
176 }
177 //*************************************************************************************************
178 
179 
180 //*************************************************************************************************
208 template< bool RF // Relaxation flag
209  , typename MT // Type of the adapted matrix
210  , bool SO // Storage order of the adapted matrix
211  , bool DF > // Density flag
212 inline bool isDefault( const UpperMatrix<MT,SO,DF>& m )
213 {
214  return isDefault<RF>( m.matrix_ );
215 }
216 //*************************************************************************************************
217 
218 
219 //*************************************************************************************************
240 template< typename MT // Type of the adapted matrix
241  , bool SO // Storage order of the adapted matrix
242  , bool DF > // Density flag
243 inline bool isIntact( const UpperMatrix<MT,SO,DF>& m )
244 {
245  return m.isIntact();
246 }
247 //*************************************************************************************************
248 
249 
250 //*************************************************************************************************
258 template< typename MT // Type of the adapted matrix
259  , bool SO // Storage order of the adapted matrix
260  , bool DF > // Density flag
261 inline void swap( UpperMatrix<MT,SO,DF>& a, UpperMatrix<MT,SO,DF>& b ) noexcept
262 {
263  a.swap( b );
264 }
265 //*************************************************************************************************
266 
267 
268 //*************************************************************************************************
291 template< InversionFlag IF // Inversion algorithm
292  , typename MT // Type of the dense matrix
293  , bool SO > // Storage order of the dense matrix
294 inline void invert( UpperMatrix<MT,SO,true>& m )
295 {
297 
298  if( IF == asUniLower ) {
299  BLAZE_INTERNAL_ASSERT( isIdentity( m ), "Violation of preconditions detected" );
300  return;
301  }
302 
303  constexpr InversionFlag flag( ( IF == byLU || IF == asGeneral || IF == asUpper )
304  ? ( asUpper )
305  : ( ( IF == asUniUpper )
306  ?( asUniUpper )
307  :( asDiagonal ) ) );
308 
309  invert<flag>( derestrict( m ) );
310 
311  BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
312 }
314 //*************************************************************************************************
315 
316 
317 //*************************************************************************************************
336 template< typename MT1, bool SO1, typename MT2, typename MT3, typename MT4, bool SO2 >
337 inline void lu( const UpperMatrix<MT1,SO1,true>& A, DenseMatrix<MT2,SO1>& L,
339 {
341 
346 
351 
352  typedef ElementType_<MT2> ET2;
353  typedef ElementType_<MT4> ET4;
354 
355  const size_t n( (~A).rows() );
356 
357  DerestrictTrait_<MT2> L2( derestrict( ~L ) );
358 
359  (~U) = A;
360 
361  resize( ~L, n, n );
362  reset( L2 );
363 
364  resize( ~P, n, n );
365  reset( ~P );
366 
367  for( size_t i=0UL; i<n; ++i ) {
368  L2(i,i) = ET2(1);
369  (~P)(i,i) = ET4(1);
370  }
371 }
373 //*************************************************************************************************
374 
375 
376 //*************************************************************************************************
392 template< typename MT // Type of the adapted matrix
393  , bool SO // Storage order of the adapted matrix
394  , bool DF // Density flag
395  , typename VT > // Type of the right-hand side dense vector
396 inline bool tryAssign( const UpperMatrix<MT,SO,DF>& lhs,
397  const DenseVector<VT,false>& rhs, size_t row, size_t column )
398 {
400 
401  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
402  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
403  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.rows() - row, "Invalid number of rows" );
404 
405  UNUSED_PARAMETER( lhs );
406 
407  const size_t ibegin( ( column < row )?( 0UL ):( column - row + 1UL ) );
408 
409  for( size_t i=ibegin; i<(~rhs).size(); ++i ) {
410  if( !isDefault( (~rhs)[i] ) )
411  return false;
412  }
413 
414  return true;
415 }
417 //*************************************************************************************************
418 
419 
420 //*************************************************************************************************
436 template< typename MT // Type of the adapted matrix
437  , bool SO // Storage order of the adapted matrix
438  , bool DF // Density flag
439  , typename VT > // Type of the right-hand side dense vector
440 inline bool tryAssign( const UpperMatrix<MT,SO,DF>& lhs,
441  const DenseVector<VT,true>& rhs, size_t row, size_t column )
442 {
444 
445  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
446  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
447  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.columns() - column, "Invalid number of columns" );
448 
449  UNUSED_PARAMETER( lhs );
450 
451  if( row <= column )
452  return true;
453 
454  const size_t iend( min( row - column, (~rhs).size() ) );
455 
456  for( size_t i=0UL; i<iend; ++i ) {
457  if( !isDefault( (~rhs)[i] ) )
458  return false;
459  }
460 
461  return true;
462 }
464 //*************************************************************************************************
465 
466 
467 //*************************************************************************************************
483 template< typename MT // Type of the adapted matrix
484  , bool SO // Storage order of the adapted matrix
485  , bool DF // Density flag
486  , typename VT > // Type of the right-hand side sparse vector
487 inline bool tryAssign( const UpperMatrix<MT,SO,DF>& lhs,
488  const SparseVector<VT,false>& rhs, size_t row, size_t column )
489 {
491 
492  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
493  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
494  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.rows() - row, "Invalid number of rows" );
495 
496  UNUSED_PARAMETER( lhs );
497 
498  typedef typename VT::ConstIterator RhsIterator;
499 
500  const RhsIterator last( (~rhs).end() );
501  RhsIterator element( (~rhs).lowerBound( ( column < row )?( 0UL ):( column - row + 1UL ) ) );
502 
503  for( ; element!=last; ++element ) {
504  if( !isDefault( element->value() ) )
505  return false;
506  }
507 
508  return true;
509 }
511 //*************************************************************************************************
512 
513 
514 //*************************************************************************************************
530 template< typename MT // Type of the adapted matrix
531  , bool SO // Storage order of the adapted matrix
532  , bool DF // Density flag
533  , typename VT > // Type of the right-hand side sparse vector
534 inline bool tryAssign( const UpperMatrix<MT,SO,DF>& lhs,
535  const SparseVector<VT,true>& rhs, size_t row, size_t column )
536 {
538 
539  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
540  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
541  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.columns() - column, "Invalid number of columns" );
542 
543  UNUSED_PARAMETER( lhs );
544 
545  typedef typename VT::ConstIterator RhsIterator;
546 
547  if( row <= column )
548  return true;
549 
550  const RhsIterator last( (~rhs).lowerBound( row - column ) );
551 
552  for( RhsIterator element=(~rhs).begin(); element!=last; ++element ) {
553  if( !isDefault( element->value() ) )
554  return false;
555  }
556 
557  return true;
558 }
560 //*************************************************************************************************
561 
562 
563 //*************************************************************************************************
579 template< typename MT1 // Type of the adapted matrix
580  , bool SO // Storage order of the adapted matrix
581  , bool DF // Density flag
582  , typename MT2 > // Type of the right-hand side dense matrix
583 inline bool tryAssign( const UpperMatrix<MT1,SO,DF>& lhs,
584  const DenseMatrix<MT2,false>& rhs, size_t row, size_t column )
585 {
587 
588  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
589  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
590  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
591  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
592 
593  UNUSED_PARAMETER( lhs );
594 
595  const size_t M( (~rhs).rows() );
596  const size_t N( (~rhs).columns() );
597 
598  if( column + 1UL >= row + M )
599  return true;
600 
601  const size_t ibegin( ( column < row )?( 0UL ):( column - row + 1UL ) );
602 
603  for( size_t i=ibegin; i<M; ++i )
604  {
605  const size_t jend( min( row + i - column, N ) );
606 
607  for( size_t j=0UL; j<jend; ++j ) {
608  if( !isDefault( (~rhs)(i,j) ) )
609  return false;
610  }
611  }
612 
613  return true;
614 }
616 //*************************************************************************************************
617 
618 
619 //*************************************************************************************************
635 template< typename MT1 // Type of the adapted matrix
636  , bool SO // Storage order of the adapted matrix
637  , bool DF // Density flag
638  , typename MT2 > // Type of the right-hand side dense matrix
639 inline bool tryAssign( const UpperMatrix<MT1,SO,DF>& lhs,
640  const DenseMatrix<MT2,true>& rhs, size_t row, size_t column )
641 {
643 
644  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
645  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
646  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
647  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
648 
649  UNUSED_PARAMETER( lhs );
650 
651  const size_t M( (~rhs).rows() );
652  const size_t N( (~rhs).columns() );
653 
654  if( column + 1UL >= row + M )
655  return true;
656 
657  const size_t jend( min( row + M - column - 1UL, N ) );
658 
659  for( size_t j=0UL; j<jend; ++j )
660  {
661  const bool containsDiagonal( column + j >= row );
662  const size_t ibegin( ( containsDiagonal )?( column + j - row + 1UL ):( 0UL ) );
663 
664  for( size_t i=ibegin; i<M; ++i ) {
665  if( !isDefault( (~rhs)(i,j) ) )
666  return false;
667  }
668  }
669 
670  return true;
671 }
673 //*************************************************************************************************
674 
675 
676 //*************************************************************************************************
692 template< typename MT1 // Type of the adapted matrix
693  , bool SO // Storage order of the adapted matrix
694  , bool DF // Density flag
695  , typename MT2 > // Type of the right-hand side sparse matrix
696 inline bool tryAssign( const UpperMatrix<MT1,SO,DF>& lhs,
697  const SparseMatrix<MT2,false>& rhs, size_t row, size_t column )
698 {
700 
701  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
702  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
703  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
704  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
705 
706  UNUSED_PARAMETER( lhs );
707 
708  typedef typename MT2::ConstIterator RhsIterator;
709 
710  const size_t M( (~rhs).rows() );
711  const size_t N( (~rhs).columns() );
712 
713  if( column + 1UL >= row + M )
714  return true;
715 
716  const size_t ibegin( ( column < row )?( 0UL ):( column - row + 1UL ) );
717 
718  for( size_t i=ibegin; i<M; ++i )
719  {
720  const size_t index( row + i - column );
721  const RhsIterator last( (~rhs).lowerBound( i, min( index, N ) ) );
722 
723  for( RhsIterator element=(~rhs).begin(i); element!=last; ++element ) {
724  if( !isDefault( element->value() ) )
725  return false;
726  }
727  }
728 
729  return true;
730 }
732 //*************************************************************************************************
733 
734 
735 //*************************************************************************************************
751 template< typename MT1 // Type of the adapted matrix
752  , bool SO // Storage order of the adapted matrix
753  , bool DF // Density flag
754  , typename MT2 > // Type of the right-hand side sparse matrix
755 inline bool tryAssign( const UpperMatrix<MT1,SO,DF>& lhs,
756  const SparseMatrix<MT2,true>& rhs, size_t row, size_t column )
757 {
759 
760  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
761  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
762  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
763  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
764 
765  UNUSED_PARAMETER( lhs );
766 
767  typedef typename MT2::ConstIterator RhsIterator;
768 
769  const size_t M( (~rhs).rows() );
770  const size_t N( (~rhs).columns() );
771 
772  if( column + 1UL >= row + M )
773  return true;
774 
775  const size_t jend( min( row + M - column - 1UL, N ) );
776 
777  for( size_t j=0UL; j<jend; ++j )
778  {
779  const bool containsDiagonal( column + j >= row );
780  const size_t index( ( containsDiagonal )?( column + j - row + 1UL ):( 0UL ) );
781 
782  const RhsIterator last( (~rhs).end(j) );
783  RhsIterator element( (~rhs).lowerBound( index, j ) );
784 
785  for( ; element!=last; ++element ) {
786  if( !isDefault( element->value() ) )
787  return false;
788  }
789  }
790 
791  return true;
792 }
794 //*************************************************************************************************
795 
796 
797 //*************************************************************************************************
813 template< typename MT // Type of the adapted matrix
814  , bool SO // Storage order of the adapted matrix
815  , bool DF // Density flag
816  , typename VT // Type of the right-hand side vector
817  , bool TF > // Transpose flag of the right-hand side vector
818 inline bool tryAddAssign( const UpperMatrix<MT,SO,DF>& lhs,
819  const Vector<VT,TF>& rhs, size_t row, size_t column )
820 {
821  return tryAssign( lhs, ~rhs, row, column );
822 }
824 //*************************************************************************************************
825 
826 
827 //*************************************************************************************************
843 template< typename MT1 // Type of the adapted matrix
844  , bool SO1 // Storage order of the adapted matrix
845  , bool DF // Density flag
846  , typename MT2 // Type of the right-hand side matrix
847  , bool SO2 > // Storage order of the right-hand side matrix
848 inline bool tryAddAssign( const UpperMatrix<MT1,SO1,DF>& lhs,
849  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
850 {
851  return tryAssign( lhs, ~rhs, row, column );
852 }
854 //*************************************************************************************************
855 
856 
857 //*************************************************************************************************
873 template< typename MT // Type of the adapted matrix
874  , bool SO // Storage order of the adapted matrix
875  , bool DF // Density flag
876  , typename VT // Type of the right-hand side vector
877  , bool TF > // Transpose flag of the right-hand side vector
878 inline bool trySubAssign( const UpperMatrix<MT,SO,DF>& lhs,
879  const Vector<VT,TF>& rhs, size_t row, size_t column )
880 {
881  return tryAssign( lhs, ~rhs, row, column );
882 }
884 //*************************************************************************************************
885 
886 
887 //*************************************************************************************************
903 template< typename MT1 // Type of the adapted matrix
904  , bool SO1 // Storage order of the adapted matrix
905  , bool DF // Density flag
906  , typename MT2 // Type of the right-hand side matrix
907  , bool SO2 > // Storage order of the right-hand side matrix
908 inline bool trySubAssign( const UpperMatrix<MT1,SO1,DF>& lhs,
909  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
910 {
911  return tryAssign( lhs, ~rhs, row, column );
912 }
914 //*************************************************************************************************
915 
916 
917 //*************************************************************************************************
931 template< typename MT // Type of the adapted matrix
932  , bool SO // Storage order of the adapted matrix
933  , bool DF > // Density flag
934 inline MT& derestrict( UpperMatrix<MT,SO,DF>& m )
935 {
936  return m.matrix_;
937 }
939 //*************************************************************************************************
940 
941 
942 
943 
944 //=================================================================================================
945 //
946 // ROWS SPECIALIZATIONS
947 //
948 //=================================================================================================
949 
950 //*************************************************************************************************
952 template< typename MT, bool SO, bool DF >
953 struct Rows< UpperMatrix<MT,SO,DF> > : public Rows<MT>
954 {};
956 //*************************************************************************************************
957 
958 
959 
960 
961 //=================================================================================================
962 //
963 // COLUMNS SPECIALIZATIONS
964 //
965 //=================================================================================================
966 
967 //*************************************************************************************************
969 template< typename MT, bool SO, bool DF >
970 struct Columns< UpperMatrix<MT,SO,DF> > : public Columns<MT>
971 {};
973 //*************************************************************************************************
974 
975 
976 
977 
978 //=================================================================================================
979 //
980 // ISSQUARE SPECIALIZATIONS
981 //
982 //=================================================================================================
983 
984 //*************************************************************************************************
986 template< typename MT, bool SO, bool DF >
987 struct IsSquare< UpperMatrix<MT,SO,DF> > : public TrueType
988 {};
990 //*************************************************************************************************
991 
992 
993 
994 
995 //=================================================================================================
996 //
997 // ISUPPER SPECIALIZATIONS
998 //
999 //=================================================================================================
1000 
1001 //*************************************************************************************************
1003 template< typename MT, bool SO, bool DF >
1004 struct IsUpper< UpperMatrix<MT,SO,DF> > : public TrueType
1005 {};
1007 //*************************************************************************************************
1008 
1009 
1010 
1011 
1012 //=================================================================================================
1013 //
1014 // ISADAPTOR SPECIALIZATIONS
1015 //
1016 //=================================================================================================
1017 
1018 //*************************************************************************************************
1020 template< typename MT, bool SO, bool DF >
1021 struct IsAdaptor< UpperMatrix<MT,SO,DF> > : public TrueType
1022 {};
1024 //*************************************************************************************************
1025 
1026 
1027 
1028 
1029 //=================================================================================================
1030 //
1031 // ISRESTRICTED SPECIALIZATIONS
1032 //
1033 //=================================================================================================
1034 
1035 //*************************************************************************************************
1037 template< typename MT, bool SO, bool DF >
1038 struct IsRestricted< UpperMatrix<MT,SO,DF> > : public TrueType
1039 {};
1041 //*************************************************************************************************
1042 
1043 
1044 
1045 
1046 //=================================================================================================
1047 //
1048 // HASCONSTDATAACCESS SPECIALIZATIONS
1049 //
1050 //=================================================================================================
1051 
1052 //*************************************************************************************************
1054 template< typename MT, bool SO >
1055 struct HasConstDataAccess< UpperMatrix<MT,SO,true> > : public TrueType
1056 {};
1058 //*************************************************************************************************
1059 
1060 
1061 
1062 
1063 //=================================================================================================
1064 //
1065 // ISALIGNED SPECIALIZATIONS
1066 //
1067 //=================================================================================================
1068 
1069 //*************************************************************************************************
1071 template< typename MT, bool SO, bool DF >
1072 struct IsAligned< UpperMatrix<MT,SO,DF> > : public BoolConstant< IsAligned<MT>::value >
1073 {};
1075 //*************************************************************************************************
1076 
1077 
1078 
1079 
1080 //=================================================================================================
1081 //
1082 // ISPADDED SPECIALIZATIONS
1083 //
1084 //=================================================================================================
1085 
1086 //*************************************************************************************************
1088 template< typename MT, bool SO, bool DF >
1089 struct IsPadded< UpperMatrix<MT,SO,DF> > : public BoolConstant< IsPadded<MT>::value >
1090 {};
1092 //*************************************************************************************************
1093 
1094 
1095 
1096 
1097 //=================================================================================================
1098 //
1099 // ISRESIZABLE SPECIALIZATIONS
1100 //
1101 //=================================================================================================
1102 
1103 //*************************************************************************************************
1105 template< typename MT, bool SO, bool DF >
1106 struct IsResizable< UpperMatrix<MT,SO,DF> > : public BoolConstant< IsResizable<MT>::value >
1107 {};
1109 //*************************************************************************************************
1110 
1111 
1112 
1113 
1114 //=================================================================================================
1115 //
1116 // REMOVEADAPTOR SPECIALIZATIONS
1117 //
1118 //=================================================================================================
1119 
1120 //*************************************************************************************************
1122 template< typename MT, bool SO, bool DF >
1123 struct RemoveAdaptor< UpperMatrix<MT,SO,DF> >
1124 {
1125  using Type = MT;
1126 };
1128 //*************************************************************************************************
1129 
1130 
1131 
1132 
1133 //=================================================================================================
1134 //
1135 // DERESTRICTTRAIT SPECIALIZATIONS
1136 //
1137 //=================================================================================================
1138 
1139 //*************************************************************************************************
1141 template< typename MT, bool SO, bool DF >
1142 struct DerestrictTrait< UpperMatrix<MT,SO,DF> >
1143 {
1144  using Type = MT&;
1145 };
1147 //*************************************************************************************************
1148 
1149 
1150 
1151 
1152 //=================================================================================================
1153 //
1154 // ADDTRAIT SPECIALIZATIONS
1155 //
1156 //=================================================================================================
1157 
1158 //*************************************************************************************************
1160 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1161 struct AddTrait< UpperMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
1162 {
1164 };
1165 
1166 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1167 struct AddTrait< StaticMatrix<T,M,N,SO1>, UpperMatrix<MT,SO2,DF> >
1168 {
1169  using Type = AddTrait_< StaticMatrix<T,M,N,SO1>, MT >;
1170 };
1171 
1172 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1173 struct AddTrait< UpperMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
1174 {
1176 };
1177 
1178 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1179 struct AddTrait< HybridMatrix<T,M,N,SO1>, UpperMatrix<MT,SO2,DF> >
1180 {
1181  using Type = AddTrait_< HybridMatrix<T,M,N,SO1>, MT >;
1182 };
1183 
1184 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1185 struct AddTrait< UpperMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
1186 {
1187  using Type = AddTrait_< MT, DynamicMatrix<T,SO2> >;
1188 };
1189 
1190 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1191 struct AddTrait< DynamicMatrix<T,SO1>, UpperMatrix<MT,SO2,DF> >
1192 {
1193  using Type = AddTrait_< DynamicMatrix<T,SO1>, MT >;
1194 };
1195 
1196 template< typename MT, bool SO1, bool DF, typename T, bool AF, bool PF, bool SO2 >
1197 struct AddTrait< UpperMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
1198 {
1200 };
1201 
1202 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF >
1203 struct AddTrait< CustomMatrix<T,AF,PF,SO1>, UpperMatrix<MT,SO2,DF> >
1204 {
1205  using Type = AddTrait_< CustomMatrix<T,AF,PF,SO1>, MT >;
1206 };
1207 
1208 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1209 struct AddTrait< UpperMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
1210 {
1212 };
1213 
1214 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1215 struct AddTrait< CompressedMatrix<T,SO1>, UpperMatrix<MT,SO2,DF> >
1216 {
1217  using Type = AddTrait_< CompressedMatrix<T,SO1>, MT >;
1218 };
1219 
1220 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
1221 struct AddTrait< UpperMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
1222 {
1223  using Type = AddTrait_<MT1,MT2>;
1224 };
1225 
1226 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
1227 struct AddTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, UpperMatrix<MT2,SO2,DF2> >
1228 {
1229  using Type = AddTrait_<MT1,MT2>;
1230 };
1231 
1232 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1233 struct AddTrait< UpperMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
1234 {
1235  using Type = AddTrait_<MT1,MT2>;
1236 };
1237 
1238 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1239 struct AddTrait< HermitianMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1240 {
1241  using Type = AddTrait_<MT1,MT2>;
1242 };
1243 
1244 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1245 struct AddTrait< UpperMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1246 {
1247  using Type = AddTrait_<MT1,MT2>;
1248 };
1249 
1250 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1251 struct AddTrait< LowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1252 {
1253  using Type = AddTrait_<MT1,MT2>;
1254 };
1255 
1256 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1257 struct AddTrait< UpperMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
1258 {
1259  using Type = AddTrait_<MT1,MT2>;
1260 };
1261 
1262 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1263 struct AddTrait< UniLowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1264 {
1265  using Type = AddTrait_<MT1,MT2>;
1266 };
1267 
1268 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1269 struct AddTrait< UpperMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2> >
1270 {
1271  using Type = AddTrait_<MT1,MT2>;
1272 };
1273 
1274 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1275 struct AddTrait< StrictlyLowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1276 {
1277  using Type = AddTrait_<MT1,MT2>;
1278 };
1279 
1280 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1281 struct AddTrait< UpperMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1282 {
1283  using Type = UpperMatrix< AddTrait_<MT1,MT2> >;
1284 };
1286 //*************************************************************************************************
1287 
1288 
1289 
1290 
1291 //=================================================================================================
1292 //
1293 // SUBTRAIT SPECIALIZATIONS
1294 //
1295 //=================================================================================================
1296 
1297 //*************************************************************************************************
1299 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1300 struct SubTrait< UpperMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
1301 {
1303 };
1304 
1305 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1306 struct SubTrait< StaticMatrix<T,M,N,SO1>, UpperMatrix<MT,SO2,DF> >
1307 {
1308  using Type = SubTrait_< StaticMatrix<T,M,N,SO1>, MT >;
1309 };
1310 
1311 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1312 struct SubTrait< UpperMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
1313 {
1315 };
1316 
1317 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1318 struct SubTrait< HybridMatrix<T,M,N,SO1>, UpperMatrix<MT,SO2,DF> >
1319 {
1320  using Type = SubTrait_< HybridMatrix<T,M,N,SO1>, MT >;
1321 };
1322 
1323 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1324 struct SubTrait< UpperMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
1325 {
1326  using Type = SubTrait_< MT, DynamicMatrix<T,SO2> >;
1327 };
1328 
1329 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1330 struct SubTrait< DynamicMatrix<T,SO1>, UpperMatrix<MT,SO2,DF> >
1331 {
1332  using Type = SubTrait_< DynamicMatrix<T,SO1>, MT >;
1333 };
1334 
1335 template< typename MT, bool SO1, bool DF, typename T, bool AF, bool PF, bool SO2 >
1336 struct SubTrait< UpperMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
1337 {
1339 };
1340 
1341 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF >
1342 struct SubTrait< CustomMatrix<T,AF,PF,SO1>, UpperMatrix<MT,SO2,DF> >
1343 {
1344  using Type = SubTrait_< CustomMatrix<T,AF,PF,SO1>, MT >;
1345 };
1346 
1347 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1348 struct SubTrait< UpperMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
1349 {
1351 };
1352 
1353 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1354 struct SubTrait< CompressedMatrix<T,SO1>, UpperMatrix<MT,SO2,DF> >
1355 {
1356  using Type = SubTrait_< CompressedMatrix<T,SO1>, MT >;
1357 };
1358 
1359 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
1360 struct SubTrait< UpperMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
1361 {
1362  using Type = SubTrait_<MT1,MT2>;
1363 };
1364 
1365 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
1366 struct SubTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, UpperMatrix<MT2,SO2,DF2> >
1367 {
1368  using Type = SubTrait_<MT1,MT2>;
1369 };
1370 
1371 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1372 struct SubTrait< UpperMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
1373 {
1374  using Type = SubTrait_<MT1,MT2>;
1375 };
1376 
1377 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1378 struct SubTrait< HermitianMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1379 {
1380  using Type = SubTrait_<MT1,MT2>;
1381 };
1382 
1383 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1384 struct SubTrait< UpperMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1385 {
1386  using Type = SubTrait_<MT1,MT2>;
1387 };
1388 
1389 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1390 struct SubTrait< LowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1391 {
1392  using Type = SubTrait_<MT1,MT2>;
1393 };
1394 
1395 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1396 struct SubTrait< UpperMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
1397 {
1398  using Type = SubTrait_<MT1,MT2>;
1399 };
1400 
1401 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1402 struct SubTrait< UniLowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1403 {
1404  using Type = SubTrait_<MT1,MT2>;
1405 };
1406 
1407 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1408 struct SubTrait< UpperMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2> >
1409 {
1410  using Type = SubTrait_<MT1,MT2>;
1411 };
1412 
1413 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1414 struct SubTrait< StrictlyLowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1415 {
1416  using Type = SubTrait_<MT1,MT2>;
1417 };
1418 
1419 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1420 struct SubTrait< UpperMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1421 {
1422  using Type = UpperMatrix< SubTrait_<MT1,MT2> >;
1423 };
1425 //*************************************************************************************************
1426 
1427 
1428 
1429 
1430 //=================================================================================================
1431 //
1432 // MULTTRAIT SPECIALIZATIONS
1433 //
1434 //=================================================================================================
1435 
1436 //*************************************************************************************************
1438 template< typename MT, bool SO, bool DF, typename T >
1439 struct MultTrait< UpperMatrix<MT,SO,DF>, T, EnableIf_< IsNumeric<T> > >
1440 {
1441  using Type = UpperMatrix< MultTrait_<MT,T> >;
1442 };
1443 
1444 template< typename T, typename MT, bool SO, bool DF >
1445 struct MultTrait< T, UpperMatrix<MT,SO,DF>, EnableIf_< IsNumeric<T> > >
1446 {
1447  using Type = UpperMatrix< MultTrait_<T,MT> >;
1448 };
1449 
1450 template< typename MT, bool SO, bool DF, typename T, size_t N >
1451 struct MultTrait< UpperMatrix<MT,SO,DF>, StaticVector<T,N,false> >
1452 {
1454 };
1455 
1456 template< typename T, size_t N, typename MT, bool SO, bool DF >
1457 struct MultTrait< StaticVector<T,N,true>, UpperMatrix<MT,SO,DF> >
1458 {
1459  using Type = MultTrait_< StaticVector<T,N,true>, MT >;
1460 };
1461 
1462 template< typename MT, bool SO, bool DF, typename T, size_t N >
1463 struct MultTrait< UpperMatrix<MT,SO,DF>, HybridVector<T,N,false> >
1464 {
1466 };
1467 
1468 template< typename T, size_t N, typename MT, bool SO, bool DF >
1469 struct MultTrait< HybridVector<T,N,true>, UpperMatrix<MT,SO,DF> >
1470 {
1471  using Type = MultTrait_< HybridVector<T,N,true>, MT >;
1472 };
1473 
1474 template< typename MT, bool SO, bool DF, typename T >
1475 struct MultTrait< UpperMatrix<MT,SO,DF>, DynamicVector<T,false> >
1476 {
1478 };
1479 
1480 template< typename T, typename MT, bool SO, bool DF >
1481 struct MultTrait< DynamicVector<T,true>, UpperMatrix<MT,SO,DF> >
1482 {
1483  using Type = MultTrait_< DynamicVector<T,true>, MT >;
1484 };
1485 
1486 template< typename MT, bool SO, bool DF, typename T, bool AF, bool PF >
1487 struct MultTrait< UpperMatrix<MT,SO,DF>, CustomVector<T,AF,PF,false> >
1488 {
1490 };
1491 
1492 template< typename T, bool AF, bool PF, typename MT, bool SO, bool DF >
1493 struct MultTrait< CustomVector<T,AF,PF,true>, UpperMatrix<MT,SO,DF> >
1494 {
1495  using Type = MultTrait_< CustomVector<T,AF,PF,true>, MT >;
1496 };
1497 
1498 template< typename MT, bool SO, bool DF, typename T >
1499 struct MultTrait< UpperMatrix<MT,SO,DF>, CompressedVector<T,false> >
1500 {
1502 };
1503 
1504 template< typename T, typename MT, bool SO, bool DF >
1505 struct MultTrait< CompressedVector<T,true>, UpperMatrix<MT,SO,DF> >
1506 {
1507  using Type = MultTrait_< CompressedVector<T,true>, MT >;
1508 };
1509 
1510 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1511 struct MultTrait< UpperMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
1512 {
1514 };
1515 
1516 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1517 struct MultTrait< StaticMatrix<T,M,N,SO1>, UpperMatrix<MT,SO2,DF> >
1518 {
1519  using Type = MultTrait_< StaticMatrix<T,M,N,SO1>, MT >;
1520 };
1521 
1522 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1523 struct MultTrait< UpperMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
1524 {
1526 };
1527 
1528 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1529 struct MultTrait< HybridMatrix<T,M,N,SO1>, UpperMatrix<MT,SO2,DF> >
1530 {
1531  using Type = MultTrait_< HybridMatrix<T,M,N,SO1>, MT >;
1532 };
1533 
1534 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1535 struct MultTrait< UpperMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
1536 {
1537  using Type = MultTrait_< MT, DynamicMatrix<T,SO2> >;
1538 };
1539 
1540 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1541 struct MultTrait< DynamicMatrix<T,SO1>, UpperMatrix<MT,SO2,DF> >
1542 {
1543  using Type = MultTrait_< DynamicMatrix<T,SO1>, MT >;
1544 };
1545 
1546 template< typename MT, bool SO1, bool DF, typename T, bool AF, bool PF, bool SO2 >
1547 struct MultTrait< UpperMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
1548 {
1550 };
1551 
1552 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF >
1553 struct MultTrait< CustomMatrix<T,AF,PF,SO1>, UpperMatrix<MT,SO2,DF> >
1554 {
1555  using Type = MultTrait_< CustomMatrix<T,AF,PF,SO1>, MT >;
1556 };
1557 
1558 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1559 struct MultTrait< UpperMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
1560 {
1562 };
1563 
1564 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1565 struct MultTrait< CompressedMatrix<T,SO1>, UpperMatrix<MT,SO2,DF> >
1566 {
1567  using Type = MultTrait_< CompressedMatrix<T,SO1>, MT >;
1568 };
1569 
1570 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
1571 struct MultTrait< UpperMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
1572 {
1573  using Type = MultTrait_<MT1,MT2>;
1574 };
1575 
1576 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
1577 struct MultTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, UpperMatrix<MT2,SO2,DF2> >
1578 {
1579  using Type = MultTrait_<MT1,MT2>;
1580 };
1581 
1582 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1583 struct MultTrait< UpperMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
1584 {
1585  using Type = MultTrait_<MT1,MT2>;
1586 };
1587 
1588 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1589 struct MultTrait< HermitianMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1590 {
1591  using Type = MultTrait_<MT1,MT2>;
1592 };
1593 
1594 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1595 struct MultTrait< UpperMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1596 {
1597  using Type = MultTrait_<MT1,MT2>;
1598 };
1599 
1600 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1601 struct MultTrait< LowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1602 {
1603  using Type = MultTrait_<MT1,MT2>;
1604 };
1605 
1606 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1607 struct MultTrait< UpperMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
1608 {
1609  using Type = MultTrait_<MT1,MT2>;
1610 };
1611 
1612 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1613 struct MultTrait< UniLowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1614 {
1615  using Type = MultTrait_<MT1,MT2>;
1616 };
1617 
1618 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1619 struct MultTrait< UpperMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2> >
1620 {
1621  using Type = MultTrait_<MT1,MT2>;
1622 };
1623 
1624 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1625 struct MultTrait< StrictlyLowerMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1626 {
1627  using Type = MultTrait_<MT1,MT2>;
1628 };
1629 
1630 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1631 struct MultTrait< UpperMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1632 {
1633  using Type = UpperMatrix< MultTrait_<MT1,MT2> >;
1634 };
1636 //*************************************************************************************************
1637 
1638 
1639 
1640 
1641 //=================================================================================================
1642 //
1643 // DIVTRAIT SPECIALIZATIONS
1644 //
1645 //=================================================================================================
1646 
1647 //*************************************************************************************************
1649 template< typename MT, bool SO, bool DF, typename T >
1650 struct DivTrait< UpperMatrix<MT,SO,DF>, T, EnableIf_< IsNumeric<T> > >
1651 {
1652  using Type = UpperMatrix< DivTrait_<MT,T> >;
1653 };
1655 //*************************************************************************************************
1656 
1657 
1658 
1659 
1660 //=================================================================================================
1661 //
1662 // FOREACHTRAIT SPECIALIZATIONS
1663 //
1664 //=================================================================================================
1665 
1666 //*************************************************************************************************
1668 template< typename MT, bool SO, bool DF >
1669 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Abs >
1670 {
1671  using Type = UpperMatrix< ForEachTrait_<MT,Abs> >;
1672 };
1673 
1674 template< typename MT, bool SO, bool DF >
1675 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Floor >
1676 {
1677  using Type = UpperMatrix< ForEachTrait_<MT,Floor> >;
1678 };
1679 
1680 template< typename MT, bool SO, bool DF >
1681 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Ceil >
1682 {
1683  using Type = UpperMatrix< ForEachTrait_<MT,Ceil> >;
1684 };
1685 
1686 template< typename MT, bool SO, bool DF >
1687 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Conj >
1688 {
1689  using Type = UpperMatrix< ForEachTrait_<MT,Conj> >;
1690 };
1691 
1692 template< typename MT, bool SO, bool DF >
1693 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Real >
1694 {
1695  using Type = UpperMatrix< ForEachTrait_<MT,Real> >;
1696 };
1697 
1698 template< typename MT, bool SO, bool DF >
1699 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Imag >
1700 {
1701  using Type = UpperMatrix< ForEachTrait_<MT,Imag> >;
1702 };
1703 
1704 template< typename MT, bool SO, bool DF >
1705 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Sin >
1706 {
1707  using Type = UpperMatrix< ForEachTrait_<MT,Sin> >;
1708 };
1709 
1710 template< typename MT, bool SO, bool DF >
1711 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Asin >
1712 {
1713  using Type = UpperMatrix< ForEachTrait_<MT,Asin> >;
1714 };
1715 
1716 template< typename MT, bool SO, bool DF >
1717 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Sinh >
1718 {
1719  using Type = UpperMatrix< ForEachTrait_<MT,Sinh> >;
1720 };
1721 
1722 template< typename MT, bool SO, bool DF >
1723 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Asinh >
1724 {
1725  using Type = UpperMatrix< ForEachTrait_<MT,Asinh> >;
1726 };
1727 
1728 template< typename MT, bool SO, bool DF >
1729 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Tan >
1730 {
1731  using Type = UpperMatrix< ForEachTrait_<MT,Tan> >;
1732 };
1733 
1734 template< typename MT, bool SO, bool DF >
1735 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Atan >
1736 {
1737  using Type = UpperMatrix< ForEachTrait_<MT,Atan> >;
1738 };
1739 
1740 template< typename MT, bool SO, bool DF >
1741 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Tanh >
1742 {
1743  using Type = UpperMatrix< ForEachTrait_<MT,Tanh> >;
1744 };
1745 
1746 template< typename MT, bool SO, bool DF >
1747 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Atanh >
1748 {
1749  using Type = UpperMatrix< ForEachTrait_<MT,Atanh> >;
1750 };
1751 
1752 template< typename MT, bool SO, bool DF >
1753 struct ForEachTrait< UpperMatrix<MT,SO,DF>, Erf >
1754 {
1755  using Type = UpperMatrix< ForEachTrait_<MT,Erf> >;
1756 };
1758 //*************************************************************************************************
1759 
1760 
1761 
1762 
1763 //=================================================================================================
1764 //
1765 // HIGHTYPE SPECIALIZATIONS
1766 //
1767 //=================================================================================================
1768 
1769 //*************************************************************************************************
1771 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1772 struct HighType< UpperMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1773 {
1775 };
1777 //*************************************************************************************************
1778 
1779 
1780 
1781 
1782 //=================================================================================================
1783 //
1784 // LOWTYPE SPECIALIZATIONS
1785 //
1786 //=================================================================================================
1787 
1788 //*************************************************************************************************
1790 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1791 struct LowType< UpperMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1792 {
1794 };
1796 //*************************************************************************************************
1797 
1798 
1799 
1800 
1801 //=================================================================================================
1802 //
1803 // SUBMATRIXTRAIT SPECIALIZATIONS
1804 //
1805 //=================================================================================================
1806 
1807 //*************************************************************************************************
1809 template< typename MT, bool SO, bool DF >
1810 struct SubmatrixTrait< UpperMatrix<MT,SO,DF> >
1811 {
1812  using Type = SubmatrixTrait_<MT>;
1813 };
1815 //*************************************************************************************************
1816 
1817 
1818 
1819 
1820 //=================================================================================================
1821 //
1822 // ROWTRAIT SPECIALIZATIONS
1823 //
1824 //=================================================================================================
1825 
1826 //*************************************************************************************************
1828 template< typename MT, bool SO, bool DF >
1829 struct RowTrait< UpperMatrix<MT,SO,DF> >
1830 {
1831  using Type = RowTrait_<MT>;
1832 };
1834 //*************************************************************************************************
1835 
1836 
1837 
1838 
1839 //=================================================================================================
1840 //
1841 // COLUMNTRAIT SPECIALIZATIONS
1842 //
1843 //=================================================================================================
1844 
1845 //*************************************************************************************************
1847 template< typename MT, bool SO, bool DF >
1848 struct ColumnTrait< UpperMatrix<MT,SO,DF> >
1849 {
1850  using Type = ColumnTrait_<MT>;
1851 };
1853 //*************************************************************************************************
1854 
1855 } // namespace blaze
1856 
1857 #endif
Header file for auxiliary alias declarations.
Header file for mathematical functions.
typename DerestrictTrait< T >::Type DerestrictTrait_
Auxiliary alias declaration for the DerestrictTrait type trait.The DerestrictTrait_ alias declaration...
Definition: DerestrictTrait.h:110
Compile time check for low-level access to constant data.This type trait tests whether the given data...
Definition: HasConstDataAccess.h:75
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
Flag for the inversion of a diagonal matrix.
Definition: InversionFlag.h:115
Flag for the inversion of a general matrix (same as byLU).
Definition: InversionFlag.h:108
Header file for the row trait.
Base template for the SubmatrixTrait class.
Definition: SubmatrixTrait.h:118
Flag for the inversion of a upper unitriangular matrix.
Definition: InversionFlag.h:114
Base template for the ColumnTrait class.
Definition: ColumnTrait.h:117
Flag for the inversion of a lower unitriangular matrix.
Definition: InversionFlag.h:112
typename RowTrait< MT >::Type RowTrait_
Auxiliary alias declaration for the RowTrait type trait.The RowTrait_ alias declaration provides a co...
Definition: RowTrait.h:152
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:261
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
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:194
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
UpperMatrix specialization for sparse matrices.
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1755
#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
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:245
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:88
Constraint on the data type.
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:71
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:119
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is an identity matrix.
Definition: DenseMatrix.h:1679
Constraint on the data type.
Compile time check for data types with restricted data access.This type trait tests whether the given...
Definition: IsRestricted.h:82
Header file for the IsSquare type trait.
Compile time check for the alignment of data types.This type trait tests whether the given data type ...
Definition: IsAligned.h:87
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:741
Base template for the RowTrait class.
Definition: RowTrait.h:117
Flag for the inversion of a upper triangular matrix.
Definition: InversionFlag.h:113
Constraint on the data type.
Header file for the LowType type trait.
Base template for the HighType type trait.
Definition: HighType.h:133
Header file for the multiplication trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Flag for the LU-based matrix inversion.
Definition: InversionFlag.h:103
Base template for the ForEachTrait class.The ForEachTrait class template offers the possibility to se...
Definition: ForEachTrait.h:79
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2939
Compile time check for data types with padding.This type trait tests whether the given data type empl...
Definition: IsPadded.h:76
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.
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
Compile time check for square matrices.This type trait tests whether or not the given template parame...
Definition: IsSquare.h:88
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:336
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< 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:128
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:544
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:260
Header file for the RemoveAdaptor type trait.
Constraint on the data type.
Matrix adapter for upper triangular matrices.
Definition: Forward.h:55
Compile time check for adaptors.This type trait tests whether the given template parameter is an adap...
Definition: IsAdaptor.h:88
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< 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:128
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.
Header file for the DerestrictTrait class template.
Constraint on the data type.
Header file for the IsNumeric type trait.
Base template for the LowType type trait.
Definition: LowType.h:133
Header file for the HasConstDataAccess type trait.
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
#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.
Base template for the AddTrait class.
Definition: AddTrait.h:143
Base template for the MultTrait class.
Definition: MultTrait.h:143
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:267
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:94
#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
typename SubmatrixTrait< MT >::Type SubmatrixTrait_
Auxiliary alias declaration for the SubmatrixTrait type trait.The SubmatrixTrait_ alias declaration p...
Definition: SubmatrixTrait.h:153
Evaluation of the return type of the derestrict function.Via this type trait it is possible to evalua...
Definition: DerestrictTrait.h:73
Base template for the DivTrait class.
Definition: DivTrait.h:143
typename ColumnTrait< MT >::Type ColumnTrait_
Auxiliary alias declaration for the ColumnTrait type trait.The ColumnTrait_ alias declaration provide...
Definition: ColumnTrait.h:152
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:320
Removal of top level adaptor types.In case the given type is an adaptor type (SymmetricMatrix, LowerMatrix, UpperMatrix, ...), the RemoveAdaptor type trait removes the adaptor and extracts the contained general matrix type. Else the given type is returned as is. Note that cv-qualifiers are preserved.
Definition: RemoveAdaptor.h:76
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:164
typename SubTrait< T1, T2 >::Type SubTrait_
Auxiliary alias declaration for the SubTrait class template.The SubTrait_ alias declaration provides ...
Definition: SubTrait.h:245
Header file for the for-each trait.
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:120
Header file for the isDivisor shim.
Header file for the IntegralConstant class template.
Compile time evaluation of the number of columns of a matrix.The Columns type trait evaluates the num...
Definition: Columns.h:76
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:249
Compile time evaluation of the number of rows of a matrix.The Rows type trait evaluates the number of...
Definition: Rows.h:76
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
#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
Base template for the SubTrait class.
Definition: SubTrait.h:143
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.
Header file for the IsResizable type trait.
Header file for the IsRestricted type trait.
typename AddTrait< T1, T2 >::Type AddTrait_
Auxiliary alias declaration for the AddTrait class template.The AddTrait_ alias declaration provides ...
Definition: AddTrait.h:245
InversionFlag
Inversion flag.The InversionFlag type enumeration represents the different types of matrix inversion ...
Definition: InversionFlag.h:101
#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 HighType type trait.
Header file for the TrueType type/value trait base class.