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