DiagonalMatrix.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_DIAGONALMATRIX_H_
36 #define _BLAZE_MATH_ADAPTORS_DIAGONALMATRIX_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
54 #include <blaze/math/Exception.h>
55 #include <blaze/math/Forward.h>
91 #include <blaze/util/Assert.h>
92 #include <blaze/util/EnableIf.h>
94 #include <blaze/util/TrueType.h>
97 #include <blaze/util/Unused.h>
98 
99 
100 namespace blaze {
101 
102 //=================================================================================================
103 //
104 // DIAGONALMATRIX OPERATORS
105 //
106 //=================================================================================================
107 
108 //*************************************************************************************************
111 template< typename MT, bool SO, bool DF >
112 inline void reset( DiagonalMatrix<MT,SO,DF>& m );
113 
114 template< typename MT, bool SO, bool DF >
115 inline void reset( DiagonalMatrix<MT,SO,DF>& m, size_t i );
116 
117 template< typename MT, bool SO, bool DF >
118 inline void clear( DiagonalMatrix<MT,SO,DF>& m );
119 
120 template< bool RF, typename MT, bool SO, bool DF >
121 inline bool isDefault( const DiagonalMatrix<MT,SO,DF>& m );
122 
123 template< typename MT, bool SO, bool DF >
124 inline bool isIntact( const DiagonalMatrix<MT,SO,DF>& m );
125 
126 template< typename MT, bool SO, bool DF >
127 inline void swap( DiagonalMatrix<MT,SO,DF>& a, DiagonalMatrix<MT,SO,DF>& b ) noexcept;
129 //*************************************************************************************************
130 
131 
132 //*************************************************************************************************
139 template< typename MT // Type of the adapted matrix
140  , bool SO // Storage order of the adapted matrix
141  , bool DF > // Density flag
143 {
144  m.reset();
145 }
146 //*************************************************************************************************
147 
148 
149 //*************************************************************************************************
162 template< typename MT // Type of the adapted matrix
163  , bool SO // Storage order of the adapted matrix
164  , bool DF > // Density flag
165 inline void reset( DiagonalMatrix<MT,SO,DF>& m, size_t i )
166 {
167  m.reset( i );
168 }
169 //*************************************************************************************************
170 
171 
172 //*************************************************************************************************
179 template< typename MT // Type of the adapted matrix
180  , bool SO // Storage order of the adapted matrix
181  , bool DF > // Density flag
183 {
184  m.clear();
185 }
186 //*************************************************************************************************
187 
188 
189 //*************************************************************************************************
217 template< bool RF // Relaxation flag
218  , typename MT // Type of the adapted matrix
219  , bool SO // Storage order of the adapted matrix
220  , bool DF > // Density flag
221 inline bool isDefault( const DiagonalMatrix<MT,SO,DF>& m )
222 {
223  return isDefault<RF>( m.matrix_ );
224 }
225 //*************************************************************************************************
226 
227 
228 //*************************************************************************************************
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 bool isIntact( const DiagonalMatrix<MT,SO,DF>& m )
253 {
254  return m.isIntact();
255 }
256 //*************************************************************************************************
257 
258 
259 //*************************************************************************************************
267 template< typename MT // Type of the adapted matrix
268  , bool SO // Storage order of the adapted matrix
269  , bool DF > // Density flag
271 {
272  a.swap( b );
273 }
274 //*************************************************************************************************
275 
276 
277 //*************************************************************************************************
300 template< InversionFlag IF // Inversion algorithm
301  , typename MT // Type of the dense matrix
302  , bool SO > // Storage order of the dense matrix
303 inline void invert( DiagonalMatrix<MT,SO,true>& m )
304 {
306 
307  if( IF == asUniLower || IF == asUniUpper ) {
308  BLAZE_INTERNAL_ASSERT( isIdentity( m ), "Violation of preconditions detected" );
309  return;
310  }
311 
312  invert<asDiagonal>( derestrict( m ) );
313 
314  BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
315 }
317 //*************************************************************************************************
318 
319 
320 //*************************************************************************************************
339 template< typename MT1, bool SO1, typename MT2, typename MT3, typename MT4, bool SO2 >
340 inline void lu( const DiagonalMatrix<MT1,SO1,true>& A, DenseMatrix<MT2,SO1>& L,
342 {
344 
349 
354 
355  using ET3 = ElementType_<MT3>;
356  using ET4 = ElementType_<MT4>;
357 
358  const size_t n( (~A).rows() );
359 
360  decltype(auto) U2( derestrict( ~U ) );
361 
362  (~L) = A;
363 
364  resize( ~U, n, n );
365  reset( U2 );
366 
367  resize( ~P, n, n );
368  reset( ~P );
369 
370  for( size_t i=0UL; i<n; ++i ) {
371  U2(i,i) = ET3(1);
372  (~P)(i,i) = ET4(1);
373  }
374 }
376 //*************************************************************************************************
377 
378 
379 //*************************************************************************************************
395 template< typename MT // Type of the adapted matrix
396  , bool SO // Storage order of the adapted matrix
397  , bool DF // Density flag
398  , typename VT > // Type of the right-hand side dense vector
399 inline bool tryAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
400  const DenseVector<VT,false>& rhs, size_t row, size_t column )
401 {
403 
404  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
405  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
406  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.rows() - row, "Invalid number of rows" );
407 
408  UNUSED_PARAMETER( lhs );
409 
410  const size_t index( ( column <= row )?( 0UL ):( column - row ) );
411 
412  for( size_t i=0UL; i<index; ++i ) {
413  if( !isDefault( (~rhs)[i] ) )
414  return false;
415  }
416 
417  for( size_t i=index+1UL; i<(~rhs).size(); ++i ) {
418  if( !isDefault( (~rhs)[i] ) )
419  return false;
420  }
421 
422  return true;
423 }
425 //*************************************************************************************************
426 
427 
428 //*************************************************************************************************
444 template< typename MT // Type of the adapted matrix
445  , bool SO // Storage order of the adapted matrix
446  , bool DF // Density flag
447  , typename VT > // Type of the right-hand side dense vector
448 inline bool tryAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
449  const DenseVector<VT,true>& rhs, size_t row, size_t column )
450 {
452 
453  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
454  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
455  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.columns() - column, "Invalid number of columns" );
456 
457  UNUSED_PARAMETER( lhs );
458 
459  const size_t index( ( row <= column )?( 0UL ):( row - column ) );
460 
461  for( size_t i=0UL; i<index; ++i ) {
462  if( !isDefault( (~rhs)[i] ) )
463  return false;
464  }
465 
466  for( size_t i=index+1UL; i<(~rhs).size(); ++i ) {
467  if( !isDefault( (~rhs)[i] ) )
468  return false;
469  }
470 
471  return true;
472 }
474 //*************************************************************************************************
475 
476 
477 //*************************************************************************************************
493 template< typename MT // Type of the adapted matrix
494  , bool SO // Storage order of the adapted matrix
495  , bool DF // Density flag
496  , typename VT > // Type of the right-hand side sparse vector
497 inline bool tryAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
498  const SparseVector<VT,false>& rhs, size_t row, size_t column )
499 {
501 
502  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
503  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
504  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.rows() - row, "Invalid number of rows" );
505 
506  UNUSED_PARAMETER( lhs );
507 
508  using RhsIterator = typename VT::ConstIterator;
509 
510  const size_t index( column - row );
511 
512  for( RhsIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
513  if( element->index() != index && !isDefault( element->value() ) )
514  return false;
515  }
516 
517  return true;
518 }
520 //*************************************************************************************************
521 
522 
523 //*************************************************************************************************
539 template< typename MT // Type of the adapted matrix
540  , bool SO // Storage order of the adapted matrix
541  , bool DF // Density flag
542  , typename VT > // Type of the right-hand side sparse vector
543 inline bool tryAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
544  const SparseVector<VT,true>& rhs, size_t row, size_t column )
545 {
547 
548  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
549  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
550  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.columns() - column, "Invalid number of columns" );
551 
552  UNUSED_PARAMETER( lhs );
553 
554  using RhsIterator = typename VT::ConstIterator;
555 
556  const size_t index( row - column );
557 
558  for( RhsIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
559  if( element->index() != index && !isDefault( element->value() ) )
560  return false;
561  }
562 
563  return true;
564 }
566 //*************************************************************************************************
567 
568 
569 //*************************************************************************************************
585 template< typename MT1 // Type of the adapted matrix
586  , bool SO // Storage order of the adapted matrix
587  , bool DF // Density flag
588  , typename MT2 > // Type of the right-hand side dense matrix
589 inline bool tryAssign( const DiagonalMatrix<MT1,SO,DF>& lhs,
590  const DenseMatrix<MT2,false>& rhs, size_t row, size_t column )
591 {
593 
594  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
595  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
596  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
597  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
598 
599  UNUSED_PARAMETER( lhs );
600 
601  const size_t M( (~rhs).rows() );
602  const size_t N( (~rhs).columns() );
603 
604  for( size_t i=0UL; i<M; ++i ) {
605  for( size_t j=0UL; j<N; ++j ) {
606  if( ( row + i != column + j ) && !isDefault( (~rhs)(i,j) ) )
607  return false;
608  }
609  }
610 
611  return true;
612 }
614 //*************************************************************************************************
615 
616 
617 //*************************************************************************************************
633 template< typename MT1 // Type of the adapted matrix
634  , bool SO // Storage order of the adapted matrix
635  , bool DF // Density flag
636  , typename MT2 > // Type of the right-hand side dense matrix
637 inline bool tryAssign( const DiagonalMatrix<MT1,SO,DF>& lhs,
638  const DenseMatrix<MT2,true>& rhs, size_t row, size_t column )
639 {
641 
642  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
643  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
644  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
645  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
646 
647  UNUSED_PARAMETER( lhs );
648 
649  const size_t M( (~rhs).rows() );
650  const size_t N( (~rhs).columns() );
651 
652  for( size_t j=0UL; j<N; ++j ) {
653  for( size_t i=0UL; i<M; ++i ) {
654  if( ( column + j != row + i ) && !isDefault( (~rhs)(i,j) ) )
655  return false;
656  }
657  }
658 
659  return true;
660 }
662 //*************************************************************************************************
663 
664 
665 //*************************************************************************************************
681 template< typename MT1 // Type of the adapted matrix
682  , bool SO // Storage order of the adapted matrix
683  , bool DF // Density flag
684  , typename MT2 > // Type of the right-hand side sparse matrix
685 inline bool tryAssign( const DiagonalMatrix<MT1,SO,DF>& lhs,
686  const SparseMatrix<MT2,false>& rhs, size_t row, size_t column )
687 {
689 
690  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
691  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
692  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
693  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
694 
695  UNUSED_PARAMETER( lhs );
696 
697  using RhsIterator = typename MT2::ConstIterator;
698 
699  const size_t M( (~rhs).rows() );
700 
701  for( size_t i=0UL; i<M; ++i ) {
702  for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element ) {
703  if( ( row + i != column + element->index() ) && !isDefault( element->value() ) )
704  return false;
705  }
706  }
707 
708  return true;
709 }
711 //*************************************************************************************************
712 
713 
714 //*************************************************************************************************
730 template< typename MT1 // Type of the adapted matrix
731  , bool SO // Storage order of the adapted matrix
732  , bool DF // Density flag
733  , typename MT2 > // Type of the right-hand side sparse matrix
734 inline bool tryAssign( const DiagonalMatrix<MT1,SO,DF>& lhs,
735  const SparseMatrix<MT2,true>& rhs, size_t row, size_t column )
736 {
738 
739  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
740  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
741  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
742  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
743 
744  UNUSED_PARAMETER( lhs );
745 
746  using RhsIterator = typename MT2::ConstIterator;
747 
748  const size_t N( (~rhs).columns() );
749 
750  for( size_t j=0UL; j<N; ++j ) {
751  for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element ) {
752  if( ( column + j != row + element->index() ) && !isDefault( element->value() ) )
753  return false;
754  }
755  }
756 
757  return true;
758 }
760 //*************************************************************************************************
761 
762 
763 //*************************************************************************************************
779 template< typename MT // Type of the adapted matrix
780  , bool SO // Storage order of the adapted matrix
781  , bool DF // Density flag
782  , typename VT // Type of the right-hand side vector
783  , bool TF > // Transpose flag of the right-hand side vector
784 inline bool tryAddAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
785  const Vector<VT,TF>& rhs, size_t row, size_t column )
786 {
787  return tryAssign( lhs, ~rhs, row, column );
788 }
790 //*************************************************************************************************
791 
792 
793 //*************************************************************************************************
809 template< typename MT1 // Type of the adapted matrix
810  , bool SO1 // Storage order of the adapted matrix
811  , bool DF // Density flag
812  , typename MT2 // Type of the right-hand side matrix
813  , bool SO2 > // Storage order of the right-hand side matrix
814 inline bool tryAddAssign( const DiagonalMatrix<MT1,SO1,DF>& lhs,
815  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
816 {
817  return tryAssign( lhs, ~rhs, row, column );
818 }
820 //*************************************************************************************************
821 
822 
823 //*************************************************************************************************
840 template< typename MT // Type of the adapted matrix
841  , bool SO // Storage order of the adapted matrix
842  , bool DF // Density flag
843  , typename VT // Type of the right-hand side vector
844  , bool TF > // Transpose flag of the right-hand side vector
845 inline bool trySubAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
846  const Vector<VT,TF>& rhs, size_t row, size_t column )
847 {
848  return tryAssign( lhs, ~rhs, row, column );
849 }
851 //*************************************************************************************************
852 
853 
854 //*************************************************************************************************
871 template< typename MT1 // Type of the adapted matrix
872  , bool SO1 // Storage order of the adapted matrix
873  , bool DF // Density flag
874  , typename MT2 // Type of the right-hand side matrix
875  , bool SO2 > // Storage order of the right-hand side matrix
876 inline bool trySubAssign( const DiagonalMatrix<MT1,SO1,DF>& lhs,
877  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
878 {
879  return tryAssign( lhs, ~rhs, row, column );
880 }
882 //*************************************************************************************************
883 
884 
885 //*************************************************************************************************
900 template< typename MT // Type of the adapted matrix
901  , bool SO // Storage order of the adapted matrix
902  , bool DF > // Density flag
903 inline MT& derestrict( DiagonalMatrix<MT,SO,DF>& m )
904 {
905  return m.matrix_;
906 }
908 //*************************************************************************************************
909 
910 
911 
912 
913 //=================================================================================================
914 //
915 // ROWS SPECIALIZATIONS
916 //
917 //=================================================================================================
918 
919 //*************************************************************************************************
921 template< typename MT, bool SO, bool DF >
922 struct Rows< DiagonalMatrix<MT,SO,DF> >
923  : public Rows<MT>
924 {};
926 //*************************************************************************************************
927 
928 
929 
930 
931 //=================================================================================================
932 //
933 // COLUMNS SPECIALIZATIONS
934 //
935 //=================================================================================================
936 
937 //*************************************************************************************************
939 template< typename MT, bool SO, bool DF >
940 struct Columns< DiagonalMatrix<MT,SO,DF> >
941  : public Columns<MT>
942 {};
944 //*************************************************************************************************
945 
946 
947 
948 
949 //=================================================================================================
950 //
951 // ISSQUARE SPECIALIZATIONS
952 //
953 //=================================================================================================
954 
955 //*************************************************************************************************
957 template< typename MT, bool SO, bool DF >
958 struct IsSquare< DiagonalMatrix<MT,SO,DF> >
959  : public TrueType
960 {};
962 //*************************************************************************************************
963 
964 
965 
966 
967 //=================================================================================================
968 //
969 // ISSYMMETRIC SPECIALIZATIONS
970 //
971 //=================================================================================================
972 
973 //*************************************************************************************************
975 template< typename MT, bool SO, bool DF >
976 struct IsSymmetric< DiagonalMatrix<MT,SO,DF> >
977  : public TrueType
978 {};
980 //*************************************************************************************************
981 
982 
983 
984 
985 //=================================================================================================
986 //
987 // ISHERMITIAN SPECIALIZATIONS
988 //
989 //=================================================================================================
990 
991 //*************************************************************************************************
993 template< typename MT, bool SO, bool DF >
994 struct IsHermitian< DiagonalMatrix<MT,SO,DF> >
995  : public BoolConstant< IsBuiltin< ElementType_<MT> >::value >
996 {};
998 //*************************************************************************************************
999 
1000 
1001 
1002 
1003 //=================================================================================================
1004 //
1005 // ISLOWER SPECIALIZATIONS
1006 //
1007 //=================================================================================================
1008 
1009 //*************************************************************************************************
1011 template< typename MT, bool SO, bool DF >
1012 struct IsLower< DiagonalMatrix<MT,SO,DF> >
1013  : public TrueType
1014 {};
1016 //*************************************************************************************************
1017 
1018 
1019 
1020 
1021 //=================================================================================================
1022 //
1023 // ISUPPER SPECIALIZATIONS
1024 //
1025 //=================================================================================================
1026 
1027 //*************************************************************************************************
1029 template< typename MT, bool SO, bool DF >
1030 struct IsUpper< DiagonalMatrix<MT,SO,DF> >
1031  : public TrueType
1032 {};
1034 //*************************************************************************************************
1035 
1036 
1037 
1038 
1039 //=================================================================================================
1040 //
1041 // ISADAPTOR SPECIALIZATIONS
1042 //
1043 //=================================================================================================
1044 
1045 //*************************************************************************************************
1047 template< typename MT, bool SO, bool DF >
1048 struct IsAdaptor< DiagonalMatrix<MT,SO,DF> >
1049  : public TrueType
1050 {};
1052 //*************************************************************************************************
1053 
1054 
1055 
1056 
1057 //=================================================================================================
1058 //
1059 // ISRESTRICTED SPECIALIZATIONS
1060 //
1061 //=================================================================================================
1062 
1063 //*************************************************************************************************
1065 template< typename MT, bool SO, bool DF >
1066 struct IsRestricted< DiagonalMatrix<MT,SO,DF> >
1067  : public TrueType
1068 {};
1070 //*************************************************************************************************
1071 
1072 
1073 
1074 
1075 //=================================================================================================
1076 //
1077 // HASCONSTDATAACCESS SPECIALIZATIONS
1078 //
1079 //=================================================================================================
1080 
1081 //*************************************************************************************************
1083 template< typename MT, bool SO >
1084 struct HasConstDataAccess< DiagonalMatrix<MT,SO,true> >
1085  : public TrueType
1086 {};
1088 //*************************************************************************************************
1089 
1090 
1091 
1092 
1093 //=================================================================================================
1094 //
1095 // ISALIGNED SPECIALIZATIONS
1096 //
1097 //=================================================================================================
1098 
1099 //*************************************************************************************************
1101 template< typename MT, bool SO, bool DF >
1102 struct IsAligned< DiagonalMatrix<MT,SO,DF> >
1103  : public BoolConstant< IsAligned<MT>::value >
1104 {};
1106 //*************************************************************************************************
1107 
1108 
1109 
1110 
1111 //=================================================================================================
1112 //
1113 // ISPADDED SPECIALIZATIONS
1114 //
1115 //=================================================================================================
1116 
1117 //*************************************************************************************************
1119 template< typename MT, bool SO, bool DF >
1120 struct IsPadded< DiagonalMatrix<MT,SO,DF> >
1121  : public BoolConstant< IsPadded<MT>::value >
1122 {};
1124 //*************************************************************************************************
1125 
1126 
1127 
1128 
1129 //=================================================================================================
1130 //
1131 // ISRESIZABLE SPECIALIZATIONS
1132 //
1133 //=================================================================================================
1134 
1135 //*************************************************************************************************
1137 template< typename MT, bool SO, bool DF >
1138 struct IsResizable< DiagonalMatrix<MT,SO,DF> >
1139  : public BoolConstant< IsResizable<MT>::value >
1140 {};
1142 //*************************************************************************************************
1143 
1144 
1145 
1146 
1147 //=================================================================================================
1148 //
1149 // ISSHRINKABLE SPECIALIZATIONS
1150 //
1151 //=================================================================================================
1152 
1153 //*************************************************************************************************
1155 template< typename MT, bool SO, bool DF >
1156 struct IsShrinkable< DiagonalMatrix<MT,SO,DF> >
1157  : public BoolConstant< IsShrinkable<MT>::value >
1158 {};
1160 //*************************************************************************************************
1161 
1162 
1163 
1164 
1165 //=================================================================================================
1166 //
1167 // REMOVEADAPTOR SPECIALIZATIONS
1168 //
1169 //=================================================================================================
1170 
1171 //*************************************************************************************************
1173 template< typename MT, bool SO, bool DF >
1174 struct RemoveAdaptor< DiagonalMatrix<MT,SO,DF> >
1175 {
1176  using Type = MT;
1177 };
1179 //*************************************************************************************************
1180 
1181 
1182 
1183 
1184 //=================================================================================================
1185 //
1186 // ADDTRAIT SPECIALIZATIONS
1187 //
1188 //=================================================================================================
1189 
1190 //*************************************************************************************************
1192 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1193 struct AddTrait< DiagonalMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
1194 {
1196 };
1197 
1198 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1199 struct AddTrait< StaticMatrix<T,M,N,SO1>, DiagonalMatrix<MT,SO2,DF> >
1200 {
1201  using Type = AddTrait_< StaticMatrix<T,M,N,SO1>, MT >;
1202 };
1203 
1204 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1205 struct AddTrait< DiagonalMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
1206 {
1208 };
1209 
1210 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1211 struct AddTrait< HybridMatrix<T,M,N,SO1>, DiagonalMatrix<MT,SO2,DF> >
1212 {
1213  using Type = AddTrait_< HybridMatrix<T,M,N,SO1>, MT >;
1214 };
1215 
1216 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1217 struct AddTrait< DiagonalMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
1218 {
1219  using Type = AddTrait_< MT, DynamicMatrix<T,SO2> >;
1220 };
1221 
1222 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1223 struct AddTrait< DynamicMatrix<T,SO1>, DiagonalMatrix<MT,SO2,DF> >
1224 {
1225  using Type = AddTrait_< DynamicMatrix<T,SO1>, MT >;
1226 };
1227 
1228 template< typename MT, bool SO1, bool DF, typename T, bool AF, bool PF, bool SO2 >
1229 struct AddTrait< DiagonalMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
1230 {
1232 };
1233 
1234 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF >
1235 struct AddTrait< CustomMatrix<T,AF,PF,SO1>, DiagonalMatrix<MT,SO2,DF> >
1236 {
1237  using Type = AddTrait_< CustomMatrix<T,AF,PF,SO1>, MT >;
1238 };
1239 
1240 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1241 struct AddTrait< DiagonalMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
1242 {
1244 };
1245 
1246 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1247 struct AddTrait< CompressedMatrix<T,SO1>, DiagonalMatrix<MT,SO2,DF> >
1248 {
1249  using Type = AddTrait_< CompressedMatrix<T,SO1>, MT >;
1250 };
1251 
1252 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1253 struct AddTrait< DiagonalMatrix<MT,SO1,DF>, IdentityMatrix<T,SO2> >
1254 {
1256 };
1257 
1258 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1259 struct AddTrait< IdentityMatrix<T,SO1>, DiagonalMatrix<MT,SO2,DF> >
1260 {
1262 };
1263 
1264 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
1265 struct AddTrait< DiagonalMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
1266 {
1267  using Type = SymmetricMatrix< AddTrait_<MT1,MT2> >;
1268 };
1269 
1270 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
1271 struct AddTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, DiagonalMatrix<MT2,SO2,DF2> >
1272 {
1273  using Type = SymmetricMatrix< AddTrait_<MT1,MT2> >;
1274 };
1275 
1276 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1277 struct AddTrait< DiagonalMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
1278 {
1279  using Type = If_< IsBuiltin< ElementType_<MT2> >
1281  , AddTrait_<MT1,MT2> >;
1282 };
1283 
1284 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1285 struct AddTrait< HermitianMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1286 {
1287  using Type = If_< IsBuiltin< ElementType_<MT1> >
1289  , AddTrait_<MT1,MT2> >;
1290 };
1291 
1292 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1293 struct AddTrait< DiagonalMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1294 {
1295  using Type = LowerMatrix< AddTrait_<MT1,MT2> >;
1296 };
1297 
1298 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1299 struct AddTrait< LowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1300 {
1301  using Type = LowerMatrix< AddTrait_<MT1,MT2> >;
1302 };
1303 
1304 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1305 struct AddTrait< DiagonalMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
1306 {
1307  using Type = LowerMatrix< AddTrait_<MT1,MT2> >;
1308 };
1309 
1310 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1311 struct AddTrait< UniLowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1312 {
1313  using Type = LowerMatrix< AddTrait_<MT1,MT2> >;
1314 };
1315 
1316 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1317 struct AddTrait< DiagonalMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2> >
1318 {
1319  using Type = LowerMatrix< AddTrait_<MT1,MT2> >;
1320 };
1321 
1322 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1323 struct AddTrait< StrictlyLowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1324 {
1325  using Type = LowerMatrix< AddTrait_<MT1,MT2> >;
1326 };
1327 
1328 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1329 struct AddTrait< DiagonalMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1330 {
1331  using Type = UpperMatrix< AddTrait_<MT1,MT2> >;
1332 };
1333 
1334 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1335 struct AddTrait< UpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1336 {
1337  using Type = UpperMatrix< AddTrait_<MT1,MT2> >;
1338 };
1339 
1340 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1341 struct AddTrait< DiagonalMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
1342 {
1343  using Type = UpperMatrix< AddTrait_<MT1,MT2> >;
1344 };
1345 
1346 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1347 struct AddTrait< UniUpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1348 {
1349  using Type = UpperMatrix< AddTrait_<MT1,MT2> >;
1350 };
1351 
1352 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1353 struct AddTrait< DiagonalMatrix<MT1,SO1,DF1>, StrictlyUpperMatrix<MT2,SO2,DF2> >
1354 {
1355  using Type = UpperMatrix< AddTrait_<MT1,MT2> >;
1356 };
1357 
1358 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1359 struct AddTrait< StrictlyUpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1360 {
1361  using Type = UpperMatrix< AddTrait_<MT1,MT2> >;
1362 };
1363 
1364 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1365 struct AddTrait< DiagonalMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1366 {
1367  using Type = DiagonalMatrix< AddTrait_<MT1,MT2> >;
1368 };
1370 //*************************************************************************************************
1371 
1372 
1373 
1374 
1375 //=================================================================================================
1376 //
1377 // SUBTRAIT SPECIALIZATIONS
1378 //
1379 //=================================================================================================
1380 
1381 //*************************************************************************************************
1383 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1384 struct SubTrait< DiagonalMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
1385 {
1387 };
1388 
1389 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1390 struct SubTrait< StaticMatrix<T,M,N,SO1>, DiagonalMatrix<MT,SO2,DF> >
1391 {
1392  using Type = SubTrait_< StaticMatrix<T,M,N,SO1>, MT >;
1393 };
1394 
1395 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1396 struct SubTrait< DiagonalMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
1397 {
1399 };
1400 
1401 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1402 struct SubTrait< HybridMatrix<T,M,N,SO1>, DiagonalMatrix<MT,SO2,DF> >
1403 {
1404  using Type = SubTrait_< HybridMatrix<T,M,N,SO1>, MT >;
1405 };
1406 
1407 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1408 struct SubTrait< DiagonalMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
1409 {
1410  using Type = SubTrait_< MT, DynamicMatrix<T,SO2> >;
1411 };
1412 
1413 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1414 struct SubTrait< DynamicMatrix<T,SO1>, DiagonalMatrix<MT,SO2,DF> >
1415 {
1416  using Type = SubTrait_< DynamicMatrix<T,SO1>, MT >;
1417 };
1418 
1419 template< typename MT, bool SO1, bool DF, typename T, bool AF, bool PF, bool SO2 >
1420 struct SubTrait< DiagonalMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
1421 {
1423 };
1424 
1425 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF >
1426 struct SubTrait< CustomMatrix<T,AF,PF,SO1>, DiagonalMatrix<MT,SO2,DF> >
1427 {
1428  using Type = SubTrait_< CustomMatrix<T,AF,PF,SO1>, MT >;
1429 };
1430 
1431 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1432 struct SubTrait< DiagonalMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
1433 {
1435 };
1436 
1437 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1438 struct SubTrait< CompressedMatrix<T,SO1>, DiagonalMatrix<MT,SO2,DF> >
1439 {
1440  using Type = SubTrait_< CompressedMatrix<T,SO1>, MT >;
1441 };
1442 
1443 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1444 struct SubTrait< DiagonalMatrix<MT,SO1,DF>, IdentityMatrix<T,SO2> >
1445 {
1447 };
1448 
1449 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1450 struct SubTrait< IdentityMatrix<T,SO1>, DiagonalMatrix<MT,SO2,DF> >
1451 {
1453 };
1454 
1455 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
1456 struct SubTrait< DiagonalMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
1457 {
1458  using Type = SymmetricMatrix< SubTrait_<MT1,MT2> >;
1459 };
1460 
1461 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
1462 struct SubTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, DiagonalMatrix<MT2,SO2,DF2> >
1463 {
1464  using Type = SymmetricMatrix< SubTrait_<MT1,MT2> >;
1465 };
1466 
1467 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1468 struct SubTrait< DiagonalMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
1469 {
1470  using Type = If_< IsBuiltin< ElementType_<MT2> >
1472  , SubTrait_<MT1,MT2> >;
1473 };
1474 
1475 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1476 struct SubTrait< HermitianMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1477 {
1478  using Type = If_< IsBuiltin< ElementType_<MT1> >
1480  , SubTrait_<MT1,MT2> >;
1481 };
1482 
1483 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1484 struct SubTrait< DiagonalMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1485 {
1486  using Type = LowerMatrix< SubTrait_<MT1,MT2> >;
1487 };
1488 
1489 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1490 struct SubTrait< LowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1491 {
1492  using Type = LowerMatrix< SubTrait_<MT1,MT2> >;
1493 };
1494 
1495 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1496 struct SubTrait< DiagonalMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
1497 {
1498  using Type = LowerMatrix< SubTrait_<MT1,MT2> >;
1499 };
1500 
1501 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1502 struct SubTrait< UniLowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1503 {
1504  using Type = LowerMatrix< SubTrait_<MT1,MT2> >;
1505 };
1506 
1507 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1508 struct SubTrait< DiagonalMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1509 {
1510  using Type = UpperMatrix< SubTrait_<MT1,MT2> >;
1511 };
1512 
1513 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1514 struct SubTrait< UpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1515 {
1516  using Type = UpperMatrix< SubTrait_<MT1,MT2> >;
1517 };
1518 
1519 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1520 struct SubTrait< DiagonalMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
1521 {
1522  using Type = UpperMatrix< SubTrait_<MT1,MT2> >;
1523 };
1524 
1525 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1526 struct SubTrait< UniUpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1527 {
1528  using Type = UpperMatrix< SubTrait_<MT1,MT2> >;
1529 };
1530 
1531 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1532 struct SubTrait< DiagonalMatrix<MT1,SO1,DF1>, StrictlyUpperMatrix<MT2,SO2,DF2> >
1533 {
1534  using Type = UpperMatrix< SubTrait_<MT1,MT2> >;
1535 };
1536 
1537 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1538 struct SubTrait< StrictlyUpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1539 {
1540  using Type = UpperMatrix< SubTrait_<MT1,MT2> >;
1541 };
1542 
1543 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1544 struct SubTrait< DiagonalMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1545 {
1546  using Type = DiagonalMatrix< SubTrait_<MT1,MT2> >;
1547 };
1549 //*************************************************************************************************
1550 
1551 
1552 
1553 
1554 //=================================================================================================
1555 //
1556 // SCHURTRAIT SPECIALIZATIONS
1557 //
1558 //=================================================================================================
1559 
1560 //*************************************************************************************************
1562 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1563 struct SchurTrait< DiagonalMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
1564 {
1566 };
1567 
1568 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1569 struct SchurTrait< StaticMatrix<T,M,N,SO1>, DiagonalMatrix<MT,SO2,DF> >
1570 {
1572 };
1573 
1574 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1575 struct SchurTrait< DiagonalMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
1576 {
1578 };
1579 
1580 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1581 struct SchurTrait< HybridMatrix<T,M,N,SO1>, DiagonalMatrix<MT,SO2,DF> >
1582 {
1584 };
1585 
1586 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1587 struct SchurTrait< DiagonalMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
1588 {
1590 };
1591 
1592 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1593 struct SchurTrait< DynamicMatrix<T,SO1>, DiagonalMatrix<MT,SO2,DF> >
1594 {
1596 };
1597 
1598 template< typename MT, bool SO1, bool DF, typename T, bool AF, bool PF, bool SO2 >
1599 struct SchurTrait< DiagonalMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
1600 {
1602 };
1603 
1604 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF >
1605 struct SchurTrait< CustomMatrix<T,AF,PF,SO1>, DiagonalMatrix<MT,SO2,DF> >
1606 {
1608 };
1609 
1610 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1611 struct SchurTrait< DiagonalMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
1612 {
1614 };
1615 
1616 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1617 struct SchurTrait< CompressedMatrix<T,SO1>, DiagonalMatrix<MT,SO2,DF> >
1618 {
1620 };
1621 
1622 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1623 struct SchurTrait< DiagonalMatrix<MT,SO1,DF>, IdentityMatrix<T,SO2> >
1624 {
1626 };
1627 
1628 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1629 struct SchurTrait< IdentityMatrix<T,SO1>, DiagonalMatrix<MT,SO2,DF> >
1630 {
1632 };
1633 
1634 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
1635 struct SchurTrait< DiagonalMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
1636 {
1637  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1638 };
1639 
1640 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
1641 struct SchurTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, DiagonalMatrix<MT2,SO2,DF2> >
1642 {
1643  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1644 };
1645 
1646 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1647 struct SchurTrait< DiagonalMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
1648 {
1649  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1650 };
1651 
1652 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1653 struct SchurTrait< HermitianMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1654 {
1655  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1656 };
1657 
1658 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1659 struct SchurTrait< DiagonalMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1660 {
1661  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1662 };
1663 
1664 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1665 struct SchurTrait< LowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1666 {
1667  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1668 };
1669 
1670 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1671 struct SchurTrait< DiagonalMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
1672 {
1673  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1674 };
1675 
1676 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1677 struct SchurTrait< UniLowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1678 {
1679  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1680 };
1681 
1682 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1683 struct SchurTrait< DiagonalMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2> >
1684 {
1685  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1686 };
1687 
1688 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1689 struct SchurTrait< StrictlyLowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1690 {
1691  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1692 };
1693 
1694 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1695 struct SchurTrait< DiagonalMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1696 {
1697  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1698 };
1699 
1700 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1701 struct SchurTrait< UpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1702 {
1703  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1704 };
1705 
1706 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1707 struct SchurTrait< DiagonalMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
1708 {
1709  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1710 };
1711 
1712 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1713 struct SchurTrait< UniUpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1714 {
1715  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1716 };
1717 
1718 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1719 struct SchurTrait< DiagonalMatrix<MT1,SO1,DF1>, StrictlyUpperMatrix<MT2,SO2,DF2> >
1720 {
1721  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1722 };
1723 
1724 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1725 struct SchurTrait< StrictlyUpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1726 {
1727  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1728 };
1729 
1730 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1731 struct SchurTrait< DiagonalMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1732 {
1733  using Type = DiagonalMatrix< SchurTrait_<MT1,MT2> >;
1734 };
1736 //*************************************************************************************************
1737 
1738 
1739 
1740 
1741 //=================================================================================================
1742 //
1743 // MULTTRAIT SPECIALIZATIONS
1744 //
1745 //=================================================================================================
1746 
1747 //*************************************************************************************************
1749 template< typename MT, bool SO, bool DF, typename T >
1750 struct MultTrait< DiagonalMatrix<MT,SO,DF>, T, EnableIf_< IsNumeric<T> > >
1751 {
1752  using Type = DiagonalMatrix< MultTrait_<MT,T> >;
1753 };
1754 
1755 template< typename T, typename MT, bool SO, bool DF >
1756 struct MultTrait< T, DiagonalMatrix<MT,SO,DF>, EnableIf_< IsNumeric<T> > >
1757 {
1758  using Type = DiagonalMatrix< MultTrait_<T,MT> >;
1759 };
1760 
1761 template< typename MT, bool SO, bool DF, typename T, size_t N >
1762 struct MultTrait< DiagonalMatrix<MT,SO,DF>, StaticVector<T,N,false> >
1763 {
1765 };
1766 
1767 template< typename T, size_t N, typename MT, bool SO, bool DF >
1768 struct MultTrait< StaticVector<T,N,true>, DiagonalMatrix<MT,SO,DF> >
1769 {
1770  using Type = MultTrait_< StaticVector<T,N,true>, MT >;
1771 };
1772 
1773 template< typename MT, bool SO, bool DF, typename T, size_t N >
1774 struct MultTrait< DiagonalMatrix<MT,SO,DF>, HybridVector<T,N,false> >
1775 {
1777 };
1778 
1779 template< typename T, size_t N, typename MT, bool SO, bool DF >
1780 struct MultTrait< HybridVector<T,N,true>, DiagonalMatrix<MT,SO,DF> >
1781 {
1782  using Type = MultTrait_< HybridVector<T,N,true>, MT >;
1783 };
1784 
1785 template< typename MT, bool SO, bool DF, typename T >
1786 struct MultTrait< DiagonalMatrix<MT,SO,DF>, DynamicVector<T,false> >
1787 {
1789 };
1790 
1791 template< typename T, typename MT, bool SO, bool DF >
1792 struct MultTrait< DynamicVector<T,true>, DiagonalMatrix<MT,SO,DF> >
1793 {
1794  using Type = MultTrait_< DynamicVector<T,true>, MT >;
1795 };
1796 
1797 template< typename MT, bool SO, bool DF, typename T, bool AF, bool PF >
1798 struct MultTrait< DiagonalMatrix<MT,SO,DF>, CustomVector<T,AF,PF,false> >
1799 {
1801 };
1802 
1803 template< typename T, bool AF, bool PF, typename MT, bool SO, bool DF >
1804 struct MultTrait< CustomVector<T,AF,PF,true>, DiagonalMatrix<MT,SO,DF> >
1805 {
1806  using Type = MultTrait_< CustomVector<T,AF,PF,true>, MT >;
1807 };
1808 
1809 template< typename MT, bool SO, bool DF, typename T >
1810 struct MultTrait< DiagonalMatrix<MT,SO,DF>, CompressedVector<T,false> >
1811 {
1813 };
1814 
1815 template< typename T, typename MT, bool SO, bool DF >
1816 struct MultTrait< CompressedVector<T,true>, DiagonalMatrix<MT,SO,DF> >
1817 {
1818  using Type = MultTrait_< CompressedVector<T,true>, MT >;
1819 };
1820 
1821 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1822 struct MultTrait< DiagonalMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
1823 {
1825 };
1826 
1827 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1828 struct MultTrait< StaticMatrix<T,M,N,SO1>, DiagonalMatrix<MT,SO2,DF> >
1829 {
1830  using Type = MultTrait_< StaticMatrix<T,M,N,SO1>, MT >;
1831 };
1832 
1833 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1834 struct MultTrait< DiagonalMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
1835 {
1837 };
1838 
1839 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1840 struct MultTrait< HybridMatrix<T,M,N,SO1>, DiagonalMatrix<MT,SO2,DF> >
1841 {
1842  using Type = MultTrait_< HybridMatrix<T,M,N,SO1>, MT >;
1843 };
1844 
1845 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1846 struct MultTrait< DiagonalMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
1847 {
1848  using Type = MultTrait_< MT, DynamicMatrix<T,SO2> >;
1849 };
1850 
1851 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1852 struct MultTrait< DynamicMatrix<T,SO1>, DiagonalMatrix<MT,SO2,DF> >
1853 {
1854  using Type = MultTrait_< DynamicMatrix<T,SO1>, MT >;
1855 };
1856 
1857 template< typename MT, bool SO1, bool DF, typename T, bool AF, bool PF, bool SO2 >
1858 struct MultTrait< DiagonalMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
1859 {
1861 };
1862 
1863 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF >
1864 struct MultTrait< CustomMatrix<T,AF,PF,SO1>, DiagonalMatrix<MT,SO2,DF> >
1865 {
1866  using Type = MultTrait_< CustomMatrix<T,AF,PF,SO1>, MT >;
1867 };
1868 
1869 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1870 struct MultTrait< DiagonalMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
1871 {
1873 };
1874 
1875 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1876 struct MultTrait< CompressedMatrix<T,SO1>, DiagonalMatrix<MT,SO2,DF> >
1877 {
1878  using Type = MultTrait_< CompressedMatrix<T,SO1>, MT >;
1879 };
1880 
1881 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1882 struct MultTrait< DiagonalMatrix<MT,SO1,DF>, IdentityMatrix<T,SO2> >
1883 {
1885 };
1886 
1887 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1888 struct MultTrait< IdentityMatrix<T,SO1>, DiagonalMatrix<MT,SO2,DF> >
1889 {
1891 };
1892 
1893 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
1894 struct MultTrait< DiagonalMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
1895 {
1896  using Type = MultTrait_<MT1,MT2>;
1897 };
1898 
1899 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
1900 struct MultTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, DiagonalMatrix<MT2,SO2,DF2> >
1901 {
1902  using Type = MultTrait_<MT1,MT2>;
1903 };
1904 
1905 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1906 struct MultTrait< DiagonalMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
1907 {
1908  using Type = MultTrait_<MT1,MT2>;
1909 };
1910 
1911 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1912 struct MultTrait< HermitianMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1913 {
1914  using Type = MultTrait_<MT1,MT2>;
1915 };
1916 
1917 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1918 struct MultTrait< DiagonalMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1919 {
1920  using Type = LowerMatrix< MultTrait_<MT1,MT2> >;
1921 };
1922 
1923 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1924 struct MultTrait< LowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1925 {
1926  using Type = LowerMatrix< MultTrait_<MT1,MT2> >;
1927 };
1928 
1929 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1930 struct MultTrait< DiagonalMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
1931 {
1932  using Type = LowerMatrix< MultTrait_<MT1,MT2> >;
1933 };
1934 
1935 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1936 struct MultTrait< UniLowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1937 {
1938  using Type = LowerMatrix< MultTrait_<MT1,MT2> >;
1939 };
1940 
1941 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1942 struct MultTrait< DiagonalMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2> >
1943 {
1945 };
1946 
1947 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1948 struct MultTrait< StrictlyLowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1949 {
1951 };
1952 
1953 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1954 struct MultTrait< DiagonalMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
1955 {
1956  using Type = UpperMatrix< MultTrait_<MT1,MT2> >;
1957 };
1958 
1959 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1960 struct MultTrait< UpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1961 {
1962  using Type = UpperMatrix< MultTrait_<MT1,MT2> >;
1963 };
1964 
1965 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1966 struct MultTrait< DiagonalMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
1967 {
1968  using Type = UpperMatrix< MultTrait_<MT1,MT2> >;
1969 };
1970 
1971 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1972 struct MultTrait< UniUpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1973 {
1974  using Type = UpperMatrix< MultTrait_<MT1,MT2> >;
1975 };
1976 
1977 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1978 struct MultTrait< DiagonalMatrix<MT1,SO1,DF1>, StrictlyUpperMatrix<MT2,SO2,DF2> >
1979 {
1981 };
1982 
1983 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1984 struct MultTrait< StrictlyUpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1985 {
1987 };
1988 
1989 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1990 struct MultTrait< DiagonalMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1991 {
1992  using Type = DiagonalMatrix< MultTrait_<MT1,MT2> >;
1993 };
1995 //*************************************************************************************************
1996 
1997 
1998 
1999 
2000 //=================================================================================================
2001 //
2002 // DIVTRAIT SPECIALIZATIONS
2003 //
2004 //=================================================================================================
2005 
2006 //*************************************************************************************************
2008 template< typename MT, bool SO, bool DF, typename T >
2009 struct DivTrait< DiagonalMatrix<MT,SO,DF>, T, EnableIf_< IsNumeric<T> > >
2010 {
2011  using Type = DiagonalMatrix< DivTrait_<MT,T> >;
2012 };
2014 //*************************************************************************************************
2015 
2016 
2017 
2018 
2019 //=================================================================================================
2020 //
2021 // UNARYMAPTRAIT SPECIALIZATIONS
2022 //
2023 //=================================================================================================
2024 
2025 //*************************************************************************************************
2027 template< typename MT, bool SO, bool DF >
2028 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Abs >
2029 {
2031 };
2032 
2033 template< typename MT, bool SO, bool DF >
2034 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Floor >
2035 {
2037 };
2038 
2039 template< typename MT, bool SO, bool DF >
2040 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Ceil >
2041 {
2043 };
2044 
2045 template< typename MT, bool SO, bool DF >
2046 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Trunc >
2047 {
2049 };
2050 
2051 template< typename MT, bool SO, bool DF >
2052 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Round >
2053 {
2055 };
2056 
2057 template< typename MT, bool SO, bool DF >
2058 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Conj >
2059 {
2061 };
2062 
2063 template< typename MT, bool SO, bool DF >
2064 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Real >
2065 {
2067 };
2068 
2069 template< typename MT, bool SO, bool DF >
2070 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Imag >
2071 {
2073 };
2074 
2075 template< typename MT, bool SO, bool DF >
2076 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Sqrt >
2077 {
2079 };
2080 
2081 template< typename MT, bool SO, bool DF >
2082 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Cbrt >
2083 {
2085 };
2086 
2087 template< typename MT, bool SO, bool DF >
2088 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Sin >
2089 {
2091 };
2092 
2093 template< typename MT, bool SO, bool DF >
2094 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Asin >
2095 {
2097 };
2098 
2099 template< typename MT, bool SO, bool DF >
2100 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Sinh >
2101 {
2103 };
2104 
2105 template< typename MT, bool SO, bool DF >
2106 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Asinh >
2107 {
2109 };
2110 
2111 template< typename MT, bool SO, bool DF >
2112 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Tan >
2113 {
2115 };
2116 
2117 template< typename MT, bool SO, bool DF >
2118 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Atan >
2119 {
2121 };
2122 
2123 template< typename MT, bool SO, bool DF >
2124 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Tanh >
2125 {
2127 };
2128 
2129 template< typename MT, bool SO, bool DF >
2130 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Atanh >
2131 {
2133 };
2134 
2135 template< typename MT, bool SO, bool DF >
2136 struct UnaryMapTrait< DiagonalMatrix<MT,SO,DF>, Erf >
2137 {
2139 };
2141 //*************************************************************************************************
2142 
2143 
2144 
2145 
2146 //=================================================================================================
2147 //
2148 // BINARYMAPTRAIT SPECIALIZATIONS
2149 //
2150 //=================================================================================================
2151 
2152 //*************************************************************************************************
2154 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
2155 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF>, Min >
2156 {
2158 };
2159 
2160 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
2161 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF>, Max >
2162 {
2164 };
2165 
2166 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
2167 struct BinaryMapTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, DiagonalMatrix<MT2,SO2,DF2>, Min >
2168 {
2170 };
2171 
2172 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
2173 struct BinaryMapTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, DiagonalMatrix<MT2,SO2,DF2>, Max >
2174 {
2176 };
2177 
2178 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2179 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2>, Min >
2180 {
2182 };
2183 
2184 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2185 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2>, Max >
2186 {
2188 };
2189 
2190 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2191 struct BinaryMapTrait< HermitianMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2>, Min >
2192 {
2194 };
2195 
2196 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2197 struct BinaryMapTrait< HermitianMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2>, Max >
2198 {
2200 };
2201 
2202 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2203 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2>, Min >
2204 {
2206 };
2207 
2208 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2209 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2>, Max >
2210 {
2212 };
2213 
2214 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2215 struct BinaryMapTrait< LowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2>, Min >
2216 {
2218 };
2219 
2220 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2221 struct BinaryMapTrait< LowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2>, Max >
2222 {
2224 };
2225 
2226 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2227 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2>, Min >
2228 {
2230 };
2231 
2232 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2233 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2>, Max >
2234 {
2236 };
2237 
2238 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2239 struct BinaryMapTrait< UniLowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2>, Min >
2240 {
2242 };
2243 
2244 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2245 struct BinaryMapTrait< UniLowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2>, Max >
2246 {
2248 };
2249 
2250 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2251 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2>, Min >
2252 {
2254 };
2255 
2256 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2257 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2>, Max >
2258 {
2260 };
2261 
2262 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2263 struct BinaryMapTrait< StrictlyLowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2>, Min >
2264 {
2266 };
2267 
2268 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2269 struct BinaryMapTrait< StrictlyLowerMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2>, Max >
2270 {
2272 };
2273 
2274 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2275 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2>, Min >
2276 {
2278 };
2279 
2280 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2281 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2>, Max >
2282 {
2284 };
2285 
2286 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2287 struct BinaryMapTrait< UpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2>, Min >
2288 {
2290 };
2291 
2292 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2293 struct BinaryMapTrait< UpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2>, Max >
2294 {
2296 };
2297 
2298 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2299 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2>, Min >
2300 {
2302 };
2303 
2304 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2305 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2>, Max >
2306 {
2308 };
2309 
2310 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2311 struct BinaryMapTrait< UniUpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2>, Min >
2312 {
2314 };
2315 
2316 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2317 struct BinaryMapTrait< UniUpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2>, Max >
2318 {
2320 };
2321 
2322 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2323 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, StrictlyUpperMatrix<MT2,SO2,DF2>, Min >
2324 {
2326 };
2327 
2328 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2329 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, StrictlyUpperMatrix<MT2,SO2,DF2>, Max >
2330 {
2332 };
2333 
2334 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2335 struct BinaryMapTrait< StrictlyUpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2>, Min >
2336 {
2338 };
2339 
2340 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2341 struct BinaryMapTrait< StrictlyUpperMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2>, Max >
2342 {
2344 };
2345 
2346 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2347 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2>, Min >
2348 {
2350 };
2351 
2352 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2353 struct BinaryMapTrait< DiagonalMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2>, Max >
2354 {
2356 };
2358 //*************************************************************************************************
2359 
2360 
2361 
2362 
2363 //=================================================================================================
2364 //
2365 // DECLSYMTRAIT SPECIALIZATIONS
2366 //
2367 //=================================================================================================
2368 
2369 //*************************************************************************************************
2371 template< typename MT, bool SO, bool DF >
2372 struct DeclSymTrait< DiagonalMatrix<MT,SO,DF> >
2373 {
2374  using Type = DiagonalMatrix<MT,SO,DF>;
2375 };
2377 //*************************************************************************************************
2378 
2379 
2380 
2381 
2382 //=================================================================================================
2383 //
2384 // DECLHERMTRAIT SPECIALIZATIONS
2385 //
2386 //=================================================================================================
2387 
2388 //*************************************************************************************************
2390 template< typename MT, bool SO, bool DF >
2391 struct DeclHermTrait< DiagonalMatrix<MT,SO,DF> >
2392 {
2393  using Type = HermitianMatrix<MT,SO,DF>;
2394 };
2396 //*************************************************************************************************
2397 
2398 
2399 
2400 
2401 //=================================================================================================
2402 //
2403 // DECLLOWTRAIT SPECIALIZATIONS
2404 //
2405 //=================================================================================================
2406 
2407 //*************************************************************************************************
2409 template< typename MT, bool SO, bool DF >
2410 struct DeclLowTrait< DiagonalMatrix<MT,SO,DF> >
2411 {
2412  using Type = DiagonalMatrix<MT,SO,DF>;
2413 };
2415 //*************************************************************************************************
2416 
2417 
2418 
2419 
2420 //=================================================================================================
2421 //
2422 // DECLUPPTRAIT SPECIALIZATIONS
2423 //
2424 //=================================================================================================
2425 
2426 //*************************************************************************************************
2428 template< typename MT, bool SO, bool DF >
2429 struct DeclUppTrait< DiagonalMatrix<MT,SO,DF> >
2430 {
2431  using Type = DiagonalMatrix<MT,SO,DF>;
2432 };
2434 //*************************************************************************************************
2435 
2436 
2437 
2438 
2439 //=================================================================================================
2440 //
2441 // DECLDIAGTRAIT SPECIALIZATIONS
2442 //
2443 //=================================================================================================
2444 
2445 //*************************************************************************************************
2447 template< typename MT, bool SO, bool DF >
2448 struct DeclDiagTrait< DiagonalMatrix<MT,SO,DF> >
2449 {
2450  using Type = DiagonalMatrix<MT,SO,DF>;
2451 };
2453 //*************************************************************************************************
2454 
2455 
2456 
2457 
2458 //=================================================================================================
2459 //
2460 // HIGHTYPE SPECIALIZATIONS
2461 //
2462 //=================================================================================================
2463 
2464 //*************************************************************************************************
2466 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2467 struct HighType< DiagonalMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
2468 {
2470 };
2472 //*************************************************************************************************
2473 
2474 
2475 
2476 
2477 //=================================================================================================
2478 //
2479 // LOWTYPE SPECIALIZATIONS
2480 //
2481 //=================================================================================================
2482 
2483 //*************************************************************************************************
2485 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2486 struct LowType< DiagonalMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
2487 {
2489 };
2491 //*************************************************************************************************
2492 
2493 
2494 
2495 
2496 //=================================================================================================
2497 //
2498 // SUBMATRIXTRAIT SPECIALIZATIONS
2499 //
2500 //=================================================================================================
2501 
2502 //*************************************************************************************************
2504 template< typename MT, bool SO, bool DF >
2505 struct SubmatrixTrait< DiagonalMatrix<MT,SO,DF> >
2506 {
2507  using Type = SubmatrixTrait_<MT>;
2508 };
2510 //*************************************************************************************************
2511 
2512 
2513 
2514 
2515 //=================================================================================================
2516 //
2517 // ROWTRAIT SPECIALIZATIONS
2518 //
2519 //=================================================================================================
2520 
2521 //*************************************************************************************************
2523 template< typename MT, bool SO, bool DF >
2524 struct RowTrait< DiagonalMatrix<MT,SO,DF> >
2525 {
2526  using Type = RowTrait_<MT>;
2527 };
2529 //*************************************************************************************************
2530 
2531 
2532 
2533 
2534 //=================================================================================================
2535 //
2536 // COLUMNTRAIT SPECIALIZATIONS
2537 //
2538 //=================================================================================================
2539 
2540 //*************************************************************************************************
2542 template< typename MT, bool SO, bool DF >
2543 struct ColumnTrait< DiagonalMatrix<MT,SO,DF> >
2544 {
2545  using Type = ColumnTrait_<MT>;
2546 };
2548 //*************************************************************************************************
2549 
2550 } // namespace blaze
2551 
2552 #endif
Header file for auxiliary alias declarations.
Header file for the decldiag trait.
Header file for the Schur product trait.
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.
Header file for the row trait.
Header file for the declherm trait.
Base template for the SubmatrixTrait class.
Definition: SubmatrixTrait.h:128
Flag for the inversion of a upper unitriangular matrix.
Definition: InversionFlag.h:114
Base template for the ColumnTrait class.
Definition: ColumnTrait.h:127
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:162
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
Base template for the DeclUppTrait class.
Definition: DeclUppTrait.h:133
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
Matrix adapter for lower triangular matrices.
Definition: BaseTemplate.h:553
Header file for the dense matrix inversion flags.
Base template for the SchurTrait class.
Definition: SchurTrait.h:124
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:198
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:560
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:88
#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
Matrix adapter for symmetric matrices.
Definition: BaseTemplate.h:611
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:250
Column< MT > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:124
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:78
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:129
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is an identity matrix.
Definition: DenseMatrix.h:1686
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.
Row< MT > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:124
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:772
Base template for the RowTrait class.
Definition: RowTrait.h:127
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.
Header file for the unary map trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Matrix adapter for strictly upper triangular matrices.
Definition: BaseTemplate.h:558
Header file for the IsShrinkable type trait.
Header file for all forward declarations of the math module.
Compile time check for data types with padding.This type trait tests whether the given data type empl...
Definition: IsPadded.h:76
Header file for the decllow trait.
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.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
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
DiagonalMatrix specialization for dense matrices.
Header file for the IsLower type trait.
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:340
Base template for the DeclSymTrait class.
Definition: DeclSymTrait.h:134
Compile time check for symmetric matrices.This type trait tests whether or not the given template par...
Definition: IsSymmetric.h:85
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:548
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:264
Header file for the RemoveAdaptor type trait.
Constraint on the data type.
Matrix adapter for upper triangular matrices.
Definition: BaseTemplate.h:553
Compile time check for adaptors.This type trait tests whether the given template parameter is an adap...
Definition: IsAdaptor.h:88
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:580
Header file for the IsPadded type trait.
Header file for the IsAdaptor type trait.
Compile time check for shrinkable data types.This type trait tests whether the given data type is a s...
Definition: IsShrinkable.h:75
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
Header file for the declupp trait.
#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 the binary map trait.
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:139
Base template for the DeclHermTrait class.
Definition: DeclHermTrait.h:134
Base template for the MultTrait class.
Definition: MultTrait.h:139
Header file for the addition trait.
Header file for the division trait.
Header file for the submatrix trait.
Constraint on the data type.
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:154
#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 declsym trait.
Matrix adapter for strictly lower triangular matrices.
Definition: BaseTemplate.h:558
Matrix adapter for Hermitian matrices.
Definition: BaseTemplate.h:614
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:270
Compile time check for Hermitian matrices.This type trait tests whether or not the given template par...
Definition: IsHermitian.h:85
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:101
#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:163
Base template for the DivTrait class.
Definition: DivTrait.h:139
typename ColumnTrait< MT >::Type ColumnTrait_
Auxiliary alias declaration for the ColumnTrait type trait.The ColumnTrait_ alias declaration provide...
Definition: ColumnTrait.h:162
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:324
Header file for the implementation of the base template of the DiagonalMatrix.
Base template for the DeclLowTrait class.
Definition: DeclLowTrait.h:133
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:177
Header file for the IsBuiltin type trait.
typename SubTrait< T1, T2 >::Type SubTrait_
Auxiliary alias declaration for the SubTrait class template.The SubTrait_ alias declaration provides ...
Definition: SubTrait.h:250
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:130
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:75
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:252
Compile time evaluation of the number of rows of a matrix.The Rows type trait evaluates the number of...
Definition: Rows.h:75
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:600
#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:139
Matrix adapter for diagonal matrices.
Definition: BaseTemplate.h:560
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 IsHermitian type trait.
Base template for the DeclDiagTrait class.
Definition: DeclDiagTrait.h:133
Base template for the BinaryMapTrait class.
Definition: BinaryMapTrait.h:119
Header file for the IsResizable type trait.
Header file for the IsRestricted type trait.
Base template for the UnaryMapTrait class.
Definition: UnaryMapTrait.h:117
typename AddTrait< T1, T2 >::Type AddTrait_
Auxiliary alias declaration for the AddTrait class template.The AddTrait_ alias declaration provides ...
Definition: AddTrait.h:250
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
DiagonalMatrix specialization for sparse matrices.
Header file for the HighType type trait.
Header file for the TrueType type/value trait base class.