Blaze 3.9
UpperMatrix.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_ADAPTORS_UPPERMATRIX_H_
36#define _BLAZE_MATH_ADAPTORS_UPPERMATRIX_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <blaze/math/Aliases.h>
55#include <blaze/math/Forward.h>
108#include <blaze/util/Assert.h>
109#include <blaze/util/EnableIf.h>
112
113
114namespace blaze {
115
116//=================================================================================================
117//
118// UPPERMATRIX OPERATORS
119//
120//=================================================================================================
121
122//*************************************************************************************************
125template< RelaxationFlag RF, typename MT, bool SO, bool DF >
126bool isDefault( const UpperMatrix<MT,SO,DF>& m );
127
128template< typename MT, bool SO, bool DF >
129bool isIntact( const UpperMatrix<MT,SO,DF>& m );
130
131template< typename MT, bool SO, bool DF >
132void swap( UpperMatrix<MT,SO,DF>& a, UpperMatrix<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 UpperMatrix<MT,SO,DF>& m )
170{
171 if( Size_v<MT,0UL> == DefaultSize_v )
172 return m.rows() == 0UL;
173 else return isStrictlyLower<RF>( m );
174}
175//*************************************************************************************************
176
177
178//*************************************************************************************************
199template< typename MT // Type of the adapted matrix
200 , bool SO // Storage order of the adapted matrix
201 , bool DF > // Density flag
202inline bool isIntact( const UpperMatrix<MT,SO,DF>& m )
203{
204 return m.isIntact();
205}
206//*************************************************************************************************
207
208
209//*************************************************************************************************
217template< typename MT // Type of the adapted matrix
218 , bool SO // Storage order of the adapted matrix
219 , bool DF > // Density flag
220inline void swap( UpperMatrix<MT,SO,DF>& a, UpperMatrix<MT,SO,DF>& b ) noexcept
221{
222 a.swap( b );
223}
224//*************************************************************************************************
225
226
227//*************************************************************************************************
250template< InversionFlag IF // Inversion algorithm
251 , typename MT // Type of the dense matrix
252 , bool SO > // Storage order of the dense matrix
253inline void invert( UpperMatrix<MT,SO,true>& m )
254{
256
257 if( IF == asUniLower ) {
258 BLAZE_INTERNAL_ASSERT( isIdentity( m ), "Violation of preconditions detected" );
259 return;
260 }
261
262 constexpr InversionFlag flag( ( IF == byLU || IF == asGeneral || IF == asUpper )
263 ? ( asUpper )
264 : ( ( IF == asUniUpper )
265 ?( asUniUpper )
266 :( asDiagonal ) ) );
267
268 invert<flag>( derestrict( m ) );
269
270 BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
271}
273//*************************************************************************************************
274
275
276//*************************************************************************************************
295template< typename MT1, bool SO1, typename MT2, typename MT3, typename MT4, bool SO2 >
296inline void lu( const UpperMatrix<MT1,SO1,true>& A, DenseMatrix<MT2,SO1>& L,
297 DenseMatrix<MT3,SO1>& U, Matrix<MT4,SO2>& P )
298{
300
305
310
311 using ET2 = ElementType_t<MT2>;
312 using ET4 = ElementType_t<MT4>;
313
314 const size_t n( (*A).rows() );
315
316 decltype(auto) L2( derestrict( *L ) );
317
318 (*U) = A;
319
320 resize( *L, n, n );
321 reset( L2 );
322
323 resize( *P, n, n );
324 reset( *P );
325
326 for( size_t i=0UL; i<n; ++i ) {
327 L2(i,i) = ET2(1);
328 (*P)(i,i) = ET4(1);
329 }
330}
332//*************************************************************************************************
333
334
335//*************************************************************************************************
351template< typename MT // Type of the adapted matrix
352 , bool SO // Storage order of the adapted matrix
353 , bool DF // Density flag
354 , typename ET > // Type of the element
355inline bool trySet( const UpperMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
356{
357 BLAZE_INTERNAL_ASSERT( i < (*mat).rows(), "Invalid row access index" );
358 BLAZE_INTERNAL_ASSERT( j < (*mat).columns(), "Invalid column access index" );
359
360 MAYBE_UNUSED( mat );
361
362 return ( i <= j || isDefault( value ) );
363}
365//*************************************************************************************************
366
367
368//*************************************************************************************************
386template< typename MT // Type of the adapted matrix
387 , bool SO // Storage order of the adapted matrix
388 , bool DF // Density flag
389 , typename ET > // Type of the element
391 trySet( const UpperMatrix<MT,SO,DF>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
392{
393 BLAZE_INTERNAL_ASSERT( row <= (*mat).rows(), "Invalid row access index" );
394 BLAZE_INTERNAL_ASSERT( column <= (*mat).columns(), "Invalid column access index" );
395 BLAZE_INTERNAL_ASSERT( row + m <= (*mat).rows(), "Invalid number of rows" );
396 BLAZE_INTERNAL_ASSERT( column + n <= (*mat).columns(), "Invalid number of columns" );
397
398 MAYBE_UNUSED( mat );
399
400 return ( m == 0UL ) ||
401 ( n == 0UL ) ||
402 ( column + 1UL >= row + m ) ||
403 isDefault( value );
404}
406//*************************************************************************************************
407
408
409//*************************************************************************************************
425template< typename MT // Type of the adapted matrix
426 , bool SO // Storage order of the adapted matrix
427 , bool DF // Density flag
428 , typename ET > // Type of the element
429inline bool tryAdd( const UpperMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
430{
431 return trySet( mat, i, j, value );
432}
434//*************************************************************************************************
435
436
437//*************************************************************************************************
455template< typename MT // Type of the adapted matrix
456 , bool SO // Storage order of the adapted matrix
457 , bool DF // Density flag
458 , typename ET > // Type of the element
460 tryAdd( const UpperMatrix<MT,SO,DF>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
461{
462 return trySet( mat, row, column, m, n, value );
463}
465//*************************************************************************************************
466
467
468//*************************************************************************************************
484template< typename MT // Type of the adapted matrix
485 , bool SO // Storage order of the adapted matrix
486 , bool DF // Density flag
487 , typename ET > // Type of the element
488inline bool trySub( const UpperMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
489{
490 return trySet( mat, i, j, value );
491}
493//*************************************************************************************************
494
495
496//*************************************************************************************************
514template< typename MT // Type of the adapted matrix
515 , bool SO // Storage order of the adapted matrix
516 , bool DF // Density flag
517 , typename ET > // Type of the element
519 trySub( const UpperMatrix<MT,SO,DF>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
520{
521 return trySet( mat, row, column, m, n, value );
522}
524//*************************************************************************************************
525
526
527//*************************************************************************************************
543template< typename MT // Type of the adapted matrix
544 , bool SO // Storage order of the adapted matrix
545 , bool DF // Density flag
546 , typename ET > // Type of the element
547inline bool tryBitor( const UpperMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
548{
549 return trySet( mat, i, j, value );
550}
552//*************************************************************************************************
553
554
555//*************************************************************************************************
573template< typename MT // Type of the adapted matrix
574 , bool SO // Storage order of the adapted matrix
575 , bool DF // Density flag
576 , typename ET > // Type of the element
578 tryBitor( const UpperMatrix<MT,SO,DF>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
579{
580 return trySet( mat, row, column, m, n, value );
581}
583//*************************************************************************************************
584
585
586//*************************************************************************************************
602template< typename MT // Type of the adapted matrix
603 , bool SO // Storage order of the adapted matrix
604 , bool DF // Density flag
605 , typename ET > // Type of the element
606inline bool tryBitxor( const UpperMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
607{
608 return tryAdd( mat, i, j, value );
609}
611//*************************************************************************************************
612
613
614//*************************************************************************************************
632template< typename MT // Type of the adapted matrix
633 , bool SO // Storage order of the adapted matrix
634 , bool DF // Density flag
635 , typename ET > // Type of the element
637 tryBitxor( const UpperMatrix<MT,SO,DF>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
638{
639 return tryAdd( mat, row, column, m, n, value );
640}
642//*************************************************************************************************
643
644
645//*************************************************************************************************
661template< typename MT // Type of the adapted matrix
662 , bool SO // Storage order of the adapted matrix
663 , bool DF // Density flag
664 , typename VT > // Type of the right-hand side dense vector
665inline bool tryAssign( const UpperMatrix<MT,SO,DF>& lhs,
666 const DenseVector<VT,false>& rhs, size_t row, size_t column )
667{
669
670 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
671 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
672 BLAZE_INTERNAL_ASSERT( row + (*rhs).size() <= lhs.rows(), "Invalid number of rows" );
673
674 MAYBE_UNUSED( lhs );
675
676 const size_t ibegin( ( column < row )?( 0UL ):( column - row + 1UL ) );
677
678 for( size_t i=ibegin; i<(*rhs).size(); ++i ) {
679 if( !isDefault( (*rhs)[i] ) )
680 return false;
681 }
682
683 return true;
684}
686//*************************************************************************************************
687
688
689//*************************************************************************************************
705template< typename MT // Type of the adapted matrix
706 , bool SO // Storage order of the adapted matrix
707 , bool DF // Density flag
708 , typename VT > // Type of the right-hand side dense vector
709inline bool tryAssign( const UpperMatrix<MT,SO,DF>& lhs,
710 const DenseVector<VT,true>& rhs, size_t row, size_t column )
711{
713
714 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
715 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
716 BLAZE_INTERNAL_ASSERT( column + (*rhs).size() <= lhs.columns(), "Invalid number of columns" );
717
718 MAYBE_UNUSED( lhs );
719
720 if( row <= column )
721 return true;
722
723 const size_t iend( min( row - column, (*rhs).size() ) );
724
725 for( size_t i=0UL; i<iend; ++i ) {
726 if( !isDefault( (*rhs)[i] ) )
727 return false;
728 }
729
730 return true;
731}
733//*************************************************************************************************
734
735
736//*************************************************************************************************
754template< typename MT // Type of the adapted matrix
755 , bool SO // Storage order of the adapted matrix
756 , bool DF // Density flag
757 , typename VT // Type of the right-hand side dense vector
758 , bool TF > // Transpose flag of the right-hand side dense vector
759inline bool tryAssign( const UpperMatrix<MT,SO,DF>& lhs, const DenseVector<VT,TF>& rhs,
760 ptrdiff_t band, size_t row, size_t column )
761{
763
764 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
765 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
766 BLAZE_INTERNAL_ASSERT( row + (*rhs).size() <= lhs.rows(), "Invalid number of rows" );
767 BLAZE_INTERNAL_ASSERT( column + (*rhs).size() <= lhs.columns(), "Invalid number of columns" );
768
769 MAYBE_UNUSED( lhs, row, column );
770
771 if( band < 0L ) {
772 for( size_t i=0UL; i<(*rhs).size(); ++i ) {
773 if( !isDefault( (*rhs)[i] ) )
774 return false;
775 }
776 }
777
778 return true;
779}
781//*************************************************************************************************
782
783
784//*************************************************************************************************
800template< typename MT // Type of the adapted matrix
801 , bool SO // Storage order of the adapted matrix
802 , bool DF // Density flag
803 , typename VT > // Type of the right-hand side sparse vector
804inline bool tryAssign( const UpperMatrix<MT,SO,DF>& lhs,
805 const SparseVector<VT,false>& rhs, size_t row, size_t column )
806{
808
809 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
810 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
811 BLAZE_INTERNAL_ASSERT( row + (*rhs).size() <= lhs.rows(), "Invalid number of rows" );
812
813 MAYBE_UNUSED( lhs );
814
815 const auto last( (*rhs).end() );
816 auto element( (*rhs).lowerBound( ( column < row )?( 0UL ):( column - row + 1UL ) ) );
817
818 for( ; element!=last; ++element ) {
819 if( !isDefault( element->value() ) )
820 return false;
821 }
822
823 return true;
824}
826//*************************************************************************************************
827
828
829//*************************************************************************************************
845template< typename MT // Type of the adapted matrix
846 , bool SO // Storage order of the adapted matrix
847 , bool DF // Density flag
848 , typename VT > // Type of the right-hand side sparse vector
849inline bool tryAssign( const UpperMatrix<MT,SO,DF>& lhs,
850 const SparseVector<VT,true>& rhs, size_t row, size_t column )
851{
853
854 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
855 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
856 BLAZE_INTERNAL_ASSERT( column + (*rhs).size() <= lhs.columns(), "Invalid number of columns" );
857
858 MAYBE_UNUSED( lhs );
859
860 if( row <= column )
861 return true;
862
863 const auto last( (*rhs).lowerBound( row - column ) );
864
865 for( auto element=(*rhs).begin(); element!=last; ++element ) {
866 if( !isDefault( element->value() ) )
867 return false;
868 }
869
870 return true;
871}
873//*************************************************************************************************
874
875
876//*************************************************************************************************
894template< typename MT // Type of the adapted matrix
895 , bool SO // Storage order of the adapted matrix
896 , bool DF // Density flag
897 , typename VT // Type of the right-hand side sparse vector
898 , bool TF > // Transpose flag of the right-hand side sparse vector
899inline bool tryAssign( const UpperMatrix<MT,SO,DF>& lhs, const SparseVector<VT,TF>& rhs,
900 ptrdiff_t band, size_t row, size_t column )
901{
903
904 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
905 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
906 BLAZE_INTERNAL_ASSERT( row + (*rhs).size() <= lhs.rows(), "Invalid number of rows" );
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 UpperMatrix<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 if( column + 1UL >= row + M )
960 return true;
961
962 const size_t ibegin( ( column < row )?( 0UL ):( column - row + 1UL ) );
963
964 for( size_t i=ibegin; i<M; ++i )
965 {
966 const size_t jend( min( row + i - column, N ) );
967
968 for( size_t j=0UL; j<jend; ++j ) {
969 if( !isDefault( (*rhs)(i,j) ) )
970 return false;
971 }
972 }
973
974 return true;
975}
977//*************************************************************************************************
978
979
980//*************************************************************************************************
996template< typename MT1 // Type of the adapted matrix
997 , bool SO // Storage order of the adapted matrix
998 , bool DF // Density flag
999 , typename MT2 > // Type of the right-hand side dense matrix
1000inline bool tryAssign( const UpperMatrix<MT1,SO,DF>& lhs,
1001 const DenseMatrix<MT2,true>& rhs, size_t row, size_t column )
1002{
1004
1005 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1006 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1007 BLAZE_INTERNAL_ASSERT( row + (*rhs).rows() <= lhs.rows(), "Invalid number of rows" );
1008 BLAZE_INTERNAL_ASSERT( column + (*rhs).columns() <= lhs.columns(), "Invalid number of columns" );
1009
1010 MAYBE_UNUSED( lhs );
1011
1012 const size_t M( (*rhs).rows() );
1013 const size_t N( (*rhs).columns() );
1014
1015 if( column + 1UL >= row + M )
1016 return true;
1017
1018 const size_t jend( min( row + M - column - 1UL, N ) );
1019
1020 for( size_t j=0UL; j<jend; ++j )
1021 {
1022 const bool containsDiagonal( column + j >= row );
1023 const size_t ibegin( ( containsDiagonal )?( column + j - row + 1UL ):( 0UL ) );
1024
1025 for( size_t i=ibegin; i<M; ++i ) {
1026 if( !isDefault( (*rhs)(i,j) ) )
1027 return false;
1028 }
1029 }
1030
1031 return true;
1032}
1034//*************************************************************************************************
1035
1036
1037//*************************************************************************************************
1053template< typename MT1 // Type of the adapted matrix
1054 , bool SO // Storage order of the adapted matrix
1055 , bool DF // Density flag
1056 , typename MT2 > // Type of the right-hand side sparse matrix
1057inline bool tryAssign( const UpperMatrix<MT1,SO,DF>& lhs,
1058 const SparseMatrix<MT2,false>& rhs, size_t row, size_t column )
1059{
1061
1062 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1063 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1064 BLAZE_INTERNAL_ASSERT( row + (*rhs).rows() <= lhs.rows(), "Invalid number of rows" );
1065 BLAZE_INTERNAL_ASSERT( column + (*rhs).columns() <= lhs.columns(), "Invalid number of columns" );
1066
1067 MAYBE_UNUSED( lhs );
1068
1069 const size_t M( (*rhs).rows() );
1070 const size_t N( (*rhs).columns() );
1071
1072 if( column + 1UL >= row + M )
1073 return true;
1074
1075 const size_t ibegin( ( column < row )?( 0UL ):( column - row + 1UL ) );
1076
1077 for( size_t i=ibegin; i<M; ++i )
1078 {
1079 const size_t index( row + i - column );
1080 const auto last( (*rhs).lowerBound( i, min( index, N ) ) );
1081
1082 for( auto element=(*rhs).begin(i); element!=last; ++element ) {
1083 if( !isDefault( element->value() ) )
1084 return false;
1085 }
1086 }
1087
1088 return true;
1089}
1091//*************************************************************************************************
1092
1093
1094//*************************************************************************************************
1110template< typename MT1 // Type of the adapted matrix
1111 , bool SO // Storage order of the adapted matrix
1112 , bool DF // Density flag
1113 , typename MT2 > // Type of the right-hand side sparse matrix
1114inline bool tryAssign( const UpperMatrix<MT1,SO,DF>& lhs,
1115 const SparseMatrix<MT2,true>& rhs, size_t row, size_t column )
1116{
1118
1119 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1120 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1121 BLAZE_INTERNAL_ASSERT( row + (*rhs).rows() <= lhs.rows(), "Invalid number of rows" );
1122 BLAZE_INTERNAL_ASSERT( column + (*rhs).columns() <= lhs.columns(), "Invalid number of columns" );
1123
1124 MAYBE_UNUSED( lhs );
1125
1126 const size_t M( (*rhs).rows() );
1127 const size_t N( (*rhs).columns() );
1128
1129 if( column + 1UL >= row + M )
1130 return true;
1131
1132 const size_t jend( min( row + M - column - 1UL, N ) );
1133
1134 for( size_t j=0UL; j<jend; ++j )
1135 {
1136 const bool containsDiagonal( column + j >= row );
1137 const size_t index( ( containsDiagonal )?( column + j - row + 1UL ):( 0UL ) );
1138
1139 const auto last( (*rhs).end(j) );
1140 auto element( (*rhs).lowerBound( index, j ) );
1141
1142 for( ; element!=last; ++element ) {
1143 if( !isDefault( element->value() ) )
1144 return false;
1145 }
1146 }
1147
1148 return true;
1149}
1151//*************************************************************************************************
1152
1153
1154//*************************************************************************************************
1170template< typename MT // Type of the adapted matrix
1171 , bool SO // Storage order of the adapted matrix
1172 , bool DF // Density flag
1173 , typename VT // Type of the right-hand side vector
1174 , bool TF > // Transpose flag of the right-hand side vector
1175inline bool tryAddAssign( const UpperMatrix<MT,SO,DF>& lhs,
1176 const Vector<VT,TF>& rhs, size_t row, size_t column )
1177{
1178 return tryAssign( lhs, *rhs, row, column );
1179}
1181//*************************************************************************************************
1182
1183
1184//*************************************************************************************************
1202template< typename MT // Type of the adapted matrix
1203 , bool SO // Storage order of the adapted matrix
1204 , bool DF // Density flag
1205 , typename VT // Type of the right-hand side vector
1206 , bool TF > // Transpose flag of the right-hand side vector
1207inline bool tryAddAssign( const UpperMatrix<MT,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1208 ptrdiff_t band, size_t row, size_t column )
1209{
1210 return tryAssign( lhs, *rhs, band, row, column );
1211}
1213//*************************************************************************************************
1214
1215
1216//*************************************************************************************************
1232template< typename MT1 // Type of the adapted matrix
1233 , bool SO1 // Storage order of the adapted matrix
1234 , bool DF // Density flag
1235 , typename MT2 // Type of the right-hand side matrix
1236 , bool SO2 > // Storage order of the right-hand side matrix
1237inline bool tryAddAssign( const UpperMatrix<MT1,SO1,DF>& lhs,
1238 const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1239{
1240 return tryAssign( lhs, *rhs, row, column );
1241}
1243//*************************************************************************************************
1244
1245
1246//*************************************************************************************************
1262template< typename MT // Type of the adapted matrix
1263 , bool SO // Storage order of the adapted matrix
1264 , bool DF // Density flag
1265 , typename VT // Type of the right-hand side vector
1266 , bool TF > // Transpose flag of the right-hand side vector
1267inline bool trySubAssign( const UpperMatrix<MT,SO,DF>& lhs,
1268 const Vector<VT,TF>& rhs, size_t row, size_t column )
1269{
1270 return tryAssign( lhs, *rhs, row, column );
1271}
1273//*************************************************************************************************
1274
1275
1276//*************************************************************************************************
1294template< typename MT // Type of the adapted matrix
1295 , bool SO // Storage order of the adapted matrix
1296 , bool DF // Density flag
1297 , typename VT // Type of the right-hand side vector
1298 , bool TF > // Transpose flag of the right-hand side vector
1299inline bool trySubAssign( const UpperMatrix<MT,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1300 ptrdiff_t band, size_t row, size_t column )
1301{
1302 return tryAssign( lhs, *rhs, band, row, column );
1303}
1305//*************************************************************************************************
1306
1307
1308//*************************************************************************************************
1324template< typename MT1 // Type of the adapted matrix
1325 , bool SO1 // Storage order of the adapted matrix
1326 , bool DF // Density flag
1327 , typename MT2 // Type of the right-hand side matrix
1328 , bool SO2 > // Storage order of the right-hand side matrix
1329inline bool trySubAssign( const UpperMatrix<MT1,SO1,DF>& lhs,
1330 const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1331{
1332 return tryAssign( lhs, *rhs, row, column );
1333}
1335//*************************************************************************************************
1336
1337
1338//*************************************************************************************************
1354template< typename MT // Type of the adapted matrix
1355 , bool SO // Storage order of the adapted matrix
1356 , bool DF // Density flag
1357 , typename VT // Type of the right-hand side vector
1358 , bool TF > // Transpose flag of the right-hand side vector
1359inline bool tryBitorAssign( const UpperMatrix<MT,SO,DF>& lhs,
1360 const Vector<VT,TF>& rhs, size_t row, size_t column )
1361{
1362 return tryAssign( lhs, *rhs, row, column );
1363}
1365//*************************************************************************************************
1366
1367
1368//*************************************************************************************************
1385template< typename MT // Type of the adapted matrix
1386 , bool SO // Storage order of the adapted matrix
1387 , bool DF // Density flag
1388 , typename VT // Type of the right-hand side vector
1389 , bool TF > // Transpose flag of the right-hand side vector
1390inline bool tryBitorAssign( const UpperMatrix<MT,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1391 ptrdiff_t band, size_t row, size_t column )
1392{
1393 return tryAssign( lhs, *rhs, band, row, column );
1394}
1396//*************************************************************************************************
1397
1398
1399//*************************************************************************************************
1415template< typename MT1 // Type of the adapted matrix
1416 , bool SO1 // Storage order of the adapted matrix
1417 , bool DF // Density flag
1418 , typename MT2 // Type of the right-hand side matrix
1419 , bool SO2 > // Storage order of the right-hand side matrix
1420inline bool tryBitorAssign( const UpperMatrix<MT1,SO1,DF>& lhs,
1421 const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1422{
1423 return tryAssign( lhs, *rhs, row, column );
1424}
1426//*************************************************************************************************
1427
1428
1429//*************************************************************************************************
1445template< typename MT // Type of the adapted matrix
1446 , bool SO // Storage order of the adapted matrix
1447 , bool DF // Density flag
1448 , typename VT // Type of the right-hand side vector
1449 , bool TF > // Transpose flag of the right-hand side vector
1450inline bool tryBitxorAssign( const UpperMatrix<MT,SO,DF>& lhs,
1451 const Vector<VT,TF>& rhs, size_t row, size_t column )
1452{
1453 return tryAssign( lhs, *rhs, row, column );
1454}
1456//*************************************************************************************************
1457
1458
1459//*************************************************************************************************
1476template< typename MT // Type of the adapted matrix
1477 , bool SO // Storage order of the adapted matrix
1478 , bool DF // Density flag
1479 , typename VT // Type of the right-hand side vector
1480 , bool TF > // Transpose flag of the right-hand side vector
1481inline bool tryBitxorAssign( const UpperMatrix<MT,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1482 ptrdiff_t band, size_t row, size_t column )
1483{
1484 return tryAssign( lhs, *rhs, band, row, column );
1485}
1487//*************************************************************************************************
1488
1489
1490//*************************************************************************************************
1506template< typename MT1 // Type of the adapted matrix
1507 , bool SO1 // Storage order of the adapted matrix
1508 , bool DF // Density flag
1509 , typename MT2 // Type of the right-hand side matrix
1510 , bool SO2 > // Storage order of the right-hand side matrix
1511inline bool tryBitxorAssign( const UpperMatrix<MT1,SO1,DF>& lhs,
1512 const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1513{
1514 return tryAssign( lhs, *rhs, row, column );
1515}
1517//*************************************************************************************************
1518
1519
1520//*************************************************************************************************
1534template< typename MT // Type of the adapted matrix
1535 , bool SO // Storage order of the adapted matrix
1536 , bool DF > // Density flag
1537inline MT& derestrict( UpperMatrix<MT,SO,DF>& m )
1538{
1539 return m.matrix_;
1540}
1542//*************************************************************************************************
1543
1544
1545
1546
1547//=================================================================================================
1548//
1549// SIZE SPECIALIZATIONS
1550//
1551//=================================================================================================
1552
1553//*************************************************************************************************
1555template< typename MT, bool SO, bool DF >
1556struct Size< UpperMatrix<MT,SO,DF>, 0UL >
1557 : public Size<MT,0UL>
1558{};
1559
1560template< typename MT, bool SO, bool DF >
1561struct Size< UpperMatrix<MT,SO,DF>, 1UL >
1562 : public Size<MT,1UL>
1563{};
1565//*************************************************************************************************
1566
1567
1568
1569
1570//=================================================================================================
1571//
1572// MAXSIZE SPECIALIZATIONS
1573//
1574//=================================================================================================
1575
1576//*************************************************************************************************
1578template< typename MT, bool SO, bool DF >
1579struct MaxSize< UpperMatrix<MT,SO,DF>, 0UL >
1580 : public MaxSize<MT,0UL>
1581{};
1582
1583template< typename MT, bool SO, bool DF >
1584struct MaxSize< UpperMatrix<MT,SO,DF>, 1UL >
1585 : public MaxSize<MT,1UL>
1586{};
1588//*************************************************************************************************
1589
1590
1591
1592
1593//=================================================================================================
1594//
1595// ISSQUARE SPECIALIZATIONS
1596//
1597//=================================================================================================
1598
1599//*************************************************************************************************
1601template< typename MT, bool SO, bool DF >
1602struct IsSquare< UpperMatrix<MT,SO,DF> >
1603 : public TrueType
1604{};
1606//*************************************************************************************************
1607
1608
1609
1610
1611//=================================================================================================
1612//
1613// ISUNIFORM SPECIALIZATIONS
1614//
1615//=================================================================================================
1616
1617//*************************************************************************************************
1619template< typename MT, bool SO, bool DF >
1620struct IsUniform< UpperMatrix<MT,SO,DF> >
1621 : public IsUniform<MT>
1622{};
1624//*************************************************************************************************
1625
1626
1627
1628
1629//=================================================================================================
1630//
1631// ISSYMMETRIC SPECIALIZATIONS
1632//
1633//=================================================================================================
1634
1635//*************************************************************************************************
1637template< typename MT, bool SO, bool DF >
1638struct IsSymmetric< UpperMatrix<MT,SO,DF> >
1639 : public IsZero<MT>
1640{};
1642//*************************************************************************************************
1643
1644
1645
1646
1647//=================================================================================================
1648//
1649// ISHERMITIAN SPECIALIZATIONS
1650//
1651//=================================================================================================
1652
1653//*************************************************************************************************
1655template< typename MT, bool SO, bool DF >
1656struct IsHermitian< UpperMatrix<MT,SO,DF> >
1657 : public IsZero<MT>
1658{};
1660//*************************************************************************************************
1661
1662
1663
1664
1665//=================================================================================================
1666//
1667// ISSTRICLYLOWER SPECIALIZATIONS
1668//
1669//=================================================================================================
1670
1671//*************************************************************************************************
1673template< typename MT, bool SO, bool DF >
1674struct IsStrictlyLower< UpperMatrix<MT,SO,DF> >
1675 : public IsZero<MT>
1676{};
1678//*************************************************************************************************
1679
1680
1681
1682
1683//=================================================================================================
1684//
1685// ISUPPER SPECIALIZATIONS
1686//
1687//=================================================================================================
1688
1689//*************************************************************************************************
1691template< typename MT, bool SO, bool DF >
1692struct IsUpper< UpperMatrix<MT,SO,DF> >
1693 : public TrueType
1694{};
1696//*************************************************************************************************
1697
1698
1699
1700
1701//=================================================================================================
1702//
1703// ISSTRICLYUPPER SPECIALIZATIONS
1704//
1705//=================================================================================================
1706
1707//*************************************************************************************************
1709template< typename MT, bool SO, bool DF >
1710struct IsStrictlyUpper< UpperMatrix<MT,SO,DF> >
1711 : public IsZero<MT>
1712{};
1714//*************************************************************************************************
1715
1716
1717
1718
1719//=================================================================================================
1720//
1721// ISADAPTOR SPECIALIZATIONS
1722//
1723//=================================================================================================
1724
1725//*************************************************************************************************
1727template< typename MT, bool SO, bool DF >
1728struct IsAdaptor< UpperMatrix<MT,SO,DF> >
1729 : public TrueType
1730{};
1732//*************************************************************************************************
1733
1734
1735
1736
1737//=================================================================================================
1738//
1739// ISRESTRICTED SPECIALIZATIONS
1740//
1741//=================================================================================================
1742
1743//*************************************************************************************************
1745template< typename MT, bool SO, bool DF >
1746struct IsRestricted< UpperMatrix<MT,SO,DF> >
1747 : public TrueType
1748{};
1750//*************************************************************************************************
1751
1752
1753
1754
1755//=================================================================================================
1756//
1757// HASCONSTDATAACCESS SPECIALIZATIONS
1758//
1759//=================================================================================================
1760
1761//*************************************************************************************************
1763template< typename MT, bool SO >
1764struct HasConstDataAccess< UpperMatrix<MT,SO,true> >
1765 : public TrueType
1766{};
1768//*************************************************************************************************
1769
1770
1771
1772
1773//=================================================================================================
1774//
1775// ISALIGNED SPECIALIZATIONS
1776//
1777//=================================================================================================
1778
1779//*************************************************************************************************
1781template< typename MT, bool SO, bool DF >
1782struct IsAligned< UpperMatrix<MT,SO,DF> >
1783 : public IsAligned<MT>
1784{};
1786//*************************************************************************************************
1787
1788
1789
1790
1791//=================================================================================================
1792//
1793// ISCONTIGUOUS SPECIALIZATIONS
1794//
1795//=================================================================================================
1796
1797//*************************************************************************************************
1799template< typename MT, bool SO, bool DF >
1800struct IsContiguous< UpperMatrix<MT,SO,DF> >
1801 : public IsContiguous<MT>
1802{};
1804//*************************************************************************************************
1805
1806
1807
1808
1809//=================================================================================================
1810//
1811// ISPADDED SPECIALIZATIONS
1812//
1813//=================================================================================================
1814
1815//*************************************************************************************************
1817template< typename MT, bool SO, bool DF >
1818struct IsPadded< UpperMatrix<MT,SO,DF> >
1819 : public IsPadded<MT>
1820{};
1822//*************************************************************************************************
1823
1824
1825
1826
1827//=================================================================================================
1828//
1829// REMOVEADAPTOR SPECIALIZATIONS
1830//
1831//=================================================================================================
1832
1833//*************************************************************************************************
1835template< typename MT, bool SO, bool DF >
1836struct RemoveAdaptor< UpperMatrix<MT,SO,DF> >
1837{
1838 using Type = MT;
1839};
1841//*************************************************************************************************
1842
1843
1844
1845
1846//=================================================================================================
1847//
1848// ADDTRAIT SPECIALIZATIONS
1849//
1850//=================================================================================================
1851
1852//*************************************************************************************************
1854template< typename T1, typename T2 >
1855struct AddTraitEval1< T1, T2
1856 , EnableIf_t< IsMatrix_v<T1> &&
1857 IsMatrix_v<T2> &&
1858 ( ( IsUpper_v<T1> && IsUpper_v<T2> ) ||
1859 ( IsUpper_v<T1> && IsDiagonal_v<T2> ) ||
1860 ( IsDiagonal_v<T1> && IsUpper_v<T2> ) ) &&
1861 !( IsUniUpper_v<T1> && IsStrictlyUpper_v<T2> ) &&
1862 !( IsStrictlyUpper_v<T1> && ( IsUniUpper_v<T2> || IsStrictlyUpper_v<T2> ) ) &&
1863 !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
1864 !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1865 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1866{
1867 using Type = UpperMatrix< typename AddTraitEval2<T1,T2>::Type >;
1868};
1870//*************************************************************************************************
1871
1872
1873
1874
1875//=================================================================================================
1876//
1877// SUBTRAIT SPECIALIZATIONS
1878//
1879//=================================================================================================
1880
1881//*************************************************************************************************
1883template< typename T1, typename T2 >
1884struct SubTraitEval1< T1, T2
1885 , EnableIf_t< IsMatrix_v<T1> &&
1886 IsMatrix_v<T2> &&
1887 ( ( IsUpper_v<T1> && IsUpper_v<T2> ) ||
1888 ( IsUpper_v<T1> && IsDiagonal_v<T2> ) ||
1889 ( IsDiagonal_v<T1> && IsUpper_v<T2> ) ) &&
1890 !( IsUniUpper_v<T1> && IsStrictlyUpper_v<T2> ) &&
1891 !( IsUniUpper_v<T1> && IsUniUpper_v<T2> ) &&
1892 !( IsStrictlyUpper_v<T1> && IsStrictlyUpper_v<T2> ) &&
1893 !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
1894 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1895{
1896 using Type = UpperMatrix< typename SubTraitEval2<T1,T2>::Type >;
1897};
1899//*************************************************************************************************
1900
1901
1902
1903
1904//=================================================================================================
1905//
1906// SCHURTRAIT SPECIALIZATIONS
1907//
1908//=================================================================================================
1909
1910//*************************************************************************************************
1912template< typename T1, typename T2 >
1913struct SchurTraitEval1< T1, T2
1914 , EnableIf_t< IsMatrix_v<T1> &&
1915 IsMatrix_v<T2> &&
1916 ( ( IsUpper_v<T1> && !IsLower_v<T2> ) ||
1917 ( !IsLower_v<T1> && IsUpper_v<T2> ) ) &&
1918 !( IsUniUpper_v<T1> && IsUniUpper_v<T2> ) &&
1919 !( IsStrictlyUpper_v<T1> || IsStrictlyUpper_v<T2> ) &&
1920 !( IsDiagonal_v<T1> || IsDiagonal_v<T2> ) &&
1921 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1922{
1923 using Type = UpperMatrix< typename SchurTraitEval2<T1,T2>::Type >;
1924};
1926//*************************************************************************************************
1927
1928
1929
1930
1931//=================================================================================================
1932//
1933// MULTTRAIT SPECIALIZATIONS
1934//
1935//=================================================================================================
1936
1937//*************************************************************************************************
1939template< typename T1, typename T2 >
1940struct MultTraitEval1< T1, T2
1941 , EnableIf_t< IsMatrix_v<T1> &&
1942 IsScalar_v<T2> &&
1943 ( IsUpper_v<T1> && !IsStrictlyUpper_v<T1> &&
1944 !IsDiagonal_v<T1> && !IsUniform_v<T1> ) > >
1945{
1946 using Type = UpperMatrix< typename MultTraitEval2<T1,T2>::Type >;
1947};
1948
1949template< typename T1, typename T2 >
1950struct MultTraitEval1< T1, T2
1951 , EnableIf_t< IsScalar_v<T1> &&
1952 IsMatrix_v<T2> &&
1953 ( IsUpper_v<T2> && !IsStrictlyUpper_v<T2> &&
1954 !IsDiagonal_v<T2> && !IsUniform_v<T2> ) > >
1955{
1956 using Type = UpperMatrix< typename MultTraitEval2<T1,T2>::Type >;
1957};
1958
1959template< typename T1, typename T2 >
1960struct MultTraitEval1< T1, T2
1961 , EnableIf_t< IsMatrix_v<T1> &&
1962 IsMatrix_v<T2> &&
1963 ( IsUpper_v<T1> && IsUpper_v<T2> ) &&
1964 !( IsUniUpper_v<T1> && IsUniUpper_v<T2> ) &&
1965 !( IsStrictlyUpper_v<T1> && IsUpper_v<T2> ) &&
1966 !( IsUpper_v<T1> && IsStrictlyUpper_v<T2> ) &&
1967 !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
1968 !( IsIdentity_v<T1> || IsIdentity_v<T2> ) &&
1969 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1970{
1971 using Type = UpperMatrix< typename MultTraitEval2<T1,T2>::Type >;
1972};
1974//*************************************************************************************************
1975
1976
1977
1978
1979//=================================================================================================
1980//
1981// KRONTRAIT SPECIALIZATIONS
1982//
1983//=================================================================================================
1984
1985//*************************************************************************************************
1987template< typename T1, typename T2 >
1988struct KronTraitEval1< T1, T2
1989 , EnableIf_t< IsMatrix_v<T1> &&
1990 IsMatrix_v<T2> &&
1991 ( IsUpper_v<T1> && IsUpper_v<T2> ) &&
1992 !( IsUniUpper_v<T1> && IsUniUpper_v<T2> ) &&
1993 !( IsStrictlyUpper_v<T1> || IsStrictlyUpper_v<T2> ) &&
1994 !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
1995 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1996{
1997 using Type = UpperMatrix< typename KronTraitEval2<T1,T2>::Type >;
1998};
2000//*************************************************************************************************
2001
2002
2003
2004
2005//=================================================================================================
2006//
2007// DIVTRAIT SPECIALIZATIONS
2008//
2009//=================================================================================================
2010
2011//*************************************************************************************************
2013template< typename T1, typename T2 >
2014struct DivTraitEval1< T1, T2
2015 , EnableIf_t< IsUpper_v<T1> &&
2016 !IsStrictlyUpper_v<T1> &&
2017 !IsDiagonal_v<T1> &&
2018 IsScalar_v<T2> > >
2019{
2020 using Type = UpperMatrix< typename DivTraitEval2<T1,T2>::Type >;
2021};
2023//*************************************************************************************************
2024
2025
2026
2027
2028//=================================================================================================
2029//
2030// MAPTRAIT SPECIALIZATIONS
2031//
2032//=================================================================================================
2033
2034//*************************************************************************************************
2036template< typename T, typename OP >
2037struct UnaryMapTraitEval1< T, OP
2038 , EnableIf_t< YieldsUpper_v<OP,T> &&
2039 !YieldsUniUpper_v<OP,T> &&
2040 !YieldsStrictlyUpper_v<OP,T> &&
2041 !YieldsDiagonal_v<OP,T> > >
2042{
2043 using Type = UpperMatrix< typename UnaryMapTraitEval2<T,OP>::Type, StorageOrder_v<T> >;
2044};
2046//*************************************************************************************************
2047
2048
2049//*************************************************************************************************
2051template< typename T1, typename T2, typename OP >
2052struct BinaryMapTraitEval1< T1, T2, OP
2053 , EnableIf_t< YieldsUpper_v<OP,T1,T2> &&
2054 !YieldsUniUpper_v<OP,T1,T2> &&
2055 !YieldsStrictlyUpper_v<OP,T1,T2> &&
2056 !YieldsDiagonal_v<OP,T1,T2> > >
2057{
2058 using Type = UpperMatrix< typename BinaryMapTraitEval2<T1,T2,OP>::Type >;
2059};
2061//*************************************************************************************************
2062
2063
2064
2065
2066//=================================================================================================
2067//
2068// DECLSYMTRAIT SPECIALIZATIONS
2069//
2070//=================================================================================================
2071
2072//*************************************************************************************************
2074template< typename MT, bool SO, bool DF >
2075struct DeclSymTrait< UpperMatrix<MT,SO,DF> >
2076{
2077 using Type = DiagonalMatrix<MT,SO,DF>;
2078};
2080//*************************************************************************************************
2081
2082
2083
2084
2085//=================================================================================================
2086//
2087// DECLHERMTRAIT SPECIALIZATIONS
2088//
2089//=================================================================================================
2090
2091//*************************************************************************************************
2093template< typename MT, bool SO, bool DF >
2094struct DeclHermTrait< UpperMatrix<MT,SO,DF> >
2095{
2096 using Type = HermitianMatrix<MT,SO,DF>;
2097};
2099//*************************************************************************************************
2100
2101
2102
2103
2104//=================================================================================================
2105//
2106// DECLLOWTRAIT SPECIALIZATIONS
2107//
2108//=================================================================================================
2109
2110//*************************************************************************************************
2112template< typename MT, bool SO, bool DF >
2113struct DeclLowTrait< UpperMatrix<MT,SO,DF> >
2114{
2115 using Type = DiagonalMatrix<MT,SO,DF>;
2116};
2118//*************************************************************************************************
2119
2120
2121
2122
2123//=================================================================================================
2124//
2125// DECLUNILOWTRAIT SPECIALIZATIONS
2126//
2127//=================================================================================================
2128
2129//*************************************************************************************************
2131template< typename MT, bool SO, bool DF >
2132struct DeclUniLowTrait< UpperMatrix<MT,SO,DF> >
2133{
2134 using Type = IdentityMatrix< ElementType_t<MT>, SO >;
2135};
2137//*************************************************************************************************
2138
2139
2140
2141
2142//=================================================================================================
2143//
2144// DECLSTRLOWTRAIT SPECIALIZATIONS
2145//
2146//=================================================================================================
2147
2148//*************************************************************************************************
2150template< typename MT, bool SO, bool DF >
2151struct DeclStrLowTrait< UpperMatrix<MT,SO,DF> >
2152{
2153 using Type = ZeroMatrix< ElementType_t<MT>, SO >;
2154};
2156//*************************************************************************************************
2157
2158
2159
2160
2161//=================================================================================================
2162//
2163// DECLUPPTRAIT SPECIALIZATIONS
2164//
2165//=================================================================================================
2166
2167//*************************************************************************************************
2169template< typename MT, bool SO, bool DF >
2170struct DeclUppTrait< UpperMatrix<MT,SO,DF> >
2171{
2172 using Type = UpperMatrix<MT,SO,DF>;
2173};
2175//*************************************************************************************************
2176
2177
2178
2179
2180//=================================================================================================
2181//
2182// DECLUNIUPPTRAIT SPECIALIZATIONS
2183//
2184//=================================================================================================
2185
2186//*************************************************************************************************
2188template< typename MT, bool SO, bool DF >
2189struct DeclUniUppTrait< UpperMatrix<MT,SO,DF> >
2190{
2191 using Type = UniUpperMatrix<MT,SO,DF>;
2192};
2194//*************************************************************************************************
2195
2196
2197
2198
2199//=================================================================================================
2200//
2201// DECLSTRUPPTRAIT SPECIALIZATIONS
2202//
2203//=================================================================================================
2204
2205//*************************************************************************************************
2207template< typename MT, bool SO, bool DF >
2208struct DeclStrUppTrait< UpperMatrix<MT,SO,DF> >
2209{
2210 using Type = StrictlyUpperMatrix<MT,SO,DF>;
2211};
2213//*************************************************************************************************
2214
2215
2216
2217
2218//=================================================================================================
2219//
2220// DECLDIAGTRAIT SPECIALIZATIONS
2221//
2222//=================================================================================================
2223
2224//*************************************************************************************************
2226template< typename MT, bool SO, bool DF >
2227struct DeclDiagTrait< UpperMatrix<MT,SO,DF> >
2228{
2229 using Type = DiagonalMatrix<MT,SO,DF>;
2230};
2232//*************************************************************************************************
2233
2234
2235
2236
2237//=================================================================================================
2238//
2239// HIGHTYPE SPECIALIZATIONS
2240//
2241//=================================================================================================
2242
2243//*************************************************************************************************
2245template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2246struct HighType< UpperMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
2247{
2248 using Type = UpperMatrix< typename HighType<MT1,MT2>::Type >;
2249};
2251//*************************************************************************************************
2252
2253
2254
2255
2256//=================================================================================================
2257//
2258// LOWTYPE SPECIALIZATIONS
2259//
2260//=================================================================================================
2261
2262//*************************************************************************************************
2264template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2265struct LowType< UpperMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
2266{
2267 using Type = UpperMatrix< typename LowType<MT1,MT2>::Type >;
2268};
2270//*************************************************************************************************
2271
2272
2273
2274
2275//=================================================================================================
2276//
2277// SUBMATRIXTRAIT SPECIALIZATIONS
2278//
2279//=================================================================================================
2280
2281//*************************************************************************************************
2283template< typename MT, size_t I, size_t N >
2284struct SubmatrixTraitEval1< MT, I, I, N, N
2285 , EnableIf_t< I != inf && N != inf &&
2286 IsUpper_v<MT> &&
2287 !IsUniUpper_v<MT> &&
2288 !IsStrictlyUpper_v<MT> &&
2289 !IsDiagonal_v<MT> &&
2290 !IsUniform_v<MT> &&
2291 !IsZero_v<MT> > >
2292{
2293 using Type = UpperMatrix< typename SubmatrixTraitEval2<MT,I,I,N,N>::Type >;
2294};
2296//*************************************************************************************************
2297
2298} // namespace blaze
2299
2300#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 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 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 IsUniUpper 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 YieldsStrictlyUpper type trait.
Header file for the YieldsUniUpper type trait.
Header file for the YieldsUpper type trait.
Header file for the implementation of the base template of the UpperMatrix.
UpperMatrix specialization for dense matrices.
UpperMatrix specialization for sparse matrices.
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
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1339
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 YieldsUpper_v
Auxiliary variable template for the YieldsUpper type trait.
Definition: YieldsUpper.h:126
constexpr bool IsScalar_v
Auxiliary variable template for the IsScalar type trait.
Definition: IsScalar.h:104
constexpr bool IsUpper_v
Auxiliary variable template for the IsUpper type trait.
Definition: IsUpper.h:175
constexpr ptrdiff_t DefaultSize_v
Default size of the Size type trait.
Definition: Size.h:72
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
@ asUpper
Flag for the inversion of a upper triangular matrix.
Definition: InversionFlag.h:113
@ asUniUpper
Flag for the inversion of a upper unitriangular matrix.
Definition: InversionFlag.h:114
@ asDiagonal
Flag for the inversion of a diagonal matrix.
Definition: InversionFlag.h:115
@ byLU
Flag for the LU-based matrix inversion.
Definition: InversionFlag.h:103
@ asGeneral
Flag for the inversion of a general matrix (same as byLU).
Definition: InversionFlag.h:108
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.
Header file for the generic min algorithm.