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>
87 #include <blaze/util/DisableIf.h>
90 #include <blaze/util/TrueType.h>
91 #include <blaze/util/Types.h>
93 
94 
95 namespace blaze {
96 
97 //=================================================================================================
98 //
99 // GLOBAL FUNCTIONS
100 //
101 //=================================================================================================
102 
103 //*************************************************************************************************
162 template< typename MT // Type of the dense matrix
163  , bool SO > // Storage order
164 inline decltype(auto)
165  submatrix( Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
166 {
168 
169  return submatrix<unaligned>( ~matrix, row, column, m, n );
170 }
171 //*************************************************************************************************
172 
173 
174 //*************************************************************************************************
232 template< typename MT // Type of the dense matrix
233  , bool SO > // Storage order
234 inline decltype(auto)
235  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
236 {
238 
239  return submatrix<unaligned>( ~matrix, row, column, m, n );
240 }
241 //*************************************************************************************************
242 
243 
244 //*************************************************************************************************
262 template< typename MT // Type of the dense matrix
263  , bool SO > // Storage order
264 inline decltype(auto)
265  submatrix( Matrix<MT,SO>&& matrix, size_t row, size_t column, size_t m, size_t n )
266 {
268 
269  return submatrix<unaligned>( ~matrix, row, column, m, n );
270 }
271 //*************************************************************************************************
272 
273 
274 //*************************************************************************************************
348 template< bool AF // Alignment flag
349  , typename MT // Type of the dense matrix
350  , bool SO > // Storage order
351 inline Submatrix<MT,AF>
352  submatrix( Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
353 {
355 
356  return Submatrix<MT,AF>( ~matrix, row, column, m, n );
357 }
358 //*************************************************************************************************
359 
360 
361 //*************************************************************************************************
433 template< bool AF // Alignment flag
434  , typename MT // Type of the dense matrix
435  , bool SO > // Storage order
436 inline const Submatrix<const MT,AF>
437  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
438 {
440 
441  return Submatrix<const MT,AF>( ~matrix, row, column, m, n );
442 }
443 //*************************************************************************************************
444 
445 
446 //*************************************************************************************************
465 template< bool AF // Alignment flag
466  , typename MT // Type of the dense matrix
467  , bool SO > // Storage order
468 inline Submatrix<MT,AF>
469  submatrix( Matrix<MT,SO>&& matrix, size_t row, size_t column, size_t m, size_t n )
470 {
472 
473  return Submatrix<MT,AF>( ~matrix, row, column, m, n );
474 }
475 //*************************************************************************************************
476 
477 
478 
479 
480 //=================================================================================================
481 //
482 // GLOBAL RESTRUCTURING FUNCTIONS
483 //
484 //=================================================================================================
485 
486 //*************************************************************************************************
499 template< bool AF // Alignment flag
500  , typename VT > // Vector base type of the expression
501 inline decltype(auto) subvector( const MatVecMultExpr<VT>& vector, size_t index, size_t size )
502 {
504 
506 
507  decltype(auto) left ( (~vector).leftOperand() );
508  decltype(auto) right( (~vector).rightOperand() );
509 
510  const size_t column( ( IsUpper<MT>::value )
511  ?( ( !AF && IsStrictlyUpper<MT>::value )?( index + 1UL ):( index ) )
512  :( 0UL ) );
513  const size_t n( ( IsLower<MT>::value )
514  ?( ( IsUpper<MT>::value )?( size )
515  :( ( IsStrictlyLower<MT>::value && size > 0UL )
516  ?( index + size - 1UL )
517  :( index + size ) ) )
518  :( ( IsUpper<MT>::value )?( left.columns() - column )
519  :( left.columns() ) ) );
520 
521  return submatrix<AF>( left, index, column, size, n ) * subvector<AF>( right, column, n );
522 }
524 //*************************************************************************************************
525 
526 
527 //*************************************************************************************************
540 template< bool AF // Alignment flag
541  , typename VT > // Vector base type of the expression
542 inline decltype(auto) subvector( const TVecMatMultExpr<VT>& vector, size_t index, size_t size )
543 {
545 
547 
548  decltype(auto) left ( (~vector).leftOperand() );
549  decltype(auto) right( (~vector).rightOperand() );
550 
551  const size_t row( ( IsLower<MT>::value )
552  ?( ( !AF && IsStrictlyLower<MT>::value )?( index + 1UL ):( index ) )
553  :( 0UL ) );
554  const size_t m( ( IsUpper<MT>::value )
555  ?( ( IsLower<MT>::value )?( size )
556  :( ( IsStrictlyUpper<MT>::value && size > 0UL )
557  ?( index + size - 1UL )
558  :( index + size ) ) )
559  :( ( IsLower<MT>::value )?( right.rows() - row )
560  :( right.rows() ) ) );
561 
562  return subvector<AF>( left, row, m ) * submatrix<AF>( right, row, index, m, size );
563 }
565 //*************************************************************************************************
566 
567 
568 //*************************************************************************************************
583 template< bool AF // Alignment flag
584  , typename MT > // Matrix base type of the expression
585 inline decltype(auto)
586  submatrix( const MatMatAddExpr<MT>& matrix, size_t row, size_t column, size_t m, size_t n )
587 {
589 
590  return submatrix<AF>( (~matrix).leftOperand() , row, column, m, n ) +
591  submatrix<AF>( (~matrix).rightOperand(), row, column, m, n );
592 }
594 //*************************************************************************************************
595 
596 
597 //*************************************************************************************************
612 template< bool AF // Alignment flag
613  , typename MT > // Matrix base type of the expression
614 inline decltype(auto)
615  submatrix( const MatMatSubExpr<MT>& matrix, size_t row, size_t column, size_t m, size_t n )
616 {
618 
619  return submatrix<AF>( (~matrix).leftOperand() , row, column, m, n ) -
620  submatrix<AF>( (~matrix).rightOperand(), row, column, m, n );
621 }
623 //*************************************************************************************************
624 
625 
626 //*************************************************************************************************
641 template< bool AF // Alignment flag
642  , typename MT > // Matrix base type of the expression
643 inline decltype(auto)
644  submatrix( const SchurExpr<MT>& matrix, size_t row, size_t column, size_t m, size_t n )
645 {
647 
648  return submatrix<AF>( (~matrix).leftOperand() , row, column, m, n ) %
649  submatrix<AF>( (~matrix).rightOperand(), row, column, m, n );
650 }
652 //*************************************************************************************************
653 
654 
655 //*************************************************************************************************
670 template< bool AF // Alignment flag
671  , typename MT > // Matrix base type of the expression
672 inline decltype(auto)
673  submatrix( const MatMatMultExpr<MT>& matrix, size_t row, size_t column, size_t m, size_t n )
674 {
676 
679 
680  decltype(auto) left ( (~matrix).leftOperand() );
681  decltype(auto) right( (~matrix).rightOperand() );
682 
683  const size_t begin( max( ( IsUpper<MT1>::value )
684  ?( ( !AF && IsStrictlyUpper<MT1>::value )?( row + 1UL ):( row ) )
685  :( 0UL )
686  , ( IsLower<MT2>::value )
687  ?( ( !AF && IsStrictlyLower<MT2>::value )?( column + 1UL ):( column ) )
688  :( 0UL ) ) );
689  const size_t end( min( ( IsLower<MT1>::value )
690  ?( ( IsStrictlyLower<MT1>::value && m > 0UL )?( row + m - 1UL ):( row + m ) )
691  :( left.columns() )
692  , ( IsUpper<MT2>::value )
693  ?( ( IsStrictlyUpper<MT2>::value && n > 0UL )?( column + n - 1UL ):( column + n ) )
694  :( left.columns() ) ) );
695 
696  const size_t diff( ( begin < end )?( end - begin ):( 0UL ) );
697 
698  return submatrix<AF>( left, row, begin, m, diff ) *
699  submatrix<AF>( right, begin, column, diff, n );
700 }
702 //*************************************************************************************************
703 
704 
705 //*************************************************************************************************
720 template< bool AF // Alignment flag
721  , typename MT > // Matrix base type of the expression
722 inline decltype(auto)
723  submatrix( const VecTVecMultExpr<MT>& matrix, size_t row, size_t column, size_t m, size_t n )
724 {
726 
727  return subvector<AF>( (~matrix).leftOperand(), row, m ) *
728  subvector<AF>( (~matrix).rightOperand(), column, n );
729 }
731 //*************************************************************************************************
732 
733 
734 //*************************************************************************************************
749 template< bool AF // Alignment flag
750  , typename MT > // Matrix base type of the expression
751 inline decltype(auto)
752  submatrix( const MatScalarMultExpr<MT>& matrix, size_t row, size_t column, size_t m, size_t n )
753 {
755 
756  return submatrix<AF>( (~matrix).leftOperand(), row, column, m, n ) * (~matrix).rightOperand();
757 }
759 //*************************************************************************************************
760 
761 
762 //*************************************************************************************************
777 template< bool AF // Alignment flag
778  , typename MT > // Matrix base type of the expression
779 inline decltype(auto)
780  submatrix( const MatScalarDivExpr<MT>& matrix, size_t row, size_t column, size_t m, size_t n )
781 {
783 
784  return submatrix<AF>( (~matrix).leftOperand(), row, column, m, n ) / (~matrix).rightOperand();
785 }
787 //*************************************************************************************************
788 
789 
790 //*************************************************************************************************
805 template< bool AF // Alignment flag
806  , typename MT > // Matrix base type of the expression
807 inline decltype(auto)
808  submatrix( const MatMapExpr<MT>& matrix, size_t row, size_t column, size_t m, size_t n )
809 {
811 
812  return map( submatrix<AF>( (~matrix).operand(), row, column, m, n ), (~matrix).operation() );
813 }
815 //*************************************************************************************************
816 
817 
818 //*************************************************************************************************
833 template< bool AF // Alignment flag
834  , typename MT > // Matrix base type of the expression
835 inline decltype(auto)
836  submatrix( const MatMatMapExpr<MT>& matrix, size_t row, size_t column, size_t m, size_t n )
837 {
839 
840  return map( submatrix<AF>( (~matrix).leftOperand() , row, column, m, n ),
841  submatrix<AF>( (~matrix).rightOperand(), row, column, m, n ),
842  (~matrix).operation() );
843 }
845 //*************************************************************************************************
846 
847 
848 //*************************************************************************************************
863 template< bool AF // Alignment flag
864  , typename MT > // Matrix base type of the expression
865 inline decltype(auto)
866  submatrix( const MatEvalExpr<MT>& matrix, size_t row, size_t column, size_t m, size_t n )
867 {
869 
870  return eval( submatrix<AF>( (~matrix).operand(), row, column, m, n ) );
871 }
873 //*************************************************************************************************
874 
875 
876 //*************************************************************************************************
891 template< bool AF // Alignment flag
892  , typename MT > // Matrix base type of the expression
893 inline decltype(auto)
894  submatrix( const MatSerialExpr<MT>& matrix, size_t row, size_t column, size_t m, size_t n )
895 {
897 
898  return serial( submatrix<AF>( (~matrix).operand(), row, column, m, n ) );
899 }
901 //*************************************************************************************************
902 
903 
904 //*************************************************************************************************
919 template< bool AF // Alignment flag
920  , typename MT > // Matrix base type of the expression
921 inline decltype(auto)
922  submatrix( const DeclExpr<MT>& matrix, size_t row, size_t column, size_t m, size_t n )
923 {
925 
926  return submatrix<AF>( (~matrix).operand(), row, column, m, n );
927 }
929 //*************************************************************************************************
930 
931 
932 //*************************************************************************************************
947 template< bool AF // Alignment flag
948  , typename MT > // Matrix base type of the expression
949 inline decltype(auto)
950  submatrix( const MatTransExpr<MT>& matrix, size_t row, size_t column, size_t m, size_t n )
951 {
953 
954  return trans( submatrix<AF>( (~matrix).operand(), column, row, n, m ) );
955 }
957 //*************************************************************************************************
958 
959 
960 //*************************************************************************************************
974 template< bool AF1 // Required alignment flag
975  , typename MT // Type of the sparse submatrix
976  , bool AF2 // Present alignment flag
977  , bool SO // Storage order
978  , bool DF > // Density flag
979 inline const Submatrix<MT,AF1,SO,DF>
980  submatrix( const Submatrix<MT,AF2,SO,DF>& sm, size_t row, size_t column, size_t m, size_t n )
981 {
983 
984  if( ( row + m > sm.rows() ) || ( column + n > sm.columns() ) ) {
985  BLAZE_THROW_INVALID_ARGUMENT( "Invalid submatrix specification" );
986  }
987 
988  return Submatrix<MT,AF1,SO,DF>( sm.operand(), sm.row() + row, sm.column() + column, m, n );
989 }
991 //*************************************************************************************************
992 
993 
994 
995 
996 //=================================================================================================
997 //
998 // SUBMATRIX OPERATORS
999 //
1000 //=================================================================================================
1001 
1002 //*************************************************************************************************
1005 template< typename MT, bool AF, bool SO, bool DF >
1006 inline void reset( Submatrix<MT,AF,SO,DF>& sm );
1007 
1008 template< typename MT, bool AF, bool SO, bool DF >
1009 inline void reset( Submatrix<MT,AF,SO,DF>&& sm );
1010 
1011 template< typename MT, bool AF, bool SO, bool DF >
1012 inline void reset( Submatrix<MT,AF,SO,DF>& sm, size_t i );
1013 
1014 template< typename MT, bool AF, bool SO, bool DF >
1015 inline void clear( Submatrix<MT,AF,SO,DF>& sm );
1016 
1017 template< typename MT, bool AF, bool SO, bool DF >
1018 inline void clear( Submatrix<MT,AF,SO,DF>&& sm );
1019 
1020 template< bool RF, typename MT, bool AF, bool SO, bool DF >
1021 inline bool isDefault( const Submatrix<MT,AF,SO,DF>& sm );
1022 
1023 template< typename MT, bool AF, bool SO, bool DF >
1024 inline bool isIntact( const Submatrix<MT,AF,SO,DF>& sm ) noexcept;
1025 
1026 template< typename MT, bool AF, bool SO, bool DF >
1027 inline bool isSymmetric( const Submatrix<MT,AF,SO,DF>& sm );
1028 
1029 template< typename MT, bool AF, bool SO, bool DF >
1030 inline bool isHermitian( const Submatrix<MT,AF,SO,DF>& sm );
1031 
1032 template< typename MT, bool AF, bool SO, bool DF >
1033 inline bool isLower( const Submatrix<MT,AF,SO,DF>& sm );
1034 
1035 template< typename MT, bool AF, bool SO, bool DF >
1036 inline bool isUniLower( const Submatrix<MT,AF,SO,DF>& sm );
1037 
1038 template< typename MT, bool AF, bool SO, bool DF >
1039 inline bool isStrictlyLower( const Submatrix<MT,AF,SO,DF>& sm );
1040 
1041 template< typename MT, bool AF, bool SO, bool DF >
1042 inline bool isUpper( const Submatrix<MT,AF,SO,DF>& sm );
1043 
1044 template< typename MT, bool AF, bool SO, bool DF >
1045 inline bool isUniUpper( const Submatrix<MT,AF,SO,DF>& sm );
1046 
1047 template< typename MT, bool AF, bool SO, bool DF >
1048 inline bool isStrictlyUpper( const Submatrix<MT,AF,SO,DF>& sm );
1049 
1050 template< typename MT, bool AF, bool SO, bool DF >
1051 inline bool isSame( const Submatrix<MT,AF,SO,DF>& a, const Matrix<MT,SO>& b ) noexcept;
1052 
1053 template< typename MT, bool AF, bool SO, bool DF >
1054 inline bool isSame( const Matrix<MT,SO>& a, const Submatrix<MT,AF,SO,DF>& b ) noexcept;
1055 
1056 template< typename MT, bool AF, bool SO, bool DF >
1057 inline bool isSame( const Submatrix<MT,AF,SO,DF>& a, const Submatrix<MT,AF,SO,DF>& b ) noexcept;
1059 //*************************************************************************************************
1060 
1061 
1062 //*************************************************************************************************
1069 template< typename MT // Type of the matrix
1070  , bool AF // Alignment flag
1071  , bool SO // Storage order
1072  , bool DF > // Density flag
1073 inline void reset( Submatrix<MT,AF,SO,DF>& sm )
1074 {
1075  sm.reset();
1076 }
1077 //*************************************************************************************************
1078 
1079 
1080 //*************************************************************************************************
1087 template< typename MT // Type of the matrix
1088  , bool AF // Alignment flag
1089  , bool SO // Storage order
1090  , bool DF > // Density flag
1091 inline void reset( Submatrix<MT,AF,SO,DF>&& sm )
1092 {
1093  sm.reset();
1094 }
1095 //*************************************************************************************************
1096 
1097 
1098 //*************************************************************************************************
1111 template< typename MT // Type of the matrix
1112  , bool AF // Alignment flag
1113  , bool SO // Storage order
1114  , bool DF > // Density flag
1115 inline void reset( Submatrix<MT,AF,SO,DF>& sm, size_t i )
1116 {
1117  sm.reset( i );
1118 }
1119 //*************************************************************************************************
1120 
1121 
1122 //*************************************************************************************************
1131 template< typename MT // Type of the matrix
1132  , bool AF // Alignment flag
1133  , bool SO // Storage order
1134  , bool DF > // Density flag
1135 inline void clear( Submatrix<MT,AF,SO,DF>& sm )
1136 {
1137  sm.reset();
1138 }
1139 //*************************************************************************************************
1140 
1141 
1142 //*************************************************************************************************
1151 template< typename MT // Type of the matrix
1152  , bool AF // Alignment flag
1153  , bool SO // Storage order
1154  , bool DF > // Density flag
1155 inline void clear( Submatrix<MT,AF,SO,DF>&& sm )
1156 {
1157  sm.reset();
1158 }
1159 //*************************************************************************************************
1160 
1161 
1162 //*************************************************************************************************
1187 template< bool RF // Relaxation flag
1188  , typename MT // Type of the matrix
1189  , bool AF // Alignment flag
1190  , bool SO // Storage order
1191  , bool DF > // Density flag
1192 inline bool isDefault( const Submatrix<MT,AF,SO,DF>& sm )
1193 {
1194  using blaze::isDefault;
1195 
1196  if( SO == rowMajor ) {
1197  for( size_t i=0UL; i<(~sm).rows(); ++i )
1198  for( size_t j=0UL; j<(~sm).columns(); ++j )
1199  if( !isDefault<RF>( (~sm)(i,j) ) )
1200  return false;
1201  }
1202  else {
1203  for( size_t j=0UL; j<(~sm).columns(); ++j )
1204  for( size_t i=0UL; i<(~sm).rows(); ++i )
1205  if( !isDefault<RF>( (~sm)(i,j) ) )
1206  return false;
1207  }
1208 
1209  return true;
1210 }
1211 //*************************************************************************************************
1212 
1213 
1214 //*************************************************************************************************
1233 template< bool RF // Relaxation flag
1234  , typename MT // Type of the sparse matrix
1235  , bool AF // Alignment flag
1236  , bool SO > // Storage order
1237 inline bool isDefault( const Submatrix<MT,AF,SO,false>& sm )
1238 {
1239  using blaze::isDefault;
1240 
1242 
1243  const size_t iend( ( SO == rowMajor)?( sm.rows() ):( sm.columns() ) );
1244 
1245  for( size_t i=0UL; i<iend; ++i ) {
1246  for( ConstIterator element=sm.begin(i); element!=sm.end(i); ++element )
1247  if( !isDefault<RF>( element->value() ) ) return false;
1248  }
1249 
1250  return true;
1251 }
1253 //*************************************************************************************************
1254 
1255 
1256 //*************************************************************************************************
1274 template< typename MT // Type of the matrix
1275  , bool AF // Alignment flag
1276  , bool SO // Storage order
1277  , bool DF > // Density flag
1278 inline bool isIntact( const Submatrix<MT,AF,SO,DF>& sm ) noexcept
1279 {
1280  return ( sm.row() + sm.rows() <= sm.operand().rows() &&
1281  sm.column() + sm.columns() <= sm.operand().columns() &&
1282  isIntact( sm.operand() ) );
1283 }
1284 //*************************************************************************************************
1285 
1286 
1287 //*************************************************************************************************
1309 template< typename MT // Type of the matrix
1310  , bool AF // Alignment flag
1311  , bool SO // Storage order
1312  , bool DF > // Density flag
1313 inline bool isSymmetric( const Submatrix<MT,AF,SO,DF>& sm )
1314 {
1316 
1317  if( IsSymmetric<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1318  return true;
1319  else return isSymmetric( static_cast<const BaseType&>( sm ) );
1320 }
1321 //*************************************************************************************************
1322 
1323 
1324 //*************************************************************************************************
1346 template< typename MT // Type of the matrix
1347  , bool AF // Alignment flag
1348  , bool SO // Storage order
1349  , bool DF > // Density flag
1350 inline bool isHermitian( const Submatrix<MT,AF,SO,DF>& sm )
1351 {
1353 
1354  if( IsHermitian<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1355  return true;
1356  else return isHermitian( static_cast<const BaseType&>( sm ) );
1357 }
1358 //*************************************************************************************************
1359 
1360 
1361 //*************************************************************************************************
1393 template< typename MT // Type of the matrix
1394  , bool AF // Alignment flag
1395  , bool SO // Storage order
1396  , bool DF > // Density flag
1397 inline bool isLower( const Submatrix<MT,AF,SO,DF>& sm )
1398 {
1400 
1401  if( IsLower<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1402  return true;
1403  else return isLower( static_cast<const BaseType&>( sm ) );
1404 }
1405 //*************************************************************************************************
1406 
1407 
1408 //*************************************************************************************************
1439 template< typename MT // Type of the matrix
1440  , bool AF // Alignment flag
1441  , bool SO // Storage order
1442  , bool DF > // Density flag
1443 inline bool isUniLower( const Submatrix<MT,AF,SO,DF>& sm )
1444 {
1446 
1447  if( IsUniLower<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1448  return true;
1449  else return isUniLower( static_cast<const BaseType&>( sm ) );
1450 }
1451 //*************************************************************************************************
1452 
1453 
1454 //*************************************************************************************************
1485 template< typename MT // Type of the matrix
1486  , bool AF // Alignment flag
1487  , bool SO // Storage order
1488  , bool DF > // Density flag
1489 inline bool isStrictlyLower( const Submatrix<MT,AF,SO,DF>& sm )
1490 {
1492 
1493  if( IsStrictlyLower<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1494  return true;
1495  else return isStrictlyLower( static_cast<const BaseType&>( sm ) );
1496 }
1497 //*************************************************************************************************
1498 
1499 
1500 //*************************************************************************************************
1532 template< typename MT // Type of the matrix
1533  , bool AF // Alignment flag
1534  , bool SO // Storage order
1535  , bool DF > // Density flag
1536 inline bool isUpper( const Submatrix<MT,AF,SO,DF>& sm )
1537 {
1539 
1540  if( IsUpper<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1541  return true;
1542  else return isUpper( static_cast<const BaseType&>( sm ) );
1543 }
1544 //*************************************************************************************************
1545 
1546 
1547 //*************************************************************************************************
1578 template< typename MT // Type of the matrix
1579  , bool AF // Alignment flag
1580  , bool SO // Storage order
1581  , bool DF > // Density flag
1582 inline bool isUniUpper( const Submatrix<MT,AF,SO,DF>& sm )
1583 {
1585 
1586  if( IsUniUpper<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1587  return true;
1588  else return isUniUpper( static_cast<const BaseType&>( sm ) );
1589 }
1590 //*************************************************************************************************
1591 
1592 
1593 //*************************************************************************************************
1624 template< typename MT // Type of the matrix
1625  , bool AF // Alignment flag
1626  , bool SO // Storage order
1627  , bool DF > // Density flag
1628 inline bool isStrictlyUpper( const Submatrix<MT,AF,SO,DF>& sm )
1629 {
1631 
1632  if( IsStrictlyUpper<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1633  return true;
1634  else return isStrictlyUpper( static_cast<const BaseType&>( sm ) );
1635 }
1636 //*************************************************************************************************
1637 
1638 
1639 //*************************************************************************************************
1651 template< typename MT // Type of the matrix
1652  , bool AF // Alignment flag
1653  , bool SO // Storage order
1654  , bool DF > // Density flag
1655 inline bool isSame( const Submatrix<MT,AF,SO,DF>& a, const Matrix<MT,SO>& b ) noexcept
1656 {
1657  return ( isSame( a.operand(), ~b ) &&
1658  ( a.rows() == (~b).rows() ) &&
1659  ( a.columns() == (~b).columns() ) );
1660 }
1661 //*************************************************************************************************
1662 
1663 
1664 //*************************************************************************************************
1676 template< typename MT // Type of the matrix
1677  , bool AF // Alignment flag
1678  , bool SO // Storage order
1679  , bool DF > // Density flag
1680 inline bool isSame( const Matrix<MT,SO>& a, const Submatrix<MT,AF,SO,DF>& b ) noexcept
1681 {
1682  return ( isSame( ~a, b.operand() ) &&
1683  ( (~a).rows() == b.rows() ) &&
1684  ( (~a).columns() == b.columns() ) );
1685 }
1686 //*************************************************************************************************
1687 
1688 
1689 //*************************************************************************************************
1701 template< typename MT // Type of the matrix
1702  , bool AF // Alignment flag
1703  , bool SO // Storage order
1704  , bool DF > // Density flag
1705 inline bool isSame( const Submatrix<MT,AF,SO,DF>& a, const Submatrix<MT,AF,SO,DF>& b ) noexcept
1706 {
1707  return ( isSame( a.operand(), b.operand() ) &&
1708  ( a.row() == b.row() ) && ( a.column() == b.column() ) &&
1709  ( a.rows() == b.rows() ) && ( a.columns() == b.columns() ) );
1710 }
1711 //*************************************************************************************************
1712 
1713 
1714 //*************************************************************************************************
1747 template< InversionFlag IF // Inversion algorithm
1748  , typename MT // Type of the dense matrix
1749  , bool AF // Alignment flag
1750  , bool SO > // Storage order
1752 {
1754 
1757 
1758  RT tmp( sm );
1759  invert<IF>( tmp );
1760  sm = tmp;
1761 }
1763 //*************************************************************************************************
1764 
1765 
1766 //*************************************************************************************************
1782 template< typename MT // Type of the matrix
1783  , bool AF // Alignment flag
1784  , bool SO // Storage order
1785  , bool DF // Density flag
1786  , typename VT // Type of the right-hand side vector
1787  , bool TF > // Transpose flag of the right-hand side vector
1788 inline bool tryAssign( const Submatrix<MT,AF,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1789  size_t row, size_t column )
1790 {
1791  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1792  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1793  BLAZE_INTERNAL_ASSERT( TF || ( (~rhs).size() <= lhs.rows() - row ), "Invalid number of rows" );
1794  BLAZE_INTERNAL_ASSERT( !TF || ( (~rhs).size() <= lhs.columns() - column ), "Invalid number of columns" );
1795 
1796  return tryAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
1797 }
1799 //*************************************************************************************************
1800 
1801 
1802 //*************************************************************************************************
1818 template< typename MT1 // Type of the matrix
1819  , bool AF // Alignment flag
1820  , bool SO1 // Storage order
1821  , bool DF // Density flag
1822  , typename MT2 // Type of the right-hand side matrix
1823  , bool SO2 > // Storage order of the right-hand side matrix
1824 inline bool tryAssign( const Submatrix<MT1,AF,SO1,DF>& lhs, const Matrix<MT2,SO2>& rhs,
1825  size_t row, size_t column )
1826 {
1827  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1828  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1829  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1830  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1831 
1832  return tryAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
1833 }
1835 //*************************************************************************************************
1836 
1837 
1838 //*************************************************************************************************
1854 template< typename MT // Type of the matrix
1855  , bool AF // Alignment flag
1856  , bool SO // Storage order
1857  , bool DF // Density flag
1858  , typename VT // Type of the right-hand side vector
1859  , bool TF > // Transpose flag of the right-hand side vector
1860 inline bool tryAddAssign( const Submatrix<MT,AF,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1861  size_t row, size_t column )
1862 {
1863  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1864  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1865  BLAZE_INTERNAL_ASSERT( TF || ( (~rhs).size() <= lhs.rows() - row ), "Invalid number of rows" );
1866  BLAZE_INTERNAL_ASSERT( !TF || ( (~rhs).size() <= lhs.columns() - column ), "Invalid number of columns" );
1867 
1868  return tryAddAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
1869 }
1871 //*************************************************************************************************
1872 
1873 
1874 //*************************************************************************************************
1890 template< typename MT1 // Type of the matrix
1891  , bool AF // Alignment flag
1892  , bool SO1 // Storage order
1893  , bool DF // Density flag
1894  , typename MT2 // Type of the right-hand side matrix
1895  , bool SO2 > // Storage order of the right-hand side matrix
1896 inline bool tryAddAssign( const Submatrix<MT1,AF,SO1,DF>& lhs, const Matrix<MT2,SO2>& rhs,
1897  size_t row, size_t column )
1898 {
1899  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1900  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1901  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1902  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1903 
1904  return tryAddAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
1905 }
1907 //*************************************************************************************************
1908 
1909 
1910 //*************************************************************************************************
1926 template< typename MT // Type of the matrix
1927  , bool AF // Alignment flag
1928  , bool SO // Storage order
1929  , bool DF // Density flag
1930  , typename VT // Type of the right-hand side vector
1931  , bool TF > // Transpose flag of the right-hand side vector
1932 inline bool trySubAssign( const Submatrix<MT,AF,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1933  size_t row, size_t column )
1934 {
1935  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1936  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1937  BLAZE_INTERNAL_ASSERT( TF || ( (~rhs).size() <= lhs.rows() - row ), "Invalid number of rows" );
1938  BLAZE_INTERNAL_ASSERT( !TF || ( (~rhs).size() <= lhs.columns() - column ), "Invalid number of columns" );
1939 
1940  return trySubAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
1941 }
1943 //*************************************************************************************************
1944 
1945 
1946 //*************************************************************************************************
1962 template< typename MT1 // Type of the matrix
1963  , bool AF // Alignment flag
1964  , bool SO1 // Storage order
1965  , bool DF // Density flag
1966  , typename MT2 // Type of the right-hand side matrix
1967  , bool SO2 > // Storage order of the right-hand side matrix
1968 inline bool trySubAssign( const Submatrix<MT1,AF,SO1,DF>& lhs, const Matrix<MT2,SO2>& rhs,
1969  size_t row, size_t column )
1970 {
1971  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1972  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1973  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1974  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1975 
1976  return trySubAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
1977 }
1979 //*************************************************************************************************
1980 
1981 
1982 //*************************************************************************************************
1998 template< typename MT // Type of the matrix
1999  , bool AF // Alignment flag
2000  , bool SO // Storage order
2001  , bool DF // Density flag
2002  , typename VT // Type of the right-hand side vector
2003  , bool TF > // Transpose flag of the right-hand side vector
2004 inline bool tryMultAssign( const Submatrix<MT,AF,SO,DF>& lhs, const Vector<VT,TF>& rhs,
2005  size_t row, size_t column )
2006 {
2007  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2008  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2009  BLAZE_INTERNAL_ASSERT( TF || ( (~rhs).size() <= lhs.rows() - row ), "Invalid number of rows" );
2010  BLAZE_INTERNAL_ASSERT( !TF || ( (~rhs).size() <= lhs.columns() - column ), "Invalid number of columns" );
2011 
2012  return tryMultAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
2013 }
2015 //*************************************************************************************************
2016 
2017 
2018 //*************************************************************************************************
2034 template< typename MT1 // Type of the matrix
2035  , bool AF // Alignment flag
2036  , bool SO1 // Storage order
2037  , bool DF // Density flag
2038  , typename MT2 // Type of the right-hand side matrix
2039  , bool SO2 > // Storage order of the right-hand side matrix
2040 inline bool trySchurAssign( const Submatrix<MT1,AF,SO1,DF>& lhs, const Matrix<MT2,SO2>& rhs,
2041  size_t row, size_t column )
2042 {
2043  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2044  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2045  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
2046  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
2047 
2048  return trySchurAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
2049 }
2051 //*************************************************************************************************
2052 
2053 
2054 //*************************************************************************************************
2069 template< typename MT // Type of the matrix
2070  , bool AF // Alignment flag
2071  , bool SO // Storage order
2072  , bool DF > // Density flag
2073 inline decltype(auto) derestrict( Submatrix<MT,AF,SO,DF>& dm )
2074 {
2075  return submatrix( derestrict( dm.operand() ), dm.row(), dm.column(), dm.rows(), dm.columns() );
2076 }
2078 //*************************************************************************************************
2079 
2080 
2081 //*************************************************************************************************
2096 template< typename MT // Type of the matrix
2097  , bool AF // Alignment flag
2098  , bool SO // Storage order
2099  , bool DF > // Density flag
2100 inline decltype(auto) derestrict( Submatrix<MT,AF,SO,DF>&& dm )
2101 {
2102  return submatrix( derestrict( dm.operand() ), dm.row(), dm.column(), dm.rows(), dm.columns() );
2103 }
2105 //*************************************************************************************************
2106 
2107 
2108 
2109 
2110 //=================================================================================================
2111 //
2112 // ISRESTRICTED SPECIALIZATIONS
2113 //
2114 //=================================================================================================
2115 
2116 //*************************************************************************************************
2118 template< typename MT, bool AF, bool SO, bool DF >
2119 struct IsRestricted< Submatrix<MT,AF,SO,DF> >
2120  : public BoolConstant< IsRestricted<MT>::value >
2121 {};
2123 //*************************************************************************************************
2124 
2125 
2126 
2127 
2128 //=================================================================================================
2129 //
2130 // HASCONSTDATAACCESS SPECIALIZATIONS
2131 //
2132 //=================================================================================================
2133 
2134 //*************************************************************************************************
2136 template< typename MT, bool AF, bool SO >
2137 struct HasConstDataAccess< Submatrix<MT,AF,SO,true> >
2138  : public BoolConstant< HasConstDataAccess<MT>::value >
2139 {};
2141 //*************************************************************************************************
2142 
2143 
2144 
2145 
2146 //=================================================================================================
2147 //
2148 // HASMUTABLEDATAACCESS SPECIALIZATIONS
2149 //
2150 //=================================================================================================
2151 
2152 //*************************************************************************************************
2154 template< typename MT, bool AF, bool SO >
2155 struct HasMutableDataAccess< Submatrix<MT,AF,SO,true> >
2156  : public BoolConstant< HasMutableDataAccess<MT>::value >
2157 {};
2159 //*************************************************************************************************
2160 
2161 
2162 
2163 
2164 //=================================================================================================
2165 //
2166 // ISALIGNED SPECIALIZATIONS
2167 //
2168 //=================================================================================================
2169 
2170 //*************************************************************************************************
2172 template< typename MT, bool SO >
2173 struct IsAligned< Submatrix<MT,aligned,SO,true> >
2174  : public TrueType
2175 {};
2177 //*************************************************************************************************
2178 
2179 
2180 
2181 
2182 //=================================================================================================
2183 //
2184 // ADDTRAIT SPECIALIZATIONS
2185 //
2186 //=================================================================================================
2187 
2188 //*************************************************************************************************
2190 template< typename MT, bool AF, bool SO, bool DF, typename T >
2191 struct AddTrait< Submatrix<MT,AF,SO,DF>, T >
2192 {
2193  using Type = AddTrait_< SubmatrixTrait_<MT>, T >;
2194 };
2195 
2196 template< typename T, typename MT, bool AF, bool SO, bool DF >
2197 struct AddTrait< T, Submatrix<MT,AF,SO,DF> >
2198 {
2199  using Type = AddTrait_< T, SubmatrixTrait_<MT> >;
2200 };
2202 //*************************************************************************************************
2203 
2204 
2205 
2206 
2207 //=================================================================================================
2208 //
2209 // SUBTRAIT SPECIALIZATIONS
2210 //
2211 //=================================================================================================
2212 
2213 //*************************************************************************************************
2215 template< typename MT, bool AF, bool SO, bool DF, typename T >
2216 struct SubTrait< Submatrix<MT,AF,SO,DF>, T >
2217 {
2218  using Type = SubTrait_< SubmatrixTrait_<MT>, T >;
2219 };
2220 
2221 template< typename T, typename MT, bool AF, bool SO, bool DF >
2222 struct SubTrait< T, Submatrix<MT,AF,SO,DF> >
2223 {
2224  using Type = SubTrait_< T, SubmatrixTrait_<MT> >;
2225 };
2227 //*************************************************************************************************
2228 
2229 
2230 
2231 
2232 //=================================================================================================
2233 //
2234 // MULTTRAIT SPECIALIZATIONS
2235 //
2236 //=================================================================================================
2237 
2238 //*************************************************************************************************
2240 template< typename MT, bool AF, bool SO, bool DF, typename T >
2241 struct MultTrait< Submatrix<MT,AF,SO,DF>, T >
2242 {
2243  using Type = MultTrait_< SubmatrixTrait_<MT>, T >;
2244 };
2245 
2246 template< typename T, typename MT, bool AF, bool SO, bool DF >
2247 struct MultTrait< T, Submatrix<MT,AF,SO,DF> >
2248 {
2249  using Type = MultTrait_< T, SubmatrixTrait_<MT> >;
2250 };
2252 //*************************************************************************************************
2253 
2254 
2255 
2256 
2257 //=================================================================================================
2258 //
2259 // DIVTRAIT SPECIALIZATIONS
2260 //
2261 //=================================================================================================
2262 
2263 //*************************************************************************************************
2265 template< typename MT, bool AF, bool SO, bool DF, typename T >
2266 struct DivTrait< Submatrix<MT,AF,SO,DF>, T >
2267 {
2268  using Type = DivTrait_< SubmatrixTrait_<MT>, T >;
2269 };
2270 
2271 template< typename T, typename MT, bool AF, bool DF, bool SO >
2272 struct DivTrait< T, Submatrix<MT,AF,SO,DF> >
2273 {
2274  using Type = DivTrait_< T, SubmatrixTrait_<MT> >;
2275 };
2277 //*************************************************************************************************
2278 
2279 
2280 
2281 
2282 //=================================================================================================
2283 //
2284 // SUBMATRIXTRAIT SPECIALIZATIONS
2285 //
2286 //=================================================================================================
2287 
2288 //*************************************************************************************************
2290 template< typename MT, bool AF, bool SO, bool DF >
2291 struct SubmatrixTrait< Submatrix<MT,AF,SO,DF> >
2292 {
2294 };
2296 //*************************************************************************************************
2297 
2298 
2299 
2300 
2301 //=================================================================================================
2302 //
2303 // ROWTRAIT SPECIALIZATIONS
2304 //
2305 //=================================================================================================
2306 
2307 //*************************************************************************************************
2309 template< typename MT, bool AF, bool SO, bool DF >
2310 struct RowTrait< Submatrix<MT,AF,SO,DF> >
2311 {
2313 };
2315 //*************************************************************************************************
2316 
2317 
2318 
2319 
2320 //=================================================================================================
2321 //
2322 // COLUMNTRAIT SPECIALIZATIONS
2323 //
2324 //=================================================================================================
2325 
2326 //*************************************************************************************************
2328 template< typename MT, bool AF, bool SO, bool DF >
2329 struct ColumnTrait< Submatrix<MT,AF,SO,DF> >
2330 {
2332 };
2334 //*************************************************************************************************
2335 
2336 } // namespace blaze
2337 
2338 #endif
#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.
Headerfile for the generic min algorithm.
Base class for all vector/matrix multiplication expression templates.The TVecMatMultExpr class serves...
Definition: TVecMatMultExpr.h:67
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:1073
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:1328
bool isStrictlyLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly lower triangular matrix.
Definition: DenseMatrix.h:1245
Base class for all binary matrix map expression templates.The MatMatMapExpr class serves as a tag for...
Definition: MatMatMapExpr.h:66
Compile time check for low-level access to constant data.This type trait tests whether the given data...
Definition: HasConstDataAccess.h:75
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:786
Header file for basic type definitions.
Base class for all matrix serial evaluation expression templates.The MatSerialExpr class serves as a ...
Definition: MatSerialExpr.h:67
Subvector< VT, AF > 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:322
Header file for the row trait.
Base template for the SubmatrixTrait class.
Definition: SubmatrixTrait.h:128
Base class for all matrix/scalar division expression templates.The MatScalarDivExpr class serves as a...
Definition: MatScalarDivExpr.h:66
Base template for the ColumnTrait class.
Definition: ColumnTrait.h:127
Header file for the serial shim.
typename RowTrait< MT >::Type RowTrait_
Auxiliary alias declaration for the RowTrait type trait.The RowTrait_ alias declaration provides a co...
Definition: RowTrait.h:162
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
Header file for the MatTransExpr base class.
Header file for the dense matrix inversion flags.
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:198
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:560
bool isUniLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower unitriangular matrix.
Definition: DenseMatrix.h:1158
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
Submatrix< MT, AF > 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:352
Base class for all matrix/scalar multiplication expression templates.The MatScalarMultExpr class serv...
Definition: MatScalarMultExpr.h:67
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1762
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 MatEvalExpr base class.
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:250
Column< MT > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:124
Header file for the MatMatMultExpr base class.
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:88
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1809
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:129
Compile time check for data types with restricted data access.This type trait tests whether the given...
Definition: IsRestricted.h:82
Compile time check for low-level access to mutable data.This type trait tests whether the given data ...
Definition: HasMutableDataAccess.h:75
Row< MT > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:124
Compile time check for the alignment of data types.This type trait tests whether the given data type ...
Definition: IsAligned.h:87
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:772
Submatrix specialization for dense matrices.
Header file for the MatMapExpr base class.
Base template for the RowTrait class.
Definition: RowTrait.h:127
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
Headerfile for the generic max algorithm.
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Base class for all matrix/matrix subtraction expression templates.The MatMatSubExpr class serves as a...
Definition: MatMatSubExpr.h:67
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the implementation of the Submatrix base template.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
Base class for all matrix/matrix addition expression templates.The MatMatAddExpr class serves as a ta...
Definition: MatMatAddExpr.h:66
Header file for the MatMatSubExpr base 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:340
Base class for all unary matrix map expression templates.The MatMapExpr class serves as a tag for all...
Definition: MatMapExpr.h:66
Base class for all matrix/vector multiplication expression templates.The MatVecMultExpr class serves ...
Definition: MatVecMultExpr.h:67
decltype(auto) eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:797
Compile time check for symmetric matrices.This type trait tests whether or not the given template par...
Definition: IsSymmetric.h:85
typename RemoveReference< T >::Type RemoveReference_
Auxiliary alias declaration for the RemoveReference type trait.The RemoveReference_ alias declaration...
Definition: RemoveReference.h:95
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
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:264
Constraint on the data type.
Constraint on the data type.
Header file for the MatSerialExpr base class.
Header file for the VecTVecMultExpr base class.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:580
View on a specific submatrix of a dense or sparse matrix.The Submatrix class template represents a vi...
Definition: BaseTemplate.h:503
typename DivTrait< T1, T2 >::Type DivTrait_
Auxiliary alias declaration for the DivTrait class template.The DivTrait_ alias declaration provides ...
Definition: DivTrait.h:250
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 HasConstDataAccess type trait.
Header file for the DeclExpr base class.
Base class for all matrix/matrix multiplication expression templates.The MatMatMultExpr class serves ...
Definition: MatMatMultExpr.h:67
Header file for the Matrix base class.
bool isStrictlyUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly upper triangular matrix.
Definition: DenseMatrix.h:1500
Header file for the MatScalarMultExpr base class.
Base class for all Schur product expression templates.The SchurExpr class serves as a tag for all exp...
Definition: SchurExpr.h:66
Base template for the AddTrait class.
Definition: AddTrait.h:139
Base template for the MultTrait class.
Definition: MultTrait.h:139
Header file for the addition trait.
Header file for the division trait.
Header file for the submatrix trait.
Header file for the SchurExpr base class.
Base class for all matrix evaluation expression templates.The MatEvalExpr class serves as a tag for a...
Definition: MatEvalExpr.h:66
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:778
Header file for the column trait.
Header file for the isDefault shim.
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:101
Header file for the TVecMatMultExpr base class.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:819
Base class for all matrix transposition expression templates.The MatTransExpr class serves as a tag f...
Definition: MatTransExpr.h:66
Header file for the HasMutableDataAccess type trait.
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:700
#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
typename SubmatrixTrait< MT >::Type SubmatrixTrait_
Auxiliary alias declaration for the SubmatrixTrait type trait.The SubmatrixTrait_ alias declaration p...
Definition: SubmatrixTrait.h:163
Header file for the MatMatAddExpr base class.
Header file for the RemoveReference type trait.
Base class for all outer product expression templates.The VecTVecMultExpr class serves as a tag for a...
Definition: VecTVecMultExpr.h:67
Base template for the DivTrait class.
Definition: DivTrait.h:139
typename ColumnTrait< MT >::Type ColumnTrait_
Auxiliary alias declaration for the ColumnTrait type trait.The ColumnTrait_ alias declaration provide...
Definition: ColumnTrait.h:162
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:324
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:790
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:177
const bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
Header file for the MatMatMapExpr base class.
typename SubTrait< T1, T2 >::Type SubTrait_
Auxiliary alias declaration for the SubTrait class template.The SubTrait_ alias declaration provides ...
Definition: SubTrait.h:250
Header file for the IntegralConstant class template.
bool isUniUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper unitriangular matrix.
Definition: DenseMatrix.h:1413
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:252
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:600
Base template for the SubTrait class.
Definition: SubTrait.h:139
Header file for the IsUpper type trait.
Header file for the MatScalarDivExpr base class.
Header file for the MatVecMultExpr base class.
Header file for the IsRestricted type trait.
typename AddTrait< T1, T2 >::Type AddTrait_
Auxiliary alias declaration for the AddTrait class template.The AddTrait_ alias declaration provides ...
Definition: AddTrait.h:250
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, 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 function trace functionality.
decltype(auto) map(const DenseMatrix< MT1, SO > &lhs, const DenseMatrix< MT2, SO > &rhs, OP op)
Evaluates the given binary operation on each single element of the dense matrices lhs and rhs...
Definition: DMatDMatMapExpr.h:1133