StrictlyLowerMatrix.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_STRICTLYLOWERMATRIX_H_
36 #define _BLAZE_MATH_ADAPTORS_STRICTLYLOWERMATRIX_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
47 #include <blaze/math/Forward.h>
91 #include <blaze/util/Assert.h>
92 #include <blaze/util/EnableIf.h>
93 #include <blaze/util/TrueType.h>
95 #include <blaze/util/Unused.h>
96 
97 
98 namespace blaze {
99 
100 //=================================================================================================
101 //
102 // STRICTLYLOWERMATRIX OPERATORS
103 //
104 //=================================================================================================
105 
106 //*************************************************************************************************
109 template< typename MT, bool SO, bool DF >
110 void reset( StrictlyLowerMatrix<MT,SO,DF>& m );
111 
112 template< typename MT, bool SO, bool DF >
113 void reset( StrictlyLowerMatrix<MT,SO,DF>& m, size_t i );
114 
115 template< typename MT, bool SO, bool DF >
116 void clear( StrictlyLowerMatrix<MT,SO,DF>& m );
117 
118 template< bool RF, typename MT, bool SO, bool DF >
119 bool isDefault( const StrictlyLowerMatrix<MT,SO,DF>& m );
120 
121 template< typename MT, bool SO, bool DF >
122 bool isIntact( const StrictlyLowerMatrix<MT,SO,DF>& m );
123 
124 template< typename MT, bool SO, bool DF >
125 void swap( StrictlyLowerMatrix<MT,SO,DF>& a, StrictlyLowerMatrix<MT,SO,DF>& b ) noexcept;
127 //*************************************************************************************************
128 
129 
130 //*************************************************************************************************
137 template< typename MT // Type of the adapted matrix
138  , bool SO // Storage order of the adapted matrix
139  , bool DF > // Density flag
141 {
142  m.reset();
143 }
144 //*************************************************************************************************
145 
146 
147 //*************************************************************************************************
160 template< typename MT // Type of the adapted matrix
161  , bool SO // Storage order of the adapted matrix
162  , bool DF > // Density flag
163 inline void reset( StrictlyLowerMatrix<MT,SO,DF>& m, size_t i )
164 {
165  m.reset( i );
166 }
167 //*************************************************************************************************
168 
169 
170 //*************************************************************************************************
177 template< typename MT // Type of the adapted matrix
178  , bool SO // Storage order of the adapted matrix
179  , bool DF > // Density flag
181 {
182  m.clear();
183 }
184 //*************************************************************************************************
185 
186 
187 //*************************************************************************************************
198 template< bool RF // Relaxation flag
199  , typename MT // Type of the adapted matrix
200  , bool SO // Storage order of the adapted matrix
201  , bool DF > // Density flag
202 inline bool isDefault_backend( const StrictlyLowerMatrix<MT,SO,DF>& m, TrueType )
203 {
204  return ( m.rows() == 0UL );
205 }
207 //*************************************************************************************************
208 
209 
210 //*************************************************************************************************
221 template< bool RF // Relaxation flag
222  , typename MT // Type of the adapted matrix
223  , bool SO // Storage order of the adapted matrix
224  , bool DF > // Density flag
225 inline bool isDefault_backend( const StrictlyLowerMatrix<MT,SO,DF>& m, FalseType )
226 {
227  if( SO ) {
228  for( size_t j=0UL; j<m.columns(); ++j ) {
229  for( size_t i=j+1UL; i<m.rows(); ++i ) {
230  if( !isDefault<RF>( m(i,j) ) )
231  return false;
232  }
233  }
234  }
235  else {
236  for( size_t i=1UL; i<m.rows(); ++i ) {
237  for( size_t j=0UL; j<i; ++j ) {
238  if( !isDefault<RF>( m(i,j) ) )
239  return false;
240  }
241  }
242  }
243 
244  return true;
245 }
247 //*************************************************************************************************
248 
249 
250 //*************************************************************************************************
276 template< bool RF // Relaxation flag
277  , typename MT // Type of the adapted matrix
278  , bool SO // Storage order of the adapted matrix
279  , bool DF > // Density flag
281 {
282  return isDefault_backend<RF>( m, typename IsResizable<MT>::Type() );
283 }
284 //*************************************************************************************************
285 
286 
287 //*************************************************************************************************
308 template< typename MT // Type of the adapted matrix
309  , bool SO // Storage order of the adapted matrix
310  , bool DF > // Density flag
312 {
313  return m.isIntact();
314 }
315 //*************************************************************************************************
316 
317 
318 //*************************************************************************************************
326 template< typename MT // Type of the adapted matrix
327  , bool SO // Storage order of the adapted matrix
328  , bool DF > // Density flag
330 {
331  a.swap( b );
332 }
333 //*************************************************************************************************
334 
335 
336 //*************************************************************************************************
352 template< typename MT // Type of the adapted matrix
353  , bool SO // Storage order of the adapted matrix
354  , bool DF // Density flag
355  , typename ET > // Type of the element
356 inline bool trySet( const StrictlyLowerMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
357 {
358  BLAZE_INTERNAL_ASSERT( i < (~mat).rows(), "Invalid row access index" );
359  BLAZE_INTERNAL_ASSERT( j < (~mat).columns(), "Invalid column access index" );
360 
361  UNUSED_PARAMETER( mat );
362 
363  return ( i > j || isDefault( value ) );
364 }
366 //*************************************************************************************************
367 
368 
369 //*************************************************************************************************
385 template< typename MT // Type of the adapted matrix
386  , bool SO // Storage order of the adapted matrix
387  , bool DF // Density flag
388  , typename ET > // Type of the element
389 inline bool tryAdd( const StrictlyLowerMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
390 {
391  return trySet( mat, i, j, value );
392 }
394 //*************************************************************************************************
395 
396 
397 //*************************************************************************************************
413 template< typename MT // Type of the adapted matrix
414  , bool SO // Storage order of the adapted matrix
415  , bool DF // Density flag
416  , typename ET > // Type of the element
417 inline bool trySub( const StrictlyLowerMatrix<MT,SO,DF>& mat, size_t i, size_t j, const ET& value )
418 {
419  return trySet( mat, i, j, value );
420 }
422 //*************************************************************************************************
423 
424 
425 //*************************************************************************************************
442 template< typename MT // Type of the adapted matrix
443  , bool SO // Storage order of the adapted matrix
444  , bool DF // Density flag
445  , typename VT > // Type of the right-hand side dense vector
446 inline bool tryAssign( const StrictlyLowerMatrix<MT,SO,DF>& lhs,
447  const DenseVector<VT,false>& rhs, size_t row, size_t column )
448 {
450 
451  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
452  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
453  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
454 
455  UNUSED_PARAMETER( lhs );
456 
457  if( column < row )
458  return true;
459 
460  const size_t iend( min( column - row + 1UL, (~rhs).size() ) );
461 
462  for( size_t i=0UL; i<iend; ++i ) {
463  if( !isDefault( (~rhs)[i] ) )
464  return false;
465  }
466 
467  return true;
468 }
470 //*************************************************************************************************
471 
472 
473 //*************************************************************************************************
490 template< typename MT // Type of the adapted matrix
491  , bool SO // Storage order of the adapted matrix
492  , bool DF // Density flag
493  , typename VT > // Type of the right-hand side dense vector
494 inline bool tryAssign( const StrictlyLowerMatrix<MT,SO,DF>& lhs,
495  const DenseVector<VT,true>& rhs, size_t row, size_t column )
496 {
498 
499  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
500  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
501  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
502 
503  UNUSED_PARAMETER( lhs );
504 
505  const size_t ibegin( ( row <= column )?( 0UL ):( row - column ) );
506 
507  for( size_t i=ibegin; i<(~rhs).size(); ++i ) {
508  if( !isDefault( (~rhs)[i] ) )
509  return false;
510  }
511 
512  return true;
513 }
515 //*************************************************************************************************
516 
517 
518 //*************************************************************************************************
536 template< typename MT // Type of the adapted matrix
537  , bool SO // Storage order of the adapted matrix
538  , bool DF // Density flag
539  , typename VT // Type of the right-hand side dense vector
540  , bool TF > // Transpose flag of the right-hand side dense vector
541 inline bool tryAssign( const StrictlyLowerMatrix<MT,SO,DF>& lhs, const DenseVector<VT,TF>& rhs,
542  ptrdiff_t band, size_t row, size_t column )
543 {
545 
546  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
547  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
548  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
549  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
550 
551  UNUSED_PARAMETER( lhs, row, column );
552 
553  if( band >= 0L ) {
554  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
555  if( !isDefault( (~rhs)[i] ) )
556  return false;
557  }
558  }
559 
560  return true;
561 }
563 //*************************************************************************************************
564 
565 
566 //*************************************************************************************************
583 template< typename MT // Type of the adapted matrix
584  , bool SO // Storage order of the adapted matrix
585  , bool DF // Density flag
586  , typename VT > // Type of the right-hand side sparse vector
587 inline bool tryAssign( const StrictlyLowerMatrix<MT,SO,DF>& lhs,
588  const SparseVector<VT,false>& rhs, size_t row, size_t column )
589 {
591 
592  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
593  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
594  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
595 
596  UNUSED_PARAMETER( lhs );
597 
598  if( column < row )
599  return true;
600 
601  const auto last( (~rhs).lowerBound( column - row + 1UL ) );
602 
603  for( auto element=(~rhs).begin(); element!=last; ++element ) {
604  if( !isDefault( element->value() ) )
605  return false;
606  }
607 
608  return true;
609 }
611 //*************************************************************************************************
612 
613 
614 //*************************************************************************************************
631 template< typename MT // Type of the adapted matrix
632  , bool SO // Storage order of the adapted matrix
633  , bool DF // Density flag
634  , typename VT > // Type of the right-hand side sparse vector
635 inline bool tryAssign( const StrictlyLowerMatrix<MT,SO,DF>& lhs,
636  const SparseVector<VT,true>& rhs, size_t row, size_t column )
637 {
639 
640  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
641  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
642  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
643 
644  UNUSED_PARAMETER( lhs );
645 
646  const auto last( (~rhs).end() );
647  auto element( (~rhs).lowerBound( ( row <= column )?( 0UL ):( row - column ) ) );
648 
649  for( ; element!=last; ++element ) {
650  if( !isDefault( element->value() ) )
651  return false;
652  }
653 
654  return true;
655 }
657 //*************************************************************************************************
658 
659 
660 //*************************************************************************************************
678 template< typename MT // Type of the adapted matrix
679  , bool SO // Storage order of the adapted matrix
680  , bool DF // Density flag
681  , typename VT // Type of the right-hand side sparse vector
682  , bool TF > // Transpose flag of the right-hand side sparse vector
683 inline bool tryAssign( const StrictlyLowerMatrix<MT,SO,DF>& lhs, const SparseVector<VT,TF>& rhs,
684  ptrdiff_t band, size_t row, size_t column )
685 {
687 
688  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
689  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
690  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
691  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
692 
693  UNUSED_PARAMETER( lhs, row, column );
694 
695  if( band >= 0L ) {
696  for( const auto& element : ~rhs ) {
697  if( !isDefault( element.value() ) )
698  return false;
699  }
700  }
701 
702  return true;
703 }
705 //*************************************************************************************************
706 
707 
708 //*************************************************************************************************
725 template< typename MT1 // Type of the adapted matrix
726  , bool SO // Storage order of the adapted matrix
727  , bool DF // Density flag
728  , typename MT2 > // Type of the right-hand side dense matrix
729 inline bool tryAssign( const StrictlyLowerMatrix<MT1,SO,DF>& lhs,
730  const DenseMatrix<MT2,false>& rhs, size_t row, size_t column )
731 {
733 
734  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
735  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
736  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
737  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
738 
739  UNUSED_PARAMETER( lhs );
740 
741  const size_t M( (~rhs).rows() );
742  const size_t N( (~rhs).columns() );
743 
744  if( row >= column + N )
745  return true;
746 
747  const size_t iend( min( column + N - row, M ) );
748 
749  for( size_t i=0UL; i<iend; ++i )
750  {
751  const bool containsDiagonal( row + i >= column );
752  const size_t jbegin( ( containsDiagonal )?( row + i - column ):( 0UL ) );
753 
754  for( size_t j=jbegin; j<N; ++j ) {
755  if( !isDefault( (~rhs)(i,j) ) )
756  return false;
757  }
758  }
759 
760  return true;
761 }
763 //*************************************************************************************************
764 
765 
766 //*************************************************************************************************
783 template< typename MT1 // Type of the adapted matrix
784  , bool SO // Storage order of the adapted matrix
785  , bool DF // Density flag
786  , typename MT2 > // Type of the right-hand side dense matrix
787 inline bool tryAssign( const StrictlyLowerMatrix<MT1,SO,DF>& lhs,
788  const DenseMatrix<MT2,true>& rhs, size_t row, size_t column )
789 {
791 
792  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
793  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
794  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
795  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
796 
797  UNUSED_PARAMETER( lhs );
798 
799  const size_t M( (~rhs).rows() );
800  const size_t N( (~rhs).columns() );
801 
802  if( row >= column + N )
803  return true;
804 
805  const size_t jbegin( ( row <= column )?( 0UL ):( row - column ) );
806 
807  for( size_t j=jbegin; j<N; ++j )
808  {
809  const size_t iend( min( column + j - row + 1UL, M ) );
810 
811  for( size_t i=0UL; i<iend; ++i ) {
812  if( !isDefault( (~rhs)(i,j) ) )
813  return false;
814  }
815  }
816 
817  return true;
818 }
820 //*************************************************************************************************
821 
822 
823 //*************************************************************************************************
840 template< typename MT1 // Type of the adapted matrix
841  , bool SO // Storage order of the adapted matrix
842  , bool DF // Density flag
843  , typename MT2 > // Type of the right-hand side sparse matrix
844 inline bool tryAssign( const StrictlyLowerMatrix<MT1,SO,DF>& lhs,
845  const SparseMatrix<MT2,false>& rhs, size_t row, size_t column )
846 {
848 
849  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
850  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
851  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
852  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
853 
854  UNUSED_PARAMETER( lhs );
855 
856  const size_t M( (~rhs).rows() );
857  const size_t N( (~rhs).columns() );
858 
859  if( row >= column + N )
860  return true;
861 
862  const size_t iend( min( column + N - row, M ) );
863 
864  for( size_t i=0UL; i<iend; ++i )
865  {
866  const bool containsDiagonal( row + i >= column );
867  const size_t index( ( containsDiagonal )?( row + i - column ):( 0UL ) );
868 
869  const auto last( (~rhs).end(i) );
870  auto element( (~rhs).lowerBound( i, index ) );
871 
872  for( ; element!=last; ++element ) {
873  if( !isDefault( element->value() ) )
874  return false;
875  }
876  }
877 
878  return true;
879 }
881 //*************************************************************************************************
882 
883 
884 //*************************************************************************************************
901 template< typename MT1 // Type of the adapted matrix
902  , bool SO // Storage order of the adapted matrix
903  , bool DF // Density flag
904  , typename MT2 > // Type of the right-hand side sparse matrix
905 inline bool tryAssign( const StrictlyLowerMatrix<MT1,SO,DF>& lhs,
906  const SparseMatrix<MT2,true>& rhs, size_t row, size_t column )
907 {
909 
910  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
911  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
912  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
913  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
914 
915  UNUSED_PARAMETER( lhs );
916 
917  const size_t M( (~rhs).rows() );
918  const size_t N( (~rhs).columns() );
919 
920  if( row >= column + N )
921  return true;
922 
923  const size_t jbegin( ( row < column )?( 0UL ):( row - column ) );
924 
925  for( size_t j=jbegin; j<N; ++j )
926  {
927  const size_t index( column + j - row + 1UL );
928  const auto last( (~rhs).lowerBound( min( index, M ), j ) );
929 
930  for( auto element=(~rhs).begin(j); element!=last; ++element ) {
931  if( !isDefault( element->value() ) )
932  return false;
933  }
934  }
935 
936  return true;
937 }
939 //*************************************************************************************************
940 
941 
942 //*************************************************************************************************
959 template< typename MT // Type of the adapted matrix
960  , bool SO // Storage order of the adapted matrix
961  , bool DF // Density flag
962  , typename VT // Type of the right-hand side vector
963  , bool TF > // Transpose flag of the right-hand side vector
964 inline bool tryAddAssign( const StrictlyLowerMatrix<MT,SO,DF>& lhs,
965  const Vector<VT,TF>& rhs, size_t row, size_t column )
966 {
967  return tryAssign( lhs, ~rhs, row, column );
968 }
970 //*************************************************************************************************
971 
972 
973 //*************************************************************************************************
991 template< typename MT // Type of the adapted matrix
992  , bool SO // Storage order of the adapted matrix
993  , bool DF // Density flag
994  , typename VT // Type of the right-hand side vector
995  , bool TF > // Transpose flag of the right-hand side vector
996 inline bool tryAddAssign( const StrictlyLowerMatrix<MT,SO,DF>& lhs, const Vector<VT,TF>& rhs,
997  ptrdiff_t band, size_t row, size_t column )
998 {
999  return tryAssign( lhs, ~rhs, band, row, column );
1000 }
1002 //*************************************************************************************************
1003 
1004 
1005 //*************************************************************************************************
1022 template< typename MT1 // Type of the adapted matrix
1023  , bool SO1 // Storage order of the adapted matrix
1024  , bool DF // Density flag
1025  , typename MT2 // Type of the right-hand side matrix
1026  , bool SO2 > // Storage order of the right-hand side matrix
1027 inline bool tryAddAssign( const StrictlyLowerMatrix<MT1,SO1,DF>& lhs,
1028  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1029 {
1030  return tryAssign( lhs, ~rhs, row, column );
1031 }
1033 //*************************************************************************************************
1034 
1035 
1036 //*************************************************************************************************
1053 template< typename MT // Type of the adapted matrix
1054  , bool SO // Storage order of the adapted matrix
1055  , bool DF // Density flag
1056  , typename VT // Type of the right-hand side vector
1057  , bool TF > // Transpose flag of the right-hand side vector
1058 inline bool trySubAssign( const StrictlyLowerMatrix<MT,SO,DF>& lhs,
1059  const Vector<VT,TF>& rhs, size_t row, size_t column )
1060 {
1061  return tryAssign( lhs, ~rhs, row, column );
1062 }
1064 //*************************************************************************************************
1065 
1066 
1067 //*************************************************************************************************
1085 template< typename MT // Type of the adapted matrix
1086  , bool SO // Storage order of the adapted matrix
1087  , bool DF // Density flag
1088  , typename VT // Type of the right-hand side vector
1089  , bool TF > // Transpose flag of the right-hand side vector
1090 inline bool trySubAssign( const StrictlyLowerMatrix<MT,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1091  ptrdiff_t band, size_t row, size_t column )
1092 {
1093  return tryAssign( lhs, ~rhs, band, row, column );
1094 }
1096 //*************************************************************************************************
1097 
1098 
1099 //*************************************************************************************************
1116 template< typename MT1 // Type of the adapted matrix
1117  , bool SO1 // Storage order of the adapted matrix
1118  , bool DF // Density flag
1119  , typename MT2 // Type of the right-hand side matrix
1120  , bool SO2 > // Storage order of the right-hand side matrix
1121 inline bool trySubAssign( const StrictlyLowerMatrix<MT1,SO1,DF>& lhs,
1122  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1123 {
1124  return tryAssign( lhs, ~rhs, row, column );
1125 }
1127 //*************************************************************************************************
1128 
1129 
1130 //*************************************************************************************************
1144 template< typename MT // Type of the adapted matrix
1145  , bool SO // Storage order of the adapted matrix
1146  , bool DF > // Density flag
1147 inline MT& derestrict( StrictlyLowerMatrix<MT,SO,DF>& m )
1148 {
1149  return m.matrix_;
1150 }
1152 //*************************************************************************************************
1153 
1154 
1155 
1156 
1157 //=================================================================================================
1158 //
1159 // SIZE SPECIALIZATIONS
1160 //
1161 //=================================================================================================
1162 
1163 //*************************************************************************************************
1165 template< typename MT, bool SO, bool DF >
1166 struct Size< StrictlyLowerMatrix<MT,SO,DF>, 0UL >
1167  : public Size<MT,0UL>
1168 {};
1169 
1170 template< typename MT, bool SO, bool DF >
1171 struct Size< StrictlyLowerMatrix<MT,SO,DF>, 1UL >
1172  : public Size<MT,1UL>
1173 {};
1175 //*************************************************************************************************
1176 
1177 
1178 
1179 
1180 //=================================================================================================
1181 //
1182 // MAXSIZE SPECIALIZATIONS
1183 //
1184 //=================================================================================================
1185 
1186 //*************************************************************************************************
1188 template< typename MT, bool SO, bool DF >
1189 struct MaxSize< StrictlyLowerMatrix<MT,SO,DF>, 0UL >
1190  : public MaxSize<MT,0UL>
1191 {};
1192 
1193 template< typename MT, bool SO, bool DF >
1194 struct MaxSize< StrictlyLowerMatrix<MT,SO,DF>, 1UL >
1195  : public MaxSize<MT,1UL>
1196 {};
1198 //*************************************************************************************************
1199 
1200 
1201 
1202 
1203 //=================================================================================================
1204 //
1205 // ISSQUARE SPECIALIZATIONS
1206 //
1207 //=================================================================================================
1208 
1209 //*************************************************************************************************
1211 template< typename MT, bool SO, bool DF >
1212 struct IsSquare< StrictlyLowerMatrix<MT,SO,DF> >
1213  : public TrueType
1214 {};
1216 //*************************************************************************************************
1217 
1218 
1219 
1220 
1221 //=================================================================================================
1222 //
1223 // ISUNIFORM SPECIALIZATIONS
1224 //
1225 //=================================================================================================
1226 
1227 //*************************************************************************************************
1229 template< typename MT, bool SO, bool DF >
1230 struct IsUniform< StrictlyLowerMatrix<MT,SO,DF> >
1231  : public IsUniform<MT>
1232 {};
1234 //*************************************************************************************************
1235 
1236 
1237 
1238 
1239 //=================================================================================================
1240 //
1241 // ISSYMMETRIC SPECIALIZATIONS
1242 //
1243 //=================================================================================================
1244 
1245 //*************************************************************************************************
1247 template< typename MT, bool SO, bool DF >
1248 struct IsSymmetric< StrictlyLowerMatrix<MT,SO,DF> >
1249  : public IsUniform<MT>
1250 {};
1252 //*************************************************************************************************
1253 
1254 
1255 
1256 
1257 //=================================================================================================
1258 //
1259 // ISHERMITIAN SPECIALIZATIONS
1260 //
1261 //=================================================================================================
1262 
1263 //*************************************************************************************************
1265 template< typename MT, bool SO, bool DF >
1266 struct IsHermitian< StrictlyLowerMatrix<MT,SO,DF> >
1267  : public IsUniform<MT>
1268 {};
1270 //*************************************************************************************************
1271 
1272 
1273 
1274 
1275 //=================================================================================================
1276 //
1277 // ISSTRICTLYLOWER SPECIALIZATIONS
1278 //
1279 //=================================================================================================
1280 
1281 //*************************************************************************************************
1283 template< typename MT, bool SO, bool DF >
1284 struct IsStrictlyLower< StrictlyLowerMatrix<MT,SO,DF> >
1285  : public TrueType
1286 {};
1288 //*************************************************************************************************
1289 
1290 
1291 
1292 
1293 //=================================================================================================
1294 //
1295 // ISSTRICTLYUPPER SPECIALIZATIONS
1296 //
1297 //=================================================================================================
1298 
1299 //*************************************************************************************************
1301 template< typename MT, bool SO, bool DF >
1302 struct IsStrictlyUpper< StrictlyLowerMatrix<MT,SO,DF> >
1303  : public IsUniform<MT>
1304 {};
1306 //*************************************************************************************************
1307 
1308 
1309 
1310 
1311 //=================================================================================================
1312 //
1313 // ISADAPTOR SPECIALIZATIONS
1314 //
1315 //=================================================================================================
1316 
1317 //*************************************************************************************************
1319 template< typename MT, bool SO, bool DF >
1320 struct IsAdaptor< StrictlyLowerMatrix<MT,SO,DF> >
1321  : public TrueType
1322 {};
1324 //*************************************************************************************************
1325 
1326 
1327 
1328 
1329 //=================================================================================================
1330 //
1331 // ISRESTRICTED SPECIALIZATIONS
1332 //
1333 //=================================================================================================
1334 
1335 //*************************************************************************************************
1337 template< typename MT, bool SO, bool DF >
1338 struct IsRestricted< StrictlyLowerMatrix<MT,SO,DF> >
1339  : public TrueType
1340 {};
1342 //*************************************************************************************************
1343 
1344 
1345 
1346 
1347 //=================================================================================================
1348 //
1349 // HASCONSTDATAACCESS SPECIALIZATIONS
1350 //
1351 //=================================================================================================
1352 
1353 //*************************************************************************************************
1355 template< typename MT, bool SO >
1356 struct HasConstDataAccess< StrictlyLowerMatrix<MT,SO,true> >
1357  : public TrueType
1358 {};
1360 //*************************************************************************************************
1361 
1362 
1363 
1364 
1365 //=================================================================================================
1366 //
1367 // ISALIGNED SPECIALIZATIONS
1368 //
1369 //=================================================================================================
1370 
1371 //*************************************************************************************************
1373 template< typename MT, bool SO, bool DF >
1374 struct IsAligned< StrictlyLowerMatrix<MT,SO,DF> >
1375  : public IsAligned<MT>
1376 {};
1378 //*************************************************************************************************
1379 
1380 
1381 
1382 
1383 //=================================================================================================
1384 //
1385 // ISCONTIGUOUS SPECIALIZATIONS
1386 //
1387 //=================================================================================================
1388 
1389 //*************************************************************************************************
1391 template< typename MT, bool SO, bool DF >
1392 struct IsContiguous< StrictlyLowerMatrix<MT,SO,DF> >
1393  : public IsContiguous<MT>
1394 {};
1396 //*************************************************************************************************
1397 
1398 
1399 
1400 
1401 //=================================================================================================
1402 //
1403 // ISPADDED SPECIALIZATIONS
1404 //
1405 //=================================================================================================
1406 
1407 //*************************************************************************************************
1409 template< typename MT, bool SO, bool DF >
1410 struct IsPadded< StrictlyLowerMatrix<MT,SO,DF> >
1411  : public IsPadded<MT>
1412 {};
1414 //*************************************************************************************************
1415 
1416 
1417 
1418 
1419 //=================================================================================================
1420 //
1421 // ISRESIZABLE SPECIALIZATIONS
1422 //
1423 //=================================================================================================
1424 
1425 //*************************************************************************************************
1427 template< typename MT, bool SO, bool DF >
1428 struct IsResizable< StrictlyLowerMatrix<MT,SO,DF> >
1429  : public IsResizable<MT>
1430 {};
1432 //*************************************************************************************************
1433 
1434 
1435 
1436 
1437 //=================================================================================================
1438 //
1439 // ISSHRINKABLE SPECIALIZATIONS
1440 //
1441 //=================================================================================================
1442 
1443 //*************************************************************************************************
1445 template< typename MT, bool SO, bool DF >
1446 struct IsShrinkable< StrictlyLowerMatrix<MT,SO,DF> >
1447  : public IsShrinkable<MT>
1448 {};
1450 //*************************************************************************************************
1451 
1452 
1453 
1454 
1455 //=================================================================================================
1456 //
1457 // REMOVEADAPTOR SPECIALIZATIONS
1458 //
1459 //=================================================================================================
1460 
1461 //*************************************************************************************************
1463 template< typename MT, bool SO, bool DF >
1464 struct RemoveAdaptor< StrictlyLowerMatrix<MT,SO,DF> >
1465 {
1466  using Type = MT;
1467 };
1469 //*************************************************************************************************
1470 
1471 
1472 
1473 
1474 //=================================================================================================
1475 //
1476 // ADDTRAIT SPECIALIZATIONS
1477 //
1478 //=================================================================================================
1479 
1480 //*************************************************************************************************
1482 template< typename T1, typename T2 >
1483 struct AddTraitEval1< T1, T2
1484  , EnableIf_t< IsMatrix_v<T1> &&
1485  IsMatrix_v<T2> &&
1486  ( IsStrictlyLower_v<T1> && IsStrictlyLower_v<T2> ) &&
1487  !( IsZero_v<T1> || IsZero_v<T2> ) > >
1488 {
1489  using Type = StrictlyLowerMatrix< typename AddTraitEval2<T1,T2>::Type >;
1490 };
1492 //*************************************************************************************************
1493 
1494 
1495 
1496 
1497 //=================================================================================================
1498 //
1499 // SUBTRAIT SPECIALIZATIONS
1500 //
1501 //=================================================================================================
1502 
1503 //*************************************************************************************************
1505 template< typename T1, typename T2 >
1506 struct SubTraitEval1< T1, T2
1507  , EnableIf_t< IsMatrix_v<T1> &&
1508  IsMatrix_v<T2> &&
1509  ( ( IsUniLower_v<T1> && IsUniLower_v<T2> ) ||
1510  ( IsStrictlyLower_v<T1> && IsStrictlyLower_v<T2> ) ) &&
1511  !( IsIdentity_v<T1> && IsIdentity_v<T2> ) &&
1512  !( IsZero_v<T1> || IsZero_v<T2> ) > >
1513 {
1514  using Type = StrictlyLowerMatrix< typename SubTraitEval2<T1,T2>::Type >;
1515 };
1517 //*************************************************************************************************
1518 
1519 
1520 
1521 
1522 //=================================================================================================
1523 //
1524 // SCHURTRAIT SPECIALIZATIONS
1525 //
1526 //=================================================================================================
1527 
1528 //*************************************************************************************************
1530 template< typename T1, typename T2 >
1531 struct SchurTraitEval1< T1, T2
1532  , EnableIf_t< IsMatrix_v<T1> &&
1533  IsMatrix_v<T2> &&
1534  ( ( IsStrictlyLower_v<T1> && !IsUpper_v<T2> ) ||
1535  ( !IsUpper_v<T1> && IsStrictlyLower_v<T2> ) ) &&
1536  !( IsZero_v<T1> || IsZero_v<T2> ) > >
1537 {
1538  using Type = StrictlyLowerMatrix< typename SchurTraitEval2<T1,T2>::Type >;
1539 };
1541 //*************************************************************************************************
1542 
1543 
1544 
1545 
1546 //=================================================================================================
1547 //
1548 // MULTTRAIT SPECIALIZATIONS
1549 //
1550 //=================================================================================================
1551 
1552 //*************************************************************************************************
1554 template< typename T1, typename T2 >
1555 struct MultTraitEval1< T1, T2
1556  , EnableIf_t< IsMatrix_v<T1> &&
1557  IsNumeric_v<T2> &&
1558  ( IsStrictlyLower_v<T1> && !IsUniform_v<T1> ) > >
1559 {
1560  using Type = StrictlyLowerMatrix< typename MultTraitEval2<T1,T2>::Type >;
1561 };
1562 
1563 template< typename T1, typename T2 >
1564 struct MultTraitEval1< T1, T2
1565  , EnableIf_t< IsNumeric_v<T1> &&
1566  IsMatrix_v<T2> &&
1567  ( IsStrictlyLower_v<T2> && !IsUniform_v<T2> ) > >
1568 {
1569  using Type = StrictlyLowerMatrix< typename MultTraitEval2<T1,T2>::Type >;
1570 };
1571 
1572 template< typename T1, typename T2 >
1573 struct MultTraitEval1< T1, T2
1574  , EnableIf_t< IsMatrix_v<T1> &&
1575  IsMatrix_v<T2> &&
1576  ( ( IsStrictlyLower_v<T1> && IsLower_v<T2> ) ||
1577  ( IsLower_v<T1> && IsStrictlyLower_v<T2> ) ) &&
1578  !( IsIdentity_v<T1> || IsIdentity_v<T2> ) &&
1579  !( IsZero_v<T1> || IsZero_v<T2> ) > >
1580 {
1581  using Type = StrictlyLowerMatrix< typename MultTraitEval2<T1,T2>::Type >;
1582 };
1584 //*************************************************************************************************
1585 
1586 
1587 
1588 
1589 //=================================================================================================
1590 //
1591 // DIVTRAIT SPECIALIZATIONS
1592 //
1593 //=================================================================================================
1594 
1595 //*************************************************************************************************
1597 template< typename T1, typename T2 >
1598 struct DivTraitEval1< T1, T2
1599  , EnableIf_t< IsStrictlyLower_v<T1> && IsNumeric_v<T2> > >
1600 {
1601  using Type = StrictlyLowerMatrix< typename DivTraitEval2<T1,T2>::Type >;
1602 };
1604 //*************************************************************************************************
1605 
1606 
1607 
1608 
1609 //=================================================================================================
1610 //
1611 // MAPTRAIT SPECIALIZATIONS
1612 //
1613 //=================================================================================================
1614 
1615 //*************************************************************************************************
1617 template< typename T, typename OP >
1618 struct UnaryMapTraitEval1< T, OP
1619  , EnableIf_t< YieldsStrictlyLower_v<OP,T> &&
1620  !YieldsZero_v<OP,T> > >
1621 {
1622  using Type = StrictlyLowerMatrix< typename UnaryMapTraitEval2<T,OP>::Type, StorageOrder_v<T> >;
1623 };
1625 //*************************************************************************************************
1626 
1627 
1628 //*************************************************************************************************
1630 template< typename T1, typename T2, typename OP >
1631 struct BinaryMapTraitEval1< T1, T2, OP
1632  , EnableIf_t< YieldsStrictlyLower_v<OP,T1,T2> &&
1633  !YieldsDiagonal_v<OP,T1,T2> > >
1634 {
1635  using Type = StrictlyLowerMatrix< typename BinaryMapTraitEval2<T1,T2,OP>::Type >;
1636 };
1638 //*************************************************************************************************
1639 
1640 
1641 
1642 
1643 //=================================================================================================
1644 //
1645 // DECLSYMTRAIT SPECIALIZATIONS
1646 //
1647 //=================================================================================================
1648 
1649 //*************************************************************************************************
1651 template< typename MT, bool SO, bool DF >
1652 struct DeclSymTrait< StrictlyLowerMatrix<MT,SO,DF> >
1653 {
1654  using Type = ZeroMatrix< typename MT::ElementType, SO >;
1655 };
1657 //*************************************************************************************************
1658 
1659 
1660 
1661 
1662 //=================================================================================================
1663 //
1664 // DECLHERMTRAIT SPECIALIZATIONS
1665 //
1666 //=================================================================================================
1667 
1668 //*************************************************************************************************
1670 template< typename MT, bool SO, bool DF >
1671 struct DeclHermTrait< StrictlyLowerMatrix<MT,SO,DF> >
1672 {
1673  using Type = ZeroMatrix< typename MT::ElementType, SO >;
1674 };
1676 //*************************************************************************************************
1677 
1678 
1679 
1680 
1681 //=================================================================================================
1682 //
1683 // DECLLOWTRAIT SPECIALIZATIONS
1684 //
1685 //=================================================================================================
1686 
1687 //*************************************************************************************************
1689 template< typename MT, bool SO, bool DF >
1690 struct DeclLowTrait< StrictlyLowerMatrix<MT,SO,DF> >
1691 {
1692  using Type = StrictlyLowerMatrix<MT,SO,DF>;
1693 };
1695 //*************************************************************************************************
1696 
1697 
1698 
1699 
1700 //=================================================================================================
1701 //
1702 // DECLUPPTRAIT SPECIALIZATIONS
1703 //
1704 //=================================================================================================
1705 
1706 //*************************************************************************************************
1708 template< typename MT, bool SO, bool DF >
1709 struct DeclUppTrait< StrictlyLowerMatrix<MT,SO,DF> >
1710 {
1711  using Type = ZeroMatrix< typename MT::ElementType, SO >;
1712 };
1714 //*************************************************************************************************
1715 
1716 
1717 
1718 
1719 //=================================================================================================
1720 //
1721 // DECLDIAGTRAIT SPECIALIZATIONS
1722 //
1723 //=================================================================================================
1724 
1725 //*************************************************************************************************
1727 template< typename MT, bool SO, bool DF >
1728 struct DeclDiagTrait< StrictlyLowerMatrix<MT,SO,DF> >
1729 {
1730  using Type = ZeroMatrix< typename MT::ElementType, SO >;
1731 };
1733 //*************************************************************************************************
1734 
1735 
1736 
1737 
1738 //=================================================================================================
1739 //
1740 // HIGHTYPE SPECIALIZATIONS
1741 //
1742 //=================================================================================================
1743 
1744 //*************************************************************************************************
1746 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1747 struct HighType< StrictlyLowerMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2> >
1748 {
1749  using Type = StrictlyLowerMatrix< typename HighType<MT1,MT2>::Type >;
1750 };
1752 //*************************************************************************************************
1753 
1754 
1755 
1756 
1757 //=================================================================================================
1758 //
1759 // LOWTYPE SPECIALIZATIONS
1760 //
1761 //=================================================================================================
1762 
1763 //*************************************************************************************************
1765 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1766 struct LowType< StrictlyLowerMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2> >
1767 {
1768  using Type = StrictlyLowerMatrix< typename LowType<MT1,MT2>::Type >;
1769 };
1771 //*************************************************************************************************
1772 
1773 
1774 
1775 
1776 //=================================================================================================
1777 //
1778 // SUBMATRIXTRAIT SPECIALIZATIONS
1779 //
1780 //=================================================================================================
1781 
1782 //*************************************************************************************************
1784 template< typename MT, size_t I, size_t N >
1785 struct SubmatrixTraitEval1< MT, I, I, N, N
1786  , EnableIf_t< IsStrictlyLower_v<MT> > >
1787 {
1788  using Type = StrictlyLowerMatrix< typename SubmatrixTraitEval2<MT,I,I,N,N>::Type >;
1789 };
1791 //*************************************************************************************************
1792 
1793 } // namespace blaze
1794 
1795 #endif
BoolConstant< false > FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: FalseType.h:61
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.
Header file for the UNUSED_PARAMETER function template.
StrictlyLowerMatrix specialization for sparse matrices.
Header file for the subtraction trait.
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.The IsMatrix_v variable template provides a c...
Definition: IsMatrix.h:139
Header file for the implementation of the base template of the StrictlyLowerMatrix.
Header file for the declherm trait.
Header file for the YieldsStrictlyLower type trait.
Header file for the YieldsZero type trait.
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
Header file for the IsIdentity type trait.
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
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
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
Header file for the LowType type trait.
Header file for the IsUniform type trait.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the IsShrinkable type trait.
StrictlyLowerMatrix specialization for dense matrices.
Header file for all forward declarations of the math module.
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:1147
constexpr bool YieldsStrictlyLower_v
Auxiliary variable template for the YieldsStrictlyLower type trait.The YieldsStrictlyLower_v variable...
Definition: YieldsStrictlyLower.h:125
Header file for the decllow trait.
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.
Header file for the IsAligned type trait.
constexpr bool IsStrictlyLower_v
Auxiliary variable template for the IsStrictlyLower type trait.The IsStrictlyLower_v variable templat...
Definition: IsStrictlyLower.h:172
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:438
Header file for the RemoveAdaptor type trait.
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:611
Header file for the IsPadded type trait.
Header file for the IsAdaptor type trait.
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:135
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
Header file for the declupp trait.
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.
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.
Header file for the declsym trait.
Matrix adapter for strictly lower triangular matrices.
Definition: BaseTemplate.h:558
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:281
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
#define BLAZE_CONSTRAINT_MUST_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 StorageOrder type trait.
Header file for the map trait.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
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.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the HighType type trait.
Header file for the TrueType type/value trait base class.