Submatrix.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_SUBMATRIX_H_
36 #define _BLAZE_MATH_VIEWS_SUBMATRIX_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
48 #include <blaze/math/Functions.h>
87 #include <blaze/util/DisableIf.h>
88 #include <blaze/util/EnableIf.h>
91 #include <blaze/util/mpl/Or.h>
92 #include <blaze/util/TrueType.h>
93 #include <blaze/util/Types.h>
95 
96 
97 namespace blaze {
98 
99 //=================================================================================================
100 //
101 // GLOBAL FUNCTION
102 //
103 //=================================================================================================
104 
105 //*************************************************************************************************
164 template< typename MT // Type of the dense matrix
165  , bool SO > // Storage order
166 inline SubmatrixExprTrait_<MT,unaligned>
167  submatrix( Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
168 {
170 
171  return submatrix<unaligned>( ~matrix, row, column, m, n );
172 }
173 //*************************************************************************************************
174 
175 
176 //*************************************************************************************************
234 template< typename MT // Type of the dense matrix
235  , bool SO > // Storage order
236 inline const SubmatrixExprTrait_<const MT,unaligned>
237  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
238 {
240 
241  return submatrix<unaligned>( ~matrix, row, column, m, n );
242 }
243 //*************************************************************************************************
244 
245 
246 //*************************************************************************************************
264 template< typename MT // Type of the dense matrix
265  , bool SO > // Storage order
266 inline SubmatrixExprTrait_<MT,unaligned>
267  submatrix( Matrix<MT,SO>&& matrix, size_t row, size_t column, size_t m, size_t n )
268 {
270 
271  return submatrix<unaligned>( ~matrix, row, column, m, n );
272 }
273 //*************************************************************************************************
274 
275 
276 //*************************************************************************************************
350 template< bool AF // Alignment flag
351  , typename MT // Type of the dense matrix
352  , bool SO > // Storage order
353 inline DisableIf_< Or< IsComputation<MT>, IsTransExpr<MT> >, SubmatrixExprTrait_<MT,AF> >
354  submatrix( Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
355 {
357 
358  return SubmatrixExprTrait_<MT,AF>( ~matrix, row, column, m, n );
359 }
360 //*************************************************************************************************
361 
362 
363 //*************************************************************************************************
435 template< bool AF // Alignment flag
436  , typename MT // Type of the dense matrix
437  , bool SO > // Storage order
438 inline const DisableIf_< Or< IsComputation<MT>, IsTransExpr<MT> >, SubmatrixExprTrait_<const MT,AF> >
439  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
440 {
442 
443  return SubmatrixExprTrait_<const MT,AF>( ~matrix, row, column, m, n );
444 }
445 //*************************************************************************************************
446 
447 
448 //*************************************************************************************************
467 template< bool AF // Alignment flag
468  , typename MT // Type of the dense matrix
469  , bool SO > // Storage order
470 inline DisableIf_< Or< IsComputation<MT>, IsTransExpr<MT> >, SubmatrixExprTrait_<MT,AF> >
471  submatrix( Matrix<MT,SO>&& matrix, size_t row, size_t column, size_t m, size_t n )
472 {
474 
475  return SubmatrixExprTrait_<MT,AF>( ~matrix, row, column, m, n );
476 }
477 //*************************************************************************************************
478 
479 
480 
481 
482 //=================================================================================================
483 //
484 // GLOBAL RESTRUCTURING OPERATORS
485 //
486 //=================================================================================================
487 
488 //*************************************************************************************************
501 template< bool AF // Alignment flag
502  , typename VT // Type of the vector
503  , bool TF > // Transpose flag
504 inline const EnableIf_< IsMatVecMultExpr<VT>, SubvectorExprTrait_<VT,AF> >
505  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
506 {
508 
509  typedef RemoveReference_< LeftOperand_<VT> > MT;
510 
511  LeftOperand_<VT> left ( (~vector).leftOperand() );
512  RightOperand_<VT> right( (~vector).rightOperand() );
513 
514  const size_t column( ( IsUpper<MT>::value )
515  ?( ( !AF && IsStrictlyUpper<MT>::value )?( index + 1UL ):( index ) )
516  :( 0UL ) );
517  const size_t n( ( IsLower<MT>::value )
518  ?( ( IsUpper<MT>::value )?( size )
519  :( ( IsStrictlyLower<MT>::value && size > 0UL )
520  ?( index + size - 1UL )
521  :( index + size ) ) )
522  :( ( IsUpper<MT>::value )?( left.columns() - column )
523  :( left.columns() ) ) );
524 
525  return submatrix<AF>( left, index, column, size, n ) * subvector<AF>( right, column, n );
526 }
528 //*************************************************************************************************
529 
530 
531 //*************************************************************************************************
544 template< bool AF // Alignment flag
545  , typename VT // Type of the vector
546  , bool TF > // Transpose flag
547 inline const EnableIf_< IsTVecMatMultExpr<VT>, SubvectorExprTrait_<VT,AF> >
548  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
549 {
551 
552  typedef RemoveReference_< RightOperand_<VT> > MT;
553 
554  LeftOperand_<VT> left ( (~vector).leftOperand() );
555  RightOperand_<VT> right( (~vector).rightOperand() );
556 
557  const size_t row( ( IsLower<MT>::value )
558  ?( ( !AF && IsStrictlyLower<MT>::value )?( index + 1UL ):( index ) )
559  :( 0UL ) );
560  const size_t m( ( IsUpper<MT>::value )
561  ?( ( IsLower<MT>::value )?( size )
562  :( ( IsStrictlyUpper<MT>::value && size > 0UL )
563  ?( index + size - 1UL )
564  :( index + size ) ) )
565  :( ( IsLower<MT>::value )?( right.rows() - row )
566  :( right.rows() ) ) );
567 
568  return subvector<AF>( left, row, m ) * submatrix<AF>( right, row, index, m, size );
569 }
571 //*************************************************************************************************
572 
573 
574 //*************************************************************************************************
589 template< bool AF // Alignment flag
590  , typename MT // Type of the matrix
591  , bool SO > // Storage order
592 inline const EnableIf_< IsMatMatAddExpr<MT>, SubmatrixExprTrait_<MT,AF> >
593  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
594 {
596 
597  return submatrix<AF>( (~matrix).leftOperand() , row, column, m, n ) +
598  submatrix<AF>( (~matrix).rightOperand(), row, column, m, n );
599 }
601 //*************************************************************************************************
602 
603 
604 //*************************************************************************************************
619 template< bool AF // Alignment flag
620  , typename MT // Type of the matrix
621  , bool SO > // Storage order
622 inline const EnableIf_< IsMatMatSubExpr<MT>, SubmatrixExprTrait_<MT,AF> >
623  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
624 {
626 
627  return submatrix<AF>( (~matrix).leftOperand() , row, column, m, n ) -
628  submatrix<AF>( (~matrix).rightOperand(), row, column, m, n );
629 }
631 //*************************************************************************************************
632 
633 
634 //*************************************************************************************************
649 template< bool AF // Alignment flag
650  , typename MT // Type of the matrix
651  , bool SO > // Storage order
652 inline const EnableIf_< IsMatMatMultExpr<MT>, SubmatrixExprTrait_<MT,AF> >
653  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
654 {
656 
657  typedef RemoveReference_< LeftOperand_<MT> > MT1;
658  typedef RemoveReference_< RightOperand_<MT> > MT2;
659 
660  LeftOperand_<MT> left ( (~matrix).leftOperand() );
661  RightOperand_<MT> right( (~matrix).rightOperand() );
662 
663  const size_t begin( max( ( IsUpper<MT1>::value )
664  ?( ( !AF && IsStrictlyUpper<MT1>::value )?( row + 1UL ):( row ) )
665  :( 0UL )
666  , ( IsLower<MT2>::value )
667  ?( ( !AF && IsStrictlyLower<MT2>::value )?( column + 1UL ):( column ) )
668  :( 0UL ) ) );
669  const size_t end( min( ( IsLower<MT1>::value )
670  ?( ( IsStrictlyLower<MT1>::value && m > 0UL )?( row + m - 1UL ):( row + m ) )
671  :( left.columns() )
672  , ( IsUpper<MT2>::value )
673  ?( ( IsStrictlyUpper<MT2>::value && n > 0UL )?( column + n - 1UL ):( column + n ) )
674  :( left.columns() ) ) );
675 
676  const size_t diff( ( begin < end )?( end - begin ):( 0UL ) );
677 
678  return submatrix<AF>( left, row, begin, m, diff ) *
679  submatrix<AF>( right, begin, column, diff, n );
680 }
682 //*************************************************************************************************
683 
684 
685 //*************************************************************************************************
700 template< bool AF // Alignment flag
701  , typename MT // Type of the matrix
702  , bool SO > // Storage order
703 inline const EnableIf_< IsVecTVecMultExpr<MT>, SubmatrixExprTrait_<MT,AF> >
704  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
705 {
707 
708  return subvector<AF>( (~matrix).leftOperand(), row, m ) *
709  subvector<AF>( (~matrix).rightOperand(), column, n );
710 }
712 //*************************************************************************************************
713 
714 
715 //*************************************************************************************************
730 template< bool AF // Alignment flag
731  , typename MT // Type of the matrix
732  , bool SO > // Storage order
733 inline const EnableIf_< IsMatScalarMultExpr<MT>, SubmatrixExprTrait_<MT,AF> >
734  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
735 {
737 
738  return submatrix<AF>( (~matrix).leftOperand(), row, column, m, n ) * (~matrix).rightOperand();
739 }
741 //*************************************************************************************************
742 
743 
744 //*************************************************************************************************
759 template< bool AF // Alignment flag
760  , typename MT // Type of the matrix
761  , bool SO > // Storage order
762 inline const EnableIf_< IsMatScalarDivExpr<MT>, SubmatrixExprTrait_<MT,AF> >
763  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
764 {
766 
767  return submatrix<AF>( (~matrix).leftOperand(), row, column, m, n ) / (~matrix).rightOperand();
768 }
770 //*************************************************************************************************
771 
772 
773 //*************************************************************************************************
788 template< bool AF // Alignment flag
789  , typename MT // Type of the matrix
790  , bool SO > // Storage order
791 inline const EnableIf_< IsMatForEachExpr<MT>, SubmatrixExprTrait_<MT,AF> >
792  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
793 {
795 
796  return forEach( submatrix<AF>( (~matrix).operand(), row, column, m, n ), (~matrix).operation() );
797 }
799 //*************************************************************************************************
800 
801 
802 //*************************************************************************************************
817 template< bool AF // Alignment flag
818  , typename MT // Type of the matrix
819  , bool SO > // Storage order
820 inline const EnableIf_< IsMatEvalExpr<MT>, SubmatrixExprTrait_<MT,AF> >
821  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
822 {
824 
825  return eval( submatrix<AF>( (~matrix).operand(), row, column, m, n ) );
826 }
828 //*************************************************************************************************
829 
830 
831 //*************************************************************************************************
846 template< bool AF // Alignment flag
847  , typename MT // Type of the matrix
848  , bool SO > // Storage order
849 inline const EnableIf_< IsMatSerialExpr<MT>, SubmatrixExprTrait_<MT,AF> >
850  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
851 {
853 
854  return serial( submatrix<AF>( (~matrix).operand(), row, column, m, n ) );
855 }
857 //*************************************************************************************************
858 
859 
860 //*************************************************************************************************
875 template< bool AF // Alignment flag
876  , typename MT // Type of the matrix
877  , bool SO > // Storage order
878 inline const EnableIf_< IsMatTransExpr<MT>, SubmatrixExprTrait_<MT,AF> >
879  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
880 {
882 
883  return trans( submatrix<AF>( (~matrix).operand(), column, row, n, m ) );
884 }
886 //*************************************************************************************************
887 
888 
889 //*************************************************************************************************
903 template< bool AF1 // Required alignment flag
904  , typename MT // Type of the sparse submatrix
905  , bool AF2 // Present alignment flag
906  , bool SO // Storage order
907  , bool DF > // Density flag
908 inline const Submatrix<MT,AF1,SO,DF>
909  submatrix( const Submatrix<MT,AF2,SO,DF>& sm, size_t row, size_t column, size_t m, size_t n )
910 {
912 
913  if( ( row + m > sm.rows() ) || ( column + n > sm.columns() ) ) {
914  BLAZE_THROW_INVALID_ARGUMENT( "Invalid submatrix specification" );
915  }
916 
917  return Submatrix<MT,AF1,SO,DF>( sm.matrix_, sm.row_ + row, sm.column_ + column, m, n );
918 }
920 //*************************************************************************************************
921 
922 
923 
924 
925 //=================================================================================================
926 //
927 // SUBMATRIX OPERATORS
928 //
929 //=================================================================================================
930 
931 //*************************************************************************************************
934 template< typename MT, bool AF, bool SO, bool DF >
935 inline void reset( Submatrix<MT,AF,SO,DF>& sm );
936 
937 template< typename MT, bool AF, bool SO, bool DF >
938 inline void reset( Submatrix<MT,AF,SO,DF>& sm, size_t i );
939 
940 template< typename MT, bool AF, bool SO, bool DF >
941 inline void clear( Submatrix<MT,AF,SO,DF>& sm );
942 
943 template< typename MT, bool AF, bool SO, bool DF >
944 inline bool isDefault( const Submatrix<MT,AF,SO,DF>& sm );
945 
946 template< typename MT, bool AF, bool SO, bool DF >
947 inline bool isIntact( const Submatrix<MT,AF,SO,DF>& sm ) noexcept;
948 
949 template< typename MT, bool AF, bool SO, bool DF >
950 inline bool isSymmetric( const Submatrix<MT,AF,SO,DF>& sm );
951 
952 template< typename MT, bool AF, bool SO, bool DF >
953 inline bool isHermitian( const Submatrix<MT,AF,SO,DF>& sm );
954 
955 template< typename MT, bool AF, bool SO, bool DF >
956 inline bool isLower( const Submatrix<MT,AF,SO,DF>& sm );
957 
958 template< typename MT, bool AF, bool SO, bool DF >
959 inline bool isUniLower( const Submatrix<MT,AF,SO,DF>& sm );
960 
961 template< typename MT, bool AF, bool SO, bool DF >
962 inline bool isStrictlyLower( const Submatrix<MT,AF,SO,DF>& sm );
963 
964 template< typename MT, bool AF, bool SO, bool DF >
965 inline bool isUpper( const Submatrix<MT,AF,SO,DF>& sm );
966 
967 template< typename MT, bool AF, bool SO, bool DF >
968 inline bool isUniUpper( const Submatrix<MT,AF,SO,DF>& sm );
969 
970 template< typename MT, bool AF, bool SO, bool DF >
971 inline bool isStrictlyUpper( const Submatrix<MT,AF,SO,DF>& sm );
972 
973 template< typename MT, bool AF, bool SO, bool DF >
974 inline bool isSame( const Submatrix<MT,AF,SO,DF>& a, const Matrix<MT,SO>& b ) noexcept;
975 
976 template< typename MT, bool AF, bool SO, bool DF >
977 inline bool isSame( const Matrix<MT,SO>& a, const Submatrix<MT,AF,SO,DF>& b ) noexcept;
978 
979 template< typename MT, bool AF, bool SO, bool DF >
980 inline bool isSame( const Submatrix<MT,AF,SO,DF>& a, const Submatrix<MT,AF,SO,DF>& b ) noexcept;
982 //*************************************************************************************************
983 
984 
985 //*************************************************************************************************
992 template< typename MT // Type of the matrix
993  , bool AF // Alignment flag
994  , bool SO // Storage order
995  , bool DF > // Density flag
996 inline void reset( Submatrix<MT,AF,SO,DF>& sm )
997 {
998  sm.reset();
999 }
1000 //*************************************************************************************************
1001 
1002 
1003 //*************************************************************************************************
1016 template< typename MT // Type of the matrix
1017  , bool AF // Alignment flag
1018  , bool SO // Storage order
1019  , bool DF > // Density flag
1020 inline void reset( Submatrix<MT,AF,SO,DF>& sm, size_t i )
1021 {
1022  sm.reset( i );
1023 }
1024 //*************************************************************************************************
1025 
1026 
1027 //*************************************************************************************************
1036 template< typename MT // Type of the matrix
1037  , bool AF // Alignment flag
1038  , bool SO // Storage order
1039  , bool DF > // Density flag
1040 inline void clear( Submatrix<MT,AF,SO,DF>& sm )
1041 {
1042  sm.reset();
1043 }
1044 //*************************************************************************************************
1045 
1046 
1047 //*************************************************************************************************
1065 template< typename MT // Type of the matrix
1066  , bool AF // Alignment flag
1067  , bool SO // Storage order
1068  , bool DF > // Density flag
1069 inline bool isDefault( const Submatrix<MT,AF,SO,DF>& sm )
1070 {
1071  using blaze::isDefault;
1072 
1073  if( SO == rowMajor ) {
1074  for( size_t i=0UL; i<(~sm).rows(); ++i )
1075  for( size_t j=0UL; j<(~sm).columns(); ++j )
1076  if( !isDefault( (~sm)(i,j) ) )
1077  return false;
1078  }
1079  else {
1080  for( size_t j=0UL; j<(~sm).columns(); ++j )
1081  for( size_t i=0UL; i<(~sm).rows(); ++i )
1082  if( !isDefault( (~sm)(i,j) ) )
1083  return false;
1084  }
1085 
1086  return true;
1087 }
1088 //*************************************************************************************************
1089 
1090 
1091 //*************************************************************************************************
1110 template< typename MT // Type of the sparse matrix
1111  , bool AF // Alignment flag
1112  , bool SO > // Storage order
1113 inline bool isDefault( const Submatrix<MT,AF,SO,false>& sm )
1114 {
1115  using blaze::isDefault;
1116 
1117  typedef ConstIterator_< Submatrix<MT,AF,SO,false> > ConstIterator;
1118 
1119  const size_t iend( ( SO == rowMajor)?( sm.rows() ):( sm.columns() ) );
1120 
1121  for( size_t i=0UL; i<iend; ++i ) {
1122  for( ConstIterator element=sm.begin(i); element!=sm.end(i); ++element )
1123  if( !isDefault( element->value() ) ) return false;
1124  }
1125 
1126  return true;
1127 }
1129 //*************************************************************************************************
1130 
1131 
1132 //*************************************************************************************************
1150 template< typename MT // Type of the matrix
1151  , bool AF // Alignment flag
1152  , bool SO // Storage order
1153  , bool DF > // Density flag
1154 inline bool isIntact( const Submatrix<MT,AF,SO,DF>& sm ) noexcept
1155 {
1156  return ( sm.row_ + sm.m_ <= sm.matrix_.rows() &&
1157  sm.column_ + sm.n_ <= sm.matrix_.columns() &&
1158  isIntact( sm.matrix_ ) );
1159 }
1160 //*************************************************************************************************
1161 
1162 
1163 //*************************************************************************************************
1185 template< typename MT // Type of the matrix
1186  , bool AF // Alignment flag
1187  , bool SO // Storage order
1188  , bool DF > // Density flag
1189 inline bool isSymmetric( const Submatrix<MT,AF,SO,DF>& sm )
1190 {
1192 
1193  if( IsSymmetric<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1194  return true;
1195  else return isSymmetric( static_cast<const BaseType&>( sm ) );
1196 }
1197 //*************************************************************************************************
1198 
1199 
1200 //*************************************************************************************************
1222 template< typename MT // Type of the matrix
1223  , bool AF // Alignment flag
1224  , bool SO // Storage order
1225  , bool DF > // Density flag
1226 inline bool isHermitian( const Submatrix<MT,AF,SO,DF>& sm )
1227 {
1229 
1230  if( IsHermitian<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1231  return true;
1232  else return isHermitian( static_cast<const BaseType&>( sm ) );
1233 }
1234 //*************************************************************************************************
1235 
1236 
1237 //*************************************************************************************************
1269 template< typename MT // Type of the matrix
1270  , bool AF // Alignment flag
1271  , bool SO // Storage order
1272  , bool DF > // Density flag
1273 inline bool isLower( const Submatrix<MT,AF,SO,DF>& sm )
1274 {
1276 
1277  if( IsLower<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1278  return true;
1279  else return isLower( static_cast<const BaseType&>( sm ) );
1280 }
1281 //*************************************************************************************************
1282 
1283 
1284 //*************************************************************************************************
1315 template< typename MT // Type of the matrix
1316  , bool AF // Alignment flag
1317  , bool SO // Storage order
1318  , bool DF > // Density flag
1319 inline bool isUniLower( const Submatrix<MT,AF,SO,DF>& sm )
1320 {
1322 
1323  if( IsUniLower<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1324  return true;
1325  else return isUniLower( static_cast<const BaseType&>( sm ) );
1326 }
1327 //*************************************************************************************************
1328 
1329 
1330 //*************************************************************************************************
1361 template< typename MT // Type of the matrix
1362  , bool AF // Alignment flag
1363  , bool SO // Storage order
1364  , bool DF > // Density flag
1365 inline bool isStrictlyLower( const Submatrix<MT,AF,SO,DF>& sm )
1366 {
1368 
1369  if( IsStrictlyLower<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1370  return true;
1371  else return isStrictlyLower( static_cast<const BaseType&>( sm ) );
1372 }
1373 //*************************************************************************************************
1374 
1375 
1376 //*************************************************************************************************
1408 template< typename MT // Type of the matrix
1409  , bool AF // Alignment flag
1410  , bool SO // Storage order
1411  , bool DF > // Density flag
1412 inline bool isUpper( const Submatrix<MT,AF,SO,DF>& sm )
1413 {
1415 
1416  if( IsUpper<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1417  return true;
1418  else return isUpper( static_cast<const BaseType&>( sm ) );
1419 }
1420 //*************************************************************************************************
1421 
1422 
1423 //*************************************************************************************************
1454 template< typename MT // Type of the matrix
1455  , bool AF // Alignment flag
1456  , bool SO // Storage order
1457  , bool DF > // Density flag
1458 inline bool isUniUpper( const Submatrix<MT,AF,SO,DF>& sm )
1459 {
1461 
1462  if( IsUniUpper<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1463  return true;
1464  else return isUniUpper( static_cast<const BaseType&>( sm ) );
1465 }
1466 //*************************************************************************************************
1467 
1468 
1469 //*************************************************************************************************
1500 template< typename MT // Type of the matrix
1501  , bool AF // Alignment flag
1502  , bool SO // Storage order
1503  , bool DF > // Density flag
1504 inline bool isStrictlyUpper( const Submatrix<MT,AF,SO,DF>& sm )
1505 {
1507 
1508  if( IsStrictlyUpper<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1509  return true;
1510  else return isStrictlyUpper( static_cast<const BaseType&>( sm ) );
1511 }
1512 //*************************************************************************************************
1513 
1514 
1515 //*************************************************************************************************
1527 template< typename MT // Type of the matrix
1528  , bool AF // Alignment flag
1529  , bool SO // Storage order
1530  , bool DF > // Density flag
1531 inline bool isSame( const Submatrix<MT,AF,SO,DF>& a, const Matrix<MT,SO>& b ) noexcept
1532 {
1533  return ( isSame( a.matrix_, ~b ) && ( a.rows() == (~b).rows() ) && ( a.columns() == (~b).columns() ) );
1534 }
1535 //*************************************************************************************************
1536 
1537 
1538 //*************************************************************************************************
1550 template< typename MT // Type of the matrix
1551  , bool AF // Alignment flag
1552  , bool SO // Storage order
1553  , bool DF > // Density flag
1554 inline bool isSame( const Matrix<MT,SO>& a, const Submatrix<MT,AF,SO,DF>& b ) noexcept
1555 {
1556  return ( isSame( ~a, b.matrix_ ) && ( (~a).rows() == b.rows() ) && ( (~a).columns() == b.columns() ) );
1557 }
1558 //*************************************************************************************************
1559 
1560 
1561 //*************************************************************************************************
1573 template< typename MT // Type of the matrix
1574  , bool AF // Alignment flag
1575  , bool SO // Storage order
1576  , bool DF > // Density flag
1577 inline bool isSame( const Submatrix<MT,AF,SO,DF>& a, const Submatrix<MT,AF,SO,DF>& b ) noexcept
1578 {
1579  return ( isSame( a.matrix_, b.matrix_ ) &&
1580  ( a.row_ == b.row_ ) && ( a.column_ == b.column_ ) &&
1581  ( a.m_ == b.m_ ) && ( a.n_ == b.n_ ) );
1582 }
1583 //*************************************************************************************************
1584 
1585 
1586 //*************************************************************************************************
1619 template< InversionFlag IF // Inversion algorithm
1620  , typename MT // Type of the dense matrix
1621  , bool AF // Alignment flag
1622  , bool SO > // Storage order
1623 inline DisableIf_< HasMutableDataAccess<MT> > invert( Submatrix<MT,AF,SO,true>& sm )
1624 {
1625  typedef ResultType_< Submatrix<MT,AF,SO,true> > RT;
1626 
1629 
1630  RT tmp( sm );
1631  invert<IF>( tmp );
1632  sm = tmp;
1633 }
1635 //*************************************************************************************************
1636 
1637 
1638 //*************************************************************************************************
1654 template< typename MT // Type of the matrix
1655  , bool AF // Alignment flag
1656  , bool SO // Storage order
1657  , bool DF // Density flag
1658  , typename VT // Type of the right-hand side vector
1659  , bool TF > // Transpose flag of the right-hand side vector
1660 inline bool tryAssign( const Submatrix<MT,AF,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1661  size_t row, size_t column )
1662 {
1663  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1664  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1665  BLAZE_INTERNAL_ASSERT( TF || ( (~rhs).size() <= lhs.rows() - row ), "Invalid number of rows" );
1666  BLAZE_INTERNAL_ASSERT( !TF || ( (~rhs).size() <= lhs.columns() - column ), "Invalid number of columns" );
1667 
1668  return tryAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
1669 }
1671 //*************************************************************************************************
1672 
1673 
1674 //*************************************************************************************************
1690 template< typename MT1 // Type of the matrix
1691  , bool AF // Alignment flag
1692  , bool SO1 // Storage order
1693  , bool DF // Density flag
1694  , typename MT2 // Type of the right-hand side matrix
1695  , bool SO2 > // Storage order of the right-hand side matrix
1696 inline bool tryAssign( const Submatrix<MT1,AF,SO1,DF>& lhs, const Matrix<MT2,SO2>& rhs,
1697  size_t row, size_t column )
1698 {
1699  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1700  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1701  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1702  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1703 
1704  return tryAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
1705 }
1707 //*************************************************************************************************
1708 
1709 
1710 //*************************************************************************************************
1726 template< typename MT // Type of the matrix
1727  , bool AF // Alignment flag
1728  , bool SO // Storage order
1729  , bool DF // Density flag
1730  , typename VT // Type of the right-hand side vector
1731  , bool TF > // Transpose flag of the right-hand side vector
1732 inline bool tryAddAssign( const Submatrix<MT,AF,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1733  size_t row, size_t column )
1734 {
1735  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1736  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1737  BLAZE_INTERNAL_ASSERT( TF || ( (~rhs).size() <= lhs.rows() - row ), "Invalid number of rows" );
1738  BLAZE_INTERNAL_ASSERT( !TF || ( (~rhs).size() <= lhs.columns() - column ), "Invalid number of columns" );
1739 
1740  return tryAddAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
1741 }
1743 //*************************************************************************************************
1744 
1745 
1746 //*************************************************************************************************
1762 template< typename MT1 // Type of the matrix
1763  , bool AF // Alignment flag
1764  , bool SO1 // Storage order
1765  , bool DF // Density flag
1766  , typename MT2 // Type of the right-hand side matrix
1767  , bool SO2 > // Storage order of the right-hand side matrix
1768 inline bool tryAddAssign( const Submatrix<MT1,AF,SO1,DF>& lhs, const Matrix<MT2,SO2>& rhs,
1769  size_t row, size_t column )
1770 {
1771  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1772  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1773  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1774  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1775 
1776  return tryAddAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
1777 }
1779 //*************************************************************************************************
1780 
1781 
1782 //*************************************************************************************************
1798 template< typename MT // Type of the matrix
1799  , bool AF // Alignment flag
1800  , bool SO // Storage order
1801  , bool DF // Density flag
1802  , typename VT // Type of the right-hand side vector
1803  , bool TF > // Transpose flag of the right-hand side vector
1804 inline bool trySubAssign( const Submatrix<MT,AF,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1805  size_t row, size_t column )
1806 {
1807  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1808  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1809  BLAZE_INTERNAL_ASSERT( TF || ( (~rhs).size() <= lhs.rows() - row ), "Invalid number of rows" );
1810  BLAZE_INTERNAL_ASSERT( !TF || ( (~rhs).size() <= lhs.columns() - column ), "Invalid number of columns" );
1811 
1812  return trySubAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
1813 }
1815 //*************************************************************************************************
1816 
1817 
1818 //*************************************************************************************************
1834 template< typename MT1 // Type of the matrix
1835  , bool AF // Alignment flag
1836  , bool SO1 // Storage order
1837  , bool DF // Density flag
1838  , typename MT2 // Type of the right-hand side matrix
1839  , bool SO2 > // Storage order of the right-hand side matrix
1840 inline bool trySubAssign( const Submatrix<MT1,AF,SO1,DF>& lhs, const Matrix<MT2,SO2>& rhs,
1841  size_t row, size_t column )
1842 {
1843  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1844  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1845  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1846  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1847 
1848  return trySubAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
1849 }
1851 //*************************************************************************************************
1852 
1853 
1854 //*************************************************************************************************
1870 template< typename MT // Type of the matrix
1871  , bool AF // Alignment flag
1872  , bool SO // Storage order
1873  , bool DF // Density flag
1874  , typename VT // Type of the right-hand side vector
1875  , bool TF > // Transpose flag of the right-hand side vector
1876 inline bool tryMultAssign( const Submatrix<MT,AF,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1877  size_t row, size_t column )
1878 {
1879  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1880  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1881  BLAZE_INTERNAL_ASSERT( TF || ( (~rhs).size() <= lhs.rows() - row ), "Invalid number of rows" );
1882  BLAZE_INTERNAL_ASSERT( !TF || ( (~rhs).size() <= lhs.columns() - column ), "Invalid number of columns" );
1883 
1884  return tryMultAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
1885 }
1887 //*************************************************************************************************
1888 
1889 
1890 //*************************************************************************************************
1905 template< typename MT // Type of the matrix
1906  , bool AF // Alignment flag
1907  , bool SO // Storage order
1908  , bool DF > // Density flag
1909 inline DerestrictTrait_< Submatrix<MT,AF,SO,DF> > derestrict( Submatrix<MT,AF,SO,DF>& dm )
1910 {
1911  typedef DerestrictTrait_< Submatrix<MT,AF,SO,DF> > ReturnType;
1912  return ReturnType( derestrict( dm.matrix_ ), dm.row_, dm.column_, dm.m_, dm.n_ );
1913 }
1915 //*************************************************************************************************
1916 
1917 
1918 
1919 
1920 //=================================================================================================
1921 //
1922 // ISRESTRICTED SPECIALIZATIONS
1923 //
1924 //=================================================================================================
1925 
1926 //*************************************************************************************************
1928 template< typename MT, bool AF, bool SO, bool DF >
1929 struct IsRestricted< Submatrix<MT,AF,SO,DF> >
1930  : public BoolConstant< IsRestricted<MT>::value >
1931 {};
1933 //*************************************************************************************************
1934 
1935 
1936 
1937 
1938 //=================================================================================================
1939 //
1940 // DERESTRICTTRAIT SPECIALIZATIONS
1941 //
1942 //=================================================================================================
1943 
1944 //*************************************************************************************************
1946 template< typename MT, bool AF, bool SO, bool DF >
1947 struct DerestrictTrait< Submatrix<MT,AF,SO,DF> >
1948 {
1949  using Type = Submatrix< RemoveReference_< DerestrictTrait_<MT> >, AF >;
1950 };
1952 //*************************************************************************************************
1953 
1954 
1955 
1956 
1957 //=================================================================================================
1958 //
1959 // HASCONSTDATAACCESS SPECIALIZATIONS
1960 //
1961 //=================================================================================================
1962 
1963 //*************************************************************************************************
1965 template< typename MT, bool AF, bool SO >
1966 struct HasConstDataAccess< Submatrix<MT,AF,SO,true> >
1967  : public BoolConstant< HasConstDataAccess<MT>::value >
1968 {};
1970 //*************************************************************************************************
1971 
1972 
1973 
1974 
1975 //=================================================================================================
1976 //
1977 // HASMUTABLEDATAACCESS SPECIALIZATIONS
1978 //
1979 //=================================================================================================
1980 
1981 //*************************************************************************************************
1983 template< typename MT, bool AF, bool SO >
1984 struct HasMutableDataAccess< Submatrix<MT,AF,SO,true> >
1985  : public BoolConstant< HasMutableDataAccess<MT>::value >
1986 {};
1988 //*************************************************************************************************
1989 
1990 
1991 
1992 
1993 //=================================================================================================
1994 //
1995 // ISALIGNED SPECIALIZATIONS
1996 //
1997 //=================================================================================================
1998 
1999 //*************************************************************************************************
2001 template< typename MT, bool SO >
2002 struct IsAligned< Submatrix<MT,aligned,SO,true> > : public TrueType
2003 {};
2005 //*************************************************************************************************
2006 
2007 
2008 
2009 
2010 //=================================================================================================
2011 //
2012 // ADDTRAIT SPECIALIZATIONS
2013 //
2014 //=================================================================================================
2015 
2016 //*************************************************************************************************
2018 template< typename MT, bool AF, bool SO, bool DF, typename T >
2019 struct AddTrait< Submatrix<MT,AF,SO,DF>, T >
2020 {
2021  using Type = AddTrait_< SubmatrixTrait_<MT>, T >;
2022 };
2023 
2024 template< typename T, typename MT, bool AF, bool SO, bool DF >
2025 struct AddTrait< T, Submatrix<MT,AF,SO,DF> >
2026 {
2027  using Type = AddTrait_< T, SubmatrixTrait_<MT> >;
2028 };
2030 //*************************************************************************************************
2031 
2032 
2033 
2034 
2035 //=================================================================================================
2036 //
2037 // SUBTRAIT SPECIALIZATIONS
2038 //
2039 //=================================================================================================
2040 
2041 //*************************************************************************************************
2043 template< typename MT, bool AF, bool SO, bool DF, typename T >
2044 struct SubTrait< Submatrix<MT,AF,SO,DF>, T >
2045 {
2046  using Type = SubTrait_< SubmatrixTrait_<MT>, T >;
2047 };
2048 
2049 template< typename T, typename MT, bool AF, bool SO, bool DF >
2050 struct SubTrait< T, Submatrix<MT,AF,SO,DF> >
2051 {
2052  using Type = SubTrait_< T, SubmatrixTrait_<MT> >;
2053 };
2055 //*************************************************************************************************
2056 
2057 
2058 
2059 
2060 //=================================================================================================
2061 //
2062 // MULTTRAIT SPECIALIZATIONS
2063 //
2064 //=================================================================================================
2065 
2066 //*************************************************************************************************
2068 template< typename MT, bool AF, bool SO, bool DF, typename T >
2069 struct MultTrait< Submatrix<MT,AF,SO,DF>, T >
2070 {
2071  using Type = MultTrait_< SubmatrixTrait_<MT>, T >;
2072 };
2073 
2074 template< typename T, typename MT, bool AF, bool SO, bool DF >
2075 struct MultTrait< T, Submatrix<MT,AF,SO,DF> >
2076 {
2077  using Type = MultTrait_< T, SubmatrixTrait_<MT> >;
2078 };
2080 //*************************************************************************************************
2081 
2082 
2083 
2084 
2085 //=================================================================================================
2086 //
2087 // DIVTRAIT SPECIALIZATIONS
2088 //
2089 //=================================================================================================
2090 
2091 //*************************************************************************************************
2093 template< typename MT, bool AF, bool SO, bool DF, typename T >
2094 struct DivTrait< Submatrix<MT,AF,SO,DF>, T >
2095 {
2096  using Type = DivTrait_< SubmatrixTrait_<MT>, T >;
2097 };
2098 
2099 template< typename T, typename MT, bool AF, bool DF, bool SO >
2100 struct DivTrait< T, Submatrix<MT,AF,SO,DF> >
2101 {
2102  using Type = DivTrait_< T, SubmatrixTrait_<MT> >;
2103 };
2105 //*************************************************************************************************
2106 
2107 
2108 
2109 
2110 //=================================================================================================
2111 //
2112 // SUBMATRIXTRAIT SPECIALIZATIONS
2113 //
2114 //=================================================================================================
2115 
2116 //*************************************************************************************************
2118 template< typename MT, bool AF, bool SO, bool DF >
2119 struct SubmatrixTrait< Submatrix<MT,AF,SO,DF> >
2120 {
2121  using Type = SubmatrixTrait_< ResultType_< Submatrix<MT,AF,SO,DF> > >;
2122 };
2124 //*************************************************************************************************
2125 
2126 
2127 
2128 
2129 //=================================================================================================
2130 //
2131 // SUBMATRIXEXPRTRAIT SPECIALIZATIONS
2132 //
2133 //=================================================================================================
2134 
2135 //*************************************************************************************************
2137 template< typename MT, bool AF1, bool SO, bool DF, bool AF2 >
2138 struct SubmatrixExprTrait< Submatrix<MT,AF1,SO,DF>, AF2 >
2139 {
2140  using Type = Submatrix<MT,AF2,SO,DF>;
2141 };
2143 //*************************************************************************************************
2144 
2145 
2146 //*************************************************************************************************
2148 template< typename MT, bool AF1, bool SO, bool DF, bool AF2 >
2149 struct SubmatrixExprTrait< const Submatrix<MT,AF1,SO,DF>, AF2 >
2150 {
2151  using Type = Submatrix<MT,AF2,SO,DF>;
2152 };
2154 //*************************************************************************************************
2155 
2156 
2157 //*************************************************************************************************
2159 template< typename MT, bool AF1, bool SO, bool DF, bool AF2 >
2160 struct SubmatrixExprTrait< volatile Submatrix<MT,AF1,SO,DF>, AF2 >
2161 {
2162  using Type = Submatrix<MT,AF2,SO,DF>;
2163 };
2165 //*************************************************************************************************
2166 
2167 
2168 //*************************************************************************************************
2170 template< typename MT, bool AF1, bool SO, bool DF, bool AF2 >
2171 struct SubmatrixExprTrait< const volatile Submatrix<MT,AF1,SO,DF>, AF2 >
2172 {
2173  using Type = Submatrix<MT,AF2,SO,DF>;
2174 };
2176 //*************************************************************************************************
2177 
2178 
2179 
2180 
2181 //=================================================================================================
2182 //
2183 // ROWTRAIT SPECIALIZATIONS
2184 //
2185 //=================================================================================================
2186 
2187 //*************************************************************************************************
2189 template< typename MT, bool AF, bool SO, bool DF >
2190 struct RowTrait< Submatrix<MT,AF,SO,DF> >
2191 {
2192  using Type = RowTrait_< ResultType_< Submatrix<MT,AF,SO,DF> > >;
2193 };
2195 //*************************************************************************************************
2196 
2197 
2198 
2199 
2200 //=================================================================================================
2201 //
2202 // COLUMNTRAIT SPECIALIZATIONS
2203 //
2204 //=================================================================================================
2205 
2206 //*************************************************************************************************
2208 template< typename MT, bool AF, bool SO, bool DF >
2209 struct ColumnTrait< Submatrix<MT,AF,SO,DF> >
2210 {
2211  using Type = ColumnTrait_< ResultType_< Submatrix<MT,AF,SO,DF> > >;
2212 };
2214 //*************************************************************************************************
2215 
2216 } // namespace blaze
2217 
2218 #endif
typename SubmatrixExprTrait< MT, AF >::Type SubmatrixExprTrait_
Auxiliary alias declaration for the SubmatrixExprTrait type trait.The SubmatrixExprTrait_ alias decla...
Definition: SubmatrixExprTrait.h:133
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Header file for mathematical functions.
Header file for the alignment flag values.
Header file for the subtraction trait.
#define BLAZE_CONSTRAINT_MUST_HAVE_MUTABLE_DATA_ACCESS(T)
Constraint on the data type.In case the given data type T does not provide low-level data access to m...
Definition: MutableDataAccess.h:61
BLAZE_ALWAYS_INLINE bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b) noexcept
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:653
Header file for basic type definitions.
Header file for the IsTVecMatMultExpr type trait class.
Header file for the row trait.
bool isStrictlyLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly lower triangular matrix.
Definition: DenseMatrix.h:1192
Header file for the serial shim.
bool isStrictlyUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly upper triangular matrix.
Definition: DenseMatrix.h:1423
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
const bool aligned
Alignment flag for aligned vectors and matrices.Via this flag it is possible to specify subvectors...
Definition: AlignmentFlag.h:85
Header file for the dense matrix inversion flags.
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:689
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
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1669
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:88
Header file for the IsTransExpr type trait class.
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:723
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:88
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
Header file for the IsMatVecMultExpr type trait class.
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1716
Header file for the IsMatMatAddExpr type trait class.
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 isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:1036
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:109
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Header file for the IsMatTransExpr type trait class.
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:741
Submatrix specialization for dense matrices.
SubvectorExprTrait_< VT, unaligned > subvector(Vector< VT, TF > &vector, size_t index, size_t size)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:152
Header file for the implementation of the Subvector view.
Compile time check for upper unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniUpper.h:86
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the IsVecTVecMultExpr type trait class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
Header file for the Or class template.
Header file for the IsMatMatMultExpr type trait class.
Header file for the implementation of the Submatrix base template.
const DMatForEachExpr< MT, OP, SO > forEach(const DenseMatrix< MT, SO > &dm, OP op)
Evaluates the given custom operation on each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1046
Header file for the IsMatSerialExpr type trait class.
Header file for the IsMatScalarMultExpr type trait class.
Header file for the IsLower type trait.
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
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:1267
Compile time check for symmetric matrices.This type trait tests whether or not the given template par...
Definition: IsSymmetric.h:85
Header file for the IsMatEvalExpr type trait class.
Submatrix specialization for sparse matrices.
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
bool isUniLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower unitriangular matrix.
Definition: DenseMatrix.h:1113
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
Constraint on the data type.
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
View on a specific submatrix of a dense or sparse matrix.The Submatrix class template represents a vi...
Definition: Forward.h:49
InversionFlag
Inversion flag.The InversionFlag type enumeration represents the different types of matrix inversion ...
Definition: InversionFlag.h:101
Compile time check for lower unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniLower.h:86
Header file for the DerestrictTrait class template.
Header file for the HasConstDataAccess type trait.
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
Header file for the Matrix base class.
Header file for the SubmatrixExprTrait class template.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2642
Header file for the IsMatScalarDivExpr type trait class.
Header file for the addition trait.
Header file for the division trait.
Header file for the submatrix trait.
Header file for the column trait.
Compile time check for Hermitian matrices.This type trait tests whether or not the given template par...
Definition: IsHermitian.h:85
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:89
Header file for the HasMutableDataAccess type trait.
#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
const DMatEvalExpr< MT, SO > eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:705
Header file for the IsMatMatSubExpr type trait class.
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
Header file for the RemoveReference type trait.
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
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
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:950
const bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
Header file for the IsComputation type trait class.
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:759
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
Header file for the IntegralConstant class template.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:240
Header file for the SubvectorExprTrait class template.
bool isUniUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper unitriangular matrix.
Definition: DenseMatrix.h:1344
Header file for the IsUpper type trait.
SubmatrixExprTrait_< MT, unaligned > submatrix(Matrix< MT, SO > &matrix, size_t row, size_t column, size_t m, size_t n)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:167
Header file for the IsRestricted type trait.
Header file for the IsMatForEachExpr type trait class.
#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.
typename T::BaseType BaseType_
Alias declaration for nested BaseType type definitions.The BaseType_ alias declaration provides a con...
Definition: Aliases.h:63
Header file for the FunctionTrace class.