Blaze  3.6
Columns.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_COLUMNS_H_
36 #define _BLAZE_MATH_VIEWS_COLUMNS_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/EnableIf.h>
92 #include <blaze/util/DisableIf.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 column index
147  , size_t... Is // Remaining column indices
148  , typename MT // Type of the matrix
149  , bool SO // Storage order
150  , typename... RCAs > // Optional arguments
151 inline decltype(auto) columns( Matrix<MT,SO>& matrix, RCAs... args )
152 {
154 
155  using ReturnType = Columns_< MT, index_sequence<I,Is...> >;
156  return ReturnType( ~matrix, args... );
157 }
158 //*************************************************************************************************
159 
160 
161 //*************************************************************************************************
196 template< size_t I // First column index
197  , size_t... Is // Remaining column indices
198  , typename MT // Type of the matrix
199  , bool SO // Storage order
200  , typename... RCAs > // Optional arguments
201 inline decltype(auto) columns( const Matrix<MT,SO>& matrix, RCAs... args )
202 {
204 
205  using ReturnType = const Columns_< const MT, index_sequence<I,Is...> >;
206  return ReturnType( ~matrix, args... );
207 }
208 //*************************************************************************************************
209 
210 
211 //*************************************************************************************************
225 template< size_t I // First column index
226  , size_t... Is // Remaining column indices
227  , typename MT // Type of the matrix
228  , bool SO // Storage order
229  , typename... RCAs > // Optional arguments
230 inline decltype(auto) columns( Matrix<MT,SO>&& matrix, RCAs... args )
231 {
233 
234  using ReturnType = Columns_< 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 column indices
282  , typename... RCAs > // Optional arguments
283 inline decltype(auto) columns( Matrix<MT,SO>& matrix, T* indices, size_t n, RCAs... args )
284 {
286 
287  using ReturnType = Columns_<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 column indices
336  , typename... RCAs > // Optional arguments
337 inline decltype(auto) columns( const Matrix<MT,SO>& matrix, T* indices, size_t n, RCAs... args )
338 {
340 
341  using ReturnType = const Columns_<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 column indices
365  , typename... RCAs > // Optional arguments
366 inline decltype(auto) columns( Matrix<MT,SO>&& matrix, T* indices, size_t n, RCAs... args )
367 {
369 
370  using ReturnType = Columns_<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... RCAs > // Optional arguments
417 inline decltype(auto) columns( Matrix<MT,SO>& matrix, P p, size_t n, RCAs... args )
418 {
420 
421  using ReturnType = Columns_<MT,P>;
422  return ReturnType( ~matrix, p, n, args... );
423 }
424 //*************************************************************************************************
425 
426 
427 //*************************************************************************************************
466 template< typename MT // Type of the matrix
467  , bool SO // Storage order
468  , typename P // Type of the index producer
469  , typename... RCAs > // Optional arguments
470 inline decltype(auto) columns( const Matrix<MT,SO>& matrix, P p, size_t n, RCAs... args )
471 {
473 
474  using ReturnType = const Columns_<const MT,P>;
475  return ReturnType( ~matrix, p, n, args... );
476 }
477 //*************************************************************************************************
478 
479 
480 //*************************************************************************************************
495 template< typename MT // Type of the matrix
496  , bool SO // Storage order
497  , typename P // Type of the index producer
498  , typename... RCAs > // Optional arguments
499 inline decltype(auto) columns( Matrix<MT,SO>&& matrix, P p, size_t n, RCAs... args )
500 {
502 
503  using ReturnType = Columns_<MT,P>;
504  return ReturnType( ~matrix, p, n, args... );
505 }
506 //*************************************************************************************************
507 
508 
509 //*************************************************************************************************
546 template< typename MT // Type of the matrix
547  , size_t... Is // Column indices
548  , typename... RCAs > // Optional arguments
549 inline decltype(auto) columns( MT&& matrix, index_sequence<Is...> indices, RCAs... args )
550 {
552 
553  MAYBE_UNUSED( indices );
554 
555  return columns<Is...>( std::forward<MT>( matrix ), args... );
556 }
557 //*************************************************************************************************
558 
559 
560 //*************************************************************************************************
596 template< typename MT // Type of the matrix
597  , typename T // Type of the column indices
598  , typename... RCAs > // Optional arguments
599 inline decltype(auto) columns( MT&& matrix, initializer_list<T> indices, RCAs... args )
600 {
602 
603  return columns( std::forward<MT>( matrix ), indices.begin(), indices.size(), args... );
604 }
605 //*************************************************************************************************
606 
607 
608 //*************************************************************************************************
646 template< typename MT // Type of the matrix
647  , typename T // Type of the column indices
648  , size_t N // Number of indices
649  , typename... RCAs > // Optional arguments
650 inline decltype(auto) columns( MT&& matrix, const std::array<T,N>& indices, RCAs... args )
651 {
653 
654  return columns( std::forward<MT>( matrix ), indices.data(), N, args... );
655 }
656 //*************************************************************************************************
657 
658 
659 //*************************************************************************************************
697 template< typename MT // Type of the matrix
698  , typename T // Type of the column indices
699  , typename... RCAs > // Optional arguments
700 inline decltype(auto) columns( MT&& matrix, const std::vector<T>& indices, RCAs... args )
701 {
703 
704  return columns( std::forward<MT>( matrix ), indices.data(), indices.size(), args... );
705 }
706 //*************************************************************************************************
707 
708 
709 //*************************************************************************************************
748 template< typename MT // Type of the matrix
749  , typename T // Type of the column indices
750  , size_t N // Number of preallocated elements
751  , typename... RCAs > // Optional arguments
752 inline decltype(auto) columns( MT&& matrix, const SmallArray<T,N>& indices, RCAs... args )
753 {
755 
756  return columns( std::forward<MT>( matrix ), indices.data(), indices.size(), args... );
757 }
759 //*************************************************************************************************
760 
761 
762 //*************************************************************************************************
778 template< typename MT // Type of the matrix
779  , typename T1 // First type of the pair of arguments
780  , typename T2 // Second type of the pair of arguments
781  , typename... RRAs > // Optional arguments
782 inline decltype(auto) columns( MT&& matrix, const std::pair<T1,T2>& pair, RRAs... args )
783 {
785 
786  return columns( std::forward<MT>( matrix ), pair.first, pair.second, args... );
787 }
789 //*************************************************************************************************
790 
791 
792 
793 
794 //=================================================================================================
795 //
796 // GLOBAL RESTRUCTURING FUNCTIONS
797 //
798 //=================================================================================================
799 
800 //*************************************************************************************************
812 template< size_t... CCAs // Compile time column arguments
813  , typename MT // Matrix base type of the expression
814  , typename... RCAs // Runtime column arguments
815  , EnableIf_t< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) >* = nullptr >
816 inline decltype(auto) columns( const MatMatAddExpr<MT>& matrix, RCAs... args )
817 {
819 
820  return columns<CCAs...>( (~matrix).leftOperand(), args... ) +
821  columns<CCAs...>( (~matrix).rightOperand(), args... );
822 }
824 //*************************************************************************************************
825 
826 
827 //*************************************************************************************************
839 template< size_t... CCAs // Compile time column arguments
840  , typename MT // Matrix base type of the expression
841  , typename... RCAs // Runtime column arguments
842  , EnableIf_t< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) >* = nullptr >
843 inline decltype(auto) columns( const MatMatSubExpr<MT>& matrix, RCAs... args )
844 {
846 
847  return columns<CCAs...>( (~matrix).leftOperand(), args... ) -
848  columns<CCAs...>( (~matrix).rightOperand(), args... );
849 }
851 //*************************************************************************************************
852 
853 
854 //*************************************************************************************************
866 template< size_t... CCAs // Compile time column arguments
867  , typename MT // Matrix base type of the expression
868  , typename... RCAs // Runtime column arguments
869  , EnableIf_t< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) >* = nullptr >
870 inline decltype(auto) columns( const SchurExpr<MT>& matrix, RCAs... args )
871 {
873 
874  return columns<CCAs...>( (~matrix).leftOperand(), args... ) %
875  columns<CCAs...>( (~matrix).rightOperand(), args... );
876 }
878 //*************************************************************************************************
879 
880 
881 //*************************************************************************************************
893 template< size_t... CCAs // Compile time column arguments
894  , typename MT // Matrix base type of the expression
895  , typename... RCAs // Runtime column arguments
896  , EnableIf_t< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) >* = nullptr >
897 inline decltype(auto) columns( const MatMatMultExpr<MT>& matrix, RCAs... args )
898 {
900 
901  return (~matrix).leftOperand() * columns<CCAs...>( (~matrix).rightOperand(), args... );
902 }
904 //*************************************************************************************************
905 
906 
907 //*************************************************************************************************
919 template< size_t I // First column index
920  , size_t... Is // Remaining column indices
921  , typename MT // Matrix base type of the expression
922  , typename... RCAs > // Optional arguments
923 inline decltype(auto) columns( const MatMatKronExpr<MT>& matrix, RCAs... args )
924 {
926 
927  decltype(auto) lhs( (~matrix).leftOperand() );
928  decltype(auto) rhs( (~matrix).rightOperand() );
929 
930  const size_t M( rhs.rows() );
931  const size_t N( rhs.columns() );
932 
933  const auto lhsRows( [M]( size_t i ){ return i / M; } );
934  const auto rhsRows( [M]( size_t i ){ return i % M; } );
935 
936  const auto lhsColumns( [N]( size_t i ) {
937  static constexpr size_t indices[] = { I, Is... };
938  return indices[i] / N;
939  } );
940 
941  const auto rhsColumns( [N]( size_t i ) {
942  static constexpr size_t indices[] = { I, Is... };
943  return indices[i] % N;
944  } );
945 
946  return columns( rows( lhs, lhsRows, (~matrix).rows(), args... ), lhsColumns, sizeof...(Is)+1UL, args... ) %
947  columns( rows( rhs, rhsRows, (~matrix).rows(), args... ), rhsColumns, sizeof...(Is)+1UL, args... );
948 }
950 //*************************************************************************************************
951 
952 
953 //*************************************************************************************************
967 template< typename MT // Matrix base type of the expression
968  , typename T // Type of the column indices
969  , typename... RCAs > // Optional arguments
970 inline decltype(auto) columns( const MatMatKronExpr<MT>& matrix, T* indices, size_t n, RCAs... args )
971 {
973 
974  decltype(auto) lhs( (~matrix).leftOperand() );
975  decltype(auto) rhs( (~matrix).rightOperand() );
976 
977  const size_t M( rhs.rows() );
978  const size_t N( rhs.columns() );
979 
980  const auto lhsRows( [M]( size_t i ){ return i / M; } );
981  const auto rhsRows( [M]( size_t i ){ return i % M; } );
982 
983  SmallArray<size_t,128UL> lhsColumns;
984  lhsColumns.reserve( n );
985 
986  for( size_t i=0UL; i<n; ++i ) {
987  lhsColumns.pushBack( indices[i] / N );
988  }
989 
990  SmallArray<size_t,128UL> rhsColumns;
991  rhsColumns.reserve( n );
992 
993  for( size_t i=0UL; i<n; ++i ) {
994  rhsColumns.pushBack( indices[i] % N );
995  }
996 
997  return columns( rows( lhs, lhsRows, (~matrix).rows(), args... ), lhsColumns, n, args... ) %
998  columns( rows( rhs, rhsRows, (~matrix).rows(), args... ), rhsColumns, n, args... );
999 }
1001 //*************************************************************************************************
1002 
1003 
1004 //*************************************************************************************************
1018 template< typename MT // Matrix base type of the expression
1019  , typename P // Type of the index producer
1020  , typename... RCAs > // Optional arguments
1021 inline decltype(auto) columns( const MatMatKronExpr<MT>& matrix, P p, size_t n, RCAs... args )
1022 {
1024 
1025  decltype(auto) lhs( (~matrix).leftOperand() );
1026  decltype(auto) rhs( (~matrix).rightOperand() );
1027 
1028  const size_t M( rhs.rows() );
1029  const size_t N( rhs.columns() );
1030 
1031  const auto lhsRows( [M]( size_t i ){ return i / M; } );
1032  const auto rhsRows( [M]( size_t i ){ return i % M; } );
1033 
1034  const auto lhsColumns( [p,N]( size_t i ) { return p(i) / N; } );
1035  const auto rhsColumns( [p,N]( size_t i ) { return p(i) % N; } );
1036 
1037  return columns( rows( lhs, lhsRows, (~matrix).rows(), args... ), lhsColumns, n, args... ) %
1038  columns( rows( rhs, rhsRows, (~matrix).rows(), args... ), rhsColumns, n, args... );
1039 }
1041 //*************************************************************************************************
1042 
1043 
1044 //*************************************************************************************************
1056 template< size_t... CCAs // Compile time column arguments
1057  , typename MT // Matrix base type of the expression
1058  , typename... RCAs // Runtime column arguments
1059  , EnableIf_t< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) >* = nullptr >
1060 inline decltype(auto) columns( const VecTVecMultExpr<MT>& matrix, RCAs... args )
1061 {
1063 
1064  return (~matrix).leftOperand() * elements<CCAs...>( (~matrix).rightOperand(), args... );
1065 }
1067 //*************************************************************************************************
1068 
1069 
1070 //*************************************************************************************************
1082 template< size_t... CCAs // Compile time column arguments
1083  , typename MT // Matrix base type of the expression
1084  , typename... RCAs // Runtime column arguments
1085  , EnableIf_t< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) >* = nullptr >
1086 inline decltype(auto) columns( const MatScalarMultExpr<MT>& matrix, RCAs... args )
1087 {
1089 
1090  return columns<CCAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
1091 }
1093 //*************************************************************************************************
1094 
1095 
1096 //*************************************************************************************************
1108 template< size_t... CCAs // Compile time column arguments
1109  , typename MT // Matrix base type of the expression
1110  , typename... RCAs // Runtime column arguments
1111  , EnableIf_t< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) >* = nullptr >
1112 inline decltype(auto) columns( const MatScalarDivExpr<MT>& matrix, RCAs... args )
1113 {
1115 
1116  return columns<CCAs...>( (~matrix).leftOperand(), args... ) / (~matrix).rightOperand();
1117 }
1119 //*************************************************************************************************
1120 
1121 
1122 //*************************************************************************************************
1134 template< size_t... CCAs // Compile time column arguments
1135  , typename MT // Matrix base type of the expression
1136  , typename... RCAs // Runtime column arguments
1137  , EnableIf_t< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) >* = nullptr >
1138 inline decltype(auto) columns( const MatMapExpr<MT>& matrix, RCAs... args )
1139 {
1141 
1142  return map( columns<CCAs...>( (~matrix).operand(), args... ), (~matrix).operation() );
1143 }
1145 //*************************************************************************************************
1146 
1147 
1148 //*************************************************************************************************
1160 template< size_t... CCAs // Compile time column arguments
1161  , typename MT // Matrix base type of the expression
1162  , typename... RCAs // Runtime column arguments
1163  , EnableIf_t< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) >* = nullptr >
1164 inline decltype(auto) columns( const MatMatMapExpr<MT>& matrix, RCAs... args )
1165 {
1167 
1168  return map( columns<CCAs...>( (~matrix).leftOperand(), args... ),
1169  columns<CCAs...>( (~matrix).rightOperand(), args... ),
1170  (~matrix).operation() );
1171 }
1173 //*************************************************************************************************
1174 
1175 
1176 //*************************************************************************************************
1188 template< size_t... CCAs // Compile time column arguments
1189  , typename MT // Matrix base type of the expression
1190  , typename... RCAs // Runtime column arguments
1191  , EnableIf_t< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) >* = nullptr >
1192 inline decltype(auto) columns( const MatEvalExpr<MT>& matrix, RCAs... args )
1193 {
1195 
1196  return eval( columns<CCAs...>( (~matrix).operand(), args... ) );
1197 }
1199 //*************************************************************************************************
1200 
1201 
1202 //*************************************************************************************************
1214 template< size_t... CCAs // Compile time column arguments
1215  , typename MT // Matrix base type of the expression
1216  , typename... RCAs // Runtime column arguments
1217  , EnableIf_t< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) >* = nullptr >
1218 inline decltype(auto) columns( const MatSerialExpr<MT>& matrix, RCAs... args )
1219 {
1221 
1222  return serial( columns<CCAs...>( (~matrix).operand(), args... ) );
1223 }
1225 //*************************************************************************************************
1226 
1227 
1228 //*************************************************************************************************
1240 template< size_t... CCAs // Compile time column arguments
1241  , typename MT // Matrix base type of the expression
1242  , typename... RCAs // Runtime column arguments
1243  , EnableIf_t< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) >* = nullptr >
1244 inline decltype(auto) columns( const DeclExpr<MT>& matrix, RCAs... args )
1245 {
1247 
1248  return columns<CCAs...>( (~matrix).operand(), args... );
1249 }
1251 //*************************************************************************************************
1252 
1253 
1254 //*************************************************************************************************
1266 template< size_t... CCAs // Compile time column arguments
1267  , typename MT // Matrix base type of the expression
1268  , typename... RCAs // Runtime column arguments
1269  , EnableIf_t< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) >* = nullptr >
1270 inline decltype(auto) columns( const MatTransExpr<MT>& matrix, RCAs... args )
1271 {
1273 
1274  return trans( rows<CCAs...>( (~matrix).operand(), args... ) );
1275 }
1277 //*************************************************************************************************
1278 
1279 
1280 //*************************************************************************************************
1293 template< size_t... CCAs // Compile time column arguments
1294  , typename MT // Matrix base type of the expression
1295  , size_t... CEAs // Compile time expansion arguments
1296  , typename... RCAs // Runtime column arguments
1297  , EnableIf_t< ( sizeof...( CCAs ) > 0UL ) &&
1298  IsColumnMajorMatrix_v<MT> >* = nullptr >
1299 inline decltype(auto) columns( const VecExpandExpr<MT,CEAs...>& matrix, RCAs... args )
1300 {
1302 
1303  MAYBE_UNUSED( args... );
1304 
1305  return expand< sizeof...( CCAs ) >( (~matrix).operand() );
1306 }
1308 //*************************************************************************************************
1309 
1310 
1311 //*************************************************************************************************
1326 template< typename MT // Matrix base type of the expression
1327  , size_t... CEAs // Compile time expansion arguments
1328  , typename T // Type of the column indices or index producer
1329  , typename... RCAs // Runtime column arguments
1330  , EnableIf_t< IsColumnMajorMatrix_v<MT> >* = nullptr >
1331 inline decltype(auto) columns( const VecExpandExpr<MT,CEAs...>& matrix, T indices, size_t n, RCAs... args )
1332 {
1334 
1335  MAYBE_UNUSED( indices, args... );
1336 
1337  return expand( (~matrix).operand(), n );
1338 }
1340 //*************************************************************************************************
1341 
1342 
1343 //*************************************************************************************************
1355 template< size_t... CCAs // Compile time column arguments
1356  , typename MT // Matrix base type of the expression
1357  , size_t... CEAs // Compile time expansion arguments
1358  , typename... RCAs // Runtime column arguments
1359  , EnableIf_t< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) &&
1360  !IsColumnMajorMatrix_v<MT> >* = nullptr >
1361 inline decltype(auto) columns( const VecExpandExpr<MT,CEAs...>& matrix, RCAs... args )
1362 {
1364 
1365  return expand<CEAs...>( elements<CCAs...>( (~matrix).operand(), args... ), (~matrix).expansion() );
1366 }
1368 //*************************************************************************************************
1369 
1370 
1371 
1372 
1373 //=================================================================================================
1374 //
1375 // GLOBAL RESTRUCTURING FUNCTIONS (COLUMNS)
1376 //
1377 //=================================================================================================
1378 
1379 //*************************************************************************************************
1391 template< size_t I // First required column index
1392  , size_t... Is // Remaining required column indices
1393  , typename MT // Type of the matrix
1394  , typename... RCAs // Optional column arguments
1395  , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > &&
1396  RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
1397 inline decltype(auto) columns( MT&& c, RCAs... args )
1398 {
1400 
1401  return columns( c.operand(), subsequence<I,Is...>( RemoveReference_t<MT>::idces() ), args... );
1402 }
1404 //*************************************************************************************************
1405 
1406 
1407 //*************************************************************************************************
1420 template< size_t I // First required column index
1421  , size_t... Is // Remaining required column indices
1422  , typename MT // Type of the matrix
1423  , typename... RCAs // Optional column arguments
1424  , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > &&
1425  !RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
1426 inline decltype(auto) columns( MT&& c, RCAs... args )
1427 {
1429 
1430  constexpr bool isChecked( !Contains_v< TypeList<RCAs...>, Unchecked > );
1431 
1432  if( isChecked ) {
1433  static constexpr size_t indices[] = { I, Is... };
1434  for( size_t i=0UL; i<sizeof...(Is)+1UL; ++i ) {
1435  if( c.columns() <= indices[i] ) {
1436  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
1437  }
1438  }
1439  }
1440 
1441  return columns( c.operand(), { c.idx(I), c.idx(Is)... }, args... );
1442 }
1444 //*************************************************************************************************
1445 
1446 
1447 //*************************************************************************************************
1462 template< typename MT // Type of the matrix
1463  , typename T // Type of the column indices
1464  , typename... RCAs // Optional column arguments
1465  , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > >* = nullptr >
1466 inline decltype(auto) columns( MT&& c, T* indices, size_t n, RCAs... args )
1467 {
1469 
1470  constexpr bool isChecked( !Contains_v< TypeList<RCAs...>, Unchecked > );
1471 
1472  if( isChecked ) {
1473  for( size_t i=0UL; i<n; ++i ) {
1474  if( c.columns() <= size_t( indices[i] ) ) {
1475  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
1476  }
1477  }
1478  }
1479 
1480  SmallArray<size_t,128UL> newIndices;
1481  newIndices.reserve( n );
1482 
1483  for( size_t i=0UL; i<n; ++i ) {
1484  newIndices.pushBack( c.idx( indices[i] ) );
1485  }
1486 
1487  return columns( c.operand(), newIndices.data(), newIndices.size(), args... );
1488 }
1490 //*************************************************************************************************
1491 
1492 
1493 //*************************************************************************************************
1508 template< typename MT // Type of the matrix
1509  , typename P // Type of the index producer
1510  , typename... RCAs // Optional column arguments
1511  , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > && !IsPointer_v<P> >* = nullptr >
1512 inline decltype(auto) columns( MT&& c, P p, size_t n, RCAs... args )
1513 {
1515 
1516  constexpr bool isChecked( !Contains_v< TypeList<RCAs...>, Unchecked > );
1517 
1518  if( isChecked ) {
1519  for( size_t i=0UL; i<n; ++i ) {
1520  if( c.columns() <= size_t( p(i) ) ) {
1521  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
1522  }
1523  }
1524  }
1525 
1526  SmallArray<size_t,128UL> newIndices;
1527  newIndices.reserve( n );
1528 
1529  for( size_t i=0UL; i<n; ++i ) {
1530  newIndices.pushBack( c.idx( p(i) ) );
1531  }
1532 
1533  return columns( c.operand(), newIndices.data(), newIndices.size(), args... );
1534 }
1536 //*************************************************************************************************
1537 
1538 
1539 
1540 
1541 //=================================================================================================
1542 //
1543 // GLOBAL RESTRUCTURING FUNCTIONS (ELEMENTS)
1544 //
1545 //=================================================================================================
1546 
1547 //*************************************************************************************************
1559 template< size_t... CEAs // Compile time element arguments
1560  , typename VT // Vector base type of the expression
1561  , typename... REAs > // Runtime element arguments
1562 inline decltype(auto) elements( const TVecMatMultExpr<VT>& vector, REAs... args )
1563 {
1565 
1566  return (~vector).leftOperand() * columns<CEAs...>( (~vector).rightOperand(), args... );
1567 }
1569 //*************************************************************************************************
1570 
1571 
1572 //*************************************************************************************************
1585 template< size_t... CEAs // Compile time element arguments
1586  , typename VT // Vector base type of the expression
1587  , typename... REAs > // Runtime element arguments
1588 inline decltype(auto) elements( const MatReduceExpr<VT,columnwise>& vector, REAs... args )
1589 {
1591 
1592  return reduce<columnwise>( columns<CEAs...>( (~vector).operand(), args... ), (~vector).operation() );
1593 }
1595 //*************************************************************************************************
1596 
1597 
1598 
1599 
1600 //=================================================================================================
1601 //
1602 // GLOBAL RESTRUCTURING FUNCTIONS (ROW)
1603 //
1604 //=================================================================================================
1605 
1606 //*************************************************************************************************
1617 template< size_t... CRAs // Compile time row arguments
1618  , typename MT // Type of the matrix
1619  , typename... RRAs // Runtime row arguments
1620  , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > >* = nullptr >
1621 inline decltype(auto) row( MT&& columns, RRAs... args )
1622 {
1624 
1625  return elements( row<CRAs...>( columns.operand(), args... ), columns.idces() );
1626 }
1628 //*************************************************************************************************
1629 
1630 
1631 
1632 
1633 //=================================================================================================
1634 //
1635 // GLOBAL RESTRUCTURING FUNCTIONS (COLUMN)
1636 //
1637 //=================================================================================================
1638 
1639 //*************************************************************************************************
1651 template< size_t I // Column index
1652  , typename MT // Type of the matrix
1653  , typename... RCAs // Optional column arguments
1654  , EnableIf_t< IsColumns_v< RemoveReference_t<MT> > &&
1655  RemoveReference_t<MT>::compileTimeArgs >* = nullptr >
1656 inline decltype(auto) column( MT&& columns, RCAs... args )
1657 {
1659 
1660  return column< RemoveReference_t<MT>::idx(I) >( columns.operand(), args... );
1661 }
1663 //*************************************************************************************************
1664 
1665 
1666 //*************************************************************************************************
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< IsColumns_v< RemoveReference_t<MT> > &&
1683  ( sizeof...( CCAs ) == 0UL || !RemoveReference_t<MT>::compileTimeArgs ) >* = nullptr >
1684 inline decltype(auto) column( MT&& columns, RCAs... args )
1685 {
1687 
1688  const ColumnData<CCAs...> cd( args... );
1689 
1690  constexpr bool isChecked( !Contains_v< TypeList<RCAs...>, Unchecked > );
1691 
1692  if( isChecked ) {
1693  if( columns.columns() <= cd.column() ) {
1694  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
1695  }
1696  }
1697 
1698  return column( columns.operand(), columns.idx( cd.column() ), args... );
1699 }
1701 //*************************************************************************************************
1702 
1703 
1704 
1705 
1706 //=================================================================================================
1707 //
1708 // COLUMNS OPERATORS
1709 //
1710 //=================================================================================================
1711 
1712 //*************************************************************************************************
1720 template< typename MT // Type of the matrix
1721  , bool SO // Storage order
1722  , bool DF // Density flag
1723  , bool SF // Symmetry flag
1724  , typename... CCAs > // Compile time column arguments
1725 inline void reset( Columns<MT,SO,DF,SF,CCAs...>& columns )
1726 {
1727  columns.reset();
1728 }
1730 //*************************************************************************************************
1731 
1732 
1733 //*************************************************************************************************
1741 template< typename MT // Type of the matrix
1742  , bool SO // Storage order
1743  , bool DF // Density flag
1744  , bool SF // Symmetry flag
1745  , typename... CCAs > // Compile time column arguments
1746 inline void reset( Columns<MT,SO,DF,SF,CCAs...>&& columns )
1747 {
1748  columns.reset();
1749 }
1751 //*************************************************************************************************
1752 
1753 
1754 //*************************************************************************************************
1766 template< typename MT // Type of the matrix
1767  , bool SO // Storage order
1768  , bool DF // Density flag
1769  , bool SF // Symmetry flag
1770  , typename... CCAs > // Compile time column arguments
1771 inline void reset( Columns<MT,SO,DF,SF,CCAs...>& columns, size_t i )
1772 {
1773  columns.reset( i );
1774 }
1776 //*************************************************************************************************
1777 
1778 
1779 //*************************************************************************************************
1789 template< typename MT // Type of the matrix
1790  , bool SO // Storage order
1791  , bool DF // Density flag
1792  , bool SF // Symmetry flag
1793  , typename... CCAs > // Compile time column arguments
1794 inline void clear( Columns<MT,SO,DF,SF,CCAs...>& columns )
1795 {
1796  columns.reset();
1797 }
1799 //*************************************************************************************************
1800 
1801 
1802 //*************************************************************************************************
1812 template< typename MT // Type of the matrix
1813  , bool SO // Storage order
1814  , bool DF // Density flag
1815  , bool SF // Symmetry flag
1816  , typename... CCAs > // Compile time column arguments
1817 inline void clear( Columns<MT,SO,DF,SF,CCAs...>&& columns )
1818 {
1819  columns.reset();
1820 }
1822 //*************************************************************************************************
1823 
1824 
1825 //*************************************************************************************************
1851 template< bool RF // Relaxation flag
1852  , typename MT // Type of the dense matrix
1853  , bool SO // Storage order
1854  , bool SF // Symmetry flag
1855  , typename... CCAs > // Compile time column arguments
1856 inline bool isDefault( const Columns<MT,SO,true,SF,CCAs...>& columns )
1857 {
1858  using blaze::isDefault;
1859 
1860  if( SO == false ) {
1861  for( size_t i=0UL; i<columns.rows(); ++i )
1862  for( size_t j=0UL; j<columns.columns(); ++j )
1863  if( !isDefault<RF>( columns(i,j) ) )
1864  return false;
1865  }
1866  else {
1867  for( size_t j=0UL; j<columns.columns(); ++j )
1868  for( size_t i=0UL; i<columns.rows(); ++i )
1869  if( !isDefault<RF>( columns(i,j) ) )
1870  return false;
1871  }
1872 
1873  return true;
1874 }
1876 //*************************************************************************************************
1877 
1878 
1879 //*************************************************************************************************
1905 template< bool RF // Relaxation flag
1906  , typename MT // Type of the dense matrix
1907  , bool SO // Storage order
1908  , bool SF // Symmetry flag
1909  , typename... CCAs > // Compile time column arguments
1910 inline bool isDefault( const Columns<MT,SO,false,SF,CCAs...>& columns )
1911 {
1912  using blaze::isDefault;
1913 
1914  for( size_t j=0UL; j<columns.columns(); ++j ) {
1915  for( auto element=columns.cbegin(j); element!=columns.cend(j); ++element )
1916  if( !isDefault<RF>( element->value() ) ) return false;
1917  }
1918 
1919  return true;
1920 }
1922 //*************************************************************************************************
1923 
1924 
1925 //*************************************************************************************************
1943 template< typename MT // Type of the matrix
1944  , bool SO // Storage order
1945  , bool DF // Density flag
1946  , bool SF // Symmetry flag
1947  , typename... CCAs > // Compile time column arguments
1948 inline bool isIntact( const Columns<MT,SO,DF,SF,CCAs...>& columns ) noexcept
1949 {
1950  return ( columns.rows() == columns.operand().rows() &&
1951  columns.columns() <= columns.operand().columns() &&
1952  isIntact( columns.operand() ) );
1953 }
1955 //*************************************************************************************************
1956 
1957 
1958 //*************************************************************************************************
1971 template< typename MT // Type of the matrix
1972  , bool SO1 // Storage order of the left-hand side column selection
1973  , bool DF // Density flag
1974  , bool SF // Symmetry flag
1975  , typename... CCAs // Compile time column arguments
1976  , bool SO2 > // Storage order of the right-hand side matrix
1977 inline bool isSame( const Columns<MT,SO1,DF,SF,CCAs...>& a, const Matrix<MT,SO2>& b ) noexcept
1978 {
1979  if( !isSame( a.operand(), ~b ) || ( a.rows() != (~b).rows() ) || ( a.columns() != (~b).columns() ) )
1980  return false;
1981 
1982  for( size_t j=0UL; j<a.columns(); ++j ) {
1983  if( a.idx(j) != j )
1984  return false;
1985  }
1986 
1987  return true;
1988 }
1990 //*************************************************************************************************
1991 
1992 
1993 //*************************************************************************************************
2006 template< typename MT // Type of the matrix
2007  , bool SO1 // Storage order of the left-hand side matrix
2008  , bool DF // Density flag
2009  , bool SF // Symmetry flag
2010  , typename... CCAs // Compile time column arguments
2011  , bool SO2 > // Storage order of the right-hand side column selection
2012 inline bool isSame( const Matrix<MT,SO1>& a, const Columns<MT,SO2,DF,SF,CCAs...>& b ) noexcept
2013 {
2014  return isSame( b, a );
2015 }
2017 //*************************************************************************************************
2018 
2019 
2020 //*************************************************************************************************
2033 template< typename MT // Type of the matrix
2034  , bool SO1 // Storage order of the left-hand side column selection
2035  , bool DF // Density flag
2036  , bool SF // Symmetry flag
2037  , typename... CCAs // Compile time column arguments
2038  , AlignmentFlag AF // Alignment flag
2039  , bool SO2 // Storage order of the right-hand side submatrix
2040  , size_t... CSAs > // Compile time submatrix arguments
2041 inline bool isSame( const Columns<MT,SO1,DF,SF,CCAs...>& a, const Submatrix<MT,AF,SO2,DF,CSAs...>& b ) noexcept
2042 {
2043  if( !isSame( a.operand(), b.operand() ) || ( a.rows() != (~b).rows() ) || ( a.columns() != (~b).columns() ) )
2044  return false;
2045 
2046  for( size_t j=0UL; j<a.columns(); ++j ) {
2047  if( a.idx(j) != b.column()+j )
2048  return false;
2049  }
2050 
2051  return true;
2052 }
2054 //*************************************************************************************************
2055 
2056 
2057 //*************************************************************************************************
2070 template< typename MT // Type of the matrix
2071  , AlignmentFlag AF // Alignment flag
2072  , bool SO1 // Storage order of the left-hand side submatrix
2073  , bool DF // Density flag
2074  , size_t... CSAs // Compile time submatrix arguments
2075  , bool SO2 // Storage order of the right-hand side column selection
2076  , bool SF // Symmetry flag
2077  , typename... CCAs > // Compile time column arguments
2078 inline bool isSame( const Submatrix<MT,AF,SO1,DF,CSAs...>& a, const Columns<MT,SO2,DF,SF,CCAs...>& b ) noexcept
2079 {
2080  return isSame( b, a );
2081 }
2083 //*************************************************************************************************
2084 
2085 
2086 //*************************************************************************************************
2099 template< typename MT // Type of the matrix
2100  , bool SO // Storage order
2101  , bool DF // Density flag
2102  , bool SF // Symmetry flag
2103  , typename... CCAs1 // Compile time column arguments of the left-hand side column selection
2104  , typename... CCAs2 > // Compile time column arguments of the right-hand side column selection
2105 inline bool isSame( const Columns<MT,SO,DF,SF,CCAs1...>& a,
2106  const Columns<MT,SO,DF,SF,CCAs2...>& b ) noexcept
2107 {
2108  if( !isSame( a.operand(), b.operand() ) || a.rows() != b.rows() || a.columns() != b.columns() )
2109  return false;
2110 
2111  for( size_t i=0UL; i<a.columns(); ++i ) {
2112  if( a.idx(i) != b.idx(i) )
2113  return false;
2114  }
2115 
2116  return true;
2117 }
2119 //*************************************************************************************************
2120 
2121 
2122 //*************************************************************************************************
2161 template< InversionFlag IF // Inversion algorithm
2162  , typename MT // Type of the dense matrix
2163  , bool SO // Storage order
2164  , bool SF // Symmetry flag
2165  , typename... CCAs > // Compile time column arguments
2166 inline auto invert( Columns<MT,SO,true,SF,CCAs...>& c )
2167  -> DisableIf_t< HasMutableDataAccess_v<MT> >
2168 {
2169  using RT = ResultType_t< Columns<MT,SO,true,SF,CCAs...> >;
2170 
2173 
2174  RT tmp( c );
2175  invert<IF>( tmp );
2176  c = tmp;
2177 }
2179 //*************************************************************************************************
2180 
2181 
2182 //*************************************************************************************************
2198 template< typename MT // Type of the matrix
2199  , bool SO // Storage order
2200  , bool DF // Density flag
2201  , bool SF // Symmetry flag
2202  , typename... CCAs // Compile time column arguments
2203  , typename ET > // Type of the element
2204 inline bool trySet( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t i, size_t j, const ET& value )
2205 {
2206  BLAZE_INTERNAL_ASSERT( i < c.rows(), "Invalid row access index" );
2207  BLAZE_INTERNAL_ASSERT( j < c.columns(), "Invalid column access index" );
2208 
2209  return trySet( c.operand(), c.idx(i), j, value );
2210 }
2212 //*************************************************************************************************
2213 
2214 
2215 //*************************************************************************************************
2233 template< typename MT // Type of the matrix
2234  , bool SO // Storage order
2235  , bool DF // Density flag
2236  , bool SF // Symmetry flag
2237  , typename... CCAs // Compile time column arguments
2238  , typename ET > // Type of the element
2240  trySet( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t row, size_t column, size_t m, size_t n, const ET& value )
2241 {
2242  BLAZE_INTERNAL_ASSERT( row <= (~c).rows(), "Invalid row access index" );
2243  BLAZE_INTERNAL_ASSERT( column <= (~c).columns(), "Invalid column access index" );
2244  BLAZE_INTERNAL_ASSERT( row + m <= (~c).rows(), "Invalid number of rows" );
2245  BLAZE_INTERNAL_ASSERT( column + n <= (~c).columns(), "Invalid number of columns" );
2246 
2247  const size_t jend( column + n );
2248 
2249  for( size_t j=column; j<jend; ++j ) {
2250  if( !trySet( c.operand(), row, c.idx(j), m, 1UL, value ) )
2251  return false;
2252  }
2253 
2254  return true;
2255 }
2257 //*************************************************************************************************
2258 
2259 
2260 //*************************************************************************************************
2276 template< typename MT // Type of the matrix
2277  , bool SO // Storage order
2278  , bool DF // Density flag
2279  , bool SF // Symmetry flag
2280  , typename... CCAs // Compile time column arguments
2281  , typename ET > // Type of the element
2282 inline bool tryAdd( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t i, size_t j, const ET& value )
2283 {
2284  BLAZE_INTERNAL_ASSERT( i < c.rows(), "Invalid row access index" );
2285  BLAZE_INTERNAL_ASSERT( j < c.columns(), "Invalid column access index" );
2286 
2287  return tryAdd( c.operand(), c.idx(i), j, value );
2288 }
2290 //*************************************************************************************************
2291 
2292 
2293 //*************************************************************************************************
2311 template< typename MT // Type of the matrix
2312  , bool SO // Storage order
2313  , bool DF // Density flag
2314  , bool SF // Symmetry flag
2315  , typename... CCAs // Compile time column arguments
2316  , typename ET > // Type of the element
2318  tryAdd( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t row, size_t column, size_t m, size_t n, const ET& value )
2319 {
2320  BLAZE_INTERNAL_ASSERT( row <= (~c).rows(), "Invalid row access index" );
2321  BLAZE_INTERNAL_ASSERT( column <= (~c).columns(), "Invalid column access index" );
2322  BLAZE_INTERNAL_ASSERT( row + m <= (~c).rows(), "Invalid number of rows" );
2323  BLAZE_INTERNAL_ASSERT( column + n <= (~c).columns(), "Invalid number of columns" );
2324 
2325  const size_t jend( column + n );
2326 
2327  for( size_t j=column; j<jend; ++j ) {
2328  if( !tryAdd( c.operand(), row, c.idx(j), m, 1UL, value ) )
2329  return false;
2330  }
2331 
2332  return true;
2333 }
2335 //*************************************************************************************************
2336 
2337 
2338 //*************************************************************************************************
2354 template< typename MT // Type of the matrix
2355  , bool SO // Storage order
2356  , bool DF // Density flag
2357  , bool SF // Symmetry flag
2358  , typename... CCAs // Compile time column arguments
2359  , typename ET > // Type of the element
2360 inline bool trySub( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t i, size_t j, const ET& value )
2361 {
2362  BLAZE_INTERNAL_ASSERT( i < c.rows(), "Invalid row access index" );
2363  BLAZE_INTERNAL_ASSERT( j < c.columns(), "Invalid column access index" );
2364 
2365  return trySub( c.operand(), c.idx(i), j, value );
2366 }
2368 //*************************************************************************************************
2369 
2370 
2371 //*************************************************************************************************
2389 template< typename MT // Type of the matrix
2390  , bool SO // Storage order
2391  , bool DF // Density flag
2392  , bool SF // Symmetry flag
2393  , typename... CCAs // Compile time column arguments
2394  , typename ET > // Type of the element
2396  trySub( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t row, size_t column, size_t m, size_t n, const ET& value )
2397 {
2398  BLAZE_INTERNAL_ASSERT( row <= (~c).rows(), "Invalid row access index" );
2399  BLAZE_INTERNAL_ASSERT( column <= (~c).columns(), "Invalid column access index" );
2400  BLAZE_INTERNAL_ASSERT( row + m <= (~c).rows(), "Invalid number of rows" );
2401  BLAZE_INTERNAL_ASSERT( column + n <= (~c).columns(), "Invalid number of columns" );
2402 
2403  const size_t jend( column + n );
2404 
2405  for( size_t j=column; j<jend; ++j ) {
2406  if( !trySub( c.operand(), row, c.idx(j), m, 1UL, value ) )
2407  return false;
2408  }
2409 
2410  return true;
2411 }
2413 //*************************************************************************************************
2414 
2415 
2416 //*************************************************************************************************
2432 template< typename MT // Type of the matrix
2433  , bool SO // Storage order
2434  , bool DF // Density flag
2435  , bool SF // Symmetry flag
2436  , typename... CCAs // Compile time column arguments
2437  , typename ET > // Type of the element
2438 inline bool tryMult( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t i, size_t j, const ET& value )
2439 {
2440  BLAZE_INTERNAL_ASSERT( i < c.rows(), "Invalid row access index" );
2441  BLAZE_INTERNAL_ASSERT( j < c.columns(), "Invalid column access index" );
2442 
2443  return tryMult( c.operand(), c.idx(i), j, value );
2444 }
2446 //*************************************************************************************************
2447 
2448 
2449 //*************************************************************************************************
2467 template< typename MT // Type of the matrix
2468  , bool SO // Storage order
2469  , bool DF // Density flag
2470  , bool SF // Symmetry flag
2471  , typename... CCAs // Compile time column arguments
2472  , typename ET > // Type of the element
2474  tryMult( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t row, size_t column, size_t m, size_t n, const ET& value )
2475 {
2476  BLAZE_INTERNAL_ASSERT( row <= (~c).rows(), "Invalid row access index" );
2477  BLAZE_INTERNAL_ASSERT( column <= (~c).columns(), "Invalid column access index" );
2478  BLAZE_INTERNAL_ASSERT( row + m <= (~c).rows(), "Invalid number of rows" );
2479  BLAZE_INTERNAL_ASSERT( column + n <= (~c).columns(), "Invalid number of columns" );
2480 
2481  const size_t jend( column + n );
2482 
2483  for( size_t j=column; j<jend; ++j ) {
2484  if( !tryMult( c.operand(), row, c.idx(j), m, 1UL, value ) )
2485  return false;
2486  }
2487 
2488  return true;
2489 }
2491 //*************************************************************************************************
2492 
2493 
2494 //*************************************************************************************************
2510 template< typename MT // Type of the matrix
2511  , bool SO // Storage order
2512  , bool DF // Density flag
2513  , bool SF // Symmetry flag
2514  , typename... CCAs // Compile time column arguments
2515  , typename ET > // Type of the element
2516 inline bool tryDiv( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t i, size_t j, const ET& value )
2517 {
2518  BLAZE_INTERNAL_ASSERT( i < c.rows(), "Invalid row access index" );
2519  BLAZE_INTERNAL_ASSERT( j < c.columns(), "Invalid column access index" );
2520 
2521  return tryDiv( c.operand(), c.idx(i), j, value );
2522 }
2524 //*************************************************************************************************
2525 
2526 
2527 //*************************************************************************************************
2545 template< typename MT // Type of the matrix
2546  , bool SO // Storage order
2547  , bool DF // Density flag
2548  , bool SF // Symmetry flag
2549  , typename... CCAs // Compile time column arguments
2550  , typename ET > // Type of the element
2552  tryDiv( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t row, size_t column, size_t m, size_t n, const ET& value )
2553 {
2554  BLAZE_INTERNAL_ASSERT( row <= (~c).rows(), "Invalid row access index" );
2555  BLAZE_INTERNAL_ASSERT( column <= (~c).columns(), "Invalid column access index" );
2556  BLAZE_INTERNAL_ASSERT( row + m <= (~c).rows(), "Invalid number of rows" );
2557  BLAZE_INTERNAL_ASSERT( column + n <= (~c).columns(), "Invalid number of columns" );
2558 
2559  const size_t jend( column + n );
2560 
2561  for( size_t j=column; j<jend; ++j ) {
2562  if( !tryDiv( c.operand(), row, c.idx(j), m, 1UL, value ) )
2563  return false;
2564  }
2565 
2566  return true;
2567 }
2569 //*************************************************************************************************
2570 
2571 
2572 //*************************************************************************************************
2588 template< typename MT // Type of the matrix
2589  , bool SO // Storage order
2590  , bool DF // Density flag
2591  , bool SF // Symmetry flag
2592  , typename... CCAs > // Compile time column arguments
2593 inline bool tryShift( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t i, size_t j, int count )
2594 {
2595  BLAZE_INTERNAL_ASSERT( i < c.rows(), "Invalid row access index" );
2596  BLAZE_INTERNAL_ASSERT( j < c.columns(), "Invalid column access index" );
2597 
2598  return tryShift( c.operand(), c.idx(i), j, count );
2599 }
2601 //*************************************************************************************************
2602 
2603 
2604 //*************************************************************************************************
2622 template< typename MT // Type of the matrix
2623  , bool SO // Storage order
2624  , bool DF // Density flag
2625  , bool SF // Symmetry flag
2626  , typename... CCAs > // Compile time column arguments
2628  tryShift( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t row, size_t column, size_t m, size_t n, int count )
2629 {
2630  BLAZE_INTERNAL_ASSERT( row <= (~c).rows(), "Invalid row access index" );
2631  BLAZE_INTERNAL_ASSERT( column <= (~c).columns(), "Invalid column access index" );
2632  BLAZE_INTERNAL_ASSERT( row + m <= (~c).rows(), "Invalid number of rows" );
2633  BLAZE_INTERNAL_ASSERT( column + n <= (~c).columns(), "Invalid number of columns" );
2634 
2635  const size_t jend( column + n );
2636 
2637  for( size_t j=column; j<jend; ++j ) {
2638  if( !tryShift( c.operand(), row, c.idx(j), m, 1UL, count ) )
2639  return false;
2640  }
2641 
2642  return true;
2643 }
2645 //*************************************************************************************************
2646 
2647 
2648 //*************************************************************************************************
2664 template< typename MT // Type of the matrix
2665  , bool SO // Storage order
2666  , bool DF // Density flag
2667  , bool SF // Symmetry flag
2668  , typename... CCAs // Compile time column arguments
2669  , typename ET > // Type of the element
2670 inline bool tryBitand( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t i, size_t j, const ET& value )
2671 {
2672  BLAZE_INTERNAL_ASSERT( i < c.rows(), "Invalid row access index" );
2673  BLAZE_INTERNAL_ASSERT( j < c.columns(), "Invalid column access index" );
2674 
2675  return tryBitand( c.operand(), c.idx(i), j, value );
2676 }
2678 //*************************************************************************************************
2679 
2680 
2681 //*************************************************************************************************
2699 template< typename MT // Type of the matrix
2700  , bool SO // Storage order
2701  , bool DF // Density flag
2702  , bool SF // Symmetry flag
2703  , typename... CCAs // Compile time column arguments
2704  , typename ET > // Type of the element
2706  tryBitand( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t row, size_t column, size_t m, size_t n, const ET& value )
2707 {
2708  BLAZE_INTERNAL_ASSERT( row <= (~c).rows(), "Invalid row access index" );
2709  BLAZE_INTERNAL_ASSERT( column <= (~c).columns(), "Invalid column access index" );
2710  BLAZE_INTERNAL_ASSERT( row + m <= (~c).rows(), "Invalid number of rows" );
2711  BLAZE_INTERNAL_ASSERT( column + n <= (~c).columns(), "Invalid number of columns" );
2712 
2713  const size_t jend( column + n );
2714 
2715  for( size_t j=column; j<jend; ++j ) {
2716  if( !tryBitand( c.operand(), row, c.idx(j), m, 1UL, value ) )
2717  return false;
2718  }
2719 
2720  return true;
2721 }
2723 //*************************************************************************************************
2724 
2725 
2726 //*************************************************************************************************
2742 template< typename MT // Type of the matrix
2743  , bool SO // Storage order
2744  , bool DF // Density flag
2745  , bool SF // Symmetry flag
2746  , typename... CCAs // Compile time column arguments
2747  , typename ET > // Type of the element
2748 inline bool tryBitor( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t i, size_t j, const ET& value )
2749 {
2750  BLAZE_INTERNAL_ASSERT( i < c.rows(), "Invalid row access index" );
2751  BLAZE_INTERNAL_ASSERT( j < c.columns(), "Invalid column access index" );
2752 
2753  return tryBitor( c.operand(), c.idx(i), j, value );
2754 }
2756 //*************************************************************************************************
2757 
2758 
2759 //*************************************************************************************************
2777 template< typename MT // Type of the matrix
2778  , bool SO // Storage order
2779  , bool DF // Density flag
2780  , bool SF // Symmetry flag
2781  , typename... CCAs // Compile time column arguments
2782  , typename ET > // Type of the element
2784  tryBitor( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t row, size_t column, size_t m, size_t n, const ET& value )
2785 {
2786  BLAZE_INTERNAL_ASSERT( row <= (~c).rows(), "Invalid row access index" );
2787  BLAZE_INTERNAL_ASSERT( column <= (~c).columns(), "Invalid column access index" );
2788  BLAZE_INTERNAL_ASSERT( row + m <= (~c).rows(), "Invalid number of rows" );
2789  BLAZE_INTERNAL_ASSERT( column + n <= (~c).columns(), "Invalid number of columns" );
2790 
2791  const size_t jend( column + n );
2792 
2793  for( size_t j=column; j<jend; ++j ) {
2794  if( !tryBitor( c.operand(), row, c.idx(j), m, 1UL, value ) )
2795  return false;
2796  }
2797 
2798  return true;
2799 }
2801 //*************************************************************************************************
2802 
2803 
2804 //*************************************************************************************************
2820 template< typename MT // Type of the matrix
2821  , bool SO // Storage order
2822  , bool DF // Density flag
2823  , bool SF // Symmetry flag
2824  , typename... CCAs // Compile time column arguments
2825  , typename ET > // Type of the element
2826 inline bool tryBitxor( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t i, size_t j, const ET& value )
2827 {
2828  BLAZE_INTERNAL_ASSERT( i < c.rows(), "Invalid row access index" );
2829  BLAZE_INTERNAL_ASSERT( j < c.columns(), "Invalid column access index" );
2830 
2831  return tryBitxor( c.operand(), c.idx(i), j, value );
2832 }
2834 //*************************************************************************************************
2835 
2836 
2837 //*************************************************************************************************
2855 template< typename MT // Type of the matrix
2856  , bool SO // Storage order
2857  , bool DF // Density flag
2858  , bool SF // Symmetry flag
2859  , typename... CCAs // Compile time column arguments
2860  , typename ET > // Type of the element
2862  tryBitxor( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t row, size_t column, size_t m, size_t n, const ET& value )
2863 {
2864  BLAZE_INTERNAL_ASSERT( row <= (~c).rows(), "Invalid row access index" );
2865  BLAZE_INTERNAL_ASSERT( column <= (~c).columns(), "Invalid column access index" );
2866  BLAZE_INTERNAL_ASSERT( row + m <= (~c).rows(), "Invalid number of rows" );
2867  BLAZE_INTERNAL_ASSERT( column + n <= (~c).columns(), "Invalid number of columns" );
2868 
2869  const size_t jend( column + n );
2870 
2871  for( size_t j=column; j<jend; ++j ) {
2872  if( !tryBitxor( c.operand(), row, c.idx(j), m, 1UL, value ) )
2873  return false;
2874  }
2875 
2876  return true;
2877 }
2879 //*************************************************************************************************
2880 
2881 
2882 //*************************************************************************************************
2898 template< typename MT // Type of the matrix
2899  , bool SO // Storage order
2900  , bool DF // Density flag
2901  , bool SF // Symmetry flag
2902  , typename... CCAs // Compile time column arguments
2903  , typename VT > // Type of the right-hand side vector
2904 inline bool tryAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2905  const Vector<VT,false>& rhs, size_t row, size_t column )
2906 {
2907  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2908  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2909  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
2910 
2911  return tryAssign( lhs.operand(), ~rhs, row, lhs.idx( column ) );
2912 }
2914 //*************************************************************************************************
2915 
2916 
2917 //*************************************************************************************************
2933 template< typename MT // Type of the matrix
2934  , bool SO // Storage order
2935  , bool DF // Density flag
2936  , bool SF // Symmetry flag
2937  , typename... CCAs // Compile time column arguments
2938  , typename VT > // Type of the right-hand side vector
2939 inline bool tryAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2940  const Vector<VT,true>& rhs, size_t row, size_t column )
2941 {
2942  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2943  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2944  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
2945 
2946  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
2947  if( !trySet( lhs.operand(), row, lhs.idx( column+i ), (~rhs)[i] ) )
2948  return false;
2949  }
2950 
2951  return true;
2952 }
2954 //*************************************************************************************************
2955 
2956 
2957 //*************************************************************************************************
2975 template< typename MT // Type of the matrix
2976  , bool SO // Storage order
2977  , bool DF // Density flag
2978  , bool SF // Symmetry flag
2979  , typename... CCAs // Compile time column arguments
2980  , typename VT // Type of the right-hand side vector
2981  , bool TF > // Transpose flag of the right-hand side vector
2982 inline bool tryAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2983  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
2984 {
2985  MAYBE_UNUSED( band );
2986 
2987  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2988  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2989  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
2990  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
2991 
2992  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
2993  if( !trySet( lhs.operand(), row+i, lhs.idx( column+i ), (~rhs)[i] ) )
2994  return false;
2995  }
2996 
2997  return true;
2998 }
3000 //*************************************************************************************************
3001 
3002 
3003 //*************************************************************************************************
3019 template< typename MT1 // Type of the matrix
3020  , bool SO1 // Storage order
3021  , bool DF // Density flag
3022  , bool SF // Symmetry flag
3023  , typename... CCAs // Compile time column arguments
3024  , typename MT2 // Type of the right-hand side matrix
3025  , bool SO2 > // Storage order of the right-hand side matrix
3026 inline bool tryAssign( const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3027  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
3028 {
3029  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3030  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3031  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
3032  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
3033 
3034  for( size_t j=0UL; j<(~rhs).columns(); ++j ) {
3035  if( !tryAssign( lhs.operand(), blaze::column( ~rhs, j, unchecked ), row, lhs.idx( column+j ) ) )
3036  return false;
3037  }
3038 
3039  return true;
3040 }
3042 //*************************************************************************************************
3043 
3044 
3045 //*************************************************************************************************
3062 template< typename MT // Type of the matrix
3063  , bool SO // Storage order
3064  , bool DF // Density flag
3065  , bool SF // Symmetry flag
3066  , typename... CCAs // Compile time column arguments
3067  , typename VT > // Type of the right-hand side vector
3068 inline bool tryAddAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3069  const Vector<VT,false>& rhs, size_t row, size_t column )
3070 {
3071  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3072  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3073  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3074 
3075  return tryAddAssign( lhs.operand(), ~rhs, row, lhs.idx( column ) );
3076 }
3078 //*************************************************************************************************
3079 
3080 
3081 //*************************************************************************************************
3098 template< typename MT // Type of the matrix
3099  , bool SO // Storage order
3100  , bool DF // Density flag
3101  , bool SF // Symmetry flag
3102  , typename... CCAs // Compile time column arguments
3103  , typename VT > // Type of the right-hand side vector
3104 inline bool tryAddAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3105  const Vector<VT,true>& rhs, size_t row, size_t column )
3106 {
3107  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3108  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3109  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3110 
3111  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3112  if( !tryAdd( lhs.operand(), row, lhs.idx( column+i ), (~rhs)[i] ) )
3113  return false;
3114  }
3115 
3116  return true;
3117 }
3119 //*************************************************************************************************
3120 
3121 
3122 //*************************************************************************************************
3140 template< typename MT // Type of the matrix
3141  , bool SO // Storage order
3142  , bool DF // Density flag
3143  , bool SF // Symmetry flag
3144  , typename... CCAs // Compile time column arguments
3145  , typename VT // Type of the right-hand side vector
3146  , bool TF > // Transpose flag of the right-hand side vector
3147 inline bool tryAddAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3148  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
3149 {
3150  MAYBE_UNUSED( band );
3151 
3152  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3153  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3154  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3155  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3156 
3157  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3158  if( !tryAdd( lhs.operand(), row+i, lhs.idx( column+i ), (~rhs)[i] ) )
3159  return false;
3160  }
3161 
3162  return true;
3163 }
3165 //*************************************************************************************************
3166 
3167 
3168 //*************************************************************************************************
3184 template< typename MT1 // Type of the matrix
3185  , bool SO1 // Storage order
3186  , bool DF // Density flag
3187  , bool SF // Symmetry flag
3188  , typename... CCAs // Compile time column arguments
3189  , typename MT2 // Type of the right-hand side matrix
3190  , bool SO2 > // Storage order of the right-hand side matrix
3191 inline bool tryAddAssign( const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3192  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
3193 {
3194  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3195  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3196  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
3197  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
3198 
3199  for( size_t j=0UL; j<(~rhs).columns(); ++j ) {
3200  if( !tryAddAssign( lhs.operand(), blaze::column( ~rhs, j, unchecked ), row, lhs.idx( column+j ) ) )
3201  return false;
3202  }
3203 
3204  return true;
3205 }
3207 //*************************************************************************************************
3208 
3209 
3210 //*************************************************************************************************
3227 template< typename MT // Type of the matrix
3228  , bool SO // Storage order
3229  , bool DF // Density flag
3230  , bool SF // Symmetry flag
3231  , typename... CCAs // Compile time column arguments
3232  , typename VT > // Type of the right-hand side vector
3233 inline bool trySubAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3234  const Vector<VT,false>& rhs, size_t row, size_t column )
3235 {
3236  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3237  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3238  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3239 
3240  return trySubAssign( lhs.operand(), ~rhs, row, lhs.idx( column ) );
3241 }
3243 //*************************************************************************************************
3244 
3245 
3246 //*************************************************************************************************
3263 template< typename MT // Type of the matrix
3264  , bool SO // Storage order
3265  , bool DF // Density flag
3266  , bool SF // Symmetry flag
3267  , typename... CCAs // Compile time column arguments
3268  , typename VT > // Type of the right-hand side vector
3269 inline bool trySubAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3270  const Vector<VT,true>& rhs, size_t row, size_t column )
3271 {
3272  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3273  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3274  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3275 
3276  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3277  if( !trySub( lhs.operand(), row, lhs.idx( column+i ), (~rhs)[i] ) )
3278  return false;
3279  }
3280 
3281  return true;
3282 }
3284 //*************************************************************************************************
3285 
3286 
3287 //*************************************************************************************************
3305 template< typename MT // Type of the matrix
3306  , bool SO // Storage order
3307  , bool DF // Density flag
3308  , bool SF // Symmetry flag
3309  , typename... CCAs // Compile time column arguments
3310  , typename VT // Type of the right-hand side vector
3311  , bool TF > // Transpose flag of the right-hand side vector
3312 inline bool trySubAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3313  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
3314 {
3315  MAYBE_UNUSED( band );
3316 
3317  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3318  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3319  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3320  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3321 
3322  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3323  if( !trySub( lhs.operand(), row+i, lhs.idx( column+i ), (~rhs)[i] ) )
3324  return false;
3325  }
3326 
3327  return true;
3328 }
3330 //*************************************************************************************************
3331 
3332 
3333 //*************************************************************************************************
3350 template< typename MT1 // Type of the matrix
3351  , bool SO1 // Storage order
3352  , bool DF // Density flag
3353  , bool SF // Symmetry flag
3354  , typename... CCAs // Compile time column arguments
3355  , typename MT2 // Type of the right-hand side matrix
3356  , bool SO2 > // Storage order of the right-hand side matrix
3357 inline bool trySubAssign( const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3358  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
3359 {
3360  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3361  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3362  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
3363  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
3364 
3365  for( size_t j=0UL; j<(~rhs).columns(); ++j ) {
3366  if( !trySubAssign( lhs.operand(), blaze::column( ~rhs, j, unchecked ), row, lhs.idx( column+j ) ) )
3367  return false;
3368  }
3369 
3370  return true;
3371 }
3373 //*************************************************************************************************
3374 
3375 
3376 //*************************************************************************************************
3393 template< typename MT // Type of the matrix
3394  , bool SO // Storage order
3395  , bool DF // Density flag
3396  , bool SF // Symmetry flag
3397  , typename... CCAs // Compile time column arguments
3398  , typename VT > // Type of the right-hand side vector
3399 inline bool tryMultAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3400  const Vector<VT,false>& rhs, size_t row, size_t column )
3401 {
3402  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3403  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3404  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3405 
3406  return tryMultAssign( lhs.operand(), ~rhs, row, lhs.idx( column ) );
3407 }
3409 //*************************************************************************************************
3410 
3411 
3412 //*************************************************************************************************
3429 template< typename MT // Type of the matrix
3430  , bool SO // Storage order
3431  , bool DF // Density flag
3432  , bool SF // Symmetry flag
3433  , typename... CCAs // Compile time column arguments
3434  , typename VT > // Type of the right-hand side vector
3435 inline bool tryMultAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3436  const Vector<VT,true>& rhs, size_t row, size_t column )
3437 {
3438  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3439  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3440  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3441 
3442  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3443  if( !tryMult( lhs.operand(), row, lhs.idx( column+i ), (~rhs)[i] ) )
3444  return false;
3445  }
3446 
3447  return true;
3448 }
3450 //*************************************************************************************************
3451 
3452 
3453 //*************************************************************************************************
3471 template< typename MT // Type of the matrix
3472  , bool SO // Storage order
3473  , bool DF // Density flag
3474  , bool SF // Symmetry flag
3475  , typename... CCAs // Compile time column arguments
3476  , typename VT // Type of the right-hand side vector
3477  , bool TF > // Transpose flag of the right-hand side vector
3478 inline bool tryMultAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3479  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
3480 {
3481  MAYBE_UNUSED( band );
3482 
3483  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3484  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3485  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3486  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3487 
3488  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3489  if( !tryMult( lhs.operand(), row+i, lhs.idx( column+i ), (~rhs)[i] ) )
3490  return false;
3491  }
3492 
3493  return true;
3494 }
3496 //*************************************************************************************************
3497 
3498 
3499 //*************************************************************************************************
3516 template< typename MT1 // Type of the matrix
3517  , bool SO1 // Storage order
3518  , bool DF // Density flag
3519  , bool SF // Symmetry flag
3520  , typename... CCAs // Compile time column arguments
3521  , typename MT2 // Type of the right-hand side matrix
3522  , bool SO2 > // Storage order of the right-hand side matrix
3523 inline bool trySchurAssign( const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3524  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
3525 {
3526  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3527  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3528  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
3529  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
3530 
3531  for( size_t j=0UL; j<(~rhs).columns(); ++j ) {
3532  if( !tryMultAssign( lhs.operand(), blaze::column( ~rhs, j, unchecked ), row, lhs.idx( column+j ) ) )
3533  return false;
3534  }
3535 
3536  return true;
3537 }
3539 //*************************************************************************************************
3540 
3541 
3542 //*************************************************************************************************
3559 template< typename MT // Type of the matrix
3560  , bool SO // Storage order
3561  , bool DF // Density flag
3562  , bool SF // Symmetry flag
3563  , typename... CCAs // Compile time column arguments
3564  , typename VT > // Type of the right-hand side vector
3565 inline bool tryDivAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3566  const Vector<VT,false>& rhs, size_t row, size_t column )
3567 {
3568  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3569  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3570  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3571 
3572  return tryDivAssign( lhs.operand(), ~rhs, row, lhs.idx( column ) );
3573 }
3575 //*************************************************************************************************
3576 
3577 
3578 //*************************************************************************************************
3595 template< typename MT // Type of the matrix
3596  , bool SO // Storage order
3597  , bool DF // Density flag
3598  , bool SF // Symmetry flag
3599  , typename... CCAs // Compile time column arguments
3600  , typename VT > // Type of the right-hand side vector
3601 inline bool tryDivAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3602  const Vector<VT,true>& rhs, size_t row, size_t column )
3603 {
3604  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3605  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3606  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3607 
3608  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3609  if( !tryDiv( lhs.operand(), row, lhs.idx( column+i ), (~rhs)[i] ) )
3610  return false;
3611  }
3612 
3613  return true;
3614 }
3616 //*************************************************************************************************
3617 
3618 
3619 //*************************************************************************************************
3637 template< typename MT // Type of the matrix
3638  , bool SO // Storage order
3639  , bool DF // Density flag
3640  , bool SF // Symmetry flag
3641  , typename... CCAs // Compile time column arguments
3642  , typename VT // Type of the right-hand side vector
3643  , bool TF > // Transpose flag of the right-hand side vector
3644 inline bool tryDivAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3645  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
3646 {
3647  MAYBE_UNUSED( band );
3648 
3649  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3650  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3651  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3652  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3653 
3654  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3655  if( !tryDiv( lhs.operand(), row+i, lhs.idx( column+i ), (~rhs)[i] ) )
3656  return false;
3657  }
3658 
3659  return true;
3660 }
3662 //*************************************************************************************************
3663 
3664 
3665 //*************************************************************************************************
3682 template< typename MT // Type of the matrix
3683  , bool SO // Storage order
3684  , bool DF // Density flag
3685  , bool SF // Symmetry flag
3686  , typename... CCAs // Compile time column arguments
3687  , typename VT > // Type of the right-hand side vector
3688 inline bool tryShiftAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3689  const Vector<VT,false>& rhs, size_t row, size_t column )
3690 {
3691  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3692  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3693  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3694 
3695  return tryShiftAssign( lhs.operand(), ~rhs, row, lhs.idx( column ) );
3696 }
3698 //*************************************************************************************************
3699 
3700 
3701 //*************************************************************************************************
3718 template< typename MT // Type of the matrix
3719  , bool SO // Storage order
3720  , bool DF // Density flag
3721  , bool SF // Symmetry flag
3722  , typename... CCAs // Compile time column arguments
3723  , typename VT > // Type of the right-hand side vector
3724 inline bool tryShiftAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3725  const Vector<VT,true>& rhs, size_t row, size_t column )
3726 {
3727  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3728  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3729  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3730 
3731  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3732  if( !tryShift( lhs.operand(), row, lhs.idx( column+i ), (~rhs)[i] ) )
3733  return false;
3734  }
3735 
3736  return true;
3737 }
3739 //*************************************************************************************************
3740 
3741 
3742 //*************************************************************************************************
3760 template< typename MT // Type of the matrix
3761  , bool SO // Storage order
3762  , bool DF // Density flag
3763  , bool SF // Symmetry flag
3764  , typename... CCAs // Compile time column arguments
3765  , typename VT // Type of the right-hand side vector
3766  , bool TF > // Transpose flag of the right-hand side vector
3767 inline bool tryShiftAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3768  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
3769 {
3770  MAYBE_UNUSED( band );
3771 
3772  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3773  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3774  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3775  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3776 
3777  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3778  if( !tryShift( lhs.operand(), row+i, lhs.idx( column+i ), (~rhs)[i] ) )
3779  return false;
3780  }
3781 
3782  return true;
3783 }
3785 //*************************************************************************************************
3786 
3787 
3788 //*************************************************************************************************
3804 template< typename MT1 // Type of the matrix
3805  , bool SO1 // Storage order
3806  , bool DF // Density flag
3807  , bool SF // Symmetry flag
3808  , typename... CCAs // Compile time column arguments
3809  , typename MT2 // Type of the right-hand side matrix
3810  , bool SO2 > // Storage order of the right-hand side matrix
3811 inline bool tryShiftAssign( const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3812  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
3813 {
3814  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3815  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3816  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
3817  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
3818 
3819  for( size_t j=0UL; j<(~rhs).columns(); ++j ) {
3820  if( !tryShiftAssign( lhs.operand(), blaze::column( ~rhs, j, unchecked ), row, lhs.idx( column+j ) ) )
3821  return false;
3822  }
3823 
3824  return true;
3825 }
3827 //*************************************************************************************************
3828 
3829 
3830 //*************************************************************************************************
3847 template< typename MT // Type of the matrix
3848  , bool SO // Storage order
3849  , bool DF // Density flag
3850  , bool SF // Symmetry flag
3851  , typename... CCAs // Compile time column arguments
3852  , typename VT > // Type of the right-hand side vector
3853 inline bool tryBitandAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3854  const Vector<VT,false>& rhs, size_t row, size_t column )
3855 {
3856  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3857  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3858  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3859 
3860  return tryBitandAssign( lhs.operand(), ~rhs, row, lhs.idx( column ) );
3861 }
3863 //*************************************************************************************************
3864 
3865 
3866 //*************************************************************************************************
3883 template< typename MT // Type of the matrix
3884  , bool SO // Storage order
3885  , bool DF // Density flag
3886  , bool SF // Symmetry flag
3887  , typename... CCAs // Compile time column arguments
3888  , typename VT > // Type of the right-hand side vector
3889 inline bool tryBitandAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3890  const Vector<VT,true>& rhs, size_t row, size_t column )
3891 {
3892  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3893  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3894  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3895 
3896  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3897  if( !tryBitand( lhs.operand(), row, lhs.idx( column+i ), (~rhs)[i] ) )
3898  return false;
3899  }
3900 
3901  return true;
3902 }
3904 //*************************************************************************************************
3905 
3906 
3907 //*************************************************************************************************
3925 template< typename MT // Type of the matrix
3926  , bool SO // Storage order
3927  , bool DF // Density flag
3928  , bool SF // Symmetry flag
3929  , typename... CCAs // Compile time column arguments
3930  , typename VT // Type of the right-hand side vector
3931  , bool TF > // Transpose flag of the right-hand side vector
3932 inline bool tryBitandAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3933  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
3934 {
3935  MAYBE_UNUSED( band );
3936 
3937  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3938  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3939  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3940  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3941 
3942  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3943  if( !tryBitand( lhs.operand(), row+i, lhs.idx( column+i ), (~rhs)[i] ) )
3944  return false;
3945  }
3946 
3947  return true;
3948 }
3950 //*************************************************************************************************
3951 
3952 
3953 //*************************************************************************************************
3970 template< typename MT1 // Type of the matrix
3971  , bool SO1 // Storage order
3972  , bool DF // Density flag
3973  , bool SF // Symmetry flag
3974  , typename... CCAs // Compile time column arguments
3975  , typename MT2 // Type of the right-hand side matrix
3976  , bool SO2 > // Storage order of the right-hand side matrix
3977 inline bool tryBitandAssign( const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3978  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
3979 {
3980  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3981  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3982  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
3983  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
3984 
3985  for( size_t j=0UL; j<(~rhs).columns(); ++j ) {
3986  if( !tryBitandAssign( lhs.operand(), blaze::column( ~rhs, j, unchecked ), row, lhs.idx( column+j ) ) )
3987  return false;
3988  }
3989 
3990  return true;
3991 }
3993 //*************************************************************************************************
3994 
3995 
3996 //*************************************************************************************************
4013 template< typename MT // Type of the matrix
4014  , bool SO // Storage order
4015  , bool DF // Density flag
4016  , bool SF // Symmetry flag
4017  , typename... CCAs // Compile time column arguments
4018  , typename VT > // Type of the right-hand side vector
4019 inline bool tryBitorAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4020  const Vector<VT,false>& rhs, size_t row, size_t column )
4021 {
4022  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4023  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4024  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
4025 
4026  return tryBitorAssign( lhs.operand(), ~rhs, row, lhs.idx( column ) );
4027 }
4029 //*************************************************************************************************
4030 
4031 
4032 //*************************************************************************************************
4049 template< typename MT // Type of the matrix
4050  , bool SO // Storage order
4051  , bool DF // Density flag
4052  , bool SF // Symmetry flag
4053  , typename... CCAs // Compile time column arguments
4054  , typename VT > // Type of the right-hand side vector
4055 inline bool tryBitorAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4056  const Vector<VT,true>& rhs, size_t row, size_t column )
4057 {
4058  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4059  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4060  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
4061 
4062  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
4063  if( !tryBitor( lhs.operand(), row, lhs.idx( column+i ), (~rhs)[i] ) )
4064  return false;
4065  }
4066 
4067  return true;
4068 }
4070 //*************************************************************************************************
4071 
4072 
4073 //*************************************************************************************************
4091 template< typename MT // Type of the matrix
4092  , bool SO // Storage order
4093  , bool DF // Density flag
4094  , bool SF // Symmetry flag
4095  , typename... CCAs // Compile time column arguments
4096  , typename VT // Type of the right-hand side vector
4097  , bool TF > // Transpose flag of the right-hand side vector
4098 inline bool tryBitorAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4099  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
4100 {
4101  MAYBE_UNUSED( band );
4102 
4103  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4104  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4105  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
4106  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
4107 
4108  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
4109  if( !tryBitor( lhs.operand(), row+i, lhs.idx( column+i ), (~rhs)[i] ) )
4110  return false;
4111  }
4112 
4113  return true;
4114 }
4116 //*************************************************************************************************
4117 
4118 
4119 //*************************************************************************************************
4136 template< typename MT1 // Type of the matrix
4137  , bool SO1 // Storage order
4138  , bool DF // Density flag
4139  , bool SF // Symmetry flag
4140  , typename... CCAs // Compile time column arguments
4141  , typename MT2 // Type of the right-hand side matrix
4142  , bool SO2 > // Storage order of the right-hand side matrix
4143 inline bool tryBitorAssign( const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
4144  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
4145 {
4146  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4147  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4148  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
4149  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
4150 
4151  for( size_t j=0UL; j<(~rhs).columns(); ++j ) {
4152  if( !tryBitorAssign( lhs.operand(), blaze::column( ~rhs, j, unchecked ), row, lhs.idx( column+j ) ) )
4153  return false;
4154  }
4155 
4156  return true;
4157 }
4159 //*************************************************************************************************
4160 
4161 
4162 //*************************************************************************************************
4179 template< typename MT // Type of the matrix
4180  , bool SO // Storage order
4181  , bool DF // Density flag
4182  , bool SF // Symmetry flag
4183  , typename... CCAs // Compile time column arguments
4184  , typename VT > // Type of the right-hand side vector
4185 inline bool tryBitxorAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4186  const Vector<VT,false>& rhs, size_t row, size_t column )
4187 {
4188  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4189  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4190  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
4191 
4192  return tryBitxorAssign( lhs.operand(), ~rhs, row, lhs.idx( column ) );
4193 }
4195 //*************************************************************************************************
4196 
4197 
4198 //*************************************************************************************************
4215 template< typename MT // Type of the matrix
4216  , bool SO // Storage order
4217  , bool DF // Density flag
4218  , bool SF // Symmetry flag
4219  , typename... CCAs // Compile time column arguments
4220  , typename VT > // Type of the right-hand side vector
4221 inline bool tryBitxorAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4222  const Vector<VT,true>& rhs, size_t row, size_t column )
4223 {
4224  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4225  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4226  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
4227 
4228  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
4229  if( !tryBitxor( lhs.operand(), row, lhs.idx( column+i ), (~rhs)[i] ) )
4230  return false;
4231  }
4232 
4233  return true;
4234 }
4236 //*************************************************************************************************
4237 
4238 
4239 //*************************************************************************************************
4257 template< typename MT // Type of the matrix
4258  , bool SO // Storage order
4259  , bool DF // Density flag
4260  , bool SF // Symmetry flag
4261  , typename... CCAs // Compile time column arguments
4262  , typename VT // Type of the right-hand side vector
4263  , bool TF > // Transpose flag of the right-hand side vector
4264 inline bool tryBitxorAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
4265  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
4266 {
4267  MAYBE_UNUSED( band );
4268 
4269  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4270  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4271  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
4272  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
4273 
4274  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
4275  if( !tryBitxor( lhs.operand(), row+i, lhs.idx( column+i ), (~rhs)[i] ) )
4276  return false;
4277  }
4278 
4279  return true;
4280 }
4282 //*************************************************************************************************
4283 
4284 
4285 //*************************************************************************************************
4302 template< typename MT1 // Type of the matrix
4303  , bool SO1 // Storage order
4304  , bool DF // Density flag
4305  , bool SF // Symmetry flag
4306  , typename... CCAs // Compile time column arguments
4307  , typename MT2 // Type of the right-hand side matrix
4308  , bool SO2 > // Storage order of the right-hand side matrix
4309 inline bool tryBitxorAssign( const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
4310  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
4311 {
4312  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
4313  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
4314  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
4315  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
4316 
4317  for( size_t j=0UL; j<(~rhs).columns(); ++j ) {
4318  if( !tryBitxorAssign( lhs.operand(), blaze::column( ~rhs, j, unchecked ), row, lhs.idx( column+j ) ) )
4319  return false;
4320  }
4321 
4322  return true;
4323 }
4325 //*************************************************************************************************
4326 
4327 
4328 //*************************************************************************************************
4343 template< typename MT // Type of the matrix
4344  , bool SO // Storage order
4345  , bool DF // Density flag
4346  , bool SF // Symmetry flag
4347  , typename... CCAs > // Compile time column arguments
4348 inline decltype(auto) derestrict( Columns<MT,SO,DF,SF,CCAs...>& c )
4349 {
4350  return columns( derestrict( c.operand() ), c.idces(), unchecked );
4351 }
4353 //*************************************************************************************************
4354 
4355 
4356 //*************************************************************************************************
4371 template< typename MT // Type of the matrix
4372  , bool SO // Storage order
4373  , bool DF // Density flag
4374  , bool SF // Symmetry flag
4375  , typename... CCAs > // Compile time column arguments
4376 inline decltype(auto) derestrict( Columns<MT,SO,DF,SF,CCAs...>&& c )
4377 {
4378  return columns( derestrict( c.operand() ), c.idces(), unchecked );
4379 }
4381 //*************************************************************************************************
4382 
4383 
4384 
4385 
4386 //=================================================================================================
4387 //
4388 // SIZE SPECIALIZATIONS
4389 //
4390 //=================================================================================================
4391 
4392 //*************************************************************************************************
4394 template< typename MT, bool SO, bool DF, bool SF, typename... CCAs >
4395 struct Size< Columns<MT,SO,DF,SF,CCAs...>, 0UL >
4396  : public Size<MT,0UL>
4397 {};
4398 
4399 template< typename MT, bool SO, bool DF, bool SF, size_t I, size_t... Is, typename... CCAs >
4400 struct Size< Columns<MT,SO,DF,SF,index_sequence<I,Is...>,CCAs...>, 1UL >
4401  : public Ptrdiff_t<1UL+sizeof...(Is)>
4402 {};
4404 //*************************************************************************************************
4405 
4406 
4407 
4408 
4409 //=================================================================================================
4410 //
4411 // MAXSIZE SPECIALIZATIONS
4412 //
4413 //=================================================================================================
4414 
4415 //*************************************************************************************************
4417 template< typename MT, bool SO, bool DF, bool SF, typename... CCAs >
4418 struct MaxSize< Columns<MT,SO,DF,SF,CCAs...>, 0UL >
4419  : public MaxSize<MT,0UL>
4420 {};
4421 
4422 template< typename MT, bool SO, bool DF, bool SF, size_t I, size_t... Is, typename... CCAs >
4423 struct MaxSize< Columns<MT,SO,DF,SF,index_sequence<I,Is...>,CCAs...>, 1UL >
4424  : public Ptrdiff_t<1UL+sizeof...(Is)>
4425 {};
4427 //*************************************************************************************************
4428 
4429 
4430 
4431 
4432 //=================================================================================================
4433 //
4434 // ISRESTRICTED SPECIALIZATIONS
4435 //
4436 //=================================================================================================
4437 
4438 //*************************************************************************************************
4440 template< typename MT, bool SO, bool DF, bool SF, typename... CCAs >
4441 struct IsRestricted< Columns<MT,SO,DF,SF,CCAs...> >
4442  : public IsRestricted<MT>
4443 {};
4445 //*************************************************************************************************
4446 
4447 
4448 
4449 
4450 //=================================================================================================
4451 //
4452 // HASCONSTDATAACCESS SPECIALIZATIONS
4453 //
4454 //=================================================================================================
4455 
4456 //*************************************************************************************************
4458 template< typename MT, bool SO, bool SF, typename... CCAs >
4459 struct HasConstDataAccess< Columns<MT,SO,true,SF,CCAs...> >
4460  : public HasConstDataAccess<MT>
4461 {};
4463 //*************************************************************************************************
4464 
4465 
4466 
4467 
4468 //=================================================================================================
4469 //
4470 // HASMUTABLEDATAACCESS SPECIALIZATIONS
4471 //
4472 //=================================================================================================
4473 
4474 //*************************************************************************************************
4476 template< typename MT, bool SO, bool SF, typename... CCAs >
4477 struct HasMutableDataAccess< Columns<MT,SO,true,SF,CCAs...> >
4478  : public HasMutableDataAccess<MT>
4479 {};
4481 //*************************************************************************************************
4482 
4483 
4484 
4485 
4486 //=================================================================================================
4487 //
4488 // ISALIGNED SPECIALIZATIONS
4489 //
4490 //=================================================================================================
4491 
4492 //*************************************************************************************************
4494 template< typename MT, bool SO, bool SF, typename... CCAs >
4495 struct IsAligned< Columns<MT,SO,true,SF,CCAs...> >
4496  : public IsAligned<MT>
4497 {};
4499 //*************************************************************************************************
4500 
4501 } // namespace blaze
4502 
4503 #endif
AlignmentFlag
Alignment flag for (un-)aligned vectors and matrices.Via these flags it is possible to specify subvec...
Definition: AlignmentFlag.h:62
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the implementation of the Columns base 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.
Columns specialization for sparse matrices.
Header file for the dense matrix inversion flags.
Header file for the IsColumnMajorMatrix type trait.
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
Columns specialization for dense matrices.
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 IsColumns type trait.
Header file for the DeclExpr base class.
Header file for the Matrix base class.
constexpr size_t columnwise
Reduction flag for column-wise reduction operations.
Definition: ReductionFlag.h:90
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 TVecMatMultExpr base class.
Header file for the integer_sequence and index_sequence aliases.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
Header file for the HasMutableDataAccess type trait.
#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.
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
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
Header file for the implementation of the ColumnData class template.
Header file for the MatScalarDivExpr base class.
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