UniLowerMatrix.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_UNILOWERMATRIX_H_
36 #define _BLAZE_MATH_ADAPTORS_UNILOWERMATRIX_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
56 #include <blaze/math/Forward.h>
57 #include <blaze/math/Functions.h>
60 #include <blaze/math/shims/IsOne.h>
82 #include <blaze/util/Assert.h>
83 #include <blaze/util/EnableIf.h>
85 #include <blaze/util/TrueType.h>
87 #include <blaze/util/Unused.h>
88 
89 
90 namespace blaze {
91 
92 //=================================================================================================
93 //
94 // UNILOWERMATRIX OPERATORS
95 //
96 //=================================================================================================
97 
98 //*************************************************************************************************
101 template< typename MT, bool SO, bool DF >
102 inline void reset( UniLowerMatrix<MT,SO,DF>& m );
103 
104 template< typename MT, bool SO, bool DF >
105 inline void reset( UniLowerMatrix<MT,SO,DF>& m, size_t i );
106 
107 template< typename MT, bool SO, bool DF >
108 inline void clear( UniLowerMatrix<MT,SO,DF>& m );
109 
110 template< typename MT, bool SO, bool DF >
111 inline bool isDefault( const UniLowerMatrix<MT,SO,DF>& m );
112 
113 template< typename MT, bool SO, bool DF >
114 inline bool isIntact( const UniLowerMatrix<MT,SO,DF>& m );
115 
116 template< typename MT, bool SO, bool DF >
117 inline void swap( UniLowerMatrix<MT,SO,DF>& a, UniLowerMatrix<MT,SO,DF>& b ) noexcept;
119 //*************************************************************************************************
120 
121 
122 //*************************************************************************************************
129 template< typename MT // Type of the adapted matrix
130  , bool SO // Storage order of the adapted matrix
131  , bool DF > // Density flag
133 {
134  m.reset();
135 }
136 //*************************************************************************************************
137 
138 
139 //*************************************************************************************************
152 template< typename MT // Type of the adapted matrix
153  , bool SO // Storage order of the adapted matrix
154  , bool DF > // Density flag
155 inline void reset( UniLowerMatrix<MT,SO,DF>& m, size_t i )
156 {
157  m.reset( i );
158 }
159 //*************************************************************************************************
160 
161 
162 //*************************************************************************************************
169 template< typename MT // Type of the adapted matrix
170  , bool SO // Storage order of the adapted matrix
171  , bool DF > // Density flag
173 {
174  m.clear();
175 }
176 //*************************************************************************************************
177 
178 
179 //*************************************************************************************************
189 template< typename MT // Type of the adapted matrix
190  , bool SO // Storage order of the adapted matrix
191  , bool DF > // Density flag
192 inline bool isDefault_backend( const UniLowerMatrix<MT,SO,DF>& m, TrueType )
193 {
194  return ( m.rows() == 0UL );
195 }
197 //*************************************************************************************************
198 
199 
200 //*************************************************************************************************
210 template< typename MT // Type of the adapted matrix
211  , bool SO // Storage order of the adapted matrix
212  , bool DF > // Density flag
213 inline bool isDefault_backend( const UniLowerMatrix<MT,SO,DF>& m, FalseType )
214 {
215  return isIdentity( m );
216 }
218 //*************************************************************************************************
219 
220 
221 //*************************************************************************************************
240 template< typename MT // Type of the adapted matrix
241  , bool SO // Storage order of the adapted matrix
242  , bool DF > // Density flag
243 inline bool isDefault( const UniLowerMatrix<MT,SO,DF>& m )
244 {
245  return isDefault_backend( m, typename IsResizable<MT>::Type() );
246 }
247 //*************************************************************************************************
248 
249 
250 //*************************************************************************************************
271 template< typename MT // Type of the adapted matrix
272  , bool SO // Storage order of the adapted matrix
273  , bool DF > // Density flag
274 inline bool isIntact( const UniLowerMatrix<MT,SO,DF>& m )
275 {
276  return m.isIntact();
277 }
278 //*************************************************************************************************
279 
280 
281 //*************************************************************************************************
289 template< typename MT // Type of the adapted matrix
290  , bool SO // Storage order of the adapted matrix
291  , bool DF > // Density flag
293 {
294  a.swap( b );
295 }
296 //*************************************************************************************************
297 
298 
299 //*************************************************************************************************
322 template< InversionFlag IF // Inversion algorithm
323  , typename MT // Type of the dense matrix
324  , bool SO > // Storage order of the dense matrix
325 inline void invert( UniLowerMatrix<MT,SO,true>& m )
326 {
328 
329  if( IF == asUpper || IF == asUniUpper ) {
330  BLAZE_INTERNAL_ASSERT( isIdentity( m ), "Violation of preconditions detected" );
331  return;
332  }
333 
334  constexpr InversionFlag flag( ( IF == byLU || IF == asGeneral || IF == asLower || IF == asUniLower )
335  ? ( asUniLower )
336  : ( asDiagonal ) );
337 
338  invert<flag>( derestrict( m ) );
339 
340  BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
341 }
343 //*************************************************************************************************
344 
345 
346 //*************************************************************************************************
365 template< typename MT1, bool SO1, typename MT2, typename MT3, typename MT4, bool SO2 >
366 inline void lu( const UniLowerMatrix<MT1,SO1,true>& A, DenseMatrix<MT2,SO1>& L,
367  DenseMatrix<MT3,SO1>& U, Matrix<MT4,SO2>& P )
368 {
370 
375 
380 
381  typedef ElementType_<MT3> ET3;
382  typedef ElementType_<MT4> ET4;
383 
384  const size_t n( (~A).rows() );
385 
386  DerestrictTrait_<MT3> U2( derestrict( ~U ) );
387 
388  (~L) = A;
389 
390  resize( ~U, n, n );
391  reset( U2 );
392 
393  resize( ~P, n, n );
394  reset( ~P );
395 
396  for( size_t i=0UL; i<n; ++i ) {
397  U2(i,i) = ET3(1);
398  (~P)(i,i) = ET4(1);
399  }
400 }
402 //*************************************************************************************************
403 
404 
405 //*************************************************************************************************
421 template< typename MT // Type of the adapted matrix
422  , bool SO // Storage order of the adapted matrix
423  , bool DF // Density flag
424  , typename VT > // Type of the right-hand side dense vector
425 inline bool tryAssign( const UniLowerMatrix<MT,SO,DF>& lhs,
426  const DenseVector<VT,false>& rhs, size_t row, size_t column )
427 {
429 
430  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
431  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
432  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.rows() - row, "Invalid number of rows" );
433 
434  UNUSED_PARAMETER( lhs );
435 
436  if( column < row )
437  return true;
438 
439  const bool containsDiagonal( column < row + (~rhs).size() );
440  const size_t iend( min( column - row, (~rhs).size() ) );
441 
442  for( size_t i=0UL; i<iend; ++i ) {
443  if( !isDefault( (~rhs)[i] ) )
444  return false;
445  }
446 
447  if( containsDiagonal && !isOne( (~rhs)[iend] ) )
448  return false;
449 
450  return true;
451 }
453 //*************************************************************************************************
454 
455 
456 //*************************************************************************************************
472 template< typename MT // Type of the adapted matrix
473  , bool SO // Storage order of the adapted matrix
474  , bool DF // Density flag
475  , typename VT > // Type of the right-hand side dense vector
476 inline bool tryAssign( const UniLowerMatrix<MT,SO,DF>& lhs,
477  const DenseVector<VT,true>& rhs, size_t row, size_t column )
478 {
480 
481  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
482  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
483  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.columns() - column, "Invalid number of columns" );
484 
485  UNUSED_PARAMETER( lhs );
486 
487  if( row >= column + (~rhs).size() )
488  return true;
489 
490  const bool containsDiagonal( row >= column );
491  const size_t ibegin( ( !containsDiagonal )?( 0UL ):( row - column + 1UL ) );
492 
493  if( containsDiagonal && !isOne( (~rhs)[row-column] ) )
494  return false;
495 
496  for( size_t i=ibegin; i<(~rhs).size(); ++i ) {
497  if( !isDefault( (~rhs)[i] ) )
498  return false;
499  }
500 
501  return true;
502 }
504 //*************************************************************************************************
505 
506 
507 //*************************************************************************************************
523 template< typename MT // Type of the adapted matrix
524  , bool SO // Storage order of the adapted matrix
525  , bool DF // Density flag
526  , typename VT > // Type of the right-hand side sparse vector
527 inline bool tryAssign( const UniLowerMatrix<MT,SO,DF>& lhs,
528  const SparseVector<VT,false>& rhs, size_t row, size_t column )
529 {
531 
532  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
533  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
534  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.rows() - row, "Invalid number of rows" );
535 
536  UNUSED_PARAMETER( lhs );
537 
538  typedef typename VT::ConstIterator RhsIterator;
539 
540  if( column < row )
541  return true;
542 
543  const bool containsDiagonal( column < row + (~rhs).size() );
544  const size_t index( column - row );
545  const RhsIterator last( (~rhs).lowerBound( index ) );
546 
547  if( containsDiagonal ) {
548  if( last == (~rhs).end() || last->index() != index || !isOne( last->value() ) )
549  return false;
550  }
551 
552  for( RhsIterator element=(~rhs).begin(); element!=last; ++element ) {
553  if( !isDefault( element->value() ) )
554  return false;
555  }
556 
557  return true;
558 }
560 //*************************************************************************************************
561 
562 
563 //*************************************************************************************************
579 template< typename MT // Type of the adapted matrix
580  , bool SO // Storage order of the adapted matrix
581  , bool DF // Density flag
582  , typename VT > // Type of the right-hand side sparse vector
583 inline bool tryAssign( const UniLowerMatrix<MT,SO,DF>& lhs,
584  const SparseVector<VT,true>& rhs, size_t row, size_t column )
585 {
587 
588  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
589  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
590  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.columns() - column, "Invalid number of columns" );
591 
592  UNUSED_PARAMETER( lhs );
593 
594  typedef typename VT::ConstIterator RhsIterator;
595 
596  if( row >= column + (~rhs).size() )
597  return true;
598 
599  const bool containsDiagonal( row >= column );
600  const size_t index( ( containsDiagonal )?( row - column ):( 0UL ) );
601  const RhsIterator last( (~rhs).end() );
602  RhsIterator element( (~rhs).lowerBound( index ) );
603 
604  if( containsDiagonal ) {
605  if( element == last || element->index() != index || !isOne( element->value() ) )
606  return false;
607  ++element;
608  }
609 
610  for( ; element!=last; ++element ) {
611  if( !isDefault( element->value() ) )
612  return false;
613  }
614 
615  return true;
616 }
618 //*************************************************************************************************
619 
620 
621 //*************************************************************************************************
637 template< typename MT1 // Type of the adapted matrix
638  , bool SO // Storage order of the adapted matrix
639  , bool DF // Density flag
640  , typename MT2 > // Type of the right-hand side dense matrix
641 inline bool tryAssign( const UniLowerMatrix<MT1,SO,DF>& lhs,
642  const DenseMatrix<MT2,false>& rhs, size_t row, size_t column )
643 {
645 
646  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
647  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
648  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
649  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
650 
651  UNUSED_PARAMETER( lhs );
652 
653  const size_t M( (~rhs).rows() );
654  const size_t N( (~rhs).columns() );
655 
656  if( row + 1UL >= column + N )
657  return true;
658 
659  const size_t iend( min( column + N - row, M ) );
660 
661  for( size_t i=0UL; i<iend; ++i )
662  {
663  const bool containsDiagonal( row + i >= column );
664 
665  if( containsDiagonal && !isOne( (~rhs)(i,row+i-column) ) )
666  return false;
667 
668  const size_t jbegin( ( containsDiagonal )?( row + i - column + 1UL ):( 0UL ) );
669 
670  for( size_t j=jbegin; j<N; ++j ) {
671  if( !isDefault( (~rhs)(i,j) ) )
672  return false;
673  }
674  }
675 
676  return true;
677 }
679 //*************************************************************************************************
680 
681 
682 //*************************************************************************************************
698 template< typename MT1 // Type of the adapted matrix
699  , bool SO // Storage order of the adapted matrix
700  , bool DF // Density flag
701  , typename MT2 > // Type of the right-hand side dense matrix
702 inline bool tryAssign( const UniLowerMatrix<MT1,SO,DF>& lhs,
703  const DenseMatrix<MT2,true>& rhs, size_t row, size_t column )
704 {
706 
707  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
708  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
709  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
710  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
711 
712  UNUSED_PARAMETER( lhs );
713 
714  const size_t M( (~rhs).rows() );
715  const size_t N( (~rhs).columns() );
716 
717  if( row + 1UL >= column + N )
718  return true;
719 
720  const size_t jbegin( ( row < column )?( 0UL ):( row - column ) );
721 
722  for( size_t j=jbegin; j<N; ++j )
723  {
724  const size_t iend( min( column + j - row, M ) );
725 
726  for( size_t i=0UL; i<iend; ++i ) {
727  if( !isDefault( (~rhs)(i,j) ) )
728  return false;
729  }
730 
731  const bool containsDiagonal( column + j < row + M );
732 
733  if( containsDiagonal && !isOne( (~rhs)(iend,j) ) )
734  return false;
735  }
736 
737  return true;
738 }
740 //*************************************************************************************************
741 
742 
743 //*************************************************************************************************
759 template< typename MT1 // Type of the adapted matrix
760  , bool SO // Storage order of the adapted matrix
761  , bool DF // Density flag
762  , typename MT2 > // Type of the right-hand side sparse matrix
763 inline bool tryAssign( const UniLowerMatrix<MT1,SO,DF>& lhs,
764  const SparseMatrix<MT2,false>& rhs, size_t row, size_t column )
765 {
767 
768  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
769  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
770  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
771  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
772 
773  UNUSED_PARAMETER( lhs );
774 
775  typedef typename MT2::ConstIterator RhsIterator;
776 
777  const size_t M( (~rhs).rows() );
778  const size_t N( (~rhs).columns() );
779 
780  if( row + 1UL >= column + N )
781  return true;
782 
783  const size_t iend( min( column + N - row, M ) );
784 
785  for( size_t i=0UL; i<iend; ++i )
786  {
787  const bool containsDiagonal( row + i >= column );
788  const size_t index( ( containsDiagonal )?( row + i - column ):( 0UL ) );
789 
790  const RhsIterator last( (~rhs).end(i) );
791  RhsIterator element( (~rhs).lowerBound( i, index ) );
792 
793  if( containsDiagonal ) {
794  if( element == last || ( element->index() != index ) || !isOne( element->value() ) )
795  return false;
796  ++element;
797  }
798 
799  for( ; element!=last; ++element ) {
800  if( !isDefault( element->value() ) )
801  return false;
802  }
803  }
804 
805  return true;
806 }
808 //*************************************************************************************************
809 
810 
811 //*************************************************************************************************
827 template< typename MT1 // Type of the adapted matrix
828  , bool SO // Storage order of the adapted matrix
829  , bool DF // Density flag
830  , typename MT2 > // Type of the right-hand side sparse matrix
831 inline bool tryAssign( const UniLowerMatrix<MT1,SO,DF>& lhs,
832  const SparseMatrix<MT2,true>& rhs, size_t row, size_t column )
833 {
835 
836  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
837  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
838  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
839  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
840 
841  UNUSED_PARAMETER( lhs );
842 
843  typedef typename MT2::ConstIterator RhsIterator;
844 
845  const size_t M( (~rhs).rows() );
846  const size_t N( (~rhs).columns() );
847 
848  if( row + 1UL >= column + N )
849  return true;
850 
851  const size_t jbegin( ( row < column )?( 0UL ):( row - column ) );
852 
853  for( size_t j=jbegin; j<N; ++j )
854  {
855  const bool containsDiagonal( column + j < row + M );
856 
857  const size_t index( column + j - row );
858  const RhsIterator last( (~rhs).lowerBound( min( index, M ), j ) );
859 
860  if( containsDiagonal ) {
861  if( last == (~rhs).end(j) || ( last->index() != index ) || !isOne( last->value() ) )
862  return false;
863  }
864 
865  for( RhsIterator element=(~rhs).begin(j); element!=last; ++element ) {
866  if( !isDefault( element->value() ) )
867  return false;
868  }
869  }
870 
871  return true;
872 }
874 //*************************************************************************************************
875 
876 
877 //*************************************************************************************************
894 template< typename MT // Type of the adapted matrix
895  , bool SO // Storage order of the adapted matrix
896  , bool DF // Density flag
897  , typename VT > // Type of the right-hand side dense vector
898 inline bool tryAddAssign( const UniLowerMatrix<MT,SO,DF>& lhs,
899  const DenseVector<VT,false>& rhs, size_t row, size_t column )
900 {
902 
903  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
904  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
905  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.rows() - row, "Invalid number of rows" );
906 
907  UNUSED_PARAMETER( lhs );
908 
909  if( column < row )
910  return true;
911 
912  const size_t iend( min( column - row + 1UL, (~rhs).size() ) );
913 
914  for( size_t i=0UL; i<iend; ++i ) {
915  if( !isDefault( (~rhs)[i] ) )
916  return false;
917  }
918 
919  return true;
920 }
922 //*************************************************************************************************
923 
924 
925 //*************************************************************************************************
942 template< typename MT // Type of the adapted matrix
943  , bool SO // Storage order of the adapted matrix
944  , bool DF // Density flag
945  , typename VT > // Type of the right-hand side dense vector
946 inline bool tryAddAssign( const UniLowerMatrix<MT,SO,DF>& lhs,
947  const DenseVector<VT,true>& rhs, size_t row, size_t column )
948 {
950 
951  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
952  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
953  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.columns() - column, "Invalid number of columns" );
954 
955  UNUSED_PARAMETER( lhs );
956 
957  const size_t ibegin( ( row <= column )?( 0UL ):( row - column ) );
958 
959  for( size_t i=ibegin; i<(~rhs).size(); ++i ) {
960  if( !isDefault( (~rhs)[i] ) )
961  return false;
962  }
963 
964  return true;
965 }
967 //*************************************************************************************************
968 
969 
970 //*************************************************************************************************
987 template< typename MT // Type of the adapted matrix
988  , bool SO // Storage order of the adapted matrix
989  , bool DF // Density flag
990  , typename VT > // Type of the right-hand side sparse vector
991 inline bool tryAddAssign( const UniLowerMatrix<MT,SO,DF>& lhs,
992  const SparseVector<VT,false>& rhs, size_t row, size_t column )
993 {
995 
996  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
997  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
998  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.rows() - row, "Invalid number of rows" );
999 
1000  UNUSED_PARAMETER( lhs );
1001 
1002  typedef typename VT::ConstIterator RhsIterator;
1003 
1004  if( column < row )
1005  return true;
1006 
1007  const RhsIterator last( (~rhs).lowerBound( column - row + 1UL ) );
1008 
1009  for( RhsIterator element=(~rhs).begin(); element!=last; ++element ) {
1010  if( !isDefault( element->value() ) )
1011  return false;
1012  }
1013 
1014  return true;
1015 }
1017 //*************************************************************************************************
1018 
1019 
1020 //*************************************************************************************************
1037 template< typename MT // Type of the adapted matrix
1038  , bool SO // Storage order of the adapted matrix
1039  , bool DF // Density flag
1040  , typename VT > // Type of the right-hand side sparse vector
1041 inline bool tryAddAssign( const UniLowerMatrix<MT,SO,DF>& lhs,
1042  const SparseVector<VT,true>& rhs, size_t row, size_t column )
1043 {
1045 
1046  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1047  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1048  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.columns() - column, "Invalid number of columns" );
1049 
1050  UNUSED_PARAMETER( lhs );
1051 
1052  typedef typename VT::ConstIterator RhsIterator;
1053 
1054  const RhsIterator last( (~rhs).end() );
1055  RhsIterator element( (~rhs).lowerBound( ( row <= column )?( 0UL ):( row - column ) ) );
1056 
1057  for( ; element!=last; ++element ) {
1058  if( !isDefault( element->value() ) )
1059  return false;
1060  }
1061 
1062  return true;
1063 }
1065 //*************************************************************************************************
1066 
1067 
1068 //*************************************************************************************************
1085 template< typename MT1 // Type of the adapted matrix
1086  , bool SO // Storage order of the adapted matrix
1087  , bool DF // Density flag
1088  , typename MT2 > // Type of the right-hand side dense matrix
1089 inline bool tryAddAssign( const UniLowerMatrix<MT1,SO,DF>& lhs,
1090  const DenseMatrix<MT2,false>& rhs, size_t row, size_t column )
1091 {
1093 
1094  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1095  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1096  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1097  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1098 
1099  UNUSED_PARAMETER( lhs );
1100 
1101  const size_t M( (~rhs).rows() );
1102  const size_t N( (~rhs).columns() );
1103 
1104  if( row + 1UL >= column + N )
1105  return true;
1106 
1107  const size_t iend( min( column + N - row, M ) );
1108 
1109  for( size_t i=0UL; i<iend; ++i )
1110  {
1111  const bool containsDiagonal( row + i >= column );
1112  const size_t jbegin( ( containsDiagonal )?( row + i - column ):( 0UL ) );
1113 
1114  for( size_t j=jbegin; j<N; ++j ) {
1115  if( !isDefault( (~rhs)(i,j) ) )
1116  return false;
1117  }
1118  }
1119 
1120  return true;
1121 }
1123 //*************************************************************************************************
1124 
1125 
1126 //*************************************************************************************************
1143 template< typename MT1 // Type of the adapted matrix
1144  , bool SO // Storage order of the adapted matrix
1145  , bool DF // Density flag
1146  , typename MT2 > // Type of the right-hand side dense matrix
1147 inline bool tryAddAssign( const UniLowerMatrix<MT1,SO,DF>& lhs,
1148  const DenseMatrix<MT2,true>& rhs, size_t row, size_t column )
1149 {
1151 
1152  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1153  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1154  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1155  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1156 
1157  UNUSED_PARAMETER( lhs );
1158 
1159  const size_t M( (~rhs).rows() );
1160  const size_t N( (~rhs).columns() );
1161 
1162  if( row + 1UL >= column + N )
1163  return true;
1164 
1165  const size_t jbegin( ( row <= column )?( 0UL ):( row - column ) );
1166 
1167  for( size_t j=jbegin; j<N; ++j )
1168  {
1169  const size_t iend( min( column + j - row + 1UL, M ) );
1170 
1171  for( size_t i=0UL; i<iend; ++i ) {
1172  if( !isDefault( (~rhs)(i,j) ) )
1173  return false;
1174  }
1175  }
1176 
1177  return true;
1178 }
1180 //*************************************************************************************************
1181 
1182 
1183 //*************************************************************************************************
1200 template< typename MT1 // Type of the adapted matrix
1201  , bool SO // Storage order of the adapted matrix
1202  , bool DF // Density flag
1203  , typename MT2 > // Type of the right-hand side sparse matrix
1204 inline bool tryAddAssign( const UniLowerMatrix<MT1,SO,DF>& lhs,
1205  const SparseMatrix<MT2,false>& rhs, size_t row, size_t column )
1206 {
1208 
1209  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1210  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1211  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1212  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1213 
1214  UNUSED_PARAMETER( lhs );
1215 
1216  typedef typename MT2::ConstIterator RhsIterator;
1217 
1218  const size_t M( (~rhs).rows() );
1219  const size_t N( (~rhs).columns() );
1220 
1221  if( row + 1UL >= column + N )
1222  return true;
1223 
1224  const size_t iend( min( column + N - row, M ) );
1225 
1226  for( size_t i=0UL; i<iend; ++i )
1227  {
1228  const bool containsDiagonal( row + i >= column );
1229  const size_t index( ( containsDiagonal )?( row + i - column ):( 0UL ) );
1230 
1231  const RhsIterator last( (~rhs).end(i) );
1232  RhsIterator element( (~rhs).lowerBound( i, index ) );
1233 
1234  for( ; element!=last; ++element ) {
1235  if( !isDefault( element->value() ) )
1236  return false;
1237  }
1238  }
1239 
1240  return true;
1241 }
1243 //*************************************************************************************************
1244 
1245 
1246 //*************************************************************************************************
1263 template< typename MT1 // Type of the adapted matrix
1264  , bool SO // Storage order of the adapted matrix
1265  , bool DF // Density flag
1266  , typename MT2 > // Type of the right-hand side sparse matrix
1267 inline bool tryAddAssign( const UniLowerMatrix<MT1,SO,DF>& lhs,
1268  const SparseMatrix<MT2,true>& rhs, size_t row, size_t column )
1269 {
1271 
1272  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1273  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1274  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1275  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1276 
1277  UNUSED_PARAMETER( lhs );
1278 
1279  typedef typename MT2::ConstIterator RhsIterator;
1280 
1281  const size_t M( (~rhs).rows() );
1282  const size_t N( (~rhs).columns() );
1283 
1284  if( row + 1UL >= column + N )
1285  return true;
1286 
1287  const size_t jbegin( ( row < column )?( 0UL ):( row - column ) );
1288 
1289  for( size_t j=jbegin; j<N; ++j )
1290  {
1291  const size_t index( column + j - row + 1UL );
1292  const RhsIterator last( (~rhs).lowerBound( min( index, M ), j ) );
1293 
1294  for( RhsIterator element=(~rhs).begin(j); element!=last; ++element ) {
1295  if( !isDefault( element->value() ) )
1296  return false;
1297  }
1298  }
1299 
1300  return true;
1301 }
1303 //*************************************************************************************************
1304 
1305 
1306 //*************************************************************************************************
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 UniLowerMatrix<MT,SO,DF>& lhs,
1329  const Vector<VT,TF>& rhs, size_t row, size_t column )
1330 {
1331  return tryAddAssign( lhs, ~rhs, row, column );
1332 }
1334 //*************************************************************************************************
1335 
1336 
1337 //*************************************************************************************************
1354 template< typename MT1 // Type of the adapted matrix
1355  , bool SO1 // Storage order of the adapted matrix
1356  , bool DF // Density flag
1357  , typename MT2 // Type of the right-hand side matrix
1358  , bool SO2 > // Storage order of the right-hand side matrix
1359 inline bool trySubAssign( const UniLowerMatrix<MT1,SO1,DF>& lhs,
1360  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1361 {
1362  return tryAddAssign( lhs, ~rhs, row, column );
1363 }
1365 //*************************************************************************************************
1366 
1367 
1368 //*************************************************************************************************
1385 template< typename MT // Type of the adapted matrix
1386  , bool SO // Storage order of the adapted matrix
1387  , bool DF // Density flag
1388  , typename VT > // Type of the right-hand side vector
1389 inline bool tryMultAssign( const UniLowerMatrix<MT,SO,DF>& lhs,
1390  const Vector<VT,false>& rhs, size_t row, size_t column )
1391 {
1393 
1394  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1395  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1396  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.rows() - row, "Invalid number of rows" );
1397 
1398  UNUSED_PARAMETER( lhs );
1399 
1400  return ( column < row || (~rhs).size() <= column - row || isOne( (~rhs)[column-row] ) );
1401 }
1403 //*************************************************************************************************
1404 
1405 
1406 //*************************************************************************************************
1423 template< typename MT // Type of the adapted matrix
1424  , bool SO // Storage order of the adapted matrix
1425  , bool DF // Density flag
1426  , typename VT > // Type of the right-hand side vector
1427 inline bool tryMultAssign( const UniLowerMatrix<MT,SO,DF>& lhs,
1428  const Vector<VT,true>& rhs, size_t row, size_t column )
1429 {
1431 
1432  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1433  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1434  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.columns() - column, "Invalid number of columns" );
1435 
1436  UNUSED_PARAMETER( lhs );
1437 
1438  return ( row < column || (~rhs).size() <= row - column || isOne( (~rhs)[row-column] ) );
1439 }
1441 //*************************************************************************************************
1442 
1443 
1444 //*************************************************************************************************
1460 template< typename MT // Type of the adapted matrix
1461  , bool SO // Storage order of the adapted matrix
1462  , bool DF // Density flag
1463  , typename VT // Type of the right-hand side vector
1464  , bool TF > // Transpose flag of the right-hand side vector
1465 inline bool tryDivAssign( const UniLowerMatrix<MT,SO,DF>& lhs,
1466  const Vector<VT,TF>& rhs, size_t row, size_t column )
1467 {
1468  return tryMultAssign( lhs, ~rhs, row, column );
1469 }
1471 //*************************************************************************************************
1472 
1473 
1474 //*************************************************************************************************
1488 template< typename MT // Type of the adapted matrix
1489  , bool SO // Storage order of the adapted matrix
1490  , bool DF > // Density flag
1491 inline MT& derestrict( UniLowerMatrix<MT,SO,DF>& m )
1492 {
1493  return m.matrix_;
1494 }
1496 //*************************************************************************************************
1497 
1498 
1499 
1500 
1501 //=================================================================================================
1502 //
1503 // ROWS SPECIALIZATIONS
1504 //
1505 //=================================================================================================
1506 
1507 //*************************************************************************************************
1509 template< typename MT, bool SO, bool DF >
1510 struct Rows< UniLowerMatrix<MT,SO,DF> > : public Rows<MT>
1511 {};
1513 //*************************************************************************************************
1514 
1515 
1516 
1517 
1518 //=================================================================================================
1519 //
1520 // COLUMNS SPECIALIZATIONS
1521 //
1522 //=================================================================================================
1523 
1524 //*************************************************************************************************
1526 template< typename MT, bool SO, bool DF >
1527 struct Columns< UniLowerMatrix<MT,SO,DF> > : public Columns<MT>
1528 {};
1530 //*************************************************************************************************
1531 
1532 
1533 
1534 
1535 //=================================================================================================
1536 //
1537 // ISSQUARE SPECIALIZATIONS
1538 //
1539 //=================================================================================================
1540 
1541 //*************************************************************************************************
1543 template< typename MT, bool SO, bool DF >
1544 struct IsSquare< UniLowerMatrix<MT,SO,DF> > : public TrueType
1545 {};
1547 //*************************************************************************************************
1548 
1549 
1550 
1551 
1552 //=================================================================================================
1553 //
1554 // ISUNILOWER SPECIALIZATIONS
1555 //
1556 //=================================================================================================
1557 
1558 //*************************************************************************************************
1560 template< typename MT, bool SO, bool DF >
1561 struct IsUniLower< UniLowerMatrix<MT,SO,DF> > : public TrueType
1562 {};
1564 //*************************************************************************************************
1565 
1566 
1567 
1568 
1569 //=================================================================================================
1570 //
1571 // ISADAPTOR SPECIALIZATIONS
1572 //
1573 //=================================================================================================
1574 
1575 //*************************************************************************************************
1577 template< typename MT, bool SO, bool DF >
1578 struct IsAdaptor< UniLowerMatrix<MT,SO,DF> > : public TrueType
1579 {};
1581 //*************************************************************************************************
1582 
1583 
1584 
1585 
1586 //=================================================================================================
1587 //
1588 // ISRESTRICTED SPECIALIZATIONS
1589 //
1590 //=================================================================================================
1591 
1592 //*************************************************************************************************
1594 template< typename MT, bool SO, bool DF >
1595 struct IsRestricted< UniLowerMatrix<MT,SO,DF> > : public TrueType
1596 {};
1598 //*************************************************************************************************
1599 
1600 
1601 
1602 
1603 //=================================================================================================
1604 //
1605 // HASCONSTDATAACCESS SPECIALIZATIONS
1606 //
1607 //=================================================================================================
1608 
1609 //*************************************************************************************************
1611 template< typename MT, bool SO >
1612 struct HasConstDataAccess< UniLowerMatrix<MT,SO,true> > : public TrueType
1613 {};
1615 //*************************************************************************************************
1616 
1617 
1618 
1619 
1620 //=================================================================================================
1621 //
1622 // ISALIGNED SPECIALIZATIONS
1623 //
1624 //=================================================================================================
1625 
1626 //*************************************************************************************************
1628 template< typename MT, bool SO, bool DF >
1629 struct IsAligned< UniLowerMatrix<MT,SO,DF> > : public BoolConstant< IsAligned<MT>::value >
1630 {};
1632 //*************************************************************************************************
1633 
1634 
1635 
1636 
1637 //=================================================================================================
1638 //
1639 // ISPADDED SPECIALIZATIONS
1640 //
1641 //=================================================================================================
1642 
1643 //*************************************************************************************************
1645 template< typename MT, bool SO, bool DF >
1646 struct IsPadded< UniLowerMatrix<MT,SO,DF> > : public BoolConstant< IsPadded<MT>::value >
1647 {};
1649 //*************************************************************************************************
1650 
1651 
1652 
1653 
1654 //=================================================================================================
1655 //
1656 // ISRESIZABLE SPECIALIZATIONS
1657 //
1658 //=================================================================================================
1659 
1660 //*************************************************************************************************
1662 template< typename MT, bool SO, bool DF >
1663 struct IsResizable< UniLowerMatrix<MT,SO,DF> > : public BoolConstant< IsResizable<MT>::value >
1664 {};
1666 //*************************************************************************************************
1667 
1668 
1669 
1670 
1671 //=================================================================================================
1672 //
1673 // REMOVEADAPTOR SPECIALIZATIONS
1674 //
1675 //=================================================================================================
1676 
1677 //*************************************************************************************************
1679 template< typename MT, bool SO, bool DF >
1680 struct RemoveAdaptor< UniLowerMatrix<MT,SO,DF> >
1681 {
1682  using Type = MT;
1683 };
1685 //*************************************************************************************************
1686 
1687 
1688 
1689 
1690 //=================================================================================================
1691 //
1692 // DERESTRICTTRAIT SPECIALIZATIONS
1693 //
1694 //=================================================================================================
1695 
1696 //*************************************************************************************************
1698 template< typename MT, bool SO, bool DF >
1699 struct DerestrictTrait< UniLowerMatrix<MT,SO,DF> >
1700 {
1701  using Type = MT&;
1702 };
1704 //*************************************************************************************************
1705 
1706 
1707 
1708 
1709 //=================================================================================================
1710 //
1711 // ADDTRAIT SPECIALIZATIONS
1712 //
1713 //=================================================================================================
1714 
1715 //*************************************************************************************************
1717 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1718 struct AddTrait< UniLowerMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
1719 {
1720  using Type = AddTrait_< MT, StaticMatrix<T,M,N,SO2> >;
1721 };
1722 
1723 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1724 struct AddTrait< StaticMatrix<T,M,N,SO1>, UniLowerMatrix<MT,SO2,DF> >
1725 {
1726  using Type = AddTrait_< StaticMatrix<T,M,N,SO1>, MT >;
1727 };
1728 
1729 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1730 struct AddTrait< UniLowerMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
1731 {
1732  using Type = AddTrait_< MT, HybridMatrix<T,M,N,SO2> >;
1733 };
1734 
1735 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1736 struct AddTrait< HybridMatrix<T,M,N,SO1>, UniLowerMatrix<MT,SO2,DF> >
1737 {
1738  using Type = AddTrait_< HybridMatrix<T,M,N,SO1>, MT >;
1739 };
1740 
1741 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1742 struct AddTrait< UniLowerMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
1743 {
1744  using Type = AddTrait_< MT, DynamicMatrix<T,SO2> >;
1745 };
1746 
1747 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1748 struct AddTrait< DynamicMatrix<T,SO1>, UniLowerMatrix<MT,SO2,DF> >
1749 {
1750  using Type = AddTrait_< DynamicMatrix<T,SO1>, MT >;
1751 };
1752 
1753 template< typename MT, bool SO1, bool DF, typename T, bool AF, bool PF, bool SO2 >
1754 struct AddTrait< UniLowerMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
1755 {
1756  using Type = AddTrait_< MT, CustomMatrix<T,AF,PF,SO2> >;
1757 };
1758 
1759 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF >
1760 struct AddTrait< CustomMatrix<T,AF,PF,SO1>, UniLowerMatrix<MT,SO2,DF> >
1761 {
1762  using Type = AddTrait_< CustomMatrix<T,AF,PF,SO1>, MT >;
1763 };
1764 
1765 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1766 struct AddTrait< UniLowerMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
1767 {
1768  using Type = AddTrait_< MT, CompressedMatrix<T,SO2> >;
1769 };
1770 
1771 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1772 struct AddTrait< CompressedMatrix<T,SO1>, UniLowerMatrix<MT,SO2,DF> >
1773 {
1774  using Type = AddTrait_< CompressedMatrix<T,SO1>, MT >;
1775 };
1776 
1777 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
1778 struct AddTrait< UniLowerMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
1779 {
1780  using Type = AddTrait_<MT1,MT2>;
1781 };
1782 
1783 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
1784 struct AddTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, UniLowerMatrix<MT2,SO2,DF2> >
1785 {
1786  using Type = AddTrait_<MT1,MT2>;
1787 };
1788 
1789 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1790 struct AddTrait< UniLowerMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
1791 {
1792  using Type = AddTrait_<MT1,MT2>;
1793 };
1794 
1795 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1796 struct AddTrait< HermitianMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
1797 {
1798  using Type = AddTrait_<MT1,MT2>;
1799 };
1800 
1801 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1802 struct AddTrait< UniLowerMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1803 {
1804  using Type = LowerMatrix< AddTrait_<MT1,MT2> >;
1805 };
1806 
1807 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1808 struct AddTrait< LowerMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
1809 {
1810  using Type = LowerMatrix< AddTrait_<MT1,MT2> >;
1811 };
1812 
1813 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1814 struct AddTrait< UniLowerMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
1815 {
1816  using Type = LowerMatrix< AddTrait_<MT1,MT2> >;
1817 };
1819 //*************************************************************************************************
1820 
1821 
1822 
1823 
1824 //=================================================================================================
1825 //
1826 // SUBTRAIT SPECIALIZATIONS
1827 //
1828 //=================================================================================================
1829 
1830 //*************************************************************************************************
1832 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1833 struct SubTrait< UniLowerMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
1834 {
1835  using Type = SubTrait_< MT, StaticMatrix<T,M,N,SO2> >;
1836 };
1837 
1838 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1839 struct SubTrait< StaticMatrix<T,M,N,SO1>, UniLowerMatrix<MT,SO2,DF> >
1840 {
1841  using Type = SubTrait_< StaticMatrix<T,M,N,SO1>, MT >;
1842 };
1843 
1844 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
1845 struct SubTrait< UniLowerMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
1846 {
1847  using Type = SubTrait_< MT, HybridMatrix<T,M,N,SO2> >;
1848 };
1849 
1850 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
1851 struct SubTrait< HybridMatrix<T,M,N,SO1>, UniLowerMatrix<MT,SO2,DF> >
1852 {
1853  using Type = SubTrait_< HybridMatrix<T,M,N,SO1>, MT >;
1854 };
1855 
1856 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1857 struct SubTrait< UniLowerMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
1858 {
1859  using Type = SubTrait_< MT, DynamicMatrix<T,SO2> >;
1860 };
1861 
1862 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1863 struct SubTrait< DynamicMatrix<T,SO1>, UniLowerMatrix<MT,SO2,DF> >
1864 {
1865  using Type = SubTrait_< DynamicMatrix<T,SO1>, MT >;
1866 };
1867 
1868 template< typename MT, bool SO1, bool DF, typename T, bool AF, bool PF, bool SO2 >
1869 struct SubTrait< UniLowerMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
1870 {
1871  using Type = SubTrait_< MT, CustomMatrix<T,AF,PF,SO2> >;
1872 };
1873 
1874 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF >
1875 struct SubTrait< CustomMatrix<T,AF,PF,SO1>, UniLowerMatrix<MT,SO2,DF> >
1876 {
1877  using Type = SubTrait_< CustomMatrix<T,AF,PF,SO1>, MT >;
1878 };
1879 
1880 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
1881 struct SubTrait< UniLowerMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
1882 {
1883  using Type = SubTrait_< MT, CompressedMatrix<T,SO2> >;
1884 };
1885 
1886 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
1887 struct SubTrait< CompressedMatrix<T,SO1>, UniLowerMatrix<MT,SO2,DF> >
1888 {
1889  using Type = SubTrait_< CompressedMatrix<T,SO1>, MT >;
1890 };
1891 
1892 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
1893 struct SubTrait< UniLowerMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
1894 {
1895  using Type = SubTrait_<MT1,MT2>;
1896 };
1897 
1898 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
1899 struct SubTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, UniLowerMatrix<MT2,SO2,DF2> >
1900 {
1901  using Type = SubTrait_<MT1,MT2>;
1902 };
1903 
1904 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1905 struct SubTrait< UniLowerMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
1906 {
1907  using Type = SubTrait_<MT1,MT2>;
1908 };
1909 
1910 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1911 struct SubTrait< HermitianMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
1912 {
1913  using Type = SubTrait_<MT1,MT2>;
1914 };
1915 
1916 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1917 struct SubTrait< UniLowerMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
1918 {
1919  using Type = LowerMatrix< SubTrait_<MT1,MT2> >;
1920 };
1921 
1922 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1923 struct SubTrait< LowerMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
1924 {
1925  using Type = LowerMatrix< SubTrait_<MT1,MT2> >;
1926 };
1927 
1928 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
1929 struct SubTrait< UniLowerMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
1930 {
1931  using Type = LowerMatrix< SubTrait_<MT1,MT2> >;
1932 };
1934 //*************************************************************************************************
1935 
1936 
1937 
1938 
1939 //=================================================================================================
1940 //
1941 // MULTTRAIT SPECIALIZATIONS
1942 //
1943 //=================================================================================================
1944 
1945 //*************************************************************************************************
1947 template< typename MT, bool SO, bool DF, typename T >
1948 struct MultTrait< UniLowerMatrix<MT,SO,DF>, T, EnableIf_< IsNumeric<T> > >
1949 {
1950  using Type = LowerMatrix< MultTrait_<MT,T> >;
1951 };
1952 
1953 template< typename T, typename MT, bool SO, bool DF >
1954 struct MultTrait< T, UniLowerMatrix<MT,SO,DF>, EnableIf_< IsNumeric<T> > >
1955 {
1956  using Type = LowerMatrix< MultTrait_<T,MT> >;
1957 };
1958 
1959 template< typename MT, bool SO, bool DF, typename T, size_t N >
1960 struct MultTrait< UniLowerMatrix<MT,SO,DF>, StaticVector<T,N,false> >
1961 {
1962  using Type = MultTrait_< MT, StaticVector<T,N,false> >;
1963 };
1964 
1965 template< typename T, size_t N, typename MT, bool SO, bool DF >
1966 struct MultTrait< StaticVector<T,N,true>, UniLowerMatrix<MT,SO,DF> >
1967 {
1968  using Type = MultTrait_< StaticVector<T,N,true>, MT >;
1969 };
1970 
1971 template< typename MT, bool SO, bool DF, typename T, size_t N >
1972 struct MultTrait< UniLowerMatrix<MT,SO,DF>, HybridVector<T,N,false> >
1973 {
1974  using Type = MultTrait_< MT, HybridVector<T,N,false> >;
1975 };
1976 
1977 template< typename T, size_t N, typename MT, bool SO, bool DF >
1978 struct MultTrait< HybridVector<T,N,true>, UniLowerMatrix<MT,SO,DF> >
1979 {
1980  using Type = MultTrait_< HybridVector<T,N,true>, MT >;
1981 };
1982 
1983 template< typename MT, bool SO, bool DF, typename T >
1984 struct MultTrait< UniLowerMatrix<MT,SO,DF>, DynamicVector<T,false> >
1985 {
1986  using Type = MultTrait_< MT, DynamicVector<T,false> >;
1987 };
1988 
1989 template< typename T, typename MT, bool SO, bool DF >
1990 struct MultTrait< DynamicVector<T,true>, UniLowerMatrix<MT,SO,DF> >
1991 {
1992  using Type = MultTrait_< DynamicVector<T,true>, MT >;
1993 };
1994 
1995 template< typename MT, bool SO, bool DF, typename T, bool AF, bool PF >
1996 struct MultTrait< UniLowerMatrix<MT,SO,DF>, CustomVector<T,AF,PF,false> >
1997 {
1998  using Type = MultTrait_< MT, CustomVector<T,AF,PF,false> >;
1999 };
2000 
2001 template< typename T, bool AF, bool PF, typename MT, bool SO, bool DF >
2002 struct MultTrait< CustomVector<T,AF,PF,true>, UniLowerMatrix<MT,SO,DF> >
2003 {
2004  using Type = MultTrait_< CustomVector<T,AF,PF,true>, MT >;
2005 };
2006 
2007 template< typename MT, bool SO, bool DF, typename T >
2008 struct MultTrait< UniLowerMatrix<MT,SO,DF>, CompressedVector<T,false> >
2009 {
2010  using Type = MultTrait_< MT, CompressedVector<T,false> >;
2011 };
2012 
2013 template< typename T, typename MT, bool SO, bool DF >
2014 struct MultTrait< CompressedVector<T,true>, UniLowerMatrix<MT,SO,DF> >
2015 {
2016  using Type = MultTrait_< CompressedVector<T,true>, MT >;
2017 };
2018 
2019 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
2020 struct MultTrait< UniLowerMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
2021 {
2022  using Type = MultTrait_< MT, StaticMatrix<T,M,N,SO2> >;
2023 };
2024 
2025 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
2026 struct MultTrait< StaticMatrix<T,M,N,SO1>, UniLowerMatrix<MT,SO2,DF> >
2027 {
2028  using Type = MultTrait_< StaticMatrix<T,M,N,SO1>, MT >;
2029 };
2030 
2031 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
2032 struct MultTrait< UniLowerMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
2033 {
2034  using Type = MultTrait_< MT, HybridMatrix<T,M,N,SO2> >;
2035 };
2036 
2037 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
2038 struct MultTrait< HybridMatrix<T,M,N,SO1>, UniLowerMatrix<MT,SO2,DF> >
2039 {
2040  using Type = MultTrait_< HybridMatrix<T,M,N,SO1>, MT >;
2041 };
2042 
2043 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
2044 struct MultTrait< UniLowerMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
2045 {
2046  using Type = MultTrait_< MT, DynamicMatrix<T,SO2> >;
2047 };
2048 
2049 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
2050 struct MultTrait< DynamicMatrix<T,SO1>, UniLowerMatrix<MT,SO2,DF> >
2051 {
2052  using Type = MultTrait_< DynamicMatrix<T,SO1>, MT >;
2053 };
2054 
2055 template< typename MT, bool SO1, bool DF, typename T, bool AF, bool PF, bool SO2 >
2056 struct MultTrait< UniLowerMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
2057 {
2058  using Type = MultTrait_< MT, CustomMatrix<T,AF,PF,SO2> >;
2059 };
2060 
2061 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF >
2062 struct MultTrait< CustomMatrix<T,AF,PF,SO1>, UniLowerMatrix<MT,SO2,DF> >
2063 {
2064  using Type = MultTrait_< CustomMatrix<T,AF,PF,SO1>, MT >;
2065 };
2066 
2067 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
2068 struct MultTrait< UniLowerMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
2069 {
2070  using Type = MultTrait_< MT, CompressedMatrix<T,SO2> >;
2071 };
2072 
2073 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
2074 struct MultTrait< CompressedMatrix<T,SO1>, UniLowerMatrix<MT,SO2,DF> >
2075 {
2076  using Type = MultTrait_< CompressedMatrix<T,SO1>, MT >;
2077 };
2078 
2079 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
2080 struct MultTrait< UniLowerMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
2081 {
2082  using Type = MultTrait_<MT1,MT2>;
2083 };
2084 
2085 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
2086 struct MultTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, UniLowerMatrix<MT2,SO2,DF2> >
2087 {
2088  using Type = MultTrait_<MT1,MT2>;
2089 };
2090 
2091 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2092 struct MultTrait< UniLowerMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
2093 {
2094  using Type = MultTrait_<MT1,MT2>;
2095 };
2096 
2097 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2098 struct MultTrait< HermitianMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2099 {
2100  using Type = MultTrait_<MT1,MT2>;
2101 };
2102 
2103 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2104 struct MultTrait< UniLowerMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
2105 {
2106  using Type = LowerMatrix< MultTrait_<MT1,MT2> >;
2107 };
2108 
2109 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2110 struct MultTrait< LowerMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2111 {
2112  using Type = LowerMatrix< MultTrait_<MT1,MT2> >;
2113 };
2114 
2115 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2116 struct MultTrait< UniLowerMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2117 {
2118  using Type = UniLowerMatrix< MultTrait_<MT1,MT2> >;
2119 };
2121 //*************************************************************************************************
2122 
2123 
2124 
2125 
2126 //=================================================================================================
2127 //
2128 // DIVTRAIT SPECIALIZATIONS
2129 //
2130 //=================================================================================================
2131 
2132 //*************************************************************************************************
2134 template< typename MT, bool SO, bool DF, typename T >
2135 struct DivTrait< UniLowerMatrix<MT,SO,DF>, T, EnableIf_< IsNumeric<T> > >
2136 {
2137  using Type = LowerMatrix< DivTrait_<MT,T> >;
2138 };
2140 //*************************************************************************************************
2141 
2142 
2143 
2144 
2145 //=================================================================================================
2146 //
2147 // FOREACHTRAIT SPECIALIZATIONS
2148 //
2149 //=================================================================================================
2150 
2151 //*************************************************************************************************
2153 template< typename MT, bool SO, bool DF, typename ET >
2154 struct ForEachTrait< UniLowerMatrix<MT,SO,DF>, Pow<ET> >
2155 {
2156  using Type = UniLowerMatrix< ForEachTrait_< MT, Pow<ET> > >;
2157 };
2159 //*************************************************************************************************
2160 
2161 
2162 
2163 
2164 //=================================================================================================
2165 //
2166 // MATHTRAIT SPECIALIZATIONS
2167 //
2168 //=================================================================================================
2169 
2170 //*************************************************************************************************
2172 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2173 struct MathTrait< UniLowerMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2174 {
2175  using HighType = UniLowerMatrix< typename MathTrait<MT1,MT2>::HighType >;
2176  using LowType = UniLowerMatrix< typename MathTrait<MT1,MT2>::LowType >;
2177 };
2179 //*************************************************************************************************
2180 
2181 
2182 
2183 
2184 //=================================================================================================
2185 //
2186 // SUBMATRIXTRAIT SPECIALIZATIONS
2187 //
2188 //=================================================================================================
2189 
2190 //*************************************************************************************************
2192 template< typename MT, bool SO, bool DF >
2193 struct SubmatrixTrait< UniLowerMatrix<MT,SO,DF> >
2194 {
2195  using Type = SubmatrixTrait_<MT>;
2196 };
2198 //*************************************************************************************************
2199 
2200 
2201 
2202 
2203 //=================================================================================================
2204 //
2205 // ROWTRAIT SPECIALIZATIONS
2206 //
2207 //=================================================================================================
2208 
2209 //*************************************************************************************************
2211 template< typename MT, bool SO, bool DF >
2212 struct RowTrait< UniLowerMatrix<MT,SO,DF> >
2213 {
2214  using Type = RowTrait_<MT>;
2215 };
2217 //*************************************************************************************************
2218 
2219 
2220 
2221 
2222 //=================================================================================================
2223 //
2224 // COLUMNTRAIT SPECIALIZATIONS
2225 //
2226 //=================================================================================================
2227 
2228 //*************************************************************************************************
2230 template< typename MT, bool SO, bool DF >
2231 struct ColumnTrait< UniLowerMatrix<MT,SO,DF> >
2232 {
2233  using Type = ColumnTrait_<MT>;
2234 };
2236 //*************************************************************************************************
2237 
2238 } // namespace blaze
2239 
2240 #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
bool isOne(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is 1.
Definition: DiagonalProxy.h:635
Header file for the implementation of the base template of the UniLowerMatrix.
Header file for auxiliary alias declarations.
Header file for mathematical functions.
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
Header file for the row trait.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
Header file for the dense matrix inversion flags.
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:188
Flag for the inversion of a diagonal matrix.
Definition: InversionFlag.h:115
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
Flag for the inversion of a general matrix (same as byLU).
Definition: InversionFlag.h:108
Flag for the inversion of a upper unitriangular matrix.
Definition: InversionFlag.h:114
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1669
#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
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
Flag for the inversion of a upper triangular matrix.
Definition: InversionFlag.h:113
Constraint on the data type.
Header file for the IsUniLower type trait.
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT > >, ColumnExprTrait_< MT > > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:126
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Constraint on the data type.
Header file for the IsSquare type trait.
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:741
Constraint on the data type.
Flag for the LU-based matrix inversion.
Definition: InversionFlag.h:103
Header file for the multiplication trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
UniLowerMatrix specialization for dense matrices.
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
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:219
Header file for the Columns type trait.
Header file for the implementation of a fixed-size matrix.
Header file for the IsAligned type trait.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:330
#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
UniLowerMatrix specialization for sparse matrices.
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:538
BLAZE_ALWAYS_INLINE 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:254
Header file for the RemoveAdaptor type trait.
Constraint on the data type.
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
Header file for the IsPadded type trait.
Header file for the IsAdaptor type trait.
Header file for the isOne shim.
InversionFlag
Inversion flag.The InversionFlag type enumeration represents the different types of matrix inversion ...
Definition: InversionFlag.h:101
Header file for the DerestrictTrait class template.
Flag for the inversion of a lower triangular matrix.
Definition: InversionFlag.h:111
Constraint on the data type.
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
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT > >, RowExprTrait_< MT > > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:126
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
Header file for run time assertion macros.
Header file for the addition trait.
Header file for the division trait.
Header file for the submatrix trait.
Constraint on the data type.
#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 column 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:258
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a BLAS compatible data type (i...
Definition: BLASCompatible.h:61
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
Header file for the mathematical trait.
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:314
Header file for the implementation of the base template of the LowerMatrix.
Header file for the for-each trait.
Header file for the IntegralConstant class template.
Matrix adapter for lower unitriangular matrices.
Definition: Forward.h:53
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:240
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Flag for the inversion of a lower unitriangular matrix.
Definition: InversionFlag.h:112
Header file for the IsResizable type trait.
Header file for the IsRestricted 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 TrueType type/value trait base class.
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is an identity matrix.
Definition: DenseMatrix.h:1593