Blaze 3.9
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>
55#include <blaze/math/Forward.h>
106#include <blaze/util/Assert.h>
107#include <blaze/util/EnableIf.h>
110#include <blaze/util/mpl/If.h>
112
113
114namespace blaze {
115
116//=================================================================================================
117//
118// DIAGONALMATRIX OPERATORS
119//
120//=================================================================================================
121
122//*************************************************************************************************
125template< RelaxationFlag RF, typename MT, bool SO, bool DF >
126bool isDefault( const DiagonalMatrix<MT,SO,DF>& m );
127
128template< typename MT, bool SO, bool DF >
129bool isIntact( const DiagonalMatrix<MT,SO,DF>& m );
130
131template< typename MT, bool SO, bool DF >
132void swap( DiagonalMatrix<MT,SO,DF>& a, DiagonalMatrix<MT,SO,DF>& b ) noexcept;
134//*************************************************************************************************
135
136
137//*************************************************************************************************
165template< RelaxationFlag RF // Relaxation flag
166 , typename MT // Type of the adapted matrix
167 , bool SO // Storage order of the adapted matrix
168 , bool DF > // Density flag
169inline bool isDefault( const DiagonalMatrix<MT,SO,DF>& m )
170{
171 if( Size_v<MT,0UL> == DefaultSize_v )
172 return m.rows() == 0UL;
173
174 for( size_t i=0UL; i<m.rows(); ++i ) {
175 if( !isDefault<RF>( m(i,i) ) ) return false;
176 }
177
178 return true;
179}
180//*************************************************************************************************
181
182
183//*************************************************************************************************
204template< typename MT // Type of the adapted matrix
205 , bool SO // Storage order of the adapted matrix
206 , bool DF > // Density flag
207inline bool isIntact( const DiagonalMatrix<MT,SO,DF>& m )
208{
209 return m.isIntact();
210}
211//*************************************************************************************************
212
213
214//*************************************************************************************************
222template< typename MT // Type of the adapted matrix
223 , bool SO // Storage order of the adapted matrix
224 , bool DF > // Density flag
226{
227 a.swap( b );
228}
229//*************************************************************************************************
230
231
232//*************************************************************************************************
255template< InversionFlag IF // Inversion algorithm
256 , typename MT // Type of the dense matrix
257 , bool SO > // Storage order of the dense matrix
258inline void invert( DiagonalMatrix<MT,SO,true>& m )
259{
261
262 if( IF == asUniLower || IF == asUniUpper ) {
263 BLAZE_INTERNAL_ASSERT( isIdentity( m ), "Violation of preconditions detected" );
264 return;
265 }
266
267 invert<asDiagonal>( derestrict( m ) );
268
269 BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
270}
272//*************************************************************************************************
273
274
275//*************************************************************************************************
294template< typename MT1, bool SO1, typename MT2, typename MT3, typename MT4, bool SO2 >
295inline void lu( const DiagonalMatrix<MT1,SO1,true>& A, DenseMatrix<MT2,SO1>& L,
296 DenseMatrix<MT3,SO1>& U, Matrix<MT4,SO2>& P )
297{
299
304
309
310 using ET3 = ElementType_t<MT3>;
311 using ET4 = ElementType_t<MT4>;
312
313 const size_t n( (*A).rows() );
314
315 decltype(auto) U2( derestrict( *U ) );
316
317 (*L) = A;
318
319 resize( *U, n, n );
320 reset( U2 );
321
322 resize( *P, n, n );
323 reset( *P );
324
325 for( size_t i=0UL; i<n; ++i ) {
326 U2(i,i) = ET3(1);
327 (*P)(i,i) = ET4(1);
328 }
329}
331//*************************************************************************************************
332
333
334//*************************************************************************************************
350template< typename MT // Type of the adapted matrix
351 , bool SO // Storage order of the adapted matrix
352 , bool DF // Density flag
353 , typename ET > // Type of the element
354inline bool trySet( const DiagonalMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
355{
356 BLAZE_INTERNAL_ASSERT( i < (*mat).rows(), "Invalid row access index" );
357 BLAZE_INTERNAL_ASSERT( j < (*mat).columns(), "Invalid column access index" );
358
359 MAYBE_UNUSED( mat );
360
361 return ( i == j || isDefault( value ) );
362}
364//*************************************************************************************************
365
366
367//*************************************************************************************************
385template< typename MT // Type of the adapted matrix
386 , bool SO // Storage order of the adapted matrix
387 , bool DF // Density flag
388 , typename ET > // Type of the element
390 trySet( const DiagonalMatrix<MT,SO,DF>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
391{
392 BLAZE_INTERNAL_ASSERT( row <= (*mat).rows(), "Invalid row access index" );
393 BLAZE_INTERNAL_ASSERT( column <= (*mat).columns(), "Invalid column access index" );
394 BLAZE_INTERNAL_ASSERT( row + m <= (*mat).rows(), "Invalid number of rows" );
395 BLAZE_INTERNAL_ASSERT( column + n <= (*mat).columns(), "Invalid number of columns" );
396
397 MAYBE_UNUSED( mat );
398
399 return ( m == 0UL ) ||
400 ( n == 0UL ) ||
401 ( row == column && m == 1UL && n == 1UL ) ||
402 isDefault( value );
403}
405//*************************************************************************************************
406
407
408//*************************************************************************************************
424template< typename MT // Type of the adapted matrix
425 , bool SO // Storage order of the adapted matrix
426 , bool DF // Density flag
427 , typename ET > // Type of the element
428inline bool tryAdd( const DiagonalMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
429{
430 return trySet( mat, i, j, value );
431}
433//*************************************************************************************************
434
435
436//*************************************************************************************************
454template< typename MT // Type of the adapted matrix
455 , bool SO // Storage order of the adapted matrix
456 , bool DF // Density flag
457 , typename ET > // Type of the element
459 tryAdd( const DiagonalMatrix<MT,SO,DF>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
460{
461 return trySet( mat, row, column, m, n, value );
462}
464//*************************************************************************************************
465
466
467//*************************************************************************************************
483template< typename MT // Type of the adapted matrix
484 , bool SO // Storage order of the adapted matrix
485 , bool DF // Density flag
486 , typename ET > // Type of the element
487inline bool trySub( const DiagonalMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
488{
489 return trySet( mat, i, j, value );
490}
492//*************************************************************************************************
493
494
495//*************************************************************************************************
513template< typename MT // Type of the adapted matrix
514 , bool SO // Storage order of the adapted matrix
515 , bool DF // Density flag
516 , typename ET > // Type of the element
518 trySub( const DiagonalMatrix<MT,SO,DF>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
519{
520 return trySet( mat, row, column, m, n, value );
521}
523//*************************************************************************************************
524
525
526//*************************************************************************************************
542template< typename MT // Type of the adapted matrix
543 , bool SO // Storage order of the adapted matrix
544 , bool DF // Density flag
545 , typename ET > // Type of the element
546inline bool tryBitor( const DiagonalMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
547{
548 return trySet( mat, i, j, value );
549}
551//*************************************************************************************************
552
553
554//*************************************************************************************************
572template< typename MT // Type of the adapted matrix
573 , bool SO // Storage order of the adapted matrix
574 , bool DF // Density flag
575 , typename ET > // Type of the element
577 tryBitor( const DiagonalMatrix<MT,SO,DF>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
578{
579 return trySet( mat, row, column, m, n, value );
580}
582//*************************************************************************************************
583
584
585//*************************************************************************************************
601template< typename MT // Type of the adapted matrix
602 , bool SO // Storage order of the adapted matrix
603 , bool DF // Density flag
604 , typename ET > // Type of the element
605inline bool tryBitxor( const DiagonalMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
606{
607 return tryAdd( mat, i, j, value );
608}
610//*************************************************************************************************
611
612
613//*************************************************************************************************
631template< typename MT // Type of the adapted matrix
632 , bool SO // Storage order of the adapted matrix
633 , bool DF // Density flag
634 , typename ET > // Type of the element
636 tryBitxor( const DiagonalMatrix<MT,SO,DF>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
637{
638 return tryAdd( mat, row, column, m, n, value );
639}
641//*************************************************************************************************
642
643
644//*************************************************************************************************
660template< typename MT // Type of the adapted matrix
661 , bool SO // Storage order of the adapted matrix
662 , bool DF // Density flag
663 , typename VT > // Type of the right-hand side dense vector
664inline bool tryAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
665 const DenseVector<VT,false>& rhs, size_t row, size_t column )
666{
668
669 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
670 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
671 BLAZE_INTERNAL_ASSERT( row + (*rhs).size() <= lhs.rows(), "Invalid number of rows" );
672
673 MAYBE_UNUSED( lhs );
674
675 const size_t index( ( column <= row )?( 0UL ):( column - row ) );
676
677 for( size_t i=0UL; i<index; ++i ) {
678 if( !isDefault( (*rhs)[i] ) )
679 return false;
680 }
681
682 for( size_t i=index+1UL; i<(*rhs).size(); ++i ) {
683 if( !isDefault( (*rhs)[i] ) )
684 return false;
685 }
686
687 return true;
688}
690//*************************************************************************************************
691
692
693//*************************************************************************************************
709template< typename MT // Type of the adapted matrix
710 , bool SO // Storage order of the adapted matrix
711 , bool DF // Density flag
712 , typename VT > // Type of the right-hand side dense vector
713inline bool tryAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
714 const DenseVector<VT,true>& rhs, size_t row, size_t column )
715{
717
718 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
719 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
720 BLAZE_INTERNAL_ASSERT( column + (*rhs).size() <= lhs.columns(), "Invalid number of columns" );
721
722 MAYBE_UNUSED( lhs );
723
724 const size_t index( ( row <= column )?( 0UL ):( row - column ) );
725
726 for( size_t i=0UL; i<index; ++i ) {
727 if( !isDefault( (*rhs)[i] ) )
728 return false;
729 }
730
731 for( size_t i=index+1UL; i<(*rhs).size(); ++i ) {
732 if( !isDefault( (*rhs)[i] ) )
733 return false;
734 }
735
736 return true;
737}
739//*************************************************************************************************
740
741
742//*************************************************************************************************
760template< typename MT // Type of the adapted matrix
761 , bool SO // Storage order of the adapted matrix
762 , bool DF // Density flag
763 , typename VT // Type of the right-hand side dense vector
764 , bool TF > // Transpose flag of the right-hand side dense vector
765inline bool tryAssign( const DiagonalMatrix<MT,SO,DF>& lhs, const DenseVector<VT,TF>& rhs,
766 ptrdiff_t band, size_t row, size_t column )
767{
769
770 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
771 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
772 BLAZE_INTERNAL_ASSERT( column + (*rhs).size() <= lhs.columns(), "Invalid number of columns" );
773
774 MAYBE_UNUSED( lhs, row, column );
775
776 if( band != 0L ) {
777 for( size_t i=0UL; i<(*rhs).size(); ++i ) {
778 if( !isDefault( (*rhs)[i] ) )
779 return false;
780 }
781 }
782
783 return true;
784}
786//*************************************************************************************************
787
788
789//*************************************************************************************************
805template< typename MT // Type of the adapted matrix
806 , bool SO // Storage order of the adapted matrix
807 , bool DF // Density flag
808 , typename VT > // Type of the right-hand side sparse vector
809inline bool tryAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
810 const SparseVector<VT,false>& rhs, size_t row, size_t column )
811{
813
814 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
815 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
816 BLAZE_INTERNAL_ASSERT( row + (*rhs).size() <= lhs.rows(), "Invalid number of rows" );
817
818 MAYBE_UNUSED( lhs );
819
820 const size_t index( column - row );
821
822 for( auto element=(*rhs).begin(); element!=(*rhs).end(); ++element ) {
823 if( element->index() != index && !isDefault( element->value() ) )
824 return false;
825 }
826
827 return true;
828}
830//*************************************************************************************************
831
832
833//*************************************************************************************************
849template< typename MT // Type of the adapted matrix
850 , bool SO // Storage order of the adapted matrix
851 , bool DF // Density flag
852 , typename VT > // Type of the right-hand side sparse vector
853inline bool tryAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
854 const SparseVector<VT,true>& rhs, size_t row, size_t column )
855{
857
858 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
859 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
860 BLAZE_INTERNAL_ASSERT( column + (*rhs).size() <= lhs.columns(), "Invalid number of columns" );
861
862 MAYBE_UNUSED( lhs );
863
864 const size_t index( row - column );
865
866 for( auto element=(*rhs).begin(); element!=(*rhs).end(); ++element ) {
867 if( element->index() != index && !isDefault( element->value() ) )
868 return false;
869 }
870
871 return true;
872}
874//*************************************************************************************************
875
876
877//*************************************************************************************************
895template< typename MT // Type of the adapted matrix
896 , bool SO // Storage order of the adapted matrix
897 , bool DF // Density flag
898 , typename VT // Type of the right-hand side sparse vector
899 , bool TF > // Transpose flag of the right-hand side sparse vector
900inline bool tryAssign( const DiagonalMatrix<MT,SO,DF>& lhs, const SparseVector<VT,TF>& rhs,
901 ptrdiff_t band, size_t row, size_t column )
902{
904
905 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
906 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
907 BLAZE_INTERNAL_ASSERT( column + (*rhs).size() <= lhs.columns(), "Invalid number of columns" );
908
909 MAYBE_UNUSED( lhs, row, column );
910
911 if( band != 0L ) {
912 for( const auto& element : *rhs ) {
913 if( !isDefault( element.value() ) )
914 return false;
915 }
916 }
917
918 return true;
919}
921//*************************************************************************************************
922
923
924//*************************************************************************************************
940template< typename MT1 // Type of the adapted matrix
941 , bool SO // Storage order of the adapted matrix
942 , bool DF // Density flag
943 , typename MT2 > // Type of the right-hand side dense matrix
944inline bool tryAssign( const DiagonalMatrix<MT1,SO,DF>& lhs,
945 const DenseMatrix<MT2,false>& rhs, size_t row, size_t column )
946{
948
949 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
950 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
951 BLAZE_INTERNAL_ASSERT( row + (*rhs).rows() <= lhs.rows(), "Invalid number of rows" );
952 BLAZE_INTERNAL_ASSERT( column + (*rhs).columns() <= lhs.columns(), "Invalid number of columns" );
953
954 MAYBE_UNUSED( lhs );
955
956 const size_t M( (*rhs).rows() );
957 const size_t N( (*rhs).columns() );
958
959 for( size_t i=0UL; i<M; ++i ) {
960 for( size_t j=0UL; j<N; ++j ) {
961 if( ( row + i != column + j ) && !isDefault( (*rhs)(i,j) ) )
962 return false;
963 }
964 }
965
966 return true;
967}
969//*************************************************************************************************
970
971
972//*************************************************************************************************
988template< typename MT1 // Type of the adapted matrix
989 , bool SO // Storage order of the adapted matrix
990 , bool DF // Density flag
991 , typename MT2 > // Type of the right-hand side dense matrix
992inline bool tryAssign( const DiagonalMatrix<MT1,SO,DF>& lhs,
993 const DenseMatrix<MT2,true>& rhs, size_t row, size_t column )
994{
996
997 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
998 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
999 BLAZE_INTERNAL_ASSERT( row + (*rhs).rows() <= lhs.rows(), "Invalid number of rows" );
1000 BLAZE_INTERNAL_ASSERT( column + (*rhs).columns() <= lhs.columns(), "Invalid number of columns" );
1001
1002 MAYBE_UNUSED( lhs );
1003
1004 const size_t M( (*rhs).rows() );
1005 const size_t N( (*rhs).columns() );
1006
1007 for( size_t j=0UL; j<N; ++j ) {
1008 for( size_t i=0UL; i<M; ++i ) {
1009 if( ( column + j != row + i ) && !isDefault( (*rhs)(i,j) ) )
1010 return false;
1011 }
1012 }
1013
1014 return true;
1015}
1017//*************************************************************************************************
1018
1019
1020//*************************************************************************************************
1036template< typename MT1 // Type of the adapted matrix
1037 , bool SO // Storage order of the adapted matrix
1038 , bool DF // Density flag
1039 , typename MT2 > // Type of the right-hand side sparse matrix
1040inline bool tryAssign( const DiagonalMatrix<MT1,SO,DF>& lhs,
1041 const SparseMatrix<MT2,false>& rhs, size_t row, size_t column )
1042{
1044
1045 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1046 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1047 BLAZE_INTERNAL_ASSERT( row + (*rhs).rows() <= lhs.rows(), "Invalid number of rows" );
1048 BLAZE_INTERNAL_ASSERT( column + (*rhs).columns() <= lhs.columns(), "Invalid number of columns" );
1049
1050 MAYBE_UNUSED( lhs );
1051
1052 const size_t M( (*rhs).rows() );
1053
1054 for( size_t i=0UL; i<M; ++i ) {
1055 for( auto element=(*rhs).begin(i); element!=(*rhs).end(i); ++element ) {
1056 if( ( row + i != column + element->index() ) && !isDefault( element->value() ) )
1057 return false;
1058 }
1059 }
1060
1061 return true;
1062}
1064//*************************************************************************************************
1065
1066
1067//*************************************************************************************************
1083template< typename MT1 // Type of the adapted matrix
1084 , bool SO // Storage order of the adapted matrix
1085 , bool DF // Density flag
1086 , typename MT2 > // Type of the right-hand side sparse matrix
1087inline bool tryAssign( const DiagonalMatrix<MT1,SO,DF>& lhs,
1088 const SparseMatrix<MT2,true>& rhs, size_t row, size_t column )
1089{
1091
1092 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1093 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1094 BLAZE_INTERNAL_ASSERT( row + (*rhs).rows() <= lhs.rows(), "Invalid number of rows" );
1095 BLAZE_INTERNAL_ASSERT( column + (*rhs).columns() <= lhs.columns(), "Invalid number of columns" );
1096
1097 MAYBE_UNUSED( lhs );
1098
1099 const size_t N( (*rhs).columns() );
1100
1101 for( size_t j=0UL; j<N; ++j ) {
1102 for( auto element=(*rhs).begin(j); element!=(*rhs).end(j); ++element ) {
1103 if( ( column + j != row + element->index() ) && !isDefault( element->value() ) )
1104 return false;
1105 }
1106 }
1107
1108 return true;
1109}
1111//*************************************************************************************************
1112
1113
1114//*************************************************************************************************
1130template< typename MT // Type of the adapted matrix
1131 , bool SO // Storage order of the adapted matrix
1132 , bool DF // Density flag
1133 , typename VT // Type of the right-hand side vector
1134 , bool TF > // Transpose flag of the right-hand side vector
1135inline bool tryAddAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
1136 const Vector<VT,TF>& rhs, size_t row, size_t column )
1137{
1138 return tryAssign( lhs, *rhs, row, column );
1139}
1141//*************************************************************************************************
1142
1143
1144//*************************************************************************************************
1162template< typename MT // Type of the adapted matrix
1163 , bool SO // Storage order of the adapted matrix
1164 , bool DF // Density flag
1165 , typename VT // Type of the right-hand side vector
1166 , bool TF > // Transpose flag of the right-hand side vector
1167inline bool tryAddAssign( const DiagonalMatrix<MT,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1168 ptrdiff_t band, size_t row, size_t column )
1169{
1170 return tryAssign( lhs, *rhs, band, row, column );
1171}
1173//*************************************************************************************************
1174
1175
1176//*************************************************************************************************
1192template< typename MT1 // Type of the adapted matrix
1193 , bool SO1 // Storage order of the adapted matrix
1194 , bool DF // Density flag
1195 , typename MT2 // Type of the right-hand side matrix
1196 , bool SO2 > // Storage order of the right-hand side matrix
1197inline bool tryAddAssign( const DiagonalMatrix<MT1,SO1,DF>& lhs,
1198 const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1199{
1200 return tryAssign( lhs, *rhs, row, column );
1201}
1203//*************************************************************************************************
1204
1205
1206//*************************************************************************************************
1223template< typename MT // Type of the adapted matrix
1224 , bool SO // Storage order of the adapted matrix
1225 , bool DF // Density flag
1226 , typename VT // Type of the right-hand side vector
1227 , bool TF > // Transpose flag of the right-hand side vector
1228inline bool trySubAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
1229 const Vector<VT,TF>& rhs, size_t row, size_t column )
1230{
1231 return tryAssign( lhs, *rhs, row, column );
1232}
1234//*************************************************************************************************
1235
1236
1237//*************************************************************************************************
1255template< typename MT // Type of the adapted matrix
1256 , bool SO // Storage order of the adapted matrix
1257 , bool DF // Density flag
1258 , typename VT // Type of the right-hand side vector
1259 , bool TF > // Transpose flag of the right-hand side vector
1260inline bool trySubAssign( const DiagonalMatrix<MT,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1261 ptrdiff_t band, size_t row, size_t column )
1262{
1263 return tryAssign( lhs, *rhs, band, row, column );
1264}
1266//*************************************************************************************************
1267
1268
1269//*************************************************************************************************
1286template< typename MT1 // Type of the adapted matrix
1287 , bool SO1 // Storage order of the adapted matrix
1288 , bool DF // Density flag
1289 , typename MT2 // Type of the right-hand side matrix
1290 , bool SO2 > // Storage order of the right-hand side matrix
1291inline bool trySubAssign( const DiagonalMatrix<MT1,SO1,DF>& lhs,
1292 const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1293{
1294 return tryAssign( lhs, *rhs, row, column );
1295}
1297//*************************************************************************************************
1298
1299
1300//*************************************************************************************************
1317template< typename MT // Type of the adapted matrix
1318 , bool SO // Storage order of the adapted matrix
1319 , bool DF // Density flag
1320 , typename VT // Type of the right-hand side vector
1321 , bool TF > // Transpose flag of the right-hand side vector
1322inline bool tryBitorAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
1323 const Vector<VT,TF>& rhs, size_t row, size_t column )
1324{
1325 return tryAssign( lhs, *rhs, row, column );
1326}
1328//*************************************************************************************************
1329
1330
1331//*************************************************************************************************
1348template< typename MT // Type of the adapted matrix
1349 , bool SO // Storage order of the adapted matrix
1350 , bool DF // Density flag
1351 , typename VT // Type of the right-hand side vector
1352 , bool TF > // Transpose flag of the right-hand side vector
1353inline bool tryBitorAssign( const DiagonalMatrix<MT,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1354 ptrdiff_t band, size_t row, size_t column )
1355{
1356 return tryAssign( lhs, *rhs, band, row, column );
1357}
1359//*************************************************************************************************
1360
1361
1362//*************************************************************************************************
1378template< typename MT1 // Type of the adapted matrix
1379 , bool SO1 // Storage order of the adapted matrix
1380 , bool DF // Density flag
1381 , typename MT2 // Type of the right-hand side matrix
1382 , bool SO2 > // Storage order of the right-hand side matrix
1383inline bool tryBitorAssign( const DiagonalMatrix<MT1,SO1,DF>& lhs,
1384 const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1385{
1386 return tryAssign( lhs, *rhs, row, column );
1387}
1389//*************************************************************************************************
1390
1391
1392//*************************************************************************************************
1409template< typename MT // Type of the adapted matrix
1410 , bool SO // Storage order of the adapted matrix
1411 , bool DF // Density flag
1412 , typename VT // Type of the right-hand side vector
1413 , bool TF > // Transpose flag of the right-hand side vector
1414inline bool tryBitxorAssign( const DiagonalMatrix<MT,SO,DF>& lhs,
1415 const Vector<VT,TF>& rhs, size_t row, size_t column )
1416{
1417 return tryAssign( lhs, *rhs, row, column );
1418}
1420//*************************************************************************************************
1421
1422
1423//*************************************************************************************************
1440template< typename MT // Type of the adapted matrix
1441 , bool SO // Storage order of the adapted matrix
1442 , bool DF // Density flag
1443 , typename VT // Type of the right-hand side vector
1444 , bool TF > // Transpose flag of the right-hand side vector
1445inline bool tryBitxorAssign( const DiagonalMatrix<MT,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1446 ptrdiff_t band, size_t row, size_t column )
1447{
1448 return tryAssign( lhs, *rhs, band, row, column );
1449}
1451//*************************************************************************************************
1452
1453
1454//*************************************************************************************************
1471template< typename MT1 // Type of the adapted matrix
1472 , bool SO1 // Storage order of the adapted matrix
1473 , bool DF // Density flag
1474 , typename MT2 // Type of the right-hand side matrix
1475 , bool SO2 > // Storage order of the right-hand side matrix
1476inline bool tryBitxorAssign( const DiagonalMatrix<MT1,SO1,DF>& lhs,
1477 const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1478{
1479 return tryAssign( lhs, *rhs, row, column );
1480}
1482//*************************************************************************************************
1483
1484
1485//*************************************************************************************************
1500template< typename MT // Type of the adapted matrix
1501 , bool SO // Storage order of the adapted matrix
1502 , bool DF > // Density flag
1503inline MT& derestrict( DiagonalMatrix<MT,SO,DF>& m )
1504{
1505 return m.matrix_;
1506}
1508//*************************************************************************************************
1509
1510
1511
1512
1513//=================================================================================================
1514//
1515// SIZE SPECIALIZATIONS
1516//
1517//=================================================================================================
1518
1519//*************************************************************************************************
1521template< typename MT, bool SO, bool DF >
1522struct Size< DiagonalMatrix<MT,SO,DF>, 0UL >
1523 : public Size<MT,0UL>
1524{};
1525
1526template< typename MT, bool SO, bool DF >
1527struct Size< DiagonalMatrix<MT,SO,DF>, 1UL >
1528 : public Size<MT,1UL>
1529{};
1531//*************************************************************************************************
1532
1533
1534
1535
1536//=================================================================================================
1537//
1538// SIZE SPECIALIZATIONS
1539//
1540//=================================================================================================
1541
1542//*************************************************************************************************
1544template< typename MT, bool SO, bool DF >
1545struct MaxSize< DiagonalMatrix<MT,SO,DF>, 0UL >
1546 : public MaxSize<MT,0UL>
1547{};
1548
1549template< typename MT, bool SO, bool DF >
1550struct MaxSize< DiagonalMatrix<MT,SO,DF>, 1UL >
1551 : public MaxSize<MT,1UL>
1552{};
1554//*************************************************************************************************
1555
1556
1557
1558
1559//=================================================================================================
1560//
1561// ISSQUARE SPECIALIZATIONS
1562//
1563//=================================================================================================
1564
1565//*************************************************************************************************
1567template< typename MT, bool SO, bool DF >
1568struct IsSquare< DiagonalMatrix<MT,SO,DF> >
1569 : public TrueType
1570{};
1572//*************************************************************************************************
1573
1574
1575
1576
1577//=================================================================================================
1578//
1579// ISUNIFORM SPECIALIZATIONS
1580//
1581//=================================================================================================
1582
1583//*************************************************************************************************
1585template< typename MT, bool SO, bool DF >
1586struct IsUniform< DiagonalMatrix<MT,SO,DF> >
1587 : public IsUniform<MT>
1588{};
1590//*************************************************************************************************
1591
1592
1593
1594
1595//=================================================================================================
1596//
1597// ISSYMMETRIC SPECIALIZATIONS
1598//
1599//=================================================================================================
1600
1601//*************************************************************************************************
1603template< typename MT, bool SO, bool DF >
1604struct IsSymmetric< DiagonalMatrix<MT,SO,DF> >
1605 : public TrueType
1606{};
1608//*************************************************************************************************
1609
1610
1611
1612
1613//=================================================================================================
1614//
1615// ISHERMITIAN SPECIALIZATIONS
1616//
1617//=================================================================================================
1618
1619//*************************************************************************************************
1621template< typename MT, bool SO, bool DF >
1622struct IsHermitian< DiagonalMatrix<MT,SO,DF> >
1623 : public IsBuiltin< ElementType_t<MT> >
1624{};
1626//*************************************************************************************************
1627
1628
1629
1630
1631//=================================================================================================
1632//
1633// ISLOWER SPECIALIZATIONS
1634//
1635//=================================================================================================
1636
1637//*************************************************************************************************
1639template< typename MT, bool SO, bool DF >
1640struct IsLower< DiagonalMatrix<MT,SO,DF> >
1641 : public TrueType
1642{};
1644//*************************************************************************************************
1645
1646
1647
1648
1649//=================================================================================================
1650//
1651// ISSTRICTLYLOWER SPECIALIZATIONS
1652//
1653//=================================================================================================
1654
1655//*************************************************************************************************
1657template< typename MT, bool SO, bool DF >
1658struct IsStrictlyLower< DiagonalMatrix<MT,SO,DF> >
1659 : public IsZero<MT>
1660{};
1662//*************************************************************************************************
1663
1664
1665
1666
1667//=================================================================================================
1668//
1669// ISUPPER SPECIALIZATIONS
1670//
1671//=================================================================================================
1672
1673//*************************************************************************************************
1675template< typename MT, bool SO, bool DF >
1676struct IsUpper< DiagonalMatrix<MT,SO,DF> >
1677 : public TrueType
1678{};
1680//*************************************************************************************************
1681
1682
1683
1684
1685//=================================================================================================
1686//
1687// ISSTRICTLYUPPER SPECIALIZATIONS
1688//
1689//=================================================================================================
1690
1691//*************************************************************************************************
1693template< typename MT, bool SO, bool DF >
1694struct IsStrictlyUpper< DiagonalMatrix<MT,SO,DF> >
1695 : public IsZero<MT>
1696{};
1698//*************************************************************************************************
1699
1700
1701
1702
1703//=================================================================================================
1704//
1705// ISADAPTOR SPECIALIZATIONS
1706//
1707//=================================================================================================
1708
1709//*************************************************************************************************
1711template< typename MT, bool SO, bool DF >
1712struct IsAdaptor< DiagonalMatrix<MT,SO,DF> >
1713 : public TrueType
1714{};
1716//*************************************************************************************************
1717
1718
1719
1720
1721//=================================================================================================
1722//
1723// ISRESTRICTED SPECIALIZATIONS
1724//
1725//=================================================================================================
1726
1727//*************************************************************************************************
1729template< typename MT, bool SO, bool DF >
1730struct IsRestricted< DiagonalMatrix<MT,SO,DF> >
1731 : public TrueType
1732{};
1734//*************************************************************************************************
1735
1736
1737
1738
1739//=================================================================================================
1740//
1741// HASCONSTDATAACCESS SPECIALIZATIONS
1742//
1743//=================================================================================================
1744
1745//*************************************************************************************************
1747template< typename MT, bool SO >
1748struct HasConstDataAccess< DiagonalMatrix<MT,SO,true> >
1749 : public TrueType
1750{};
1752//*************************************************************************************************
1753
1754
1755
1756
1757//=================================================================================================
1758//
1759// ISALIGNED SPECIALIZATIONS
1760//
1761//=================================================================================================
1762
1763//*************************************************************************************************
1765template< typename MT, bool SO, bool DF >
1766struct IsAligned< DiagonalMatrix<MT,SO,DF> >
1767 : public IsAligned<MT>
1768{};
1770//*************************************************************************************************
1771
1772
1773
1774
1775//=================================================================================================
1776//
1777// ISCONTIGUOUS SPECIALIZATIONS
1778//
1779//=================================================================================================
1780
1781//*************************************************************************************************
1783template< typename MT, bool SO, bool DF >
1784struct IsContiguous< DiagonalMatrix<MT,SO,DF> >
1785 : public IsContiguous<MT>
1786{};
1788//*************************************************************************************************
1789
1790
1791
1792
1793//=================================================================================================
1794//
1795// ISPADDED SPECIALIZATIONS
1796//
1797//=================================================================================================
1798
1799//*************************************************************************************************
1801template< typename MT, bool SO, bool DF >
1802struct IsPadded< DiagonalMatrix<MT,SO,DF> >
1803 : public IsPadded<MT>
1804{};
1806//*************************************************************************************************
1807
1808
1809
1810
1811//=================================================================================================
1812//
1813// REMOVEADAPTOR SPECIALIZATIONS
1814//
1815//=================================================================================================
1816
1817//*************************************************************************************************
1819template< typename MT, bool SO, bool DF >
1820struct RemoveAdaptor< DiagonalMatrix<MT,SO,DF> >
1821{
1822 using Type = MT;
1823};
1825//*************************************************************************************************
1826
1827
1828
1829
1830//=================================================================================================
1831//
1832// ADDTRAIT SPECIALIZATIONS
1833//
1834//=================================================================================================
1835
1836//*************************************************************************************************
1838template< typename T1, typename T2 >
1839struct AddTraitEval1< T1, T2
1840 , EnableIf_t< IsMatrix_v<T1> &&
1841 IsMatrix_v<T2> &&
1842 IsDiagonal_v<T1> && IsDiagonal_v<T2> &&
1843 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1844{
1845 using Type = DiagonalMatrix< typename AddTraitEval2<T1,T2>::Type >;
1846};
1848//*************************************************************************************************
1849
1850
1851
1852
1853//=================================================================================================
1854//
1855// SUBTRAIT SPECIALIZATIONS
1856//
1857//=================================================================================================
1858
1859//*************************************************************************************************
1861template< typename T1, typename T2 >
1862struct SubTraitEval1< T1, T2
1863 , EnableIf_t< IsMatrix_v<T1> &&
1864 IsMatrix_v<T2> &&
1865 IsDiagonal_v<T1> && IsDiagonal_v<T2> &&
1866 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1867{
1868 using Type = DiagonalMatrix< typename SubTraitEval2<T1,T2>::Type >;
1869};
1870
1871template< typename T1, typename T2 >
1872struct SubTraitEval1< T1, T2
1873 , EnableIf_t< IsMatrix_v<T1> &&
1874 IsMatrix_v<T2> &&
1875 IsZero_v<T1> && IsIdentity_v<T2> > >
1876{
1877 using Tmp = If_t< StorageOrder_v<T1> != StorageOrder_v<T2>, OppositeType_t<T1>, T1 >;
1878 using Type = DiagonalMatrix< typename SubTraitEval2<Tmp,T2>::Type >;
1879};
1881//*************************************************************************************************
1882
1883
1884
1885
1886//=================================================================================================
1887//
1888// SCHURTRAIT SPECIALIZATIONS
1889//
1890//=================================================================================================
1891
1892//*************************************************************************************************
1894template< typename T1, typename T2 >
1895struct SchurTraitEval1< T1, T2
1896 , EnableIf_t< IsMatrix_v<T1> &&
1897 IsMatrix_v<T2> &&
1898 ( IsDiagonal_v<T1> ||
1899 IsDiagonal_v<T2> ||
1900 ( IsLower_v<T1> && IsUpper_v<T2> ) ||
1901 ( IsUpper_v<T1> && IsLower_v<T2> ) ) &&
1902 !( IsStrictlyLower_v<T1> && IsUpper_v<T2> ) &&
1903 !( IsStrictlyUpper_v<T1> && IsLower_v<T2> ) &&
1904 !( IsLower_v<T1> && IsStrictlyUpper_v<T2> ) &&
1905 !( IsUpper_v<T1> && IsStrictlyLower_v<T2> ) &&
1906 !( IsUniTriangular_v<T1> && IsUniTriangular_v<T2> ) &&
1907 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1908{
1909 using Type = DiagonalMatrix< typename SchurTraitEval2<T1,T2>::Type >;
1910};
1912//*************************************************************************************************
1913
1914
1915
1916
1917//=================================================================================================
1918//
1919// MULTTRAIT SPECIALIZATIONS
1920//
1921//=================================================================================================
1922
1923//*************************************************************************************************
1925template< typename T1, typename T2 >
1926struct MultTraitEval1< T1, T2
1927 , EnableIf_t< IsMatrix_v<T1> &&
1928 IsScalar_v<T2> &&
1929 ( IsDiagonal_v<T1> && !IsUniform_v<T1> ) > >
1930{
1931 using Type = DiagonalMatrix< typename MultTraitEval2<T1,T2>::Type >;
1932};
1933
1934template< typename T1, typename T2 >
1935struct MultTraitEval1< T1, T2
1936 , EnableIf_t< IsScalar_v<T1> &&
1937 IsMatrix_v<T2> &&
1938 ( IsDiagonal_v<T2> && !IsUniform_v<T2> ) > >
1939{
1940 using Type = DiagonalMatrix< typename MultTraitEval2<T1,T2>::Type >;
1941};
1942
1943template< typename T1, typename T2 >
1944struct MultTraitEval1< T1, T2
1945 , EnableIf_t< IsMatrix_v<T1> &&
1946 IsMatrix_v<T2> &&
1947 ( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
1948 !( IsIdentity_v<T1> || IsIdentity_v<T2> ) &&
1949 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1950{
1951 using Type = DiagonalMatrix< typename MultTraitEval2<T1,T2>::Type >;
1952};
1954//*************************************************************************************************
1955
1956
1957
1958
1959//=================================================================================================
1960//
1961// KRONTRAIT SPECIALIZATIONS
1962//
1963//=================================================================================================
1964
1965//*************************************************************************************************
1967template< typename T1, typename T2 >
1968struct KronTraitEval1< T1, T2
1969 , EnableIf_t< IsMatrix_v<T1> &&
1970 IsMatrix_v<T2> &&
1971 ( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
1972 !( IsIdentity_v<T1> && IsIdentity_v<T2> ) &&
1973 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1974{
1975 using Type = DiagonalMatrix< typename KronTraitEval2<T1,T2>::Type >;
1976};
1978//*************************************************************************************************
1979
1980
1981
1982
1983//=================================================================================================
1984//
1985// DIVTRAIT SPECIALIZATIONS
1986//
1987//=================================================================================================
1988
1989//*************************************************************************************************
1991template< typename T1, typename T2 >
1992struct DivTraitEval1< T1, T2
1993 , EnableIf_t< IsDiagonal_v<T1> && IsScalar_v<T2> > >
1994{
1995 using Type = DiagonalMatrix< typename DivTraitEval2<T1,T2>::Type >;
1996};
1998//*************************************************************************************************
1999
2000
2001
2002
2003//=================================================================================================
2004//
2005// MAPTRAIT SPECIALIZATIONS
2006//
2007//=================================================================================================
2008
2009//*************************************************************************************************
2011template< typename T, typename OP >
2012struct UnaryMapTraitEval1< T, OP
2013 , EnableIf_t< YieldsDiagonal_v<OP,T> &&
2014 !YieldsIdentity_v<OP,T> &&
2015 !YieldsZero_v<OP,T> > >
2016{
2017 using Type = DiagonalMatrix< typename UnaryMapTraitEval2<T,OP>::Type, StorageOrder_v<T> >;
2018};
2020//*************************************************************************************************
2021
2022
2023//*************************************************************************************************
2025template< typename T1, typename T2, typename OP >
2026struct BinaryMapTraitEval1< T1, T2, OP
2027 , EnableIf_t< YieldsDiagonal_v<OP,T1,T2> &&
2028 !YieldsIdentity_v<OP,T1,T2> &&
2029 !YieldsZero_v<OP,T1,T2> > >
2030{
2031 using Type = DiagonalMatrix< typename BinaryMapTraitEval2<T1,T2,OP>::Type >;
2032};
2034//*************************************************************************************************
2035
2036
2037
2038
2039//=================================================================================================
2040//
2041// DECLSYMTRAIT SPECIALIZATIONS
2042//
2043//=================================================================================================
2044
2045//*************************************************************************************************
2047template< typename MT, bool SO, bool DF >
2048struct DeclSymTrait< DiagonalMatrix<MT,SO,DF> >
2049{
2050 using Type = DiagonalMatrix<MT,SO,DF>;
2051};
2053//*************************************************************************************************
2054
2055
2056
2057
2058//=================================================================================================
2059//
2060// DECLHERMTRAIT SPECIALIZATIONS
2061//
2062//=================================================================================================
2063
2064//*************************************************************************************************
2066template< typename MT, bool SO, bool DF >
2067struct DeclHermTrait< DiagonalMatrix<MT,SO,DF> >
2068{
2069 using Type = HermitianMatrix<MT,SO,DF>;
2070};
2072//*************************************************************************************************
2073
2074
2075
2076
2077//=================================================================================================
2078//
2079// DECLLOWTRAIT SPECIALIZATIONS
2080//
2081//=================================================================================================
2082
2083//*************************************************************************************************
2085template< typename MT, bool SO, bool DF >
2086struct DeclLowTrait< DiagonalMatrix<MT,SO,DF> >
2087{
2088 using Type = DiagonalMatrix<MT,SO,DF>;
2089};
2091//*************************************************************************************************
2092
2093
2094
2095
2096//=================================================================================================
2097//
2098// DECLUNILOWTRAIT SPECIALIZATIONS
2099//
2100//=================================================================================================
2101
2102//*************************************************************************************************
2104template< typename MT, bool SO, bool DF >
2105struct DeclUniLowTrait< DiagonalMatrix<MT,SO,DF> >
2106{
2107 using Type = IdentityMatrix< ElementType_t<MT>, SO >;
2108};
2110//*************************************************************************************************
2111
2112
2113
2114
2115//=================================================================================================
2116//
2117// DECLSTRLOWTRAIT SPECIALIZATIONS
2118//
2119//=================================================================================================
2120
2121//*************************************************************************************************
2123template< typename MT, bool SO, bool DF >
2124struct DeclStrLowTrait< DiagonalMatrix<MT,SO,DF> >
2125{
2126 using Type = ZeroMatrix< ElementType_t<MT>, SO >;
2127};
2129//*************************************************************************************************
2130
2131
2132
2133
2134//=================================================================================================
2135//
2136// DECLUPPTRAIT SPECIALIZATIONS
2137//
2138//=================================================================================================
2139
2140//*************************************************************************************************
2142template< typename MT, bool SO, bool DF >
2143struct DeclUppTrait< DiagonalMatrix<MT,SO,DF> >
2144{
2145 using Type = DiagonalMatrix<MT,SO,DF>;
2146};
2148//*************************************************************************************************
2149
2150
2151
2152
2153//=================================================================================================
2154//
2155// DECLUNIUPPTRAIT SPECIALIZATIONS
2156//
2157//=================================================================================================
2158
2159//*************************************************************************************************
2161template< typename MT, bool SO, bool DF >
2162struct DeclUniUppTrait< DiagonalMatrix<MT,SO,DF> >
2163{
2164 using Type = IdentityMatrix< ElementType_t<MT>, SO >;
2165};
2167//*************************************************************************************************
2168
2169
2170
2171
2172//=================================================================================================
2173//
2174// DECLSTRUPPTRAIT SPECIALIZATIONS
2175//
2176//=================================================================================================
2177
2178//*************************************************************************************************
2180template< typename MT, bool SO, bool DF >
2181struct DeclStrUppTrait< DiagonalMatrix<MT,SO,DF> >
2182{
2183 using Type = ZeroMatrix< ElementType_t<MT>, SO >;
2184};
2186//*************************************************************************************************
2187
2188
2189
2190
2191//=================================================================================================
2192//
2193// DECLDIAGTRAIT SPECIALIZATIONS
2194//
2195//=================================================================================================
2196
2197//*************************************************************************************************
2199template< typename MT, bool SO, bool DF >
2200struct DeclDiagTrait< DiagonalMatrix<MT,SO,DF> >
2201{
2202 using Type = DiagonalMatrix<MT,SO,DF>;
2203};
2205//*************************************************************************************************
2206
2207
2208
2209
2210//=================================================================================================
2211//
2212// HIGHTYPE SPECIALIZATIONS
2213//
2214//=================================================================================================
2215
2216//*************************************************************************************************
2218template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2219struct HighType< DiagonalMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
2220{
2221 using Type = DiagonalMatrix< typename HighType<MT1,MT2>::Type >;
2222};
2224//*************************************************************************************************
2225
2226
2227
2228
2229//=================================================================================================
2230//
2231// LOWTYPE SPECIALIZATIONS
2232//
2233//=================================================================================================
2234
2235//*************************************************************************************************
2237template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2238struct LowType< DiagonalMatrix<MT1,SO1,DF1>, DiagonalMatrix<MT2,SO2,DF2> >
2239{
2240 using Type = DiagonalMatrix< typename LowType<MT1,MT2>::Type >;
2241};
2243//*************************************************************************************************
2244
2245
2246
2247
2248//=================================================================================================
2249//
2250// SUBMATRIXTRAIT SPECIALIZATIONS
2251//
2252//=================================================================================================
2253
2254//*************************************************************************************************
2256template< typename MT, size_t I, size_t N >
2257struct SubmatrixTraitEval1< MT, I, I, N, N
2258 , EnableIf_t< I != inf && N != inf &&
2259 IsDiagonal_v<MT> &&
2260 !IsIdentity_v<MT> &&
2261 !IsZero_v<MT> > >
2262{
2263 using Type = DiagonalMatrix< typename SubmatrixTraitEval2<MT,I,I,N,N>::Type >;
2264};
2266//*************************************************************************************************
2267
2268} // namespace blaze
2269
2270#endif
Header file for the addition trait.
Header file for auxiliary alias declarations.
Header file for run time assertion macros.
Constraint on the data type.
Header file for the decldiag trait.
Header file for the declherm trait.
Header file for the decllow trait.
Header file for the declstrlow trait.
Header file for the declstrupp trait.
Header file for the declsym trait.
Header file for the declunilow trait.
Header file for the decluniupp trait.
Header file for the declupp trait.
Header file for the division trait.
Header file for the EnableIf class template.
Header file for the HasConstDataAccess type trait.
Constraint on the data type.
Header file for the HighType type trait.
Header file for the If class template.
Header file for the IntegralConstant class template.
Header file for the dense matrix inversion flags.
Header file for the IsAdaptor type trait.
Header file for the IsAligned type trait.
Header file for the IsBuiltin type trait.
Header file for the IsContiguous type trait.
Header file for the isDefault shim.
Header file for the IsDiagonal type trait.
Header file for the isDivisor shim.
Header file for the IsHermitian type trait.
Header file for the IsIdentity type trait.
Header file for the IsLower type trait.
Header file for the IsMatrix type trait.
Header file for the IsPadded type trait.
Header file for the IsRestricted type trait.
Header file for the IsScalar type trait.
Header file for the IsSquare type trait.
Header file for the IsStrictlyLower type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Header file for the IsUniTriangular type trait.
Header file for the IsUniform type trait.
Header file for the IsUpper type trait.
Header file for the Kron product trait.
Header file for the LowType type trait.
Constraint on the data type.
Header file for the map trait.
Header file for the MaxSize type trait.
Header file for the MAYBE_UNUSED function template.
Header file for the multiplication trait.
Header file for the relaxation flag enumeration.
Header file for the RemoveAdaptor type trait.
Header file for the Schur product trait.
Header file for the subtraction trait.
Header file for the submatrix trait.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the YieldsDiagonal type trait.
Header file for the YieldsIdentity type trait.
Header file for the YieldsZero type trait.
Header file for the implementation of the base template of the DiagonalMatrix.
DiagonalMatrix specialization for dense matrices.
DiagonalMatrix specialization for sparse matrices.
Matrix adapter for diagonal matrices.
Definition: BaseTemplate.h:565
Pointer difference type of the Blaze library.
Constraint on the data type.
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:140
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:137
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:222
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an identity matrix.
Definition: DenseMatrix.h:2561
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:207
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:225
bool isDefault(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the given diagonal matrix is in default state.
Definition: DiagonalMatrix.h:169
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:693
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.
Definition: BLASCompatible.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Hermitian.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Upper.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: UniTriangular.h:81
constexpr bool IsScalar_v
Auxiliary variable template for the IsScalar type trait.
Definition: IsScalar.h:104
constexpr bool YieldsDiagonal_v
Auxiliary variable template for the YieldsDiagonal type trait.
Definition: YieldsDiagonal.h:126
constexpr ptrdiff_t DefaultSize_v
Default size of the Size type trait.
Definition: Size.h:72
constexpr bool IsDiagonal_v
Auxiliary variable template for the IsDiagonal type trait.
Definition: IsDiagonal.h:148
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.
Definition: IsMatrix.h:124
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition: RelaxationFlag.h:66
constexpr Infinity inf
Global Infinity instance.
Definition: Infinity.h:1080
InversionFlag
Inversion flag.
Definition: InversionFlag.h:102
@ asUniLower
Flag for the inversion of a lower unitriangular matrix.
Definition: InversionFlag.h:112
@ asUniUpper
Flag for the inversion of a upper unitriangular matrix.
Definition: InversionFlag.h:114
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition: Matrix.h:806
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:1108
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:137
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
BoolConstant< true > TrueType
Type traits base class.
Definition: IntegralConstant.h:132
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the exception macros of the math module.
Header file for all forward declarations of the math module.
Header file for the Size type trait.
Header file for the StorageOrder type trait.
Header file for the IsZero type trait.