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>
102 #include <blaze/util/Assert.h>
103 #include <blaze/util/EnableIf.h>
104 #include <blaze/util/mpl/If.h>
105 #include <blaze/util/TrueType.h>
108 #include <blaze/util/Unused.h>
109 
110 
111 namespace blaze {
112 
113 //=================================================================================================
114 //
115 // DIAGONALMATRIX OPERATORS
116 //
117 //=================================================================================================
118 
119 //*************************************************************************************************
122 template< typename MT, bool SO, bool DF >
123 void reset( DiagonalMatrix<MT,SO,DF>& m );
124 
125 template< typename MT, bool SO, bool DF >
126 void reset( DiagonalMatrix<MT,SO,DF>& m, size_t i );
127 
128 template< typename MT, bool SO, bool DF >
129 void clear( DiagonalMatrix<MT,SO,DF>& m );
130 
131 template< bool RF, typename MT, bool SO, bool DF >
132 bool isDefault( const DiagonalMatrix<MT,SO,DF>& m );
133 
134 template< typename MT, bool SO, bool DF >
135 bool isIntact( const DiagonalMatrix<MT,SO,DF>& m );
136 
137 template< typename MT, bool SO, bool DF >
138 void swap( DiagonalMatrix<MT,SO,DF>& a, DiagonalMatrix<MT,SO,DF>& b ) noexcept;
140 //*************************************************************************************************
141 
142 
143 //*************************************************************************************************
150 template< typename MT // Type of the adapted matrix
151  , bool SO // Storage order of the adapted matrix
152  , bool DF > // Density flag
154 {
155  m.reset();
156 }
157 //*************************************************************************************************
158 
159 
160 //*************************************************************************************************
173 template< typename MT // Type of the adapted matrix
174  , bool SO // Storage order of the adapted matrix
175  , bool DF > // Density flag
176 inline void reset( DiagonalMatrix<MT,SO,DF>& m, size_t i )
177 {
178  m.reset( i );
179 }
180 //*************************************************************************************************
181 
182 
183 //*************************************************************************************************
190 template< typename MT // Type of the adapted matrix
191  , bool SO // Storage order of the adapted matrix
192  , bool DF > // Density flag
194 {
195  m.clear();
196 }
197 //*************************************************************************************************
198 
199 
200 //*************************************************************************************************
228 template< bool RF // Relaxation flag
229  , typename MT // Type of the adapted matrix
230  , bool SO // Storage order of the adapted matrix
231  , bool DF > // Density flag
232 inline bool isDefault( const DiagonalMatrix<MT,SO,DF>& m )
233 {
234  return isDefault<RF>( m.matrix_ );
235 }
236 //*************************************************************************************************
237 
238 
239 //*************************************************************************************************
260 template< typename MT // Type of the adapted matrix
261  , bool SO // Storage order of the adapted matrix
262  , bool DF > // Density flag
263 inline bool isIntact( const DiagonalMatrix<MT,SO,DF>& m )
264 {
265  return m.isIntact();
266 }
267 //*************************************************************************************************
268 
269 
270 //*************************************************************************************************
278 template< typename MT // Type of the adapted matrix
279  , bool SO // Storage order of the adapted matrix
280  , bool DF > // Density flag
282 {
283  a.swap( b );
284 }
285 //*************************************************************************************************
286 
287 
288 //*************************************************************************************************
311 template< InversionFlag IF // Inversion algorithm
312  , typename MT // Type of the dense matrix
313  , bool SO > // Storage order of the dense matrix
314 inline void invert( DiagonalMatrix<MT,SO,true>& m )
315 {
317 
318  if( IF == asUniLower || IF == asUniUpper ) {
319  BLAZE_INTERNAL_ASSERT( isIdentity( m ), "Violation of preconditions detected" );
320  return;
321  }
322 
323  invert<asDiagonal>( derestrict( m ) );
324 
325  BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
326 }
328 //*************************************************************************************************
329 
330 
331 //*************************************************************************************************
350 template< typename MT1, bool SO1, typename MT2, typename MT3, typename MT4, bool SO2 >
351 inline void lu( const DiagonalMatrix<MT1,SO1,true>& A, DenseMatrix<MT2,SO1>& L,
352  DenseMatrix<MT3,SO1>& U, Matrix<MT4,SO2>& P )
353 {
354  BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE( ElementType_t<MT1> );
355 
360 
365 
366  using ET3 = ElementType_t<MT3>;
367  using ET4 = ElementType_t<MT4>;
368 
369  const size_t n( (~A).rows() );
370 
371  decltype(auto) U2( derestrict( ~U ) );
372 
373  (~L) = A;
374 
375  resize( ~U, n, n );
376  reset( U2 );
377 
378  resize( ~P, n, n );
379  reset( ~P );
380 
381  for( size_t i=0UL; i<n; ++i ) {
382  U2(i,i) = ET3(1);
383  (~P)(i,i) = ET4(1);
384  }
385 }
387 //*************************************************************************************************
388 
389 
390 //*************************************************************************************************
406 template< typename MT // Type of the adapted matrix
407  , bool SO // Storage order of the adapted matrix
408  , bool DF // Density flag
409  , typename ET > // Type of the element
410 inline bool trySet( const DiagonalMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
411 {
412  BLAZE_INTERNAL_ASSERT( i < (~mat).rows(), "Invalid row access index" );
413  BLAZE_INTERNAL_ASSERT( j < (~mat).columns(), "Invalid column access index" );
414 
415  UNUSED_PARAMETER( mat );
416 
417  return ( i == j || isDefault( value ) );
418 }
420 //*************************************************************************************************
421 
422 
423 //*************************************************************************************************
439 template< typename MT // Type of the adapted matrix
440  , bool SO // Storage order of the adapted matrix
441  , bool DF // Density flag
442  , typename ET > // Type of the element
443 inline bool tryAdd( const DiagonalMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
444 {
445  return trySet( mat, i, j, value );
446 }
448 //*************************************************************************************************
449 
450 
451 //*************************************************************************************************
467 template< typename MT // Type of the adapted matrix
468  , bool SO // Storage order of the adapted matrix
469  , bool DF // Density flag
470  , typename ET > // Type of the element
471 inline bool trySub( const DiagonalMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
472 {
473  return trySet( mat, i, j, value );
474 }
476 //*************************************************************************************************
477 
478 
479 //*************************************************************************************************
495 template< typename MT // Type of the adapted matrix
496  , bool SO // Storage order of the adapted matrix
497  , bool DF // Density flag
498  , typename VT > // Type of the right-hand side dense vector
499 inline bool tryAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
500  const DenseVector<VT,false>& rhs, size_t row, size_t column )
501 {
503 
504  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
505  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
506  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
507 
508  UNUSED_PARAMETER( lhs );
509 
510  const size_t index( ( column <= row )?( 0UL ):( column - row ) );
511 
512  for( size_t i=0UL; i<index; ++i ) {
513  if( !isDefault( (~rhs)[i] ) )
514  return false;
515  }
516 
517  for( size_t i=index+1UL; i<(~rhs).size(); ++i ) {
518  if( !isDefault( (~rhs)[i] ) )
519  return false;
520  }
521 
522  return true;
523 }
525 //*************************************************************************************************
526 
527 
528 //*************************************************************************************************
544 template< typename MT // Type of the adapted matrix
545  , bool SO // Storage order of the adapted matrix
546  , bool DF // Density flag
547  , typename VT > // Type of the right-hand side dense vector
548 inline bool tryAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
549  const DenseVector<VT,true>& rhs, size_t row, size_t column )
550 {
552 
553  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
554  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
555  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
556 
557  UNUSED_PARAMETER( lhs );
558 
559  const size_t index( ( row <= column )?( 0UL ):( row - column ) );
560 
561  for( size_t i=0UL; i<index; ++i ) {
562  if( !isDefault( (~rhs)[i] ) )
563  return false;
564  }
565 
566  for( size_t i=index+1UL; i<(~rhs).size(); ++i ) {
567  if( !isDefault( (~rhs)[i] ) )
568  return false;
569  }
570 
571  return true;
572 }
574 //*************************************************************************************************
575 
576 
577 //*************************************************************************************************
595 template< typename MT // Type of the adapted matrix
596  , bool SO // Storage order of the adapted matrix
597  , bool DF // Density flag
598  , typename VT // Type of the right-hand side dense vector
599  , bool TF > // Transpose flag of the right-hand side dense vector
600 inline bool tryAssign( const DiagonalMatrix<MT,SO,DF>& lhs, const DenseVector<VT,TF>& rhs,
601  ptrdiff_t band, size_t row, size_t column )
602 {
604 
605  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
606  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
607  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
608 
609  UNUSED_PARAMETER( lhs, row, column );
610 
611  if( band != 0L ) {
612  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
613  if( !isDefault( (~rhs)[i] ) )
614  return false;
615  }
616  }
617 
618  return true;
619 }
621 //*************************************************************************************************
622 
623 
624 //*************************************************************************************************
640 template< typename MT // Type of the adapted matrix
641  , bool SO // Storage order of the adapted matrix
642  , bool DF // Density flag
643  , typename VT > // Type of the right-hand side sparse vector
644 inline bool tryAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
645  const SparseVector<VT,false>& rhs, size_t row, size_t column )
646 {
648 
649  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
650  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
651  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
652 
653  UNUSED_PARAMETER( lhs );
654 
655  const size_t index( column - row );
656 
657  for( auto element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
658  if( element->index() != index && !isDefault( element->value() ) )
659  return false;
660  }
661 
662  return true;
663 }
665 //*************************************************************************************************
666 
667 
668 //*************************************************************************************************
684 template< typename MT // Type of the adapted matrix
685  , bool SO // Storage order of the adapted matrix
686  , bool DF // Density flag
687  , typename VT > // Type of the right-hand side sparse vector
688 inline bool tryAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
689  const SparseVector<VT,true>& rhs, size_t row, size_t column )
690 {
692 
693  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
694  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
695  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
696 
697  UNUSED_PARAMETER( lhs );
698 
699  const size_t index( row - column );
700 
701  for( auto element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
702  if( element->index() != index && !isDefault( element->value() ) )
703  return false;
704  }
705 
706  return true;
707 }
709 //*************************************************************************************************
710 
711 
712 //*************************************************************************************************
730 template< typename MT // Type of the adapted matrix
731  , bool SO // Storage order of the adapted matrix
732  , bool DF // Density flag
733  , typename VT // Type of the right-hand side sparse vector
734  , bool TF > // Transpose flag of the right-hand side sparse vector
735 inline bool tryAssign( const DiagonalMatrix<MT,SO,DF>& lhs, const SparseVector<VT,TF>& rhs,
736  ptrdiff_t band, size_t row, size_t column )
737 {
739 
740  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
741  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
742  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
743 
744  UNUSED_PARAMETER( lhs, row, column );
745 
746  if( band != 0L ) {
747  for( const auto& element : ~rhs ) {
748  if( !isDefault( element.value() ) )
749  return false;
750  }
751  }
752 
753  return true;
754 }
756 //*************************************************************************************************
757 
758 
759 //*************************************************************************************************
775 template< typename MT1 // Type of the adapted matrix
776  , bool SO // Storage order of the adapted matrix
777  , bool DF // Density flag
778  , typename MT2 > // Type of the right-hand side dense matrix
779 inline bool tryAssign( const DiagonalMatrix<MT1,SO,DF>& lhs,
780  const DenseMatrix<MT2,false>& rhs, size_t row, size_t column )
781 {
783 
784  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
785  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
786  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
787  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
788 
789  UNUSED_PARAMETER( lhs );
790 
791  const size_t M( (~rhs).rows() );
792  const size_t N( (~rhs).columns() );
793 
794  for( size_t i=0UL; i<M; ++i ) {
795  for( size_t j=0UL; j<N; ++j ) {
796  if( ( row + i != column + j ) && !isDefault( (~rhs)(i,j) ) )
797  return false;
798  }
799  }
800 
801  return true;
802 }
804 //*************************************************************************************************
805 
806 
807 //*************************************************************************************************
823 template< typename MT1 // Type of the adapted matrix
824  , bool SO // Storage order of the adapted matrix
825  , bool DF // Density flag
826  , typename MT2 > // Type of the right-hand side dense matrix
827 inline bool tryAssign( const DiagonalMatrix<MT1,SO,DF>& lhs,
828  const DenseMatrix<MT2,true>& rhs, size_t row, size_t column )
829 {
831 
832  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
833  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
834  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
835  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
836 
837  UNUSED_PARAMETER( lhs );
838 
839  const size_t M( (~rhs).rows() );
840  const size_t N( (~rhs).columns() );
841 
842  for( size_t j=0UL; j<N; ++j ) {
843  for( size_t i=0UL; i<M; ++i ) {
844  if( ( column + j != row + i ) && !isDefault( (~rhs)(i,j) ) )
845  return false;
846  }
847  }
848 
849  return true;
850 }
852 //*************************************************************************************************
853 
854 
855 //*************************************************************************************************
871 template< typename MT1 // Type of the adapted matrix
872  , bool SO // Storage order of the adapted matrix
873  , bool DF // Density flag
874  , typename MT2 > // Type of the right-hand side sparse matrix
875 inline bool tryAssign( const DiagonalMatrix<MT1,SO,DF>& lhs,
876  const SparseMatrix<MT2,false>& rhs, size_t row, size_t column )
877 {
879 
880  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
881  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
882  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
883  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
884 
885  UNUSED_PARAMETER( lhs );
886 
887  const size_t M( (~rhs).rows() );
888 
889  for( size_t i=0UL; i<M; ++i ) {
890  for( auto element=(~rhs).begin(i); element!=(~rhs).end(i); ++element ) {
891  if( ( row + i != column + element->index() ) && !isDefault( element->value() ) )
892  return false;
893  }
894  }
895 
896  return true;
897 }
899 //*************************************************************************************************
900 
901 
902 //*************************************************************************************************
918 template< typename MT1 // Type of the adapted matrix
919  , bool SO // Storage order of the adapted matrix
920  , bool DF // Density flag
921  , typename MT2 > // Type of the right-hand side sparse matrix
922 inline bool tryAssign( const DiagonalMatrix<MT1,SO,DF>& lhs,
923  const SparseMatrix<MT2,true>& rhs, size_t row, size_t column )
924 {
926 
927  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
928  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
929  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
930  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
931 
932  UNUSED_PARAMETER( lhs );
933 
934  const size_t N( (~rhs).columns() );
935 
936  for( size_t j=0UL; j<N; ++j ) {
937  for( auto element=(~rhs).begin(j); element!=(~rhs).end(j); ++element ) {
938  if( ( column + j != row + element->index() ) && !isDefault( element->value() ) )
939  return false;
940  }
941  }
942 
943  return true;
944 }
946 //*************************************************************************************************
947 
948 
949 //*************************************************************************************************
965 template< typename MT // Type of the adapted matrix
966  , bool SO // Storage order of the adapted matrix
967  , bool DF // Density flag
968  , typename VT // Type of the right-hand side vector
969  , bool TF > // Transpose flag of the right-hand side vector
970 inline bool tryAddAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
971  const Vector<VT,TF>& rhs, size_t row, size_t column )
972 {
973  return tryAssign( lhs, ~rhs, row, column );
974 }
976 //*************************************************************************************************
977 
978 
979 //*************************************************************************************************
997 template< typename MT // Type of the adapted matrix
998  , bool SO // Storage order of the adapted matrix
999  , bool DF // Density flag
1000  , typename VT // Type of the right-hand side vector
1001  , bool TF > // Transpose flag of the right-hand side vector
1002 inline bool tryAddAssign( const DiagonalMatrix<MT,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1003  ptrdiff_t band, size_t row, size_t column )
1004 {
1005  return tryAssign( lhs, ~rhs, band, row, column );
1006 }
1008 //*************************************************************************************************
1009 
1010 
1011 //*************************************************************************************************
1027 template< typename MT1 // Type of the adapted matrix
1028  , bool SO1 // Storage order of the adapted matrix
1029  , bool DF // Density flag
1030  , typename MT2 // Type of the right-hand side matrix
1031  , bool SO2 > // Storage order of the right-hand side matrix
1032 inline bool tryAddAssign( const DiagonalMatrix<MT1,SO1,DF>& lhs,
1033  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1034 {
1035  return tryAssign( lhs, ~rhs, row, column );
1036 }
1038 //*************************************************************************************************
1039 
1040 
1041 //*************************************************************************************************
1058 template< typename MT // Type of the adapted matrix
1059  , bool SO // Storage order of the adapted matrix
1060  , bool DF // Density flag
1061  , typename VT // Type of the right-hand side vector
1062  , bool TF > // Transpose flag of the right-hand side vector
1063 inline bool trySubAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
1064  const Vector<VT,TF>& rhs, size_t row, size_t column )
1065 {
1066  return tryAssign( lhs, ~rhs, row, column );
1067 }
1069 //*************************************************************************************************
1070 
1071 
1072 //*************************************************************************************************
1090 template< typename MT // Type of the adapted matrix
1091  , bool SO // Storage order of the adapted matrix
1092  , bool DF // Density flag
1093  , typename VT // Type of the right-hand side vector
1094  , bool TF > // Transpose flag of the right-hand side vector
1095 inline bool trySubAssign( const DiagonalMatrix<MT,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1096  ptrdiff_t band, size_t row, size_t column )
1097 {
1098  return tryAssign( lhs, ~rhs, band, row, column );
1099 }
1101 //*************************************************************************************************
1102 
1103 
1104 //*************************************************************************************************
1121 template< typename MT1 // Type of the adapted matrix
1122  , bool SO1 // Storage order of the adapted matrix
1123  , bool DF // Density flag
1124  , typename MT2 // Type of the right-hand side matrix
1125  , bool SO2 > // Storage order of the right-hand side matrix
1126 inline bool trySubAssign( const DiagonalMatrix<MT1,SO1,DF>& lhs,
1127  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1128 {
1129  return tryAssign( lhs, ~rhs, row, column );
1130 }
1132 //*************************************************************************************************
1133 
1134 
1135 //*************************************************************************************************
1150 template< typename MT // Type of the adapted matrix
1151  , bool SO // Storage order of the adapted matrix
1152  , bool DF > // Density flag
1153 inline MT& derestrict( DiagonalMatrix<MT,SO,DF>& m )
1154 {
1155  return m.matrix_;
1156 }
1158 //*************************************************************************************************
1159 
1160 
1161 
1162 
1163 //=================================================================================================
1164 //
1165 // SIZE SPECIALIZATIONS
1166 //
1167 //=================================================================================================
1168 
1169 //*************************************************************************************************
1171 template< typename MT, bool SO, bool DF >
1172 struct Size< DiagonalMatrix<MT,SO,DF>, 0UL >
1173  : public Size<MT,0UL>
1174 {};
1175 
1176 template< typename MT, bool SO, bool DF >
1177 struct Size< DiagonalMatrix<MT,SO,DF>, 1UL >
1178  : public Size<MT,1UL>
1179 {};
1181 //*************************************************************************************************
1182 
1183 
1184 
1185 
1186 //=================================================================================================
1187 //
1188 // SIZE SPECIALIZATIONS
1189 //
1190 //=================================================================================================
1191 
1192 //*************************************************************************************************
1194 template< typename MT, bool SO, bool DF >
1195 struct MaxSize< DiagonalMatrix<MT,SO,DF>, 0UL >
1196  : public MaxSize<MT,0UL>
1197 {};
1198 
1199 template< typename MT, bool SO, bool DF >
1200 struct MaxSize< DiagonalMatrix<MT,SO,DF>, 1UL >
1201  : public MaxSize<MT,1UL>
1202 {};
1204 //*************************************************************************************************
1205 
1206 
1207 
1208 
1209 //=================================================================================================
1210 //
1211 // ISSQUARE SPECIALIZATIONS
1212 //
1213 //=================================================================================================
1214 
1215 //*************************************************************************************************
1217 template< typename MT, bool SO, bool DF >
1218 struct IsSquare< DiagonalMatrix<MT,SO,DF> >
1219  : public TrueType
1220 {};
1222 //*************************************************************************************************
1223 
1224 
1225 
1226 
1227 //=================================================================================================
1228 //
1229 // ISUNIFORM SPECIALIZATIONS
1230 //
1231 //=================================================================================================
1232 
1233 //*************************************************************************************************
1235 template< typename MT, bool SO, bool DF >
1236 struct IsUniform< DiagonalMatrix<MT,SO,DF> >
1237  : public IsUniform<MT>
1238 {};
1240 //*************************************************************************************************
1241 
1242 
1243 
1244 
1245 //=================================================================================================
1246 //
1247 // ISSYMMETRIC SPECIALIZATIONS
1248 //
1249 //=================================================================================================
1250 
1251 //*************************************************************************************************
1253 template< typename MT, bool SO, bool DF >
1254 struct IsSymmetric< DiagonalMatrix<MT,SO,DF> >
1255  : public TrueType
1256 {};
1258 //*************************************************************************************************
1259 
1260 
1261 
1262 
1263 //=================================================================================================
1264 //
1265 // ISHERMITIAN SPECIALIZATIONS
1266 //
1267 //=================================================================================================
1268 
1269 //*************************************************************************************************
1271 template< typename MT, bool SO, bool DF >
1272 struct IsHermitian< DiagonalMatrix<MT,SO,DF> >
1273  : public IsBuiltin< ElementType_t<MT> >
1274 {};
1276 //*************************************************************************************************
1277 
1278 
1279 
1280 
1281 //=================================================================================================
1282 //
1283 // ISLOWER SPECIALIZATIONS
1284 //
1285 //=================================================================================================
1286 
1287 //*************************************************************************************************
1289 template< typename MT, bool SO, bool DF >
1290 struct IsLower< DiagonalMatrix<MT,SO,DF> >
1291  : public TrueType
1292 {};
1294 //*************************************************************************************************
1295 
1296 
1297 
1298 
1299 //=================================================================================================
1300 //
1301 // ISSTRICTLYLOWER SPECIALIZATIONS
1302 //
1303 //=================================================================================================
1304 
1305 //*************************************************************************************************
1307 template< typename MT, bool SO, bool DF >
1308 struct IsStrictlyLower< DiagonalMatrix<MT,SO,DF> >
1309  : public IsUniform<MT>
1310 {};
1312 //*************************************************************************************************
1313 
1314 
1315 
1316 
1317 //=================================================================================================
1318 //
1319 // ISUPPER SPECIALIZATIONS
1320 //
1321 //=================================================================================================
1322 
1323 //*************************************************************************************************
1325 template< typename MT, bool SO, bool DF >
1326 struct IsUpper< DiagonalMatrix<MT,SO,DF> >
1327  : public TrueType
1328 {};
1330 //*************************************************************************************************
1331 
1332 
1333 
1334 
1335 //=================================================================================================
1336 //
1337 // ISSTRICTLYUPPER SPECIALIZATIONS
1338 //
1339 //=================================================================================================
1340 
1341 //*************************************************************************************************
1343 template< typename MT, bool SO, bool DF >
1344 struct IsStrictlyUpper< DiagonalMatrix<MT,SO,DF> >
1345  : public IsUniform<MT>
1346 {};
1348 //*************************************************************************************************
1349 
1350 
1351 
1352 
1353 //=================================================================================================
1354 //
1355 // ISADAPTOR SPECIALIZATIONS
1356 //
1357 //=================================================================================================
1358 
1359 //*************************************************************************************************
1361 template< typename MT, bool SO, bool DF >
1362 struct IsAdaptor< DiagonalMatrix<MT,SO,DF> >
1363  : public TrueType
1364 {};
1366 //*************************************************************************************************
1367 
1368 
1369 
1370 
1371 //=================================================================================================
1372 //
1373 // ISRESTRICTED SPECIALIZATIONS
1374 //
1375 //=================================================================================================
1376 
1377 //*************************************************************************************************
1379 template< typename MT, bool SO, bool DF >
1380 struct IsRestricted< DiagonalMatrix<MT,SO,DF> >
1381  : public TrueType
1382 {};
1384 //*************************************************************************************************
1385 
1386 
1387 
1388 
1389 //=================================================================================================
1390 //
1391 // HASCONSTDATAACCESS SPECIALIZATIONS
1392 //
1393 //=================================================================================================
1394 
1395 //*************************************************************************************************
1397 template< typename MT, bool SO >
1398 struct HasConstDataAccess< DiagonalMatrix<MT,SO,true> >
1399  : public TrueType
1400 {};
1402 //*************************************************************************************************
1403 
1404 
1405 
1406 
1407 //=================================================================================================
1408 //
1409 // ISALIGNED SPECIALIZATIONS
1410 //
1411 //=================================================================================================
1412 
1413 //*************************************************************************************************
1415 template< typename MT, bool SO, bool DF >
1416 struct IsAligned< DiagonalMatrix<MT,SO,DF> >
1417  : public IsAligned<MT>
1418 {};
1420 //*************************************************************************************************
1421 
1422 
1423 
1424 
1425 //=================================================================================================
1426 //
1427 // ISCONTIGUOUS SPECIALIZATIONS
1428 //
1429 //=================================================================================================
1430 
1431 //*************************************************************************************************
1433 template< typename MT, bool SO, bool DF >
1434 struct IsContiguous< DiagonalMatrix<MT,SO,DF> >
1435  : public IsContiguous<MT>
1436 {};
1438 //*************************************************************************************************
1439 
1440 
1441 
1442 
1443 //=================================================================================================
1444 //
1445 // ISPADDED SPECIALIZATIONS
1446 //
1447 //=================================================================================================
1448 
1449 //*************************************************************************************************
1451 template< typename MT, bool SO, bool DF >
1452 struct IsPadded< DiagonalMatrix<MT,SO,DF> >
1453  : public IsPadded<MT>
1454 {};
1456 //*************************************************************************************************
1457 
1458 
1459 
1460 
1461 //=================================================================================================
1462 //
1463 // ISRESIZABLE SPECIALIZATIONS
1464 //
1465 //=================================================================================================
1466 
1467 //*************************************************************************************************
1469 template< typename MT, bool SO, bool DF >
1470 struct IsResizable< DiagonalMatrix<MT,SO,DF> >
1471  : public IsResizable<MT>
1472 {};
1474 //*************************************************************************************************
1475 
1476 
1477 
1478 
1479 //=================================================================================================
1480 //
1481 // ISSHRINKABLE SPECIALIZATIONS
1482 //
1483 //=================================================================================================
1484 
1485 //*************************************************************************************************
1487 template< typename MT, bool SO, bool DF >
1488 struct IsShrinkable< DiagonalMatrix<MT,SO,DF> >
1489  : public IsShrinkable<MT>
1490 {};
1492 //*************************************************************************************************
1493 
1494 
1495 
1496 
1497 //=================================================================================================
1498 //
1499 // REMOVEADAPTOR SPECIALIZATIONS
1500 //
1501 //=================================================================================================
1502 
1503 //*************************************************************************************************
1505 template< typename MT, bool SO, bool DF >
1506 struct RemoveAdaptor< DiagonalMatrix<MT,SO,DF> >
1507 {
1508  using Type = MT;
1509 };
1511 //*************************************************************************************************
1512 
1513 
1514 
1515 
1516 //=================================================================================================
1517 //
1518 // ADDTRAIT SPECIALIZATIONS
1519 //
1520 //=================================================================================================
1521 
1522 //*************************************************************************************************
1524 template< typename T1, typename T2 >
1525 struct AddTraitEval1< T1, T2
1526  , EnableIf_t< IsMatrix_v<T1> &&
1527  IsMatrix_v<T2> &&
1528  IsDiagonal_v<T1> && IsDiagonal_v<T2> &&
1529  !( IsZero_v<T1> || IsZero_v<T2> ) > >
1530 {
1531  using Type = DiagonalMatrix< typename AddTraitEval2<T1,T2>::Type >;
1532 };
1534 //*************************************************************************************************
1535 
1536 
1537 
1538 
1539 //=================================================================================================
1540 //
1541 // SUBTRAIT SPECIALIZATIONS
1542 //
1543 //=================================================================================================
1544 
1545 //*************************************************************************************************
1547 template< typename T1, typename T2 >
1548 struct SubTraitEval1< T1, T2
1549  , EnableIf_t< IsMatrix_v<T1> &&
1550  IsMatrix_v<T2> &&
1551  IsDiagonal_v<T1> && IsDiagonal_v<T2> &&
1552  !( IsZero_v<T1> || IsZero_v<T2> ) > >
1553 {
1554  using Type = DiagonalMatrix< typename SubTraitEval2<T1,T2>::Type >;
1555 };
1556 
1557 template< typename T1, typename T2 >
1558 struct SubTraitEval1< T1, T2
1559  , EnableIf_t< IsMatrix_v<T1> &&
1560  IsMatrix_v<T2> &&
1561  IsZero_v<T1> && IsIdentity_v<T2> > >
1562 {
1563  using Tmp = If_t< StorageOrder_v<T1> != StorageOrder_v<T2>, OppositeType_t<T1>, T1 >;
1564  using Type = DiagonalMatrix< typename SubTraitEval2<Tmp,T2>::Type >;
1565 };
1567 //*************************************************************************************************
1568 
1569 
1570 
1571 
1572 //=================================================================================================
1573 //
1574 // SCHURTRAIT SPECIALIZATIONS
1575 //
1576 //=================================================================================================
1577 
1578 //*************************************************************************************************
1580 template< typename T1, typename T2 >
1581 struct SchurTraitEval1< T1, T2
1582  , EnableIf_t< IsMatrix_v<T1> &&
1583  IsMatrix_v<T2> &&
1584  ( IsDiagonal_v<T1> ||
1585  IsDiagonal_v<T2> ||
1586  ( IsLower_v<T1> && IsUpper_v<T2> ) ||
1587  ( IsUpper_v<T1> && IsLower_v<T2> ) ) &&
1588  !( IsStrictlyLower_v<T1> && IsUpper_v<T2> ) &&
1589  !( IsStrictlyUpper_v<T1> && IsLower_v<T2> ) &&
1590  !( IsLower_v<T1> && IsStrictlyUpper_v<T2> ) &&
1591  !( IsUpper_v<T1> && IsStrictlyLower_v<T2> ) &&
1592  !( IsUniTriangular_v<T1> && IsUniTriangular_v<T2> ) &&
1593  !( IsZero_v<T1> || IsZero_v<T2> ) > >
1594 {
1595  using Type = DiagonalMatrix< typename SchurTraitEval2<T1,T2>::Type >;
1596 };
1598 //*************************************************************************************************
1599 
1600 
1601 
1602 
1603 //=================================================================================================
1604 //
1605 // MULTTRAIT SPECIALIZATIONS
1606 //
1607 //=================================================================================================
1608 
1609 //*************************************************************************************************
1611 template< typename T1, typename T2 >
1612 struct MultTraitEval1< T1, T2
1613  , EnableIf_t< IsMatrix_v<T1> &&
1614  IsNumeric_v<T2> &&
1615  ( IsDiagonal_v<T1> && !IsUniform_v<T1> ) > >
1616 {
1617  using Type = DiagonalMatrix< typename MultTraitEval2<T1,T2>::Type >;
1618 };
1619 
1620 template< typename T1, typename T2 >
1621 struct MultTraitEval1< T1, T2
1622  , EnableIf_t< IsNumeric_v<T1> &&
1623  IsMatrix_v<T2> &&
1624  ( IsDiagonal_v<T2> && !IsUniform_v<T2> ) > >
1625 {
1626  using Type = DiagonalMatrix< typename MultTraitEval2<T1,T2>::Type >;
1627 };
1628 
1629 template< typename T1, typename T2 >
1630 struct MultTraitEval1< T1, T2
1631  , EnableIf_t< IsMatrix_v<T1> &&
1632  IsMatrix_v<T2> &&
1633  ( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
1634  !( IsIdentity_v<T1> || IsIdentity_v<T2> ) &&
1635  !( IsZero_v<T1> || IsZero_v<T2> ) > >
1636 {
1637  using Type = DiagonalMatrix< typename MultTraitEval2<T1,T2>::Type >;
1638 };
1640 //*************************************************************************************************
1641 
1642 
1643 
1644 
1645 //=================================================================================================
1646 //
1647 // DIVTRAIT SPECIALIZATIONS
1648 //
1649 //=================================================================================================
1650 
1651 //*************************************************************************************************
1653 template< typename T1, typename T2 >
1654 struct DivTraitEval1< T1, T2
1655  , EnableIf_t< IsDiagonal_v<T1> && IsNumeric_v<T2> > >
1656 {
1657  using Type = DiagonalMatrix< typename DivTraitEval2<T1,T2>::Type >;
1658 };
1660 //*************************************************************************************************
1661 
1662 
1663 
1664 
1665 //=================================================================================================
1666 //
1667 // MAPTRAIT SPECIALIZATIONS
1668 //
1669 //=================================================================================================
1670 
1671 //*************************************************************************************************
1673 template< typename T, typename OP >
1674 struct UnaryMapTraitEval1< T, OP
1675  , EnableIf_t< YieldsDiagonal_v<OP,T> &&
1676  !YieldsIdentity_v<OP,T> &&
1677  !YieldsZero_v<OP,T> > >
1678 {
1679  using Type = DiagonalMatrix< typename UnaryMapTraitEval2<T,OP>::Type, StorageOrder_v<T> >;
1680 };
1682 //*************************************************************************************************
1683 
1684 
1685 //*************************************************************************************************
1687 template< typename T1, typename T2, typename OP >
1688 struct BinaryMapTraitEval1< T1, T2, OP
1689  , EnableIf_t< YieldsDiagonal_v<OP,T1,T2> &&
1690  !YieldsIdentity_v<OP,T1,T2> &&
1691  !YieldsZero_v<OP,T1,T2> > >
1692 {
1693  using Type = DiagonalMatrix< typename BinaryMapTraitEval2<T1,T2,OP>::Type >;
1694 };
1696 //*************************************************************************************************
1697 
1698 
1699 
1700 
1701 //=================================================================================================
1702 //
1703 // DECLSYMTRAIT SPECIALIZATIONS
1704 //
1705 //=================================================================================================
1706 
1707 //*************************************************************************************************
1709 template< typename MT, bool SO, bool DF >
1710 struct DeclSymTrait< DiagonalMatrix<MT,SO,DF> >
1711 {
1712  using Type = DiagonalMatrix<MT,SO,DF>;
1713 };
1715 //*************************************************************************************************
1716 
1717 
1718 
1719 
1720 //=================================================================================================
1721 //
1722 // DECLHERMTRAIT SPECIALIZATIONS
1723 //
1724 //=================================================================================================
1725 
1726 //*************************************************************************************************
1728 template< typename MT, bool SO, bool DF >
1729 struct DeclHermTrait< DiagonalMatrix<MT,SO,DF> >
1730 {
1731  using Type = HermitianMatrix<MT,SO,DF>;
1732 };
1734 //*************************************************************************************************
1735 
1736 
1737 
1738 
1739 //=================================================================================================
1740 //
1741 // DECLLOWTRAIT SPECIALIZATIONS
1742 //
1743 //=================================================================================================
1744 
1745 //*************************************************************************************************
1747 template< typename MT, bool SO, bool DF >
1748 struct DeclLowTrait< DiagonalMatrix<MT,SO,DF> >
1749 {
1750  using Type = DiagonalMatrix<MT,SO,DF>;
1751 };
1753 //*************************************************************************************************
1754 
1755 
1756 
1757 
1758 //=================================================================================================
1759 //
1760 // DECLUPPTRAIT SPECIALIZATIONS
1761 //
1762 //=================================================================================================
1763 
1764 //*************************************************************************************************
1766 template< typename MT, bool SO, bool DF >
1767 struct DeclUppTrait< DiagonalMatrix<MT,SO,DF> >
1768 {
1769  using Type = DiagonalMatrix<MT,SO,DF>;
1770 };
1772 //*************************************************************************************************
1773 
1774 
1775 
1776 
1777 //=================================================================================================
1778 //
1779 // DECLDIAGTRAIT SPECIALIZATIONS
1780 //
1781 //=================================================================================================
1782 
1783 //*************************************************************************************************
1785 template< typename MT, bool SO, bool DF >
1786 struct DeclDiagTrait< DiagonalMatrix<MT,SO,DF> >
1787 {
1788  using Type = DiagonalMatrix<MT,SO,DF>;
1789 };
1791 //*************************************************************************************************
1792 
1793 
1794 
1795 
1796 //=================================================================================================
1797 //
1798 // HIGHTYPE SPECIALIZATIONS
1799 //
1800 //=================================================================================================
1801 
1802 //*************************************************************************************************
1804 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1805 struct HighType< DiagonalMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1806 {
1807  using Type = DiagonalMatrix< typename HighType<MT1,MT2>::Type >;
1808 };
1810 //*************************************************************************************************
1811 
1812 
1813 
1814 
1815 //=================================================================================================
1816 //
1817 // LOWTYPE SPECIALIZATIONS
1818 //
1819 //=================================================================================================
1820 
1821 //*************************************************************************************************
1823 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1824 struct LowType< DiagonalMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
1825 {
1826  using Type = DiagonalMatrix< typename LowType<MT1,MT2>::Type >;
1827 };
1829 //*************************************************************************************************
1830 
1831 
1832 
1833 
1834 //=================================================================================================
1835 //
1836 // SUBMATRIXTRAIT SPECIALIZATIONS
1837 //
1838 //=================================================================================================
1839 
1840 //*************************************************************************************************
1842 template< typename MT, size_t I, size_t N >
1843 struct SubmatrixTraitEval1< MT, I, I, N, N
1844  , EnableIf_t< IsDiagonal_v<MT> &&
1845  !IsIdentity_v<MT> > >
1846 {
1847  using Type = DiagonalMatrix< typename SubmatrixTraitEval2<MT,I,I,N,N>::Type >;
1848 };
1850 //*************************************************************************************************
1851 
1852 } // namespace blaze
1853 
1854 #endif
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Header file for the decldiag trait.
Header file for the Schur product trait.
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.The IsMatrix_v variable template provides a c...
Definition: IsMatrix.h:139
Header file for the row trait.
Header file for the declherm trait.
Flag for the inversion of a upper unitriangular matrix.
Definition: InversionFlag.h:114
Flag for the inversion of a lower unitriangular matrix.
Definition: InversionFlag.h:112
Header file for the IsDiagonal type trait.
Header file for the YieldsZero type trait.
Header file for the dense matrix inversion flags.
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
Header file for the YieldsIdentity type trait.
#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
Header file for the IsIdentity type trait.
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Constraint on the data type.
Header file for the MaxSize type trait.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is an identity matrix.
Definition: DenseMatrix.h:1644
Constraint on the data type.
Header file for the IsMatrix type trait.
Header file for the IsSquare type trait.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:775
Constraint on the data type.
Header file for the LowType type trait.
Header file for the IsUniform type trait.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
Header file for the IsShrinkable type trait.
Header file for all forward declarations of the math module.
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:221
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.The IsNumeric_v variable template provides a...
Definition: IsNumeric.h:143
DiagonalMatrix specialization for dense matrices.
Header file for the IsLower type trait.
Header file for the IsAligned type trait.
Header file for the IsUniTriangular type trait.
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
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
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:438
Header file for the RemoveAdaptor type trait.
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:611
Header file for the IsPadded type trait.
Header file for the IsAdaptor type trait.
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:135
Constraint on the data type.
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
constexpr bool YieldsDiagonal_v
Auxiliary variable template for the YieldsDiagonal type trait.The YieldsDiagonal_v variable template ...
Definition: YieldsDiagonal.h:126
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 run time assertion macros.
Header file for the addition trait.
Header file for the division trait.
Header file for the submatrix trait.
Constraint on the data type.
Header file for the IsContiguous type trait.
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
Header file for the IsZero type trait.
#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.
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:281
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
#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
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
constexpr bool IsDiagonal_v
Auxiliary variable template for the IsDiagonal type trait.The IsDiagonal_v variable template provides...
Definition: IsDiagonal.h:148
Header file for the implementation of the base template of the DiagonalMatrix.
Header file for the YieldsDiagonal type trait.
Header file for the IsBuiltin type trait.
Header file for the isDivisor shim.
Header file for the StorageOrder type trait.
Header file for the map trait.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
#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
Matrix adapter for diagonal matrices.
Definition: BaseTemplate.h:560
Header file for the IsUpper type trait.
Header file for the IsHermitian type trait.
Header file for the IsResizable type trait.
Header file for the IsRestricted type trait.
Header file for the Size type trait.
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.