Blaze  3.6
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/math/views/Check.h>
96 #include <blaze/util/Assert.h>
97 #include <blaze/util/DisableIf.h>
98 #include <blaze/util/EnableIf.h>
101 #include <blaze/util/MaybeUnused.h>
102 #include <blaze/util/SmallArray.h>
103 #include <blaze/util/StaticAssert.h>
104 #include <blaze/util/TypeList.h>
105 #include <blaze/util/Types.h>
107 
108 
109 namespace blaze {
110 
111 //=================================================================================================
112 //
113 // GLOBAL FUNCTIONS
114 //
115 //=================================================================================================
116 
117 //*************************************************************************************************
171 template< size_t I // Index of the first row
172  , size_t J // Index of the first column
173  , size_t M // Number of rows
174  , size_t N // Number of columns
175  , typename MT // Type of the dense matrix
176  , bool SO // Storage order
177  , typename... RSAs > // Optional submatrix arguments
178 inline decltype(auto) submatrix( Matrix<MT,SO>& matrix, RSAs... args )
179 {
181 
182  return submatrix<unaligned,I,J,M,N>( ~matrix, args... );
183 }
184 //*************************************************************************************************
185 
186 
187 //*************************************************************************************************
240 template< size_t I // Index of the first row
241  , size_t J // Index of the first column
242  , size_t M // Number of rows
243  , size_t N // Number of columns
244  , typename MT // Type of the dense matrix
245  , bool SO // Storage order
246  , typename... RSAs > // Option submatrix arguments
247 inline decltype(auto) submatrix( const Matrix<MT,SO>& matrix, RSAs... args )
248 {
250 
251  return submatrix<unaligned,I,J,M,N>( ~matrix, args... );
252 }
253 //*************************************************************************************************
254 
255 
256 //*************************************************************************************************
271 template< size_t I // Index of the first row
272  , size_t J // Index of the first column
273  , size_t M // Number of rows
274  , size_t N // Number of columns
275  , typename MT // Type of the dense matrix
276  , bool SO // Storage order
277  , typename... RSAs > // Option submatrix arguments
278 inline decltype(auto) submatrix( Matrix<MT,SO>&& matrix, RSAs... args )
279 {
281 
282  return submatrix<unaligned,I,J,M,N>( std::move( ~matrix ), args... );
283 }
284 //*************************************************************************************************
285 
286 
287 //*************************************************************************************************
353 template< AlignmentFlag AF // Alignment flag
354  , size_t I // Index of the first row
355  , size_t J // Index of the first column
356  , size_t M // Number of rows
357  , size_t N // Number of columns
358  , typename MT // Type of the dense matrix
359  , bool SO // Storage order
360  , typename... RSAs > // Option submatrix arguments
361 inline decltype(auto) submatrix( Matrix<MT,SO>& matrix, RSAs... args )
362 {
364 
365  using ReturnType = Submatrix_<MT,AF,I,J,M,N>;
366  return ReturnType( ~matrix, args... );
367 }
368 //*************************************************************************************************
369 
370 
371 //*************************************************************************************************
435 template< AlignmentFlag AF // Alignment flag
436  , size_t I // Index of the first row
437  , size_t J // Index of the first column
438  , size_t M // Number of rows
439  , size_t N // Number of columns
440  , typename MT // Type of the dense matrix
441  , bool SO // Storage order
442  , typename... RSAs > // Option submatrix arguments
443 inline decltype(auto) submatrix( const Matrix<MT,SO>& matrix, RSAs... args )
444 {
446 
447  using ReturnType = const Submatrix_<const MT,AF,I,J,M,N>;
448  return ReturnType( ~matrix, args... );
449 }
450 //*************************************************************************************************
451 
452 
453 //*************************************************************************************************
469 template< AlignmentFlag AF // Alignment flag
470  , size_t I // Index of the first row
471  , size_t J // Index of the first column
472  , size_t M // Number of rows
473  , size_t N // Number of columns
474  , typename MT // Type of the dense matrix
475  , bool SO // Storage order
476  , typename... RSAs > // Option submatrix arguments
477 inline decltype(auto) submatrix( Matrix<MT,SO>&& matrix, RSAs... args )
478 {
480 
481  using ReturnType = Submatrix_<MT,AF,I,J,M,N>;
482  return ReturnType( ~matrix, args... );
483 }
484 //*************************************************************************************************
485 
486 
487 //*************************************************************************************************
545 template< typename MT // Type of the dense matrix
546  , bool SO // Storage order
547  , typename... RSAs > // Option submatrix arguments
548 inline decltype(auto)
549  submatrix( Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n, RSAs... args )
550 {
552 
553  return submatrix<unaligned>( ~matrix, row, column, m, n, args... );
554 }
555 //*************************************************************************************************
556 
557 
558 //*************************************************************************************************
615 template< typename MT // Type of the dense matrix
616  , bool SO // Storage order
617  , typename... RSAs > // Option submatrix arguments
618 inline decltype(auto)
619  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n, RSAs... args )
620 {
622 
623  return submatrix<unaligned>( ~matrix, row, column, m, n, args... );
624 }
625 //*************************************************************************************************
626 
627 
628 //*************************************************************************************************
647 template< typename MT // Type of the dense matrix
648  , bool SO // Storage order
649  , typename... RSAs > // Option submatrix arguments
650 inline decltype(auto)
651  submatrix( Matrix<MT,SO>&& matrix, size_t row, size_t column, size_t m, size_t n, RSAs... args )
652 {
654 
655  return submatrix<unaligned>( std::move( ~matrix ), row, column, m, n, args... );
656 }
657 //*************************************************************************************************
658 
659 
660 //*************************************************************************************************
730 template< AlignmentFlag AF // Alignment flag
731  , typename MT // Type of the dense matrix
732  , bool SO // Storage order
733  , typename... RSAs > // Option submatrix arguments
734 inline decltype(auto)
735  submatrix( Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n, RSAs... args )
736 {
738 
739  using ReturnType = Submatrix_<MT,AF>;
740  return ReturnType( ~matrix, row, column, m, n, args... );
741 }
742 //*************************************************************************************************
743 
744 
745 //*************************************************************************************************
813 template< AlignmentFlag AF // Alignment flag
814  , typename MT // Type of the dense matrix
815  , bool SO // Storage order
816  , typename... RSAs > // Option submatrix arguments
817 inline decltype(auto)
818  submatrix( const Matrix<MT,SO>& matrix, size_t row, size_t column, size_t m, size_t n, RSAs... args )
819 {
821 
822  using ReturnType = const Submatrix_<const MT,AF>;
823  return ReturnType( ~matrix, row, column, m, n, args... );
824 }
825 //*************************************************************************************************
826 
827 
828 //*************************************************************************************************
848 template< AlignmentFlag AF // Alignment flag
849  , typename MT // Type of the dense matrix
850  , bool SO // Storage order
851  , typename... RSAs > // Option submatrix arguments
852 inline decltype(auto)
853  submatrix( Matrix<MT,SO>&& matrix, size_t row, size_t column, size_t m, size_t n, RSAs... args )
854 {
856 
857  using ReturnType = Submatrix_<MT,AF>;
858  return ReturnType( ~matrix, row, column, m, n, args... );
859 }
860 //*************************************************************************************************
861 
862 
863 
864 
865 //=================================================================================================
866 //
867 // GLOBAL RESTRUCTURING FUNCTIONS
868 //
869 //=================================================================================================
870 
871 //*************************************************************************************************
883 template< AlignmentFlag AF // Alignment flag
884  , size_t... CSAs // Compile time submatrix arguments
885  , typename MT // Matrix base type of the expression
886  , typename... RSAs > // Runtime submatrix arguments
887 inline decltype(auto) submatrix( const MatMatAddExpr<MT>& matrix, RSAs... args )
888 {
890 
891  return submatrix<AF,CSAs...>( (~matrix).leftOperand(), args... ) +
892  submatrix<AF,CSAs...>( (~matrix).rightOperand(), args... );
893 }
895 //*************************************************************************************************
896 
897 
898 //*************************************************************************************************
910 template< AlignmentFlag AF // Alignment flag
911  , size_t... CSAs // Compile time submatrix arguments
912  , typename MT // Matrix base type of the expression
913  , typename... RSAs > // Runtime submatrix arguments
914 inline decltype(auto) submatrix( const MatMatSubExpr<MT>& matrix, RSAs... args )
915 {
917 
918  return submatrix<AF,CSAs...>( (~matrix).leftOperand(), args... ) -
919  submatrix<AF,CSAs...>( (~matrix).rightOperand(), args... );
920 }
922 //*************************************************************************************************
923 
924 
925 //*************************************************************************************************
937 template< AlignmentFlag AF // Alignment flag
938  , size_t... CSAs // Compile time submatrix arguments
939  , typename MT // Matrix base type of the expression
940  , typename... RSAs > // Runtime submatrix arguments
941 inline decltype(auto) submatrix( const SchurExpr<MT>& matrix, RSAs... args )
942 {
944 
945  return submatrix<AF,CSAs...>( (~matrix).leftOperand(), args... ) %
946  submatrix<AF,CSAs...>( (~matrix).rightOperand(), args... );
947 }
949 //*************************************************************************************************
950 
951 
952 //*************************************************************************************************
964 template< AlignmentFlag AF // Alignment flag
965  , size_t... CSAs // Compile time submatrix arguments
966  , typename MT // Matrix base type of the expression
967  , typename... RSAs > // Runtime submatrix arguments
968 inline decltype(auto) submatrix( const MatMatMultExpr<MT>& matrix, RSAs... args )
969 {
971 
972  using MT1 = RemoveReference_t< LeftOperand_t< MatrixType_t<MT> > >;
973  using MT2 = RemoveReference_t< RightOperand_t< MatrixType_t<MT> > >;
974 
975  const SubmatrixData<CSAs...> sd( args... );
976 
977  decltype(auto) left ( (~matrix).leftOperand() );
978  decltype(auto) right( (~matrix).rightOperand() );
979 
980  const size_t begin( max( ( IsUpper_v<MT1> )
981  ?( ( !AF && IsStrictlyUpper_v<MT1> )
982  ?( sd.row() + 1UL )
983  :( sd.row() ) )
984  :( 0UL )
985  , ( IsLower_v<MT2> )
986  ?( ( !AF && IsStrictlyLower_v<MT2> )
987  ?( sd.column() + 1UL )
988  :( sd.column() ) )
989  :( 0UL ) ) );
990  const size_t end( min( ( IsLower_v<MT1> )
991  ?( ( IsStrictlyLower_v<MT1> && sd.rows() > 0UL )
992  ?( sd.row() + sd.rows() - 1UL )
993  :( sd.row() + sd.rows() ) )
994  :( left.columns() )
995  , ( IsUpper_v<MT2> )
996  ?( ( IsStrictlyUpper_v<MT2> && sd.columns() > 0UL )
997  ?( sd.column() + sd.columns() - 1UL )
998  :( sd.column() + sd.columns() ) )
999  :( left.columns() ) ) );
1000 
1001  const size_t diff( ( begin < end )?( end - begin ):( 0UL ) );
1002 
1003  return submatrix<AF>( left, sd.row(), begin, sd.rows(), diff ) *
1004  submatrix<AF>( right, begin, sd.column(), diff, sd.columns() );
1005 }
1007 //*************************************************************************************************
1008 
1009 
1010 //*************************************************************************************************
1022 template< AlignmentFlag AF // Alignment flag
1023  , size_t I // Index of the first row
1024  , size_t J // Index of the first column
1025  , size_t M // Number of rows
1026  , size_t N // Number of columns
1027  , typename MT // Matrix base type of the expression
1028  , typename... RSAs > // Optional submatrix arguments
1029 inline decltype(auto) submatrix( const MatMatKronExpr<MT>& matrix, RSAs... args )
1030 {
1032 
1033  return columns( rows( ~matrix, make_shifted_index_sequence<I,M>(), args... )
1034  , make_shifted_index_sequence<J,N>(), args... );
1035 }
1037 //*************************************************************************************************
1038 
1039 
1040 //*************************************************************************************************
1056 template< AlignmentFlag AF // Alignment flag
1057  , typename MT // Matrix base type of the expression
1058  , typename... RSAs > // Optional submatrix arguments
1059 inline decltype(auto)
1060  submatrix( const MatMatKronExpr<MT>& matrix, size_t row, size_t column, size_t m, size_t n, RSAs... args )
1061 {
1063 
1064  return columns( rows( ~matrix, [row]( size_t i ){ return i+row; }, m, args... )
1065  , [column]( size_t i ){ return i+column; }, n, args... );
1066 }
1068 //*************************************************************************************************
1069 
1070 
1071 //*************************************************************************************************
1082 template< AlignmentFlag AF // Alignment flag
1083  , size_t I // Index of the first row
1084  , size_t J // Index of the first column
1085  , size_t M // Number of rows
1086  , size_t N // Number of columns
1087  , typename MT // Matrix base type of the expression
1088  , typename... RSAs > // Runtime submatrix arguments
1089 inline decltype(auto) submatrix( const VecTVecMultExpr<MT>& matrix, RSAs... args )
1090 {
1092 
1093  return subvector<AF,I,M>( (~matrix).leftOperand(), args... ) *
1094  subvector<AF,J,N>( (~matrix).rightOperand(), args... );
1095 }
1097 //*************************************************************************************************
1098 
1099 
1100 //*************************************************************************************************
1115 template< AlignmentFlag AF // Alignment flag
1116  , typename MT // Matrix base type of the expression
1117  , typename... RSAs > // Runtime submatrix arguments
1118 inline decltype(auto)
1119  submatrix( const VecTVecMultExpr<MT>& matrix, size_t row, size_t column, size_t m, size_t n, RSAs... args )
1120 {
1122 
1123  return subvector<AF>( (~matrix).leftOperand(), row, m, args... ) *
1124  subvector<AF>( (~matrix).rightOperand(), column, n, args... );
1125 }
1127 //*************************************************************************************************
1128 
1129 
1130 //*************************************************************************************************
1142 template< AlignmentFlag AF // Alignment flag
1143  , size_t... CSAs // Compile time submatrix arguments
1144  , typename MT // Matrix base type of the expression
1145  , typename... RSAs > // Runtime submatrix arguments
1146 inline decltype(auto) submatrix( const MatScalarMultExpr<MT>& matrix, RSAs... args )
1147 {
1149 
1150  return submatrix<AF,CSAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
1151 }
1153 //*************************************************************************************************
1154 
1155 
1156 //*************************************************************************************************
1168 template< AlignmentFlag AF // Alignment flag
1169  , size_t... CSAs // Compile time submatrix arguments
1170  , typename MT // Matrix base type of the expression
1171  , typename... RSAs > // Runtime submatrix arguments
1172 inline decltype(auto) submatrix( const MatScalarDivExpr<MT>& matrix, RSAs... args )
1173 {
1175 
1176  return submatrix<AF,CSAs...>( (~matrix).leftOperand(), args... ) / (~matrix).rightOperand();
1177 }
1179 //*************************************************************************************************
1180 
1181 
1182 //*************************************************************************************************
1194 template< AlignmentFlag AF // Alignment flag
1195  , size_t... CSAs // Compile time submatrix arguments
1196  , typename MT // Matrix base type of the expression
1197  , typename... RSAs > // Runtime submatrix arguments
1198 inline decltype(auto) submatrix( const MatMapExpr<MT>& matrix, RSAs... args )
1199 {
1201 
1202  return map( submatrix<AF,CSAs...>( (~matrix).operand(), args... ), (~matrix).operation() );
1203 }
1205 //*************************************************************************************************
1206 
1207 
1208 //*************************************************************************************************
1220 template< AlignmentFlag AF // Alignment flag
1221  , size_t... CSAs // Compile time submatrix arguments
1222  , typename MT // Matrix base type of the expression
1223  , typename... RSAs > // Runtime submatrix arguments
1224 inline decltype(auto) submatrix( const MatMatMapExpr<MT>& matrix, RSAs... args )
1225 {
1227 
1228  return map( submatrix<AF,CSAs...>( (~matrix).leftOperand(), args... ),
1229  submatrix<AF,CSAs...>( (~matrix).rightOperand(), args... ),
1230  (~matrix).operation() );
1231 }
1233 //*************************************************************************************************
1234 
1235 
1236 //*************************************************************************************************
1248 template< AlignmentFlag AF // Alignment flag
1249  , size_t... CSAs // Compile time submatrix arguments
1250  , typename MT // Matrix base type of the expression
1251  , typename... RSAs > // Runtime submatrix arguments
1252 inline decltype(auto) submatrix( const MatEvalExpr<MT>& matrix, RSAs... args )
1253 {
1255 
1256  return eval( submatrix<AF,CSAs...>( (~matrix).operand(), args... ) );
1257 }
1259 //*************************************************************************************************
1260 
1261 
1262 //*************************************************************************************************
1274 template< AlignmentFlag AF // Alignment flag
1275  , size_t... CSAs // Compile time submatrix arguments
1276  , typename MT // Matrix base type of the expression
1277  , typename... RSAs > // Runtime submatrix arguments
1278 inline decltype(auto) submatrix( const MatSerialExpr<MT>& matrix, RSAs... args )
1279 {
1281 
1282  return serial( submatrix<AF,CSAs...>( (~matrix).operand(), args... ) );
1283 }
1285 //*************************************************************************************************
1286 
1287 
1288 //*************************************************************************************************
1300 template< AlignmentFlag AF // Alignment flag
1301  , size_t... CSAs // Compile time submatrix arguments
1302  , typename MT // Matrix base type of the expression
1303  , typename... RSAs > // Runtime submatrix arguments
1304 inline decltype(auto) submatrix( const DeclExpr<MT>& matrix, RSAs... args )
1305 {
1307 
1308  return submatrix<AF,CSAs...>( (~matrix).operand(), args... );
1309 }
1311 //*************************************************************************************************
1312 
1313 
1314 //*************************************************************************************************
1326 template< AlignmentFlag AF // Alignment flag
1327  , size_t I // Index of the first row
1328  , size_t J // Index of the first column
1329  , size_t M // Number of rows
1330  , size_t N // Number of columns
1331  , typename MT // Matrix base type of the expression
1332  , typename... RSAs > // Optional submatrix arguments
1333 inline decltype(auto) submatrix( const MatTransExpr<MT>& matrix, RSAs... args )
1334 {
1336 
1337  return trans( submatrix<AF,J,I,N,M>( (~matrix).operand(), args... ) );
1338 }
1340 //*************************************************************************************************
1341 
1342 
1343 //*************************************************************************************************
1359 template< AlignmentFlag AF // Alignment flag
1360  , typename MT // Matrix base type of the expression
1361  , typename... RSAs > // Optional submatrix arguments
1362 inline decltype(auto)
1363  submatrix( const MatTransExpr<MT>& matrix, size_t row, size_t column, size_t m, size_t n, RSAs... args )
1364 {
1366 
1367  return trans( submatrix<AF>( (~matrix).operand(), column, row, n, m, args... ) );
1368 }
1370 //*************************************************************************************************
1371 
1372 
1373 //*************************************************************************************************
1385 template< AlignmentFlag AF // Alignment flag
1386  , size_t I // Index of the first row
1387  , size_t J // Index of the first column
1388  , size_t M // Number of rows
1389  , size_t N // Number of columns
1390  , typename MT // Matrix base type of the expression
1391  , size_t... CEAs // Compile time expansion arguments
1392  , typename... RSAs > // Optional submatrix arguments
1393 inline decltype(auto) submatrix( const VecExpandExpr<MT,CEAs...>& matrix, RSAs... args )
1394 {
1396 
1397  using VT = VectorType_t< RemoveReference_t< decltype( (~matrix).operand() ) > >;
1398 
1399  constexpr bool TF( TransposeFlag_v<VT> );
1400 
1401  constexpr size_t index ( TF ? J : I );
1402  constexpr size_t size ( TF ? N : M );
1403  constexpr size_t expansion( TF ? M : N );
1404 
1405  return expand<expansion>( subvector<index,size>( (~matrix).operand(), args... ) );
1406 }
1408 //*************************************************************************************************
1409 
1410 
1411 //*************************************************************************************************
1427 template< AlignmentFlag AF // Alignment flag
1428  , typename MT // Matrix base type of the expression
1429  , size_t... CEAs // Compile time expansion arguments
1430  , typename... RSAs > // Optional submatrix arguments
1431 inline decltype(auto)
1432  submatrix( const VecExpandExpr<MT,CEAs...>& matrix,
1433  size_t row, size_t column, size_t m, size_t n, RSAs... args )
1434 {
1436 
1437  using VT = VectorType_t< RemoveReference_t< decltype( (~matrix).operand() ) > >;
1438 
1439  constexpr bool TF( TransposeFlag_v<VT> );
1440 
1441  const size_t index ( TF ? column : row );
1442  const size_t size ( TF ? n : m );
1443  const size_t expansion( TF ? m : n );
1444 
1445  return expand( subvector( (~matrix).operand(), index, size, args... ), expansion );
1446 }
1448 //*************************************************************************************************
1449 
1450 
1451 
1452 
1453 //=================================================================================================
1454 //
1455 // GLOBAL RESTRUCTURING FUNCTIONS (SUBMATRIX)
1456 //
1457 //=================================================================================================
1458 
1459 //*************************************************************************************************
1470 template< AlignmentFlag AF // Required alignment flag
1471  , size_t I // Required index of the first row
1472  , size_t J // Required index of the first column
1473  , size_t M // Required number of rows
1474  , size_t N // Required number of columns
1475  , typename MT // Type of the sparse submatrix
1476  , typename... RSAs // Optional submatrix arguments
1477  , EnableIf_t< IsSubmatrix_v< RemoveReference_t<MT> > &&
1478  RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
1479 inline decltype(auto) submatrix( MT&& sm, RSAs... args )
1480 {
1482 
1483  constexpr size_t I2( RemoveReference_t<MT>::row() );
1484  constexpr size_t J2( RemoveReference_t<MT>::column() );
1485  constexpr size_t M2( RemoveReference_t<MT>::rows() );
1486  constexpr size_t N2( RemoveReference_t<MT>::columns() );
1487 
1488  BLAZE_STATIC_ASSERT_MSG( I + M <= M2, "Invalid submatrix specification" );
1489  BLAZE_STATIC_ASSERT_MSG( J + N <= N2, "Invalid submatrix specification" );
1490 
1491  return submatrix<AF,I+I2,J+J2,M,N>( sm.operand(), args... );
1492 }
1494 //*************************************************************************************************
1495 
1496 
1497 //*************************************************************************************************
1509 template< AlignmentFlag AF // Required alignment flag
1510  , size_t I // Index of the first row
1511  , size_t J // Index of the first column
1512  , size_t M // Number of rows
1513  , size_t N // Number of columns
1514  , typename MT // Type of the sparse submatrix
1515  , typename... RSAs // Optional submatrix arguments
1516  , EnableIf_t< IsSubmatrix_v< RemoveReference_t<MT> > >* = nullptr >
1517 inline decltype(auto) submatrix( MT&& sm, RSAs... args )
1518 {
1520 
1521  constexpr bool isChecked( !Contains_v< TypeList<RSAs...>, Unchecked > );
1522 
1523  if( isChecked ) {
1524  if( ( I + M > sm.rows() ) || ( J + N > sm.columns() ) ) {
1525  BLAZE_THROW_INVALID_ARGUMENT( "Invalid submatrix specification" );
1526  }
1527  }
1528  else {
1529  BLAZE_USER_ASSERT( I + M <= sm.rows() , "Invalid submatrix specification" );
1530  BLAZE_USER_ASSERT( J + N <= sm.columns(), "Invalid submatrix specification" );
1531  }
1532 
1533  return submatrix<AF>( sm.operand(), sm.row() + I, sm.column() + J, M, N, args... );
1534 }
1536 //*************************************************************************************************
1537 
1538 
1539 //*************************************************************************************************
1555 template< AlignmentFlag AF // Required alignment flag
1556  , typename MT // Type of the sparse submatrix
1557  , typename... RSAs // Optional submatrix arguments
1558  , EnableIf_t< IsSubmatrix_v< RemoveReference_t<MT> > >* = nullptr >
1559 inline decltype(auto) submatrix( MT&& sm, size_t row, size_t column, size_t m, size_t n, RSAs... args )
1560 {
1562 
1563  constexpr bool isChecked( !Contains_v< TypeList<RSAs...>, Unchecked > );
1564 
1565  if( isChecked ) {
1566  if( ( row + m > sm.rows() ) || ( column + n > sm.columns() ) ) {
1567  BLAZE_THROW_INVALID_ARGUMENT( "Invalid submatrix specification" );
1568  }
1569  }
1570  else {
1571  BLAZE_USER_ASSERT( row + m <= sm.rows() , "Invalid submatrix specification" );
1572  BLAZE_USER_ASSERT( column + n <= sm.columns(), "Invalid submatrix specification" );
1573  }
1574 
1575  return submatrix<AF>( sm.operand(), sm.row() + row, sm.column() + column, m, n, args... );
1576 }
1578 //*************************************************************************************************
1579 
1580 
1581 
1582 
1583 //=================================================================================================
1584 //
1585 // GLOBAL RESTRUCTURING FUNCTIONS (SUBVECTOR)
1586 //
1587 //=================================================================================================
1588 
1589 //*************************************************************************************************
1601 template< AlignmentFlag AF // Alignment flag
1602  , size_t... CSAs // Compile time subvector arguments
1603  , typename VT // Vector base type of the expression
1604  , typename... RSAs > // Runtime subvector arguments
1605 inline decltype(auto) subvector( const MatVecMultExpr<VT>& vector, RSAs... args )
1606 {
1608 
1609  using MT = RemoveReference_t< LeftOperand_t< VectorType_t<VT> > >;
1610 
1611  const SubvectorData<CSAs...> sd( args... );
1612 
1613  decltype(auto) left ( (~vector).leftOperand() );
1614  decltype(auto) right( (~vector).rightOperand() );
1615 
1616  const size_t column( ( IsUpper_v<MT> )
1617  ?( ( !AF && IsStrictlyUpper_v<MT> )?( sd.offset() + 1UL ):( sd.offset() ) )
1618  :( 0UL ) );
1619  const size_t n( ( IsLower_v<MT> )
1620  ?( ( IsUpper_v<MT> )?( sd.size() )
1621  :( ( IsStrictlyLower_v<MT> && sd.size() > 0UL )
1622  ?( sd.offset() + sd.size() - 1UL )
1623  :( sd.offset() + sd.size() ) ) )
1624  :( ( IsUpper_v<MT> )?( left.columns() - column )
1625  :( left.columns() ) ) );
1626 
1627  return submatrix<AF>( left, sd.offset(), column, sd.size(), n ) * subvector<AF>( right, column, n );
1628 }
1630 //*************************************************************************************************
1631 
1632 
1633 //*************************************************************************************************
1645 template< AlignmentFlag AF // Alignment flag
1646  , size_t... CSAs // Compile time subvector arguments
1647  , typename VT // Vector base type of the expression
1648  , typename... RSAs > // Runtime subvector arguments
1649 inline decltype(auto) subvector( const TVecMatMultExpr<VT>& vector, RSAs... args )
1650 {
1652 
1653  using MT = RemoveReference_t< RightOperand_t< VectorType_t<VT> > >;
1654 
1655  const SubvectorData<CSAs...> sd( args... );
1656 
1657  decltype(auto) left ( (~vector).leftOperand() );
1658  decltype(auto) right( (~vector).rightOperand() );
1659 
1660  const size_t row( ( IsLower_v<MT> )
1661  ?( ( !AF && IsStrictlyLower_v<MT> )?( sd.offset() + 1UL ):( sd.offset() ) )
1662  :( 0UL ) );
1663  const size_t m( ( IsUpper_v<MT> )
1664  ?( ( IsLower_v<MT> )?( sd.size() )
1665  :( ( IsStrictlyUpper_v<MT> && sd.size() > 0UL )
1666  ?( sd.offset() + sd.size() - 1UL )
1667  :( sd.offset() + sd.size() ) ) )
1668  :( ( IsLower_v<MT> )?( right.rows() - row )
1669  :( right.rows() ) ) );
1670 
1671  return subvector<AF>( left, row, m ) * submatrix<AF>( right, row, sd.offset(), m, sd.size() );
1672 }
1674 //*************************************************************************************************
1675 
1676 
1677 //*************************************************************************************************
1689 template< AlignmentFlag AF // Alignment flag
1690  , size_t... CSAs // Compile time subvector arguments
1691  , typename VT // Vector base type of the expression
1692  , typename... RSAs > // Runtime subvector arguments
1693 inline decltype(auto) subvector( const MatReduceExpr<VT,columnwise>& vector, RSAs... args )
1694 {
1696 
1697  const SubvectorData<CSAs...> sd( args... );
1698  const size_t M( (~vector).operand().rows() );
1699 
1700  decltype(auto) sm( submatrix<AF>( (~vector).operand(), 0UL, sd.offset(), M, sd.size() ) );
1701  return reduce<columnwise>( sm, (~vector).operation() );
1702 }
1704 //*************************************************************************************************
1705 
1706 
1707 //*************************************************************************************************
1719 template< AlignmentFlag AF // Alignment flag
1720  , size_t... CSAs // Compile time subvector arguments
1721  , typename VT // Vector base type of the expression
1722  , typename... RSAs > // Runtime subvector arguments
1723 inline decltype(auto) subvector( const MatReduceExpr<VT,rowwise>& vector, RSAs... args )
1724 {
1726 
1727  const SubvectorData<CSAs...> sd( args... );
1728  const size_t N( (~vector).operand().columns() );
1729 
1730  decltype(auto) sm( submatrix<AF>( (~vector).operand(), sd.offset(), 0UL, sd.size(), N ) );
1731  return reduce<rowwise>( sm, (~vector).operation() );
1732 }
1734 //*************************************************************************************************
1735 
1736 
1737 
1738 
1739 //=================================================================================================
1740 //
1741 // GLOBAL RESTRUCTURING FUNCTIONS (ROW)
1742 //
1743 //=================================================================================================
1744 
1745 //*************************************************************************************************
1756 template< size_t I // Row index
1757  , typename MT // Type of the sparse submatrix
1758  , typename... RRAs // Optional row arguments
1760  RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
1761 inline decltype(auto) row( MT&& sm, RRAs... args )
1762 {
1764 
1765  constexpr size_t I2( RemoveReference_t<MT>::row() );
1766  constexpr size_t J ( RemoveReference_t<MT>::column() );
1767  constexpr size_t M ( RemoveReference_t<MT>::rows() );
1768  constexpr size_t N ( RemoveReference_t<MT>::columns() );
1769 
1770  BLAZE_STATIC_ASSERT_MSG( I < M, "Invalid row access index" );
1771 
1772  return subvector<J,N>( row<I+I2>( sm.operand(), args... ), unchecked );
1773 }
1775 //*************************************************************************************************
1776 
1777 
1778 //*************************************************************************************************
1791 template< typename MT // Type of the sparse submatrix
1792  , typename... RRAs // Optional row arguments
1793  , EnableIf_t< IsSubmatrix_v< RemoveReference_t<MT> > &&
1794  RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
1795 inline decltype(auto) row( MT&& sm, size_t index, RRAs... args )
1796 {
1798 
1799  constexpr size_t I( RemoveReference_t<MT>::row() );
1800  constexpr size_t J( RemoveReference_t<MT>::column() );
1801  constexpr size_t M( RemoveReference_t<MT>::rows() );
1802  constexpr size_t N( RemoveReference_t<MT>::columns() );
1803 
1804  constexpr bool isChecked( !Contains_v< TypeList<RRAs...>, Unchecked > );
1805 
1806  if( isChecked ) {
1807  if( ( index >= M ) ) {
1808  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
1809  }
1810  }
1811  else {
1812  BLAZE_USER_ASSERT( index < M, "Invalid row access index" );
1813  }
1814 
1815  return subvector<J,N>( row( sm.operand(), I+index, args... ), unchecked );
1816 }
1818 //*************************************************************************************************
1819 
1820 
1821 //*************************************************************************************************
1833 template< size_t... CRAs // Compile time row arguments
1834  , typename MT // Type of the sparse submatrix
1835  , typename... RRAs // Runtime row arguments
1836  , EnableIf_t< IsSubmatrix_v< RemoveReference_t<MT> > &&
1837  !RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
1838 inline decltype(auto) row( MT&& sm, RRAs... args )
1839 {
1841 
1842  const RowData<CRAs...> rd( args... );
1843 
1844  constexpr bool isChecked( !Contains_v< TypeList<RRAs...>, Unchecked > );
1845 
1846  if( isChecked ) {
1847  if( ( rd.row() >= sm.rows() ) ) {
1848  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
1849  }
1850  }
1851  else {
1852  BLAZE_USER_ASSERT( rd.row() < sm.rows(), "Invalid row access index" );
1853  }
1854 
1855  const size_t index( rd.row() + sm.row() );
1856 
1857  return subvector( row( sm.operand(), index, args... ), sm.column(), sm.columns(), unchecked );
1858 }
1860 //*************************************************************************************************
1861 
1862 
1863 
1864 
1865 //=================================================================================================
1866 //
1867 // GLOBAL RESTRUCTURING FUNCTIONS (ROWS)
1868 //
1869 //=================================================================================================
1870 
1871 //*************************************************************************************************
1882 template< size_t I // First row index
1883  , size_t... Is // Remaining row indices
1884  , typename MT // Type of the sparse submatrix
1885  , typename... RRAs // Optional row arguments
1886  , EnableIf_t< IsSubmatrix_v< RemoveReference_t<MT> > &&
1887  RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
1888 inline decltype(auto) rows( MT&& sm, RRAs... args )
1889 {
1891 
1892  constexpr size_t I2( RemoveReference_t<MT>::row() );
1893  constexpr size_t J ( RemoveReference_t<MT>::column() );
1894  constexpr size_t M ( RemoveReference_t<MT>::rows() );
1895  constexpr size_t N ( RemoveReference_t<MT>::columns() );
1896 
1897  return submatrix<0UL,J,sizeof...(Is)+1UL,N>(
1898  rows( sm.operand(), make_shifted_index_subsequence<I2,M,I,Is...>(), args... ), unchecked );
1899 }
1901 //*************************************************************************************************
1902 
1903 
1904 //*************************************************************************************************
1916 template< size_t I // First row index
1917  , size_t... Is // Remaining row indices
1918  , typename MT // Type of the sparse submatrix
1919  , typename... RRAs // Optional row arguments
1920  , EnableIf_t< IsSubmatrix_v< RemoveReference_t<MT> > &&
1921  !RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
1922 inline decltype(auto) rows( MT&& sm, RRAs... args )
1923 {
1925 
1926  constexpr bool isChecked( !Contains_v< TypeList<RRAs...>, Unchecked > );
1927 
1928  if( isChecked ) {
1929  static constexpr size_t indices[] = { I, Is... };
1930  for( size_t i=0UL; i<sizeof...(Is)+1UL; ++i ) {
1931  if( sm.rows() <= indices[i] ) {
1932  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
1933  }
1934  }
1935  }
1936 
1937  return submatrix( rows( sm.operand(), { I+sm.row(), Is+sm.row()... }, args... ),
1938  0UL, sm.column(), sizeof...(Is)+1UL, sm.columns(), unchecked );
1939 }
1941 //*************************************************************************************************
1942 
1943 
1944 //*************************************************************************************************
1958 template< typename MT // Type of the sparse submatrix
1959  , typename T // Type of the row indices
1960  , typename... RRAs // Optional row arguments
1961  , EnableIf_t< IsSubmatrix_v< RemoveReference_t<MT> > >* = nullptr >
1962 inline decltype(auto) rows( MT&& sm, T* indices, size_t n, RRAs... args )
1963 {
1965 
1966  constexpr bool isChecked( !Contains_v< TypeList<RRAs...>, Unchecked > );
1967 
1968  if( isChecked ) {
1969  for( size_t i=0UL; i<n; ++i ) {
1970  if( sm.rows() <= size_t( indices[i] ) ) {
1971  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row specification" );
1972  }
1973  }
1974  }
1975 
1976  SmallArray<size_t,128UL> newIndices( indices, indices+n );
1977  std::for_each( newIndices.begin(), newIndices.end(),
1978  [row=sm.row()]( size_t& index ){ index += row; } );
1979 
1980  return submatrix( rows( sm.operand(), newIndices.data(), n, args... ),
1981  0UL, sm.column(), n, sm.columns(), unchecked );
1982 }
1984 //*************************************************************************************************
1985 
1986 
1987 //*************************************************************************************************
2001 template< typename MT // Type of the sparse submatrix
2002  , typename P // Type of the index producer
2003  , typename... RRAs // Optional row arguments
2004  , EnableIf_t< IsSubmatrix_v< RemoveReference_t<MT> > >* = nullptr >
2005 inline decltype(auto) rows( MT&& sm, P p, size_t n, RRAs... args )
2006 {
2008 
2009  constexpr bool isChecked( !Contains_v< TypeList<RRAs...>, Unchecked > );
2010 
2011  if( isChecked ) {
2012  for( size_t i=0UL; i<n; ++i ) {
2013  if( sm.rows() <= size_t( p(i) ) ) {
2014  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row specification" );
2015  }
2016  }
2017  }
2018 
2019  return submatrix( rows( sm.operand(), [p,offset=sm.row()]( size_t i ){ return p(i)+offset; }, n, args... ),
2020  0UL, sm.column(), n, sm.columns(), unchecked );
2021 }
2023 //*************************************************************************************************
2024 
2025 
2026 
2027 
2028 //=================================================================================================
2029 //
2030 // GLOBAL RESTRUCTURING FUNCTIONS (COLUMN)
2031 //
2032 //=================================================================================================
2033 
2034 //*************************************************************************************************
2045 template< size_t I // Column index
2046  , typename MT // Type of the sparse submatrix
2047  , typename... RCAs // Optional column arguments
2048  , EnableIf_t< IsSubmatrix_v< RemoveReference_t<MT> > &&
2049  RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
2050 inline decltype(auto) column( MT&& sm, RCAs... args )
2051 {
2053 
2054  constexpr size_t I2( RemoveReference_t<MT>::row() );
2055  constexpr size_t J ( RemoveReference_t<MT>::column() );
2056  constexpr size_t M ( RemoveReference_t<MT>::rows() );
2057  constexpr size_t N ( RemoveReference_t<MT>::columns() );
2058 
2059  BLAZE_STATIC_ASSERT_MSG( I < N, "Invalid column access index" );
2060 
2061  return subvector<I2,M>( column<I+J>( sm.operand(), args... ), unchecked );
2062 }
2064 //*************************************************************************************************
2065 
2066 
2067 //*************************************************************************************************
2080 template< typename MT // Type of the sparse submatrix
2081  , typename... RCAs // Optional column arguments
2082  , EnableIf_t< IsSubmatrix_v< RemoveReference_t<MT> > &&
2083  RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
2084 inline decltype(auto) column( MT&& sm, size_t index, RCAs... args )
2085 {
2087 
2088  constexpr size_t I( RemoveReference_t<MT>::row() );
2089  constexpr size_t J( RemoveReference_t<MT>::column() );
2090  constexpr size_t M( RemoveReference_t<MT>::rows() );
2091  constexpr size_t N( RemoveReference_t<MT>::columns() );
2092 
2093  constexpr bool isChecked( !Contains_v< TypeList<RCAs...>, Unchecked > );
2094 
2095  if( isChecked ) {
2096  if( ( index >= N ) ) {
2097  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
2098  }
2099  }
2100  else {
2101  BLAZE_USER_ASSERT( index < N, "Invalid column access index" );
2102  }
2103 
2104  return subvector<I,M>( column( sm.operand(), J+index, args... ), unchecked );
2105 }
2107 //*************************************************************************************************
2108 
2109 
2110 //*************************************************************************************************
2122 template< size_t... CCAs // Compile time column arguments
2123  , typename MT // Type of the sparse submatrixy
2124  , typename... RCAs // Runtime column arguments
2125  , EnableIf_t< IsSubmatrix_v< RemoveReference_t<MT> > &&
2126  !RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
2127 inline decltype(auto) column( MT&& sm, RCAs... args )
2128 {
2130 
2131  const ColumnData<CCAs...> cd( args... );
2132 
2133  constexpr bool isChecked( !Contains_v< TypeList<RCAs...>, Unchecked > );
2134 
2135  if( isChecked ) {
2136  if( ( cd.column() >= sm.columns() ) ) {
2137  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
2138  }
2139  }
2140  else {
2141  BLAZE_USER_ASSERT( cd.column() < sm.columns(), "Invalid column access index" );
2142  }
2143 
2144  const size_t index( cd.column() + sm.column() );
2145 
2146  return subvector( column( sm.operand(), index, args... ), sm.row(), sm.rows(), unchecked );
2147 }
2149 //*************************************************************************************************
2150 
2151 
2152 
2153 
2154 //=================================================================================================
2155 //
2156 // GLOBAL RESTRUCTURING FUNCTIONS (COLUMNS)
2157 //
2158 //=================================================================================================
2159 
2160 //*************************************************************************************************
2171 template< size_t I // First column index
2172  , size_t... Is // Remaining column indices
2173  , typename MT // Type of the sparse submatrix
2174  , typename... RCAs // Optional column arguments
2175  , EnableIf_t< IsSubmatrix_v< RemoveReference_t<MT> > &&
2176  RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
2177 inline decltype(auto) columns( MT&& sm, RCAs... args )
2178 {
2180 
2181  constexpr size_t I2( RemoveReference_t<MT>::row() );
2182  constexpr size_t J ( RemoveReference_t<MT>::column() );
2183  constexpr size_t M ( RemoveReference_t<MT>::rows() );
2184  constexpr size_t N ( RemoveReference_t<MT>::columns() );
2185 
2186  return submatrix<I2,0UL,M,sizeof...(Is)+1UL>(
2187  columns( sm.operand(), make_shifted_index_subsequence<J,N,I,Is...>(), args... ), unchecked );
2188 }
2190 //*************************************************************************************************
2191 
2192 
2193 //*************************************************************************************************
2205 template< size_t I // First column index
2206  , size_t... Is // Remaining column indices
2207  , typename MT // Type of the sparse submatrix
2208  , typename... RCAs // Optional column arguments
2209  , EnableIf_t< IsSubmatrix_v< RemoveReference_t<MT> > &&
2210  !RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
2211 inline decltype(auto) columns( MT&& sm, RCAs... args )
2212 {
2214 
2215  constexpr bool isChecked( !Contains_v< TypeList<RCAs...>, Unchecked > );
2216 
2217  if( isChecked ) {
2218  static constexpr size_t indices[] = { I, Is... };
2219  for( size_t j=0UL; j<sizeof...(Is)+1UL; ++j ) {
2220  if( sm.columns() <= indices[j] ) {
2221  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
2222  }
2223  }
2224  }
2225 
2226  return submatrix( columns( sm.operand(), { I+sm.column(), Is+sm.column()... }, args... ),
2227  sm.row(), 0UL, sm.rows(), sizeof...(Is)+1UL, unchecked );
2228 }
2230 //*************************************************************************************************
2231 
2232 
2233 //*************************************************************************************************
2247 template< typename MT // Type of the sparse submatrix
2248  , typename T // Type of the column indices
2249  , typename... RCAs // Optional column arguments
2250  , EnableIf_t< IsSubmatrix_v< RemoveReference_t<MT> > >* = nullptr >
2251 inline decltype(auto) columns( MT&& sm, T* indices, size_t n, RCAs... args )
2252 {
2254 
2255  constexpr bool isChecked( !Contains_v< TypeList<RCAs...>, Unchecked > );
2256 
2257  if( isChecked ) {
2258  for( size_t j=0UL; j<n; ++j ) {
2259  if( sm.columns() <= size_t( indices[j] ) ) {
2260  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column specification" );
2261  }
2262  }
2263  }
2264 
2265  SmallArray<size_t,128UL> newIndices( indices, indices+n );
2266  std::for_each( newIndices.begin(), newIndices.end(),
2267  [column=sm.column()]( size_t& index ){ index += column; } );
2268 
2269  return submatrix( columns( sm.operand(), newIndices.data(), n, args... ),
2270  sm.row(), 0UL, sm.rows(), n, unchecked );
2271 }
2273 //*************************************************************************************************
2274 
2275 
2276 //*************************************************************************************************
2290 template< typename MT // Type of the sparse submatrix
2291  , typename P // Type of the index producer
2292  , typename... RCAs // Optional column arguments
2293  , EnableIf_t< IsSubmatrix_v< RemoveReference_t<MT> > >* = nullptr >
2294 inline decltype(auto) columns( MT&& sm, P p, size_t n, RCAs... args )
2295 {
2297 
2298  constexpr bool isChecked( !Contains_v< TypeList<RCAs...>, Unchecked > );
2299 
2300  if( isChecked ) {
2301  for( size_t j=0UL; j<n; ++j ) {
2302  if( sm.columns() <= size_t( p(j) ) ) {
2303  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column specification" );
2304  }
2305  }
2306  }
2307 
2308  return submatrix( columns( sm.operand(), [p,offset=sm.column()]( size_t i ){ return p(i)+offset; }, n, args... ),
2309  sm.row(), 0UL, sm.rows(), n, unchecked );
2310 }
2312 //*************************************************************************************************
2313 
2314 
2315 
2316 
2317 //=================================================================================================
2318 //
2319 // SUBMATRIX OPERATORS
2320 //
2321 //=================================================================================================
2322 
2323 //*************************************************************************************************
2331 template< typename MT // Type of the matrix
2332  , AlignmentFlag AF // Alignment flag
2333  , bool SO // Storage order
2334  , bool DF // Density flag
2335  , size_t... CSAs > // Compile time submatrix arguments
2336 inline void reset( Submatrix<MT,AF,SO,DF,CSAs...>& sm )
2337 {
2338  sm.reset();
2339 }
2341 //*************************************************************************************************
2342 
2343 
2344 //*************************************************************************************************
2352 template< typename MT // Type of the matrix
2353  , AlignmentFlag AF // Alignment flag
2354  , bool SO // Storage order
2355  , bool DF // Density flag
2356  , size_t... CSAs > // Compile time submatrix arguments
2357 inline void reset( Submatrix<MT,AF,SO,DF,CSAs...>&& sm )
2358 {
2359  sm.reset();
2360 }
2362 //*************************************************************************************************
2363 
2364 
2365 //*************************************************************************************************
2379 template< typename MT // Type of the matrix
2380  , AlignmentFlag AF // Alignment flag
2381  , bool SO // Storage order
2382  , bool DF // Density flag
2383  , size_t... CSAs > // Compile time submatrix arguments
2384 inline void reset( Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t i )
2385 {
2386  sm.reset( i );
2387 }
2389 //*************************************************************************************************
2390 
2391 
2392 //*************************************************************************************************
2402 template< typename MT // Type of the matrix
2403  , AlignmentFlag AF // Alignment flag
2404  , bool SO // Storage order
2405  , bool DF // Density flag
2406  , size_t... CSAs > // Compile time submatrix arguments
2407 inline void clear( Submatrix<MT,AF,SO,DF,CSAs...>& sm )
2408 {
2409  sm.reset();
2410 }
2412 //*************************************************************************************************
2413 
2414 
2415 //*************************************************************************************************
2425 template< typename MT // Type of the matrix
2426  , AlignmentFlag AF // Alignment flag
2427  , bool SO // Storage order
2428  , bool DF // Density flag
2429  , size_t... CSAs > // Compile time submatrix arguments
2430 inline void clear( Submatrix<MT,AF,SO,DF,CSAs...>&& sm )
2431 {
2432  sm.reset();
2433 }
2435 //*************************************************************************************************
2436 
2437 
2438 //*************************************************************************************************
2464 template< bool RF // Relaxation flag
2465  , typename MT // Type of the dense matrix
2466  , AlignmentFlag AF // Alignment flag
2467  , bool SO // Storage order
2468  , size_t... CSAs > // Compile time submatrix arguments
2469 inline bool isDefault( const Submatrix<MT,AF,SO,true,CSAs...>& sm )
2470 {
2471  using blaze::isDefault;
2472 
2473  if( SO == rowMajor ) {
2474  for( size_t i=0UL; i<(~sm).rows(); ++i )
2475  for( size_t j=0UL; j<(~sm).columns(); ++j )
2476  if( !isDefault<RF>( (~sm)(i,j) ) )
2477  return false;
2478  }
2479  else {
2480  for( size_t j=0UL; j<(~sm).columns(); ++j )
2481  for( size_t i=0UL; i<(~sm).rows(); ++i )
2482  if( !isDefault<RF>( (~sm)(i,j) ) )
2483  return false;
2484  }
2485 
2486  return true;
2487 }
2489 //*************************************************************************************************
2490 
2491 
2492 //*************************************************************************************************
2518 template< bool RF // Relaxation flag
2519  , typename MT // Type of the sparse matrix
2520  , AlignmentFlag AF // Alignment flag
2521  , bool SO // Storage order
2522  , size_t... CSAs > // Compile time submatrix arguments
2523 inline bool isDefault( const Submatrix<MT,AF,SO,false,CSAs...>& sm )
2524 {
2525  using blaze::isDefault;
2526 
2527  const size_t iend( ( SO == rowMajor)?( sm.rows() ):( sm.columns() ) );
2528 
2529  for( size_t i=0UL; i<iend; ++i ) {
2530  for( auto element=sm.cbegin(i); element!=sm.cend(i); ++element )
2531  if( !isDefault<RF>( element->value() ) ) return false;
2532  }
2533 
2534  return true;
2535 }
2537 //*************************************************************************************************
2538 
2539 
2540 //*************************************************************************************************
2559 template< typename MT // Type of the matrix
2560  , AlignmentFlag AF // Alignment flag
2561  , bool SO // Storage order
2562  , bool DF // Density flag
2563  , size_t... CSAs > // Compile time submatrix arguments
2564 inline bool isIntact( const Submatrix<MT,AF,SO,DF,CSAs...>& sm ) noexcept
2565 {
2566  return ( sm.row() + sm.rows() <= sm.operand().rows() &&
2567  sm.column() + sm.columns() <= sm.operand().columns() &&
2568  isIntact( sm.operand() ) );
2569 }
2571 //*************************************************************************************************
2572 
2573 
2574 //*************************************************************************************************
2595 template< typename MT // Type of the matrix
2596  , AlignmentFlag AF // Alignment flag
2597  , bool SO // Storage order
2598  , bool DF // Density flag
2599  , size_t... CSAs > // Compile time submatrix arguments
2600 inline bool isSymmetric( const Submatrix<MT,AF,SO,DF,CSAs...>& sm )
2601 {
2602  using BaseType = BaseType_t< Submatrix<MT,AF,SO,DF,CSAs...> >;
2603 
2604  if( IsSymmetric_v<MT> && sm.row() == sm.column() && sm.rows() == sm.columns() )
2605  return true;
2606  else return isSymmetric( static_cast<const BaseType&>( sm ) );
2607 }
2609 //*************************************************************************************************
2610 
2611 
2612 //*************************************************************************************************
2633 template< typename MT // Type of the matrix
2634  , AlignmentFlag AF // Alignment flag
2635  , bool SO // Storage order
2636  , bool DF // Density flag
2637  , size_t... CSAs > // Compile time submatrix arguments
2638 inline bool isHermitian( const Submatrix<MT,AF,SO,DF,CSAs...>& sm )
2639 {
2640  using BaseType = BaseType_t< Submatrix<MT,AF,SO,DF,CSAs...> >;
2641 
2642  if( IsHermitian_v<MT> && sm.row() == sm.column() && sm.rows() == sm.columns() )
2643  return true;
2644  else return isHermitian( static_cast<const BaseType&>( sm ) );
2645 }
2647 //*************************************************************************************************
2648 
2649 
2650 //*************************************************************************************************
2681 template< typename MT // Type of the matrix
2682  , AlignmentFlag AF // Alignment flag
2683  , bool SO // Storage order
2684  , bool DF // Density flag
2685  , size_t... CSAs > // Compile time submatrix arguments
2686 inline bool isLower( const Submatrix<MT,AF,SO,DF,CSAs...>& sm )
2687 {
2688  using BaseType = BaseType_t< Submatrix<MT,AF,SO,DF,CSAs...> >;
2689 
2690  if( IsLower_v<MT> && sm.row() == sm.column() && sm.rows() == sm.columns() )
2691  return true;
2692  else return isLower( static_cast<const BaseType&>( sm ) );
2693 }
2695 //*************************************************************************************************
2696 
2697 
2698 //*************************************************************************************************
2728 template< typename MT // Type of the matrix
2729  , AlignmentFlag AF // Alignment flag
2730  , bool SO // Storage order
2731  , bool DF // Density flag
2732  , size_t... CSAs > // Compile time submatrix arguments
2733 inline bool isUniLower( const Submatrix<MT,AF,SO,DF,CSAs...>& sm )
2734 {
2735  using BaseType = BaseType_t< Submatrix<MT,AF,SO,DF,CSAs...> >;
2736 
2737  if( IsUniLower_v<MT> && sm.row() == sm.column() && sm.rows() == sm.columns() )
2738  return true;
2739  else return isUniLower( static_cast<const BaseType&>( sm ) );
2740 }
2742 //*************************************************************************************************
2743 
2744 
2745 //*************************************************************************************************
2775 template< typename MT // Type of the matrix
2776  , AlignmentFlag AF // Alignment flag
2777  , bool SO // Storage order
2778  , bool DF // Density flag
2779  , size_t... CSAs > // Compile time submatrix arguments
2780 inline bool isStrictlyLower( const Submatrix<MT,AF,SO,DF,CSAs...>& sm )
2781 {
2782  using BaseType = BaseType_t< Submatrix<MT,AF,SO,DF,CSAs...> >;
2783 
2784  if( IsStrictlyLower_v<MT> && sm.row() == sm.column() && sm.rows() == sm.columns() )
2785  return true;
2786  else return isStrictlyLower( static_cast<const BaseType&>( sm ) );
2787 }
2789 //*************************************************************************************************
2790 
2791 
2792 //*************************************************************************************************
2823 template< typename MT // Type of the matrix
2824  , AlignmentFlag AF // Alignment flag
2825  , bool SO // Storage order
2826  , bool DF // Density flag
2827  , size_t... CSAs > // Compile time submatrix arguments
2828 inline bool isUpper( const Submatrix<MT,AF,SO,DF,CSAs...>& sm )
2829 {
2830  using BaseType = BaseType_t< Submatrix<MT,AF,SO,DF,CSAs...> >;
2831 
2832  if( IsUpper_v<MT> && sm.row() == sm.column() && sm.rows() == sm.columns() )
2833  return true;
2834  else return isUpper( static_cast<const BaseType&>( sm ) );
2835 }
2837 //*************************************************************************************************
2838 
2839 
2840 //*************************************************************************************************
2870 template< typename MT // Type of the matrix
2871  , AlignmentFlag AF // Alignment flag
2872  , bool SO // Storage order
2873  , bool DF // Density flag
2874  , size_t... CSAs > // Compile time submatrix arguments
2875 inline bool isUniUpper( const Submatrix<MT,AF,SO,DF,CSAs...>& sm )
2876 {
2877  using BaseType = BaseType_t< Submatrix<MT,AF,SO,DF,CSAs...> >;
2878 
2879  if( IsUniUpper_v<MT> && sm.row() == sm.column() && sm.rows() == sm.columns() )
2880  return true;
2881  else return isUniUpper( static_cast<const BaseType&>( sm ) );
2882 }
2884 //*************************************************************************************************
2885 
2886 
2887 //*************************************************************************************************
2917 template< typename MT // Type of the matrix
2918  , AlignmentFlag AF // Alignment flag
2919  , bool SO // Storage order
2920  , bool DF // Density flag
2921  , size_t... CSAs > // Compile time submatrix arguments
2922 inline bool isStrictlyUpper( const Submatrix<MT,AF,SO,DF,CSAs...>& sm )
2923 {
2924  using BaseType = BaseType_t< Submatrix<MT,AF,SO,DF,CSAs...> >;
2925 
2926  if( IsStrictlyUpper_v<MT> && sm.row() == sm.column() && sm.rows() == sm.columns() )
2927  return true;
2928  else return isStrictlyUpper( static_cast<const BaseType&>( sm ) );
2929 }
2931 //*************************************************************************************************
2932 
2933 
2934 //*************************************************************************************************
2947 template< typename MT // Type of the matrix
2948  , AlignmentFlag AF // Alignment flag
2949  , bool SO // Storage order
2950  , bool DF // Density flag
2951  , size_t... CSAs > // Compile time submatrix arguments
2952 inline bool isSame( const Submatrix<MT,AF,SO,DF,CSAs...>& a, const Matrix<MT,SO>& b ) noexcept
2953 {
2954  return ( isSame( a.operand(), ~b ) &&
2955  ( a.rows() == (~b).rows() ) &&
2956  ( a.columns() == (~b).columns() ) );
2957 }
2959 //*************************************************************************************************
2960 
2961 
2962 //*************************************************************************************************
2975 template< typename MT // Type of the matrix
2976  , bool SO // Storage order
2977  , AlignmentFlag AF // Alignment flag
2978  , bool DF // Density flag
2979  , size_t... CSAs > // Compile time submatrix arguments
2980 inline bool isSame( const Matrix<MT,SO>& a, const Submatrix<MT,AF,SO,DF,CSAs...>& b ) noexcept
2981 {
2982  return ( isSame( ~a, b.operand() ) &&
2983  ( (~a).rows() == b.rows() ) &&
2984  ( (~a).columns() == b.columns() ) );
2985 }
2987 //*************************************************************************************************
2988 
2989 
2990 //*************************************************************************************************
3003 template< typename MT1 // Type of the matrix of the left-hand side submatrix
3004  , AlignmentFlag AF1 // Alignment flag of the left-hand side submatrix
3005  , bool SO1 // Storage order of the left-hand side submatrix
3006  , bool DF1 // Density flag of the left-hand side submatrix
3007  , size_t... CSAs1 // Compile time submatrix arguments of the left-hand side submatrix
3008  , typename MT2 // Type of the matrix of the right-hand side submatrix
3009  , AlignmentFlag AF2 // Alignment flag of the right-hand side submatrix
3010  , bool SO2 // Storage order of the right-hand side submatrix
3011  , bool DF2 // Density flag of the right-hand side submatrix
3012  , size_t... CSAs2 > // Compile time submatrix arguments of the right-hand side submatrix
3013 inline bool isSame( const Submatrix<MT1,AF1,SO1,DF1,CSAs1...>& a,
3014  const Submatrix<MT2,AF2,SO2,DF2,CSAs2...>& b ) noexcept
3015 {
3016  return ( isSame( a.operand(), b.operand() ) &&
3017  ( a.row() == b.row() ) && ( a.column() == b.column() ) &&
3018  ( a.rows() == b.rows() ) && ( a.columns() == b.columns() ) );
3019 }
3021 //*************************************************************************************************
3022 
3023 
3024 //*************************************************************************************************
3063 template< InversionFlag IF // Inversion algorithm
3064  , typename MT // Type of the dense matrix
3065  , AlignmentFlag AF // Alignment flag
3066  , bool SO // Storage order
3067  , size_t... CSAs > // Compile time submatrix arguments
3068 inline auto invert( Submatrix<MT,AF,SO,true,CSAs...>& sm )
3069  -> DisableIf_t< HasMutableDataAccess_v<MT> >
3070 {
3071  using RT = ResultType_t< Submatrix<MT,AF,SO,true,CSAs...> >;
3072 
3075 
3076  RT tmp( sm );
3077  invert<IF>( tmp );
3078  sm = tmp;
3079 }
3081 //*************************************************************************************************
3082 
3083 
3084 //*************************************************************************************************
3100 template< typename MT // Type of the matrix
3101  , AlignmentFlag AF // Alignment flag
3102  , bool SO // Storage order
3103  , bool DF // Density flag
3104  , size_t... CSAs // Compile time submatrix arguments
3105  , typename ET > // Type of the element
3106 inline bool trySet( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t i, size_t j, const ET& value )
3107 {
3108  BLAZE_INTERNAL_ASSERT( i < sm.rows(), "Invalid row access index" );
3109  BLAZE_INTERNAL_ASSERT( j < sm.columns(), "Invalid column access index" );
3110 
3111  return trySet( sm.operand(), sm.row()+i, sm.column()+j, value );
3112 }
3114 //*************************************************************************************************
3115 
3116 
3117 //*************************************************************************************************
3135 template< typename MT // Type of the matrix
3136  , AlignmentFlag AF // Alignment flag
3137  , bool SO // Storage order
3138  , bool DF // Density flag
3139  , size_t... CSAs // Compile time submatrix arguments
3140  , typename ET > // Type of the element
3142  trySet( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t row, size_t column, size_t m, size_t n, const ET& value )
3143 {
3144  BLAZE_INTERNAL_ASSERT( row <= (~sm).rows(), "Invalid row access index" );
3145  BLAZE_INTERNAL_ASSERT( column <= (~sm).columns(), "Invalid column access index" );
3146  BLAZE_INTERNAL_ASSERT( row + m <= (~sm).rows(), "Invalid number of rows" );
3147  BLAZE_INTERNAL_ASSERT( column + n <= (~sm).columns(), "Invalid number of columns" );
3148 
3149  return trySet( sm.operand(), sm.row()+row, sm.column()+column, m, n, value );
3150 }
3152 //*************************************************************************************************
3153 
3154 
3155 //*************************************************************************************************
3171 template< typename MT // Type of the matrix
3172  , AlignmentFlag AF // Alignment flag
3173  , bool SO // Storage order
3174  , bool DF // Density flag
3175  , size_t... CSAs // Compile time submatrix arguments
3176  , typename ET > // Type of the element
3177 inline bool tryAdd( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t i, size_t j, const ET& value )
3178 {
3179  BLAZE_INTERNAL_ASSERT( i < sm.rows(), "Invalid row access index" );
3180  BLAZE_INTERNAL_ASSERT( j < sm.columns(), "Invalid column access index" );
3181 
3182  return tryAdd( sm.operand(), sm.row()+i, sm.column()+j, value );
3183 }
3185 //*************************************************************************************************
3186 
3187 
3188 //*************************************************************************************************
3206 template< typename MT // Type of the matrix
3207  , AlignmentFlag AF // Alignment flag
3208  , bool SO // Storage order
3209  , bool DF // Density flag
3210  , size_t... CSAs // Compile time submatrix arguments
3211  , typename ET > // Type of the element
3213  tryAdd( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t row, size_t column, size_t m, size_t n, const ET& value )
3214 {
3215  BLAZE_INTERNAL_ASSERT( row <= (~sm).rows(), "Invalid row access index" );
3216  BLAZE_INTERNAL_ASSERT( column <= (~sm).columns(), "Invalid column access index" );
3217  BLAZE_INTERNAL_ASSERT( row + m <= (~sm).rows(), "Invalid number of rows" );
3218  BLAZE_INTERNAL_ASSERT( column + n <= (~sm).columns(), "Invalid number of columns" );
3219 
3220  return tryAdd( sm.operand(), sm.row()+row, sm.column()+column, m, n, value );
3221 }
3223 //*************************************************************************************************
3224 
3225 
3226 //*************************************************************************************************
3242 template< typename MT // Type of the matrix
3243  , AlignmentFlag AF // Alignment flag
3244  , bool SO // Storage order
3245  , bool DF // Density flag
3246  , size_t... CSAs // Compile time submatrix arguments
3247  , typename ET > // Type of the element
3248 inline bool trySub( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t i, size_t j, const ET& value )
3249 {
3250  BLAZE_INTERNAL_ASSERT( i < sm.rows(), "Invalid row access index" );
3251  BLAZE_INTERNAL_ASSERT( j < sm.columns(), "Invalid column access index" );
3252 
3253  return trySub( sm.operand(), sm.row()+i, sm.column()+j, value );
3254 }
3256 //*************************************************************************************************
3257 
3258 
3259 //*************************************************************************************************
3277 template< typename MT // Type of the matrix
3278  , AlignmentFlag AF // Alignment flag
3279  , bool SO // Storage order
3280  , bool DF // Density flag
3281  , size_t... CSAs // Compile time submatrix arguments
3282  , typename ET > // Type of the element
3284  trySub( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t row, size_t column, size_t m, size_t n, const ET& value )
3285 {
3286  BLAZE_INTERNAL_ASSERT( row <= (~sm).rows(), "Invalid row access index" );
3287  BLAZE_INTERNAL_ASSERT( column <= (~sm).columns(), "Invalid column access index" );
3288  BLAZE_INTERNAL_ASSERT( row + m <= (~sm).rows(), "Invalid number of rows" );
3289  BLAZE_INTERNAL_ASSERT( column + n <= (~sm).columns(), "Invalid number of columns" );
3290 
3291  return trySub( sm.operand(), sm.row()+row, sm.column()+column, m, n, value );
3292 }
3294 //*************************************************************************************************
3295 
3296 
3297 //*************************************************************************************************
3313 template< typename MT // Type of the matrix
3314  , AlignmentFlag AF // Alignment flag
3315  , bool SO // Storage order
3316  , bool DF // Density flag
3317  , size_t... CSAs // Compile time submatrix arguments
3318  , typename ET > // Type of the element
3319 inline bool tryMult( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t i, size_t j, const ET& value )
3320 {
3321  BLAZE_INTERNAL_ASSERT( i < sm.rows(), "Invalid row access index" );
3322  BLAZE_INTERNAL_ASSERT( j < sm.columns(), "Invalid column access index" );
3323 
3324  return tryMult( sm.operand(), sm.row()+i, sm.column()+j, value );
3325 }
3327 //*************************************************************************************************
3328 
3329 
3330 //*************************************************************************************************
3348 template< typename MT // Type of the matrix
3349  , AlignmentFlag AF // Alignment flag
3350  , bool SO // Storage order
3351  , bool DF // Density flag
3352  , size_t... CSAs // Compile time submatrix arguments
3353  , typename ET > // Type of the element
3355  tryMult( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t row, size_t column, size_t m, size_t n, const ET& value )
3356 {
3357  BLAZE_INTERNAL_ASSERT( row <= (~sm).rows(), "Invalid row access index" );
3358  BLAZE_INTERNAL_ASSERT( column <= (~sm).columns(), "Invalid column access index" );
3359  BLAZE_INTERNAL_ASSERT( row + m <= (~sm).rows(), "Invalid number of rows" );
3360  BLAZE_INTERNAL_ASSERT( column + n <= (~sm).columns(), "Invalid number of columns" );
3361 
3362  return tryMult( sm.operand(), sm.row()+row, sm.column()+column, m, n, value );
3363 }
3365 //*************************************************************************************************
3366 
3367 
3368 //*************************************************************************************************
3384 template< typename MT // Type of the matrix
3385  , AlignmentFlag AF // Alignment flag
3386  , bool SO // Storage order
3387  , bool DF // Density flag
3388  , size_t... CSAs // Compile time submatrix arguments
3389  , typename ET > // Type of the element
3390 inline bool tryDiv( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t i, size_t j, const ET& value )
3391 {
3392  BLAZE_INTERNAL_ASSERT( i < sm.rows(), "Invalid row access index" );
3393  BLAZE_INTERNAL_ASSERT( j < sm.columns(), "Invalid column access index" );
3394 
3395  return tryDiv( sm.operand(), sm.row()+i, sm.column()+j, value );
3396 }
3398 //*************************************************************************************************
3399 
3400 
3401 //*************************************************************************************************
3419 template< typename MT // Type of the matrix
3420  , AlignmentFlag AF // Alignment flag
3421  , bool SO // Storage order
3422  , bool DF // Density flag
3423  , size_t... CSAs // Compile time submatrix arguments
3424  , typename ET > // Type of the element
3426  tryDiv( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t row, size_t column, size_t m, size_t n, const ET& value )
3427 {
3428  BLAZE_INTERNAL_ASSERT( row <= (~sm).rows(), "Invalid row access index" );
3429  BLAZE_INTERNAL_ASSERT( column <= (~sm).columns(), "Invalid column access index" );
3430  BLAZE_INTERNAL_ASSERT( row + m <= (~sm).rows(), "Invalid number of rows" );
3431  BLAZE_INTERNAL_ASSERT( column + n <= (~sm).columns(), "Invalid number of columns" );
3432 
3433  return tryDiv( sm.operand(), sm.row()+row, sm.column()+column, m, n, value );
3434 }
3436 //*************************************************************************************************
3437 
3438 
3439 //*************************************************************************************************
3455 template< typename MT // Type of the matrix
3456  , AlignmentFlag AF // Alignment flag
3457  , bool SO // Storage order
3458  , bool DF // Density flag
3459  , size_t... CSAs > // Compile time submatrix arguments
3460 inline bool tryShift( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t i, size_t j, int count )
3461 {
3462  BLAZE_INTERNAL_ASSERT( i < sm.rows(), "Invalid row access index" );
3463  BLAZE_INTERNAL_ASSERT( j < sm.columns(), "Invalid column access index" );
3464 
3465  return tryShift( sm.operand(), sm.row()+i, sm.column()+j, count );
3466 }
3468 //*************************************************************************************************
3469 
3470 
3471 //*************************************************************************************************
3489 template< typename MT // Type of the matrix
3490  , AlignmentFlag AF // Alignment flag
3491  , bool SO // Storage order
3492  , bool DF // Density flag
3493  , size_t... CSAs > // Compile time submatrix arguments
3495  tryShift( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t row, size_t column, size_t m, size_t n, int count )
3496 {
3497  BLAZE_INTERNAL_ASSERT( row <= (~sm).rows(), "Invalid row access index" );
3498  BLAZE_INTERNAL_ASSERT( column <= (~sm).columns(), "Invalid column access index" );
3499  BLAZE_INTERNAL_ASSERT( row + m <= (~sm).rows(), "Invalid number of rows" );
3500  BLAZE_INTERNAL_ASSERT( column + n <= (~sm).columns(), "Invalid number of columns" );
3501 
3502  return tryShift( sm.operand(), sm.row()+row, sm.column()+column, m, n, count );
3503 }
3505 //*************************************************************************************************
3506 
3507 
3508 //*************************************************************************************************
3524 template< typename MT // Type of the matrix
3525  , AlignmentFlag AF // Alignment flag
3526  , bool SO // Storage order
3527  , bool DF // Density flag
3528  , size_t... CSAs // Compile time submatrix arguments
3529  , typename ET > // Type of the element
3530 inline bool tryBitand( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t i, size_t j, const ET& value )
3531 {
3532  BLAZE_INTERNAL_ASSERT( i < sm.rows(), "Invalid row access index" );
3533  BLAZE_INTERNAL_ASSERT( j < sm.columns(), "Invalid column access index" );
3534 
3535  return tryBitand( sm.operand(), sm.row()+i, sm.column()+j, value );
3536 }
3538 //*************************************************************************************************
3539 
3540 
3541 //*************************************************************************************************
3559 template< typename MT // Type of the matrix
3560  , AlignmentFlag AF // Alignment flag
3561  , bool SO // Storage order
3562  , bool DF // Density flag
3563  , size_t... CSAs // Compile time submatrix arguments
3564  , typename ET > // Type of the element
3566  tryBitand( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t row, size_t column, size_t m, size_t n, const ET& value )
3567 {
3568  BLAZE_INTERNAL_ASSERT( row <= (~sm).rows(), "Invalid row access index" );
3569  BLAZE_INTERNAL_ASSERT( column <= (~sm).columns(), "Invalid column access index" );
3570  BLAZE_INTERNAL_ASSERT( row + m <= (~sm).rows(), "Invalid number of rows" );
3571  BLAZE_INTERNAL_ASSERT( column + n <= (~sm).columns(), "Invalid number of columns" );
3572 
3573  return tryBitand( sm.operand(), sm.row()+row, sm.column()+column, m, n, value );
3574 }
3576 //*************************************************************************************************
3577 
3578 
3579 //*************************************************************************************************
3595 template< typename MT // Type of the matrix
3596  , AlignmentFlag AF // Alignment flag
3597  , bool SO // Storage order
3598  , bool DF // Density flag
3599  , size_t... CSAs // Compile time submatrix arguments
3600  , typename ET > // Type of the element
3601 inline bool tryBitor( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t i, size_t j, const ET& value )
3602 {
3603  BLAZE_INTERNAL_ASSERT( i < sm.rows(), "Invalid row access index" );
3604  BLAZE_INTERNAL_ASSERT( j < sm.columns(), "Invalid column access index" );
3605 
3606  return tryBitor( sm.operand(), sm.row()+i, sm.column()+j, value );
3607 }
3609 //*************************************************************************************************
3610 
3611 
3612 //*************************************************************************************************
3630 template< typename MT // Type of the matrix
3631  , AlignmentFlag AF // Alignment flag
3632  , bool SO // Storage order
3633  , bool DF // Density flag
3634  , size_t... CSAs // Compile time submatrix arguments
3635  , typename ET > // Type of the element
3637  tryBitor( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t row, size_t column, size_t m, size_t n, const ET& value )
3638 {
3639  BLAZE_INTERNAL_ASSERT( row <= (~sm).rows(), "Invalid row access index" );
3640  BLAZE_INTERNAL_ASSERT( column <= (~sm).columns(), "Invalid column access index" );
3641  BLAZE_INTERNAL_ASSERT( row + m <= (~sm).rows(), "Invalid number of rows" );
3642  BLAZE_INTERNAL_ASSERT( column + n <= (~sm).columns(), "Invalid number of columns" );
3643 
3644  return tryBitor( sm.operand(), sm.row()+row, sm.column()+column, m, n, value );
3645 }
3647 //*************************************************************************************************
3648 
3649 
3650 //*************************************************************************************************
3666 template< typename MT // Type of the matrix
3667  , AlignmentFlag AF // Alignment flag
3668  , bool SO // Storage order
3669  , bool DF // Density flag
3670  , size_t... CSAs // Compile time submatrix arguments
3671  , typename ET > // Type of the element
3672 inline bool tryBitxor( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t i, size_t j, const ET& value )
3673 {
3674  BLAZE_INTERNAL_ASSERT( i < sm.rows(), "Invalid row access index" );
3675  BLAZE_INTERNAL_ASSERT( j < sm.columns(), "Invalid column access index" );
3676 
3677  return tryBitxor( sm.operand(), sm.row()+i, sm.column()+j, value );
3678 }
3680 //*************************************************************************************************
3681 
3682 
3683 //*************************************************************************************************
3701 template< typename MT // Type of the matrix
3702  , AlignmentFlag AF // Alignment flag
3703  , bool SO // Storage order
3704  , bool DF // Density flag
3705  , size_t... CSAs // Compile time submatrix arguments
3706  , typename ET > // Type of the element
3708  tryBitxor( const Submatrix<MT,AF,SO,DF,CSAs...>& sm, size_t row, size_t column, size_t m, size_t n, const ET& value )
3709 {
3710  BLAZE_INTERNAL_ASSERT( row <= (~sm).rows(), "Invalid row access index" );
3711  BLAZE_INTERNAL_ASSERT( column <= (~sm).columns(), "Invalid column access index" );
3712  BLAZE_INTERNAL_ASSERT( row + m <= (~sm).rows(), "Invalid number of rows" );
3713  BLAZE_INTERNAL_ASSERT( column + n <= (~sm).columns(), "Invalid number of columns" );
3714 
3715  return tryBitxor( sm.operand(), sm.row()+row, sm.column()+column, m, n, value );
3716 }
3718 //*************************************************************************************************
3719 
3720 
3721 //*************************************************************************************************
3737 template< typename MT // Type of the matrix
3738  , AlignmentFlag AF // Alignment flag
3739  , bool SO // Storage order
3740  , bool DF // Density flag
3741  , size_t... CSAs // Compile time submatrix arguments
3742  , typename VT // Type of the right-hand side vector
3743  , bool TF > // Transpose flag of the right-hand side vector
3744 inline bool tryAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
3745  const Vector<VT,TF>& rhs, size_t row, size_t column )
3746 {
3747  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3748  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3749  BLAZE_INTERNAL_ASSERT( TF || ( row + (~rhs).size() <= lhs.rows() ), "Invalid number of rows" );
3750  BLAZE_INTERNAL_ASSERT( !TF || ( column + (~rhs).size() <= lhs.columns() ), "Invalid number of columns" );
3751 
3752  return tryAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
3753 }
3755 //*************************************************************************************************
3756 
3757 
3758 //*************************************************************************************************
3775 template< typename MT // Type of the matrix
3776  , AlignmentFlag AF // Alignment flag
3777  , bool SO // Storage order
3778  , bool DF // Density flag
3779  , size_t... CSAs // Compile time submatrix arguments
3780  , typename VT // Type of the right-hand side vector
3781  , bool TF > // Transpose flag of the right-hand side vector
3782 inline bool tryAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
3783  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
3784 {
3785  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3786  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3787  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3788  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3789 
3790  return tryAssign( lhs.operand(), ~rhs, band + ptrdiff_t( lhs.column() - lhs.row() ),
3791  lhs.row() + row, lhs.column() + column );
3792 }
3794 //*************************************************************************************************
3795 
3796 
3797 //*************************************************************************************************
3813 template< typename MT1 // Type of the matrix
3814  , AlignmentFlag AF // Alignment flag
3815  , bool SO1 // Storage order
3816  , bool DF // Density flag
3817  , size_t... CSAs // Compile time submatrix arguments
3818  , typename MT2 // Type of the right-hand side matrix
3819  , bool SO2 > // Storage order of the right-hand side matrix
3820 inline bool tryAssign( const Submatrix<MT1,AF,SO1,DF,CSAs...>& lhs,
3821  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
3822 {
3823  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3824  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3825  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
3826  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
3827 
3828  return tryAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
3829 }
3831 //*************************************************************************************************
3832 
3833 
3834 //*************************************************************************************************
3850 template< typename MT // Type of the matrix
3851  , AlignmentFlag AF // Alignment flag
3852  , bool SO // Storage order
3853  , bool DF // Density flag
3854  , size_t... CSAs // Compile time submatrix arguments
3855  , typename VT // Type of the right-hand side vector
3856  , bool TF > // Transpose flag of the right-hand side vector
3857 inline bool tryAddAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
3858  const Vector<VT,TF>& rhs, size_t row, size_t column )
3859 {
3860  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3861  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3862  BLAZE_INTERNAL_ASSERT( TF || ( row + (~rhs).size() <= lhs.rows() ), "Invalid number of rows" );
3863  BLAZE_INTERNAL_ASSERT( !TF || ( column + (~rhs).size() <= lhs.columns() ), "Invalid number of columns" );
3864 
3865  return tryAddAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
3866 }
3868 //*************************************************************************************************
3869 
3870 
3871 //*************************************************************************************************
3889 template< typename MT // Type of the matrix
3890  , AlignmentFlag AF // Alignment flag
3891  , bool SO // Storage order
3892  , bool DF // Density flag
3893  , size_t... CSAs // Compile time submatrix arguments
3894  , typename VT // Type of the right-hand side vector
3895  , bool TF > // Transpose flag of the right-hand side vector
3896 inline bool tryAddAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
3897  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
3898 {
3899  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3900  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3901  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3902  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3903 
3904  return tryAddAssign( lhs.operand(), ~rhs, band + ptrdiff_t( lhs.column() - lhs.row() ),
3905  lhs.row() + row, lhs.column() + column );
3906 }
3908 //*************************************************************************************************
3909 
3910 
3911 //*************************************************************************************************
3927 template< typename MT1 // Type of the matrix
3928  , AlignmentFlag AF // Alignment flag
3929  , bool SO1 // Storage order
3930  , bool DF // Density flag
3931  , size_t... CSAs // Compile time submatrix arguments
3932  , typename MT2 // Type of the right-hand side matrix
3933  , bool SO2 > // Storage order of the right-hand side matrix
3934 inline bool tryAddAssign( const Submatrix<MT1,AF,SO1,DF,CSAs...>& lhs,
3935  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
3936 {
3937  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3938  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3939  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
3940  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
3941 
3942  return tryAddAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
3943 }
3945 //*************************************************************************************************
3946 
3947 
3948 //*************************************************************************************************
3964 template< typename MT // Type of the matrix
3965  , AlignmentFlag AF // Alignment flag
3966  , bool SO // Storage order
3967  , bool DF // Density flag
3968  , size_t... CSAs // Compile time submatrix arguments
3969  , typename VT // Type of the right-hand side vector
3970  , bool TF > // Transpose flag of the right-hand side vector
3971 inline bool trySubAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
3972  const Vector<VT,TF>& rhs, size_t row, size_t column )
3973 {
3974  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3975  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3976  BLAZE_INTERNAL_ASSERT( TF || ( row + (~rhs).size() <= lhs.rows() ), "Invalid number of rows" );
3977  BLAZE_INTERNAL_ASSERT( !TF || ( column + (~rhs).size() <= lhs.columns() ), "Invalid number of columns" );
3978 
3979  return trySubAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
3980 }
3982 //*************************************************************************************************
3983 
3984 
3985 //*************************************************************************************************
4003 template< typename MT // Type of the matrix
4004  , AlignmentFlag AF // Alignment flag
4005  , bool SO // Storage order
4006  , bool DF // Density flag
4007  , size_t... CSAs // Compile time submatrix arguments
4008  , typename VT // Type of the right-hand side vector
4009  , bool TF > // Transpose flag of the right-hand side vector
4010 inline bool trySubAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
4011  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
4012 {
4013  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4014  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4015  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
4016  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
4017 
4018  return trySubAssign( lhs.operand(), ~rhs, band + ptrdiff_t( lhs.column() - lhs.row() ),
4019  lhs.row() + row, lhs.column() + column );
4020 }
4022 //*************************************************************************************************
4023 
4024 
4025 //*************************************************************************************************
4041 template< typename MT1 // Type of the matrix
4042  , AlignmentFlag AF // Alignment flag
4043  , bool SO1 // Storage order
4044  , bool DF // Density flag
4045  , size_t... CSAs // Compile time submatrix arguments
4046  , typename MT2 // Type of the right-hand side matrix
4047  , bool SO2 > // Storage order of the right-hand side matrix
4048 inline bool trySubAssign( const Submatrix<MT1,AF,SO1,DF,CSAs...>& lhs,
4049  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
4050 {
4051  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4052  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4053  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
4054  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
4055 
4056  return trySubAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
4057 }
4059 //*************************************************************************************************
4060 
4061 
4062 //*************************************************************************************************
4078 template< typename MT // Type of the matrix
4079  , AlignmentFlag AF // Alignment flag
4080  , bool SO // Storage order
4081  , bool DF // Density flag
4082  , size_t... CSAs // Compile time submatrix arguments
4083  , typename VT // Type of the right-hand side vector
4084  , bool TF > // Transpose flag of the right-hand side vector
4085 inline bool tryMultAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
4086  const Vector<VT,TF>& rhs, size_t row, size_t column )
4087 {
4088  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4089  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4090  BLAZE_INTERNAL_ASSERT( TF || ( row + (~rhs).size() <= lhs.rows() ), "Invalid number of rows" );
4091  BLAZE_INTERNAL_ASSERT( !TF || ( column + (~rhs).size() <= lhs.columns() ), "Invalid number of columns" );
4092 
4093  return tryMultAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
4094 }
4096 //*************************************************************************************************
4097 
4098 
4099 //*************************************************************************************************
4117 template< typename MT // Type of the matrix
4118  , AlignmentFlag AF // Alignment flag
4119  , bool SO // Storage order
4120  , bool DF // Density flag
4121  , size_t... CSAs // Compile time submatrix arguments
4122  , typename VT // Type of the right-hand side vector
4123  , bool TF > // Transpose flag of the right-hand side vector
4124 inline bool tryMultAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
4125  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
4126 {
4127  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4128  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4129  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
4130  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
4131 
4132  return tryMultAssign( lhs.operand(), ~rhs, band + ptrdiff_t( lhs.column() - lhs.row() ),
4133  lhs.row() + row, lhs.column() + column );
4134 }
4136 //*************************************************************************************************
4137 
4138 
4139 //*************************************************************************************************
4155 template< typename MT1 // Type of the matrix
4156  , AlignmentFlag AF // Alignment flag
4157  , bool SO1 // Storage order
4158  , bool DF // Density flag
4159  , size_t... CSAs // Compile time submatrix arguments
4160  , typename MT2 // Type of the right-hand side matrix
4161  , bool SO2 > // Storage order of the right-hand side matrix
4162 inline bool trySchurAssign( const Submatrix<MT1,AF,SO1,DF,CSAs...>& lhs,
4163  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
4164 {
4165  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4166  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4167  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
4168  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
4169 
4170  return trySchurAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
4171 }
4173 //*************************************************************************************************
4174 
4175 
4176 //*************************************************************************************************
4192 template< typename MT // Type of the matrix
4193  , AlignmentFlag AF // Alignment flag
4194  , bool SO // Storage order
4195  , bool DF // Density flag
4196  , size_t... CSAs // Compile time submatrix arguments
4197  , typename VT // Type of the right-hand side vector
4198  , bool TF > // Transpose flag of the right-hand side vector
4199 inline bool tryDivAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
4200  const Vector<VT,TF>& rhs, size_t row, size_t column )
4201 {
4202  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4203  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4204  BLAZE_INTERNAL_ASSERT( TF || ( row + (~rhs).size() <= lhs.rows() ), "Invalid number of rows" );
4205  BLAZE_INTERNAL_ASSERT( !TF || ( column + (~rhs).size() <= lhs.columns() ), "Invalid number of columns" );
4206 
4207  return tryDivAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
4208 }
4210 //*************************************************************************************************
4211 
4212 
4213 //*************************************************************************************************
4231 template< typename MT // Type of the matrix
4232  , AlignmentFlag AF // Alignment flag
4233  , bool SO // Storage order
4234  , bool DF // Density flag
4235  , size_t... CSAs // Compile time submatrix arguments
4236  , typename VT // Type of the right-hand side vector
4237  , bool TF > // Transpose flag of the right-hand side vector
4238 inline bool tryDivAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
4239  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
4240 {
4241  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4242  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4243  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
4244  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
4245 
4246  return tryDivAssign( lhs.operand(), ~rhs, band + ptrdiff_t( lhs.column() - lhs.row() ),
4247  lhs.row() + row, lhs.column() + column );
4248 }
4250 //*************************************************************************************************
4251 
4252 
4253 //*************************************************************************************************
4269 template< typename MT // Type of the matrix
4270  , AlignmentFlag AF // Alignment flag
4271  , bool SO // Storage order
4272  , bool DF // Density flag
4273  , size_t... CSAs // Compile time submatrix arguments
4274  , typename VT // Type of the right-hand side vector
4275  , bool TF > // Transpose flag of the right-hand side vector
4276 inline bool tryShiftAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
4277  const Vector<VT,TF>& rhs, size_t row, size_t column )
4278 {
4279  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4280  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4281  BLAZE_INTERNAL_ASSERT( TF || ( row + (~rhs).size() <= lhs.rows() ), "Invalid number of rows" );
4282  BLAZE_INTERNAL_ASSERT( !TF || ( column + (~rhs).size() <= lhs.columns() ), "Invalid number of columns" );
4283 
4284  return tryShiftAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
4285 }
4287 //*************************************************************************************************
4288 
4289 
4290 //*************************************************************************************************
4308 template< typename MT // Type of the matrix
4309  , AlignmentFlag AF // Alignment flag
4310  , bool SO // Storage order
4311  , bool DF // Density flag
4312  , size_t... CSAs // Compile time submatrix arguments
4313  , typename VT // Type of the right-hand side vector
4314  , bool TF > // Transpose flag of the right-hand side vector
4315 inline bool tryShiftAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
4316  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
4317 {
4318  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4319  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4320  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
4321  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
4322 
4323  return tryShiftAssign( lhs.operand(), ~rhs, band + ptrdiff_t( lhs.column() - lhs.row() ),
4324  lhs.row() + row, lhs.column() + column );
4325 }
4327 //*************************************************************************************************
4328 
4329 
4330 //*************************************************************************************************
4346 template< typename MT1 // Type of the matrix
4347  , AlignmentFlag AF // Alignment flag
4348  , bool SO1 // Storage order
4349  , bool DF // Density flag
4350  , size_t... CSAs // Compile time submatrix arguments
4351  , typename MT2 // Type of the right-hand side matrix
4352  , bool SO2 > // Storage order of the right-hand side matrix
4353 inline bool tryShiftAssign( const Submatrix<MT1,AF,SO1,DF,CSAs...>& lhs,
4354  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
4355 {
4356  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4357  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4358  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
4359  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
4360 
4361  return tryShiftAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
4362 }
4364 //*************************************************************************************************
4365 
4366 
4367 //*************************************************************************************************
4383 template< typename MT // Type of the matrix
4384  , AlignmentFlag AF // Alignment flag
4385  , bool SO // Storage order
4386  , bool DF // Density flag
4387  , size_t... CSAs // Compile time submatrix arguments
4388  , typename VT // Type of the right-hand side vector
4389  , bool TF > // Transpose flag of the right-hand side vector
4390 inline bool tryBitandAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
4391  const Vector<VT,TF>& rhs, size_t row, size_t column )
4392 {
4393  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4394  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4395  BLAZE_INTERNAL_ASSERT( TF || ( row + (~rhs).size() <= lhs.rows() ), "Invalid number of rows" );
4396  BLAZE_INTERNAL_ASSERT( !TF || ( column + (~rhs).size() <= lhs.columns() ), "Invalid number of columns" );
4397 
4398  return tryBitandAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
4399 }
4401 //*************************************************************************************************
4402 
4403 
4404 //*************************************************************************************************
4422 template< typename MT // Type of the matrix
4423  , AlignmentFlag AF // Alignment flag
4424  , bool SO // Storage order
4425  , bool DF // Density flag
4426  , size_t... CSAs // Compile time submatrix arguments
4427  , typename VT // Type of the right-hand side vector
4428  , bool TF > // Transpose flag of the right-hand side vector
4429 inline bool tryBitandAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
4430  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
4431 {
4432  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4433  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4434  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
4435  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
4436 
4437  return tryBitandAssign( lhs.operand(), ~rhs, band + ptrdiff_t( lhs.column() - lhs.row() ),
4438  lhs.row() + row, lhs.column() + column );
4439 }
4441 //*************************************************************************************************
4442 
4443 
4444 //*************************************************************************************************
4460 template< typename MT1 // Type of the matrix
4461  , AlignmentFlag AF // Alignment flag
4462  , bool SO1 // Storage order
4463  , bool DF // Density flag
4464  , size_t... CSAs // Compile time submatrix arguments
4465  , typename MT2 // Type of the right-hand side matrix
4466  , bool SO2 > // Storage order of the right-hand side matrix
4467 inline bool tryBitandAssign( const Submatrix<MT1,AF,SO1,DF,CSAs...>& lhs,
4468  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
4469 {
4470  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4471  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4472  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
4473  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
4474 
4475  return tryBitandAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
4476 }
4478 //*************************************************************************************************
4479 
4480 
4481 //*************************************************************************************************
4497 template< typename MT // Type of the matrix
4498  , AlignmentFlag AF // Alignment flag
4499  , bool SO // Storage order
4500  , bool DF // Density flag
4501  , size_t... CSAs // Compile time submatrix arguments
4502  , typename VT // Type of the right-hand side vector
4503  , bool TF > // Transpose flag of the right-hand side vector
4504 inline bool tryBitorAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
4505  const Vector<VT,TF>& rhs, size_t row, size_t column )
4506 {
4507  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4508  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4509  BLAZE_INTERNAL_ASSERT( TF || ( row + (~rhs).size() <= lhs.rows() ), "Invalid number of rows" );
4510  BLAZE_INTERNAL_ASSERT( !TF || ( column + (~rhs).size() <= lhs.columns() ), "Invalid number of columns" );
4511 
4512  return tryBitorAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
4513 }
4515 //*************************************************************************************************
4516 
4517 
4518 //*************************************************************************************************
4536 template< typename MT // Type of the matrix
4537  , AlignmentFlag AF // Alignment flag
4538  , bool SO // Storage order
4539  , bool DF // Density flag
4540  , size_t... CSAs // Compile time submatrix arguments
4541  , typename VT // Type of the right-hand side vector
4542  , bool TF > // Transpose flag of the right-hand side vector
4543 inline bool tryBitorAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
4544  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
4545 {
4546  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4547  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4548  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
4549  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
4550 
4551  return tryBitorAssign( lhs.operand(), ~rhs, band + ptrdiff_t( lhs.column() - lhs.row() ),
4552  lhs.row() + row, lhs.column() + column );
4553 }
4555 //*************************************************************************************************
4556 
4557 
4558 //*************************************************************************************************
4574 template< typename MT1 // Type of the matrix
4575  , AlignmentFlag AF // Alignment flag
4576  , bool SO1 // Storage order
4577  , bool DF // Density flag
4578  , size_t... CSAs // Compile time submatrix arguments
4579  , typename MT2 // Type of the right-hand side matrix
4580  , bool SO2 > // Storage order of the right-hand side matrix
4581 inline bool tryBitorAssign( const Submatrix<MT1,AF,SO1,DF,CSAs...>& lhs,
4582  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
4583 {
4584  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4585  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4586  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
4587  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
4588 
4589  return tryBitorAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
4590 }
4592 //*************************************************************************************************
4593 
4594 
4595 //*************************************************************************************************
4611 template< typename MT // Type of the matrix
4612  , AlignmentFlag AF // Alignment flag
4613  , bool SO // Storage order
4614  , bool DF // Density flag
4615  , size_t... CSAs // Compile time submatrix arguments
4616  , typename VT // Type of the right-hand side vector
4617  , bool TF > // Transpose flag of the right-hand side vector
4618 inline bool tryBitxorAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
4619  const Vector<VT,TF>& rhs, size_t row, size_t column )
4620 {
4621  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4622  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4623  BLAZE_INTERNAL_ASSERT( TF || ( row + (~rhs).size() <= lhs.rows() ), "Invalid number of rows" );
4624  BLAZE_INTERNAL_ASSERT( !TF || ( column + (~rhs).size() <= lhs.columns() ), "Invalid number of columns" );
4625 
4626  return tryBitxorAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
4627 }
4629 //*************************************************************************************************
4630 
4631 
4632 //*************************************************************************************************
4650 template< typename MT // Type of the matrix
4651  , AlignmentFlag AF // Alignment flag
4652  , bool SO // Storage order
4653  , bool DF // Density flag
4654  , size_t... CSAs // Compile time submatrix arguments
4655  , typename VT // Type of the right-hand side vector
4656  , bool TF > // Transpose flag of the right-hand side vector
4657 inline bool tryBitxorAssign( const Submatrix<MT,AF,SO,DF,CSAs...>& lhs,
4658  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
4659 {
4660  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4661  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4662  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
4663  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
4664 
4665  return tryBitxorAssign( lhs.operand(), ~rhs, band + ptrdiff_t( lhs.column() - lhs.row() ),
4666  lhs.row() + row, lhs.column() + column );
4667 }
4669 //*************************************************************************************************
4670 
4671 
4672 //*************************************************************************************************
4688 template< typename MT1 // Type of the matrix
4689  , AlignmentFlag AF // Alignment flag
4690  , bool SO1 // Storage order
4691  , bool DF // Density flag
4692  , size_t... CSAs // Compile time submatrix arguments
4693  , typename MT2 // Type of the right-hand side matrix
4694  , bool SO2 > // Storage order of the right-hand side matrix
4695 inline bool tryBitxorAssign( const Submatrix<MT1,AF,SO1,DF,CSAs...>& lhs,
4696  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
4697 {
4698  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4699  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4700  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
4701  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
4702 
4703  return tryBitxorAssign( lhs.operand(), ~rhs, lhs.row() + row, lhs.column() + column );
4704 }
4706 //*************************************************************************************************
4707 
4708 
4709 //*************************************************************************************************
4724 template< typename MT // Type of the matrix
4725  , AlignmentFlag AF // Alignment flag
4726  , bool SO // Storage order
4727  , bool DF // Density flag
4728  , size_t I // Index of the first row
4729  , size_t J // Index of the first column
4730  , size_t M // Number of rows
4731  , size_t N > // Number of columns
4732 inline decltype(auto) derestrict( Submatrix<MT,AF,SO,DF,I,J,M,N>& dm )
4733 {
4734  return submatrix<AF,I,J,M,N>( derestrict( dm.operand() ), unchecked );
4735 }
4737 //*************************************************************************************************
4738 
4739 
4740 //*************************************************************************************************
4755 template< typename MT // Type of the matrix
4756  , AlignmentFlag AF // Alignment flag
4757  , bool SO // Storage order
4758  , bool DF // Density flag
4759  , size_t I // Index of the first row
4760  , size_t J // Index of the first column
4761  , size_t M // Number of rows
4762  , size_t N > // Number of columns
4763 inline decltype(auto) derestrict( Submatrix<MT,AF,SO,DF,I,J,M,N>&& dm )
4764 {
4765  return submatrix<AF,I,J,M,N>( derestrict( dm.operand() ), unchecked );
4766 }
4768 //*************************************************************************************************
4769 
4770 
4771 //*************************************************************************************************
4786 template< typename MT // Type of the matrix
4787  , AlignmentFlag AF // Alignment flag
4788  , bool SO // Storage order
4789  , bool DF > // Density flag
4790 inline decltype(auto) derestrict( Submatrix<MT,AF,SO,DF>& dm )
4791 {
4792  return submatrix<AF>( derestrict( dm.operand() ), dm.row(), dm.column(), dm.rows(), dm.columns(), unchecked );
4793 }
4795 //*************************************************************************************************
4796 
4797 
4798 //*************************************************************************************************
4813 template< typename MT // Type of the matrix
4814  , AlignmentFlag AF // Alignment flag
4815  , bool SO // Storage order
4816  , bool DF > // Density flag
4817 inline decltype(auto) derestrict( Submatrix<MT,AF,SO,DF>&& dm )
4818 {
4819  return submatrix<AF>( derestrict( dm.operand() ), dm.row(), dm.column(), dm.rows(), dm.columns(), unchecked );
4820 }
4822 //*************************************************************************************************
4823 
4824 
4825 
4826 
4827 //=================================================================================================
4828 //
4829 // SIZE SPECIALIZATIONS
4830 //
4831 //=================================================================================================
4832 
4833 //*************************************************************************************************
4835 template< typename MT, AlignmentFlag AF, bool SO, bool DF, size_t I, size_t J, size_t M, size_t N >
4836 struct Size< Submatrix<MT,AF,SO,DF,I,J,M,N>, 0UL >
4837  : public Ptrdiff_t<M>
4838 {};
4839 
4840 template< typename MT, AlignmentFlag AF, bool SO, bool DF, size_t I, size_t J, size_t M, size_t N >
4841 struct Size< Submatrix<MT,AF,SO,DF,I,J,M,N>, 1UL >
4842  : public Ptrdiff_t<N>
4843 {};
4845 //*************************************************************************************************
4846 
4847 
4848 
4849 
4850 //=================================================================================================
4851 //
4852 // MAXSIZE SPECIALIZATIONS
4853 //
4854 //=================================================================================================
4855 
4856 //*************************************************************************************************
4858 template< typename MT, AlignmentFlag AF, bool SO, bool DF, size_t I, size_t J, size_t M, size_t N >
4859 struct MaxSize< Submatrix<MT,AF,SO,DF,I,J,M,N>, 0UL >
4860  : public Ptrdiff_t<M>
4861 {};
4862 
4863 template< typename MT, AlignmentFlag AF, bool SO, bool DF, size_t I, size_t J, size_t M, size_t N >
4864 struct MaxSize< Submatrix<MT,AF,SO,DF,I,J,M,N>, 1UL >
4865  : public Ptrdiff_t<N>
4866 {};
4868 //*************************************************************************************************
4869 
4870 
4871 
4872 
4873 //=================================================================================================
4874 //
4875 // ISRESTRICTED SPECIALIZATIONS
4876 //
4877 //=================================================================================================
4878 
4879 //*************************************************************************************************
4881 template< typename MT, AlignmentFlag AF, bool SO, bool DF, size_t... CSAs >
4882 struct IsRestricted< Submatrix<MT,AF,SO,DF,CSAs...> >
4883  : public IsRestricted<MT>
4884 {};
4886 //*************************************************************************************************
4887 
4888 
4889 
4890 
4891 //=================================================================================================
4892 //
4893 // HASCONSTDATAACCESS SPECIALIZATIONS
4894 //
4895 //=================================================================================================
4896 
4897 //*************************************************************************************************
4899 template< typename MT, AlignmentFlag AF, bool SO, size_t... CSAs >
4900 struct HasConstDataAccess< Submatrix<MT,AF,SO,true,CSAs...> >
4901  : public HasConstDataAccess<MT>
4902 {};
4904 //*************************************************************************************************
4905 
4906 
4907 
4908 
4909 //=================================================================================================
4910 //
4911 // HASMUTABLEDATAACCESS SPECIALIZATIONS
4912 //
4913 //=================================================================================================
4914 
4915 //*************************************************************************************************
4917 template< typename MT, AlignmentFlag AF, bool SO, size_t... CSAs >
4918 struct HasMutableDataAccess< Submatrix<MT,AF,SO,true,CSAs...> >
4919  : public HasMutableDataAccess<MT>
4920 {};
4922 //*************************************************************************************************
4923 
4924 
4925 
4926 
4927 //=================================================================================================
4928 //
4929 // ISALIGNED SPECIALIZATIONS
4930 //
4931 //=================================================================================================
4932 
4933 //*************************************************************************************************
4935 template< typename MT, bool SO, size_t... CSAs >
4936 struct IsAligned< Submatrix<MT,aligned,SO,true,CSAs...> >
4937  : public TrueType
4938 {};
4940 //*************************************************************************************************
4941 
4942 
4943 
4944 
4945 //=================================================================================================
4946 //
4947 // ISCONTIGUOUS SPECIALIZATIONS
4948 //
4949 //=================================================================================================
4950 
4951 //*************************************************************************************************
4953 template< typename MT, AlignmentFlag AF, bool SO, size_t... CSAs >
4954 struct IsContiguous< Submatrix<MT,AF,SO,true,CSAs...> >
4955  : public IsContiguous<MT>
4956 {};
4958 //*************************************************************************************************
4959 
4960 
4961 
4962 
4963 //=================================================================================================
4964 //
4965 // ISSYMMETRIC SPECIALIZATIONS
4966 //
4967 //=================================================================================================
4968 
4969 //*************************************************************************************************
4971 template< typename MT, AlignmentFlag AF, bool SO, bool DF, size_t I, size_t J, size_t M, size_t N >
4972 struct IsSymmetric< Submatrix<MT,AF,SO,DF,I,J,M,N> >
4973  : public BoolConstant< ( IsSymmetric_v<MT> && I == J && M == N ) >
4974 {};
4976 //*************************************************************************************************
4977 
4978 
4979 
4980 
4981 //=================================================================================================
4982 //
4983 // ISHERMITIAN SPECIALIZATIONS
4984 //
4985 //=================================================================================================
4986 
4987 //*************************************************************************************************
4989 template< typename MT, AlignmentFlag AF, bool SO, bool DF, size_t I, size_t J, size_t M, size_t N >
4990 struct IsHermitian< Submatrix<MT,AF,SO,DF,I,J,M,N> >
4991  : public BoolConstant< ( IsHermitian_v<MT> && I == J && M == N ) >
4992 {};
4994 //*************************************************************************************************
4995 
4996 
4997 
4998 
4999 //=================================================================================================
5000 //
5001 // ISLOWER SPECIALIZATIONS
5002 //
5003 //=================================================================================================
5004 
5005 //*************************************************************************************************
5007 template< typename MT, AlignmentFlag AF, bool SO, bool DF, size_t I, size_t J, size_t M, size_t N >
5008 struct IsLower< Submatrix<MT,AF,SO,DF,I,J,M,N> >
5009  : public BoolConstant< ( IsLower_v<MT> && I == J && M == N ) ||
5010  ( IsStrictlyLower_v<MT> && I == J+1UL && M == N ) >
5011 {};
5013 //*************************************************************************************************
5014 
5015 
5016 
5017 
5018 //=================================================================================================
5019 //
5020 // ISUNILOWER SPECIALIZATIONS
5021 //
5022 //=================================================================================================
5023 
5024 //*************************************************************************************************
5026 template< typename MT, AlignmentFlag AF, bool SO, bool DF, size_t I, size_t J, size_t M, size_t N >
5027 struct IsUniLower< Submatrix<MT,AF,SO,DF,I,J,M,N> >
5028  : public BoolConstant< ( IsUniLower_v<MT> && I == J && M == N ) >
5029 {};
5031 //*************************************************************************************************
5032 
5033 
5034 
5035 
5036 //=================================================================================================
5037 //
5038 // ISSTRICTLYLOWER SPECIALIZATIONS
5039 //
5040 //=================================================================================================
5041 
5042 //*************************************************************************************************
5044 template< typename MT, AlignmentFlag AF, bool SO, bool DF, size_t I, size_t J, size_t M, size_t N >
5045 struct IsStrictlyLower< Submatrix<MT,AF,SO,DF,I,J,M,N> >
5046  : public BoolConstant< ( IsLower_v<MT> && I < J && M == N ) ||
5047  ( IsStrictlyLower_v<MT> && I == J && M == N ) >
5048 {};
5050 //*************************************************************************************************
5051 
5052 
5053 
5054 
5055 //=================================================================================================
5056 //
5057 // ISUPPER SPECIALIZATIONS
5058 //
5059 //=================================================================================================
5060 
5061 //*************************************************************************************************
5063 template< typename MT, AlignmentFlag AF, bool SO, bool DF, size_t I, size_t J, size_t M, size_t N >
5064 struct IsUpper< Submatrix<MT,AF,SO,DF,I,J,M,N> >
5065  : public BoolConstant< ( IsUpper_v<MT> && I == J && M == N ) ||
5066  ( IsStrictlyUpper_v<MT> && I+1UL == J && M == N ) >
5067 {};
5069 //*************************************************************************************************
5070 
5071 
5072 
5073 
5074 //=================================================================================================
5075 //
5076 // ISUNIUPPER SPECIALIZATIONS
5077 //
5078 //=================================================================================================
5079 
5080 //*************************************************************************************************
5082 template< typename MT, AlignmentFlag AF, bool SO, bool DF, size_t I, size_t J, size_t M, size_t N >
5083 struct IsUniUpper< Submatrix<MT,AF,SO,DF,I,J,M,N> >
5084  : public BoolConstant< ( IsUniUpper_v<MT> && I == J && M == N ) >
5085 {};
5087 //*************************************************************************************************
5088 
5089 
5090 
5091 
5092 //=================================================================================================
5093 //
5094 // ISSTRICTLYUPPER SPECIALIZATIONS
5095 //
5096 //=================================================================================================
5097 
5098 //*************************************************************************************************
5100 template< typename MT, AlignmentFlag AF, bool SO, bool DF, size_t I, size_t J, size_t M, size_t N >
5101 struct IsStrictlyUpper< Submatrix<MT,AF,SO,DF,I,J,M,N> >
5102  : public BoolConstant< ( IsUpper_v<MT> && I > J && M == N ) ||
5103  ( IsStrictlyUpper_v<MT> && I == J && M == N ) >
5104 {};
5106 //*************************************************************************************************
5107 
5108 } // namespace blaze
5109 
5110 #endif
AlignmentFlag
Alignment flag for (un-)aligned vectors and matrices.Via these flags it is possible to specify subvec...
Definition: AlignmentFlag.h:62
#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.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:1793
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:2060
bool isStrictlyLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly lower triangular matrix.
Definition: DenseMatrix.h:1968
Header file for the implementation of the RowData class template.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
Definition: Assert.h:117
Header file for the alignment flag values.
Header file for the IsUniUpper type 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
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:992
Header file for basic type definitions.
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:178
IntegralConstant< ptrdiff_t, N > Ptrdiff_t
Compile time integral constant wrapper for ptrdiff_t.The Ptrdiff_t alias template represents an integ...
Definition: IntegralConstant.h:237
Header file for the MatReduceExpr base class.
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
Header file for the serial shim.
Header file for the MatTransExpr base class.
Header file for the dense matrix inversion flags.
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
bool isUniLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower unitriangular matrix.
Definition: DenseMatrix.h:1881
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
Header file for the MatEvalExpr base class.
decltype(auto) subvector(Vector< VT, TF > &, RSAs...)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:154
Header file for the MAYBE_UNUSED function template.
typename RemoveReference< T >::Type RemoveReference_t
Auxiliary alias declaration for the RemoveReference type trait.The RemoveReference_t alias declaratio...
Definition: RemoveReference.h:95
Header file for the MatMatMultExpr base class.
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: IntegralConstant.h:132
constexpr bool IsLower_v
Auxiliary variable template for the IsLower type trait.The IsLower_v variable template provides a con...
Definition: IsLower.h:175
#define BLAZE_STATIC_ASSERT_MSG(expr, msg)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:123
Header file for the IsUniLower type trait.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
constexpr bool IsStrictlyLower_v
Auxiliary variable template for the IsStrictlyLower type trait.The IsStrictlyLower_v variable templat...
Definition: IsStrictlyLower.h:173
Header file for the MatMatKronExpr base class.
constexpr bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:779
Submatrix specialization for dense matrices.
Header file for the MatMapExpr base class.
Header file for the implementation of the Subvector view.
decltype(auto) reduce(const DenseMatrix< MT, SO > &dm, OP op)
Performs a custom reduction operation on the given dense matrix.
Definition: DMatReduceExpr.h:2017
Headerfile for the generic max algorithm.
Header file for the DisableIf class template.
Header file for the SmallArray implementation.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
constexpr bool IsStrictlyUpper_v
Auxiliary variable template for the IsStrictlyUpper type trait.The IsStrictlyUpper_v variable templat...
Definition: IsStrictlyUpper.h:173
Compile time assertion.
Header file for the IsSubmatrix type trait.
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1162
Header file for the implementation of the Submatrix base template.
Header file for the MatMatSubExpr base class.
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:138
Header file for the IsLower type trait.
Header file for the IsAligned type trait.
Header file for the TransposeFlag type trait.
decltype(auto) eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:786
Submatrix specialization for sparse matrices.
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1198
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:438
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 EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:615
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:137
Flag for aligned vectors and matrices.
Definition: AlignmentFlag.h:65
Header file for the HasConstDataAccess type trait.
Header file for the DeclExpr base class.
Header file for the Matrix base class.
constexpr size_t columnwise
Reduction flag for column-wise reduction operations.
Definition: ReductionFlag.h:90
bool isStrictlyUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly upper triangular matrix.
Definition: DenseMatrix.h:2235
decltype(subsequence< Is... >(shift< Offset >(make_index_sequence< N >()))) make_shifted_index_subsequence
Auxiliary alias declaration for the setup of shifted index subsequences.The make_shifted_index_subseq...
Definition: IntegerSequence.h:248
Header file for the MatScalarMultExpr base class.
Header file for run time assertion macros.
Header file for the Unique class template.
Header file for the IsContiguous type trait.
Check< false > Unchecked
Type of the blaze::unchecked instance.blaze::Unchecked is the type of the blaze::unchecked instance,...
Definition: Check.h:96
Header file for the SchurExpr base class.
decltype(auto) expand(const DenseVector< VT, TF > &dv, size_t expansion)
Expansion of the given dense vector.
Definition: DVecExpandExpr.h:739
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
#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:1406
constexpr bool IsSubmatrix_v
Auxiliary variable template for the IsSubmatrix type trait.The IsSubmatrix_v variable template provid...
Definition: IsSubmatrix.h:161
Header file for the isDefault shim.
constexpr bool IsUpper_v
Auxiliary variable template for the IsUpper type trait.The IsUpper_v variable template provides a con...
Definition: IsUpper.h:175
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:114
typename T::VectorType VectorType_t
Alias declaration for nested VectorType type definitions.The VectorType_t alias declaration provides ...
Definition: Aliases.h:510
Header file for the TVecMatMultExpr base class.
Header file for the integer_sequence and index_sequence aliases.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
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:1328
#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
Header file for the MatMatAddExpr base class.
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant alias template represents ...
Definition: IntegralConstant.h:110
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
Header file for the RemoveReference type trait.
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
Header file for the VecExpandExpr base class.
typename T::BaseType BaseType_t
Alias declaration for nested BaseType type definitions.The BaseType_t alias declaration provides a co...
Definition: Aliases.h:70
constexpr size_t rowwise
Reduction flag for row-wise reduction operations.
Definition: ReductionFlag.h:70
Header file for the MatMatMapExpr base class.
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:2148
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
Header file for the IsUpper type trait.
Header file for the implementation of the ColumnData class template.
Header file for the MatScalarDivExpr base class.
Header file for the MatVecMultExpr base class.
Header file for the IsHermitian type trait.
Header file for the IsRestricted type trait.
Header file for the Size type trait.
InversionFlag
Inversion flag.The InversionFlag type enumeration represents the different types of matrix inversion ...
Definition: InversionFlag.h:101
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
Header file for the reduction flags.
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:1121