Blaze  3.6
Rows.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_ROWS_H_
36 #define _BLAZE_MATH_VIEWS_ROWS_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <array>
44 #include <utility>
45 #include <vector>
46 #include <blaze/math/Aliases.h>
50 #include <blaze/math/Exception.h>
84 #include <blaze/math/views/Check.h>
90 #include <blaze/util/Assert.h>
91 #include <blaze/util/DisableIf.h>
92 #include <blaze/util/EnableIf.h>
95 #include <blaze/util/MaybeUnused.h>
96 #include <blaze/util/SmallArray.h>
97 #include <blaze/util/TypeList.h>
98 #include <blaze/util/Types.h>
101 
102 
103 namespace blaze {
104 
105 //=================================================================================================
106 //
107 // GLOBAL FUNCTIONS
108 //
109 //=================================================================================================
110 
111 //*************************************************************************************************
146 template< size_t I // First row index
147  , size_t... Is // Remaining row indices
148  , typename MT // Type of the matrix
149  , bool SO // Storage order
150  , typename... RRAs > // Optional arguments
151 inline decltype(auto) rows( Matrix<MT,SO>& matrix, RRAs... args )
152 {
154 
155  using ReturnType = Rows_< MT, index_sequence<I,Is...> >;
156  return ReturnType( ~matrix, args... );
157 }
158 //*************************************************************************************************
159 
160 
161 //*************************************************************************************************
196 template< size_t I // First row index
197  , size_t... Is // Remaining row indices
198  , typename MT // Type of the matrix
199  , bool SO // Storage order
200  , typename... RRAs > // Optional arguments
201 inline decltype(auto) rows( const Matrix<MT,SO>& matrix, RRAs... args )
202 {
204 
205  using ReturnType = const Rows_< const MT, index_sequence<I,Is...> >;
206  return ReturnType( ~matrix, args... );
207 }
208 //*************************************************************************************************
209 
210 
211 //*************************************************************************************************
225 template< size_t I // First row index
226  , size_t... Is // Remaining row indices
227  , typename MT // Type of the matrix
228  , bool SO // Storage order
229  , typename... RRAs > // Optional arguments
230 inline decltype(auto) rows( Matrix<MT,SO>&& matrix, RRAs... args )
231 {
233 
234  using ReturnType = Rows_< MT, index_sequence<I,Is...> >;
235  return ReturnType( ~matrix, args... );
236 }
237 //*************************************************************************************************
238 
239 
240 //*************************************************************************************************
279 template< typename MT // Type of the matrix
280  , bool SO // Storage order
281  , typename T // Type of the row indices
282  , typename... RRAs > // Optional arguments
283 inline decltype(auto) rows( Matrix<MT,SO>& matrix, T* indices, size_t n, RRAs... args )
284 {
286 
287  using ReturnType = Rows_<MT>;
288  return ReturnType( ~matrix, indices, n, args... );
289 }
290 //*************************************************************************************************
291 
292 
293 //*************************************************************************************************
333 template< typename MT // Type of the matrix
334  , bool SO // Storage order
335  , typename T // Type of the row indices
336  , typename... RRAs > // Optional arguments
337 inline decltype(auto) rows( const Matrix<MT,SO>& matrix, T* indices, size_t n, RRAs... args )
338 {
340 
341  using ReturnType = const Rows_<const MT>;
342  return ReturnType( ~matrix, indices, n, args... );
343 }
344 //*************************************************************************************************
345 
346 
347 //*************************************************************************************************
362 template< typename MT // Type of the matrix
363  , bool SO // Storage order
364  , typename T // Type of the row indices
365  , typename... RRAs > // Optional arguments
366 inline decltype(auto) rows( Matrix<MT,SO>&& matrix, T* indices, size_t n, RRAs... args )
367 {
369 
370  using ReturnType = Rows_<MT>;
371  return ReturnType( ~matrix, indices, n, args... );
372 }
373 //*************************************************************************************************
374 
375 
376 //*************************************************************************************************
413 template< typename MT // Type of the matrix
414  , bool SO // Storage order
415  , typename P // Type of the index producer
416  , typename... RRAs > // Optional arguments
417 inline decltype(auto) rows( Matrix<MT,SO>& matrix, P p, size_t n, RRAs... args )
418 {
420 
421  using ReturnType = Rows_<MT,P>;
422  return ReturnType( ~matrix, p, n, args... );
423 }
424 //*************************************************************************************************
425 
426 
427 //*************************************************************************************************
465 template< typename MT // Type of the matrix
466  , bool SO // Storage order
467  , typename P // Type of the index producer
468  , typename... RRAs > // Optional arguments
469 inline decltype(auto) rows( const Matrix<MT,SO>& matrix, P p, size_t n, RRAs... args )
470 {
472 
473  using ReturnType = const Rows_<const MT,P>;
474  return ReturnType( ~matrix, p, n, args... );
475 }
476 //*************************************************************************************************
477 
478 
479 //*************************************************************************************************
494 template< typename MT // Type of the matrix
495  , bool SO // Storage order
496  , typename P // Type of the index producer
497  , typename... RRAs > // Optional arguments
498 inline decltype(auto) rows( Matrix<MT,SO>&& matrix, P p, size_t n, RRAs... args )
499 {
501 
502  using ReturnType = Rows_<MT,P>;
503  return ReturnType( ~matrix, p, n, args... );
504 }
505 //*************************************************************************************************
506 
507 
508 //*************************************************************************************************
545 template< typename MT // Type of the matrix
546  , size_t... Is // Row indices
547  , typename... RRAs > // Optional arguments
548 inline decltype(auto) rows( MT&& matrix, index_sequence<Is...> indices, RRAs... args )
549 {
551 
552  MAYBE_UNUSED( indices );
553 
554  return rows<Is...>( std::forward<MT>( matrix ), args... );
555 }
556 //*************************************************************************************************
557 
558 
559 //*************************************************************************************************
595 template< typename MT // Type of the matrix
596  , typename T // Type of the row indices
597  , typename... RRAs > // Optional arguments
598 inline decltype(auto) rows( MT&& matrix, initializer_list<T> indices, RRAs... args )
599 {
601 
602  return rows( std::forward<MT>( matrix ), indices.begin(), indices.size(), args... );
603 }
604 //*************************************************************************************************
605 
606 
607 //*************************************************************************************************
645 template< typename MT // Type of the matrix
646  , typename T // Type of the row indices
647  , size_t N // Number of indices
648  , typename... RRAs > // Optional arguments
649 inline decltype(auto) rows( MT&& matrix, const std::array<T,N>& indices, RRAs... args )
650 {
652 
653  return rows( std::forward<MT>( matrix ), indices.data(), N, args... );
654 }
655 //*************************************************************************************************
656 
657 
658 //*************************************************************************************************
696 template< typename MT // Type of the matrix
697  , typename T // Type of the row indices
698  , typename... RRAs > // Optional arguments
699 inline decltype(auto) rows( MT&& matrix, const std::vector<T>& indices, RRAs... args )
700 {
702 
703  return rows( std::forward<MT>( matrix ), indices.data(), indices.size(), args... );
704 }
705 //*************************************************************************************************
706 
707 
708 //*************************************************************************************************
746 template< typename MT // Type of the matrix
747  , typename T // Type of the row indices
748  , size_t N // Number of preallocated elements
749  , typename... RRAs > // Optional arguments
750 inline decltype(auto) rows( MT&& matrix, const SmallArray<T,N>& indices, RRAs... args )
751 {
753 
754  return rows( std::forward<MT>( matrix ), indices.data(), indices.size(), args... );
755 }
756 //*************************************************************************************************
757 
758 
759 //*************************************************************************************************
775 template< typename MT // Type of the matrix
776  , typename T1 // First type of the pair of arguments
777  , typename T2 // Second type of the pair of arguments
778  , typename... RRAs > // Optional arguments
779 inline decltype(auto) rows( MT&& matrix, const std::pair<T1,T2>& pair, RRAs... args )
780 {
782 
783  return rows( std::forward<MT>( matrix ), pair.first, pair.second, args... );
784 }
786 //*************************************************************************************************
787 
788 
789 
790 
791 //=================================================================================================
792 //
793 // GLOBAL RESTRUCTURING FUNCTIONS
794 //
795 //=================================================================================================
796 
797 //*************************************************************************************************
809 template< size_t... CRAs // Compile time row arguments
810  , typename MT // Matrix base type of the expression
811  , typename... RRAs // Runtime row arguments
812  , EnableIf_t< ( sizeof...( CRAs ) + sizeof...( RRAs ) > 0UL ) >* = nullptr >
813 inline decltype(auto) rows( const MatMatAddExpr<MT>& matrix, RRAs... args )
814 {
816 
817  return rows<CRAs...>( (~matrix).leftOperand(), args... ) +
818  rows<CRAs...>( (~matrix).rightOperand(), args... );
819 }
821 //*************************************************************************************************
822 
823 
824 //*************************************************************************************************
836 template< size_t... CRAs // Compile time row arguments
837  , typename MT // Matrix base type of the expression
838  , typename... RRAs // Runtime row arguments
839  , EnableIf_t< ( sizeof...( CRAs ) + sizeof...( RRAs ) > 0UL ) >* = nullptr >
840 inline decltype(auto) rows( const MatMatSubExpr<MT>& matrix, RRAs... args )
841 {
843 
844  return rows<CRAs...>( (~matrix).leftOperand(), args... ) -
845  rows<CRAs...>( (~matrix).rightOperand(), args... );
846 }
848 //*************************************************************************************************
849 
850 
851 //*************************************************************************************************
863 template< size_t... CRAs // Compile time row arguments
864  , typename MT // Matrix base type of the expression
865  , typename... RRAs // Runtime row arguments
866  , EnableIf_t< ( sizeof...( CRAs ) + sizeof...( RRAs ) > 0UL ) >* = nullptr >
867 inline decltype(auto) rows( const SchurExpr<MT>& matrix, RRAs... args )
868 {
870 
871  return rows<CRAs...>( (~matrix).leftOperand(), args... ) %
872  rows<CRAs...>( (~matrix).rightOperand(), args... );
873 }
875 //*************************************************************************************************
876 
877 
878 //*************************************************************************************************
890 template< size_t... CRAs // Compile time row arguments
891  , typename MT // Matrix base type of the expression
892  , typename... RRAs // Runtime row arguments
893  , EnableIf_t< ( sizeof...( CRAs ) + sizeof...( RRAs ) > 0UL ) >* = nullptr >
894 inline decltype(auto) rows( const MatMatMultExpr<MT>& matrix, RRAs... args )
895 {
897 
898  return rows<CRAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
899 }
901 //*************************************************************************************************
902 
903 
904 //*************************************************************************************************
916 template< size_t I // First row index
917  , size_t... Is // Remaining row indices
918  , typename MT // Matrix base type of the expression
919  , typename... RRAs > // Optional arguments
920 inline decltype(auto) rows( const MatMatKronExpr<MT>& matrix, RRAs... args )
921 {
923 
924  decltype(auto) lhs( (~matrix).leftOperand() );
925  decltype(auto) rhs( (~matrix).rightOperand() );
926 
927  const size_t M( rhs.rows() );
928  const size_t N( rhs.columns() );
929 
930  const auto lhsRows( [M]( size_t i ) {
931  static constexpr size_t indices[] = { I, Is... };
932  return indices[i] / M;
933  } );
934 
935  const auto rhsRows( [M]( size_t i ) {
936  static constexpr size_t indices[] = { I, Is... };
937  return indices[i] % M;
938  } );
939 
940  const auto lhsColumns( [N]( size_t i ){ return i / N; } );
941  const auto rhsColumns( [N]( size_t i ){ return i % N; } );
942 
943  return columns( rows( lhs, lhsRows, sizeof...(Is)+1UL, args... ), lhsColumns, (~matrix).columns(), args... ) %
944  columns( rows( rhs, rhsRows, sizeof...(Is)+1UL, args... ), rhsColumns, (~matrix).columns(), args... );
945 }
947 //*************************************************************************************************
948 
949 
950 //*************************************************************************************************
964 template< typename MT // Matrix base type of the expression
965  , typename T // Type of the row indices
966  , typename... RRAs > // Optional arguments
967 inline decltype(auto) rows( const MatMatKronExpr<MT>& matrix, T* indices, size_t n, RRAs... args )
968 {
970 
971  decltype(auto) lhs( (~matrix).leftOperand() );
972  decltype(auto) rhs( (~matrix).rightOperand() );
973 
974  const size_t M( rhs.rows() );
975  const size_t N( rhs.columns() );
976 
977  SmallArray<size_t,128UL> lhsRows;
978  lhsRows.reserve( n );
979 
980  for( size_t i=0UL; i<n; ++i ) {
981  lhsRows.pushBack( indices[i] / M );
982  }
983 
984  SmallArray<size_t,128UL> rhsRows;
985  rhsRows.reserve( n );
986 
987  for( size_t i=0UL; i<n; ++i ) {
988  rhsRows.pushBack( indices[i] % M );
989  }
990 
991  const auto lhsColumns( [N]( size_t i ){ return i / N; } );
992  const auto rhsColumns( [N]( size_t i ){ return i % N; } );
993 
994  return columns( rows( lhs, lhsRows, n, args... ), lhsColumns, (~matrix).columns(), args... ) %
995  columns( rows( rhs, rhsRows, n, args... ), rhsColumns, (~matrix).columns(), args... );
996 }
998 //*************************************************************************************************
999 
1000 
1001 //*************************************************************************************************
1015 template< typename MT // Matrix base type of the expression
1016  , typename P // Type of the index producer
1017  , typename... RRAs > // Optional arguments
1018 inline decltype(auto) rows( const MatMatKronExpr<MT>& matrix, P p, size_t n, RRAs... args )
1019 {
1021 
1022  decltype(auto) lhs( (~matrix).leftOperand() );
1023  decltype(auto) rhs( (~matrix).rightOperand() );
1024 
1025  const size_t M( rhs.rows() );
1026  const size_t N( rhs.columns() );
1027 
1028  const auto lhsRows( [p,M]( size_t i ) { return p(i) / M; } );
1029  const auto rhsRows( [p,M]( size_t i ) { return p(i) % M; } );
1030 
1031  const auto lhsColumns( [N]( size_t i ){ return i / N; } );
1032  const auto rhsColumns( [N]( size_t i ){ return i % N; } );
1033 
1034  return columns( rows( lhs, lhsRows, n, args... ), lhsColumns, (~matrix).columns(), args... ) %
1035  columns( rows( rhs, rhsRows, n, args... ), rhsColumns, (~matrix).columns(), args... );
1036 }
1038 //*************************************************************************************************
1039 
1040 
1041 //*************************************************************************************************
1053 template< size_t... CRAs // Compile time row arguments
1054  , typename MT // Matrix base type of the expression
1055  , typename... RRAs // Runtime row arguments
1056  , EnableIf_t< ( sizeof...( CRAs ) + sizeof...( RRAs ) > 0UL ) >* = nullptr >
1057 inline decltype(auto) rows( const VecTVecMultExpr<MT>& matrix, RRAs... args )
1058 {
1060 
1061  return elements<CRAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
1062 }
1064 //*************************************************************************************************
1065 
1066 
1067 //*************************************************************************************************
1079 template< size_t... CRAs // Compile time row arguments
1080  , typename MT // Matrix base type of the expression
1081  , typename... RRAs // Runtime row arguments
1082  , EnableIf_t< ( sizeof...( CRAs ) + sizeof...( RRAs ) > 0UL ) >* = nullptr >
1083 inline decltype(auto) rows( const MatScalarMultExpr<MT>& matrix, RRAs... args )
1084 {
1086 
1087  return rows<CRAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
1088 }
1090 //*************************************************************************************************
1091 
1092 
1093 //*************************************************************************************************
1105 template< size_t... CRAs // Compile time row arguments
1106  , typename MT // Matrix base type of the expression
1107  , typename... RRAs // Runtime row arguments
1108  , EnableIf_t< ( sizeof...( CRAs ) + sizeof...( RRAs ) > 0UL ) >* = nullptr >
1109 inline decltype(auto) rows( const MatScalarDivExpr<MT>& matrix, RRAs... args )
1110 {
1112 
1113  return rows<CRAs...>( (~matrix).leftOperand(), args... ) / (~matrix).rightOperand();
1114 }
1116 //*************************************************************************************************
1117 
1118 
1119 //*************************************************************************************************
1131 template< size_t... CRAs // Compile time row arguments
1132  , typename MT // Matrix base type of the expression
1133  , typename... RRAs // Runtime row arguments
1134  , EnableIf_t< ( sizeof...( CRAs ) + sizeof...( RRAs ) > 0UL ) >* = nullptr >
1135 inline decltype(auto) rows( const MatMapExpr<MT>& matrix, RRAs... args )
1136 {
1138 
1139  return map( rows<CRAs...>( (~matrix).operand(), args... ), (~matrix).operation() );
1140 }
1142 //*************************************************************************************************
1143 
1144 
1145 //*************************************************************************************************
1157 template< size_t... CRAs // Compile time row arguments
1158  , typename MT // Matrix base type of the expression
1159  , typename... RRAs // Runtime row arguments
1160  , EnableIf_t< ( sizeof...( CRAs ) + sizeof...( RRAs ) > 0UL ) >* = nullptr >
1161 inline decltype(auto) rows( const MatMatMapExpr<MT>& matrix, RRAs... args )
1162 {
1164 
1165  return map( rows<CRAs...>( (~matrix).leftOperand(), args... ),
1166  rows<CRAs...>( (~matrix).rightOperand(), args... ),
1167  (~matrix).operation() );
1168 }
1170 //*************************************************************************************************
1171 
1172 
1173 //*************************************************************************************************
1185 template< size_t... CRAs // Compile time row arguments
1186  , typename MT // Matrix base type of the expression
1187  , typename... RRAs // Runtime row arguments
1188  , EnableIf_t< ( sizeof...( CRAs ) + sizeof...( RRAs ) > 0UL ) >* = nullptr >
1189 inline decltype(auto) rows( const MatEvalExpr<MT>& matrix, RRAs... args )
1190 {
1192 
1193  return eval( rows<CRAs...>( (~matrix).operand(), args... ) );
1194 }
1196 //*************************************************************************************************
1197 
1198 
1199 //*************************************************************************************************
1211 template< size_t... CRAs // Compile time row arguments
1212  , typename MT // Matrix base type of the expression
1213  , typename... RRAs // Runtime row arguments
1214  , EnableIf_t< ( sizeof...( CRAs ) + sizeof...( RRAs ) > 0UL ) >* = nullptr >
1215 inline decltype(auto) rows( const MatSerialExpr<MT>& matrix, RRAs... args )
1216 {
1218 
1219  return serial( rows<CRAs...>( (~matrix).operand(), args... ) );
1220 }
1222 //*************************************************************************************************
1223 
1224 
1225 //*************************************************************************************************
1237 template< size_t... CRAs // Compile time row arguments
1238  , typename MT // Matrix base type of the expression
1239  , typename... RRAs // Runtime row arguments
1240  , EnableIf_t< ( sizeof...( CRAs ) + sizeof...( RRAs ) > 0UL ) >* = nullptr >
1241 inline decltype(auto) rows( const DeclExpr<MT>& matrix, RRAs... args )
1242 {
1244 
1245  return rows<CRAs...>( (~matrix).operand(), args... );
1246 }
1248 //*************************************************************************************************
1249 
1250 
1251 //*************************************************************************************************
1263 template< size_t... CRAs // Compile time row arguments
1264  , typename MT // Matrix base type of the expression
1265  , typename... RRAs // Runtime row arguments
1266  , EnableIf_t< ( sizeof...( CRAs ) + sizeof...( RRAs ) > 0UL ) >* = nullptr >
1267 inline decltype(auto) rows( const MatTransExpr<MT>& matrix, RRAs... args )
1268 {
1270 
1271  return trans( columns<CRAs...>( (~matrix).operand(), args... ) );
1272 }
1274 //*************************************************************************************************
1275 
1276 
1277 //*************************************************************************************************
1289 template< size_t... CRAs // Compile time row arguments
1290  , typename MT // Matrix base type of the expression
1291  , size_t... CEAs // Compile time expansion arguments
1292  , typename... RRAs // Runtime row arguments
1293  , EnableIf_t< ( sizeof...( CRAs ) > 0UL ) &&
1294  IsRowMajorMatrix_v<MT> >* = nullptr >
1295 inline decltype(auto) rows( const VecExpandExpr<MT,CEAs...>& matrix, RRAs... args )
1296 {
1298 
1299  MAYBE_UNUSED( args... );
1300 
1301  return expand< sizeof...( CRAs ) >( (~matrix).operand() );
1302 }
1304 //*************************************************************************************************
1305 
1306 
1307 //*************************************************************************************************
1321 template< typename MT // Matrix base type of the expression
1322  , size_t... CEAs // Compile time expansion arguments
1323  , typename T // Type of the row indices or index producer
1324  , typename... RRAs // Runtime row arguments
1325  , EnableIf_t< IsRowMajorMatrix_v<MT> >* = nullptr >
1326 inline decltype(auto) rows( const VecExpandExpr<MT,CEAs...>& matrix, T indices, size_t n, RRAs... args )
1327 {
1329 
1330  MAYBE_UNUSED( indices, args... );
1331 
1332  return expand( (~matrix).operand(), n );
1333 }
1335 //*************************************************************************************************
1336 
1337 
1338 //*************************************************************************************************
1350 template< size_t... CRAs // Compile time row arguments
1351  , typename MT // Matrix base type of the expression
1352  , size_t... CEAs // Compile time expansion arguments
1353  , typename... RRAs // Runtime row arguments
1354  , EnableIf_t< ( sizeof...( CRAs ) + sizeof...( RRAs ) > 0UL ) &&
1355  !IsRowMajorMatrix_v<MT> >* = nullptr >
1356 inline decltype(auto) rows( const VecExpandExpr<MT,CEAs...>& matrix, RRAs... args )
1357 {
1359 
1360  return expand<CEAs...>( elements<CRAs...>( (~matrix).operand(), args... ), (~matrix).expansion() );
1361 }
1363 //*************************************************************************************************
1364 
1365 
1366 
1367 
1368 //=================================================================================================
1369 //
1370 // GLOBAL RESTRUCTURING FUNCTIONS (ROWS)
1371 //
1372 //=================================================================================================
1373 
1374 //*************************************************************************************************
1385 template< size_t I // First required row index
1386  , size_t... Is // Remaining required row indices
1387  , typename MT // Type of the matrix
1388  , typename... RRAs // Optional row arguments
1389  , EnableIf_t< IsRows_v< RemoveReference_t<MT> > &&
1390  RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
1391 inline decltype(auto) rows( MT&& r, RRAs... args )
1392 {
1394 
1395  return rows( r.operand(), subsequence<I,Is...>( RemoveReference_t<MT>::idces() ), args... );
1396 }
1398 //*************************************************************************************************
1399 
1400 
1401 //*************************************************************************************************
1413 template< size_t I // First required row index
1414  , size_t... Is // Remaining required row indices
1415  , typename MT // Type of the matrix
1416  , typename... RRAs // Optional row arguments
1417  , EnableIf_t< IsRows_v< RemoveReference_t<MT> > &&
1418  !RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
1419 inline decltype(auto) rows( MT&& r, RRAs... args )
1420 {
1422 
1423  constexpr bool isChecked( !Contains_v< TypeList<RRAs...>, Unchecked > );
1424 
1425  if( isChecked ) {
1426  static constexpr size_t indices[] = { I, Is... };
1427  for( size_t i=0UL; i<sizeof...(Is)+1UL; ++i ) {
1428  if( r.rows() <= indices[i] ) {
1429  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
1430  }
1431  }
1432  }
1433 
1434  return rows( r.operand(), { r.idx(I), r.idx(Is)... }, args... );
1435 }
1437 //*************************************************************************************************
1438 
1439 
1440 //*************************************************************************************************
1454 template< typename MT // Type of the matrix
1455  , typename T // Type of the row indices
1456  , typename... RRAs // Optional row arguments
1457  , EnableIf_t< IsRows_v< RemoveReference_t<MT> > >* = nullptr >
1458 inline decltype(auto) rows( MT&& r, T* indices, size_t n, RRAs... args )
1459 {
1461 
1462  constexpr bool isChecked( !Contains_v< TypeList<RRAs...>, Unchecked > );
1463 
1464  if( isChecked ) {
1465  for( size_t i=0UL; i<n; ++i ) {
1466  if( r.rows() <= size_t( indices[i] ) ) {
1467  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
1468  }
1469  }
1470  }
1471 
1472  SmallArray<size_t,128UL> newIndices;
1473  newIndices.reserve( n );
1474 
1475  for( size_t i=0UL; i<n; ++i ) {
1476  newIndices.pushBack( r.idx( indices[i] ) );
1477  }
1478 
1479  return rows( r.operand(), newIndices.data(), newIndices.size(), args... );
1480 }
1482 //*************************************************************************************************
1483 
1484 
1485 //*************************************************************************************************
1499 template< typename MT // Type of the matrix
1500  , typename P // Type of the index producer
1501  , typename... RRAs // Optional row arguments
1502  , EnableIf_t< IsRows_v< RemoveReference_t<MT> > && !IsPointer_v<P> >* = nullptr >
1503 inline decltype(auto) rows( MT&& r, P p, size_t n, RRAs... args )
1504 {
1506 
1507  constexpr bool isChecked( !Contains_v< TypeList<RRAs...>, Unchecked > );
1508 
1509  if( isChecked ) {
1510  for( size_t i=0UL; i<n; ++i ) {
1511  if( r.rows() <= size_t( p(i) ) ) {
1512  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
1513  }
1514  }
1515  }
1516 
1517  SmallArray<size_t,128UL> newIndices;
1518  newIndices.reserve( n );
1519 
1520  for( size_t i=0UL; i<n; ++i ) {
1521  newIndices.pushBack( r.idx( p(i) ) );
1522  }
1523 
1524  return rows( r.operand(), newIndices.data(), newIndices.size(), args... );
1525 }
1527 //*************************************************************************************************
1528 
1529 
1530 
1531 
1532 //=================================================================================================
1533 //
1534 // GLOBAL RESTRUCTURING FUNCTIONS (ELEMENTS)
1535 //
1536 //=================================================================================================
1537 
1538 //*************************************************************************************************
1550 template< size_t... CEAs // Compile time element arguments
1551  , typename VT // Vector base type of the expression
1552  , typename... REAs > // Runtime element arguments
1553 inline decltype(auto) elements( const MatVecMultExpr<VT>& vector, REAs... args )
1554 {
1556 
1557  return rows<CEAs...>( (~vector).leftOperand(), args... ) * (~vector).rightOperand();
1558 }
1560 //*************************************************************************************************
1561 
1562 
1563 //*************************************************************************************************
1576 template< size_t... CEAs // Compile time element arguments
1577  , typename VT // Vector base type of the expression
1578  , typename... REAs > // Runtime element arguments
1579 inline decltype(auto) elements( const MatReduceExpr<VT,rowwise>& vector, REAs... args )
1580 {
1582 
1583  return reduce<rowwise>( rows<CEAs...>( (~vector).operand(), args... ), (~vector).operation() );
1584 }
1586 //*************************************************************************************************
1587 
1588 
1589 
1590 
1591 //=================================================================================================
1592 //
1593 // GLOBAL RESTRUCTURING FUNCTIONS (ROW)
1594 //
1595 //=================================================================================================
1596 
1597 //*************************************************************************************************
1608 template< size_t I // Row index
1609  , typename MT // Type of the matrix
1610  , typename... RRAs // Optional row arguments
1611  , EnableIf_t< IsRows_v< RemoveReference_t<MT> > &&
1612  RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
1613 inline decltype(auto) row( MT&& rows, RRAs... args )
1614 {
1616 
1617  return row< RemoveReference_t<MT>::idx(I) >( rows.operand(), args... );
1618 }
1620 //*************************************************************************************************
1621 
1622 
1623 //*************************************************************************************************
1635 template< size_t... CRAs // Compile time row arguments
1636  , typename MT // Type of the matrix
1637  , typename... RRAs // Runtime row arguments
1638  , EnableIf_t< IsRows_v< RemoveReference_t<MT> > &&
1639  ( sizeof...( CRAs ) == 0UL || !RemoveReference_t<MT>::compileTimeArgs ) >* = nullptr >
1640 inline decltype(auto) row( MT&& rows, RRAs... args )
1641 {
1643 
1644  const RowData<CRAs...> rd( args... );
1645 
1646  constexpr bool isChecked( !Contains_v< TypeList<RRAs...>, Unchecked > );
1647 
1648  if( isChecked ) {
1649  if( rows.rows() <= rd.row() ) {
1650  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
1651  }
1652  }
1653 
1654  return row( rows.operand(), rows.idx( rd.row() ), args... );
1655 }
1657 //*************************************************************************************************
1658 
1659 
1660 
1661 
1662 //=================================================================================================
1663 //
1664 // GLOBAL RESTRUCTURING FUNCTIONS (COLUMN)
1665 //
1666 //=================================================================================================
1667 
1668 //*************************************************************************************************
1679 template< size_t... CCAs // Compile time column arguments
1680  , typename MT // Type of the matrix
1681  , typename... RCAs // Runtime column arguments
1682  , EnableIf_t< IsRows_v< RemoveReference_t<MT> > >* = nullptr >
1683 inline decltype(auto) column( MT&& rows, RCAs... args )
1684 {
1686 
1687  return elements( column<CCAs...>( rows.operand(), args... ), rows.idces() );
1688 }
1690 //*************************************************************************************************
1691 
1692 
1693 
1694 
1695 //=================================================================================================
1696 //
1697 // ROWS OPERATORS
1698 //
1699 //=================================================================================================
1700 
1701 //*************************************************************************************************
1709 template< typename MT // Type of the matrix
1710  , bool SO // Storage order
1711  , bool DF // Density flag
1712  , bool SF // Symmetry flag
1713  , typename... CRAs > // Compile time row arguments
1714 inline void reset( Rows<MT,SO,DF,SF,CRAs...>& rows )
1715 {
1716  rows.reset();
1717 }
1719 //*************************************************************************************************
1720 
1721 
1722 //*************************************************************************************************
1730 template< typename MT // Type of the matrix
1731  , bool SO // Storage order
1732  , bool DF // Density flag
1733  , bool SF // Symmetry flag
1734  , typename... CRAs > // Compile time row arguments
1735 inline void reset( Rows<MT,SO,DF,SF,CRAs...>&& rows )
1736 {
1737  rows.reset();
1738 }
1740 //*************************************************************************************************
1741 
1742 
1743 //*************************************************************************************************
1755 template< typename MT // Type of the matrix
1756  , bool SO // Storage order
1757  , bool DF // Density flag
1758  , bool SF // Symmetry flag
1759  , typename... CRAs > // Compile time row arguments
1760 inline void reset( Rows<MT,SO,DF,SF,CRAs...>& rows, size_t i )
1761 {
1762  rows.reset( i );
1763 }
1765 //*************************************************************************************************
1766 
1767 
1768 //*************************************************************************************************
1778 template< typename MT // Type of the matrix
1779  , bool SO // Storage order
1780  , bool DF // Density flag
1781  , bool SF // Symmetry flag
1782  , typename... CRAs > // Compile time row arguments
1783 inline void clear( Rows<MT,SO,DF,SF,CRAs...>& rows )
1784 {
1785  rows.reset();
1786 }
1788 //*************************************************************************************************
1789 
1790 
1791 //*************************************************************************************************
1801 template< typename MT // Type of the matrix
1802  , bool SO // Storage order
1803  , bool DF // Density flag
1804  , bool SF // Symmetry flag
1805  , typename... CRAs > // Compile time row arguments
1806 inline void clear( Rows<MT,SO,DF,SF,CRAs...>&& rows )
1807 {
1808  rows.reset();
1809 }
1811 //*************************************************************************************************
1812 
1813 
1814 //*************************************************************************************************
1840 template< bool RF // Relaxation flag
1841  , typename MT // Type of the dense matrix
1842  , bool SO // Storage order
1843  , bool SF // Symmetry flag
1844  , typename... CRAs > // Compile time row arguments
1845 inline bool isDefault( const Rows<MT,SO,true,SF,CRAs...>& rows )
1846 {
1847  using blaze::isDefault;
1848 
1849  if( SO == true ) {
1850  for( size_t i=0UL; i<rows.rows(); ++i )
1851  for( size_t j=0UL; j<rows.columns(); ++j )
1852  if( !isDefault<RF>( rows(i,j) ) )
1853  return false;
1854  }
1855  else {
1856  for( size_t j=0UL; j<rows.columns(); ++j )
1857  for( size_t i=0UL; i<rows.rows(); ++i )
1858  if( !isDefault<RF>( rows(i,j) ) )
1859  return false;
1860  }
1861 
1862  return true;
1863 }
1865 //*************************************************************************************************
1866 
1867 
1868 //*************************************************************************************************
1894 template< bool RF // Relaxation flag
1895  , typename MT // Type of the dense matrix
1896  , bool SO // Storage order
1897  , bool SF // Symmetry flag
1898  , typename... CRAs > // Compile time row arguments
1899 inline bool isDefault( const Rows<MT,SO,false,SF,CRAs...>& rows )
1900 {
1901  using blaze::isDefault;
1902 
1903  for( size_t i=0UL; i<rows.rows(); ++i ) {
1904  for( auto element=rows.cbegin(i); element!=rows.cend(i); ++element )
1905  if( !isDefault<RF>( element->value() ) ) return false;
1906  }
1907 
1908  return true;
1909 }
1911 //*************************************************************************************************
1912 
1913 
1914 //*************************************************************************************************
1933 template< typename MT // Type of the matrix
1934  , bool SO // Storage order
1935  , bool DF // Density flag
1936  , bool SF // Symmetry flag
1937  , typename... CRAs > // Compile time row arguments
1938 inline bool isIntact( const Rows<MT,SO,DF,SF,CRAs...>& rows ) noexcept
1939 {
1940  return ( rows.rows() <= rows.operand().rows() &&
1941  rows.columns() == rows.operand().columns() &&
1942  isIntact( rows.operand() ) );
1943 }
1945 //*************************************************************************************************
1946 
1947 
1948 //*************************************************************************************************
1961 template< typename MT // Type of the matrix
1962  , bool SO1 // Storage order of the left-hand side row selection
1963  , bool DF // Density flag
1964  , bool SF // Symmetry flag
1965  , typename... CRAs // Compile time row arguments
1966  , bool SO2 > // Storage order of the right-hand side matrix
1967 inline bool isSame( const Rows<MT,SO1,DF,SF,CRAs...>& a, const Matrix<MT,SO2>& b ) noexcept
1968 {
1969  if( !isSame( a.operand(), ~b ) || ( a.rows() != (~b).rows() ) || ( a.columns() != (~b).columns() ) )
1970  return false;
1971 
1972  for( size_t i=0UL; i<a.rows(); ++i ) {
1973  if( a.idx(i) != i )
1974  return false;
1975  }
1976 
1977  return true;
1978 }
1980 //*************************************************************************************************
1981 
1982 
1983 //*************************************************************************************************
1996 template< typename MT // Type of the matrix
1997  , bool SO1 // Storage order of the left-hand side matrix
1998  , bool DF // Density flag
1999  , bool SF // Symmetry flag
2000  , typename... CRAs // Compile time row arguments
2001  , bool SO2 > // Storage order of the right-hand side row selection
2002 inline bool isSame( const Matrix<MT,SO1>& a, const Rows<MT,SO2,DF,SF,CRAs...>& b ) noexcept
2003 {
2004  return isSame( b, a );
2005 }
2007 //*************************************************************************************************
2008 
2009 
2010 //*************************************************************************************************
2023 template< typename MT // Type of the matrix
2024  , bool SO1 // Storage order of the left-hand side row selection
2025  , bool DF // Density flag
2026  , bool SF // Symmetry flag
2027  , typename... CRAs // Compile time row arguments
2028  , AlignmentFlag AF // Alignment flag
2029  , bool SO2 // Storage order of the right-hand side submatrix
2030  , size_t... CSAs > // Compile time submatrix arguments
2031 inline bool isSame( const Rows<MT,SO1,DF,SF,CRAs...>& a, const Submatrix<MT,AF,SO2,DF,CSAs...>& b ) noexcept
2032 {
2033  if( !isSame( a.operand(), b.operand() ) || ( a.rows() != (~b).rows() ) || ( a.columns() != (~b).columns() ) )
2034  return false;
2035 
2036  for( size_t i=0UL; i<a.rows(); ++i ) {
2037  if( a.idx(i) != b.row()+i )
2038  return false;
2039  }
2040 
2041  return true;
2042 }
2044 //*************************************************************************************************
2045 
2046 
2047 //*************************************************************************************************
2060 template< typename MT // Type of the matrix
2061  , AlignmentFlag AF // Alignment flag
2062  , bool SO1 // Storage order of the left-hand side submatrix
2063  , bool DF // Density flag
2064  , size_t... CSAs // Compile time submatrix arguments
2065  , bool SO2 // Storage order of the right-hand side row selection
2066  , bool SF // Symmetry flag
2067  , typename... CRAs > // Compile time row arguments
2068 inline bool isSame( const Submatrix<MT,AF,SO1,DF,CSAs...>& a, const Rows<MT,SO2,DF,SF,CRAs...>& b ) noexcept
2069 {
2070  return isSame( b, a );
2071 }
2073 //*************************************************************************************************
2074 
2075 
2076 //*************************************************************************************************
2089 template< typename MT // Type of the matrix
2090  , bool SO // Storage order
2091  , bool DF // Density flag
2092  , bool SF // Symmetry flag
2093  , typename... CRAs1 // Compile time row arguments of the left-hand side row selection
2094  , typename... CRAs2 > // Compile time row arguments of the right-hand side row selection
2095 inline bool isSame( const Rows<MT,SO,DF,SF,CRAs1...>& a,
2096  const Rows<MT,SO,DF,SF,CRAs2...>& b ) noexcept
2097 {
2098  if( !isSame( a.operand(), b.operand() ) || a.rows() != b.rows() || a.columns() != b.columns() )
2099  return false;
2100 
2101  for( size_t i=0UL; i<a.rows(); ++i ) {
2102  if( a.idx(i) != b.idx(i) )
2103  return false;
2104  }
2105 
2106  return true;
2107 }
2109 //*************************************************************************************************
2110 
2111 
2112 //*************************************************************************************************
2151 template< InversionFlag IF // Inversion algorithm
2152  , typename MT // Type of the dense matrix
2153  , bool SO // Storage order
2154  , bool SF // Symmetry flag
2155  , typename... CRAs > // Compile time row arguments
2156 inline auto invert( Rows<MT,SO,true,SF,CRAs...>& r )
2157  -> DisableIf_t< HasMutableDataAccess_v<MT> >
2158 {
2159  using RT = ResultType_t< Rows<MT,SO,true,SF,CRAs...> >;
2160 
2163 
2164  RT tmp( r );
2165  invert<IF>( tmp );
2166  r = tmp;
2167 }
2169 //*************************************************************************************************
2170 
2171 
2172 //*************************************************************************************************
2188 template< typename MT // Type of the matrix
2189  , bool SO // Storage order
2190  , bool DF // Density flag
2191  , bool SF // Symmetry flag
2192  , typename... CRAs // Compile time row arguments
2193  , typename ET > // Type of the element
2194 inline bool trySet( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t i, size_t j, const ET& value )
2195 {
2196  BLAZE_INTERNAL_ASSERT( i < r.rows(), "Invalid row access index" );
2197  BLAZE_INTERNAL_ASSERT( j < r.columns(), "Invalid column access index" );
2198 
2199  return trySet( r.operand(), r.idx(i), j, value );
2200 }
2202 //*************************************************************************************************
2203 
2204 
2205 //*************************************************************************************************
2223 template< typename MT // Type of the matrix
2224  , bool SO // Storage order
2225  , bool DF // Density flag
2226  , bool SF // Symmetry flag
2227  , typename... CRAs // Compile time row arguments
2228  , typename ET > // Type of the element
2230  trySet( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t row, size_t column, size_t m, size_t n, const ET& value )
2231 {
2232  BLAZE_INTERNAL_ASSERT( row <= (~r).rows(), "Invalid row access index" );
2233  BLAZE_INTERNAL_ASSERT( column <= (~r).columns(), "Invalid column access index" );
2234  BLAZE_INTERNAL_ASSERT( row + m <= (~r).rows(), "Invalid number of rows" );
2235  BLAZE_INTERNAL_ASSERT( column + n <= (~r).columns(), "Invalid number of columns" );
2236 
2237  const size_t iend( row + m );
2238 
2239  for( size_t i=row; i<iend; ++i ) {
2240  if( !trySet( r.operand(), r.idx(i), column, 1UL, n, value ) )
2241  return false;
2242  }
2243 
2244  return true;
2245 }
2247 //*************************************************************************************************
2248 
2249 
2250 //*************************************************************************************************
2266 template< typename MT // Type of the matrix
2267  , bool SO // Storage order
2268  , bool DF // Density flag
2269  , bool SF // Symmetry flag
2270  , typename... CRAs // Compile time row arguments
2271  , typename ET > // Type of the element
2272 inline bool tryAdd( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t i, size_t j, const ET& value )
2273 {
2274  BLAZE_INTERNAL_ASSERT( i < r.rows(), "Invalid row access index" );
2275  BLAZE_INTERNAL_ASSERT( j < r.columns(), "Invalid column access index" );
2276 
2277  return tryAdd( r.operand(), r.idx(i), j, value );
2278 }
2280 //*************************************************************************************************
2281 
2282 
2283 //*************************************************************************************************
2301 template< typename MT // Type of the matrix
2302  , bool SO // Storage order
2303  , bool DF // Density flag
2304  , bool SF // Symmetry flag
2305  , typename... CRAs // Compile time row arguments
2306  , typename ET > // Type of the element
2308  tryAdd( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t row, size_t column, size_t m, size_t n, const ET& value )
2309 {
2310  BLAZE_INTERNAL_ASSERT( row <= (~r).rows(), "Invalid row access index" );
2311  BLAZE_INTERNAL_ASSERT( column <= (~r).columns(), "Invalid column access index" );
2312  BLAZE_INTERNAL_ASSERT( row + m <= (~r).rows(), "Invalid number of rows" );
2313  BLAZE_INTERNAL_ASSERT( column + n <= (~r).columns(), "Invalid number of columns" );
2314 
2315  const size_t iend( row + m );
2316 
2317  for( size_t i=row; i<iend; ++i ) {
2318  if( !tryAdd( r.operand(), r.idx(i), column, 1UL, n, value ) )
2319  return false;
2320  }
2321 
2322  return true;
2323 }
2325 //*************************************************************************************************
2326 
2327 
2328 //*************************************************************************************************
2344 template< typename MT // Type of the matrix
2345  , bool SO // Storage order
2346  , bool DF // Density flag
2347  , bool SF // Symmetry flag
2348  , typename... CRAs // Compile time row arguments
2349  , typename ET > // Type of the element
2350 inline bool trySub( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t i, size_t j, const ET& value )
2351 {
2352  BLAZE_INTERNAL_ASSERT( i < r.rows(), "Invalid row access index" );
2353  BLAZE_INTERNAL_ASSERT( j < r.columns(), "Invalid column access index" );
2354 
2355  return trySub( r.operand(), r.idx(i), j, value );
2356 }
2358 //*************************************************************************************************
2359 
2360 
2361 //*************************************************************************************************
2379 template< typename MT // Type of the matrix
2380  , bool SO // Storage order
2381  , bool DF // Density flag
2382  , bool SF // Symmetry flag
2383  , typename... CRAs // Compile time row arguments
2384  , typename ET > // Type of the element
2386  trySub( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t row, size_t column, size_t m, size_t n, const ET& value )
2387 {
2388  BLAZE_INTERNAL_ASSERT( row <= (~r).rows(), "Invalid row access index" );
2389  BLAZE_INTERNAL_ASSERT( column <= (~r).columns(), "Invalid column access index" );
2390  BLAZE_INTERNAL_ASSERT( row + m <= (~r).rows(), "Invalid number of rows" );
2391  BLAZE_INTERNAL_ASSERT( column + n <= (~r).columns(), "Invalid number of columns" );
2392 
2393  const size_t iend( row + m );
2394 
2395  for( size_t i=row; i<iend; ++i ) {
2396  if( !trySub( r.operand(), r.idx(i), column, 1UL, n, value ) )
2397  return false;
2398  }
2399 
2400  return true;
2401 }
2403 //*************************************************************************************************
2404 
2405 
2406 //*************************************************************************************************
2422 template< typename MT // Type of the matrix
2423  , bool SO // Storage order
2424  , bool DF // Density flag
2425  , bool SF // Symmetry flag
2426  , typename... CRAs // Compile time row arguments
2427  , typename ET > // Type of the element
2428 inline bool tryMult( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t i, size_t j, const ET& value )
2429 {
2430  BLAZE_INTERNAL_ASSERT( i < r.rows(), "Invalid row access index" );
2431  BLAZE_INTERNAL_ASSERT( j < r.columns(), "Invalid column access index" );
2432 
2433  return tryMult( r.operand(), r.idx(i), j, value );
2434 }
2436 //*************************************************************************************************
2437 
2438 
2439 //*************************************************************************************************
2457 template< typename MT // Type of the matrix
2458  , bool SO // Storage order
2459  , bool DF // Density flag
2460  , bool SF // Symmetry flag
2461  , typename... CRAs // Compile time row arguments
2462  , typename ET > // Type of the element
2464  tryMult( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t row, size_t column, size_t m, size_t n, const ET& value )
2465 {
2466  BLAZE_INTERNAL_ASSERT( row <= (~r).rows(), "Invalid row access index" );
2467  BLAZE_INTERNAL_ASSERT( column <= (~r).columns(), "Invalid column access index" );
2468  BLAZE_INTERNAL_ASSERT( row + m <= (~r).rows(), "Invalid number of rows" );
2469  BLAZE_INTERNAL_ASSERT( column + n <= (~r).columns(), "Invalid number of columns" );
2470 
2471  const size_t iend( row + m );
2472 
2473  for( size_t i=row; i<iend; ++i ) {
2474  if( !tryMult( r.operand(), r.idx(i), column, 1UL, n, value ) )
2475  return false;
2476  }
2477 
2478  return true;
2479 }
2481 //*************************************************************************************************
2482 
2483 
2484 //*************************************************************************************************
2500 template< typename MT // Type of the matrix
2501  , bool SO // Storage order
2502  , bool DF // Density flag
2503  , bool SF // Symmetry flag
2504  , typename... CRAs // Compile time row arguments
2505  , typename ET > // Type of the element
2506 inline bool tryDiv( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t i, size_t j, const ET& value )
2507 {
2508  BLAZE_INTERNAL_ASSERT( i < r.rows(), "Invalid row access index" );
2509  BLAZE_INTERNAL_ASSERT( j < r.columns(), "Invalid column access index" );
2510 
2511  return tryDiv( r.operand(), r.idx(i), j, value );
2512 }
2514 //*************************************************************************************************
2515 
2516 
2517 //*************************************************************************************************
2535 template< typename MT // Type of the matrix
2536  , bool SO // Storage order
2537  , bool DF // Density flag
2538  , bool SF // Symmetry flag
2539  , typename... CRAs // Compile time row arguments
2540  , typename ET > // Type of the element
2542  tryDiv( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t row, size_t column, size_t m, size_t n, const ET& value )
2543 {
2544  BLAZE_INTERNAL_ASSERT( row <= (~r).rows(), "Invalid row access index" );
2545  BLAZE_INTERNAL_ASSERT( column <= (~r).columns(), "Invalid column access index" );
2546  BLAZE_INTERNAL_ASSERT( row + m <= (~r).rows(), "Invalid number of rows" );
2547  BLAZE_INTERNAL_ASSERT( column + n <= (~r).columns(), "Invalid number of columns" );
2548 
2549  const size_t iend( row + m );
2550 
2551  for( size_t i=row; i<iend; ++i ) {
2552  if( !tryDiv( r.operand(), r.idx(i), column, 1UL, n, value ) )
2553  return false;
2554  }
2555 
2556  return true;
2557 }
2559 //*************************************************************************************************
2560 
2561 
2562 //*************************************************************************************************
2578 template< typename MT // Type of the matrix
2579  , bool SO // Storage order
2580  , bool DF // Density flag
2581  , bool SF // Symmetry flag
2582  , typename... CRAs > // Compile time row arguments
2583 inline bool tryShift( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t i, size_t j, int count )
2584 {
2585  BLAZE_INTERNAL_ASSERT( i < r.rows(), "Invalid row access index" );
2586  BLAZE_INTERNAL_ASSERT( j < r.columns(), "Invalid column access index" );
2587 
2588  return tryShift( r.operand(), r.idx(i), j, count );
2589 }
2591 //*************************************************************************************************
2592 
2593 
2594 //*************************************************************************************************
2612 template< typename MT // Type of the matrix
2613  , bool SO // Storage order
2614  , bool DF // Density flag
2615  , bool SF // Symmetry flag
2616  , typename... CRAs > // Compile time row arguments
2618  tryShift( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t row, size_t column, size_t m, size_t n, int count )
2619 {
2620  BLAZE_INTERNAL_ASSERT( row <= (~r).rows(), "Invalid row access index" );
2621  BLAZE_INTERNAL_ASSERT( column <= (~r).columns(), "Invalid column access index" );
2622  BLAZE_INTERNAL_ASSERT( row + m <= (~r).rows(), "Invalid number of rows" );
2623  BLAZE_INTERNAL_ASSERT( column + n <= (~r).columns(), "Invalid number of columns" );
2624 
2625  const size_t iend( row + m );
2626 
2627  for( size_t i=row; i<iend; ++i ) {
2628  if( !tryShift( r.operand(), r.idx(i), column, 1UL, n, count ) )
2629  return false;
2630  }
2631 
2632  return true;
2633 }
2635 //*************************************************************************************************
2636 
2637 
2638 //*************************************************************************************************
2654 template< typename MT // Type of the matrix
2655  , bool SO // Storage order
2656  , bool DF // Density flag
2657  , bool SF // Symmetry flag
2658  , typename... CRAs // Compile time row arguments
2659  , typename ET > // Type of the element
2660 inline bool tryBitand( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t i, size_t j, const ET& value )
2661 {
2662  BLAZE_INTERNAL_ASSERT( i < r.rows(), "Invalid row access index" );
2663  BLAZE_INTERNAL_ASSERT( j < r.columns(), "Invalid column access index" );
2664 
2665  return tryBitand( r.operand(), r.idx(i), j, value );
2666 }
2668 //*************************************************************************************************
2669 
2670 
2671 //*************************************************************************************************
2689 template< typename MT // Type of the matrix
2690  , bool SO // Storage order
2691  , bool DF // Density flag
2692  , bool SF // Symmetry flag
2693  , typename... CRAs // Compile time row arguments
2694  , typename ET > // Type of the element
2696  tryBitand( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t row, size_t column, size_t m, size_t n, const ET& value )
2697 {
2698  BLAZE_INTERNAL_ASSERT( row <= (~r).rows(), "Invalid row access index" );
2699  BLAZE_INTERNAL_ASSERT( column <= (~r).columns(), "Invalid column access index" );
2700  BLAZE_INTERNAL_ASSERT( row + m <= (~r).rows(), "Invalid number of rows" );
2701  BLAZE_INTERNAL_ASSERT( column + n <= (~r).columns(), "Invalid number of columns" );
2702 
2703  const size_t iend( row + m );
2704 
2705  for( size_t i=row; i<iend; ++i ) {
2706  if( !tryBitand( r.operand(), r.idx(i), column, 1UL, n, value ) )
2707  return false;
2708  }
2709 
2710  return true;
2711 }
2713 //*************************************************************************************************
2714 
2715 
2716 //*************************************************************************************************
2732 template< typename MT // Type of the matrix
2733  , bool SO // Storage order
2734  , bool DF // Density flag
2735  , bool SF // Symmetry flag
2736  , typename... CRAs // Compile time row arguments
2737  , typename ET > // Type of the element
2738 inline bool tryBitor( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t i, size_t j, const ET& value )
2739 {
2740  BLAZE_INTERNAL_ASSERT( i < r.rows(), "Invalid row access index" );
2741  BLAZE_INTERNAL_ASSERT( j < r.columns(), "Invalid column access index" );
2742 
2743  return tryBitor( r.operand(), r.idx(i), j, value );
2744 }
2746 //*************************************************************************************************
2747 
2748 
2749 //*************************************************************************************************
2767 template< typename MT // Type of the matrix
2768  , bool SO // Storage order
2769  , bool DF // Density flag
2770  , bool SF // Symmetry flag
2771  , typename... CRAs // Compile time row arguments
2772  , typename ET > // Type of the element
2774  tryBitor( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t row, size_t column, size_t m, size_t n, const ET& value )
2775 {
2776  BLAZE_INTERNAL_ASSERT( row <= (~r).rows(), "Invalid row access index" );
2777  BLAZE_INTERNAL_ASSERT( column <= (~r).columns(), "Invalid column access index" );
2778  BLAZE_INTERNAL_ASSERT( row + m <= (~r).rows(), "Invalid number of rows" );
2779  BLAZE_INTERNAL_ASSERT( column + n <= (~r).columns(), "Invalid number of columns" );
2780 
2781  const size_t iend( row + m );
2782 
2783  for( size_t i=row; i<iend; ++i ) {
2784  if( !tryBitor( r.operand(), r.idx(i), column, 1UL, n, value ) )
2785  return false;
2786  }
2787 
2788  return true;
2789 }
2791 //*************************************************************************************************
2792 
2793 
2794 //*************************************************************************************************
2810 template< typename MT // Type of the matrix
2811  , bool SO // Storage order
2812  , bool DF // Density flag
2813  , bool SF // Symmetry flag
2814  , typename... CRAs // Compile time row arguments
2815  , typename ET > // Type of the element
2816 inline bool tryBitxor( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t i, size_t j, const ET& value )
2817 {
2818  BLAZE_INTERNAL_ASSERT( i < r.rows(), "Invalid row access index" );
2819  BLAZE_INTERNAL_ASSERT( j < r.columns(), "Invalid column access index" );
2820 
2821  return tryBitxor( r.operand(), r.idx(i), j, value );
2822 }
2824 //*************************************************************************************************
2825 
2826 
2827 //*************************************************************************************************
2845 template< typename MT // Type of the matrix
2846  , bool SO // Storage order
2847  , bool DF // Density flag
2848  , bool SF // Symmetry flag
2849  , typename... CRAs // Compile time row arguments
2850  , typename ET > // Type of the element
2852  tryBitxor( const Rows<MT,SO,DF,SF,CRAs...>& r, size_t row, size_t column, size_t m, size_t n, const ET& value )
2853 {
2854  BLAZE_INTERNAL_ASSERT( row <= (~r).rows(), "Invalid row access index" );
2855  BLAZE_INTERNAL_ASSERT( column <= (~r).columns(), "Invalid column access index" );
2856  BLAZE_INTERNAL_ASSERT( row + m <= (~r).rows(), "Invalid number of rows" );
2857  BLAZE_INTERNAL_ASSERT( column + n <= (~r).columns(), "Invalid number of columns" );
2858 
2859  const size_t iend( row + m );
2860 
2861  for( size_t i=row; i<iend; ++i ) {
2862  if( !tryBitxor( r.operand(), r.idx(i), column, 1UL, n, value ) )
2863  return false;
2864  }
2865 
2866  return true;
2867 }
2869 //*************************************************************************************************
2870 
2871 
2872 //*************************************************************************************************
2888 template< typename MT // Type of the matrix
2889  , bool SO // Storage order
2890  , bool DF // Density flag
2891  , bool SF // Symmetry flag
2892  , typename... CRAs // Compile time row arguments
2893  , typename VT > // Type of the right-hand side vector
2894 inline bool tryAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
2895  const Vector<VT,false>& rhs, size_t row, size_t column )
2896 {
2897  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2898  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2899  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
2900 
2901  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
2902  if( !trySet( lhs.operand(), lhs.idx( row+i ), column, (~rhs)[i] ) )
2903  return false;
2904  }
2905 
2906  return true;
2907 }
2909 //*************************************************************************************************
2910 
2911 
2912 //*************************************************************************************************
2928 template< typename MT // Type of the matrix
2929  , bool SO // Storage order
2930  , bool DF // Density flag
2931  , bool SF // Symmetry flag
2932  , typename... CRAs // Compile time row arguments
2933  , typename VT > // Type of the right-hand side vector
2934 inline bool tryAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
2935  const Vector<VT,true>& rhs, size_t row, size_t column )
2936 {
2937  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2938  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2939  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
2940 
2941  return tryAssign( lhs.operand(), ~rhs, lhs.idx( row ), column );
2942 }
2944 //*************************************************************************************************
2945 
2946 
2947 //*************************************************************************************************
2964 template< typename MT // Type of the matrix
2965  , bool SO // Storage order
2966  , bool DF // Density flag
2967  , bool SF // Symmetry flag
2968  , typename... CRAs // Compile time row arguments
2969  , typename VT // Type of the right-hand side vector
2970  , bool TF > // Transpose flag of the right-hand side vector
2971 inline bool tryAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
2972  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
2973 {
2974  MAYBE_UNUSED( band );
2975 
2976  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2977  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2978  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
2979  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
2980 
2981  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
2982  if( !trySet( lhs.operand(), lhs.idx( row+i ), column+i, (~rhs)[i] ) )
2983  return false;
2984  }
2985 
2986  return true;
2987 }
2989 //*************************************************************************************************
2990 
2991 
2992 //*************************************************************************************************
3008 template< typename MT1 // Type of the matrix
3009  , bool SO1 // Storage order
3010  , bool DF // Density flag
3011  , bool SF // Symmetry flag
3012  , typename... CRAs // Compile time row arguments
3013  , typename MT2 // Type of the right-hand side matrix
3014  , bool SO2 > // Storage order of the right-hand side matrix
3015 inline bool tryAssign( const Rows<MT1,SO1,DF,SF,CRAs...>& lhs,
3016  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
3017 {
3018  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3019  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3020  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
3021  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
3022 
3023  for( size_t i=0UL; i<(~rhs).rows(); ++i ) {
3024  if( !tryAssign( lhs.operand(), blaze::row( ~rhs, i, unchecked ), lhs.idx( row+i ), column ) )
3025  return false;
3026  }
3027 
3028  return true;
3029 }
3031 //*************************************************************************************************
3032 
3033 
3034 //*************************************************************************************************
3051 template< typename MT // Type of the matrix
3052  , bool SO // Storage order
3053  , bool DF // Density flag
3054  , bool SF // Symmetry flag
3055  , typename... CRAs // Compile time row arguments
3056  , typename VT > // Type of the right-hand side vector
3057 inline bool tryAddAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3058  const Vector<VT,false>& rhs, size_t row, size_t column )
3059 {
3060  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3061  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3062  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3063 
3064  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3065  if( !tryAdd( lhs.operand(), lhs.idx( row+i ), column, (~rhs)[i] ) )
3066  return false;
3067  }
3068 
3069  return true;
3070 }
3072 //*************************************************************************************************
3073 
3074 
3075 //*************************************************************************************************
3091 template< typename MT // Type of the matrix
3092  , bool SO // Storage order
3093  , bool DF // Density flag
3094  , bool SF // Symmetry flag
3095  , typename... CRAs // Compile time row arguments
3096  , typename VT > // Type of the right-hand side vector
3097 inline bool tryAddAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3098  const Vector<VT,true>& rhs, size_t row, size_t column )
3099 {
3100  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3101  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3102  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3103 
3104  return tryAddAssign( lhs.operand(), ~rhs, lhs.idx( row ), column );
3105 }
3107 //*************************************************************************************************
3108 
3109 
3110 //*************************************************************************************************
3128 template< typename MT // Type of the matrix
3129  , bool SO // Storage order
3130  , bool DF // Density flag
3131  , bool SF // Symmetry flag
3132  , typename... CRAs // Compile time row arguments
3133  , typename VT // Type of the right-hand side vector
3134  , bool TF > // Transpose flag of the right-hand side vector
3135 inline bool tryAddAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3136  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
3137 {
3138  MAYBE_UNUSED( band );
3139 
3140  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3141  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3142  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3143  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3144 
3145  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3146  if( !tryAdd( lhs.operand(), lhs.idx( row+i ), column+i, (~rhs)[i] ) )
3147  return false;
3148  }
3149 
3150  return true;
3151 }
3153 //*************************************************************************************************
3154 
3155 
3156 //*************************************************************************************************
3172 template< typename MT1 // Type of the matrix
3173  , bool SO1 // Storage order
3174  , bool DF // Density flag
3175  , bool SF // Symmetry flag
3176  , typename... CRAs // Compile time row arguments
3177  , typename MT2 // Type of the right-hand side matrix
3178  , bool SO2 > // Storage order of the right-hand side matrix
3179 inline bool tryAddAssign( const Rows<MT1,SO1,DF,SF,CRAs...>& lhs,
3180  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
3181 {
3182  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3183  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3184  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
3185  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
3186 
3187  for( size_t i=0UL; i<(~rhs).rows(); ++i ) {
3188  if( !tryAddAssign( lhs.operand(), blaze::row( ~rhs, i, unchecked ), lhs.idx( row+i ), column ) )
3189  return false;
3190  }
3191 
3192  return true;
3193 }
3195 //*************************************************************************************************
3196 
3197 
3198 //*************************************************************************************************
3215 template< typename MT // Type of the matrix
3216  , bool SO // Storage order
3217  , bool DF // Density flag
3218  , bool SF // Symmetry flag
3219  , typename... CRAs // Compile time row arguments
3220  , typename VT > // Type of the right-hand side vector
3221 inline bool trySubAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3222  const Vector<VT,false>& rhs, size_t row, size_t column )
3223 {
3224  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3225  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3226  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3227 
3228  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3229  if( !trySub( lhs.operand(), lhs.idx( row+i ), column, (~rhs)[i] ) )
3230  return false;
3231  }
3232 
3233  return true;
3234 }
3236 //*************************************************************************************************
3237 
3238 
3239 //*************************************************************************************************
3256 template< typename MT // Type of the matrix
3257  , bool SO // Storage order
3258  , bool DF // Density flag
3259  , bool SF // Symmetry flag
3260  , typename... CRAs // Compile time row arguments
3261  , typename VT > // Type of the right-hand side vector
3262 inline bool trySubAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3263  const Vector<VT,true>& rhs, size_t row, size_t column )
3264 {
3265  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3266  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3267  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3268 
3269  return trySubAssign( lhs.operand(), ~rhs, lhs.idx( row ), column );
3270 }
3272 //*************************************************************************************************
3273 
3274 
3275 //*************************************************************************************************
3293 template< typename MT // Type of the matrix
3294  , bool SO // Storage order
3295  , bool DF // Density flag
3296  , bool SF // Symmetry flag
3297  , typename... CRAs // Compile time row arguments
3298  , typename VT // Type of the right-hand side vector
3299  , bool TF > // Transpose flag of the right-hand side vector
3300 inline bool trySubAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3301  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
3302 {
3303  MAYBE_UNUSED( band );
3304 
3305  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3306  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3307  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3308  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3309 
3310  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3311  if( !trySub( lhs.operand(), lhs.idx( row+i ), column+i, (~rhs)[i] ) )
3312  return false;
3313  }
3314 
3315  return true;
3316 }
3318 //*************************************************************************************************
3319 
3320 
3321 //*************************************************************************************************
3337 template< typename MT1 // Type of the matrix
3338  , bool SO1 // Storage order
3339  , bool DF // Density flag
3340  , bool SF // Symmetry flag
3341  , typename... CRAs // Compile time row arguments
3342  , typename MT2 // Type of the right-hand side matrix
3343  , bool SO2 > // Storage order of the right-hand side matrix
3344 inline bool trySubAssign( const Rows<MT1,SO1,DF,SF,CRAs...>& lhs,
3345  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
3346 {
3347  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3348  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3349  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
3350  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
3351 
3352  for( size_t i=0UL; i<(~rhs).rows(); ++i ) {
3353  if( !trySubAssign( lhs.operand(), blaze::row( ~rhs, i, unchecked ), lhs.idx( row+i ), column ) )
3354  return false;
3355  }
3356 
3357  return true;
3358 }
3360 //*************************************************************************************************
3361 
3362 
3363 //*************************************************************************************************
3380 template< typename MT // Type of the matrix
3381  , bool SO // Storage order
3382  , bool DF // Density flag
3383  , bool SF // Symmetry flag
3384  , typename... CRAs // Compile time row arguments
3385  , typename VT > // Type of the right-hand side vector
3386 inline bool tryMultAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3387  const Vector<VT,false>& rhs, size_t row, size_t column )
3388 {
3389  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3390  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3391  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3392 
3393  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3394  if( !tryMult( lhs.operand(), lhs.idx( row+i ), column, (~rhs)[i] ) )
3395  return false;
3396  }
3397 
3398  return true;
3399 }
3401 //*************************************************************************************************
3402 
3403 
3404 //*************************************************************************************************
3421 template< typename MT // Type of the matrix
3422  , bool SO // Storage order
3423  , bool DF // Density flag
3424  , bool SF // Symmetry flag
3425  , typename... CRAs // Compile time row arguments
3426  , typename VT > // Type of the right-hand side vector
3427 inline bool tryMultAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3428  const Vector<VT,true>& rhs, size_t row, size_t column )
3429 {
3430  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3431  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3432  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3433 
3434  return tryMultAssign( lhs.operand(), ~rhs, lhs.idx( row ), column );
3435 }
3437 //*************************************************************************************************
3438 
3439 
3440 //*************************************************************************************************
3458 template< typename MT // Type of the matrix
3459  , bool SO // Storage order
3460  , bool DF // Density flag
3461  , bool SF // Symmetry flag
3462  , typename... CRAs // Compile time row arguments
3463  , typename VT // Type of the right-hand side vector
3464  , bool TF > // Transpose flag of the right-hand side vector
3465 inline bool tryMultAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3466  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
3467 {
3468  MAYBE_UNUSED( band );
3469 
3470  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3471  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3472  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3473  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3474 
3475  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3476  if( !tryMult( lhs.operand(), lhs.idx( row+i ), column+i, (~rhs)[i] ) )
3477  return false;
3478  }
3479 
3480  return true;
3481 }
3483 //*************************************************************************************************
3484 
3485 
3486 //*************************************************************************************************
3503 template< typename MT1 // Type of the matrix
3504  , bool SO1 // Storage order
3505  , bool DF // Density flag
3506  , bool SF // Symmetry flag
3507  , typename... CRAs // Compile time row arguments
3508  , typename MT2 // Type of the right-hand side matrix
3509  , bool SO2 > // Storage order of the right-hand side matrix
3510 inline bool trySchurAssign( const Rows<MT1,SO1,DF,SF,CRAs...>& lhs,
3511  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
3512 {
3513  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3514  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3515  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
3516  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
3517 
3518  for( size_t i=0UL; i<(~rhs).rows(); ++i ) {
3519  if( !tryMultAssign( lhs.operand(), blaze::row( ~rhs, i, unchecked ), lhs.idx( row+i ), column ) )
3520  return false;
3521  }
3522 
3523  return true;
3524 }
3526 //*************************************************************************************************
3527 
3528 
3529 //*************************************************************************************************
3546 template< typename MT // Type of the matrix
3547  , bool SO // Storage order
3548  , bool DF // Density flag
3549  , bool SF // Symmetry flag
3550  , typename... CRAs // Compile time row arguments
3551  , typename VT > // Type of the right-hand side vector
3552 inline bool tryDivAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3553  const Vector<VT,false>& rhs, size_t row, size_t column )
3554 {
3555  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3556  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3557  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3558 
3559  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3560  if( !tryDiv( lhs.operand(), lhs.idx( row+i ), column, (~rhs)[i] ) )
3561  return false;
3562  }
3563 
3564  return true;
3565 }
3567 //*************************************************************************************************
3568 
3569 
3570 //*************************************************************************************************
3586 template< typename MT // Type of the matrix
3587  , bool SO // Storage order
3588  , bool DF // Density flag
3589  , bool SF // Symmetry flag
3590  , typename... CRAs // Compile time row arguments
3591  , typename VT > // Type of the right-hand side vector
3592 inline bool tryDivAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3593  const Vector<VT,true>& rhs, size_t row, size_t column )
3594 {
3595  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3596  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3597  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3598 
3599  return tryDivAssign( lhs.operand(), ~rhs, lhs.idx( row ), column );
3600 }
3602 //*************************************************************************************************
3603 
3604 
3605 //*************************************************************************************************
3623 template< typename MT // Type of the matrix
3624  , bool SO // Storage order
3625  , bool DF // Density flag
3626  , bool SF // Symmetry flag
3627  , typename... CRAs // Compile time row arguments
3628  , typename VT // Type of the right-hand side vector
3629  , bool TF > // Transpose flag of the right-hand side vector
3630 inline bool tryDivAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3631  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
3632 {
3633  MAYBE_UNUSED( band );
3634 
3635  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3636  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3637  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3638  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3639 
3640  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3641  if( !tryDiv( lhs.operand(), lhs.idx( row+i ), column+i, (~rhs)[i] ) )
3642  return false;
3643  }
3644 
3645  return true;
3646 }
3648 //*************************************************************************************************
3649 
3650 
3651 //*************************************************************************************************
3668 template< typename MT // Type of the matrix
3669  , bool SO // Storage order
3670  , bool DF // Density flag
3671  , bool SF // Symmetry flag
3672  , typename... CRAs // Compile time row arguments
3673  , typename VT > // Type of the right-hand side vector
3674 inline bool tryShiftAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3675  const Vector<VT,false>& rhs, size_t row, size_t column )
3676 {
3677  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3678  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3679  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3680 
3681  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3682  if( !tryShift( lhs.operand(), lhs.idx( row+i ), column, (~rhs)[i] ) )
3683  return false;
3684  }
3685 
3686  return true;
3687 }
3689 //*************************************************************************************************
3690 
3691 
3692 //*************************************************************************************************
3708 template< typename MT // Type of the matrix
3709  , bool SO // Storage order
3710  , bool DF // Density flag
3711  , bool SF // Symmetry flag
3712  , typename... CRAs // Compile time row arguments
3713  , typename VT > // Type of the right-hand side vector
3714 inline bool tryShiftAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3715  const Vector<VT,true>& rhs, size_t row, size_t column )
3716 {
3717  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3718  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3719  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3720 
3721  return tryShiftAssign( lhs.operand(), ~rhs, lhs.idx( row ), column );
3722 }
3724 //*************************************************************************************************
3725 
3726 
3727 //*************************************************************************************************
3745 template< typename MT // Type of the matrix
3746  , bool SO // Storage order
3747  , bool DF // Density flag
3748  , bool SF // Symmetry flag
3749  , typename... CRAs // Compile time row arguments
3750  , typename VT // Type of the right-hand side vector
3751  , bool TF > // Transpose flag of the right-hand side vector
3752 inline bool tryShiftAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3753  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
3754 {
3755  MAYBE_UNUSED( band );
3756 
3757  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3758  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3759  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3760  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3761 
3762  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3763  if( !tryShift( lhs.operand(), lhs.idx( row+i ), column+i, (~rhs)[i] ) )
3764  return false;
3765  }
3766 
3767  return true;
3768 }
3770 //*************************************************************************************************
3771 
3772 
3773 //*************************************************************************************************
3789 template< typename MT1 // Type of the matrix
3790  , bool SO1 // Storage order
3791  , bool DF // Density flag
3792  , bool SF // Symmetry flag
3793  , typename... CRAs // Compile time row arguments
3794  , typename MT2 // Type of the right-hand side matrix
3795  , bool SO2 > // Storage order of the right-hand side matrix
3796 inline bool tryShiftAssign( const Rows<MT1,SO1,DF,SF,CRAs...>& lhs,
3797  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
3798 {
3799  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3800  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3801  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
3802  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
3803 
3804  for( size_t i=0UL; i<(~rhs).rows(); ++i ) {
3805  if( !tryShiftAssign( lhs.operand(), blaze::row( ~rhs, i, unchecked ), lhs.idx( row+i ), column ) )
3806  return false;
3807  }
3808 
3809  return true;
3810 }
3812 //*************************************************************************************************
3813 
3814 
3815 //*************************************************************************************************
3832 template< typename MT // Type of the matrix
3833  , bool SO // Storage order
3834  , bool DF // Density flag
3835  , bool SF // Symmetry flag
3836  , typename... CRAs // Compile time row arguments
3837  , typename VT > // Type of the right-hand side vector
3838 inline bool tryBitandAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3839  const Vector<VT,false>& rhs, size_t row, size_t column )
3840 {
3841  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3842  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3843  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3844 
3845  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3846  if( !tryBitand( lhs.operand(), lhs.idx( row+i ), column, (~rhs)[i] ) )
3847  return false;
3848  }
3849 
3850  return true;
3851 }
3853 //*************************************************************************************************
3854 
3855 
3856 //*************************************************************************************************
3873 template< typename MT // Type of the matrix
3874  , bool SO // Storage order
3875  , bool DF // Density flag
3876  , bool SF // Symmetry flag
3877  , typename... CRAs // Compile time row arguments
3878  , typename VT > // Type of the right-hand side vector
3879 inline bool tryBitandAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3880  const Vector<VT,true>& rhs, size_t row, size_t column )
3881 {
3882  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3883  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3884  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3885 
3886  return tryBitandAssign( lhs.operand(), ~rhs, lhs.idx( row ), column );
3887 }
3889 //*************************************************************************************************
3890 
3891 
3892 //*************************************************************************************************
3910 template< typename MT // Type of the matrix
3911  , bool SO // Storage order
3912  , bool DF // Density flag
3913  , bool SF // Symmetry flag
3914  , typename... CRAs // Compile time row arguments
3915  , typename VT // Type of the right-hand side vector
3916  , bool TF > // Transpose flag of the right-hand side vector
3917 inline bool tryBitandAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
3918  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
3919 {
3920  MAYBE_UNUSED( band );
3921 
3922  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3923  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3924  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3925  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3926 
3927  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3928  if( !tryBitand( lhs.operand(), lhs.idx( row+i ), column+i, (~rhs)[i] ) )
3929  return false;
3930  }
3931 
3932  return true;
3933 }
3935 //*************************************************************************************************
3936 
3937 
3938 //*************************************************************************************************
3954 template< typename MT1 // Type of the matrix
3955  , bool SO1 // Storage order
3956  , bool DF // Density flag
3957  , bool SF // Symmetry flag
3958  , typename... CRAs // Compile time row arguments
3959  , typename MT2 // Type of the right-hand side matrix
3960  , bool SO2 > // Storage order of the right-hand side matrix
3961 inline bool tryBitandAssign( const Rows<MT1,SO1,DF,SF,CRAs...>& lhs,
3962  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
3963 {
3964  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3965  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3966  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
3967  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
3968 
3969  for( size_t i=0UL; i<(~rhs).rows(); ++i ) {
3970  if( !tryBitandAssign( lhs.operand(), blaze::row( ~rhs, i, unchecked ), lhs.idx( row+i ), column ) )
3971  return false;
3972  }
3973 
3974  return true;
3975 }
3977 //*************************************************************************************************
3978 
3979 
3980 //*************************************************************************************************
3997 template< typename MT // Type of the matrix
3998  , bool SO // Storage order
3999  , bool DF // Density flag
4000  , bool SF // Symmetry flag
4001  , typename... CRAs // Compile time row arguments
4002  , typename VT > // Type of the right-hand side vector
4003 inline bool tryBitorAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
4004  const Vector<VT,false>& rhs, size_t row, size_t column )
4005 {
4006  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4007  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4008  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
4009 
4010  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
4011  if( !tryBitor( lhs.operand(), lhs.idx( row+i ), column, (~rhs)[i] ) )
4012  return false;
4013  }
4014 
4015  return true;
4016 }
4018 //*************************************************************************************************
4019 
4020 
4021 //*************************************************************************************************
4038 template< typename MT // Type of the matrix
4039  , bool SO // Storage order
4040  , bool DF // Density flag
4041  , bool SF // Symmetry flag
4042  , typename... CRAs // Compile time row arguments
4043  , typename VT > // Type of the right-hand side vector
4044 inline bool tryBitorAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
4045  const Vector<VT,true>& rhs, size_t row, size_t column )
4046 {
4047  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4048  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4049  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
4050 
4051  return tryBitorAssign( lhs.operand(), ~rhs, lhs.idx( row ), column );
4052 }
4054 //*************************************************************************************************
4055 
4056 
4057 //*************************************************************************************************
4075 template< typename MT // Type of the matrix
4076  , bool SO // Storage order
4077  , bool DF // Density flag
4078  , bool SF // Symmetry flag
4079  , typename... CRAs // Compile time row arguments
4080  , typename VT // Type of the right-hand side vector
4081  , bool TF > // Transpose flag of the right-hand side vector
4082 inline bool tryBitorAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
4083  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
4084 {
4085  MAYBE_UNUSED( band );
4086 
4087  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4088  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4089  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
4090  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
4091 
4092  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
4093  if( !tryBitor( lhs.operand(), lhs.idx( row+i ), column+i, (~rhs)[i] ) )
4094  return false;
4095  }
4096 
4097  return true;
4098 }
4100 //*************************************************************************************************
4101 
4102 
4103 //*************************************************************************************************
4119 template< typename MT1 // Type of the matrix
4120  , bool SO1 // Storage order
4121  , bool DF // Density flag
4122  , bool SF // Symmetry flag
4123  , typename... CRAs // Compile time row arguments
4124  , typename MT2 // Type of the right-hand side matrix
4125  , bool SO2 > // Storage order of the right-hand side matrix
4126 inline bool tryBitorAssign( const Rows<MT1,SO1,DF,SF,CRAs...>& lhs,
4127  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
4128 {
4129  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4130  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4131  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
4132  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
4133 
4134  for( size_t i=0UL; i<(~rhs).rows(); ++i ) {
4135  if( !tryBitorAssign( lhs.operand(), blaze::row( ~rhs, i, unchecked ), lhs.idx( row+i ), column ) )
4136  return false;
4137  }
4138 
4139  return true;
4140 }
4142 //*************************************************************************************************
4143 
4144 
4145 //*************************************************************************************************
4162 template< typename MT // Type of the matrix
4163  , bool SO // Storage order
4164  , bool DF // Density flag
4165  , bool SF // Symmetry flag
4166  , typename... CRAs // Compile time row arguments
4167  , typename VT > // Type of the right-hand side vector
4168 inline bool tryBitxorAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
4169  const Vector<VT,false>& rhs, size_t row, size_t column )
4170 {
4171  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4172  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4173  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
4174 
4175  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
4176  if( !tryBitxor( lhs.operand(), lhs.idx( row+i ), column, (~rhs)[i] ) )
4177  return false;
4178  }
4179 
4180  return true;
4181 }
4183 //*************************************************************************************************
4184 
4185 
4186 //*************************************************************************************************
4203 template< typename MT // Type of the matrix
4204  , bool SO // Storage order
4205  , bool DF // Density flag
4206  , bool SF // Symmetry flag
4207  , typename... CRAs // Compile time row arguments
4208  , typename VT > // Type of the right-hand side vector
4209 inline bool tryBitxorAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
4210  const Vector<VT,true>& rhs, size_t row, size_t column )
4211 {
4212  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4213  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4214  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
4215 
4216  return tryBitxorAssign( lhs.operand(), ~rhs, lhs.idx( row ), column );
4217 }
4219 //*************************************************************************************************
4220 
4221 
4222 //*************************************************************************************************
4240 template< typename MT // Type of the matrix
4241  , bool SO // Storage order
4242  , bool DF // Density flag
4243  , bool SF // Symmetry flag
4244  , typename... CRAs // Compile time row arguments
4245  , typename VT // Type of the right-hand side vector
4246  , bool TF > // Transpose flag of the right-hand side vector
4247 inline bool tryBitxorAssign( const Rows<MT,SO,DF,SF,CRAs...>& lhs,
4248  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
4249 {
4250  MAYBE_UNUSED( band );
4251 
4252  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4253  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4254  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
4255  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
4256 
4257  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
4258  if( !tryBitxor( lhs.operand(), lhs.idx( row+i ), column+i, (~rhs)[i] ) )
4259  return false;
4260  }
4261 
4262  return true;
4263 }
4265 //*************************************************************************************************
4266 
4267 
4268 //*************************************************************************************************
4284 template< typename MT1 // Type of the matrix
4285  , bool SO1 // Storage order
4286  , bool DF // Density flag
4287  , bool SF // Symmetry flag
4288  , typename... CRAs // Compile time row arguments
4289  , typename MT2 // Type of the right-hand side matrix
4290  , bool SO2 > // Storage order of the right-hand side matrix
4291 inline bool tryBitxorAssign( const Rows<MT1,SO1,DF,SF,CRAs...>& lhs,
4292  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
4293 {
4294  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4295  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4296  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
4297  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
4298 
4299  for( size_t i=0UL; i<(~rhs).rows(); ++i ) {
4300  if( !tryBitxorAssign( lhs.operand(), blaze::row( ~rhs, i, unchecked ), lhs.idx( row+i ), column ) )
4301  return false;
4302  }
4303 
4304  return true;
4305 }
4307 //*************************************************************************************************
4308 
4309 
4310 //*************************************************************************************************
4325 template< typename MT // Type of the matrix
4326  , bool SO // Storage order
4327  , bool DF // Density flag
4328  , bool SF // Symmetry flag
4329  , typename... CRAs > // Compile time row arguments
4330 inline decltype(auto) derestrict( Rows<MT,SO,DF,SF,CRAs...>& r )
4331 {
4332  return rows( derestrict( r.operand() ), r.idces(), unchecked );
4333 }
4335 //*************************************************************************************************
4336 
4337 
4338 //*************************************************************************************************
4353 template< typename MT // Type of the matrix
4354  , bool SO // Storage order
4355  , bool DF // Density flag
4356  , bool SF // Symmetry flag
4357  , typename... CRAs > // Compile time row arguments
4358 inline decltype(auto) derestrict( Rows<MT,SO,DF,SF,CRAs...>&& r )
4359 {
4360  return rows( derestrict( r.operand() ), r.idces(), unchecked );
4361 }
4363 //*************************************************************************************************
4364 
4365 
4366 
4367 
4368 //=================================================================================================
4369 //
4370 // SIZE SPECIALIZATIONS
4371 //
4372 //=================================================================================================
4373 
4374 //*************************************************************************************************
4376 template< typename MT, bool SO, bool DF, bool SF, size_t I, size_t... Is, typename... CRAs >
4377 struct Size< Rows<MT,SO,DF,SF,index_sequence<I,Is...>,CRAs...>, 0UL >
4378  : public Ptrdiff_t<1UL+sizeof...(Is)>
4379 {};
4380 
4381 template< typename MT, bool SO, bool DF, bool SF, typename... CRAs >
4382 struct Size< Rows<MT,SO,DF,SF,CRAs...>, 1UL >
4383  : public Size<MT,1UL>
4384 {};
4386 //*************************************************************************************************
4387 
4388 
4389 
4390 
4391 //=================================================================================================
4392 //
4393 // MAXSIZE SPECIALIZATIONS
4394 //
4395 //=================================================================================================
4396 
4397 //*************************************************************************************************
4399 template< typename MT, bool SO, bool DF, bool SF, size_t I, size_t... Is, typename... CRAs >
4400 struct MaxSize< Rows<MT,SO,DF,SF,index_sequence<I,Is...>,CRAs...>, 0UL >
4401  : public Ptrdiff_t<1UL+sizeof...(Is)>
4402 {};
4403 
4404 template< typename MT, bool SO, bool DF, bool SF, typename... CRAs >
4405 struct MaxSize< Rows<MT,SO,DF,SF,CRAs...>, 1UL >
4406  : public MaxSize<MT,1UL>
4407 {};
4409 //*************************************************************************************************
4410 
4411 
4412 
4413 
4414 //=================================================================================================
4415 //
4416 // ISRESTRICTED SPECIALIZATIONS
4417 //
4418 //=================================================================================================
4419 
4420 //*************************************************************************************************
4422 template< typename MT, bool SO, bool DF, bool SF, typename... CRAs >
4423 struct IsRestricted< Rows<MT,SO,DF,SF,CRAs...> >
4424  : public IsRestricted<MT>
4425 {};
4427 //*************************************************************************************************
4428 
4429 
4430 
4431 
4432 //=================================================================================================
4433 //
4434 // HASCONSTDATAACCESS SPECIALIZATIONS
4435 //
4436 //=================================================================================================
4437 
4438 //*************************************************************************************************
4440 template< typename MT, bool SO, bool SF, typename... CRAs >
4441 struct HasConstDataAccess< Rows<MT,SO,true,SF,CRAs...> >
4442  : public HasConstDataAccess<MT>
4443 {};
4445 //*************************************************************************************************
4446 
4447 
4448 
4449 
4450 //=================================================================================================
4451 //
4452 // HASMUTABLEDATAACCESS SPECIALIZATIONS
4453 //
4454 //=================================================================================================
4455 
4456 //*************************************************************************************************
4458 template< typename MT, bool SO, bool SF, typename... CRAs >
4459 struct HasMutableDataAccess< Rows<MT,SO,true,SF,CRAs...> >
4460  : public HasMutableDataAccess<MT>
4461 {};
4463 //*************************************************************************************************
4464 
4465 
4466 
4467 
4468 //=================================================================================================
4469 //
4470 // ISALIGNED SPECIALIZATIONS
4471 //
4472 //=================================================================================================
4473 
4474 //*************************************************************************************************
4476 template< typename MT, bool SO, bool SF, typename... CRAs >
4477 struct IsAligned< Rows<MT,SO,true,SF,CRAs...> >
4478  : public IsAligned<MT>
4479 {};
4481 //*************************************************************************************************
4482 
4483 } // namespace blaze
4484 
4485 #endif
AlignmentFlag
Alignment flag for (un-)aligned vectors and matrices.Via these flags it is possible to specify subvec...
Definition: AlignmentFlag.h:62
Rows specialization for sparse matrices.
#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
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the implementation of the RowData class template.
Header file for the alignment flag values.
#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.
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.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
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.
Header file for the MAYBE_UNUSED function template.
Header file for the MatMatMultExpr base class.
Header file for the extended initializer_list functionality.
Index sequence type of the Blaze library.
Header file for the MaxSize type trait.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
Header file for the MatMatKronExpr base class.
Header file for the matrix storage order types.
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
Header file for the MatMapExpr base class.
Header file for the DisableIf class template.
Header file for the SmallArray implementation.
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
Header file for the IsRows type trait.
Implementation of a dynamic array with small array optimization.The SmallArray class template is a hy...
Definition: SmallArray.h:81
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
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the IsAligned type trait.
decltype(auto) eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:786
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:139
Header file for the exception macros of the math module.
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.
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
Header file for the HasConstDataAccess type trait.
Header file for the DeclExpr base class.
Header file for the Matrix base class.
Header file for the MatScalarMultExpr base class.
Header file for run time assertion macros.
Header file for the Unique class template.
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
Header file for the IsPointer type trait.
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
Header file for the isDefault shim.
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
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.
#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.
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.
constexpr size_t rowwise
Reduction flag for row-wise reduction operations.
Definition: ReductionFlag.h:70
Header file for the IsRowMajorMatrix type trait.
Header file for the MatMatMapExpr base class.
Initializer list type of the Blaze library.
Header file for all forward declarations for views.
Header file for the IntegralConstant class template.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
Rows specialization for dense matrices.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
Header file for the MatScalarDivExpr base class.
Header file for the MatVecMultExpr base class.
Header file for the implementation of the Rows base template.
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