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 <algorithm>
44 #include <array>
45 #include <vector>
46 #include <blaze/math/Aliases.h>
50 #include <blaze/math/Exception.h>
83 #include <blaze/math/views/Check.h>
89 #include <blaze/util/Assert.h>
91 #include <blaze/util/SmallVector.h>
92 #include <blaze/util/TypeList.h>
93 #include <blaze/util/Types.h>
94 #include <blaze/util/Unused.h>
95 
96 
97 namespace blaze {
98 
99 //=================================================================================================
100 //
101 // GLOBAL FUNCTIONS
102 //
103 //=================================================================================================
104 
105 //*************************************************************************************************
140 template< size_t I // First column index
141  , size_t... Is // Remaining column indices
142  , typename MT // Type of the matrix
143  , bool SO // Storage order
144  , typename... RCAs > // Optional arguments
145 inline decltype(auto) columns( Matrix<MT,SO>& matrix, RCAs... args )
146 {
148 
149  using ReturnType = Columns_<MT,I,Is...>;
150  return ReturnType( ~matrix, args... );
151 }
152 //*************************************************************************************************
153 
154 
155 //*************************************************************************************************
190 template< size_t I // First column index
191  , size_t... Is // Remaining column indices
192  , typename MT // Type of the matrix
193  , bool SO // Storage order
194  , typename... RCAs > // Optional arguments
195 inline decltype(auto) columns( const Matrix<MT,SO>& matrix, RCAs... args )
196 {
198 
199  using ReturnType = const Columns_<const MT,I,Is...>;
200  return ReturnType( ~matrix, args... );
201 }
202 //*************************************************************************************************
203 
204 
205 //*************************************************************************************************
219 template< size_t I // First column index
220  , size_t... Is // Remaining column indices
221  , typename MT // Type of the matrix
222  , bool SO // Storage order
223  , typename... RCAs > // Optional arguments
224 inline decltype(auto) columns( Matrix<MT,SO>&& matrix, RCAs... args )
225 {
227 
228  using ReturnType = Columns_<MT,I,Is...>;
229  return ReturnType( ~matrix, args... );
230 }
231 //*************************************************************************************************
232 
233 
234 //*************************************************************************************************
273 template< typename MT // Type of the matrix
274  , bool SO // Storage order
275  , typename T // Type of the column indices
276  , typename... RCAs > // Optional arguments
277 inline decltype(auto) columns( Matrix<MT,SO>& matrix, const T* indices, size_t n, RCAs... args )
278 {
280 
281  using ReturnType = Columns_<MT>;
282  return ReturnType( ~matrix, indices, n, args... );
283 }
284 //*************************************************************************************************
285 
286 
287 //*************************************************************************************************
327 template< typename MT // Type of the matrix
328  , bool SO // Storage order
329  , typename T // Type of the column indices
330  , typename... RCAs > // Optional arguments
331 inline decltype(auto) columns( const Matrix<MT,SO>& matrix, const T* indices, size_t n, RCAs... args )
332 {
334 
335  using ReturnType = const Columns_<const MT>;
336  return ReturnType( ~matrix, indices, n, args... );
337 }
338 //*************************************************************************************************
339 
340 
341 //*************************************************************************************************
356 template< typename MT // Type of the matrix
357  , bool SO // Storage order
358  , typename T // Type of the column indices
359  , typename... RCAs > // Optional arguments
360 inline decltype(auto) columns( Matrix<MT,SO>&& matrix, const T* indices, size_t n, RCAs... args )
361 {
363 
364  using ReturnType = Columns_<MT>;
365  return ReturnType( ~matrix, indices, n, args... );
366 }
367 //*************************************************************************************************
368 
369 
370 //*************************************************************************************************
386 template< typename MT // Type of the matrix
387  , size_t... Is // Column indices
388  , typename... RCAs > // Optional arguments
389 inline decltype(auto) columns( MT&& matrix, index_sequence<Is...> indices, RCAs... args )
390 {
392 
393  UNUSED_PARAMETER( indices );
394 
395  return columns<Is...>( std::forward<MT>( matrix ), args... );
396 }
398 //*************************************************************************************************
399 
400 
401 //*************************************************************************************************
417 template< typename MT // Type of the matrix
418  , typename T // Type of the column indices
419  , typename... RCAs > // Optional arguments
420 inline decltype(auto) columns( MT&& matrix, initializer_list<T> indices, RCAs... args )
421 {
423 
424  return columns( std::forward<MT>( matrix ), indices.begin(), indices.size(), args... );
425 }
427 //*************************************************************************************************
428 
429 
430 //*************************************************************************************************
446 template< typename MT // Type of the matrix
447  , typename T // Type of the column indices
448  , size_t N // Number of indices
449  , typename... RCAs > // Optional arguments
450 inline decltype(auto) columns( MT&& matrix, const std::array<T,N>& indices, RCAs... args )
451 {
453 
454  return columns( std::forward<MT>( matrix ), indices.data(), N, args... );
455 }
457 //*************************************************************************************************
458 
459 
460 //*************************************************************************************************
476 template< typename MT // Type of the matrix
477  , typename T // Type of the column indices
478  , typename... RCAs > // Optional arguments
479 inline decltype(auto) columns( MT&& matrix, const std::vector<T>& indices, RCAs... args )
480 {
482 
483  return columns( std::forward<MT>( matrix ), indices.data(), indices.size(), args... );
484 }
486 //*************************************************************************************************
487 
488 
489 //*************************************************************************************************
505 template< typename MT // Type of the matrix
506  , typename T // Type of the column indices
507  , size_t N // Number of preallocated elements
508  , typename... RCAs > // Optional arguments
509 inline decltype(auto) columns( MT&& matrix, const SmallVector<T,N>& indices, RCAs... args )
510 {
512 
513  return columns( std::forward<MT>( matrix ), indices.data(), indices.size(), args... );
514 }
516 //*************************************************************************************************
517 
518 
519 
520 
521 //=================================================================================================
522 //
523 // GLOBAL RESTRUCTURING FUNCTIONS
524 //
525 //=================================================================================================
526 
527 //*************************************************************************************************
539 template< size_t... CCAs // Compile time column arguments
540  , typename MT // Matrix base type of the expression
541  , typename... RCAs // Runtime column arguments
542  , typename = EnableIfTrue_< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) > >
543 inline decltype(auto) columns( const MatMatAddExpr<MT>& matrix, RCAs... args )
544 {
546 
547  return columns<CCAs...>( (~matrix).leftOperand(), args... ) +
548  columns<CCAs...>( (~matrix).rightOperand(), args... );
549 }
551 //*************************************************************************************************
552 
553 
554 //*************************************************************************************************
566 template< size_t... CCAs // Compile time column arguments
567  , typename MT // Matrix base type of the expression
568  , typename... RCAs // Runtime column arguments
569  , typename = EnableIfTrue_< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) > >
570 inline decltype(auto) columns( const MatMatSubExpr<MT>& matrix, RCAs... args )
571 {
573 
574  return columns<CCAs...>( (~matrix).leftOperand(), args... ) -
575  columns<CCAs...>( (~matrix).rightOperand(), args... );
576 }
578 //*************************************************************************************************
579 
580 
581 //*************************************************************************************************
593 template< size_t... CCAs // Compile time column arguments
594  , typename MT // Matrix base type of the expression
595  , typename... RCAs // Runtime column arguments
596  , typename = EnableIfTrue_< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) > >
597 inline decltype(auto) columns( const SchurExpr<MT>& matrix, RCAs... args )
598 {
600 
601  return columns<CCAs...>( (~matrix).leftOperand(), args... ) %
602  columns<CCAs...>( (~matrix).rightOperand(), args... );
603 }
605 //*************************************************************************************************
606 
607 
608 //*************************************************************************************************
620 template< size_t... CCAs // Compile time column arguments
621  , typename MT // Matrix base type of the expression
622  , typename... RCAs // Runtime column arguments
623  , typename = EnableIfTrue_< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) > >
624 inline decltype(auto) columns( const MatMatMultExpr<MT>& matrix, RCAs... args )
625 {
627 
628  return (~matrix).leftOperand() * columns<CCAs...>( (~matrix).rightOperand(), args... );
629 }
631 //*************************************************************************************************
632 
633 
634 //*************************************************************************************************
646 template< size_t... CCAs // Compile time column arguments
647  , typename MT // Matrix base type of the expression
648  , typename... RCAs // Runtime column arguments
649  , typename = EnableIfTrue_< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) > >
650 inline decltype(auto) columns( const VecTVecMultExpr<MT>& matrix, RCAs... args )
651 {
653 
654  return (~matrix).leftOperand() * elements<CCAs...>( (~matrix).rightOperand(), args... );
655 }
657 //*************************************************************************************************
658 
659 
660 //*************************************************************************************************
672 template< size_t... CCAs // Compile time column arguments
673  , typename MT // Matrix base type of the expression
674  , typename... RCAs // Runtime column arguments
675  , typename = EnableIfTrue_< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) > >
676 inline decltype(auto) columns( const MatScalarMultExpr<MT>& matrix, RCAs... args )
677 {
679 
680  return columns<CCAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
681 }
683 //*************************************************************************************************
684 
685 
686 //*************************************************************************************************
698 template< size_t... CCAs // Compile time column arguments
699  , typename MT // Matrix base type of the expression
700  , typename... RCAs // Runtime column arguments
701  , typename = EnableIfTrue_< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) > >
702 inline decltype(auto) columns( const MatScalarDivExpr<MT>& matrix, RCAs... args )
703 {
705 
706  return columns<CCAs...>( (~matrix).leftOperand(), args... ) / (~matrix).rightOperand();
707 }
709 //*************************************************************************************************
710 
711 
712 //*************************************************************************************************
724 template< size_t... CCAs // Compile time column arguments
725  , typename MT // Matrix base type of the expression
726  , typename... RCAs // Runtime column arguments
727  , typename = EnableIfTrue_< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) > >
728 inline decltype(auto) columns( const MatMapExpr<MT>& matrix, RCAs... args )
729 {
731 
732  return map( columns<CCAs...>( (~matrix).operand(), args... ), (~matrix).operation() );
733 }
735 //*************************************************************************************************
736 
737 
738 //*************************************************************************************************
750 template< size_t... CCAs // Compile time column arguments
751  , typename MT // Matrix base type of the expression
752  , typename... RCAs // Runtime column arguments
753  , typename = EnableIfTrue_< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) > >
754 inline decltype(auto) columns( const MatMatMapExpr<MT>& matrix, RCAs... args )
755 {
757 
758  return map( columns<CCAs...>( (~matrix).leftOperand(), args... ),
759  columns<CCAs...>( (~matrix).rightOperand(), args... ),
760  (~matrix).operation() );
761 }
763 //*************************************************************************************************
764 
765 
766 //*************************************************************************************************
778 template< size_t... CCAs // Compile time column arguments
779  , typename MT // Matrix base type of the expression
780  , typename... RCAs // Runtime column arguments
781  , typename = EnableIfTrue_< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) > >
782 inline decltype(auto) columns( const MatEvalExpr<MT>& matrix, RCAs... args )
783 {
785 
786  return eval( columns<CCAs...>( (~matrix).operand(), args... ) );
787 }
789 //*************************************************************************************************
790 
791 
792 //*************************************************************************************************
804 template< size_t... CCAs // Compile time column arguments
805  , typename MT // Matrix base type of the expression
806  , typename... RCAs // Runtime column arguments
807  , typename = EnableIfTrue_< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) > >
808 inline decltype(auto) columns( const MatSerialExpr<MT>& matrix, RCAs... args )
809 {
811 
812  return serial( columns<CCAs...>( (~matrix).operand(), args... ) );
813 }
815 //*************************************************************************************************
816 
817 
818 //*************************************************************************************************
830 template< size_t... CCAs // Compile time column arguments
831  , typename MT // Matrix base type of the expression
832  , typename... RCAs // Runtime column arguments
833  , typename = EnableIfTrue_< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) > >
834 inline decltype(auto) columns( const DeclExpr<MT>& matrix, RCAs... args )
835 {
837 
838  return columns<CCAs...>( (~matrix).operand(), args... );
839 }
841 //*************************************************************************************************
842 
843 
844 //*************************************************************************************************
856 template< size_t... CCAs // Compile time column arguments
857  , typename MT // Matrix base type of the expression
858  , typename... RCAs // Runtime column arguments
859  , typename = EnableIfTrue_< ( sizeof...( CCAs ) + sizeof...( RCAs ) > 0UL ) > >
860 inline decltype(auto) columns( const MatTransExpr<MT>& matrix, RCAs... args )
861 {
863 
864  return trans( rows<CCAs...>( (~matrix).operand(), args... ) );
865 }
867 //*************************************************************************************************
868 
869 
870 //*************************************************************************************************
882 template< size_t I1 // First required column index
883  , size_t... Is1 // Remaining required column indices
884  , typename MT // Type of the matrix
885  , bool SO // Storage order
886  , bool DF // Density flag
887  , bool SF // Symmetry flag
888  , size_t I2 // First present column index
889  , size_t... Is2 // Remaining present column indices
890  , typename... RCAs > // Optional column arguments
891 inline decltype(auto) columns( Columns<MT,SO,DF,SF,I2,Is2...>& c, RCAs... args )
892 {
894 
895  static constexpr size_t indices[] = { I2, Is2... };
896  return columns< indices[I1], indices[Is1]... >( c.operand(), args... );
897 }
899 //*************************************************************************************************
900 
901 
902 //*************************************************************************************************
914 template< size_t I1 // First required column index
915  , size_t... Is1 // Remaining required column indices
916  , typename MT // Type of the matrix
917  , bool SO // Storage order
918  , bool DF // Density flag
919  , bool SF // Symmetry flag
920  , size_t I2 // First present column index
921  , size_t... Is2 // Remaining present column indices
922  , typename... RCAs > // Optional column arguments
923 inline decltype(auto) columns( const Columns<MT,SO,DF,SF,I2,Is2...>& c, RCAs... args )
924 {
926 
927  static constexpr size_t indices[] = { I2, Is2... };
928  return columns< indices[I1], indices[Is1]... >( c.operand(), args... );
929 }
931 //*************************************************************************************************
932 
933 
934 //*************************************************************************************************
946 template< size_t I1 // First required column index
947  , size_t... Is1 // Remaining required column indices
948  , typename MT // Type of the matrix
949  , bool SO // Storage order
950  , bool DF // Density flag
951  , bool SF // Symmetry flag
952  , size_t I2 // First present column index
953  , size_t... Is2 // Remaining present column indices
954  , typename... RCAs > // Optional column arguments
955 inline decltype(auto) columns( Columns<MT,SO,DF,SF,I2,Is2...>&& c, RCAs... args )
956 {
958 
959  static constexpr size_t indices[] = { I2, Is2... };
960  return columns< indices[I1], indices[Is1]... >( c.operand(), args... );
961 }
963 //*************************************************************************************************
964 
965 
966 //*************************************************************************************************
979 template< size_t I // First required column index
980  , size_t... Is // Remaining required column indices
981  , typename MT // Type of the matrix
982  , bool SO // Storage order
983  , bool DF // Density flag
984  , bool SF // Symmetry flag
985  , size_t... CCAs // Compile time column arguments
986  , typename... RCAs > // Optional column arguments
987 inline decltype(auto) columns( Columns<MT,SO,DF,SF,CCAs...>& c, RCAs... args )
988 {
990 
991  constexpr bool isChecked( !Contains< TypeList<RCAs...>, Unchecked >::value );
992 
993  if( isChecked ) {
994  static constexpr size_t indices[] = { I, Is... };
995  for( size_t i=0UL; i<sizeof...(Is)+1UL; ++i ) {
996  if( c.columns() <= indices[i] ) {
997  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
998  }
999  }
1000  }
1001 
1002  decltype(auto) indices( c.idces() );
1003  return columns( c.operand(), { indices[I], indices[Is]... }, args... );
1004 }
1006 //*************************************************************************************************
1007 
1008 
1009 //*************************************************************************************************
1022 template< size_t I // First required column index
1023  , size_t... Is // Remaining required column indices
1024  , typename MT // Type of the matrix
1025  , bool SO // Storage order
1026  , bool DF // Density flag
1027  , bool SF // Symmetry flag
1028  , size_t... CCAs // Compile time column arguments
1029  , typename... RCAs > // Optional column arguments
1030 inline decltype(auto) columns( const Columns<MT,SO,DF,SF,CCAs...>& c, RCAs... args )
1031 {
1033 
1034  constexpr bool isChecked( !Contains< TypeList<RCAs...>, Unchecked >::value );
1035 
1036  if( isChecked ) {
1037  static constexpr size_t indices[] = { I, Is... };
1038  for( size_t i=0UL; i<sizeof...(Is)+1UL; ++i ) {
1039  if( c.columns() <= indices[i] ) {
1040  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
1041  }
1042  }
1043  }
1044 
1045  decltype(auto) indices( c.idces() );
1046  return columns( c.operand(), { indices[I], indices[Is]... }, args... );
1047 }
1049 //*************************************************************************************************
1050 
1051 
1052 //*************************************************************************************************
1065 template< size_t I // First required column index
1066  , size_t... Is // Remaining required column indices
1067  , typename MT // Type of the matrix
1068  , bool SO // Storage order
1069  , bool DF // Density flag
1070  , bool SF // Symmetry flag
1071  , size_t... CCAs // Compile time column arguments
1072  , typename... RCAs > // Optional column arguments
1073 inline decltype(auto) columns( Columns<MT,SO,DF,SF,CCAs...>&& c, RCAs... args )
1074 {
1076 
1077  constexpr bool isChecked( !Contains< TypeList<RCAs...>, Unchecked >::value );
1078 
1079  if( isChecked ) {
1080  static constexpr size_t indices[] = { I, Is... };
1081  for( size_t i=0UL; i<sizeof...(Is)+1UL; ++i ) {
1082  if( c.columns() <= indices[i] ) {
1083  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
1084  }
1085  }
1086  }
1087 
1088  decltype(auto) indices( c.idces() );
1089  return columns( c.operand(), { indices[I], indices[Is]... }, args... );
1090 }
1092 //*************************************************************************************************
1093 
1094 
1095 //*************************************************************************************************
1110 template< typename MT // Type of the matrix
1111  , bool SO // Storage order
1112  , bool DF // Density flag
1113  , bool SF // Symmetry flag
1114  , size_t... CCAs // Compile time column arguments
1115  , typename T // Type of the column indices
1116  , typename... RCAs > // Optional column arguments
1117 inline decltype(auto) columns( Columns<MT,SO,DF,SF,CCAs...>& c, const T* indices, size_t n, RCAs... args )
1118 {
1120 
1121  constexpr bool isChecked( !Contains< TypeList<RCAs...>, Unchecked >::value );
1122 
1123  if( isChecked ) {
1124  for( size_t i=0UL; i<n; ++i ) {
1125  if( c.columns() <= indices[i] ) {
1126  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
1127  }
1128  }
1129  }
1130 
1131  decltype(auto) oldIndices( c.idces() );
1132  SmallVector<size_t,128UL> newIndices;
1133  newIndices.reserve( n );
1134 
1135  for( size_t i=0UL; i<n; ++i ) {
1136  newIndices.pushBack( oldIndices[indices[i]] );
1137  }
1138 
1139  return columns( c.operand(), newIndices.data(), newIndices.size(), args... );
1140 }
1142 //*************************************************************************************************
1143 
1144 
1145 //*************************************************************************************************
1160 template< typename MT // Type of the matrix
1161  , bool SO // Storage order
1162  , bool DF // Density flag
1163  , bool SF // Symmetry flag
1164  , size_t... CCAs // Compile time column arguments
1165  , typename T // Type of the column indices
1166  , typename... RCAs > // Optional column arguments
1167 inline decltype(auto) columns( const Columns<MT,SO,DF,SF,CCAs...>& c, const T* indices, size_t n, RCAs... args )
1168 {
1170 
1171  constexpr bool isChecked( !Contains< TypeList<RCAs...>, Unchecked >::value );
1172 
1173  if( isChecked ) {
1174  for( size_t i=0UL; i<n; ++i ) {
1175  if( c.columns() <= indices[i] ) {
1176  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
1177  }
1178  }
1179  }
1180 
1181  decltype(auto) oldIndices( c.idces() );
1182  SmallVector<size_t,128UL> newIndices;
1183  newIndices.reserve( n );
1184 
1185  for( size_t i=0UL; i<n; ++i ) {
1186  newIndices.pushBack( oldIndices[indices[i]] );
1187  }
1188 
1189  return columns( c.operand(), newIndices.data(), newIndices.size(), args... );
1190 }
1192 //*************************************************************************************************
1193 
1194 
1195 //*************************************************************************************************
1210 template< typename MT // Type of the matrix
1211  , bool SO // Storage order
1212  , bool DF // Density flag
1213  , bool SF // Symmetry flag
1214  , size_t... CCAs // Compile time column arguments
1215  , typename T // Type of the column indices
1216  , typename... RCAs > // Optional column arguments
1217 inline decltype(auto) columns( Columns<MT,SO,DF,SF,CCAs...>&& c, const T* indices, size_t n, RCAs... args )
1218 {
1220 
1221  constexpr bool isChecked( !Contains< TypeList<RCAs...>, Unchecked >::value );
1222 
1223  if( isChecked ) {
1224  for( size_t i=0UL; i<n; ++i ) {
1225  if( c.columns() <= indices[i] ) {
1226  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
1227  }
1228  }
1229  }
1230 
1231  decltype(auto) oldIndices( c.idces() );
1232  SmallVector<size_t,128UL> newIndices;
1233  newIndices.reserve( n );
1234 
1235  for( size_t i=0UL; i<n; ++i ) {
1236  newIndices.pushBack( oldIndices[indices[i]] );
1237  }
1238 
1239  return columns( c.operand(), newIndices.data(), newIndices.size(), args... );
1240 }
1242 //*************************************************************************************************
1243 
1244 
1245 
1246 
1247 //=================================================================================================
1248 //
1249 // GLOBAL RESTRUCTURING FUNCTIONS (ELEMENTS)
1250 //
1251 //=================================================================================================
1252 
1253 //*************************************************************************************************
1265 template< size_t... CEAs // Compile time element arguments
1266  , typename VT // Vector base type of the expression
1267  , typename... REAs > // Runtime element arguments
1268 inline decltype(auto) elements( const TVecMatMultExpr<VT>& vector, REAs... args )
1269 {
1271 
1272  return (~vector).leftOperand() * columns<CEAs...>( (~vector).rightOperand(), args... );
1273 }
1275 //*************************************************************************************************
1276 
1277 
1278 
1279 
1280 //=================================================================================================
1281 //
1282 // GLOBAL RESTRUCTURING FUNCTIONS (ROW)
1283 //
1284 //=================================================================================================
1285 
1286 //*************************************************************************************************
1297 template< size_t... CRAs // Compile time row arguments
1298  , typename MT // Type of the matrix
1299  , bool SO // Storage order
1300  , bool DF // Density flag
1301  , bool SF // Symmetry flag
1302  , size_t I // First column index
1303  , size_t... Is // Remaining column indices
1304  , typename... RRAs > // Runtime row arguments
1305 inline decltype(auto) row( Columns<MT,SO,DF,SF,I,Is...>& columns, RRAs... args )
1306 {
1308 
1309  return elements<I,Is...>( row<CRAs...>( columns.operand(), args... ) );
1310 }
1312 //*************************************************************************************************
1313 
1314 
1315 //*************************************************************************************************
1327 template< size_t... CRAs // Compile time row arguments
1328  , typename MT // Type of the matrix
1329  , bool SO // Storage order
1330  , bool DF // Density flag
1331  , bool SF // Symmetry flag
1332  , size_t I // First column index
1333  , size_t... Is // Remaining column indices
1334  , typename... RRAs > // Runtime row arguments
1335 inline decltype(auto) row( const Columns<MT,SO,DF,SF,I,Is...>& columns, RRAs... args )
1336 {
1338 
1339  return elements<I,Is...>( row<CRAs...>( columns.operand(), args... ) );
1340 }
1342 //*************************************************************************************************
1343 
1344 
1345 //*************************************************************************************************
1357 template< size_t... CRAs // Compile time row arguments
1358  , typename MT // Type of the matrix
1359  , bool SO // Storage order
1360  , bool DF // Density flag
1361  , bool SF // Symmetry flag
1362  , size_t I // First column index
1363  , size_t... Is // Remaining column indices
1364  , typename... RRAs > // Runtime row arguments
1365 inline decltype(auto) row( Columns<MT,SO,DF,SF,I,Is...>&& columns, RRAs... args )
1366 {
1368 
1369  return elements<I,Is...>( row<CRAs...>( columns.operand(), args... ) );
1370 }
1372 //*************************************************************************************************
1373 
1374 
1375 //*************************************************************************************************
1386 template< size_t... CRAs // Compile time row arguments
1387  , typename MT // Type of the matrix
1388  , bool SO // Storage order
1389  , bool DF // Density flag
1390  , bool SF // Symmetry flag
1391  , typename... RRAs > // Runtime row arguments
1392 inline decltype(auto) row( Columns<MT,SO,DF,SF>& columns, RRAs... args )
1393 {
1395 
1396  return elements( row<CRAs...>( columns.operand(), args... ), columns.idces() );
1397 }
1399 //*************************************************************************************************
1400 
1401 
1402 //*************************************************************************************************
1414 template< size_t... CRAs // Compile time row arguments
1415  , typename MT // Type of the matrix
1416  , bool SO // Storage order
1417  , bool DF // Density flag
1418  , bool SF // Symmetry flag
1419  , typename... RRAs > // Runtime row arguments
1420 inline decltype(auto) row( const Columns<MT,SO,DF,SF>& columns, RRAs... args )
1421 {
1423 
1424  return elements( row<CRAs...>( columns.operand(), args... ), columns.idces() );
1425 }
1427 //*************************************************************************************************
1428 
1429 
1430 //*************************************************************************************************
1442 template< size_t... CRAs // Compile time row arguments
1443  , typename MT // Type of the matrix
1444  , bool SO // Storage order
1445  , bool DF // Density flag
1446  , bool SF // Symmetry flag
1447  , typename... RRAs > // Runtime row arguments
1448 inline decltype(auto) row( Columns<MT,SO,DF,SF>&& columns, RRAs... args )
1449 {
1451 
1452  return elements( row<CRAs...>( columns.operand(), args... ), columns.idces() );
1453 }
1455 //*************************************************************************************************
1456 
1457 
1458 
1459 
1460 //=================================================================================================
1461 //
1462 // GLOBAL RESTRUCTURING FUNCTIONS (COLUMN)
1463 //
1464 //=================================================================================================
1465 
1466 //*************************************************************************************************
1478 template< size_t I1 // Column index
1479  , typename MT // Type of the matrix
1480  , bool SO // Storage order
1481  , bool DF // Density flag
1482  , bool SF // Symmetry flag
1483  , size_t I2 // First column index
1484  , size_t... Is // Remaining column indices
1485  , typename... RCAs > // Optional column arguments
1486 inline decltype(auto) column( Columns<MT,SO,DF,SF,I2,Is...>& columns, RCAs... args )
1487 {
1489 
1490  static constexpr size_t indices[] = { I2, Is... };
1491  return column<indices[I1]>( columns.operand(), args... );
1492 }
1494 //*************************************************************************************************
1495 
1496 
1497 //*************************************************************************************************
1509 template< size_t I1 // Column index
1510  , typename MT // Type of the matrix
1511  , bool SO // Storage order
1512  , bool DF // Density flag
1513  , bool SF // Symmetry flag
1514  , size_t I2 // First column index
1515  , size_t... Is // Remaining column indices
1516  , typename... RCAs > // Optional column arguments
1517 inline decltype(auto) column( const Columns<MT,SO,DF,SF,I2,Is...>& columns, RCAs... args )
1518 {
1520 
1521  static constexpr size_t indices[] = { I2, Is... };
1522  return column<indices[I1]>( columns.operand(), args... );
1523 }
1525 //*************************************************************************************************
1526 
1527 
1528 //*************************************************************************************************
1540 template< size_t I1 // Column index
1541  , typename MT // Type of the matrix
1542  , bool SO // Storage order
1543  , bool DF // Density flag
1544  , bool SF // Symmetry flag
1545  , size_t I2 // First column index
1546  , size_t... Is // Remaining column indices
1547  , typename... RCAs > // Optional column arguments
1548 inline decltype(auto) column( Columns<MT,SO,DF,SF,I2,Is...>&& columns, RCAs... args )
1549 {
1551 
1552  static constexpr size_t indices[] = { I2, Is... };
1553  return column<indices[I1]>( columns.operand(), args... );
1554 }
1556 //*************************************************************************************************
1557 
1558 
1559 //*************************************************************************************************
1572 template< size_t... CCAs1 // Compile time column arguments
1573  , typename MT // Type of the matrix
1574  , bool SO // Storage order
1575  , bool DF // Density flag
1576  , bool SF // Symmetry flag
1577  , size_t... CCAs2 // Compile time column arguments
1578  , typename... RCAs > // Runtime column arguments
1579 inline decltype(auto) column( Columns<MT,SO,DF,SF,CCAs2...>& columns, RCAs... args )
1580 {
1582 
1583  const ColumnData<CCAs1...> cd( args... );
1584  decltype(auto) indices( columns.idces() );
1585 
1586  constexpr bool isChecked( !Contains< TypeList<RCAs...>, Unchecked >::value );
1587 
1588  if( isChecked ) {
1589  if( indices.size() <= cd.column() ) {
1590  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
1591  }
1592  }
1593 
1594  return column( columns.operand(), indices[cd.column()], args... );
1595 }
1597 //*************************************************************************************************
1598 
1599 
1600 //*************************************************************************************************
1613 template< size_t... CCAs1 // Compile time column arguments
1614  , typename MT // Type of the matrix
1615  , bool SO // Storage order
1616  , bool DF // Density flag
1617  , bool SF // Symmetry flag
1618  , size_t... CCAs2 // Compile time column arguments
1619  , typename... RCAs > // Runtime column arguments
1620 inline decltype(auto) column( const Columns<MT,SO,DF,SF,CCAs2...>& columns, RCAs... args )
1621 {
1623 
1624  const ColumnData<CCAs1...> cd( args... );
1625  decltype(auto) indices( columns.idces() );
1626 
1627  constexpr bool isChecked( !Contains< TypeList<RCAs...>, Unchecked >::value );
1628 
1629  if( isChecked ) {
1630  if( indices.size() <= cd.column() ) {
1631  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
1632  }
1633  }
1634 
1635  return column( columns.operand(), indices[cd.column()], args... );
1636 }
1638 //*************************************************************************************************
1639 
1640 
1641 //*************************************************************************************************
1654 template< size_t... CCAs1 // Compile time column arguments
1655  , typename MT // Type of the matrix
1656  , bool SO // Storage order
1657  , bool DF // Density flag
1658  , bool SF // Symmetry flag
1659  , size_t... CCAs2 // Compile time column arguments
1660  , typename... RCAs > // Runtime column arguments
1661 inline decltype(auto) column( Columns<MT,SO,DF,SF,CCAs2...>&& columns, RCAs... args )
1662 {
1664 
1665  const ColumnData<CCAs1...> cd( args... );
1666  decltype(auto) indices( columns.idces() );
1667 
1668  constexpr bool isChecked( !Contains< TypeList<RCAs...>, Unchecked >::value );
1669 
1670  if( isChecked ) {
1671  if( indices.size() <= cd.column() ) {
1672  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
1673  }
1674  }
1675 
1676  return column( columns.operand(), indices[cd.column()], args... );
1677 }
1679 //*************************************************************************************************
1680 
1681 
1682 
1683 
1684 //=================================================================================================
1685 //
1686 // COLUMNS OPERATORS
1687 //
1688 //=================================================================================================
1689 
1690 //*************************************************************************************************
1698 template< typename MT // Type of the matrix
1699  , bool SO // Storage order
1700  , bool DF // Density flag
1701  , bool SF // Symmetry flag
1702  , size_t... CCAs > // Compile time column arguments
1703 inline void reset( Columns<MT,SO,DF,SF,CCAs...>& columns )
1704 {
1705  columns.reset();
1706 }
1708 //*************************************************************************************************
1709 
1710 
1711 //*************************************************************************************************
1719 template< typename MT // Type of the matrix
1720  , bool SO // Storage order
1721  , bool DF // Density flag
1722  , bool SF // Symmetry flag
1723  , size_t... CCAs > // Compile time column arguments
1724 inline void reset( Columns<MT,SO,DF,SF,CCAs...>&& columns )
1725 {
1726  columns.reset();
1727 }
1729 //*************************************************************************************************
1730 
1731 
1732 //*************************************************************************************************
1744 template< typename MT // Type of the matrix
1745  , bool SO // Storage order
1746  , bool DF // Density flag
1747  , bool SF // Symmetry flag
1748  , size_t... CCAs > // Compile time column arguments
1749 inline void reset( Columns<MT,SO,DF,SF,CCAs...>& columns, size_t i )
1750 {
1751  columns.reset( i );
1752 }
1754 //*************************************************************************************************
1755 
1756 
1757 //*************************************************************************************************
1767 template< typename MT // Type of the matrix
1768  , bool SO // Storage order
1769  , bool DF // Density flag
1770  , bool SF // Symmetry flag
1771  , size_t... CCAs > // Compile time column arguments
1772 inline void clear( Columns<MT,SO,DF,SF,CCAs...>& columns )
1773 {
1774  columns.reset();
1775 }
1777 //*************************************************************************************************
1778 
1779 
1780 //*************************************************************************************************
1790 template< typename MT // Type of the matrix
1791  , bool SO // Storage order
1792  , bool DF // Density flag
1793  , bool SF // Symmetry flag
1794  , size_t... CCAs > // Compile time column arguments
1795 inline void clear( Columns<MT,SO,DF,SF,CCAs...>&& columns )
1796 {
1797  columns.reset();
1798 }
1800 //*************************************************************************************************
1801 
1802 
1803 //*************************************************************************************************
1829 template< bool RF // Relaxation flag
1830  , typename MT // Type of the dense matrix
1831  , bool SO // Storage order
1832  , bool SF // Symmetry flag
1833  , size_t... CCAs > // Compile time column arguments
1834 inline bool isDefault( const Columns<MT,SO,true,SF,CCAs...>& columns )
1835 {
1836  using blaze::isDefault;
1837 
1838  if( SO == false ) {
1839  for( size_t i=0UL; i<columns.rows(); ++i )
1840  for( size_t j=0UL; j<columns.columns(); ++j )
1841  if( !isDefault<RF>( columns(i,j) ) )
1842  return false;
1843  }
1844  else {
1845  for( size_t j=0UL; j<columns.columns(); ++j )
1846  for( size_t i=0UL; i<columns.rows(); ++i )
1847  if( !isDefault<RF>( columns(i,j) ) )
1848  return false;
1849  }
1850 
1851  return true;
1852 }
1854 //*************************************************************************************************
1855 
1856 
1857 //*************************************************************************************************
1883 template< bool RF // Relaxation flag
1884  , typename MT // Type of the dense matrix
1885  , bool SO // Storage order
1886  , bool SF // Symmetry flag
1887  , size_t... CCAs > // Compile time column arguments
1888 inline bool isDefault( const Columns<MT,SO,false,SF,CCAs...>& columns )
1889 {
1890  using blaze::isDefault;
1891 
1892  for( size_t j=0UL; j<columns.columns(); ++j ) {
1893  for( auto element=columns.cbegin(j); element!=columns.cend(j); ++element )
1894  if( !isDefault<RF>( element->value() ) ) return false;
1895  }
1896 
1897  return true;
1898 }
1900 //*************************************************************************************************
1901 
1902 
1903 //*************************************************************************************************
1921 template< typename MT // Type of the matrix
1922  , bool SO // Storage order
1923  , bool DF // Density flag
1924  , bool SF // Symmetry flag
1925  , size_t... CCAs > // Compile time column arguments
1926 inline bool isIntact( const Columns<MT,SO,DF,SF,CCAs...>& columns ) noexcept
1927 {
1928  return ( columns.rows() == columns.operand().rows() &&
1929  columns.columns() <= columns.operand().columns() &&
1930  isIntact( columns.operand() ) );
1931 }
1933 //*************************************************************************************************
1934 
1935 
1936 //*************************************************************************************************
1949 template< typename MT // Type of the matrix
1950  , bool SO1 // Storage order of the left-hand side column selection
1951  , bool DF // Density flag
1952  , bool SF // Symmetry flag
1953  , size_t... CCAs // Compile time column arguments
1954  , bool SO2 > // Storage order of the right-hand side matrix
1955 inline bool isSame( const Columns<MT,SO1,DF,SF,CCAs...>& a, const Matrix<MT,SO2>& b ) noexcept
1956 {
1957  if( !isSame( a.operand(), ~b ) || ( a.rows() != (~b).rows() ) || ( a.columns() != (~b).columns() ) )
1958  return false;
1959 
1960  decltype(auto) indices( a.idces() );
1961  for( size_t j=0UL; j<a.columns(); ++j ) {
1962  if( indices[j] != j )
1963  return false;
1964  }
1965 
1966  return true;
1967 }
1969 //*************************************************************************************************
1970 
1971 
1972 //*************************************************************************************************
1985 template< typename MT // Type of the matrix
1986  , bool SO1 // Storage order of the left-hand side matrix
1987  , bool DF // Density flag
1988  , bool SF // Symmetry flag
1989  , size_t... CCAs // Compile time column arguments
1990  , bool SO2 > // Storage order of the right-hand side column selection
1991 inline bool isSame( const Matrix<MT,SO1>& a, const Columns<MT,SO2,DF,SF,CCAs...>& b ) noexcept
1992 {
1993  return isSame( b, a );
1994 }
1996 //*************************************************************************************************
1997 
1998 
1999 //*************************************************************************************************
2012 template< typename MT // Type of the matrix
2013  , bool SO1 // Storage order of the left-hand side column selection
2014  , bool DF // Density flag
2015  , bool SF // Symmetry flag
2016  , size_t... CCAs // Compile time column arguments
2017  , AlignmentFlag AF // Alignment flag
2018  , bool SO2 // Storage order of the right-hand side submatrix
2019  , size_t... CSAs > // Compile time submatrix arguments
2020 inline bool isSame( const Columns<MT,SO1,DF,SF,CCAs...>& a, const Submatrix<MT,AF,SO2,DF,CSAs...>& b ) noexcept
2021 {
2022  if( !isSame( a.operand(), b.operand() ) || ( a.rows() != (~b).rows() ) || ( a.columns() != (~b).columns() ) )
2023  return false;
2024 
2025  decltype(auto) indices( a.idces() );
2026  for( size_t j=0UL; j<a.columns(); ++j ) {
2027  if( indices[j] != b.column()+j )
2028  return false;
2029  }
2030 
2031  return true;
2032 }
2034 //*************************************************************************************************
2035 
2036 
2037 //*************************************************************************************************
2050 template< typename MT // Type of the matrix
2051  , AlignmentFlag AF // Alignment flag
2052  , bool SO1 // Storage order of the left-hand side submatrix
2053  , bool DF // Density flag
2054  , size_t... CSAs // Compile time submatrix arguments
2055  , bool SO2 // Storage order of the right-hand side column selection
2056  , bool SF // Symmetry flag
2057  , size_t... CCAs > // Compile time column arguments
2058 inline bool isSame( const Submatrix<MT,AF,SO1,DF,CSAs...>& a, const Columns<MT,SO2,DF,SF,CCAs...>& b ) noexcept
2059 {
2060  return isSame( b, a );
2061 }
2063 //*************************************************************************************************
2064 
2065 
2066 //*************************************************************************************************
2079 template< typename MT // Type of the matrix
2080  , bool SO // Storage order
2081  , bool DF // Density flag
2082  , bool SF // Symmetry flag
2083  , size_t... CCAs1 // Compile time column arguments of the left-hand side column selection
2084  , size_t... CCAs2 > // Compile time column arguments of the right-hand side column selection
2085 inline bool isSame( const Columns<MT,SO,DF,SF,CCAs1...>& a,
2086  const Columns<MT,SO,DF,SF,CCAs2...>& b ) noexcept
2087 {
2088  if( !isSame( a.operand(), b.operand() ) || a.rows() != b.rows() || a.columns() != b.columns() )
2089  return false;
2090 
2091  decltype(auto) indices1( a.idces() );
2092  decltype(auto) indices2( b.idces() );
2093 
2094  return std::equal( indices1.begin(), indices1.end(), indices2.begin() );
2095 }
2097 //*************************************************************************************************
2098 
2099 
2100 //*************************************************************************************************
2139 template< InversionFlag IF // Inversion algorithm
2140  , typename MT // Type of the dense matrix
2141  , bool SO // Storage order
2142  , bool SF // Symmetry flag
2143  , size_t... CCAs > // Compile time column arguments
2144 inline DisableIf_< HasMutableDataAccess<MT> > invert( Columns<MT,SO,true,SF,CCAs...>& c )
2145 {
2146  using RT = ResultType_< Columns<MT,SO,true,SF,CCAs...> >;
2147 
2150 
2151  RT tmp( c );
2152  invert<IF>( tmp );
2153  c = tmp;
2154 }
2156 //*************************************************************************************************
2157 
2158 
2159 //*************************************************************************************************
2175 template< typename MT // Type of the matrix
2176  , bool SO // Storage order
2177  , bool DF // Density flag
2178  , bool SF // Symmetry flag
2179  , size_t... CCAs // Compile time column arguments
2180  , typename ET > // Type of the element
2181 inline bool trySet( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t i, size_t j, const ET& value )
2182 {
2183  BLAZE_INTERNAL_ASSERT( i < c.rows(), "Invalid row access index" );
2184  BLAZE_INTERNAL_ASSERT( j < c.columns(), "Invalid column access index" );
2185 
2186  return trySet( c.operand(), c.idx(i), j, value );
2187 }
2189 //*************************************************************************************************
2190 
2191 
2192 //*************************************************************************************************
2208 template< typename MT // Type of the matrix
2209  , bool SO // Storage order
2210  , bool DF // Density flag
2211  , bool SF // Symmetry flag
2212  , size_t... CCAs // Compile time column arguments
2213  , typename ET > // Type of the element
2214 inline bool tryAdd( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t i, size_t j, const ET& value )
2215 {
2216  BLAZE_INTERNAL_ASSERT( i < c.rows(), "Invalid row access index" );
2217  BLAZE_INTERNAL_ASSERT( j < c.columns(), "Invalid column access index" );
2218 
2219  return tryAdd( c.operand(), c.idx(i), j, value );
2220 }
2222 //*************************************************************************************************
2223 
2224 
2225 //*************************************************************************************************
2241 template< typename MT // Type of the matrix
2242  , bool SO // Storage order
2243  , bool DF // Density flag
2244  , bool SF // Symmetry flag
2245  , size_t... CCAs // Compile time column arguments
2246  , typename ET > // Type of the element
2247 inline bool trySub( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t i, size_t j, const ET& value )
2248 {
2249  BLAZE_INTERNAL_ASSERT( i < c.rows(), "Invalid row access index" );
2250  BLAZE_INTERNAL_ASSERT( j < c.columns(), "Invalid column access index" );
2251 
2252  return trySub( c.operand(), c.idx(i), j, value );
2253 }
2255 //*************************************************************************************************
2256 
2257 
2258 //*************************************************************************************************
2274 template< typename MT // Type of the matrix
2275  , bool SO // Storage order
2276  , bool DF // Density flag
2277  , bool SF // Symmetry flag
2278  , size_t... CCAs // Compile time column arguments
2279  , typename ET > // Type of the element
2280 inline bool tryMult( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t i, size_t j, const ET& value )
2281 {
2282  BLAZE_INTERNAL_ASSERT( i < c.rows(), "Invalid row access index" );
2283  BLAZE_INTERNAL_ASSERT( j < c.columns(), "Invalid column access index" );
2284 
2285  return tryMult( c.operand(), c.idx(i), j, value );
2286 }
2288 //*************************************************************************************************
2289 
2290 
2291 //*************************************************************************************************
2309 template< typename MT // Type of the matrix
2310  , bool SO // Storage order
2311  , bool DF // Density flag
2312  , bool SF // Symmetry flag
2313  , size_t... CCAs // Compile time column arguments
2314  , typename ET > // Type of the element
2316  tryMult( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t row, size_t column, size_t m, size_t n, const ET& value )
2317 {
2318  BLAZE_INTERNAL_ASSERT( row <= (~c).rows(), "Invalid row access index" );
2319  BLAZE_INTERNAL_ASSERT( column <= (~c).columns(), "Invalid column access index" );
2320  BLAZE_INTERNAL_ASSERT( row + m <= (~c).rows(), "Invalid number of rows" );
2321  BLAZE_INTERNAL_ASSERT( column + n <= (~c).columns(), "Invalid number of columns" );
2322 
2323  const size_t jend( column + n );
2324 
2325  for( size_t j=column; j<jend; ++j ) {
2326  if( !tryMult( c.operand(), row, c.idx(j), m, n, value ) )
2327  return false;
2328  }
2329 
2330  return true;
2331 }
2333 //*************************************************************************************************
2334 
2335 
2336 //*************************************************************************************************
2352 template< typename MT // Type of the matrix
2353  , bool SO // Storage order
2354  , bool DF // Density flag
2355  , bool SF // Symmetry flag
2356  , size_t... CCAs // Compile time column arguments
2357  , typename ET > // Type of the element
2358 inline bool tryDiv( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t i, size_t j, const ET& value )
2359 {
2360  BLAZE_INTERNAL_ASSERT( i < c.rows(), "Invalid row access index" );
2361  BLAZE_INTERNAL_ASSERT( j < c.columns(), "Invalid column access index" );
2362 
2363  return tryDiv( c.operand(), c.idx(i), j, value );
2364 }
2366 //*************************************************************************************************
2367 
2368 
2369 //*************************************************************************************************
2387 template< typename MT // Type of the matrix
2388  , bool SO // Storage order
2389  , bool DF // Density flag
2390  , bool SF // Symmetry flag
2391  , size_t... CCAs // Compile time column arguments
2392  , typename ET > // Type of the element
2394  tryDiv( const Columns<MT,SO,DF,SF,CCAs...>& c, size_t row, size_t column, size_t m, size_t n, const ET& value )
2395 {
2396  BLAZE_INTERNAL_ASSERT( row <= (~c).rows(), "Invalid row access index" );
2397  BLAZE_INTERNAL_ASSERT( column <= (~c).columns(), "Invalid column access index" );
2398  BLAZE_INTERNAL_ASSERT( row + m <= (~c).rows(), "Invalid number of rows" );
2399  BLAZE_INTERNAL_ASSERT( column + n <= (~c).columns(), "Invalid number of columns" );
2400 
2401  const size_t jend( column + n );
2402 
2403  for( size_t j=column; j<jend; ++j ) {
2404  if( !tryDiv( c.operand(), row, c.idx(j), m, n, value ) )
2405  return false;
2406  }
2407 
2408  return true;
2409 }
2411 //*************************************************************************************************
2412 
2413 
2414 //*************************************************************************************************
2430 template< typename MT // Type of the matrix
2431  , bool SO // Storage order
2432  , bool DF // Density flag
2433  , bool SF // Symmetry flag
2434  , size_t... CCAs // Compile time column arguments
2435  , typename VT > // Type of the right-hand side vector
2436 inline bool tryAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2437  const Vector<VT,false>& rhs, size_t row, size_t column )
2438 {
2439  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2440  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2441  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
2442 
2443  return tryAssign( lhs.operand(), ~rhs, row, lhs.idx( column ) );
2444 }
2446 //*************************************************************************************************
2447 
2448 
2449 //*************************************************************************************************
2465 template< typename MT // Type of the matrix
2466  , bool SO // Storage order
2467  , bool DF // Density flag
2468  , bool SF // Symmetry flag
2469  , size_t... CCAs // Compile time column arguments
2470  , typename VT > // Type of the right-hand side vector
2471 inline bool tryAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2472  const Vector<VT,true>& rhs, size_t row, size_t column )
2473 {
2474  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2475  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2476  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
2477 
2478  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
2479  if( !trySet( lhs.operand(), row, lhs.idx( column+i ), (~rhs)[i] ) )
2480  return false;
2481  }
2482 
2483  return true;
2484 }
2486 //*************************************************************************************************
2487 
2488 
2489 //*************************************************************************************************
2507 template< typename MT // Type of the matrix
2508  , bool SO // Storage order
2509  , bool DF // Density flag
2510  , bool SF // Symmetry flag
2511  , size_t... CCAs // Compile time column arguments
2512  , typename VT // Type of the right-hand side vector
2513  , bool TF > // Transpose flag of the right-hand side vector
2514 inline bool tryAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2515  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
2516 {
2517  UNUSED_PARAMETER( band );
2518 
2519  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2520  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2521  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
2522  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
2523 
2524  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
2525  if( !trySet( lhs.operand(), row+i, lhs.idx( column+i ), (~rhs)[i] ) )
2526  return false;
2527  }
2528 
2529  return true;
2530 }
2532 //*************************************************************************************************
2533 
2534 
2535 //*************************************************************************************************
2551 template< typename MT1 // Type of the matrix
2552  , bool SO1 // Storage order
2553  , bool DF // Density flag
2554  , bool SF // Symmetry flag
2555  , size_t... CCAs // Compile time column arguments
2556  , typename MT2 // Type of the right-hand side matrix
2557  , bool SO2 > // Storage order of the right-hand side matrix
2558 inline bool tryAssign( const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
2559  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
2560 {
2561  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2562  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2563  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
2564  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
2565 
2566  for( size_t j=0UL; j<(~rhs).columns(); ++j ) {
2567  if( !tryAssign( lhs.operand(), blaze::column( ~rhs, j, unchecked ), row, lhs.idx( column+j ) ) )
2568  return false;
2569  }
2570 
2571  return true;
2572 }
2574 //*************************************************************************************************
2575 
2576 
2577 //*************************************************************************************************
2594 template< typename MT // Type of the matrix
2595  , bool SO // Storage order
2596  , bool DF // Density flag
2597  , bool SF // Symmetry flag
2598  , size_t... CCAs // Compile time column arguments
2599  , typename VT > // Type of the right-hand side vector
2600 inline bool tryAddAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2601  const Vector<VT,false>& rhs, size_t row, size_t column )
2602 {
2603  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2604  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2605  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
2606 
2607  return tryAddAssign( lhs.operand(), ~rhs, row, lhs.idx( column ) );
2608 }
2610 //*************************************************************************************************
2611 
2612 
2613 //*************************************************************************************************
2630 template< typename MT // Type of the matrix
2631  , bool SO // Storage order
2632  , bool DF // Density flag
2633  , bool SF // Symmetry flag
2634  , size_t... CCAs // Compile time column arguments
2635  , typename VT > // Type of the right-hand side vector
2636 inline bool tryAddAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2637  const Vector<VT,true>& rhs, size_t row, size_t column )
2638 {
2639  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2640  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2641  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
2642 
2643  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
2644  if( !tryAdd( lhs.operand(), row, lhs.idx( column+i ), (~rhs)[i] ) )
2645  return false;
2646  }
2647 
2648  return true;
2649 }
2651 //*************************************************************************************************
2652 
2653 
2654 //*************************************************************************************************
2672 template< typename MT // Type of the matrix
2673  , bool SO // Storage order
2674  , bool DF // Density flag
2675  , bool SF // Symmetry flag
2676  , size_t... CCAs // Compile time column arguments
2677  , typename VT // Type of the right-hand side vector
2678  , bool TF > // Transpose flag of the right-hand side vector
2679 inline bool tryAddAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2680  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
2681 {
2682  UNUSED_PARAMETER( band );
2683 
2684  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2685  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2686  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
2687  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
2688 
2689  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
2690  if( !tryAdd( lhs.operand(), row+i, lhs.idx( column+i ), (~rhs)[i] ) )
2691  return false;
2692  }
2693 
2694  return true;
2695 }
2697 //*************************************************************************************************
2698 
2699 
2700 //*************************************************************************************************
2716 template< typename MT1 // Type of the matrix
2717  , bool SO1 // Storage order
2718  , bool DF // Density flag
2719  , bool SF // Symmetry flag
2720  , size_t... CCAs // Compile time column arguments
2721  , typename MT2 // Type of the right-hand side matrix
2722  , bool SO2 > // Storage order of the right-hand side matrix
2723 inline bool tryAddAssign( const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
2724  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
2725 {
2726  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2727  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2728  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
2729  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
2730 
2731  for( size_t j=0UL; j<(~rhs).columns(); ++j ) {
2732  if( !tryAddAssign( lhs.operand(), blaze::column( ~rhs, j, unchecked ), row, lhs.idx( column+j ) ) )
2733  return false;
2734  }
2735 
2736  return true;
2737 }
2739 //*************************************************************************************************
2740 
2741 
2742 //*************************************************************************************************
2759 template< typename MT // Type of the matrix
2760  , bool SO // Storage order
2761  , bool DF // Density flag
2762  , bool SF // Symmetry flag
2763  , size_t... CCAs // Compile time column arguments
2764  , typename VT > // Type of the right-hand side vector
2765 inline bool trySubAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2766  const Vector<VT,false>& rhs, size_t row, size_t column )
2767 {
2768  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2769  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2770  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
2771 
2772  return trySubAssign( lhs.operand(), ~rhs, row, lhs.idx( column ) );
2773 }
2775 //*************************************************************************************************
2776 
2777 
2778 //*************************************************************************************************
2795 template< typename MT // Type of the matrix
2796  , bool SO // Storage order
2797  , bool DF // Density flag
2798  , bool SF // Symmetry flag
2799  , size_t... CCAs // Compile time column arguments
2800  , typename VT > // Type of the right-hand side vector
2801 inline bool trySubAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2802  const Vector<VT,true>& rhs, size_t row, size_t column )
2803 {
2804  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2805  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2806  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
2807 
2808  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
2809  if( !trySub( lhs.operand(), row, lhs.idx( column+i ), (~rhs)[i] ) )
2810  return false;
2811  }
2812 
2813  return true;
2814 }
2816 //*************************************************************************************************
2817 
2818 
2819 //*************************************************************************************************
2837 template< typename MT // Type of the matrix
2838  , bool SO // Storage order
2839  , bool DF // Density flag
2840  , bool SF // Symmetry flag
2841  , size_t... CCAs // Compile time column arguments
2842  , typename VT // Type of the right-hand side vector
2843  , bool TF > // Transpose flag of the right-hand side vector
2844 inline bool trySubAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2845  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
2846 {
2847  UNUSED_PARAMETER( band );
2848 
2849  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2850  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2851  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
2852  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
2853 
2854  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
2855  if( !trySub( lhs.operand(), row+i, lhs.idx( column+i ), (~rhs)[i] ) )
2856  return false;
2857  }
2858 
2859  return true;
2860 }
2862 //*************************************************************************************************
2863 
2864 
2865 //*************************************************************************************************
2882 template< typename MT1 // Type of the matrix
2883  , bool SO1 // Storage order
2884  , bool DF // Density flag
2885  , bool SF // Symmetry flag
2886  , size_t... CCAs // Compile time column arguments
2887  , typename MT2 // Type of the right-hand side matrix
2888  , bool SO2 > // Storage order of the right-hand side matrix
2889 inline bool trySubAssign( const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
2890  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
2891 {
2892  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2893  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2894  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
2895  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
2896 
2897  for( size_t j=0UL; j<(~rhs).columns(); ++j ) {
2898  if( !trySubAssign( lhs.operand(), blaze::column( ~rhs, j, unchecked ), row, lhs.idx( column+j ) ) )
2899  return false;
2900  }
2901 
2902  return true;
2903 }
2905 //*************************************************************************************************
2906 
2907 
2908 //*************************************************************************************************
2925 template< typename MT // Type of the matrix
2926  , bool SO // Storage order
2927  , bool DF // Density flag
2928  , bool SF // Symmetry flag
2929  , size_t... CCAs // Compile time column arguments
2930  , typename VT > // Type of the right-hand side vector
2931 inline bool tryMultAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2932  const Vector<VT,false>& rhs, size_t row, size_t column )
2933 {
2934  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2935  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2936  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
2937 
2938  return tryMultAssign( lhs.operand(), ~rhs, row, lhs.idx( column ) );
2939 }
2941 //*************************************************************************************************
2942 
2943 
2944 //*************************************************************************************************
2961 template< typename MT // Type of the matrix
2962  , bool SO // Storage order
2963  , bool DF // Density flag
2964  , bool SF // Symmetry flag
2965  , size_t... CCAs // Compile time column arguments
2966  , typename VT > // Type of the right-hand side vector
2967 inline bool tryMultAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
2968  const Vector<VT,true>& rhs, size_t row, size_t column )
2969 {
2970  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
2971  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
2972  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
2973 
2974  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
2975  if( !tryMult( lhs.operand(), row, lhs.idx( column+i ), (~rhs)[i] ) )
2976  return false;
2977  }
2978 
2979  return true;
2980 }
2982 //*************************************************************************************************
2983 
2984 
2985 //*************************************************************************************************
3003 template< typename MT // Type of the matrix
3004  , bool SO // Storage order
3005  , bool DF // Density flag
3006  , bool SF // Symmetry flag
3007  , size_t... CCAs // Compile time column arguments
3008  , typename VT // Type of the right-hand side vector
3009  , bool TF > // Transpose flag of the right-hand side vector
3010 inline bool tryMultAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3011  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
3012 {
3013  UNUSED_PARAMETER( band );
3014 
3015  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3016  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3017  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3018  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3019 
3020  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3021  if( !tryMult( lhs.operand(), row+i, lhs.idx( column+i ), (~rhs)[i] ) )
3022  return false;
3023  }
3024 
3025  return true;
3026 }
3028 //*************************************************************************************************
3029 
3030 
3031 //*************************************************************************************************
3048 template< typename MT1 // Type of the matrix
3049  , bool SO1 // Storage order
3050  , bool DF // Density flag
3051  , bool SF // Symmetry flag
3052  , size_t... CCAs // Compile time column arguments
3053  , typename MT2 // Type of the right-hand side matrix
3054  , bool SO2 > // Storage order of the right-hand side matrix
3055 inline bool trySchurAssign( const Columns<MT1,SO1,DF,SF,CCAs...>& lhs,
3056  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
3057 {
3058  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3059  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3060  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= lhs.rows(), "Invalid number of rows" );
3061  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= lhs.columns(), "Invalid number of columns" );
3062 
3063  for( size_t j=0UL; j<(~rhs).columns(); ++j ) {
3064  if( !tryMultAssign( lhs.operand(), blaze::column( ~rhs, j, unchecked ), row, lhs.idx( column+j ) ) )
3065  return false;
3066  }
3067 
3068  return true;
3069 }
3071 //*************************************************************************************************
3072 
3073 
3074 //*************************************************************************************************
3091 template< typename MT // Type of the matrix
3092  , bool SO // Storage order
3093  , bool DF // Density flag
3094  , bool SF // Symmetry flag
3095  , size_t... CCAs // Compile time column arguments
3096  , typename VT > // Type of the right-hand side vector
3097 inline bool tryDivAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3098  const Vector<VT,false>& rhs, size_t row, size_t column )
3099 {
3100  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3101  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3102  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3103 
3104  return tryDivAssign( lhs.operand(), ~rhs, row, lhs.idx( column ) );
3105 }
3107 //*************************************************************************************************
3108 
3109 
3110 //*************************************************************************************************
3127 template< typename MT // Type of the matrix
3128  , bool SO // Storage order
3129  , bool DF // Density flag
3130  , bool SF // Symmetry flag
3131  , size_t... CCAs // Compile time column arguments
3132  , typename VT > // Type of the right-hand side vector
3133 inline bool tryDivAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3134  const Vector<VT,true>& rhs, size_t row, size_t column )
3135 {
3136  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3137  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3138  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3139 
3140  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3141  if( !tryDiv( lhs.operand(), row, lhs.idx( column+i ), (~rhs)[i] ) )
3142  return false;
3143  }
3144 
3145  return true;
3146 }
3148 //*************************************************************************************************
3149 
3150 
3151 //*************************************************************************************************
3169 template< typename MT // Type of the matrix
3170  , bool SO // Storage order
3171  , bool DF // Density flag
3172  , bool SF // Symmetry flag
3173  , size_t... CCAs // Compile time column arguments
3174  , typename VT // Type of the right-hand side vector
3175  , bool TF > // Transpose flag of the right-hand side vector
3176 inline bool tryDivAssign( const Columns<MT,SO,DF,SF,CCAs...>& lhs,
3177  const Vector<VT,TF>& rhs, ptrdiff_t band, size_t row, size_t column )
3178 {
3179  UNUSED_PARAMETER( band );
3180 
3181  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
3182  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
3183  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= lhs.rows(), "Invalid number of rows" );
3184  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= lhs.columns(), "Invalid number of columns" );
3185 
3186  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
3187  if( !tryDiv( lhs.operand(), row+i, lhs.idx( column+i ), (~rhs)[i] ) )
3188  return false;
3189  }
3190 
3191  return true;
3192 }
3194 //*************************************************************************************************
3195 
3196 
3197 //*************************************************************************************************
3212 template< typename MT // Type of the matrix
3213  , bool SO // Storage order
3214  , bool DF // Density flag
3215  , bool SF // Symmetry flag
3216  , size_t I // First element index
3217  , size_t... Is > // Remaining element indices
3218 inline decltype(auto) derestrict( Columns<MT,SO,DF,SF,I,Is...>& c )
3219 {
3220  return columns<I,Is...>( derestrict( c.operand() ), unchecked );
3221 }
3223 //*************************************************************************************************
3224 
3225 
3226 //*************************************************************************************************
3241 template< typename MT // Type of the matrix
3242  , bool SO // Storage order
3243  , bool DF // Density flag
3244  , bool SF // Symmetry flag
3245  , size_t I // First element index
3246  , size_t... Is > // Remaining element indices
3247 inline decltype(auto) derestrict( Columns<MT,SO,DF,SF,I,Is...>&& c )
3248 {
3249  return columns<I,Is...>( derestrict( c.operand() ), unchecked );
3250 }
3252 //*************************************************************************************************
3253 
3254 
3255 //*************************************************************************************************
3270 template< typename MT // Type of the matrix
3271  , bool SO // Storage order
3272  , bool DF // Density flag
3273  , bool SF > // Symmetry flag
3274 inline decltype(auto) derestrict( Columns<MT,SO,DF,SF>& c )
3275 {
3276  decltype(auto) indices( c.idces() );
3277  return columns( derestrict( c.operand() ), indices.data(), indices.size(), unchecked );
3278 }
3280 //*************************************************************************************************
3281 
3282 
3283 //*************************************************************************************************
3298 template< typename MT // Type of the matrix
3299  , bool SO // Storage order
3300  , bool DF // Density flag
3301  , bool SF > // Symmetry flag
3302 inline decltype(auto) derestrict( Columns<MT,SO,DF,SF>&& r )
3303 {
3304  decltype(auto) indices( r.idces() );
3305  return columns( derestrict( r.operand() ), indices.data(), indices.size(), unchecked );
3306 }
3308 //*************************************************************************************************
3309 
3310 
3311 
3312 
3313 //=================================================================================================
3314 //
3315 // SIZE SPECIALIZATIONS
3316 //
3317 //=================================================================================================
3318 
3319 //*************************************************************************************************
3321 template< typename MT, bool SO, bool DF, bool SF, size_t... CCAs >
3322 struct Size< Columns<MT,SO,DF,SF,CCAs...>, 0UL >
3323  : public Size<MT,0UL>
3324 {};
3325 
3326 template< typename MT, bool SO, bool DF, bool SF, size_t I, size_t... Is >
3327 struct Size< Columns<MT,SO,DF,SF,I,Is...>, 1UL >
3328  : public PtrdiffT<1UL+sizeof...(Is)>
3329 {};
3331 //*************************************************************************************************
3332 
3333 
3334 
3335 
3336 //=================================================================================================
3337 //
3338 // ISRESTRICTED SPECIALIZATIONS
3339 //
3340 //=================================================================================================
3341 
3342 //*************************************************************************************************
3344 template< typename MT, bool SO, bool DF, bool SF, size_t... CCAs >
3345 struct IsRestricted< Columns<MT,SO,DF,SF,CCAs...> >
3346  : public IsRestricted<MT>
3347 {};
3349 //*************************************************************************************************
3350 
3351 
3352 
3353 
3354 //=================================================================================================
3355 //
3356 // HASCONSTDATAACCESS SPECIALIZATIONS
3357 //
3358 //=================================================================================================
3359 
3360 //*************************************************************************************************
3362 template< typename MT, bool SO, bool SF, size_t... CCAs >
3363 struct HasConstDataAccess< Columns<MT,SO,true,SF,CCAs...> >
3364  : public HasConstDataAccess<MT>
3365 {};
3367 //*************************************************************************************************
3368 
3369 
3370 
3371 
3372 //=================================================================================================
3373 //
3374 // HASMUTABLEDATAACCESS SPECIALIZATIONS
3375 //
3376 //=================================================================================================
3377 
3378 //*************************************************************************************************
3380 template< typename MT, bool SO, bool SF, size_t... CCAs >
3381 struct HasMutableDataAccess< Columns<MT,SO,true,SF,CCAs...> >
3382  : public HasMutableDataAccess<MT>
3383 {};
3385 //*************************************************************************************************
3386 
3387 
3388 
3389 
3390 //=================================================================================================
3391 //
3392 // ISALIGNED SPECIALIZATIONS
3393 //
3394 //=================================================================================================
3395 
3396 //*************************************************************************************************
3398 template< typename MT, bool SO, bool SF, size_t... CCAs >
3399 struct IsAligned< Columns<MT,SO,true,SF,CCAs...> >
3400  : public IsAligned<MT>
3401 {};
3403 //*************************************************************************************************
3404 
3405 
3406 
3407 
3408 //=================================================================================================
3409 //
3410 // SUBMATRIXTRAIT SPECIALIZATIONS
3411 //
3412 //=================================================================================================
3413 
3414 //*************************************************************************************************
3416 template< typename MT, bool SO, bool DF, bool SF, size_t... CCAs, size_t... CSAs >
3417 struct SubmatrixTrait< Columns<MT,SO,DF,SF,CCAs...>, CSAs... >
3418 {
3419  using Type = SubmatrixTrait_< ResultType_< Columns<MT,SO,DF,SF,CCAs...> >, CSAs... >;
3420 };
3422 //*************************************************************************************************
3423 
3424 
3425 
3426 
3427 //=================================================================================================
3428 //
3429 // ROWTRAIT SPECIALIZATIONS
3430 //
3431 //=================================================================================================
3432 
3433 //*************************************************************************************************
3435 template< typename MT, bool SO, bool DF, bool SF, size_t... CCAs, size_t... CRAs >
3436 struct RowTrait< Columns<MT,SO,DF,SF,CCAs...>, CRAs... >
3437 {
3438  using Type = RowTrait_< ResultType_< Columns<MT,SO,DF,SF,CCAs...> >, CRAs... >;
3439 };
3441 //*************************************************************************************************
3442 
3443 
3444 
3445 
3446 //=================================================================================================
3447 //
3448 // ROWSTRAIT SPECIALIZATIONS
3449 //
3450 //=================================================================================================
3451 
3452 //*************************************************************************************************
3454 template< typename MT, bool SO, bool DF, bool SF, size_t... CCAs, size_t... CRAs >
3455 struct RowsTrait< Columns<MT,SO,DF,SF,CCAs...>, CRAs... >
3456 {
3457  using Type = RowsTrait_< ResultType_< Columns<MT,SO,DF,SF,CCAs...> >, CRAs... >;
3458 };
3460 //*************************************************************************************************
3461 
3462 
3463 
3464 
3465 //=================================================================================================
3466 //
3467 // COLUMNTRAIT SPECIALIZATIONS
3468 //
3469 //=================================================================================================
3470 
3471 //*************************************************************************************************
3473 template< typename MT, bool SO, bool DF, bool SF, size_t... CCAs1, size_t... CCAs2 >
3474 struct ColumnTrait< Columns<MT,SO,DF,SF,CCAs1...>, CCAs2... >
3475 {
3476  using Type = ColumnTrait_< ResultType_< Columns<MT,SO,DF,SF,CCAs1...> >, CCAs2... >;
3477 };
3479 //*************************************************************************************************
3480 
3481 
3482 
3483 
3484 //=================================================================================================
3485 //
3486 // COLUMNSTRAIT SPECIALIZATIONS
3487 //
3488 //=================================================================================================
3489 
3490 //*************************************************************************************************
3492 template< typename MT, bool SO, bool DF, bool SF, size_t... CCAs1, size_t... CCAs2 >
3493 struct ColumnsTrait< Columns<MT,SO,DF,SF,CCAs1...>, CCAs2... >
3494 {
3495  using Type = ColumnsTrait_< ResultType_< Columns<MT,SO,DF,SF,CCAs1...> >, CCAs2... >;
3496 };
3498 //*************************************************************************************************
3499 
3500 
3501 
3502 
3503 //=================================================================================================
3504 //
3505 // BANDTRAIT SPECIALIZATIONS
3506 //
3507 //=================================================================================================
3508 
3509 //*************************************************************************************************
3511 template< typename MT, bool SO, bool DF, bool SF, size_t... CCAs, ptrdiff_t... CBAs >
3512 struct BandTrait< Columns<MT,SO,DF,SF,CCAs...>, CBAs... >
3513 {
3514  using Type = BandTrait_< ResultType_< Columns<MT,SO,DF,SF,CCAs...> >, CBAs... >;
3515 };
3517 //*************************************************************************************************
3518 
3519 } // namespace blaze
3520 
3521 #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
Pointer difference type of the Blaze library.
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:131
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the implementation of the Columns base template.
Base class for all vector/matrix multiplication expression templates.The TVecMatMultExpr class serves...
Definition: TVecMatMultExpr.h:67
Base class for all binary matrix map expression templates.The MatMatMapExpr class serves as a tag for...
Definition: MatMatMapExpr.h:66
Compile time check for low-level access to constant data.This type trait tests whether the given data...
Definition: HasConstDataAccess.h:75
Header file for the alignment flag values.
Header file for the UNUSED_PARAMETER function template.
#define BLAZE_CONSTRAINT_MUST_HAVE_MUTABLE_DATA_ACCESS(T)
Constraint on the data type.In case the given data type T does not provide low-level data access to m...
Definition: MutableDataAccess.h:61
BLAZE_ALWAYS_INLINE bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b) noexcept
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:949
Header file for basic type definitions.
Base class for all matrix serial evaluation expression templates.The MatSerialExpr class serves as a ...
Definition: MatSerialExpr.h:67
constexpr bool equal(const T1 &a, const T2 &b)
Generic equality check.
Definition: Equal.h:76
Header file for the row trait.
Base template for the SubmatrixTrait class.
Definition: SubmatrixTrait.h:109
Base class for all matrix/scalar division expression templates.The MatScalarDivExpr class serves as a...
Definition: MatScalarDivExpr.h:66
Base template for the ColumnTrait class.
Definition: ColumnTrait.h:108
Header file for the serial shim.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
Header file for the MatTransExpr base class.
Columns specialization for sparse matrices.
Header file for the dense matrix inversion flags.
Auxiliary class template for the data members of the Column class.The auxiliary ColumnData class temp...
Definition: ColumnData.h:64
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
Implementation of a dynamic vector with small vector optimization.The SmallVector class template is a...
Definition: SmallVector.h:80
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
Base class for all matrix/scalar multiplication expression templates.The MatScalarMultExpr class serv...
Definition: MatScalarMultExpr.h:67
Header file for the MatEvalExpr base class.
Header file for the MatMatMultExpr base class.
Header file for the extended initializer_list functionality.
Index sequence type of the Blaze library.
typename SubmatrixTrait< MT, CSAs... >::Type SubmatrixTrait_
Auxiliary alias declaration for the SubmatrixTrait type trait.The SubmatrixTrait_ alias declaration p...
Definition: SubmatrixTrait.h:145
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
typename RowTrait< MT, CRAs... >::Type RowTrait_
Auxiliary alias declaration for the RowTrait type trait.The RowTrait_ alias declaration provides a co...
Definition: RowTrait.h:145
Base template for the RowsTrait class.
Definition: RowsTrait.h:109
Header file for the band trait.
Compile time check for data types with restricted data access.This type trait tests whether the given...
Definition: IsRestricted.h:82
Compile time check for low-level access to mutable data.This type trait tests whether the given data ...
Definition: HasMutableDataAccess.h:75
Compile time check for the alignment of data types.This type trait tests whether the given data type ...
Definition: IsAligned.h:87
Pointer data() noexcept
Low-level data access to the vector elements.
Definition: SmallVector.h:538
Header file for the matrix storage order types.
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:772
Header file for the MatMapExpr base class.
Base template for the RowTrait class.
Definition: RowTrait.h:109
typename ColumnTrait< MT, CCAs... >::Type ColumnTrait_
Auxiliary alias declaration for the ColumnTrait type trait.The ColumnTrait_ alias declaration provide...
Definition: ColumnTrait.h:144
typename ColumnsTrait< MT, CCAs... >::Type ColumnsTrait_
Auxiliary alias declaration for the ColumnsTrait type trait.The ColumnsTrait_ alias declaration provi...
Definition: ColumnsTrait.h:145
Base class for all matrix/matrix subtraction expression templates.The MatMatSubExpr class serves as a...
Definition: MatMatSubExpr.h:67
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Columns specialization for dense matrices.
Base class for all matrix/matrix addition expression templates.The MatMatAddExpr class serves as a ta...
Definition: MatMatAddExpr.h:66
Header file for the MatMatSubExpr base class.
Header file for the IsAligned type trait.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:506
Base class for all unary matrix map expression templates.The MatMapExpr class serves as a tag for all...
Definition: MatMapExpr.h:66
Implementation of a type list.The TypeList class template represents a list of data types of arbitrar...
Definition: TypeList.h:119
decltype(auto) eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:794
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:134
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.
typename BandTrait< MT, CBAs... >::Type BandTrait_
Auxiliary alias declaration for the BandTrait type trait.The BandTrait_ alias declaration provides a ...
Definition: BandTrait.h:145
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:608
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:134
typename RowsTrait< MT, CRAs... >::Type RowsTrait_
Auxiliary alias declaration for the RowsTrait type trait.The RowsTrait_ alias declaration provides a ...
Definition: RowsTrait.h:145
Header file for the HasConstDataAccess type trait.
Header file for the DeclExpr base class.
Base class for all matrix/matrix multiplication expression templates.The MatMatMultExpr class serves ...
Definition: MatMatMultExpr.h:67
Header file for the Matrix base class.
Header file for all forward declarations for views.
typename EnableIfTrue< Condition, T >::Type EnableIfTrue_
Auxiliary type for the EnableIfTrue class template.The EnableIfTrue_ alias declaration provides a con...
Definition: EnableIf.h:138
Header file for the MatScalarMultExpr base class.
Base class for all Schur product expression templates.The SchurExpr class serves as a tag for all exp...
Definition: SchurExpr.h:66
Header file for run time assertion macros.
Header file for the Unique class template.
Header file for the submatrix trait.
Header file for the columns trait.
Header file for the SchurExpr base class.
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:131
Compile time integral constant wrapper for ptrdiff_t.The PtrdiffT class template represents an integr...
Definition: PtrdiffT.h:72
Base class for all matrix evaluation expression templates.The MatEvalExpr class serves as a tag for a...
Definition: MatEvalExpr.h:66
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
size_t size() const noexcept
Returns the current size/dimension of the small vector.
Definition: SmallVector.h:769
Header file for the column trait.
Header file for the isDefault shim.
void reserve(size_t n)
Setting the minimum capacity of the vector.
Definition: SmallVector.h:895
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:101
Header file for the TVecMatMultExpr base class.
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:816
Base class for all matrix transposition expression templates.The MatTransExpr class serves as a tag f...
Definition: MatTransExpr.h:66
Header file for the HasMutableDataAccess type trait.
#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.
Base class for all outer product expression templates.The VecTVecMultExpr class serves as a tag for a...
Definition: VecTVecMultExpr.h:67
Header file for the rows trait.
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:490
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:789
Base template for the ColumnsTrait class.
Definition: ColumnsTrait.h:109
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:177
Header file for the MatMatMapExpr base class.
Initializer list type of the Blaze library.
Compile time evaluation of the size of vectors and matrices.The Size type trait evaluates the size of...
Definition: Size.h:80
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
Header file for the SmallVector implementation.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
Header file for the implementation of the ColumnData class template.
Header file for the MatScalarDivExpr base class.
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Searching a type list.The Contains class can be used to search the type list for a particular type Ty...
Definition: Contains.h:78
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, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Base template for the BandTrait class.
Definition: BandTrait.h:109
Header file for the function trace functionality.
Template for the blaze::checked and blaze::unchecked instances.blaze::Check is the template for the b...
Definition: Check.h:56
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:1134