Elements.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_ELEMENTS_H_
36 #define _BLAZE_MATH_VIEWS_ELEMENTS_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <array>
44 #include <numeric>
45 #include <utility>
46 #include <vector>
47 #include <blaze/math/Aliases.h>
49 #include <blaze/math/Exception.h>
72 #include <blaze/math/views/Check.h>
76 #include <blaze/util/Assert.h>
79 #include <blaze/util/SmallArray.h>
81 #include <blaze/util/TypeList.h>
82 #include <blaze/util/Types.h>
84 #include <blaze/util/Unused.h>
85 
86 
87 namespace blaze {
88 
89 //=================================================================================================
90 //
91 // GLOBAL FUNCTIONS
92 //
93 //=================================================================================================
94 
95 //*************************************************************************************************
130 template< size_t I // First element index
131  , size_t... Is // Remaining element indices
132  , typename VT // Type of the vector
133  , bool TF // Transpose flag
134  , typename... REAs > // Optional arguments
135 inline decltype(auto) elements( Vector<VT,TF>& vector, REAs... args )
136 {
138 
139  using ReturnType = Elements_< VT, index_sequence<I,Is...> >;
140  return ReturnType( ~vector, args... );
141 }
142 //*************************************************************************************************
143 
144 
145 //*************************************************************************************************
180 template< size_t I // First element index
181  , size_t... Is // Remaining element indices
182  , typename VT // Type of the vector
183  , bool TF // Transpose flag
184  , typename... REAs > // Optional arguments
185 inline decltype(auto) elements( const Vector<VT,TF>& vector, REAs... args )
186 {
188 
189  using ReturnType = const Elements_< const VT, index_sequence<I,Is...> >;
190  return ReturnType( ~vector, args... );
191 }
192 //*************************************************************************************************
193 
194 
195 //*************************************************************************************************
209 template< size_t I // First element index
210  , size_t... Is // Remaining element indices
211  , typename VT // Type of the vector
212  , bool TF // Transpose flag
213  , typename... REAs > // Optional arguments
214 inline decltype(auto) elements( Vector<VT,TF>&& vector, REAs... args )
215 {
217 
218  using ReturnType = Elements_< VT, index_sequence<I,Is...> >;
219  return ReturnType( ~vector, args... );
220 }
221 //*************************************************************************************************
222 
223 
224 //*************************************************************************************************
263 template< typename VT // Type of the vector
264  , bool TF // Transpose flag
265  , typename T // Type of the element indices
266  , typename... REAs > // Optional arguments
267 inline decltype(auto) elements( Vector<VT,TF>& vector, const T* indices, size_t n, REAs... args )
268 {
270 
271  using ReturnType = Elements_<VT>;
272  return ReturnType( ~vector, indices, n, args... );
273 }
274 //*************************************************************************************************
275 
276 
277 //*************************************************************************************************
316 template< typename VT // Type of the vector
317  , bool TF // Transpose flag
318  , typename T // Type of the element indices
319  , typename... REAs > // Optional arguments
320 inline decltype(auto) elements( const Vector<VT,TF>& vector, const T* indices, size_t n, REAs... args )
321 {
323 
324  using ReturnType = const Elements_<const VT>;
325  return ReturnType( ~vector, indices, n, args... );
326 }
327 //*************************************************************************************************
328 
329 
330 //*************************************************************************************************
346 template< typename VT // Type of the vector
347  , bool TF // Transpose flag
348  , typename T // Type of the element indices
349  , typename... REAs > // Optional arguments
350 inline decltype(auto) elements( Vector<VT,TF>&& vector, const T* indices, size_t n, REAs... args )
351 {
353 
354  using ReturnType = Elements_<VT>;
355  return ReturnType( ~vector, indices, n, args... );
356 }
357 //*************************************************************************************************
358 
359 
360 //*************************************************************************************************
397 template< typename VT // Type of the vector
398  , bool TF // Transpose flag
399  , typename P // Type of the index producer
400  , typename... REAs // Optional arguments
401  , EnableIf_t< !IsPointer_v<P> >* = nullptr >
402 inline decltype(auto) elements( Vector<VT,TF>& vector, P p, size_t n, REAs... args )
403 {
405 
406  using ReturnType = Elements_<VT,P>;
407  return ReturnType( ~vector, p, n, args... );
408 }
409 //*************************************************************************************************
410 
411 
412 //*************************************************************************************************
451 template< typename VT // Type of the vector
452  , bool TF // Transpose flag
453  , typename P // Type of the index producer
454  , typename... REAs // Optional arguments
455  , EnableIf_t< !IsPointer_v<P> >* = nullptr >
456 inline decltype(auto) elements( const Vector<VT,TF>& vector, P p, size_t n, REAs... args )
457 {
459 
460  using ReturnType = const Elements_<const VT,P>;
461  return ReturnType( ~vector, p, n, args... );
462 }
463 //*************************************************************************************************
464 
465 
466 //*************************************************************************************************
482 template< typename VT // Type of the vector
483  , bool TF // Transpose flag
484  , typename P // Type of the index producer
485  , typename... REAs // Optional arguments
486  , EnableIf_t< !IsPointer_v<P> >* = nullptr >
487 inline decltype(auto) elements( Vector<VT,TF>&& vector, P p, size_t n, REAs... args )
488 {
490 
491  using ReturnType = Elements_<VT,P>;
492  return ReturnType( ~vector, p, n, args... );
493 }
494 //*************************************************************************************************
495 
496 
497 //*************************************************************************************************
534 template< typename VT // Type of the vector
535  , size_t... Is // Element indices
536  , typename... REAs > // Optional arguments
537 inline decltype(auto) elements( VT&& vector, index_sequence<Is...> indices, REAs... args )
538 {
540 
541  UNUSED_PARAMETER( indices );
542 
543  return elements<Is...>( std::forward<VT>( vector ), args... );
544 }
546 //*************************************************************************************************
547 
548 
549 //*************************************************************************************************
584 template< typename VT // Type of the vector
585  , typename T // Type of the element indices
586  , typename... REAs > // Optional arguments
587 inline decltype(auto) elements( VT&& vector, initializer_list<T> indices, REAs... args )
588 {
590 
591  return elements( std::forward<VT>( vector ), indices.begin(), indices.size(), args... );
592 }
593 //*************************************************************************************************
594 
595 
596 //*************************************************************************************************
633 template< typename VT // Type of the vector
634  , typename T // Type of the element indices
635  , size_t N // Number of indices
636  , typename... REAs > // Optional arguments
637 inline decltype(auto) elements( VT&& vector, const std::array<T,N>& indices, REAs... args )
638 {
640 
641  return elements( std::forward<VT>( vector ), indices.data(), N, args... );
642 }
643 //*************************************************************************************************
644 
645 
646 //*************************************************************************************************
683 template< typename VT // Type of the vector
684  , typename T // Type of the element indices
685  , typename... REAs > // Optional arguments
686 inline decltype(auto) elements( VT&& vector, const std::vector<T>& indices, REAs... args )
687 {
689 
690  return elements( std::forward<VT>( vector ), indices.data(), indices.size(), args... );
691 }
692 //*************************************************************************************************
693 
694 
695 //*************************************************************************************************
732 template< typename VT // Type of the vector
733  , typename T // Type of the element indices
734  , size_t N // Number of preallocated elements
735  , typename... REAs > // Optional arguments
736 inline decltype(auto) elements( VT&& vector, const SmallArray<T,N>& indices, REAs... args )
737 {
739 
740  return elements( std::forward<VT>( vector ), indices.data(), indices.size(), args... );
741 }
742 //*************************************************************************************************
743 
744 
745 //*************************************************************************************************
760 template< typename VT // Type of the vector
761  , typename T1 // First type of the pair of arguments
762  , typename T2 // Second type of the pair of arguments
763  , typename... REAs > // Optional arguments
764 inline decltype(auto) elements( VT&& vector, const std::pair<T1,T2>& pair, REAs... args )
765 {
767 
768  return elements( std::forward<VT>( vector ), pair.first, pair.second, args... );
769 }
771 //*************************************************************************************************
772 
773 
774 
775 
776 //=================================================================================================
777 //
778 // GLOBAL RESTRUCTURING FUNCTIONS
779 //
780 //=================================================================================================
781 
782 //*************************************************************************************************
794 template< typename... CEAs // Compile time element arguments
795  , typename VT // Vector base type of the expression
796  , typename... REAs > // Runtime element arguments
797 inline decltype(auto) elements( const VecVecAddExpr<VT>& vector, REAs... args )
798 {
800 
801  return elements<CEAs...>( (~vector).leftOperand(), args... ) +
802  elements<CEAs...>( (~vector).rightOperand(), args... );
803 }
805 //*************************************************************************************************
806 
807 
808 //*************************************************************************************************
820 template< typename... CEAs // Compile time element arguments
821  , typename VT // Vector base type of the expression
822  , typename... REAs > // Runtime element arguments
823 inline decltype(auto) elements( const VecVecSubExpr<VT>& vector, REAs... args )
824 {
826 
827  return elements<CEAs...>( (~vector).leftOperand(), args... ) -
828  elements<CEAs...>( (~vector).rightOperand(), args... );
829 }
831 //*************************************************************************************************
832 
833 
834 //*************************************************************************************************
846 template< typename... CEAs // Compile time element arguments
847  , typename VT // Vector base type of the expression
848  , typename... REAs > // Runtime element arguments
849 inline decltype(auto) elements( const VecVecMultExpr<VT>& vector, REAs... args )
850 {
852 
853  return elements<CEAs...>( (~vector).leftOperand(), args... ) *
854  elements<CEAs...>( (~vector).rightOperand(), args... );
855 }
857 //*************************************************************************************************
858 
859 
860 //*************************************************************************************************
872 template< typename... CEAs // Compile time element arguments
873  , typename VT // Vector base type of the expression
874  , typename... REAs > // Runtime element arguments
875 inline decltype(auto) elements( const VecVecDivExpr<VT>& vector, REAs... args )
876 {
878 
879  return elements<CEAs...>( (~vector).leftOperand(), args... ) /
880  elements<CEAs...>( (~vector).rightOperand(), args... );
881 }
883 //*************************************************************************************************
884 
885 
886 //*************************************************************************************************
898 template< typename... CEAs // Compile time element arguments
899  , typename VT // Vector base type of the expression
900  , typename... REAs > // Runtime element arguments
901 inline decltype(auto) elements( const CrossExpr<VT>& vector, REAs... args )
902 {
904 
905  using ReturnType = Elements_< VectorType_t<VT>, CEAs... >;
906  return ReturnType( ~vector, args... );
907 }
909 //*************************************************************************************************
910 
911 
912 //*************************************************************************************************
924 template< typename... CEAs // Compile time element arguments
925  , typename VT // Vector base type of the expression
926  , typename... REAs > // Runtime element arguments
927 inline decltype(auto) elements( const VecScalarMultExpr<VT>& vector, REAs... args )
928 {
930 
931  return elements<CEAs...>( (~vector).leftOperand(), args... ) * (~vector).rightOperand();
932 }
934 //*************************************************************************************************
935 
936 
937 //*************************************************************************************************
949 template< typename... CEAs // Compile time element arguments
950  , typename VT // Vector base type of the expression
951  , typename... REAs > // Runtime element arguments
952 inline decltype(auto) elements( const VecScalarDivExpr<VT>& vector, REAs... args )
953 {
955 
956  return elements<CEAs...>( (~vector).leftOperand(), args... ) / (~vector).rightOperand();
957 }
959 //*************************************************************************************************
960 
961 
962 //*************************************************************************************************
974 template< typename... CEAs // Compile time element arguments
975  , typename VT // Vector base type of the expression
976  , typename... REAs > // Runtime element arguments
977 inline decltype(auto) elements( const VecMapExpr<VT>& vector, REAs... args )
978 {
980 
981  return map( elements<CEAs...>( (~vector).operand(), args... ), (~vector).operation() );
982 }
984 //*************************************************************************************************
985 
986 
987 //*************************************************************************************************
999 template< typename... CEAs // Compile time element arguments
1000  , typename VT // Vector base type of the expression
1001  , typename... REAs > // Runtime element arguments
1002 inline decltype(auto) elements( const VecVecMapExpr<VT>& vector, REAs... args )
1003 {
1005 
1006  return map( elements<CEAs...>( (~vector).leftOperand(), args... ),
1007  elements<CEAs...>( (~vector).rightOperand(), args... ),
1008  (~vector).operation() );
1009 }
1011 //*************************************************************************************************
1012 
1013 
1014 //*************************************************************************************************
1026 template< typename... CEAs // Compile time element arguments
1027  , typename VT // Vector base type of the expression
1028  , typename... REAs > // Runtime element arguments
1029 inline decltype(auto) elements( const VecEvalExpr<VT>& vector, REAs... args )
1030 {
1032 
1033  return eval( elements<CEAs...>( (~vector).operand(), args... ) );
1034 }
1036 //*************************************************************************************************
1037 
1038 
1039 //*************************************************************************************************
1051 template< typename... CEAs // Compile time element arguments
1052  , typename VT // Vector base type of the expression
1053  , typename... REAs > // Runtime element arguments
1054 inline decltype(auto) elements( const VecSerialExpr<VT>& vector, REAs... args )
1055 {
1057 
1058  return serial( elements<CEAs...>( (~vector).operand(), args... ) );
1059 }
1061 //*************************************************************************************************
1062 
1063 
1064 //*************************************************************************************************
1076 template< typename... CEAs // Compile time element arguments
1077  , typename VT // Vector base type of the expression
1078  , typename... REAs > // Runtime element arguments
1079 inline decltype(auto) elements( const VecTransExpr<VT>& vector, REAs... args )
1080 {
1082 
1083  return trans( elements<CEAs...>( (~vector).operand(), args... ) );
1084 }
1086 //*************************************************************************************************
1087 
1088 
1089 //*************************************************************************************************
1101 template< size_t I1 // First required element index
1102  , size_t... Is1 // Remaining required element indices
1103  , typename VT // Type of the vector
1104  , bool TF // Transpose flag
1105  , bool DF // Density flag
1106  , size_t I2 // First present element index
1107  , size_t... Is2 // Remaining present element indices
1108  , typename... CEAs // Compile time element arguments
1109  , typename... REAs > // Optional element arguments
1110 inline decltype(auto) elements( Elements<VT,TF,DF,index_sequence<I2,Is2...>,CEAs...>& e, REAs... args )
1111 {
1113 
1114  static constexpr size_t indices[] = { I2, Is2... };
1115  return elements< indices[I1], indices[Is1]... >( e.operand(), args... );
1116 }
1118 //*************************************************************************************************
1119 
1120 
1121 //*************************************************************************************************
1133 template< size_t I1 // First required element index
1134  , size_t... Is1 // Remaining required element indices
1135  , typename VT // Type of the vector
1136  , bool TF // Transpose flag
1137  , bool DF // Density flag
1138  , size_t I2 // First present element index
1139  , size_t... Is2 // Remaining present element indices
1140  , typename... CEAs // Compile time element arguments
1141  , typename... REAs > // Optional element arguments
1142 inline decltype(auto) elements( const Elements<VT,TF,DF,index_sequence<I2,Is2...>,CEAs...>& e, REAs... args )
1143 {
1145 
1146  static constexpr size_t indices[] = { I2, Is2... };
1147  return elements< indices[I1], indices[Is1]... >( e.operand(), args... );
1148 }
1150 //*************************************************************************************************
1151 
1152 
1153 //*************************************************************************************************
1165 template< size_t I1 // First required element index
1166  , size_t... Is1 // Remaining required element indices
1167  , typename VT // Type of the vector
1168  , bool TF // Transpose flag
1169  , bool DF // Density flag
1170  , size_t I2 // First present element index
1171  , size_t... Is2 // Remaining present element indices
1172  , typename... CEAs // Compile time element arguments
1173  , typename... REAs > // Optional element arguments
1174 inline decltype(auto) elements( Elements<VT,TF,DF,index_sequence<I2,Is2...>,CEAs...>&& e, REAs... args )
1175 {
1177 
1178  static constexpr size_t indices[] = { I2, Is2... };
1179  return elements< indices[I1], indices[Is1]... >( e.operand(), args... );
1180 }
1182 //*************************************************************************************************
1183 
1184 
1185 //*************************************************************************************************
1198 template< size_t I // First element index
1199  , size_t... Is // Remaining element indices
1200  , typename VT // Type of the vector
1201  , bool TF // Transpose flag
1202  , bool DF // Density flag
1203  , typename... CEAs // Compile time element arguments
1204  , typename... REAs > // Optional element arguments
1205 inline decltype(auto) elements( Elements<VT,TF,DF,CEAs...>& e, REAs... args )
1206 {
1208 
1209  constexpr bool isChecked( !Contains_v< TypeList<REAs...>, Unchecked > );
1210 
1211  if( isChecked ) {
1212  static constexpr size_t indices[] = { I, Is... };
1213  for( size_t i=0UL; i<sizeof...(Is)+1UL; ++i ) {
1214  if( e.size() <= indices[i] ) {
1215  BLAZE_THROW_INVALID_ARGUMENT( "Invalid element access index" );
1216  }
1217  }
1218  }
1219 
1220  return elements( e.operand(), { e.idx(I), e.idx(Is)... }, args... );
1221 }
1223 //*************************************************************************************************
1224 
1225 
1226 //*************************************************************************************************
1239 template< size_t I // First element index
1240  , size_t... Is // Remaining element indices
1241  , typename VT // Type of the vector
1242  , bool TF // Transpose flag
1243  , bool DF // Density flag
1244  , typename... CEAs // Compile time element arguments
1245  , typename... REAs > // Optional element arguments
1246 inline decltype(auto) elements( const Elements<VT,TF,DF,CEAs...>& e, REAs... args )
1247 {
1249 
1250  constexpr bool isChecked( !Contains_v< TypeList<REAs...>, Unchecked > );
1251 
1252  if( isChecked ) {
1253  static constexpr size_t indices[] = { I, Is... };
1254  for( size_t i=0UL; i<sizeof...(Is)+1UL; ++i ) {
1255  if( e.size() <= indices[i] ) {
1256  BLAZE_THROW_INVALID_ARGUMENT( "Invalid element access index" );
1257  }
1258  }
1259  }
1260 
1261  return elements( e.operand(), { e.idx(I), e.idx(Is)... }, args... );
1262 }
1264 //*************************************************************************************************
1265 
1266 
1267 //*************************************************************************************************
1280 template< size_t I // First element index
1281  , size_t... Is // Remaining element indices
1282  , typename VT // Type of the vector
1283  , bool TF // Transpose flag
1284  , bool DF // Density flag
1285  , typename... CEAs // Compile time element arguments
1286  , typename... REAs > // Optional element arguments
1287 inline decltype(auto) elements( Elements<VT,TF,DF,CEAs...>&& e, REAs... args )
1288 {
1290 
1291  constexpr bool isChecked( !Contains_v< TypeList<REAs...>, Unchecked > );
1292 
1293  if( isChecked ) {
1294  static constexpr size_t indices[] = { I, Is... };
1295  for( size_t i=0UL; i<sizeof...(Is)+1UL; ++i ) {
1296  if( e.size() <= indices[i] ) {
1297  BLAZE_THROW_INVALID_ARGUMENT( "Invalid element access index" );
1298  }
1299  }
1300  }
1301 
1302  return elements( e.operand(), { e.idx(I), e.idx(Is)... }, args... );
1303 }
1305 //*************************************************************************************************
1306 
1307 
1308 //*************************************************************************************************
1323 template< typename VT // Type of the vector
1324  , bool TF // Transpose flag
1325  , bool DF // Density flag
1326  , typename... CEAs // Compile time element arguments
1327  , typename T // Type of the element indices
1328  , typename... REAs > // Optional element arguments
1329 inline decltype(auto) elements( Elements<VT,TF,DF,CEAs...>& e,
1330  const T* indices, size_t n, REAs... args )
1331 {
1333 
1334  constexpr bool isChecked( !Contains_v< TypeList<REAs...>, Unchecked > );
1335 
1336  if( isChecked ) {
1337  for( size_t i=0UL; i<n; ++i ) {
1338  if( e.size() <= size_t( indices[i] ) ) {
1339  BLAZE_THROW_INVALID_ARGUMENT( "Invalid element access index" );
1340  }
1341  }
1342  }
1343 
1344  SmallArray<size_t,128UL> newIndices;
1345  newIndices.reserve( n );
1346 
1347  for( size_t i=0UL; i<n; ++i ) {
1348  newIndices.pushBack( e.idx( indices[i] ) );
1349  }
1350 
1351  return elements( e.operand(), newIndices.data(), newIndices.size(), args... );
1352 }
1354 //*************************************************************************************************
1355 
1356 
1357 //*************************************************************************************************
1372 template< typename VT // Type of the vector
1373  , bool TF // Transpose flag
1374  , bool DF // Density flag
1375  , typename... CEAs // Compile time element arguments
1376  , typename T // Type of the element indices
1377  , typename... REAs > // Optional element arguments
1378 inline decltype(auto) elements( const Elements<VT,TF,DF,CEAs...>& e,
1379  const T* indices, size_t n, REAs... args )
1380 {
1382 
1383  constexpr bool isChecked( !Contains_v< TypeList<REAs...>, Unchecked > );
1384 
1385  if( isChecked ) {
1386  for( size_t i=0UL; i<n; ++i ) {
1387  if( e.size() <= size_t( indices[i] ) ) {
1388  BLAZE_THROW_INVALID_ARGUMENT( "Invalid element access index" );
1389  }
1390  }
1391  }
1392 
1393  SmallArray<size_t,128UL> newIndices;
1394  newIndices.reserve( n );
1395 
1396  for( size_t i=0UL; i<n; ++i ) {
1397  newIndices.pushBack( e.idx( indices[i] ) );
1398  }
1399 
1400  return elements( e.operand(), newIndices.data(), newIndices.size(), args... );
1401 }
1403 //*************************************************************************************************
1404 
1405 
1406 //*************************************************************************************************
1421 template< typename VT // Type of the vector
1422  , bool TF // Transpose flag
1423  , bool DF // Density flag
1424  , typename... CEAs // Compile time element arguments
1425  , typename T // Type of the element indices
1426  , typename... REAs > // Optional element arguments
1427 inline decltype(auto) elements( Elements<VT,TF,DF,CEAs...>&& e,
1428  const T* indices, size_t n, REAs... args )
1429 {
1431 
1432  constexpr bool isChecked( !Contains_v< TypeList<REAs...>, Unchecked > );
1433 
1434  if( isChecked ) {
1435  for( size_t i=0UL; i<n; ++i ) {
1436  if( e.size() <= size_t( indices[i] ) ) {
1437  BLAZE_THROW_INVALID_ARGUMENT( "Invalid element access index" );
1438  }
1439  }
1440  }
1441 
1442  SmallArray<size_t,128UL> newIndices;
1443  newIndices.reserve( n );
1444 
1445  for( size_t i=0UL; i<n; ++i ) {
1446  newIndices.pushBack( e.idx( indices[i] ) );
1447  }
1448 
1449  return elements( e.operand(), newIndices.data(), newIndices.size(), args... );
1450 }
1452 //*************************************************************************************************
1453 
1454 
1455 //*************************************************************************************************
1470 template< typename VT // Type of the vector
1471  , bool TF // Transpose flag
1472  , bool DF // Density flag
1473  , typename... CEAs // Compile time element arguments
1474  , typename P // Type of the index producer
1475  , typename... REAs // Optional element arguments
1476  , EnableIf_t< !IsPointer_v<P> >* = nullptr >
1477 inline decltype(auto) elements( Elements<VT,TF,DF,CEAs...>& e,
1478  P p, size_t n, REAs... args )
1479 {
1481 
1482  constexpr bool isChecked( !Contains_v< TypeList<REAs...>, Unchecked > );
1483 
1484  if( isChecked ) {
1485  for( size_t i=0UL; i<n; ++i ) {
1486  if( e.size() <= size_t( p(i) ) ) {
1487  BLAZE_THROW_INVALID_ARGUMENT( "Invalid element access index" );
1488  }
1489  }
1490  }
1491 
1492  SmallArray<size_t,128UL> newIndices;
1493  newIndices.reserve( n );
1494 
1495  for( size_t i=0UL; i<n; ++i ) {
1496  newIndices.pushBack( e.idx( p(i) ) );
1497  }
1498 
1499  return elements( e.operand(), newIndices.data(), newIndices.size(), args... );
1500 }
1502 //*************************************************************************************************
1503 
1504 
1505 //*************************************************************************************************
1520 template< typename VT // Type of the vector
1521  , bool TF // Transpose flag
1522  , bool DF // Density flag
1523  , typename... CEAs // Compile time element arguments
1524  , typename P // Type of the index producer
1525  , typename... REAs // Optional element arguments
1526  , EnableIf_t< !IsPointer_v<P> >* = nullptr >
1527 inline decltype(auto) elements( const Elements<VT,TF,DF,CEAs...>& e,
1528  P p, size_t n, REAs... args )
1529 {
1531 
1532  constexpr bool isChecked( !Contains_v< TypeList<REAs...>, Unchecked > );
1533 
1534  if( isChecked ) {
1535  for( size_t i=0UL; i<n; ++i ) {
1536  if( e.size() <= size_t( p(i) ) ) {
1537  BLAZE_THROW_INVALID_ARGUMENT( "Invalid element access index" );
1538  }
1539  }
1540  }
1541 
1542  SmallArray<size_t,128UL> newIndices;
1543  newIndices.reserve( n );
1544 
1545  for( size_t i=0UL; i<n; ++i ) {
1546  newIndices.pushBack( e.idx( p(i) ) );
1547  }
1548 
1549  return elements( e.operand(), newIndices.data(), newIndices.size(), args... );
1550 }
1552 //*************************************************************************************************
1553 
1554 
1555 //*************************************************************************************************
1570 template< typename VT // Type of the vector
1571  , bool TF // Transpose flag
1572  , bool DF // Density flag
1573  , typename... CEAs // Compile time element arguments
1574  , typename P // Type of the index producer
1575  , typename... REAs // Optional element arguments
1576  , EnableIf_t< !IsPointer_v<P> >* = nullptr >
1577 inline decltype(auto) elements( Elements<VT,TF,DF,CEAs...>&& e,
1578  P p, size_t n, REAs... args )
1579 {
1581 
1582  constexpr bool isChecked( !Contains_v< TypeList<REAs...>, Unchecked > );
1583 
1584  if( isChecked ) {
1585  for( size_t i=0UL; i<n; ++i ) {
1586  if( e.size() <= size_t( p(i) ) ) {
1587  BLAZE_THROW_INVALID_ARGUMENT( "Invalid element access index" );
1588  }
1589  }
1590  }
1591 
1592  SmallArray<size_t,128UL> newIndices;
1593  newIndices.reserve( n );
1594 
1595  for( size_t i=0UL; i<n; ++i ) {
1596  newIndices.pushBack( e.idx( p(i) ) );
1597  }
1598 
1599  return elements( e.operand(), newIndices.data(), newIndices.size(), args... );
1600 }
1602 //*************************************************************************************************
1603 
1604 
1605 
1606 
1607 //=================================================================================================
1608 //
1609 // GLOBAL RESTRUCTURING FUNCTIONS (SUBVECTOR)
1610 //
1611 //=================================================================================================
1612 
1613 //*************************************************************************************************
1625 template< AlignmentFlag AF // Alignment flag
1626  , size_t I // Index of the first subvector element
1627  , size_t N // Size of the subvector
1628  , typename VT // Type of the vector
1629  , bool TF // Transpose flag
1630  , bool DF // Density flag
1631  , typename... CEAs // Compile time element arguments
1632  , typename... RSAs > // Optional arguments
1633 inline decltype(auto) subvector( Elements<VT,TF,DF,CEAs...>& e, RSAs... args )
1634 {
1636 
1637  return elements( e, make_shifted_index_sequence<I,N>(), args... );
1638 }
1640 //*************************************************************************************************
1641 
1642 
1643 //*************************************************************************************************
1655 template< AlignmentFlag AF // Alignment flag
1656  , size_t I // Index of the first subvector element
1657  , size_t N // Size of the subvector
1658  , typename VT // Type of the vector
1659  , bool TF // Transpose flag
1660  , bool DF // Density flag
1661  , typename... CEAs // Compile time element arguments
1662  , typename... RSAs > // Optional arguments
1663 inline decltype(auto) subvector( const Elements<VT,TF,DF,CEAs...>& e, RSAs... args )
1664 {
1666 
1667  return elements( e, make_shifted_index_sequence<I,N>(), args... );
1668 }
1670 //*************************************************************************************************
1671 
1672 
1673 //*************************************************************************************************
1685 template< AlignmentFlag AF // Alignment flag
1686  , size_t I // Index of the first subvector element
1687  , size_t N // Size of the subvector
1688  , typename VT // Type of the vector
1689  , bool TF // Transpose flag
1690  , bool DF // Density flag
1691  , typename... CEAs // Compile time element arguments
1692  , typename... RSAs > // Optional arguments
1693 inline decltype(auto) subvector( Elements<VT,TF,DF,CEAs...>&& e, RSAs... args )
1694 {
1696 
1697  return elements( e, make_shifted_index_sequence<I,N>(), args... );
1698 }
1700 //*************************************************************************************************
1701 
1702 
1703 //*************************************************************************************************
1717 template< AlignmentFlag AF // Alignment flag
1718  , typename VT // Type of the vector
1719  , bool TF // Transpose flag
1720  , bool DF // Density flag
1721  , typename... CEAs // Compile time element arguments
1722  , typename... RSAs > // Optional arguments
1723 inline decltype(auto)
1724  subvector( Elements<VT,TF,DF,CEAs...>& e, size_t index, size_t size, RSAs... args )
1725 {
1727 
1728  SmallArray<size_t,128UL> indices( size );
1729  std::iota( indices.begin(), indices.end(), index );
1730 
1731  return elements( e, indices.data(), indices.size(), args... );
1732 }
1734 //*************************************************************************************************
1735 
1736 
1737 //*************************************************************************************************
1751 template< AlignmentFlag AF // Alignment flag
1752  , typename VT // Type of the vector
1753  , bool TF // Transpose flag
1754  , bool DF // Density flag
1755  , typename... CEAs // Compile time element arguments
1756  , typename... RSAs > // Optional arguments
1757 inline decltype(auto)
1758  subvector( const Elements<VT,TF,DF,CEAs...>& e, size_t index, size_t size, RSAs... args )
1759 {
1761 
1762  SmallArray<size_t,128UL> indices( size );
1763  std::iota( indices.begin(), indices.end(), index );
1764 
1765  return elements( e, indices.data(), indices.size(), args... );
1766 }
1768 //*************************************************************************************************
1769 
1770 
1771 //*************************************************************************************************
1785 template< AlignmentFlag AF // Alignment flag
1786  , typename VT // Type of the vector
1787  , bool TF // Transpose flag
1788  , bool DF // Density flag
1789  , typename... CEAs // Compile time element arguments
1790  , typename... RSAs > // Optional arguments
1791 inline decltype(auto)
1792  subvector( Elements<VT,TF,DF,CEAs...>&& e, size_t index, size_t size, RSAs... args )
1793 {
1795 
1796  SmallArray<size_t,128UL> indices( size );
1797  std::iota( indices.begin(), indices.end(), index );
1798 
1799  return elements( std::move( e ), indices.data(), indices.size(), args... );
1800 }
1802 //*************************************************************************************************
1803 
1804 
1805 
1806 
1807 //=================================================================================================
1808 //
1809 // ELEMENTS OPERATORS
1810 //
1811 //=================================================================================================
1812 
1813 //*************************************************************************************************
1821 template< typename VT // Type of the vector
1822  , bool TF // Transpose flag
1823  , bool DF // Density flag
1824  , typename... CEAs > // Compile time element arguments
1825 inline void reset( Elements<VT,TF,DF,CEAs...>& e )
1826 {
1827  e.reset();
1828 }
1830 //*************************************************************************************************
1831 
1832 
1833 //*************************************************************************************************
1841 template< typename VT // Type of the vector
1842  , bool TF // Transpose flag
1843  , bool DF // Density flag
1844  , typename... CEAs > // Compile time element arguments
1845 inline void reset( Elements<VT,TF,DF,CEAs...>&& e )
1846 {
1847  e.reset();
1848 }
1850 //*************************************************************************************************
1851 
1852 
1853 //*************************************************************************************************
1861 template< typename VT // Type of the vector
1862  , bool TF // Transpose flag
1863  , bool DF // Density flag
1864  , typename... CEAs > // Compile time element arguments
1865 inline void clear( Elements<VT,TF,DF,CEAs...>& e )
1866 {
1867  e.reset();
1868 }
1870 //*************************************************************************************************
1871 
1872 
1873 //*************************************************************************************************
1881 template< typename VT // Type of the vector
1882  , bool TF // Transpose flag
1883  , bool DF // Density flag
1884  , typename... CEAs > // Compile time element arguments
1885 inline void clear( Elements<VT,TF,DF,CEAs...>&& e )
1886 {
1887  e.reset();
1888 }
1890 //*************************************************************************************************
1891 
1892 
1893 //*************************************************************************************************
1919 template< bool RF // Relaxation flag
1920  , typename VT // Type of the dense vector
1921  , bool TF // Transpose flag
1922  , typename... CEAs > // Compile time element arguments
1923 inline bool isDefault( const Elements<VT,TF,true,CEAs...>& e )
1924 {
1925  using blaze::isDefault;
1926 
1927  for( size_t i=0UL; i<e.size(); ++i )
1928  if( !isDefault<RF>( e[i] ) ) return false;
1929  return true;
1930 }
1932 //*************************************************************************************************
1933 
1934 
1935 //*************************************************************************************************
1961 template< bool RF // Relaxation flag
1962  , typename VT // Type of the sparse vector
1963  , bool TF // Transpose flag
1964  , typename... CEAs > // Compile time element arguments
1965 inline bool isDefault( const Elements<VT,TF,false,CEAs...>& e )
1966 {
1967  using blaze::isDefault;
1968 
1969  for( const auto& element : ~e )
1970  if( !isDefault<RF>( element.value() ) ) return false;
1971  return true;
1972 }
1974 //*************************************************************************************************
1975 
1976 
1977 //*************************************************************************************************
1995 template< typename VT // Type of the vector
1996  , bool TF // Transpose flag
1997  , bool DF // Density flag
1998  , typename... CEAs > // Compile time element arguments
1999 inline bool isIntact( const Elements<VT,TF,DF,CEAs...>& e ) noexcept
2000 {
2001  return ( e.size() <= e.operand().size() && isIntact( e.operand() ) );
2002 }
2004 //*************************************************************************************************
2005 
2006 
2007 //*************************************************************************************************
2021 template< typename VT // Type of the vector
2022  , bool TF // Transpose flag
2023  , bool DF // Density flag
2024  , typename... CEAs > // Compile time element arguments
2025 inline bool isSame( const Elements<VT,TF,DF,CEAs...>& a, const Vector<VT,TF>& b ) noexcept
2026 {
2027  if( !isSame( a.operand(), ~b ) || ( a.size() != (~b).size() ) )
2028  return false;
2029 
2030  for( size_t i=0UL; i<a.size(); ++i ) {
2031  if( a.idx(i) != i )
2032  return false;
2033  }
2034 
2035  return true;
2036 }
2038 //*************************************************************************************************
2039 
2040 
2041 //*************************************************************************************************
2055 template< typename VT // Type of the vector
2056  , bool TF // Transpose flag
2057  , bool DF // Density flag
2058  , typename... CEAs > // Compile time element arguments
2059 inline bool isSame( const Vector<VT,TF>& a, const Elements<VT,TF,DF,CEAs...>& b ) noexcept
2060 {
2061  return isSame( b, a );
2062 }
2064 //*************************************************************************************************
2065 
2066 
2067 //*************************************************************************************************
2081 template< typename VT1 // Type of the left-hand side vector
2082  , bool TF // Transpose flag
2083  , bool DF // Density flag
2084  , typename... CEAs // Compile time element arguments
2085  , typename VT2 // Type of the right-hand side vector
2086  , AlignmentFlag AF // Alignment flag
2087  , size_t... CSAs > // Compile time subvector arguments
2088 inline bool isSame( const Elements<VT1,TF,DF,CEAs...>& a, const Subvector<VT2,AF,TF,DF,CSAs...>& b ) noexcept
2089 {
2090  if( !isSame( a.operand(), b.operand() ) || ( a.size() != b.size() ) )
2091  return false;
2092 
2093  for( size_t i=0UL; i<a.size(); ++i ) {
2094  if( a.idx(i) != b.offset()+i )
2095  return false;
2096  }
2097 
2098  return true;
2099 }
2101 //*************************************************************************************************
2102 
2103 
2104 //*************************************************************************************************
2118 template< typename VT1 // Type of the left-hand side vector
2119  , AlignmentFlag AF // Alignment flag
2120  , bool TF // Transpose flag
2121  , bool DF // Density flag
2122  , size_t... CSAs // Compile time subvector arguments
2123  , typename VT2 // Type of the right-hand side vector
2124  , typename... CEAs > // Compile time element arguments
2125 inline bool isSame( const Subvector<VT1,AF,TF,DF,CSAs...>& a, const Elements<VT2,TF,DF,CEAs...>& b ) noexcept
2126 {
2127  return isSame( b, a );
2128 }
2130 //*************************************************************************************************
2131 
2132 
2133 //*************************************************************************************************
2146 template< typename VT1 // Type of the vector of the left-hand side selection of elements
2147  , bool TF1 // Transpose flag of the left-hand side selection of elements
2148  , bool DF1 // Density flag of the left-hand side selection of elements
2149  , typename... CEAs1 // Compile time element arguments of the left-hand side selection of elements
2150  , typename VT2 // Type of the vector of the right-hand side selection of elements
2151  , bool TF2 // Transpose flag of the right-hand side selection of elements
2152  , bool DF2 // Density flag of the right-hand side selection of elements
2153  , typename... CEAs2 > // Compile time element arguments of the right-hand side selection of elements
2154 inline bool isSame( const Elements<VT1,TF1,DF1,CEAs1...>& a,
2155  const Elements<VT2,TF2,DF2,CEAs2...>& b ) noexcept
2156 {
2157  if( !isSame( a.operand(), b.operand() ) || a.size() != b.size() )
2158  return false;
2159 
2160  for( size_t i=0UL; i<a.size(); ++i ) {
2161  if( a.idx(i) != b.idx(i) )
2162  return false;
2163  }
2164 
2165  return true;
2166 }
2168 //*************************************************************************************************
2169 
2170 
2171 //*************************************************************************************************
2186 template< typename VT // Type of the vector
2187  , bool TF // Transpose flag
2188  , bool DF // Density flag
2189  , typename... CEAs // Compile time element arguments
2190  , typename ET > // Type of the element
2191 inline bool trySet( const Elements<VT,TF,DF,CEAs...>& e, size_t index, const ET& value )
2192 {
2193  BLAZE_INTERNAL_ASSERT( index < e.size(), "Invalid vector access index" );
2194 
2195  return trySet( e.operand(), e.idx(index), value );
2196 }
2198 //*************************************************************************************************
2199 
2200 
2201 //*************************************************************************************************
2216 template< typename VT // Type of the vector
2217  , bool TF // Transpose flag
2218  , bool DF // Density flag
2219  , typename... CEAs // Compile time element arguments
2220  , typename ET > // Type of the element
2221 inline bool tryAdd( const Elements<VT,TF,DF,CEAs...>& e, size_t index, const ET& value )
2222 {
2223  BLAZE_INTERNAL_ASSERT( index < e.size(), "Invalid vector access index" );
2224 
2225  return tryAdd( e.operand(), e.idx(index), value );
2226 }
2228 //*************************************************************************************************
2229 
2230 
2231 //*************************************************************************************************
2246 template< typename VT // Type of the vector
2247  , bool TF // Transpose flag
2248  , bool DF // Density flag
2249  , typename... CEAs // Compile time element arguments
2250  , typename ET > // Type of the element
2251 inline bool trySub( const Elements<VT,TF,DF,CEAs...>& e, size_t index, const ET& value )
2252 {
2253  BLAZE_INTERNAL_ASSERT( index < e.size(), "Invalid vector access index" );
2254 
2255  return trySub( e.operand(), e.idx(index), value );
2256 }
2258 //*************************************************************************************************
2259 
2260 
2261 //*************************************************************************************************
2276 template< typename VT // Type of the vector
2277  , bool TF // Transpose flag
2278  , bool DF // Density flag
2279  , typename... CEAs // Compile time element arguments
2280  , typename ET > // Type of the element
2281 inline bool tryMult( const Elements<VT,TF,DF,CEAs...>& e, size_t index, const ET& value )
2282 {
2283  BLAZE_INTERNAL_ASSERT( index < e.size(), "Invalid vector access index" );
2284 
2285  return tryMult( e.operand(), e.idx(index), value );
2286 }
2288 //*************************************************************************************************
2289 
2290 
2291 //*************************************************************************************************
2307 template< typename VT // Type of the vector
2308  , bool TF // Transpose flag
2309  , bool DF // Density flag
2310  , typename... CEAs // Compile time element arguments
2311  , typename ET > // Type of the element
2313  tryMult( const Elements<VT,TF,DF,CEAs...>& e, size_t index, size_t size, const ET& value )
2314 {
2315  BLAZE_INTERNAL_ASSERT( index <= (~e).size(), "Invalid vector access index" );
2316  BLAZE_INTERNAL_ASSERT( index + size <= (~e).size(), "Invalid range size" );
2317 
2318  const size_t iend( index + size );
2319 
2320  for( size_t i=index; i<iend; ++i ) {
2321  if( !tryMult( e.operand(), e.idx(i), value ) )
2322  return false;
2323  }
2324 
2325  return true;
2326 }
2328 //*************************************************************************************************
2329 
2330 
2331 //*************************************************************************************************
2346 template< typename VT // Type of the vector
2347  , bool TF // Transpose flag
2348  , bool DF // Density flag
2349  , typename... CEAs // Compile time element arguments
2350  , typename ET > // Type of the element
2351 inline bool tryDiv( const Elements<VT,TF,DF,CEAs...>& e, size_t index, const ET& value )
2352 {
2353  BLAZE_INTERNAL_ASSERT( index < e.size(), "Invalid vector access index" );
2354 
2355  return tryDiv( e.operand(), e.idx(index), value );
2356 }
2358 //*************************************************************************************************
2359 
2360 
2361 //*************************************************************************************************
2377 template< typename VT // Type of the vector
2378  , bool TF // Transpose flag
2379  , bool DF // Density flag
2380  , typename... CEAs // Compile time element arguments
2381  , typename ET > // Type of the element
2383  tryDiv( const Elements<VT,TF,DF,CEAs...>& e, size_t index, size_t size, const ET& value )
2384 {
2385  BLAZE_INTERNAL_ASSERT( index <= (~e).size(), "Invalid vector access index" );
2386  BLAZE_INTERNAL_ASSERT( index + size <= (~e).size(), "Invalid range size" );
2387 
2388  const size_t iend( index + size );
2389 
2390  for( size_t i=index; i<iend; ++i ) {
2391  if( !tryDiv( e.operand(), e.idx(i), value ) )
2392  return false;
2393  }
2394 
2395  return true;
2396 }
2398 //*************************************************************************************************
2399 
2400 
2401 //*************************************************************************************************
2416 template< typename VT1 // Type of the vector
2417  , bool TF // Transpose flag
2418  , bool DF // Density flag
2419  , typename... CEAs // Compile time element arguments
2420  , typename VT2 > // Type of the right-hand side vector
2421 inline bool tryAssign( const Elements<VT1,TF,DF,CEAs...>& lhs,
2422  const Vector<VT2,TF>& rhs, size_t index )
2423 {
2424  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
2425  BLAZE_INTERNAL_ASSERT( index + (~rhs).size() <= lhs.size(), "Invalid vector size" );
2426 
2427  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
2428  if( !trySet( lhs.operand(), lhs.idx(i+index), (~rhs)[i] ) )
2429  return false;
2430  }
2431 
2432  return true;
2433 }
2435 //*************************************************************************************************
2436 
2437 
2438 //*************************************************************************************************
2454 template< typename VT1 // Type of the vector
2455  , bool TF // Transpose flag
2456  , bool DF // Density flag
2457  , typename... CEAs // Compile time element arguments
2458  , typename VT2 > // Type of the right-hand side vector
2459 inline bool tryAddAssign( const Elements<VT1,TF,DF,CEAs...>& lhs,
2460  const Vector<VT2,TF>& rhs, size_t index )
2461 {
2462  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
2463  BLAZE_INTERNAL_ASSERT( index + (~rhs).size() <= lhs.size(), "Invalid vector size" );
2464 
2465  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
2466  if( !tryAdd( lhs.operand(), lhs.idx(i+index), (~rhs)[i] ) )
2467  return false;
2468  }
2469 
2470  return true;
2471 }
2473 //*************************************************************************************************
2474 
2475 
2476 //*************************************************************************************************
2492 template< typename VT1 // Type of the vector
2493  , bool TF // Transpose flag
2494  , bool DF // Density flag
2495  , typename... CEAs // Compile time element arguments
2496  , typename VT2 > // Type of the right-hand side vector
2497 inline bool trySubAssign( const Elements<VT1,TF,DF,CEAs...>& lhs,
2498  const Vector<VT2,TF>& rhs, size_t index )
2499 {
2500  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
2501  BLAZE_INTERNAL_ASSERT( index + (~rhs).size() <= lhs.size(), "Invalid vector size" );
2502 
2503  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
2504  if( !trySub( lhs.operand(), lhs.idx(i+index), (~rhs)[i] ) )
2505  return false;
2506  }
2507 
2508  return true;
2509 }
2511 //*************************************************************************************************
2512 
2513 
2514 //*************************************************************************************************
2530 template< typename VT1 // Type of the vector
2531  , bool TF // Transpose flag
2532  , bool DF // Density flag
2533  , typename... CEAs // Compile time element arguments
2534  , typename VT2 > // Type of the right-hand side vector
2535 inline bool tryMultAssign( const Elements<VT1,TF,DF,CEAs...>& lhs,
2536  const Vector<VT2,TF>& rhs, size_t index )
2537 {
2538  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
2539  BLAZE_INTERNAL_ASSERT( index + (~rhs).size() <= lhs.size(), "Invalid vector size" );
2540 
2541  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
2542  if( !tryMult( lhs.operand(), lhs.idx(i+index), (~rhs)[i] ) )
2543  return false;
2544  }
2545 
2546  return true;
2547 }
2549 //*************************************************************************************************
2550 
2551 
2552 //*************************************************************************************************
2568 template< typename VT1 // Type of the vector
2569  , bool TF // Transpose flag
2570  , bool DF // Density flag
2571  , typename... CEAs // Compile time element arguments
2572  , typename VT2 > // Type of the right-hand side vector
2573 inline bool tryDivAssign( const Elements<VT1,TF,DF,CEAs...>& lhs,
2574  const Vector<VT2,TF>& rhs, size_t index )
2575 {
2576  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
2577  BLAZE_INTERNAL_ASSERT( index + (~rhs).size() <= lhs.size(), "Invalid vector size" );
2578 
2579  for( size_t i=0UL; i<(~rhs).size(); ++i ) {
2580  if( !tryDiv( lhs.operand(), lhs.idx(i+index), (~rhs)[i] ) )
2581  return false;
2582  }
2583 
2584  return true;
2585 }
2587 //*************************************************************************************************
2588 
2589 
2590 //*************************************************************************************************
2605 template< typename VT // Type of the vector
2606  , bool TF // Transpose flag
2607  , bool DF // Density flag
2608  , typename... CEAs > // Compile time element arguments
2609 inline decltype(auto) derestrict( Elements<VT,TF,DF,CEAs...>& e )
2610 {
2611  return elements( derestrict( e.operand() ), e.idces(), unchecked );
2612 }
2614 //*************************************************************************************************
2615 
2616 
2617 //*************************************************************************************************
2632 template< typename VT // Type of the vector
2633  , bool TF // Transpose flag
2634  , bool DF // Density flag
2635  , typename... CEAs > // Compile time element arguments
2636 inline decltype(auto) derestrict( Elements<VT,TF,DF,CEAs...>&& e )
2637 {
2638  return elements( derestrict( e.operand() ), e.idces(), unchecked );
2639 }
2641 //*************************************************************************************************
2642 
2643 
2644 
2645 
2646 //=================================================================================================
2647 //
2648 // SIZE SPECIALIZATIONS
2649 //
2650 //=================================================================================================
2651 
2652 //*************************************************************************************************
2654 template< typename VT, bool TF, bool DF, size_t I, size_t... Is, typename... CEAs >
2655 struct Size< Elements<VT,TF,DF,index_sequence<I,Is...>,CEAs...>, 0UL >
2656  : public PtrdiffT<1UL+sizeof...(Is)>
2657 {};
2659 //*************************************************************************************************
2660 
2661 
2662 
2663 
2664 //=================================================================================================
2665 //
2666 // MAXSIZE SPECIALIZATIONS
2667 //
2668 //=================================================================================================
2669 
2670 //*************************************************************************************************
2672 template< typename VT, bool TF, bool DF, size_t I, size_t... Is, typename... CEAs >
2673 struct MaxSize< Elements<VT,TF,DF,index_sequence<I,Is...>,CEAs...>, 0UL >
2674  : public PtrdiffT<1UL+sizeof...(Is)>
2675 {};
2677 //*************************************************************************************************
2678 
2679 
2680 
2681 
2682 //=================================================================================================
2683 //
2684 // ISRESTRICTED SPECIALIZATIONS
2685 //
2686 //=================================================================================================
2687 
2688 //*************************************************************************************************
2690 template< typename VT, bool TF, bool DF, typename... CEAs >
2691 struct IsRestricted< Elements<VT,TF,DF,CEAs...> >
2692  : public IsRestricted<VT>
2693 {};
2695 //*************************************************************************************************
2696 
2697 
2698 
2699 
2700 //=================================================================================================
2701 //
2702 // HASCONSTDATAACCESS SPECIALIZATIONS
2703 //
2704 //=================================================================================================
2705 
2706 //*************************************************************************************************
2708 template< typename VT, bool TF, typename... CEAs >
2709 struct HasConstDataAccess< Elements<VT,TF,true,CEAs...> >
2710  : public HasConstDataAccess<VT>
2711 {};
2713 //*************************************************************************************************
2714 
2715 
2716 
2717 
2718 //=================================================================================================
2719 //
2720 // HASMUTABLEDATAACCESS SPECIALIZATIONS
2721 //
2722 //=================================================================================================
2723 
2724 //*************************************************************************************************
2726 template< typename VT, bool TF, typename... CEAs >
2727 struct HasMutableDataAccess< Elements<VT,TF,true,CEAs...> >
2728  : public HasMutableDataAccess<VT>
2729 {};
2731 //*************************************************************************************************
2732 
2733 } // namespace blaze
2734 
2735 #endif
decltype(auto) subvector(Vector< VT, TF > &, RSAs...)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:329
AlignmentFlag
Alignment flag for (un-)aligned vectors and matrices.Via these flags it is possible to specify subvec...
Definition: AlignmentFlag.h:62
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the alignment flag values.
Header file for the UNUSED_PARAMETER function template.
Header file for the VecVecDivExpr base class.
bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b) noexcept
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:992
Header file for basic type definitions.
Header file for the serial shim.
Header file for the VecMapExpr base class.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
Header file for the VecScalarDivExpr base class.
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
Header file for the extended initializer_list functionality.
Index sequence type of the Blaze library.
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the VecEvalExpr base class.
STL namespace.
Header file for the VecScalarMultExpr base class.
Header file for the MaxSize type trait.
Header file for the VecVecMapExpr base class.
Elements specialization for sparse vectors.
Header file for the SmallArray implementation.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Compile time assertion.
Header file for the VecVecAddExpr base class.
Implementation of a dynamic array with small array optimization.The SmallArray class template is a hy...
Definition: SmallArray.h:81
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:139
Header file for the implementation of the Elements base template.
decltype(auto) eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:786
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:135
Header file for the exception macros of the math module.
Header file for the VecVecMultExpr base class.
Header file for the VecVecSubExpr base class.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:611
Header file for the CrossExpr base class.
Header file for the HasConstDataAccess type trait.
IntegralConstant< ptrdiff_t, N > PtrdiffT
Compile time integral constant wrapper for ptrdiff_t.The PtrdiffT class template represents an integr...
Definition: PtrdiffT.h:72
Header file for the VecSerialExpr base class.
Header file for the PtrdiffT class template.
Header file for the VecTransExpr base class.
Header file for run time assertion macros.
Header file for the Unique class template.
Check< false > Unchecked
Type of the blaze::unchecked instance.blaze::Unchecked is the type of the blaze::unchecked instance...
Definition: Check.h:96
Header file for the IsPointer type trait.
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
Header file for the isDefault shim.
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Header file for the integer_sequence and index_sequence aliases.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
Header file for the HasMutableDataAccess type trait.
Elements specialization for dense vectors.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:186
Initializer list type of the Blaze library.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
Header file for the IsRestricted type trait.
Header file for the Vector CRTP base class.
Header file for the Size type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the function trace functionality.
decltype(auto) map(const DenseMatrix< MT1, SO > &lhs, const DenseMatrix< MT2, SO > &rhs, OP op)
Evaluates the given binary operation on each single element of the dense matrices lhs and rhs...
Definition: DMatDMatMapExpr.h:1110