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>
88 #include <blaze/util/DisableIf.h>
89 #include <blaze/util/EnableIf.h>
92 #include <blaze/util/mpl/Or.h>
93 #include <blaze/util/TrueType.h>
94 #include <blaze/util/Types.h>
96 
97 
98 namespace blaze {
99 
100 //=================================================================================================
101 //
102 // GLOBAL FUNCTION
103 //
104 //=================================================================================================
105 
106 //*************************************************************************************************
165 template< typename MT // Type of the dense matrix
166  , bool SO > // Storage order
167 inline SubmatrixExprTrait_<MT,unaligned>
168  submatrix( Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
169 {
171 
172  return submatrix<unaligned>( ~matrix, row, column, m, n );
173 }
174 //*************************************************************************************************
175 
176 
177 //*************************************************************************************************
235 template< typename MT // Type of the dense matrix
236  , bool SO > // Storage order
238  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
239 {
241 
242  return submatrix<unaligned>( ~matrix, row, column, m, n );
243 }
244 //*************************************************************************************************
245 
246 
247 //*************************************************************************************************
265 template< typename MT // Type of the dense matrix
266  , bool SO > // Storage order
268  submatrix( Matrix<MT,SO>&& matrix, size_t row, size_t column, size_t m, size_t n )
269 {
271 
272  return submatrix<unaligned>( ~matrix, row, column, m, n );
273 }
274 //*************************************************************************************************
275 
276 
277 //*************************************************************************************************
351 template< bool AF // Alignment flag
352  , typename MT // Type of the dense matrix
353  , bool SO > // Storage order
356  submatrix( Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
357 {
359 
360  return SubmatrixExprTrait_<MT,AF>( ~matrix, row, column, m, n );
361 }
362 //*************************************************************************************************
363 
364 
365 //*************************************************************************************************
437 template< bool AF // Alignment flag
438  , typename MT // Type of the dense matrix
439  , bool SO > // Storage order
440 inline const DisableIf_< Or< IsComputation<MT>, IsTransExpr<MT>, IsDeclExpr<MT> >
442  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
443 {
445 
446  return SubmatrixExprTrait_<const MT,AF>( ~matrix, row, column, m, n );
447 }
448 //*************************************************************************************************
449 
450 
451 //*************************************************************************************************
470 template< bool AF // Alignment flag
471  , typename MT // Type of the dense matrix
472  , bool SO > // Storage order
473 inline DisableIf_< Or< IsComputation<MT>, IsTransExpr<MT>, IsDeclExpr<MT> >
475  submatrix( Matrix<MT,SO>&& matrix, size_t row, size_t column, size_t m, size_t n )
476 {
478 
479  return SubmatrixExprTrait_<MT,AF>( ~matrix, row, column, m, n );
480 }
481 //*************************************************************************************************
482 
483 
484 
485 
486 //=================================================================================================
487 //
488 // GLOBAL RESTRUCTURING OPERATORS
489 //
490 //=================================================================================================
491 
492 //*************************************************************************************************
505 template< bool AF // Alignment flag
506  , typename VT // Type of the vector
507  , bool TF > // Transpose flag
509  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
510 {
512 
514 
515  LeftOperand_<VT> left ( (~vector).leftOperand() );
516  RightOperand_<VT> right( (~vector).rightOperand() );
517 
518  const size_t column( ( IsUpper<MT>::value )
519  ?( ( !AF && IsStrictlyUpper<MT>::value )?( index + 1UL ):( index ) )
520  :( 0UL ) );
521  const size_t n( ( IsLower<MT>::value )
522  ?( ( IsUpper<MT>::value )?( size )
523  :( ( IsStrictlyLower<MT>::value && size > 0UL )
524  ?( index + size - 1UL )
525  :( index + size ) ) )
526  :( ( IsUpper<MT>::value )?( left.columns() - column )
527  :( left.columns() ) ) );
528 
529  return submatrix<AF>( left, index, column, size, n ) * subvector<AF>( right, column, n );
530 }
532 //*************************************************************************************************
533 
534 
535 //*************************************************************************************************
548 template< bool AF // Alignment flag
549  , typename VT // Type of the vector
550  , bool TF > // Transpose flag
552  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
553 {
555 
557 
558  LeftOperand_<VT> left ( (~vector).leftOperand() );
559  RightOperand_<VT> right( (~vector).rightOperand() );
560 
561  const size_t row( ( IsLower<MT>::value )
562  ?( ( !AF && IsStrictlyLower<MT>::value )?( index + 1UL ):( index ) )
563  :( 0UL ) );
564  const size_t m( ( IsUpper<MT>::value )
565  ?( ( IsLower<MT>::value )?( size )
566  :( ( IsStrictlyUpper<MT>::value && size > 0UL )
567  ?( index + size - 1UL )
568  :( index + size ) ) )
569  :( ( IsLower<MT>::value )?( right.rows() - row )
570  :( right.rows() ) ) );
571 
572  return subvector<AF>( left, row, m ) * submatrix<AF>( right, row, index, m, size );
573 }
575 //*************************************************************************************************
576 
577 
578 //*************************************************************************************************
593 template< bool AF // Alignment flag
594  , typename MT // Type of the matrix
595  , bool SO > // Storage order
597  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
598 {
600 
601  return submatrix<AF>( (~matrix).leftOperand() , row, column, m, n ) +
602  submatrix<AF>( (~matrix).rightOperand(), row, column, m, n );
603 }
605 //*************************************************************************************************
606 
607 
608 //*************************************************************************************************
623 template< bool AF // Alignment flag
624  , typename MT // Type of the matrix
625  , bool SO > // Storage order
627  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
628 {
630 
631  return submatrix<AF>( (~matrix).leftOperand() , row, column, m, n ) -
632  submatrix<AF>( (~matrix).rightOperand(), row, column, m, n );
633 }
635 //*************************************************************************************************
636 
637 
638 //*************************************************************************************************
653 template< bool AF // Alignment flag
654  , typename MT // Type of the matrix
655  , bool SO > // Storage order
657  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
658 {
660 
663 
664  LeftOperand_<MT> left ( (~matrix).leftOperand() );
665  RightOperand_<MT> right( (~matrix).rightOperand() );
666 
667  const size_t begin( max( ( IsUpper<MT1>::value )
668  ?( ( !AF && IsStrictlyUpper<MT1>::value )?( row + 1UL ):( row ) )
669  :( 0UL )
670  , ( IsLower<MT2>::value )
671  ?( ( !AF && IsStrictlyLower<MT2>::value )?( column + 1UL ):( column ) )
672  :( 0UL ) ) );
673  const size_t end( min( ( IsLower<MT1>::value )
674  ?( ( IsStrictlyLower<MT1>::value && m > 0UL )?( row + m - 1UL ):( row + m ) )
675  :( left.columns() )
676  , ( IsUpper<MT2>::value )
677  ?( ( IsStrictlyUpper<MT2>::value && n > 0UL )?( column + n - 1UL ):( column + n ) )
678  :( left.columns() ) ) );
679 
680  const size_t diff( ( begin < end )?( end - begin ):( 0UL ) );
681 
682  return submatrix<AF>( left, row, begin, m, diff ) *
683  submatrix<AF>( right, begin, column, diff, n );
684 }
686 //*************************************************************************************************
687 
688 
689 //*************************************************************************************************
704 template< bool AF // Alignment flag
705  , typename MT // Type of the matrix
706  , bool SO > // Storage order
708  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
709 {
711 
712  return subvector<AF>( (~matrix).leftOperand(), row, m ) *
713  subvector<AF>( (~matrix).rightOperand(), column, n );
714 }
716 //*************************************************************************************************
717 
718 
719 //*************************************************************************************************
734 template< bool AF // Alignment flag
735  , typename MT // Type of the matrix
736  , bool SO > // Storage order
738  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
739 {
741 
742  return submatrix<AF>( (~matrix).leftOperand(), row, column, m, n ) * (~matrix).rightOperand();
743 }
745 //*************************************************************************************************
746 
747 
748 //*************************************************************************************************
763 template< bool AF // Alignment flag
764  , typename MT // Type of the matrix
765  , bool SO > // Storage order
767  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
768 {
770 
771  return submatrix<AF>( (~matrix).leftOperand(), row, column, m, n ) / (~matrix).rightOperand();
772 }
774 //*************************************************************************************************
775 
776 
777 //*************************************************************************************************
792 template< bool AF // Alignment flag
793  , typename MT // Type of the matrix
794  , bool SO > // Storage order
796  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
797 {
799 
800  return forEach( submatrix<AF>( (~matrix).operand(), row, column, m, n ), (~matrix).operation() );
801 }
803 //*************************************************************************************************
804 
805 
806 //*************************************************************************************************
821 template< bool AF // Alignment flag
822  , typename MT // Type of the matrix
823  , bool SO > // Storage order
825  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
826 {
828 
829  return eval( submatrix<AF>( (~matrix).operand(), row, column, m, n ) );
830 }
832 //*************************************************************************************************
833 
834 
835 //*************************************************************************************************
850 template< bool AF // Alignment flag
851  , typename MT // Type of the matrix
852  , bool SO > // Storage order
854  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
855 {
857 
858  return serial( submatrix<AF>( (~matrix).operand(), row, column, m, n ) );
859 }
861 //*************************************************************************************************
862 
863 
864 //*************************************************************************************************
879 template< bool AF // Alignment flag
880  , typename MT // Type of the matrix
881  , bool SO > // Storage order
883  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
884 {
886 
887  return submatrix<AF>( (~matrix).operand(), row, column, m, n );
888 }
890 //*************************************************************************************************
891 
892 
893 //*************************************************************************************************
908 template< bool AF // Alignment flag
909  , typename MT // Type of the matrix
910  , bool SO > // Storage order
912  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n )
913 {
915 
916  return trans( submatrix<AF>( (~matrix).operand(), column, row, n, m ) );
917 }
919 //*************************************************************************************************
920 
921 
922 //*************************************************************************************************
936 template< bool AF1 // Required alignment flag
937  , typename MT // Type of the sparse submatrix
938  , bool AF2 // Present alignment flag
939  , bool SO // Storage order
940  , bool DF > // Density flag
941 inline const Submatrix<MT,AF1,SO,DF>
942  submatrix( const Submatrix<MT,AF2,SO,DF>& sm, size_t row, size_t column, size_t m, size_t n )
943 {
945 
946  if( ( row + m > sm.rows() ) || ( column + n > sm.columns() ) ) {
947  BLAZE_THROW_INVALID_ARGUMENT( "Invalid submatrix specification" );
948  }
949 
950  return Submatrix<MT,AF1,SO,DF>( sm.matrix_, sm.row_ + row, sm.column_ + column, m, n );
951 }
953 //*************************************************************************************************
954 
955 
956 
957 
958 //=================================================================================================
959 //
960 // SUBMATRIX OPERATORS
961 //
962 //=================================================================================================
963 
964 //*************************************************************************************************
967 template< typename MT, bool AF, bool SO, bool DF >
968 inline void reset( Submatrix<MT,AF,SO,DF>& sm );
969 
970 template< typename MT, bool AF, bool SO, bool DF >
971 inline void reset( Submatrix<MT,AF,SO,DF>&& sm );
972 
973 template< typename MT, bool AF, bool SO, bool DF >
974 inline void reset( Submatrix<MT,AF,SO,DF>& sm, size_t i );
975 
976 template< typename MT, bool AF, bool SO, bool DF >
977 inline void clear( Submatrix<MT,AF,SO,DF>& sm );
978 
979 template< typename MT, bool AF, bool SO, bool DF >
980 inline void clear( Submatrix<MT,AF,SO,DF>&& sm );
981 
982 template< bool RF, typename MT, bool AF, bool SO, bool DF >
983 inline bool isDefault( const Submatrix<MT,AF,SO,DF>& sm );
984 
985 template< typename MT, bool AF, bool SO, bool DF >
986 inline bool isIntact( const Submatrix<MT,AF,SO,DF>& sm ) noexcept;
987 
988 template< typename MT, bool AF, bool SO, bool DF >
989 inline bool isSymmetric( const Submatrix<MT,AF,SO,DF>& sm );
990 
991 template< typename MT, bool AF, bool SO, bool DF >
992 inline bool isHermitian( const Submatrix<MT,AF,SO,DF>& sm );
993 
994 template< typename MT, bool AF, bool SO, bool DF >
995 inline bool isLower( const Submatrix<MT,AF,SO,DF>& sm );
996 
997 template< typename MT, bool AF, bool SO, bool DF >
998 inline bool isUniLower( const Submatrix<MT,AF,SO,DF>& sm );
999 
1000 template< typename MT, bool AF, bool SO, bool DF >
1001 inline bool isStrictlyLower( const Submatrix<MT,AF,SO,DF>& sm );
1002 
1003 template< typename MT, bool AF, bool SO, bool DF >
1004 inline bool isUpper( const Submatrix<MT,AF,SO,DF>& sm );
1005 
1006 template< typename MT, bool AF, bool SO, bool DF >
1007 inline bool isUniUpper( const Submatrix<MT,AF,SO,DF>& sm );
1008 
1009 template< typename MT, bool AF, bool SO, bool DF >
1010 inline bool isStrictlyUpper( const Submatrix<MT,AF,SO,DF>& sm );
1011 
1012 template< typename MT, bool AF, bool SO, bool DF >
1013 inline bool isSame( const Submatrix<MT,AF,SO,DF>& a, const Matrix<MT,SO>& b ) noexcept;
1014 
1015 template< typename MT, bool AF, bool SO, bool DF >
1016 inline bool isSame( const Matrix<MT,SO>& a, const Submatrix<MT,AF,SO,DF>& b ) noexcept;
1017 
1018 template< typename MT, bool AF, bool SO, bool DF >
1019 inline bool isSame( const Submatrix<MT,AF,SO,DF>& a, const Submatrix<MT,AF,SO,DF>& b ) noexcept;
1021 //*************************************************************************************************
1022 
1023 
1024 //*************************************************************************************************
1031 template< typename MT // Type of the matrix
1032  , bool AF // Alignment flag
1033  , bool SO // Storage order
1034  , bool DF > // Density flag
1035 inline void reset( Submatrix<MT,AF,SO,DF>& sm )
1036 {
1037  sm.reset();
1038 }
1039 //*************************************************************************************************
1040 
1041 
1042 //*************************************************************************************************
1049 template< typename MT // Type of the matrix
1050  , bool AF // Alignment flag
1051  , bool SO // Storage order
1052  , bool DF > // Density flag
1053 inline void reset( Submatrix<MT,AF,SO,DF>&& sm )
1054 {
1055  sm.reset();
1056 }
1057 //*************************************************************************************************
1058 
1059 
1060 //*************************************************************************************************
1073 template< typename MT // Type of the matrix
1074  , bool AF // Alignment flag
1075  , bool SO // Storage order
1076  , bool DF > // Density flag
1077 inline void reset( Submatrix<MT,AF,SO,DF>& sm, size_t i )
1078 {
1079  sm.reset( i );
1080 }
1081 //*************************************************************************************************
1082 
1083 
1084 //*************************************************************************************************
1093 template< typename MT // Type of the matrix
1094  , bool AF // Alignment flag
1095  , bool SO // Storage order
1096  , bool DF > // Density flag
1097 inline void clear( Submatrix<MT,AF,SO,DF>& sm )
1098 {
1099  sm.reset();
1100 }
1101 //*************************************************************************************************
1102 
1103 
1104 //*************************************************************************************************
1113 template< typename MT // Type of the matrix
1114  , bool AF // Alignment flag
1115  , bool SO // Storage order
1116  , bool DF > // Density flag
1117 inline void clear( Submatrix<MT,AF,SO,DF>&& sm )
1118 {
1119  sm.reset();
1120 }
1121 //*************************************************************************************************
1122 
1123 
1124 //*************************************************************************************************
1149 template< bool RF // Relaxation flag
1150  , typename MT // Type of the matrix
1151  , bool AF // Alignment flag
1152  , bool SO // Storage order
1153  , bool DF > // Density flag
1154 inline bool isDefault( const Submatrix<MT,AF,SO,DF>& sm )
1155 {
1156  using blaze::isDefault;
1157 
1158  if( SO == rowMajor ) {
1159  for( size_t i=0UL; i<(~sm).rows(); ++i )
1160  for( size_t j=0UL; j<(~sm).columns(); ++j )
1161  if( !isDefault<RF>( (~sm)(i,j) ) )
1162  return false;
1163  }
1164  else {
1165  for( size_t j=0UL; j<(~sm).columns(); ++j )
1166  for( size_t i=0UL; i<(~sm).rows(); ++i )
1167  if( !isDefault<RF>( (~sm)(i,j) ) )
1168  return false;
1169  }
1170 
1171  return true;
1172 }
1173 //*************************************************************************************************
1174 
1175 
1176 //*************************************************************************************************
1195 template< bool RF // Relaxation flag
1196  , typename MT // Type of the sparse matrix
1197  , bool AF // Alignment flag
1198  , bool SO > // Storage order
1199 inline bool isDefault( const Submatrix<MT,AF,SO,false>& sm )
1200 {
1201  using blaze::isDefault;
1202 
1204 
1205  const size_t iend( ( SO == rowMajor)?( sm.rows() ):( sm.columns() ) );
1206 
1207  for( size_t i=0UL; i<iend; ++i ) {
1208  for( ConstIterator element=sm.begin(i); element!=sm.end(i); ++element )
1209  if( !isDefault<RF>( element->value() ) ) return false;
1210  }
1211 
1212  return true;
1213 }
1215 //*************************************************************************************************
1216 
1217 
1218 //*************************************************************************************************
1236 template< typename MT // Type of the matrix
1237  , bool AF // Alignment flag
1238  , bool SO // Storage order
1239  , bool DF > // Density flag
1240 inline bool isIntact( const Submatrix<MT,AF,SO,DF>& sm ) noexcept
1241 {
1242  return ( sm.row_ + sm.m_ <= sm.matrix_.rows() &&
1243  sm.column_ + sm.n_ <= sm.matrix_.columns() &&
1244  isIntact( sm.matrix_ ) );
1245 }
1246 //*************************************************************************************************
1247 
1248 
1249 //*************************************************************************************************
1271 template< typename MT // Type of the matrix
1272  , bool AF // Alignment flag
1273  , bool SO // Storage order
1274  , bool DF > // Density flag
1275 inline bool isSymmetric( const Submatrix<MT,AF,SO,DF>& sm )
1276 {
1278 
1279  if( IsSymmetric<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1280  return true;
1281  else return isSymmetric( static_cast<const BaseType&>( sm ) );
1282 }
1283 //*************************************************************************************************
1284 
1285 
1286 //*************************************************************************************************
1308 template< typename MT // Type of the matrix
1309  , bool AF // Alignment flag
1310  , bool SO // Storage order
1311  , bool DF > // Density flag
1312 inline bool isHermitian( const Submatrix<MT,AF,SO,DF>& sm )
1313 {
1315 
1316  if( IsHermitian<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1317  return true;
1318  else return isHermitian( static_cast<const BaseType&>( sm ) );
1319 }
1320 //*************************************************************************************************
1321 
1322 
1323 //*************************************************************************************************
1355 template< typename MT // Type of the matrix
1356  , bool AF // Alignment flag
1357  , bool SO // Storage order
1358  , bool DF > // Density flag
1359 inline bool isLower( const Submatrix<MT,AF,SO,DF>& sm )
1360 {
1362 
1363  if( IsLower<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1364  return true;
1365  else return isLower( static_cast<const BaseType&>( sm ) );
1366 }
1367 //*************************************************************************************************
1368 
1369 
1370 //*************************************************************************************************
1401 template< typename MT // Type of the matrix
1402  , bool AF // Alignment flag
1403  , bool SO // Storage order
1404  , bool DF > // Density flag
1405 inline bool isUniLower( const Submatrix<MT,AF,SO,DF>& sm )
1406 {
1408 
1409  if( IsUniLower<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1410  return true;
1411  else return isUniLower( static_cast<const BaseType&>( sm ) );
1412 }
1413 //*************************************************************************************************
1414 
1415 
1416 //*************************************************************************************************
1447 template< typename MT // Type of the matrix
1448  , bool AF // Alignment flag
1449  , bool SO // Storage order
1450  , bool DF > // Density flag
1451 inline bool isStrictlyLower( const Submatrix<MT,AF,SO,DF>& sm )
1452 {
1454 
1455  if( IsStrictlyLower<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1456  return true;
1457  else return isStrictlyLower( static_cast<const BaseType&>( sm ) );
1458 }
1459 //*************************************************************************************************
1460 
1461 
1462 //*************************************************************************************************
1494 template< typename MT // Type of the matrix
1495  , bool AF // Alignment flag
1496  , bool SO // Storage order
1497  , bool DF > // Density flag
1498 inline bool isUpper( const Submatrix<MT,AF,SO,DF>& sm )
1499 {
1501 
1502  if( IsUpper<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1503  return true;
1504  else return isUpper( static_cast<const BaseType&>( sm ) );
1505 }
1506 //*************************************************************************************************
1507 
1508 
1509 //*************************************************************************************************
1540 template< typename MT // Type of the matrix
1541  , bool AF // Alignment flag
1542  , bool SO // Storage order
1543  , bool DF > // Density flag
1544 inline bool isUniUpper( const Submatrix<MT,AF,SO,DF>& sm )
1545 {
1547 
1548  if( IsUniUpper<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1549  return true;
1550  else return isUniUpper( static_cast<const BaseType&>( sm ) );
1551 }
1552 //*************************************************************************************************
1553 
1554 
1555 //*************************************************************************************************
1586 template< typename MT // Type of the matrix
1587  , bool AF // Alignment flag
1588  , bool SO // Storage order
1589  , bool DF > // Density flag
1590 inline bool isStrictlyUpper( const Submatrix<MT,AF,SO,DF>& sm )
1591 {
1593 
1594  if( IsStrictlyUpper<MT>::value && sm.row() == sm.column() && sm.rows() == sm.columns() )
1595  return true;
1596  else return isStrictlyUpper( static_cast<const BaseType&>( sm ) );
1597 }
1598 //*************************************************************************************************
1599 
1600 
1601 //*************************************************************************************************
1613 template< typename MT // Type of the matrix
1614  , bool AF // Alignment flag
1615  , bool SO // Storage order
1616  , bool DF > // Density flag
1617 inline bool isSame( const Submatrix<MT,AF,SO,DF>& a, const Matrix<MT,SO>& b ) noexcept
1618 {
1619  return ( isSame( a.matrix_, ~b ) && ( a.rows() == (~b).rows() ) && ( a.columns() == (~b).columns() ) );
1620 }
1621 //*************************************************************************************************
1622 
1623 
1624 //*************************************************************************************************
1636 template< typename MT // Type of the matrix
1637  , bool AF // Alignment flag
1638  , bool SO // Storage order
1639  , bool DF > // Density flag
1640 inline bool isSame( const Matrix<MT,SO>& a, const Submatrix<MT,AF,SO,DF>& b ) noexcept
1641 {
1642  return ( isSame( ~a, b.matrix_ ) && ( (~a).rows() == b.rows() ) && ( (~a).columns() == b.columns() ) );
1643 }
1644 //*************************************************************************************************
1645 
1646 
1647 //*************************************************************************************************
1659 template< typename MT // Type of the matrix
1660  , bool AF // Alignment flag
1661  , bool SO // Storage order
1662  , bool DF > // Density flag
1663 inline bool isSame( const Submatrix<MT,AF,SO,DF>& a, const Submatrix<MT,AF,SO,DF>& b ) noexcept
1664 {
1665  return ( isSame( a.matrix_, b.matrix_ ) &&
1666  ( a.row_ == b.row_ ) && ( a.column_ == b.column_ ) &&
1667  ( a.m_ == b.m_ ) && ( a.n_ == b.n_ ) );
1668 }
1669 //*************************************************************************************************
1670 
1671 
1672 //*************************************************************************************************
1705 template< InversionFlag IF // Inversion algorithm
1706  , typename MT // Type of the dense matrix
1707  , bool AF // Alignment flag
1708  , bool SO > // Storage order
1710 {
1712 
1715 
1716  RT tmp( sm );
1717  invert<IF>( tmp );
1718  sm = tmp;
1719 }
1721 //*************************************************************************************************
1722 
1723 
1724 //*************************************************************************************************
1740 template< typename MT // Type of the matrix
1741  , bool AF // Alignment flag
1742  , bool SO // Storage order
1743  , bool DF // Density flag
1744  , typename VT // Type of the right-hand side vector
1745  , bool TF > // Transpose flag of the right-hand side vector
1746 inline bool tryAssign( const Submatrix<MT,AF,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1747  size_t row, size_t column )
1748 {
1749  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1750  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1751  BLAZE_INTERNAL_ASSERT( TF || ( (~rhs).size() <= lhs.rows() - row ), "Invalid number of rows" );
1752  BLAZE_INTERNAL_ASSERT( !TF || ( (~rhs).size() <= lhs.columns() - column ), "Invalid number of columns" );
1753 
1754  return tryAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
1755 }
1757 //*************************************************************************************************
1758 
1759 
1760 //*************************************************************************************************
1776 template< typename MT1 // Type of the matrix
1777  , bool AF // Alignment flag
1778  , bool SO1 // Storage order
1779  , bool DF // Density flag
1780  , typename MT2 // Type of the right-hand side matrix
1781  , bool SO2 > // Storage order of the right-hand side matrix
1782 inline bool tryAssign( const Submatrix<MT1,AF,SO1,DF>& lhs, const Matrix<MT2,SO2>& rhs,
1783  size_t row, size_t column )
1784 {
1785  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1786  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1787  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1788  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1789 
1790  return tryAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
1791 }
1793 //*************************************************************************************************
1794 
1795 
1796 //*************************************************************************************************
1812 template< typename MT // Type of the matrix
1813  , bool AF // Alignment flag
1814  , bool SO // Storage order
1815  , bool DF // Density flag
1816  , typename VT // Type of the right-hand side vector
1817  , bool TF > // Transpose flag of the right-hand side vector
1818 inline bool tryAddAssign( const Submatrix<MT,AF,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1819  size_t row, size_t column )
1820 {
1821  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1822  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1823  BLAZE_INTERNAL_ASSERT( TF || ( (~rhs).size() <= lhs.rows() - row ), "Invalid number of rows" );
1824  BLAZE_INTERNAL_ASSERT( !TF || ( (~rhs).size() <= lhs.columns() - column ), "Invalid number of columns" );
1825 
1826  return tryAddAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
1827 }
1829 //*************************************************************************************************
1830 
1831 
1832 //*************************************************************************************************
1848 template< typename MT1 // Type of the matrix
1849  , bool AF // Alignment flag
1850  , bool SO1 // Storage order
1851  , bool DF // Density flag
1852  , typename MT2 // Type of the right-hand side matrix
1853  , bool SO2 > // Storage order of the right-hand side matrix
1854 inline bool tryAddAssign( const Submatrix<MT1,AF,SO1,DF>& lhs, const Matrix<MT2,SO2>& rhs,
1855  size_t row, size_t column )
1856 {
1857  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1858  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1859  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1860  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1861 
1862  return tryAddAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
1863 }
1865 //*************************************************************************************************
1866 
1867 
1868 //*************************************************************************************************
1884 template< typename MT // Type of the matrix
1885  , bool AF // Alignment flag
1886  , bool SO // Storage order
1887  , bool DF // Density flag
1888  , typename VT // Type of the right-hand side vector
1889  , bool TF > // Transpose flag of the right-hand side vector
1890 inline bool trySubAssign( const Submatrix<MT,AF,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1891  size_t row, size_t column )
1892 {
1893  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1894  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1895  BLAZE_INTERNAL_ASSERT( TF || ( (~rhs).size() <= lhs.rows() - row ), "Invalid number of rows" );
1896  BLAZE_INTERNAL_ASSERT( !TF || ( (~rhs).size() <= lhs.columns() - column ), "Invalid number of columns" );
1897 
1898  return trySubAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
1899 }
1901 //*************************************************************************************************
1902 
1903 
1904 //*************************************************************************************************
1920 template< typename MT1 // Type of the matrix
1921  , bool AF // Alignment flag
1922  , bool SO1 // Storage order
1923  , bool DF // Density flag
1924  , typename MT2 // Type of the right-hand side matrix
1925  , bool SO2 > // Storage order of the right-hand side matrix
1926 inline bool trySubAssign( const Submatrix<MT1,AF,SO1,DF>& lhs, const Matrix<MT2,SO2>& rhs,
1927  size_t row, size_t column )
1928 {
1929  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1930  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1931  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1932  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1933 
1934  return trySubAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
1935 }
1937 //*************************************************************************************************
1938 
1939 
1940 //*************************************************************************************************
1956 template< typename MT // Type of the matrix
1957  , bool AF // Alignment flag
1958  , bool SO // Storage order
1959  , bool DF // Density flag
1960  , typename VT // Type of the right-hand side vector
1961  , bool TF > // Transpose flag of the right-hand side vector
1962 inline bool tryMultAssign( const Submatrix<MT,AF,SO,DF>& lhs, const Vector<VT,TF>& rhs,
1963  size_t row, size_t column )
1964 {
1965  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1966  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1967  BLAZE_INTERNAL_ASSERT( TF || ( (~rhs).size() <= lhs.rows() - row ), "Invalid number of rows" );
1968  BLAZE_INTERNAL_ASSERT( !TF || ( (~rhs).size() <= lhs.columns() - column ), "Invalid number of columns" );
1969 
1970  return tryMultAssign( lhs.matrix_, ~rhs, lhs.row_ + row, lhs.column_ + column );
1971 }
1973 //*************************************************************************************************
1974 
1975 
1976 //*************************************************************************************************
1991 template< typename MT // Type of the matrix
1992  , bool AF // Alignment flag
1993  , bool SO // Storage order
1994  , bool DF > // Density flag
1996 {
1998  return ReturnType( derestrict( dm.matrix_ ), dm.row_, dm.column_, dm.m_, dm.n_ );
1999 }
2001 //*************************************************************************************************
2002 
2003 
2004 
2005 
2006 //=================================================================================================
2007 //
2008 // ISRESTRICTED SPECIALIZATIONS
2009 //
2010 //=================================================================================================
2011 
2012 //*************************************************************************************************
2014 template< typename MT, bool AF, bool SO, bool DF >
2015 struct IsRestricted< Submatrix<MT,AF,SO,DF> >
2016  : public BoolConstant< IsRestricted<MT>::value >
2017 {};
2019 //*************************************************************************************************
2020 
2021 
2022 
2023 
2024 //=================================================================================================
2025 //
2026 // DERESTRICTTRAIT SPECIALIZATIONS
2027 //
2028 //=================================================================================================
2029 
2030 //*************************************************************************************************
2032 template< typename MT, bool AF, bool SO, bool DF >
2033 struct DerestrictTrait< Submatrix<MT,AF,SO,DF> >
2034 {
2036 };
2038 //*************************************************************************************************
2039 
2040 
2041 
2042 
2043 //=================================================================================================
2044 //
2045 // HASCONSTDATAACCESS SPECIALIZATIONS
2046 //
2047 //=================================================================================================
2048 
2049 //*************************************************************************************************
2051 template< typename MT, bool AF, bool SO >
2052 struct HasConstDataAccess< Submatrix<MT,AF,SO,true> >
2053  : public BoolConstant< HasConstDataAccess<MT>::value >
2054 {};
2056 //*************************************************************************************************
2057 
2058 
2059 
2060 
2061 //=================================================================================================
2062 //
2063 // HASMUTABLEDATAACCESS SPECIALIZATIONS
2064 //
2065 //=================================================================================================
2066 
2067 //*************************************************************************************************
2069 template< typename MT, bool AF, bool SO >
2070 struct HasMutableDataAccess< Submatrix<MT,AF,SO,true> >
2071  : public BoolConstant< HasMutableDataAccess<MT>::value >
2072 {};
2074 //*************************************************************************************************
2075 
2076 
2077 
2078 
2079 //=================================================================================================
2080 //
2081 // ISALIGNED SPECIALIZATIONS
2082 //
2083 //=================================================================================================
2084 
2085 //*************************************************************************************************
2087 template< typename MT, bool SO >
2088 struct IsAligned< Submatrix<MT,aligned,SO,true> > : public TrueType
2089 {};
2091 //*************************************************************************************************
2092 
2093 
2094 
2095 
2096 //=================================================================================================
2097 //
2098 // ADDTRAIT SPECIALIZATIONS
2099 //
2100 //=================================================================================================
2101 
2102 //*************************************************************************************************
2104 template< typename MT, bool AF, bool SO, bool DF, typename T >
2105 struct AddTrait< Submatrix<MT,AF,SO,DF>, T >
2106 {
2107  using Type = AddTrait_< SubmatrixTrait_<MT>, T >;
2108 };
2109 
2110 template< typename T, typename MT, bool AF, bool SO, bool DF >
2111 struct AddTrait< T, Submatrix<MT,AF,SO,DF> >
2112 {
2113  using Type = AddTrait_< T, SubmatrixTrait_<MT> >;
2114 };
2116 //*************************************************************************************************
2117 
2118 
2119 
2120 
2121 //=================================================================================================
2122 //
2123 // SUBTRAIT SPECIALIZATIONS
2124 //
2125 //=================================================================================================
2126 
2127 //*************************************************************************************************
2129 template< typename MT, bool AF, bool SO, bool DF, typename T >
2130 struct SubTrait< Submatrix<MT,AF,SO,DF>, T >
2131 {
2132  using Type = SubTrait_< SubmatrixTrait_<MT>, T >;
2133 };
2134 
2135 template< typename T, typename MT, bool AF, bool SO, bool DF >
2136 struct SubTrait< T, Submatrix<MT,AF,SO,DF> >
2137 {
2138  using Type = SubTrait_< T, SubmatrixTrait_<MT> >;
2139 };
2141 //*************************************************************************************************
2142 
2143 
2144 
2145 
2146 //=================================================================================================
2147 //
2148 // MULTTRAIT SPECIALIZATIONS
2149 //
2150 //=================================================================================================
2151 
2152 //*************************************************************************************************
2154 template< typename MT, bool AF, bool SO, bool DF, typename T >
2155 struct MultTrait< Submatrix<MT,AF,SO,DF>, T >
2156 {
2157  using Type = MultTrait_< SubmatrixTrait_<MT>, T >;
2158 };
2159 
2160 template< typename T, typename MT, bool AF, bool SO, bool DF >
2161 struct MultTrait< T, Submatrix<MT,AF,SO,DF> >
2162 {
2163  using Type = MultTrait_< T, SubmatrixTrait_<MT> >;
2164 };
2166 //*************************************************************************************************
2167 
2168 
2169 
2170 
2171 //=================================================================================================
2172 //
2173 // DIVTRAIT SPECIALIZATIONS
2174 //
2175 //=================================================================================================
2176 
2177 //*************************************************************************************************
2179 template< typename MT, bool AF, bool SO, bool DF, typename T >
2180 struct DivTrait< Submatrix<MT,AF,SO,DF>, T >
2181 {
2182  using Type = DivTrait_< SubmatrixTrait_<MT>, T >;
2183 };
2184 
2185 template< typename T, typename MT, bool AF, bool DF, bool SO >
2186 struct DivTrait< T, Submatrix<MT,AF,SO,DF> >
2187 {
2188  using Type = DivTrait_< T, SubmatrixTrait_<MT> >;
2189 };
2191 //*************************************************************************************************
2192 
2193 
2194 
2195 
2196 //=================================================================================================
2197 //
2198 // SUBMATRIXTRAIT SPECIALIZATIONS
2199 //
2200 //=================================================================================================
2201 
2202 //*************************************************************************************************
2204 template< typename MT, bool AF, bool SO, bool DF >
2205 struct SubmatrixTrait< Submatrix<MT,AF,SO,DF> >
2206 {
2208 };
2210 //*************************************************************************************************
2211 
2212 
2213 
2214 
2215 //=================================================================================================
2216 //
2217 // SUBMATRIXEXPRTRAIT SPECIALIZATIONS
2218 //
2219 //=================================================================================================
2220 
2221 //*************************************************************************************************
2223 template< typename MT, bool AF1, bool SO, bool DF, bool AF2 >
2224 struct SubmatrixExprTrait< Submatrix<MT,AF1,SO,DF>, AF2 >
2225 {
2226  using Type = Submatrix<MT,AF2,SO,DF>;
2227 };
2229 //*************************************************************************************************
2230 
2231 
2232 //*************************************************************************************************
2234 template< typename MT, bool AF1, bool SO, bool DF, bool AF2 >
2235 struct SubmatrixExprTrait< const Submatrix<MT,AF1,SO,DF>, AF2 >
2236 {
2237  using Type = Submatrix<MT,AF2,SO,DF>;
2238 };
2240 //*************************************************************************************************
2241 
2242 
2243 //*************************************************************************************************
2245 template< typename MT, bool AF1, bool SO, bool DF, bool AF2 >
2246 struct SubmatrixExprTrait< volatile Submatrix<MT,AF1,SO,DF>, AF2 >
2247 {
2248  using Type = Submatrix<MT,AF2,SO,DF>;
2249 };
2251 //*************************************************************************************************
2252 
2253 
2254 //*************************************************************************************************
2256 template< typename MT, bool AF1, bool SO, bool DF, bool AF2 >
2257 struct SubmatrixExprTrait< const volatile Submatrix<MT,AF1,SO,DF>, AF2 >
2258 {
2259  using Type = Submatrix<MT,AF2,SO,DF>;
2260 };
2262 //*************************************************************************************************
2263 
2264 
2265 
2266 
2267 //=================================================================================================
2268 //
2269 // ROWTRAIT SPECIALIZATIONS
2270 //
2271 //=================================================================================================
2272 
2273 //*************************************************************************************************
2275 template< typename MT, bool AF, bool SO, bool DF >
2276 struct RowTrait< Submatrix<MT,AF,SO,DF> >
2277 {
2279 };
2281 //*************************************************************************************************
2282 
2283 
2284 
2285 
2286 //=================================================================================================
2287 //
2288 // COLUMNTRAIT SPECIALIZATIONS
2289 //
2290 //=================================================================================================
2291 
2292 //*************************************************************************************************
2294 template< typename MT, bool AF, bool SO, bool DF >
2295 struct ColumnTrait< Submatrix<MT,AF,SO,DF> >
2296 {
2298 };
2300 //*************************************************************************************************
2301 
2302 } // namespace blaze
2303 
2304 #endif
typename SubmatrixExprTrait< MT, AF >::Type SubmatrixExprTrait_
Auxiliary alias declaration for the SubmatrixExprTrait type trait.The SubmatrixExprTrait_ alias decla...
Definition: SubmatrixExprTrait.h:134
#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.
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:1066
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:1321
typename DerestrictTrait< T >::Type DerestrictTrait_
Auxiliary alias declaration for the DerestrictTrait type trait.The DerestrictTrait_ alias declaration...
Definition: DerestrictTrait.h:110
bool isStrictlyLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly lower triangular matrix.
Definition: DenseMatrix.h:1238
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:721
Header file for basic type definitions.
Header file for the IsTVecMatMultExpr type trait class.
Header file for the row trait.
Base template for the SubmatrixTrait class.
Definition: SubmatrixTrait.h:118
Base template for the ColumnTrait class.
Definition: ColumnTrait.h:117
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:152
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:261
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
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:194
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
bool isUniLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower unitriangular matrix.
Definition: DenseMatrix.h:1151
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1755
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:721
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:245
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:88
Header file for the IsMatVecMultExpr type trait class.
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1802
Header file for the IsMatMatAddExpr type trait class.
Compile time check whether the given type is a declaration expression template.This type trait class ...
Definition: IsDeclExpr.h:71
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:119
Compile time check for data types with restricted data access.This type trait tests whether the given...
Definition: IsRestricted.h:82
Header file for the IsMatTransExpr type trait class.
Compile time check for low-level access to mutable data.This type trait tests whether the given data ...
Definition: HasMutableDataAccess.h:75
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: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
Base template for the RowTrait class.
Definition: RowTrait.h:117
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:2939
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.
typename SubvectorExprTrait< VT, AF >::Type SubvectorExprTrait_
Auxiliary alias declaration for the SubvectorExprTrait type trait.The SubvectorExprTrait_ alias decla...
Definition: SubvectorExprTrait.h:133
Evaluation of the expression type type of a submatrix operation.Via this type trait it is possible to...
Definition: SubmatrixExprTrait.h:80
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:336
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< 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:128
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
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
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:260
Constraint on the data type.
Constraint on the data type.
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< 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:128
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
typename DivTrait< T1, T2 >::Type DivTrait_
Auxiliary alias declaration for the DivTrait class template.The DivTrait_ alias declaration provides ...
Definition: DivTrait.h:245
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.
Compile time check whether the given type is a transposition expression template.This type trait clas...
Definition: IsTransExpr.h:71
typename T::LeftOperand LeftOperand_
Alias declaration for nested LeftOperand type definitions.The LeftOperand_ alias declaration provides...
Definition: Aliases.h:203
Header file for the HasConstDataAccess type trait.
Header file for the Matrix base class.
Header file for the SubmatrixExprTrait class template.
bool isStrictlyUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly upper triangular matrix.
Definition: DenseMatrix.h:1493
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2934
Base template for the AddTrait class.
Definition: AddTrait.h:143
Header file for the IsMatScalarDivExpr type trait class.
Base template for the MultTrait class.
Definition: MultTrait.h:143
Header file for the addition trait.
Header file for the division trait.
Header file for the submatrix trait.
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:93
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:775
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:94
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:697
#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:153
const DMatEvalExpr< MT, SO > eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:703
Header file for the IsMatMatSubExpr type trait class.
Evaluation of the return type of the derestrict function.Via this type trait it is possible to evalua...
Definition: DerestrictTrait.h:73
Header file for the RemoveReference type trait.
Header file for the IsDeclExpr type trait class.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
Base template for the DivTrait class.
Definition: DivTrait.h:143
typename ColumnTrait< MT >::Type ColumnTrait_
Auxiliary alias declaration for the ColumnTrait type trait.The ColumnTrait_ alias declaration provide...
Definition: ColumnTrait.h:152
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:320
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:164
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:733
const bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
Header file for the IsComputation type trait class.
typename SubTrait< T1, T2 >::Type SubTrait_
Auxiliary alias declaration for the SubTrait class template.The SubTrait_ alias declaration provides ...
Definition: SubTrait.h:245
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:1406
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:249
Header file for the SubvectorExprTrait class template.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Base template for the SubTrait class.
Definition: SubTrait.h:143
typename T::RightOperand RightOperand_
Alias declaration for nested RightOperand type definitions.The RightOperand_ alias declaration provid...
Definition: Aliases.h:363
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:168
Header file for the IsRestricted type trait.
Header file for the IsMatForEachExpr type trait class.
typename AddTrait< T1, T2 >::Type AddTrait_
Auxiliary alias declaration for the AddTrait class template.The AddTrait_ alias declaration provides ...
Definition: AddTrait.h:245
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.