Subvector.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_SUBVECTOR_H_
36 #define _BLAZE_MATH_VIEWS_SUBVECTOR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
45 #include <blaze/math/Exception.h>
75 #include <blaze/util/TrueType.h>
76 #include <blaze/util/Types.h>
78 
79 
80 namespace blaze {
81 
82 //=================================================================================================
83 //
84 // GLOBAL FUNCTIONS
85 //
86 //=================================================================================================
87 
88 //*************************************************************************************************
144 template< typename VT // Type of the vector
145  , bool TF > // Transpose flag
146 inline decltype(auto) subvector( Vector<VT,TF>& vector, size_t index, size_t size )
147 {
149 
150  return subvector<unaligned>( ~vector, index, size );
151 }
152 //*************************************************************************************************
153 
154 
155 //*************************************************************************************************
211 template< typename VT // Type of the vector
212  , bool TF > // Transpose flag
213 inline decltype(auto) subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
214 {
216 
217  return subvector<unaligned>( ~vector, index, size );
218 }
219 //*************************************************************************************************
220 
221 
222 //*************************************************************************************************
237 template< typename VT // Type of the vector
238  , bool TF > // Transpose flag
239 inline decltype(auto) subvector( Vector<VT,TF>&& vector, size_t index, size_t size )
240 {
242 
243  return subvector<unaligned>( ~vector, index, size );
244 }
245 //*************************************************************************************************
246 
247 
248 //*************************************************************************************************
319 template< bool AF // Alignment flag
320  , typename VT // Type of the dense vector
321  , bool TF > // Transpose flag
322 inline Subvector<VT,AF> subvector( Vector<VT,TF>& vector, size_t index, size_t size )
323 {
325 
326  return Subvector<VT,AF>( ~vector, index, size );
327 }
328 //*************************************************************************************************
329 
330 
331 //*************************************************************************************************
400 template< bool AF // Alignment flag
401  , typename VT // Type of the dense vector
402  , bool TF > // Transpose flag
403 inline const Subvector<const VT,AF>
404  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
405 {
407 
408  return Subvector<const VT,AF>( ~vector, index, size );
409 }
410 //*************************************************************************************************
411 
412 
413 //*************************************************************************************************
430 template< bool AF // Alignment flag
431  , typename VT // Type of the dense vector
432  , bool TF > // Transpose flag
433 inline Subvector<VT,AF> subvector( Vector<VT,TF>&& vector, size_t index, size_t size )
434 {
436 
437  return Subvector<VT,AF>( ~vector, index, size );
438 }
439 //*************************************************************************************************
440 
441 
442 
443 
444 //=================================================================================================
445 //
446 // GLOBAL RESTRUCTURING FUNCTIONS
447 //
448 //=================================================================================================
449 
450 //*************************************************************************************************
463 template< bool AF // Alignment flag
464  , typename VT > // Vector base type of the expression
465 inline decltype(auto) subvector( const VecVecAddExpr<VT>& vector, size_t index, size_t size )
466 {
468 
469  return subvector<AF>( (~vector).leftOperand() , index, size ) +
470  subvector<AF>( (~vector).rightOperand(), index, size );
471 }
473 //*************************************************************************************************
474 
475 
476 //*************************************************************************************************
489 template< bool AF // Alignment flag
490  , typename VT > // Vector base type of the expression
491 inline decltype(auto) subvector( const VecVecSubExpr<VT>& vector, size_t index, size_t size )
492 {
494 
495  return subvector<AF>( (~vector).leftOperand() , index, size ) -
496  subvector<AF>( (~vector).rightOperand(), index, size );
497 }
499 //*************************************************************************************************
500 
501 
502 //*************************************************************************************************
515 template< bool AF // Alignment flag
516  , typename VT > // Vector base type of the expression
517 inline decltype(auto) subvector( const VecVecMultExpr<VT>& vector, size_t index, size_t size )
518 {
520 
521  return subvector<AF>( (~vector).leftOperand() , index, size ) *
522  subvector<AF>( (~vector).rightOperand(), index, size );
523 }
525 //*************************************************************************************************
526 
527 
528 //*************************************************************************************************
541 template< bool AF // Alignment flag
542  , typename VT > // Vector base type of the expression
543 inline decltype(auto) subvector( const VecVecDivExpr<VT>& vector, size_t index, size_t size )
544 {
546 
547  return subvector<AF>( (~vector).leftOperand() , index, size ) /
548  subvector<AF>( (~vector).rightOperand(), index, size );
549 }
551 //*************************************************************************************************
552 
553 
554 //*************************************************************************************************
567 template< bool AF // Alignment flag
568  , typename VT > // Vector base type of the expression
569 inline decltype(auto) subvector( const CrossExpr<VT>& vector, size_t index, size_t size )
570 {
572 
573  return Subvector< VectorType_<VT>, AF >( ~vector, index, size );
574 }
576 //*************************************************************************************************
577 
578 
579 //*************************************************************************************************
592 template< bool AF // Alignment flag
593  , typename VT > // Vector base type of the expression
594 inline decltype(auto) subvector( const VecScalarMultExpr<VT>& vector, size_t index, size_t size )
595 {
597 
598  return subvector<AF>( (~vector).leftOperand(), index, size ) * (~vector).rightOperand();
599 }
601 //*************************************************************************************************
602 
603 
604 //*************************************************************************************************
617 template< bool AF // Alignment flag
618  , typename VT > // Vector base type of the expression
619 inline decltype(auto) subvector( const VecScalarDivExpr<VT>& vector, size_t index, size_t size )
620 {
622 
623  return subvector<AF>( (~vector).leftOperand(), index, size ) / (~vector).rightOperand();
624 }
626 //*************************************************************************************************
627 
628 
629 //*************************************************************************************************
642 template< bool AF // Alignment flag
643  , typename VT > // Vector base type of the expression
644 inline decltype(auto) subvector( const VecMapExpr<VT>& vector, size_t index, size_t size )
645 {
647 
648  return map( subvector<AF>( (~vector).operand(), index, size ), (~vector).operation() );
649 }
651 //*************************************************************************************************
652 
653 
654 //*************************************************************************************************
667 template< bool AF // Alignment flag
668  , typename VT > // Vector base type of the expression
669 inline decltype(auto) subvector( const VecVecMapExpr<VT>& vector, size_t index, size_t size )
670 {
672 
673  return map( subvector<AF>( (~vector).leftOperand() , index, size ),
674  subvector<AF>( (~vector).rightOperand(), index, size ),
675  (~vector).operation() );
676 }
678 //*************************************************************************************************
679 
680 
681 //*************************************************************************************************
694 template< bool AF // Alignment flag
695  , typename VT > // Vector base type of the expression
696 inline decltype(auto) subvector( const VecEvalExpr<VT>& vector, size_t index, size_t size )
697 {
699 
700  return eval( subvector<AF>( (~vector).operand(), index, size ) );
701 }
703 //*************************************************************************************************
704 
705 
706 //*************************************************************************************************
719 template< bool AF // Alignment flag
720  , typename VT > // Vector base type of the expression
721 inline decltype(auto) subvector( const VecSerialExpr<VT>& vector, size_t index, size_t size )
722 {
724 
725  return serial( subvector<AF>( (~vector).operand(), index, size ) );
726 }
728 //*************************************************************************************************
729 
730 
731 //*************************************************************************************************
744 template< bool AF // Alignment flag
745  , typename VT > // Vector base type of the expression
746 inline decltype(auto) subvector( const VecTransExpr<VT>& vector, size_t index, size_t size )
747 {
749 
750  return trans( subvector<AF>( (~vector).operand(), index, size ) );
751 }
753 //*************************************************************************************************
754 
755 
756 //*************************************************************************************************
768 template< bool AF1 // Required alignment flag
769  , typename VT // Type of the dense vector
770  , bool AF2 // Present alignment flag
771  , bool TF // Transpose flag
772  , bool DF > // Density flag
773 inline const Subvector<VT,AF1,TF,DF>
774  subvector( const Subvector<VT,AF2,TF,DF>& sv, size_t index, size_t size )
775 {
777 
778  if( index + size > sv.size() ) {
779  BLAZE_THROW_INVALID_ARGUMENT( "Invalid subvector specification" );
780  }
781 
782  return Subvector<VT,AF1,TF,DF>( sv.operand(), sv.offset() + index, size );
783 }
785 //*************************************************************************************************
786 
787 
788 
789 
790 //=================================================================================================
791 //
792 // SUBVECTOR OPERATORS
793 //
794 //=================================================================================================
795 
796 //*************************************************************************************************
799 template< typename VT, bool AF, bool TF, bool DF >
800 inline void reset( Subvector<VT,AF,TF,DF>& sv );
801 
802 template< typename VT, bool AF, bool TF, bool DF >
803 inline void reset( Subvector<VT,AF,TF,DF>&& sv );
804 
805 template< typename VT, bool AF, bool TF, bool DF >
806 inline void clear( Subvector<VT,AF,TF,DF>& sv );
807 
808 template< typename VT, bool AF, bool TF, bool DF >
809 inline void clear( Subvector<VT,AF,TF,DF>&& sv );
810 
811 template< bool RF, typename VT, bool AF, bool TF, bool DF >
812 inline bool isDefault( const Subvector<VT,AF,TF,DF>& sv );
813 
814 template< typename VT, bool AF, bool TF, bool DF >
815 inline bool isIntact( const Subvector<VT,AF,TF,DF>& sv ) noexcept;
816 
817 template< typename VT, bool AF, bool TF, bool DF >
818 inline bool isSame( const Subvector<VT,AF,TF,DF>& a, const Vector<VT,TF>& b ) noexcept;
819 
820 template< typename VT, bool AF, bool TF, bool DF >
821 inline bool isSame( const Vector<VT,TF>& a, const Subvector<VT,AF,TF,DF>& b ) noexcept;
822 
823 template< typename VT, bool AF, bool TF, bool DF >
824 inline bool isSame( const Subvector<VT,AF,TF,DF>& a, const Subvector<VT,AF,TF,DF>& b ) noexcept;
826 //*************************************************************************************************
827 
828 
829 //*************************************************************************************************
836 template< typename VT // Type of the vector
837  , bool AF // Alignment flag
838  , bool TF // Transpose flag
839  , bool DF > // Density flag
840 inline void reset( Subvector<VT,AF,TF,DF>& sv )
841 {
842  sv.reset();
843 }
844 //*************************************************************************************************
845 
846 
847 //*************************************************************************************************
854 template< typename VT // Type of the vector
855  , bool AF // Alignment flag
856  , bool TF // Transpose flag
857  , bool DF > // Density flag
858 inline void reset( Subvector<VT,AF,TF,DF>&& sv )
859 {
860  sv.reset();
861 }
862 //*************************************************************************************************
863 
864 
865 //*************************************************************************************************
872 template< typename VT // Type of the vector
873  , bool AF // Alignment flag
874  , bool TF // Transpose flag
875  , bool DF > // Density flag
876 inline void clear( Subvector<VT,AF,TF,DF>& sv )
877 {
878  sv.reset();
879 }
880 //*************************************************************************************************
881 
882 
883 //*************************************************************************************************
890 template< typename VT // Type of the vector
891  , bool AF // Alignment flag
892  , bool TF // Transpose flag
893  , bool DF > // Density flag
894 inline void clear( Subvector<VT,AF,TF,DF>&& sv )
895 {
896  sv.reset();
897 }
898 //*************************************************************************************************
899 
900 
901 //*************************************************************************************************
927 template< bool RF // Relaxation flag
928  , typename VT // Type of the vector
929  , bool AF // Alignment flag
930  , bool TF // Transpose flag
931  , bool DF > // Density flag
932 inline bool isDefault( const Subvector<VT,AF,TF,DF>& sv )
933 {
934  using blaze::isDefault;
935 
936  for( size_t i=0UL; i<sv.size(); ++i )
937  if( !isDefault<RF>( sv[i] ) ) return false;
938  return true;
939 }
940 //*************************************************************************************************
941 
942 
943 //*************************************************************************************************
962 template< bool RF // Relaxation flag
963  , typename VT // Type of the sparse vector
964  , bool AF // Alignment flag
965  , bool TF > // Transpose flag
966 inline bool isDefault( const Subvector<VT,AF,TF,false>& sv )
967 {
968  using blaze::isDefault;
969 
971 
972  const ConstIterator end( sv.end() );
973  for( ConstIterator element=sv.begin(); element!=end; ++element )
974  if( !isDefault<RF>( element->value() ) ) return false;
975  return true;
976 }
978 //*************************************************************************************************
979 
980 
981 //*************************************************************************************************
998 template< typename VT // Type of the vector
999  , bool AF // Alignment flag
1000  , bool TF // Transpose flag
1001  , bool DF > // Density flag
1002 inline bool isIntact( const Subvector<VT,AF,TF,DF>& sv ) noexcept
1003 {
1004  return ( sv.offset() + sv.size() <= sv.operand().size() &&
1005  isIntact( sv.operand() ) );
1006 }
1007 //*************************************************************************************************
1008 
1009 
1010 //*************************************************************************************************
1022 template< typename VT // Type of the vector
1023  , bool AF // Alignment flag
1024  , bool TF // Transpose flag
1025  , bool DF > // Density flag
1026 inline bool isSame( const Subvector<VT,AF,TF,DF>& a, const Vector<VT,TF>& b ) noexcept
1027 {
1028  return ( isSame( a.operand(), ~b ) && ( a.size() == (~b).size() ) );
1029 }
1030 //*************************************************************************************************
1031 
1032 
1033 //*************************************************************************************************
1045 template< typename VT // Type of the vector
1046  , bool AF // Alignment flag
1047  , bool TF // Transpose flag
1048  , bool DF > // Density flag
1049 inline bool isSame( const Vector<VT,TF>& a, const Subvector<VT,AF,TF,DF>& b ) noexcept
1050 {
1051  return ( isSame( ~a, b.operand() ) && ( (~a).size() == b.size() ) );
1052 }
1053 //*************************************************************************************************
1054 
1055 
1056 //*************************************************************************************************
1068 template< typename VT // Type of the vector
1069  , bool AF // Alignment flag
1070  , bool TF // Transpose flag
1071  , bool DF > // Density flag
1072 inline bool isSame( const Subvector<VT,AF,TF,DF>& a, const Subvector<VT,AF,TF,DF>& b ) noexcept
1073 {
1074  return ( isSame( a.operand(), b.operand() ) &&
1075  ( a.offset() == b.offset() ) &&
1076  ( a.size() == b.size() ) );
1077 }
1078 //*************************************************************************************************
1079 
1080 
1081 //*************************************************************************************************
1096 template< typename VT1 // Type of the vector
1097  , bool AF // Alignment flag
1098  , bool TF // Transpose flag
1099  , bool DF // Density flag
1100  , typename VT2 > // Type of the right-hand side vector
1101 inline bool tryAssign( const Subvector<VT1,AF,TF,DF>& lhs, const Vector<VT2,TF>& rhs, size_t index )
1102 {
1103  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1104  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
1105 
1106  return tryAssign( lhs.operand(), ~rhs, lhs.offset() + index );
1107 }
1109 //*************************************************************************************************
1110 
1111 
1112 //*************************************************************************************************
1127 template< typename VT1 // Type of the vector
1128  , bool AF // Alignment flag
1129  , bool TF // Transpose flag
1130  , bool DF // Density flag
1131  , typename VT2 > // Type of the right-hand side vector
1132 inline bool tryAddAssign( const Subvector<VT1,AF,TF,DF>& lhs, const Vector<VT2,TF>& rhs, size_t index )
1133 {
1134  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1135  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
1136 
1137  return tryAddAssign( lhs.operand(), ~rhs, lhs.offset() + index );
1138 }
1140 //*************************************************************************************************
1141 
1142 
1143 //*************************************************************************************************
1158 template< typename VT1 // Type of the vector
1159  , bool AF // Alignment flag
1160  , bool TF // Transpose flag
1161  , bool DF // Density flag
1162  , typename VT2 > // Type of the right-hand side vector
1163 inline bool trySubAssign( const Subvector<VT1,AF,TF,DF>& lhs, const Vector<VT2,TF>& rhs, size_t index )
1164 {
1165  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1166  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
1167 
1168  return trySubAssign( lhs.operand(), ~rhs, lhs.offset() + index );
1169 }
1171 //*************************************************************************************************
1172 
1173 
1174 //*************************************************************************************************
1189 template< typename VT1 // Type of the vector
1190  , bool AF // Alignment flag
1191  , bool TF // Transpose flag
1192  , bool DF // Density flag
1193  , typename VT2 > // Type of the right-hand side vector
1194 inline bool tryMultAssign( const Subvector<VT1,AF,TF,DF>& lhs, const Vector<VT2,TF>& rhs, size_t index )
1195 {
1196  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1197  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
1198 
1199  return tryMultAssign( lhs.operand(), ~rhs, lhs.offset() + index );
1200 }
1202 //*************************************************************************************************
1203 
1204 
1205 //*************************************************************************************************
1220 template< typename VT1 // Type of the vector
1221  , bool AF // Alignment flag
1222  , bool TF // Transpose flag
1223  , bool DF // Density flag
1224  , typename VT2 > // Type of the right-hand side vector
1225 inline bool tryDivAssign( const Subvector<VT1,AF,TF,DF>& lhs, const Vector<VT2,TF>& rhs, size_t index )
1226 {
1227  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1228  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
1229 
1230  return tryDivAssign( lhs.operand(), ~rhs, lhs.offset() + index );
1231 }
1233 //*************************************************************************************************
1234 
1235 
1236 //*************************************************************************************************
1251 template< typename VT // Type of the vector
1252  , bool AF // Alignment flag
1253  , bool TF // Transpose flag
1254  , bool DF > // Density flag
1255 inline decltype(auto) derestrict( Subvector<VT,AF,TF,DF>& sv )
1256 {
1257  return subvector( derestrict( sv.operand() ), sv.offset(), sv.size() );
1258 }
1260 //*************************************************************************************************
1261 
1262 
1263 //*************************************************************************************************
1278 template< typename VT // Type of the vector
1279  , bool AF // Alignment flag
1280  , bool TF // Transpose flag
1281  , bool DF > // Density flag
1282 inline decltype(auto) derestrict( Subvector<VT,AF,TF,DF>&& sv )
1283 {
1284  return subvector( derestrict( sv.operand() ), sv.offset(), sv.size() );
1285 }
1287 //*************************************************************************************************
1288 
1289 
1290 
1291 
1292 //=================================================================================================
1293 //
1294 // ISRESTRICTED SPECIALIZATIONS
1295 //
1296 //=================================================================================================
1297 
1298 //*************************************************************************************************
1300 template< typename VT, bool AF, bool TF, bool DF >
1301 struct IsRestricted< Subvector<VT,AF,TF,DF> >
1302  : public BoolConstant< IsRestricted<VT>::value >
1303 {};
1305 //*************************************************************************************************
1306 
1307 
1308 
1309 
1310 //=================================================================================================
1311 //
1312 // HASCONSTDATAACCESS SPECIALIZATIONS
1313 //
1314 //=================================================================================================
1315 
1316 //*************************************************************************************************
1318 template< typename VT, bool AF, bool TF >
1319 struct HasConstDataAccess< Subvector<VT,AF,TF,true> >
1320  : public BoolConstant< HasConstDataAccess<VT>::value >
1321 {};
1323 //*************************************************************************************************
1324 
1325 
1326 
1327 
1328 //=================================================================================================
1329 //
1330 // HASMUTABLEDATAACCESS SPECIALIZATIONS
1331 //
1332 //=================================================================================================
1333 
1334 //*************************************************************************************************
1336 template< typename VT, bool AF, bool TF >
1337 struct HasMutableDataAccess< Subvector<VT,AF,TF,true> >
1338  : public BoolConstant< HasMutableDataAccess<VT>::value >
1339 {};
1341 //*************************************************************************************************
1342 
1343 
1344 
1345 
1346 //=================================================================================================
1347 //
1348 // ISALIGNED SPECIALIZATIONS
1349 //
1350 //=================================================================================================
1351 
1352 //*************************************************************************************************
1354 template< typename VT, bool TF >
1355 struct IsAligned< Subvector<VT,aligned,TF,true> >
1356  : public TrueType
1357 {};
1359 //*************************************************************************************************
1360 
1361 
1362 
1363 
1364 //=================================================================================================
1365 //
1366 // ADDTRAIT SPECIALIZATIONS
1367 //
1368 //=================================================================================================
1369 
1370 //*************************************************************************************************
1372 template< typename VT, bool AF, bool TF, bool DF, typename T >
1373 struct AddTrait< Subvector<VT,AF,TF,DF>, T >
1374 {
1375  using Type = AddTrait_< SubvectorTrait_<VT>, T >;
1376 };
1377 
1378 template< typename T, typename VT, bool AF, bool TF, bool DF >
1379 struct AddTrait< T, Subvector<VT,AF,TF,DF> >
1380 {
1381  using Type = AddTrait_< T, SubvectorTrait_<VT> >;
1382 };
1384 //*************************************************************************************************
1385 
1386 
1387 
1388 
1389 //=================================================================================================
1390 //
1391 // SUBTRAIT SPECIALIZATIONS
1392 //
1393 //=================================================================================================
1394 
1395 //*************************************************************************************************
1397 template< typename VT, bool AF, bool TF, bool DF, typename T >
1398 struct SubTrait< Subvector<VT,AF,TF,DF>, T >
1399 {
1400  using Type = SubTrait_< SubvectorTrait_<VT>, T >;
1401 };
1402 
1403 template< typename T, typename VT, bool AF, bool TF, bool DF >
1404 struct SubTrait< T, Subvector<VT,AF,TF,DF> >
1405 {
1406  using Type = SubTrait_< T, SubvectorTrait_<VT> >;
1407 };
1409 //*************************************************************************************************
1410 
1411 
1412 
1413 
1414 //=================================================================================================
1415 //
1416 // MULTTRAIT SPECIALIZATIONS
1417 //
1418 //=================================================================================================
1419 
1420 //*************************************************************************************************
1422 template< typename VT, bool AF, bool TF, bool DF, typename T >
1423 struct MultTrait< Subvector<VT,AF,TF,DF>, T >
1424 {
1425  using Type = MultTrait_< SubvectorTrait_<VT>, T >;
1426 };
1427 
1428 template< typename T, typename VT, bool AF, bool TF, bool DF >
1429 struct MultTrait< T, Subvector<VT,AF,TF,DF> >
1430 {
1431  using Type = MultTrait_< T, SubvectorTrait_<VT> >;
1432 };
1434 //*************************************************************************************************
1435 
1436 
1437 
1438 
1439 //=================================================================================================
1440 //
1441 // DIVTRAIT SPECIALIZATIONS
1442 //
1443 //=================================================================================================
1444 
1445 //*************************************************************************************************
1447 template< typename VT, bool AF, bool TF, bool DF, typename T >
1448 struct DivTrait< Subvector<VT,AF,TF,DF>, T >
1449 {
1450  using Type = DivTrait_< SubvectorTrait_<VT>, T >;
1451 };
1452 
1453 template< typename T, typename VT, bool AF, bool TF, bool DF >
1454 struct DivTrait< T, Subvector<VT,AF,TF,DF> >
1455 {
1456  using Type = DivTrait_< T, SubvectorTrait_<VT> >;
1457 };
1459 //*************************************************************************************************
1460 
1461 
1462 
1463 
1464 //=================================================================================================
1465 //
1466 // CROSSTRAIT SPECIALIZATIONS
1467 //
1468 //=================================================================================================
1469 
1470 //*************************************************************************************************
1472 template< typename VT, bool AF, bool TF, bool DF, typename T >
1473 struct CrossTrait< Subvector<VT,AF,TF,DF>, T >
1474 {
1475  using Type = CrossTrait_< SubvectorTrait_<VT>, T >;
1476 };
1477 
1478 template< typename T, typename VT, bool AF, bool TF, bool DF >
1479 struct CrossTrait< T, Subvector<VT,AF,TF,DF> >
1480 {
1481  using Type = CrossTrait_< T, SubvectorTrait_<VT> >;
1482 };
1484 //*************************************************************************************************
1485 
1486 } // namespace blaze
1487 
1488 #endif
#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.
View on a specific subvector of a dense or sparse vector.The Subvector class template represents a vi...
Definition: BaseTemplate.h:434
Compile time check for low-level access to constant data.This type trait tests whether the given data...
Definition: HasConstDataAccess.h:75
Base class for all vector transposition expression templates.The VecTransExpr class serves as a tag f...
Definition: VecTransExpr.h:66
Header file for the alignment flag values.
Header file for the VecVecDivExpr base class.
Header file for the subtraction trait.
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:786
Header file for basic type definitions.
Base class for all vector evaluation expression templates.The VecEvalExpr class serves as a tag for a...
Definition: VecEvalExpr.h:66
Subvector< VT, AF > subvector(Vector< VT, TF > &vector, size_t index, size_t size)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:322
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
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
Subvector specialization for sparse vectors.
Base class for all cross product expression templates.The CrossExpr class serves as a tag for all exp...
Definition: CrossExpr.h:66
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:560
Base class for all vector serial evaluation expression templates.The VecSerialExpr class serves as a ...
Definition: VecSerialExpr.h:67
Header file for the VecScalarDivExpr base class.
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:250
Base class for all vector/scalar division expression templates.The VecScalarDivExpr class serves as a...
Definition: VecScalarDivExpr.h:66
Header file for the VecEvalExpr base class.
Header file for the VecScalarMultExpr base class.
Header file for the VecVecMapExpr base class.
Base template for the CrossTrait class.
Definition: CrossTrait.h:116
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
Subvector specialization for dense vectors.
Header file for the multiplication trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the VecVecAddExpr base class.
Header file for the implementation of the Subvector base template.
Base class for all vector/vector division expression templates.The VecVecDivExpr class serves as a ta...
Definition: VecVecDivExpr.h:66
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
Header file for the subvector trait.
Header file for the IsAligned type trait.
decltype(auto) eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:797
Base class for all unary vector map expression templates.The VecMapExpr class serves as a tag for all...
Definition: VecMapExpr.h:66
Header file for the exception macros of the math module.
Header file for the VecVecMultExpr base class.
typename CrossTrait< T1, T2 >::Type CrossTrait_
Auxiliary alias declaration for the CrossTrait class template.The CrossTrait_ alias declaration provi...
Definition: CrossTrait.h:159
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:264
Header file for the VecVecSubExpr base class.
Base class for all vector/vector addition expression templates.The VecVecAddExpr class serves as a ta...
Definition: VecVecAddExpr.h:66
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:580
typename DivTrait< T1, T2 >::Type DivTrait_
Auxiliary alias declaration for the DivTrait class template.The DivTrait_ alias declaration provides ...
Definition: DivTrait.h:250
Header file for the CrossExpr base class.
Header file for the HasConstDataAccess type trait.
Base class for all vector/scalar multiplication expression templates.The VecScalarMultExpr class serv...
Definition: VecScalarMultExpr.h:67
Header file for the VecSerialExpr base class.
Header file for the VecTransExpr base class.
Base template for the AddTrait class.
Definition: AddTrait.h:139
Base template for the MultTrait class.
Definition: MultTrait.h:139
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division 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.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:819
Header file for the HasMutableDataAccess type trait.
Header file for the RemoveReference type trait.
Base template for the DivTrait class.
Definition: DivTrait.h:139
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:790
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:177
typename SubTrait< T1, T2 >::Type SubTrait_
Auxiliary alias declaration for the SubTrait class template.The SubTrait_ alias declaration provides ...
Definition: SubTrait.h:250
Header file for the IntegralConstant class template.
Base class for all binary vector map expression templates.The VecVecMapExpr class serves as a tag for...
Definition: VecVecMapExpr.h:66
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:252
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:600
Base template for the SubTrait class.
Definition: SubTrait.h:139
Base class for all vector/vector subtraction expression templates.The VecVecSubExpr class serves as a...
Definition: VecVecSubExpr.h:66
Header file for the Vector CRTP base class.
Base class for all vector/vector multiplication expression templates.The VecVecMultExpr class serves ...
Definition: VecVecMultExpr.h:66
typename AddTrait< T1, T2 >::Type AddTrait_
Auxiliary alias declaration for the AddTrait class template.The AddTrait_ alias declaration provides ...
Definition: AddTrait.h:250
#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 TrueType type/value trait base class.
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:1133