Blaze  3.6
LowerMatrix.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_LOWERMATRIX_H_
36 #define _BLAZE_MATH_ADAPTORS_LOWERMATRIX_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
54 #include <blaze/math/Exception.h>
55 #include <blaze/math/Forward.h>
104 #include <blaze/util/Assert.h>
105 #include <blaze/util/EnableIf.h>
107 #include <blaze/util/MaybeUnused.h>
109 
110 
111 namespace blaze {
112 
113 //=================================================================================================
114 //
115 // LOWERMATRIX OPERATORS
116 //
117 //=================================================================================================
118 
119 //*************************************************************************************************
122 template< typename MT, bool SO, bool DF >
123 void reset( LowerMatrix<MT,SO,DF>& m );
124 
125 template< typename MT, bool SO, bool DF >
126 void reset( LowerMatrix<MT,SO,DF>& m, size_t i );
127 
128 template< typename MT, bool SO, bool DF >
129 void clear( LowerMatrix<MT,SO,DF>& m );
130 
131 template< bool RF, typename MT, bool SO, bool DF >
132 bool isDefault( const LowerMatrix<MT,SO,DF>& m );
133 
134 template< typename MT, bool SO, bool DF >
135 bool isIntact( const LowerMatrix<MT,SO,DF>& m );
136 
137 template< typename MT, bool SO, bool DF >
138 void swap( LowerMatrix<MT,SO,DF>& a, LowerMatrix<MT,SO,DF>& b ) noexcept;
140 //*************************************************************************************************
141 
142 
143 //*************************************************************************************************
150 template< typename MT // Type of the adapted matrix
151  , bool SO // Storage order of the adapted matrix
152  , bool DF > // Density flag
153 inline void reset( LowerMatrix<MT,SO,DF>& m )
154 {
155  m.reset();
156 }
157 //*************************************************************************************************
158 
159 
160 //*************************************************************************************************
173 template< typename MT // Type of the adapted matrix
174  , bool SO // Storage order of the adapted matrix
175  , bool DF > // Density flag
176 inline void reset( LowerMatrix<MT,SO,DF>& m, size_t i )
177 {
178  m.reset( i );
179 }
180 //*************************************************************************************************
181 
182 
183 //*************************************************************************************************
190 template< typename MT // Type of the adapted matrix
191  , bool SO // Storage order of the adapted matrix
192  , bool DF > // Density flag
193 inline void clear( LowerMatrix<MT,SO,DF>& m )
194 {
195  m.clear();
196 }
197 //*************************************************************************************************
198 
199 
200 //*************************************************************************************************
228 template< bool RF // Relaxation flag
229  , typename MT // Type of the adapted matrix
230  , bool SO // Storage order of the adapted matrix
231  , bool DF > // Density flag
232 inline bool isDefault( const LowerMatrix<MT,SO,DF>& m )
233 {
234  return isDefault<RF>( m.matrix_ );
235 }
236 //*************************************************************************************************
237 
238 
239 //*************************************************************************************************
260 template< typename MT // Type of the adapted matrix
261  , bool SO // Storage order of the adapted matrix
262  , bool DF > // Density flag
263 inline bool isIntact( const LowerMatrix<MT,SO,DF>& m )
264 {
265  return m.isIntact();
266 }
267 //*************************************************************************************************
268 
269 
270 //*************************************************************************************************
278 template< typename MT // Type of the adapted matrix
279  , bool SO // Storage order of the adapted matrix
280  , bool DF > // Density flag
281 inline void swap( LowerMatrix<MT,SO,DF>& a, LowerMatrix<MT,SO,DF>& b ) noexcept
282 {
283  a.swap( b );
284 }
285 //*************************************************************************************************
286 
287 
288 //*************************************************************************************************
311 template< InversionFlag IF // Inversion algorithm
312  , typename MT // Type of the dense matrix
313  , bool SO > // Storage order of the dense matrix
314 inline void invert( LowerMatrix<MT,SO,true>& m )
315 {
317 
318  if( IF == asUniUpper ) {
319  BLAZE_INTERNAL_ASSERT( isIdentity( m ), "Violation of preconditions detected" );
320  return;
321  }
322 
323  constexpr InversionFlag flag( ( IF == byLU || IF == asGeneral || IF == asLower )
324  ? ( asLower )
325  : ( ( IF == asUniLower )
326  ?( asUniLower )
327  :( asDiagonal ) ) );
328 
329  invert<flag>( derestrict( m ) );
330 
331  BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
332 }
334 //*************************************************************************************************
335 
336 
337 //*************************************************************************************************
356 template< typename MT1, bool SO1, typename MT2, typename MT3, typename MT4, bool SO2 >
357 inline void lu( const LowerMatrix<MT1,SO1,true>& A, DenseMatrix<MT2,SO1>& L,
358  DenseMatrix<MT3,SO1>& U, Matrix<MT4,SO2>& P )
359 {
360  BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE( ElementType_t<MT1> );
361 
366 
371 
372  using ET3 = ElementType_t<MT3>;
373  using ET4 = ElementType_t<MT4>;
374 
375  const size_t n( (~A).rows() );
376 
377  decltype(auto) U2( derestrict( ~U ) );
378 
379  (~L) = A;
380 
381  resize( ~U, n, n );
382  reset( U2 );
383 
384  resize( ~P, n, n );
385  reset( ~P );
386 
387  for( size_t i=0UL; i<n; ++i ) {
388  U2(i,i) = ET3(1);
389  (~P)(i,i) = ET4(1);
390  }
391 }
393 //*************************************************************************************************
394 
395 
396 //*************************************************************************************************
412 template< typename MT // Type of the adapted matrix
413  , bool SO // Storage order of the adapted matrix
414  , bool DF // Density flag
415  , typename ET > // Type of the element
416 inline bool trySet( const LowerMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
417 {
418  BLAZE_INTERNAL_ASSERT( i < (~mat).rows(), "Invalid row access index" );
419  BLAZE_INTERNAL_ASSERT( j < (~mat).columns(), "Invalid column access index" );
420 
421  MAYBE_UNUSED( mat );
422 
423  return ( i >= j || isDefault( value ) );
424 }
426 //*************************************************************************************************
427 
428 
429 //*************************************************************************************************
447 template< typename MT // Type of the adapted matrix
448  , bool SO // Storage order of the adapted matrix
449  , bool DF // Density flag
450  , typename ET > // Type of the element
452  trySet( const LowerMatrix<MT,SO,DF>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
453 {
454  BLAZE_INTERNAL_ASSERT( row <= (~mat).rows(), "Invalid row access index" );
455  BLAZE_INTERNAL_ASSERT( column <= (~mat).columns(), "Invalid column access index" );
456  BLAZE_INTERNAL_ASSERT( row + m <= (~mat).rows(), "Invalid number of rows" );
457  BLAZE_INTERNAL_ASSERT( column + n <= (~mat).columns(), "Invalid number of columns" );
458 
459  MAYBE_UNUSED( mat );
460 
461  return ( m == 0UL ) ||
462  ( n == 0UL ) ||
463  ( row + 1UL >= column + n ) ||
464  isDefault( value );
465 }
467 //*************************************************************************************************
468 
469 
470 //*************************************************************************************************
486 template< typename MT // Type of the adapted matrix
487  , bool SO // Storage order of the adapted matrix
488  , bool DF // Density flag
489  , typename ET > // Type of the element
490 inline bool tryAdd( const LowerMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
491 {
492  return trySet( mat, i, j, value );
493 }
495 //*************************************************************************************************
496 
497 
498 //*************************************************************************************************
516 template< typename MT // Type of the adapted matrix
517  , bool SO // Storage order of the adapted matrix
518  , bool DF // Density flag
519  , typename ET > // Type of the element
521  tryAdd( const LowerMatrix<MT,SO,DF>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
522 {
523  return trySet( mat, row, column, m, n, value );
524 }
526 //*************************************************************************************************
527 
528 
529 //*************************************************************************************************
545 template< typename MT // Type of the adapted matrix
546  , bool SO // Storage order of the adapted matrix
547  , bool DF // Density flag
548  , typename ET > // Type of the element
549 inline bool trySub( const LowerMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
550 {
551  return trySet( mat, i, j, value );
552 }
554 //*************************************************************************************************
555 
556 
557 //*************************************************************************************************
575 template< typename MT // Type of the adapted matrix
576  , bool SO // Storage order of the adapted matrix
577  , bool DF // Density flag
578  , typename ET > // Type of the element
580  trySub( const LowerMatrix<MT,SO,DF>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
581 {
582  return trySet( mat, row, column, m, n, value );
583 }
585 //*************************************************************************************************
586 
587 
588 //*************************************************************************************************
604 template< typename MT // Type of the adapted matrix
605  , bool SO // Storage order of the adapted matrix
606  , bool DF // Density flag
607  , typename ET > // Type of the element
608 inline bool tryBitor( const LowerMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
609 {
610  return trySet( mat, i, j, value );
611 }
613 //*************************************************************************************************
614 
615 
616 //*************************************************************************************************
634 template< typename MT // Type of the adapted matrix
635  , bool SO // Storage order of the adapted matrix
636  , bool DF // Density flag
637  , typename ET > // Type of the element
639  tryBitor( const LowerMatrix<MT,SO,DF>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
640 {
641  return trySet( mat, row, column, m, n, value );
642 }
644 //*************************************************************************************************
645 
646 
647 //*************************************************************************************************
663 template< typename MT // Type of the adapted matrix
664  , bool SO // Storage order of the adapted matrix
665  , bool DF // Density flag
666  , typename ET > // Type of the element
667 inline bool tryBitxor( const LowerMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
668 {
669  return tryAdd( mat, i, j, value );
670 }
672 //*************************************************************************************************
673 
674 
675 //*************************************************************************************************
693 template< typename MT // Type of the adapted matrix
694  , bool SO // Storage order of the adapted matrix
695  , bool DF // Density flag
696  , typename ET > // Type of the element
698  tryBitxor( const LowerMatrix<MT,SO,DF>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
699 {
700  return tryAdd( mat, row, column, m, n, value );
701 }
703 //*************************************************************************************************
704 
705 
706 //*************************************************************************************************
722 template< typename MT // Type of the adapted matrix
723  , bool SO // Storage order of the adapted matrix
724  , bool DF // Density flag
725  , typename VT > // Type of the right-hand side dense vector
726 inline bool tryAssign( const LowerMatrix<MT,SO,DF>& lhs,
727  const DenseVector<VT,false>& rhs, size_t row, size_t column )
728 {
730 
731  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
732  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
733  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
734 
735  MAYBE_UNUSED( lhs );
736 
737  if( column <= row )
738  return true;
739 
740  const size_t iend( min( column - row, (~rhs).size() ) );
741 
742  for( size_t i=0UL; i<iend; ++i ) {
743  if( !isDefault( (~rhs)[i] ) )
744  return false;
745  }
746 
747  return true;
748 }
750 //*************************************************************************************************
751 
752 
753 //*************************************************************************************************
769 template< typename MT // Type of the adapted matrix
770  , bool SO // Storage order of the adapted matrix
771  , bool DF // Density flag
772  , typename VT > // Type of the right-hand side dense vector
773 inline bool tryAssign( const LowerMatrix<MT,SO,DF>& lhs,
774  const DenseVector<VT,true>& rhs, size_t row, size_t column )
775 {
777 
778  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
779  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
780  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
781 
782  MAYBE_UNUSED( lhs );
783 
784  const size_t ibegin( ( row < column )?( 0UL ):( row - column + 1UL ) );
785 
786  for( size_t i=ibegin; i<(~rhs).size(); ++i ) {
787  if( !isDefault( (~rhs)[i] ) )
788  return false;
789  }
790 
791  return true;
792 }
794 //*************************************************************************************************
795 
796 
797 //*************************************************************************************************
815 template< typename MT // Type of the adapted matrix
816  , bool SO // Storage order of the adapted matrix
817  , bool DF // Density flag
818  , typename VT // Type of the right-hand side dense vector
819  , bool TF > // Transpose flag of the right-hand side dense vector
820 inline bool tryAssign( const LowerMatrix<MT,SO,DF>& lhs, const DenseVector<VT,TF>& rhs,
821  ptrdiff_t band, size_t row, size_t column )
822 {
824 
825  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
826  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
827  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
828  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
829 
830  MAYBE_UNUSED( lhs, row, column );
831 
832  if( band > 0L ) {
833  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
834  if( !isDefault( (~rhs)[i] ) )
835  return false;
836  }
837  }
838 
839  return true;
840 }
842 //*************************************************************************************************
843 
844 
845 //*************************************************************************************************
861 template< typename MT // Type of the adapted matrix
862  , bool SO // Storage order of the adapted matrix
863  , bool DF // Density flag
864  , typename VT > // Type of the right-hand side sparse vector
865 inline bool tryAssign( const LowerMatrix<MT,SO,DF>& lhs,
866  const SparseVector<VT,false>& rhs, size_t row, size_t column )
867 {
869 
870  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
871  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
872  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
873 
874  MAYBE_UNUSED( lhs );
875 
876  if( column <= row )
877  return true;
878 
879  const auto last( (~rhs).lowerBound( column - row ) );
880 
881  for( auto element=(~rhs).begin(); element!=last; ++element ) {
882  if( !isDefault( element->value() ) )
883  return false;
884  }
885 
886  return true;
887 }
889 //*************************************************************************************************
890 
891 
892 //*************************************************************************************************
908 template< typename MT // Type of the adapted matrix
909  , bool SO // Storage order of the adapted matrix
910  , bool DF // Density flag
911  , typename VT > // Type of the right-hand side sparse vector
912 inline bool tryAssign( const LowerMatrix<MT,SO,DF>& lhs,
913  const SparseVector<VT,true>& rhs, size_t row, size_t column )
914 {
916 
917  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
918  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
919  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
920 
921  MAYBE_UNUSED( lhs );
922 
923  const auto last( (~rhs).end() );
924  auto element( (~rhs).lowerBound( ( row < column )?( 0UL ):( row - column + 1UL ) ) );
925 
926  for( ; element!=last; ++element ) {
927  if( !isDefault( element->value() ) )
928  return false;
929  }
930 
931  return true;
932 }
934 //*************************************************************************************************
935 
936 
937 //*************************************************************************************************
955 template< typename MT // Type of the adapted matrix
956  , bool SO // Storage order of the adapted matrix
957  , bool DF // Density flag
958  , typename VT // Type of the right-hand side sparse vector
959  , bool TF > // Transpose flag of the right-hand side sparse vector
960 inline bool tryAssign( const LowerMatrix<MT,SO,DF>& lhs, const SparseVector<VT,TF>& rhs,
961  ptrdiff_t band, size_t row, size_t column )
962 {
964 
965  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
966  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
967  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
968  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
969 
970  MAYBE_UNUSED( lhs, row, column );
971 
972  if( band > 0L ) {
973  for( const auto& element : ~rhs ) {
974  if( !isDefault( element.value() ) )
975  return false;
976  }
977  }
978 
979  return true;
980 }
982 //*************************************************************************************************
983 
984 
985 //*************************************************************************************************
1001 template< typename MT1 // Type of the adapted matrix
1002  , bool SO // Storage order of the adapted matrix
1003  , bool DF // Density flag
1004  , typename MT2 > // Type of the right-hand side dense matrix
1005 inline bool tryAssign( const LowerMatrix<MT1,SO,DF>& lhs,
1006  const DenseMatrix<MT2,false>& rhs, size_t row, size_t column )
1007 {
1009 
1010  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1011  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1012  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
1013  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
1014 
1015  MAYBE_UNUSED( lhs );
1016 
1017  const size_t M( (~rhs).rows() );
1018  const size_t N( (~rhs).columns() );
1019 
1020  if( row + 1UL >= column + N )
1021  return true;
1022 
1023  const size_t iend( min( column + N - row - 1UL, M ) );
1024 
1025  for( size_t i=0UL; i<iend; ++i )
1026  {
1027  const bool containsDiagonal( row + i >= column );
1028  const size_t jbegin( ( containsDiagonal )?( row + i - column + 1UL ):( 0UL ) );
1029 
1030  for( size_t j=jbegin; j<N; ++j ) {
1031  if( !isDefault( (~rhs)(i,j) ) )
1032  return false;
1033  }
1034  }
1035 
1036  return true;
1037 }
1039 //*************************************************************************************************
1040 
1041 
1042 //*************************************************************************************************
1058 template< typename MT1 // Type of the adapted matrix
1059  , bool SO // Storage order of the adapted matrix
1060  , bool DF // Density flag
1061  , typename MT2 > // Type of the right-hand side dense matrix
1062 inline bool tryAssign( const LowerMatrix<MT1,SO,DF>& lhs,
1063  const DenseMatrix<MT2,true>& rhs, size_t row, size_t column )
1064 {
1066 
1067  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1068  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1069  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
1070  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
1071 
1072  MAYBE_UNUSED( lhs );
1073 
1074  const size_t M( (~rhs).rows() );
1075  const size_t N( (~rhs).columns() );
1076 
1077  if( row + 1UL >= column + N )
1078  return true;
1079 
1080  const size_t jbegin( ( row < column )?( 0UL ):( row - column + 1UL ) );
1081 
1082  for( size_t j=jbegin; j<N; ++j )
1083  {
1084  const size_t iend( min( column + j - row, M ) );
1085 
1086  for( size_t i=0UL; i<iend; ++i ) {
1087  if( !isDefault( (~rhs)(i,j) ) )
1088  return false;
1089  }
1090  }
1091 
1092  return true;
1093 }
1095 //*************************************************************************************************
1096 
1097 
1098 //*************************************************************************************************
1114 template< typename MT1 // Type of the adapted matrix
1115  , bool SO // Storage order of the adapted matrix
1116  , bool DF // Density flag
1117  , typename MT2 > // Type of the right-hand side sparse matrix
1118 inline bool tryAssign( const LowerMatrix<MT1,SO,DF>& lhs,
1119  const SparseMatrix<MT2,false>& rhs, size_t row, size_t column )
1120 {
1122 
1123  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1124  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1125  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
1126  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
1127 
1128  MAYBE_UNUSED( lhs );
1129 
1130  const size_t M( (~rhs).rows() );
1131  const size_t N( (~rhs).columns() );
1132 
1133  if( row + 1UL >= column + N )
1134  return true;
1135 
1136  const size_t iend( min( column + N - row - 1UL, M ) );
1137 
1138  for( size_t i=0UL; i<iend; ++i )
1139  {
1140  const bool containsDiagonal( row + i >= column );
1141  const size_t index( ( containsDiagonal )?( row + i - column + 1UL ):( 0UL ) );
1142 
1143  const auto last( (~rhs).end(i) );
1144  auto element( (~rhs).lowerBound( i, index ) );
1145 
1146  for( ; element!=last; ++element ) {
1147  if( !isDefault( element->value() ) )
1148  return false;
1149  }
1150  }
1151 
1152  return true;
1153 }
1155 //*************************************************************************************************
1156 
1157 
1158 //*************************************************************************************************
1174 template< typename MT1 // Type of the adapted matrix
1175  , bool SO // Storage order of the adapted matrix
1176  , bool DF // Density flag
1177  , typename MT2 > // Type of the right-hand side sparse matrix
1178 inline bool tryAssign( const LowerMatrix<MT1,SO,DF>& lhs,
1179  const SparseMatrix<MT2,true>& rhs, size_t row, size_t column )
1180 {
1182 
1183  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1184  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1185  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
1186  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
1187 
1188  MAYBE_UNUSED( lhs );
1189 
1190  const size_t M( (~rhs).rows() );
1191  const size_t N( (~rhs).columns() );
1192 
1193  if( row + 1UL >= column + N )
1194  return true;
1195 
1196  const size_t jbegin( ( row < column )?( 0UL ):( row - column + 1UL ) );
1197 
1198  for( size_t j=jbegin; j<N; ++j )
1199  {
1200  const size_t index( column + j - row );
1201  const auto last( (~rhs).lowerBound( min( index, M ), j ) );
1202 
1203  for( auto element=(~rhs).begin(j); element!=last; ++element ) {
1204  if( !isDefault( element->value() ) )
1205  return false;
1206  }
1207  }
1208 
1209  return true;
1210 }
1212 //*************************************************************************************************
1213 
1214 
1215 //*************************************************************************************************
1231 template< typename MT // Type of the adapted matrix
1232  , bool SO // Storage order of the adapted matrix
1233  , bool DF // Density flag
1234  , typename VT // Type of the right-hand side vector
1235  , bool TF > // Transpose flag of the right-hand side vector
1236 inline bool tryAddAssign( const LowerMatrix<MT,SO,DF>& lhs,
1237  const Vector<VT,TF>& rhs, size_t row, size_t column )
1238 {
1239  return tryAssign( lhs, ~rhs, row, column );
1240 }
1242 //*************************************************************************************************
1243 
1244 
1245 //*************************************************************************************************
1263 template< typename MT // Type of the adapted matrix
1264  , bool SO // Storage order of the adapted matrix
1265  , bool DF // Density flag
1266  , typename VT // Type of the right-hand side vector
1267  , bool TF > // Transpose flag of the right-hand side vector
1268 inline bool tryAddAssign( const LowerMatrix<MT,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1269  ptrdiff_t band, size_t row, size_t column )
1270 {
1271  return tryAssign( lhs, ~rhs, band, row, column );
1272 }
1274 //*************************************************************************************************
1275 
1276 
1277 //*************************************************************************************************
1293 template< typename MT1 // Type of the adapted matrix
1294  , bool SO1 // Storage order of the adapted matrix
1295  , bool DF // Density flag
1296  , typename MT2 // Type of the right-hand side matrix
1297  , bool SO2 > // Storage order of the right-hand side matrix
1298 inline bool tryAddAssign( const LowerMatrix<MT1,SO1,DF>& lhs,
1299  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1300 {
1301  return tryAssign( lhs, ~rhs, row, column );
1302 }
1304 //*************************************************************************************************
1305 
1306 
1307 //*************************************************************************************************
1323 template< typename MT // Type of the adapted matrix
1324  , bool SO // Storage order of the adapted matrix
1325  , bool DF // Density flag
1326  , typename VT // Type of the right-hand side vector
1327  , bool TF > // Transpose flag of the right-hand side vector
1328 inline bool trySubAssign( const LowerMatrix<MT,SO,DF>& lhs,
1329  const Vector<VT,TF>& rhs, size_t row, size_t column )
1330 {
1331  return tryAssign( lhs, ~rhs, row, column );
1332 }
1334 //*************************************************************************************************
1335 
1336 
1337 //*************************************************************************************************
1355 template< typename MT // Type of the adapted matrix
1356  , bool SO // Storage order of the adapted matrix
1357  , bool DF // Density flag
1358  , typename VT // Type of the right-hand side vector
1359  , bool TF > // Transpose flag of the right-hand side vector
1360 inline bool trySubAssign( const LowerMatrix<MT,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1361  ptrdiff_t band, size_t row, size_t column )
1362 {
1363  return tryAssign( lhs, ~rhs, band, row, column );
1364 }
1366 //*************************************************************************************************
1367 
1368 
1369 //*************************************************************************************************
1385 template< typename MT1 // Type of the adapted matrix
1386  , bool SO1 // Storage order of the adapted matrix
1387  , bool DF // Density flag
1388  , typename MT2 // Type of the right-hand side matrix
1389  , bool SO2 > // Storage order of the right-hand side matrix
1390 inline bool trySubAssign( const LowerMatrix<MT1,SO1,DF>& lhs,
1391  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1392 {
1393  return tryAssign( lhs, ~rhs, row, column );
1394 }
1396 //*************************************************************************************************
1397 
1398 
1399 //*************************************************************************************************
1416 template< typename MT // Type of the adapted matrix
1417  , bool SO // Storage order of the adapted matrix
1418  , bool DF // Density flag
1419  , typename VT // Type of the right-hand side vector
1420  , bool TF > // Transpose flag of the right-hand side vector
1421 inline bool tryBitorAssign( const LowerMatrix<MT,SO,DF>& lhs,
1422  const Vector<VT,TF>& rhs, size_t row, size_t column )
1423 {
1424  return tryAssign( lhs, ~rhs, row, column );
1425 }
1427 //*************************************************************************************************
1428 
1429 
1430 //*************************************************************************************************
1447 template< typename MT // Type of the adapted matrix
1448  , bool SO // Storage order of the adapted matrix
1449  , bool DF // Density flag
1450  , typename VT // Type of the right-hand side vector
1451  , bool TF > // Transpose flag of the right-hand side vector
1452 inline bool tryBitorAssign( const LowerMatrix<MT,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1453  ptrdiff_t band, size_t row, size_t column )
1454 {
1455  return tryAssign( lhs, ~rhs, band, row, column );
1456 }
1458 //*************************************************************************************************
1459 
1460 
1461 //*************************************************************************************************
1477 template< typename MT1 // Type of the adapted matrix
1478  , bool SO1 // Storage order of the adapted matrix
1479  , bool DF // Density flag
1480  , typename MT2 // Type of the right-hand side matrix
1481  , bool SO2 > // Storage order of the right-hand side matrix
1482 inline bool tryBitorAssign( const LowerMatrix<MT1,SO1,DF>& lhs,
1483  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1484 {
1485  return tryAssign( lhs, ~rhs, row, column );
1486 }
1488 //*************************************************************************************************
1489 
1490 
1491 //*************************************************************************************************
1508 template< typename MT // Type of the adapted matrix
1509  , bool SO // Storage order of the adapted matrix
1510  , bool DF // Density flag
1511  , typename VT // Type of the right-hand side vector
1512  , bool TF > // Transpose flag of the right-hand side vector
1513 inline bool tryBitxorAssign( const LowerMatrix<MT,SO,DF>& lhs,
1514  const Vector<VT,TF>& rhs, size_t row, size_t column )
1515 {
1516  return tryAssign( lhs, ~rhs, row, column );
1517 }
1519 //*************************************************************************************************
1520 
1521 
1522 //*************************************************************************************************
1539 template< typename MT // Type of the adapted matrix
1540  , bool SO // Storage order of the adapted matrix
1541  , bool DF // Density flag
1542  , typename VT // Type of the right-hand side vector
1543  , bool TF > // Transpose flag of the right-hand side vector
1544 inline bool tryBitxorAssign( const LowerMatrix<MT,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1545  ptrdiff_t band, size_t row, size_t column )
1546 {
1547  return tryAssign( lhs, ~rhs, band, row, column );
1548 }
1550 //*************************************************************************************************
1551 
1552 
1553 //*************************************************************************************************
1569 template< typename MT1 // Type of the adapted matrix
1570  , bool SO1 // Storage order of the adapted matrix
1571  , bool DF // Density flag
1572  , typename MT2 // Type of the right-hand side matrix
1573  , bool SO2 > // Storage order of the right-hand side matrix
1574 inline bool tryBitxorAssign( const LowerMatrix<MT1,SO1,DF>& lhs,
1575  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1576 {
1577  return tryAssign( lhs, ~rhs, row, column );
1578 }
1580 //*************************************************************************************************
1581 
1582 
1583 //*************************************************************************************************
1597 template< typename MT // Type of the adapted matrix
1598  , bool SO // Storage order of the adapted matrix
1599  , bool DF > // Density flag
1600 inline MT& derestrict( LowerMatrix<MT,SO,DF>& m )
1601 {
1602  return m.matrix_;
1603 }
1605 //*************************************************************************************************
1606 
1607 
1608 
1609 
1610 //=================================================================================================
1611 //
1612 // SIZE SPECIALIZATIONS
1613 //
1614 //=================================================================================================
1615 
1616 //*************************************************************************************************
1618 template< typename MT, bool SO, bool DF >
1619 struct Size< LowerMatrix<MT,SO,DF>, 0UL >
1620  : public Size<MT,0UL>
1621 {};
1622 
1623 template< typename MT, bool SO, bool DF >
1624 struct Size< LowerMatrix<MT,SO,DF>, 1UL >
1625  : public Size<MT,1UL>
1626 {};
1628 //*************************************************************************************************
1629 
1630 
1631 
1632 
1633 //=================================================================================================
1634 //
1635 // MAXSIZE SPECIALIZATIONS
1636 //
1637 //=================================================================================================
1638 
1639 //*************************************************************************************************
1641 template< typename MT, bool SO, bool DF >
1642 struct MaxSize< LowerMatrix<MT,SO,DF>, 0UL >
1643  : public MaxSize<MT,0UL>
1644 {};
1645 
1646 template< typename MT, bool SO, bool DF >
1647 struct MaxSize< LowerMatrix<MT,SO,DF>, 1UL >
1648  : public MaxSize<MT,1UL>
1649 {};
1651 //*************************************************************************************************
1652 
1653 
1654 
1655 
1656 //=================================================================================================
1657 //
1658 // ISSQUARE SPECIALIZATIONS
1659 //
1660 //=================================================================================================
1661 
1662 //*************************************************************************************************
1664 template< typename MT, bool SO, bool DF >
1665 struct IsSquare< LowerMatrix<MT,SO,DF> >
1666  : public TrueType
1667 {};
1669 //*************************************************************************************************
1670 
1671 
1672 
1673 
1674 //=================================================================================================
1675 //
1676 // ISUNIFORM SPECIALIZATIONS
1677 //
1678 //=================================================================================================
1679 
1680 //*************************************************************************************************
1682 template< typename MT, bool SO, bool DF >
1683 struct IsUniform< LowerMatrix<MT,SO,DF> >
1684  : public IsUniform<MT>
1685 {};
1687 //*************************************************************************************************
1688 
1689 
1690 
1691 
1692 //=================================================================================================
1693 //
1694 // ISSYMMETRIC SPECIALIZATIONS
1695 //
1696 //=================================================================================================
1697 
1698 //*************************************************************************************************
1700 template< typename MT, bool SO, bool DF >
1701 struct IsSymmetric< LowerMatrix<MT,SO,DF> >
1702  : public IsZero<MT>
1703 {};
1705 //*************************************************************************************************
1706 
1707 
1708 
1709 
1710 //=================================================================================================
1711 //
1712 // ISHERMITIAN SPECIALIZATIONS
1713 //
1714 //=================================================================================================
1715 
1716 //*************************************************************************************************
1718 template< typename MT, bool SO, bool DF >
1719 struct IsHermitian< LowerMatrix<MT,SO,DF> >
1720  : public IsZero<MT>
1721 {};
1723 //*************************************************************************************************
1724 
1725 
1726 
1727 
1728 //=================================================================================================
1729 //
1730 // ISLOWER SPECIALIZATIONS
1731 //
1732 //=================================================================================================
1733 
1734 //*************************************************************************************************
1736 template< typename MT, bool SO, bool DF >
1737 struct IsLower< LowerMatrix<MT,SO,DF> >
1738  : public TrueType
1739 {};
1741 //*************************************************************************************************
1742 
1743 
1744 
1745 
1746 //=================================================================================================
1747 //
1748 // ISSTRICTLYLOWER SPECIALIZATIONS
1749 //
1750 //=================================================================================================
1751 
1752 //*************************************************************************************************
1754 template< typename MT, bool SO, bool DF >
1755 struct IsStrictlyLower< LowerMatrix<MT,SO,DF> >
1756  : public IsZero<MT>
1757 {};
1759 //*************************************************************************************************
1760 
1761 
1762 
1763 
1764 //=================================================================================================
1765 //
1766 // ISSTRICTLYUPPER SPECIALIZATIONS
1767 //
1768 //=================================================================================================
1769 
1770 //*************************************************************************************************
1772 template< typename MT, bool SO, bool DF >
1773 struct IsStrictlyUpper< LowerMatrix<MT,SO,DF> >
1774  : public IsZero<MT>
1775 {};
1777 //*************************************************************************************************
1778 
1779 
1780 
1781 
1782 //=================================================================================================
1783 //
1784 // ISADAPTOR SPECIALIZATIONS
1785 //
1786 //=================================================================================================
1787 
1788 //*************************************************************************************************
1790 template< typename MT, bool SO, bool DF >
1791 struct IsAdaptor< LowerMatrix<MT,SO,DF> >
1792  : public TrueType
1793 {};
1795 //*************************************************************************************************
1796 
1797 
1798 
1799 
1800 //=================================================================================================
1801 //
1802 // ISRESTRICTED SPECIALIZATIONS
1803 //
1804 //=================================================================================================
1805 
1806 //*************************************************************************************************
1808 template< typename MT, bool SO, bool DF >
1809 struct IsRestricted< LowerMatrix<MT,SO,DF> >
1810  : public TrueType
1811 {};
1813 //*************************************************************************************************
1814 
1815 
1816 
1817 
1818 //=================================================================================================
1819 //
1820 // HASCONSTDATAACCESS SPECIALIZATIONS
1821 //
1822 //=================================================================================================
1823 
1824 //*************************************************************************************************
1826 template< typename MT, bool SO >
1827 struct HasConstDataAccess< LowerMatrix<MT,SO,true> >
1828  : public TrueType
1829 {};
1831 //*************************************************************************************************
1832 
1833 
1834 
1835 
1836 //=================================================================================================
1837 //
1838 // ISALIGNED SPECIALIZATIONS
1839 //
1840 //=================================================================================================
1841 
1842 //*************************************************************************************************
1844 template< typename MT, bool SO, bool DF >
1845 struct IsAligned< LowerMatrix<MT,SO,DF> >
1846  : public IsAligned<MT>
1847 {};
1849 //*************************************************************************************************
1850 
1851 
1852 
1853 
1854 //=================================================================================================
1855 //
1856 // ISCONTIGUOUS SPECIALIZATIONS
1857 //
1858 //=================================================================================================
1859 
1860 //*************************************************************************************************
1862 template< typename MT, bool SO, bool DF >
1863 struct IsContiguous< LowerMatrix<MT,SO,DF> >
1864  : public IsContiguous<MT>
1865 {};
1867 //*************************************************************************************************
1868 
1869 
1870 
1871 
1872 //=================================================================================================
1873 //
1874 // ISPADDED SPECIALIZATIONS
1875 //
1876 //=================================================================================================
1877 
1878 //*************************************************************************************************
1880 template< typename MT, bool SO, bool DF >
1881 struct IsPadded< LowerMatrix<MT,SO,DF> >
1882  : public IsPadded<MT>
1883 {};
1885 //*************************************************************************************************
1886 
1887 
1888 
1889 
1890 //=================================================================================================
1891 //
1892 // ISRESIZABLE SPECIALIZATIONS
1893 //
1894 //=================================================================================================
1895 
1896 //*************************************************************************************************
1898 template< typename MT, bool SO, bool DF >
1899 struct IsResizable< LowerMatrix<MT,SO,DF> >
1900  : public IsResizable<MT>
1901 {};
1903 //*************************************************************************************************
1904 
1905 
1906 
1907 
1908 //=================================================================================================
1909 //
1910 // ISSHRINKABLE SPECIALIZATIONS
1911 //
1912 //=================================================================================================
1913 
1914 //*************************************************************************************************
1916 template< typename MT, bool SO, bool DF >
1917 struct IsShrinkable< LowerMatrix<MT,SO,DF> >
1918  : public IsShrinkable<MT>
1919 {};
1921 //*************************************************************************************************
1922 
1923 
1924 
1925 
1926 //=================================================================================================
1927 //
1928 // REMOVEADAPTOR SPECIALIZATIONS
1929 //
1930 //=================================================================================================
1931 
1932 //*************************************************************************************************
1934 template< typename MT, bool SO, bool DF >
1935 struct RemoveAdaptor< LowerMatrix<MT,SO,DF> >
1936 {
1937  using Type = MT;
1938 };
1940 //*************************************************************************************************
1941 
1942 
1943 
1944 
1945 //=================================================================================================
1946 //
1947 // ADDTRAIT SPECIALIZATIONS
1948 //
1949 //=================================================================================================
1950 
1951 //*************************************************************************************************
1953 template< typename T1, typename T2 >
1954 struct AddTraitEval1< T1, T2
1955  , EnableIf_t< IsMatrix_v<T1> &&
1956  IsMatrix_v<T2> &&
1957  ( ( IsLower_v<T1> && IsLower_v<T2> ) ||
1958  ( IsLower_v<T1> && IsDiagonal_v<T2> ) ||
1959  ( IsDiagonal_v<T1> && IsLower_v<T2> ) ) &&
1960  !( IsUniLower_v<T1> && IsStrictlyLower_v<T2> ) &&
1961  !( IsStrictlyLower_v<T1> && ( IsUniLower_v<T2> || IsStrictlyLower_v<T2> ) ) &&
1962  !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
1963  !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1964  !( IsZero_v<T1> || IsZero_v<T2> ) > >
1965 {
1966  using Type = LowerMatrix< typename AddTraitEval2<T1,T2>::Type >;
1967 };
1969 //*************************************************************************************************
1970 
1971 
1972 
1973 
1974 //=================================================================================================
1975 //
1976 // SUBTRAIT SPECIALIZATIONS
1977 //
1978 //=================================================================================================
1979 
1980 //*************************************************************************************************
1982 template< typename T1, typename T2 >
1983 struct SubTraitEval1< T1, T2
1984  , EnableIf_t< IsMatrix_v<T1> &&
1985  IsMatrix_v<T2> &&
1986  ( ( IsLower_v<T1> && IsLower_v<T2> ) ||
1987  ( IsLower_v<T1> && IsDiagonal_v<T2> ) ||
1988  ( IsDiagonal_v<T1> && IsLower_v<T2> ) ) &&
1989  !( IsUniLower_v<T1> && IsStrictlyLower_v<T2> ) &&
1990  !( IsUniLower_v<T1> && IsUniLower_v<T2> ) &&
1991  !( IsStrictlyLower_v<T1> && IsStrictlyLower_v<T2> ) &&
1992  !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
1993  !( IsZero_v<T1> || IsZero_v<T2> ) > >
1994 {
1995  using Type = LowerMatrix< typename SubTraitEval2<T1,T2>::Type >;
1996 };
1998 //*************************************************************************************************
1999 
2000 
2001 
2002 
2003 //=================================================================================================
2004 //
2005 // SCHURTRAIT SPECIALIZATIONS
2006 //
2007 //=================================================================================================
2008 
2009 //*************************************************************************************************
2011 template< typename T1, typename T2 >
2012 struct SchurTraitEval1< T1, T2
2013  , EnableIf_t< IsMatrix_v<T1> &&
2014  IsMatrix_v<T2> &&
2015  ( ( IsLower_v<T1> && !IsUpper_v<T2> ) ||
2016  ( !IsUpper_v<T1> && IsLower_v<T2> ) ) &&
2017  !( IsUniLower_v<T1> && IsUniLower_v<T2> ) &&
2018  !( IsStrictlyLower_v<T1> || IsStrictlyLower_v<T2> ) &&
2019  !( IsDiagonal_v<T1> || IsDiagonal_v<T2> ) &&
2020  !( IsZero_v<T1> || IsZero_v<T2> ) > >
2021 {
2022  using Type = LowerMatrix< typename SchurTraitEval2<T1,T2>::Type >;
2023 };
2025 //*************************************************************************************************
2026 
2027 
2028 
2029 
2030 //=================================================================================================
2031 //
2032 // MULTTRAIT SPECIALIZATIONS
2033 //
2034 //=================================================================================================
2035 
2036 //*************************************************************************************************
2038 template< typename T1, typename T2 >
2039 struct MultTraitEval1< T1, T2
2040  , EnableIf_t< IsMatrix_v<T1> &&
2041  IsNumeric_v<T2> &&
2042  ( IsLower_v<T1> && !IsStrictlyLower_v<T1> &&
2043  !IsDiagonal_v<T1> && !IsUniform_v<T1> ) > >
2044 {
2045  using Type = LowerMatrix< typename MultTraitEval2<T1,T2>::Type >;
2046 };
2047 
2048 template< typename T1, typename T2 >
2049 struct MultTraitEval1< T1, T2
2050  , EnableIf_t< IsNumeric_v<T1> &&
2051  IsMatrix_v<T2> &&
2052  ( IsLower_v<T2> && !IsStrictlyLower_v<T2> &&
2053  !IsDiagonal_v<T2> && !IsUniform_v<T2> ) > >
2054 {
2055  using Type = LowerMatrix< typename MultTraitEval2<T1,T2>::Type >;
2056 };
2057 
2058 template< typename T1, typename T2 >
2059 struct MultTraitEval1< T1, T2
2060  , EnableIf_t< IsMatrix_v<T1> &&
2061  IsMatrix_v<T2> &&
2062  ( IsLower_v<T1> && IsLower_v<T2> ) &&
2063  !( IsUniLower_v<T1> && IsUniLower_v<T2> ) &&
2064  !( IsStrictlyLower_v<T1> && IsLower_v<T2> ) &&
2065  !( IsLower_v<T1> && IsStrictlyLower_v<T2> ) &&
2066  !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
2067  !( IsIdentity_v<T1> || IsIdentity_v<T2> ) &&
2068  !( IsZero_v<T1> || IsZero_v<T2> ) > >
2069 {
2070  using Type = LowerMatrix< typename MultTraitEval2<T1,T2>::Type >;
2071 };
2073 //*************************************************************************************************
2074 
2075 
2076 
2077 
2078 //=================================================================================================
2079 //
2080 // KRONTRAIT SPECIALIZATIONS
2081 //
2082 //=================================================================================================
2083 
2084 //*************************************************************************************************
2086 template< typename T1, typename T2 >
2087 struct KronTraitEval1< T1, T2
2088  , EnableIf_t< IsMatrix_v<T1> &&
2089  IsMatrix_v<T2> &&
2090  ( IsLower_v<T1> && IsLower_v<T2> ) &&
2091  !( IsUniLower_v<T1> && IsUniLower_v<T2> ) &&
2092  !( IsStrictlyLower_v<T1> || IsStrictlyLower_v<T2> ) &&
2093  !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
2094  !( IsZero_v<T1> || IsZero_v<T2> ) > >
2095 {
2096  using Type = LowerMatrix< typename KronTraitEval2<T1,T2>::Type >;
2097 };
2099 //*************************************************************************************************
2100 
2101 
2102 
2103 
2104 //=================================================================================================
2105 //
2106 // DIVTRAIT SPECIALIZATIONS
2107 //
2108 //=================================================================================================
2109 
2110 //*************************************************************************************************
2112 template< typename T1, typename T2 >
2113 struct DivTraitEval1< T1, T2
2114  , EnableIf_t< IsLower_v<T1> &&
2115  !IsStrictlyLower_v<T1> &&
2116  !IsDiagonal_v<T1> &&
2117  IsNumeric_v<T2> > >
2118 {
2119  using Type = LowerMatrix< typename DivTraitEval2<T1,T2>::Type >;
2120 };
2122 //*************************************************************************************************
2123 
2124 
2125 
2126 
2127 //=================================================================================================
2128 //
2129 // MAPTRAIT SPECIALIZATIONS
2130 //
2131 //=================================================================================================
2132 
2133 //*************************************************************************************************
2135 template< typename T, typename OP >
2136 struct UnaryMapTraitEval1< T, OP
2137  , EnableIf_t< YieldsLower_v<OP,T> &&
2138  !YieldsUniLower_v<OP,T> &&
2139  !YieldsStrictlyLower_v<OP,T> &&
2140  !YieldsDiagonal_v<OP,T> > >
2141 {
2142  using Type = LowerMatrix< typename UnaryMapTraitEval2<T,OP>::Type, StorageOrder_v<T> >;
2143 };
2145 //*************************************************************************************************
2146 
2147 
2148 //*************************************************************************************************
2150 template< typename T1, typename T2, typename OP >
2151 struct BinaryMapTraitEval1< T1, T2, OP
2152  , EnableIf_t< YieldsLower_v<OP,T1,T2> &&
2153  !YieldsUniLower_v<OP,T1,T2> &&
2154  !YieldsStrictlyLower_v<OP,T1,T2> &&
2155  !YieldsDiagonal_v<OP,T1,T2> > >
2156 {
2157  using Type = LowerMatrix< typename BinaryMapTraitEval2<T1,T2,OP>::Type >;
2158 };
2160 //*************************************************************************************************
2161 
2162 
2163 
2164 
2165 //=================================================================================================
2166 //
2167 // DECLSYMTRAIT SPECIALIZATIONS
2168 //
2169 //=================================================================================================
2170 
2171 //*************************************************************************************************
2173 template< typename MT, bool SO, bool DF >
2174 struct DeclSymTrait< LowerMatrix<MT,SO,DF> >
2175 {
2176  using Type = DiagonalMatrix<MT>;
2177 };
2179 //*************************************************************************************************
2180 
2181 
2182 
2183 
2184 //=================================================================================================
2185 //
2186 // DECLHERMTRAIT SPECIALIZATIONS
2187 //
2188 //=================================================================================================
2189 
2190 //*************************************************************************************************
2192 template< typename MT, bool SO, bool DF >
2193 struct DeclHermTrait< LowerMatrix<MT,SO,DF> >
2194 {
2195  using Type = HermitianMatrix<MT>;
2196 };
2198 //*************************************************************************************************
2199 
2200 
2201 
2202 
2203 //=================================================================================================
2204 //
2205 // DECLLOWTRAIT SPECIALIZATIONS
2206 //
2207 //=================================================================================================
2208 
2209 //*************************************************************************************************
2211 template< typename MT, bool SO, bool DF >
2212 struct DeclLowTrait< LowerMatrix<MT,SO,DF> >
2213 {
2214  using Type = LowerMatrix<MT,SO,DF>;
2215 };
2217 //*************************************************************************************************
2218 
2219 
2220 
2221 
2222 //=================================================================================================
2223 //
2224 // DECLUPPTRAIT SPECIALIZATIONS
2225 //
2226 //=================================================================================================
2227 
2228 //*************************************************************************************************
2230 template< typename MT, bool SO, bool DF >
2231 struct DeclUppTrait< LowerMatrix<MT,SO,DF> >
2232 {
2233  using Type = DiagonalMatrix<MT,SO,DF>;
2234 };
2236 //*************************************************************************************************
2237 
2238 
2239 
2240 
2241 //=================================================================================================
2242 //
2243 // DECLDIAGTRAIT SPECIALIZATIONS
2244 //
2245 //=================================================================================================
2246 
2247 //*************************************************************************************************
2249 template< typename MT, bool SO, bool DF >
2250 struct DeclDiagTrait< LowerMatrix<MT,SO,DF> >
2251 {
2252  using Type = DiagonalMatrix<MT,SO,DF>;
2253 };
2255 //*************************************************************************************************
2256 
2257 
2258 
2259 
2260 //=================================================================================================
2261 //
2262 // HIGHTYPE SPECIALIZATIONS
2263 //
2264 //=================================================================================================
2265 
2266 //*************************************************************************************************
2268 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2269 struct HighType< LowerMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
2270 {
2271  using Type = LowerMatrix< typename HighType<MT1,MT2>::Type >;
2272 };
2274 //*************************************************************************************************
2275 
2276 
2277 
2278 
2279 //=================================================================================================
2280 //
2281 // LOWTYPE SPECIALIZATIONS
2282 //
2283 //=================================================================================================
2284 
2285 //*************************************************************************************************
2287 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2288 struct LowType< LowerMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
2289 {
2290  using Type = LowerMatrix< typename LowType<MT1,MT2>::Type >;
2291 };
2293 //*************************************************************************************************
2294 
2295 
2296 
2297 
2298 //=================================================================================================
2299 //
2300 // SUBMATRIXTRAIT SPECIALIZATIONS
2301 //
2302 //=================================================================================================
2303 
2304 //*************************************************************************************************
2306 template< typename MT, size_t I, size_t N >
2307 struct SubmatrixTraitEval1< MT, I, I, N, N
2308  , EnableIf_t< IsLower_v<MT> &&
2309  !IsUniLower_v<MT> &&
2310  !IsStrictlyLower_v<MT> &&
2311  !IsDiagonal_v<MT> > >
2312 {
2313  using Type = LowerMatrix< typename SubmatrixTraitEval2<MT,I,I,N,N>::Type >;
2314 };
2316 //*************************************************************************************************
2317 
2318 } // namespace blaze
2319 
2320 #endif
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Headerfile for the generic min algorithm.
Header file for the decldiag trait.
Header file for the Schur product trait.
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.The IsMatrix_v variable template provides a c...
Definition: IsMatrix.h:138
Header file for the subtraction trait.
Flag for the inversion of a diagonal matrix.
Definition: InversionFlag.h:115
Flag for the inversion of a general matrix (same as byLU).
Definition: InversionFlag.h:108
Header file for the declherm trait.
Flag for the inversion of a upper unitriangular matrix.
Definition: InversionFlag.h:114
Flag for the inversion of a lower unitriangular matrix.
Definition: InversionFlag.h:112
Header file for the YieldsStrictlyLower type trait.
Header file for the IsDiagonal type trait.
Matrix adapter for lower triangular matrices.
Definition: BaseTemplate.h:553
Header file for the dense matrix inversion flags.
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
Header file for the MAYBE_UNUSED function template.
Header file for the IsIdentity type trait.
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: IntegralConstant.h:132
Header file for all forward declarations of the math module.
constexpr bool IsLower_v
Auxiliary variable template for the IsLower type trait.The IsLower_v variable template provides a con...
Definition: IsLower.h:175
Constraint on the data type.
Header file for the IsUniLower type trait.
Header file for the MaxSize type trait.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is an identity matrix.
Definition: DenseMatrix.h:2433
Constraint on the data type.
Header file for the IsMatrix type trait.
Header file for the IsSquare type trait.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:779
Constraint on the data type.
Header file for the LowType type trait.
Flag for the inversion of a lower triangular matrix.
Definition: InversionFlag.h:111
Header file for the IsUniform type trait.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Flag for the LU-based matrix inversion.
Definition: InversionFlag.h:103
Header file for the IsShrinkable type trait.
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:1162
Header file for the YieldsUniLower type trait.
Header file for the decllow trait.
void lu(const DenseMatrix< MT1, SO1 > &A, DenseMatrix< MT2, SO1 > &L, DenseMatrix< MT3, SO1 > &U, Matrix< MT4, SO2 > &P)
LU decomposition of the given dense matrix.
Definition: LU.h:222
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.The IsNumeric_v variable template provides a...
Definition: IsNumeric.h:143
Header file for the IsLower type trait.
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the IsAligned type trait.
Header file for the Kron product trait.
constexpr bool YieldsLower_v
Auxiliary variable template for the YieldsLower type trait.The YieldsLower_v variable template provid...
Definition: YieldsLower.h:126
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type,...
Definition: Upper.h:81
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:438
Header file for the RemoveAdaptor type trait.
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:615
Header file for the IsPadded type trait.
Header file for the IsAdaptor type trait.
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:137
Constraint on the data type.
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
Header file for the declupp trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type,...
Definition: Symmetric.h:79
Header file for run time assertion macros.
Header file for the addition trait.
Header file for the division trait.
Header file for the submatrix trait.
Constraint on the data type.
Header file for the IsContiguous type trait.
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
Header file for the IsZero type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type,...
Definition: Lower.h:81
Header file for the declsym trait.
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:282
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a BLAS compatible data type (i....
Definition: BLASCompatible.h:61
Header file for the YieldsLower type trait.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
Header file for the YieldsDiagonal type trait.
Header file for the implementation of the base template of the LowerMatrix.
LowerMatrix specialization for sparse matrices.
Header file for the isDivisor shim.
Header file for the StorageOrder type trait.
Header file for the IntegralConstant class template.
Header file for the map trait.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type,...
Definition: Hermitian.h:79
Header file for the IsUpper type trait.
Header file for the IsHermitian type trait.
Header file for the IsResizable type trait.
Header file for the IsRestricted type trait.
Header file for the Size type trait.
InversionFlag
Inversion flag.The InversionFlag type enumeration represents the different types of matrix inversion ...
Definition: InversionFlag.h:101
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
LowerMatrix specialization for dense matrices.
Header file for the HighType type trait.