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/DisableIf.h>
76 #include <blaze/util/EnableIf.h>
79 #include <blaze/util/mpl/Or.h>
80 #include <blaze/util/TrueType.h>
81 #include <blaze/util/Types.h>
83 
84 
85 namespace blaze {
86 
87 //=================================================================================================
88 //
89 // GLOBAL FUNCTION
90 //
91 //=================================================================================================
92 
93 //*************************************************************************************************
149 template< typename VT // Type of the vector
150  , bool TF > // Transpose flag
151 inline SubvectorExprTrait_<VT,unaligned>
152  subvector( Vector<VT,TF>& vector, size_t index, size_t size )
153 {
155 
156  return subvector<unaligned>( ~vector, index, size );
157 }
158 //*************************************************************************************************
159 
160 
161 //*************************************************************************************************
217 template< typename VT // Type of the vector
218  , bool TF > // Transpose flag
220  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
221 {
223 
224  return subvector<unaligned>( ~vector, index, size );
225 }
226 //*************************************************************************************************
227 
228 
229 //*************************************************************************************************
244 template< typename VT // Type of the vector
245  , bool TF > // Transpose flag
247  subvector( Vector<VT,TF>&& vector, size_t index, size_t size )
248 {
250 
251  return subvector<unaligned>( ~vector, index, size );
252 }
253 //*************************************************************************************************
254 
255 
256 //*************************************************************************************************
327 template< bool AF // Alignment flag
328  , typename VT // Type of the dense vector
329  , bool TF > // Transpose flag
331  subvector( Vector<VT,TF>& vector, size_t index, size_t size )
332 {
334 
335  return SubvectorExprTrait_<VT,AF>( ~vector, index, size );
336 }
337 //*************************************************************************************************
338 
339 
340 //*************************************************************************************************
409 template< bool AF // Alignment flag
410  , typename VT // Type of the dense vector
411  , bool TF > // Transpose flag
412 inline const DisableIf_< Or< IsComputation<VT>, IsTransExpr<VT> >, SubvectorExprTrait_<const VT,AF> >
413  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
414 {
416 
417  return SubvectorExprTrait_<const VT,AF>( ~vector, index, size );
418 }
419 //*************************************************************************************************
420 
421 
422 //*************************************************************************************************
439 template< bool AF // Alignment flag
440  , typename VT // Type of the dense vector
441  , bool TF > // Transpose flag
442 inline DisableIf_< Or< IsComputation<VT>, IsTransExpr<VT> >, SubvectorExprTrait_<VT,AF> >
443  subvector( Vector<VT,TF>&& vector, size_t index, size_t size )
444 {
446 
447  return SubvectorExprTrait_<VT,AF>( ~vector, index, size );
448 }
449 //*************************************************************************************************
450 
451 
452 
453 
454 //=================================================================================================
455 //
456 // GLOBAL RESTRUCTURING OPERATORS
457 //
458 //=================================================================================================
459 
460 //*************************************************************************************************
473 template< bool AF // Alignment flag
474  , typename VT // Type of the vector
475  , bool TF > // Transpose flag
477  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
478 {
480 
481  return subvector<AF>( (~vector).leftOperand() , index, size ) +
482  subvector<AF>( (~vector).rightOperand(), index, size );
483 }
485 //*************************************************************************************************
486 
487 
488 //*************************************************************************************************
501 template< bool AF // Alignment flag
502  , typename VT // Type of the vector
503  , bool TF > // Transpose flag
505  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
506 {
508 
509  return subvector<AF>( (~vector).leftOperand() , index, size ) -
510  subvector<AF>( (~vector).rightOperand(), index, size );
511 }
513 //*************************************************************************************************
514 
515 
516 //*************************************************************************************************
529 template< bool AF // Alignment flag
530  , typename VT // Type of the vector
531  , bool TF > // Transpose flag
533  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
534 {
536 
537  return subvector<AF>( (~vector).leftOperand() , index, size ) *
538  subvector<AF>( (~vector).rightOperand(), index, size );
539 }
541 //*************************************************************************************************
542 
543 
544 //*************************************************************************************************
557 template< bool AF // Alignment flag
558  , typename VT // Type of the vector
559  , bool TF > // Transpose flag
561  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
562 {
564 
565  return subvector<AF>( (~vector).leftOperand() , index, size ) /
566  subvector<AF>( (~vector).rightOperand(), index, size );
567 }
569 //*************************************************************************************************
570 
571 
572 //*************************************************************************************************
585 template< bool AF // Alignment flag
586  , typename VT // Type of the vector
587  , bool TF > // Transpose flag
589  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
590 {
592 
593  return SubvectorExprTrait_<VT,unaligned>( ~vector, index, size );
594 }
596 //*************************************************************************************************
597 
598 
599 //*************************************************************************************************
612 template< bool AF // Alignment flag
613  , typename VT // Type of the vector
614  , bool TF > // Transpose flag
616  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
617 {
619 
620  return subvector<AF>( (~vector).leftOperand(), index, size ) * (~vector).rightOperand();
621 }
623 //*************************************************************************************************
624 
625 
626 //*************************************************************************************************
639 template< bool AF // Alignment flag
640  , typename VT // Type of the vector
641  , bool TF > // Transpose flag
643  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
644 {
646 
647  return subvector<AF>( (~vector).leftOperand(), index, size ) / (~vector).rightOperand();
648 }
650 //*************************************************************************************************
651 
652 
653 //*************************************************************************************************
666 template< bool AF // Alignment flag
667  , typename VT // Type of the vector
668  , bool TF > // Transpose flag
670  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
671 {
673 
674  return forEach( subvector<AF>( (~vector).operand(), index, size ), (~vector).operation() );
675 }
677 //*************************************************************************************************
678 
679 
680 //*************************************************************************************************
693 template< bool AF // Alignment flag
694  , typename VT // Type of the vector
695  , bool TF > // Transpose flag
697  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
698 {
700 
701  return eval( subvector<AF>( (~vector).operand(), index, size ) );
702 }
704 //*************************************************************************************************
705 
706 
707 //*************************************************************************************************
720 template< bool AF // Alignment flag
721  , typename VT // Type of the vector
722  , bool TF > // Transpose flag
724  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
725 {
727 
728  return serial( subvector<AF>( (~vector).operand(), index, size ) );
729 }
731 //*************************************************************************************************
732 
733 
734 //*************************************************************************************************
747 template< bool AF // Alignment flag
748  , typename VT // Type of the vector
749  , bool TF > // Transpose flag
751  subvector( const Vector<VT,TF>& vector, size_t index, size_t size )
752 {
754 
755  return trans( subvector<AF>( (~vector).operand(), index, size ) );
756 }
758 //*************************************************************************************************
759 
760 
761 //*************************************************************************************************
773 template< bool AF1 // Required alignment flag
774  , typename VT // Type of the dense vector
775  , bool AF2 // Present alignment flag
776  , bool TF // Transpose flag
777  , bool DF > // Density flag
778 inline const Subvector<VT,AF1,TF,DF>
779  subvector( const Subvector<VT,AF2,TF,DF>& sv, size_t index, size_t size )
780 {
782 
783  if( index + size > sv.size() ) {
784  BLAZE_THROW_INVALID_ARGUMENT( "Invalid subvector specification" );
785  }
786 
787  return Subvector<VT,AF1,TF,DF>( sv.vector_, sv.offset_ + index, size );
788 }
790 //*************************************************************************************************
791 
792 
793 
794 
795 //=================================================================================================
796 //
797 // SUBVECTOR OPERATORS
798 //
799 //=================================================================================================
800 
801 //*************************************************************************************************
804 template< typename VT, bool AF, bool TF, bool DF >
805 inline void reset( Subvector<VT,AF,TF,DF>& sv );
806 
807 template< typename VT, bool AF, bool TF, bool DF >
808 inline void reset( Subvector<VT,AF,TF,DF>&& sv );
809 
810 template< typename VT, bool AF, bool TF, bool DF >
811 inline void clear( Subvector<VT,AF,TF,DF>& sv );
812 
813 template< typename VT, bool AF, bool TF, bool DF >
814 inline void clear( Subvector<VT,AF,TF,DF>&& sv );
815 
816 template< bool RF, typename VT, bool AF, bool TF, bool DF >
817 inline bool isDefault( const Subvector<VT,AF,TF,DF>& sv );
818 
819 template< typename VT, bool AF, bool TF, bool DF >
820 inline bool isIntact( const Subvector<VT,AF,TF,DF>& sv ) noexcept;
821 
822 template< typename VT, bool AF, bool TF, bool DF >
823 inline bool isSame( const Subvector<VT,AF,TF,DF>& a, const Vector<VT,TF>& b ) noexcept;
824 
825 template< typename VT, bool AF, bool TF, bool DF >
826 inline bool isSame( const Vector<VT,TF>& a, const Subvector<VT,AF,TF,DF>& b ) noexcept;
827 
828 template< typename VT, bool AF, bool TF, bool DF >
829 inline bool isSame( const Subvector<VT,AF,TF,DF>& a, const Subvector<VT,AF,TF,DF>& b ) noexcept;
831 //*************************************************************************************************
832 
833 
834 //*************************************************************************************************
841 template< typename VT // Type of the vector
842  , bool AF // Alignment flag
843  , bool TF // Transpose flag
844  , bool DF > // Density flag
845 inline void reset( Subvector<VT,AF,TF,DF>& sv )
846 {
847  sv.reset();
848 }
849 //*************************************************************************************************
850 
851 
852 //*************************************************************************************************
859 template< typename VT // Type of the vector
860  , bool AF // Alignment flag
861  , bool TF // Transpose flag
862  , bool DF > // Density flag
863 inline void reset( Subvector<VT,AF,TF,DF>&& sv )
864 {
865  sv.reset();
866 }
867 //*************************************************************************************************
868 
869 
870 //*************************************************************************************************
877 template< typename VT // Type of the vector
878  , bool AF // Alignment flag
879  , bool TF // Transpose flag
880  , bool DF > // Density flag
881 inline void clear( Subvector<VT,AF,TF,DF>& sv )
882 {
883  sv.reset();
884 }
885 //*************************************************************************************************
886 
887 
888 //*************************************************************************************************
895 template< typename VT // Type of the vector
896  , bool AF // Alignment flag
897  , bool TF // Transpose flag
898  , bool DF > // Density flag
899 inline void clear( Subvector<VT,AF,TF,DF>&& sv )
900 {
901  sv.reset();
902 }
903 //*************************************************************************************************
904 
905 
906 //*************************************************************************************************
932 template< bool RF // Relaxation flag
933  , typename VT // Type of the vector
934  , bool AF // Alignment flag
935  , bool TF // Transpose flag
936  , bool DF > // Density flag
937 inline bool isDefault( const Subvector<VT,AF,TF,DF>& sv )
938 {
939  for( size_t i=0UL; i<sv.size(); ++i )
940  if( !isDefault<RF>( sv[i] ) ) return false;
941  return true;
942 }
943 //*************************************************************************************************
944 
945 
946 //*************************************************************************************************
965 template< bool RF // Relaxation flag
966  , typename VT // Type of the sparse vector
967  , bool AF // Alignment flag
968  , bool TF > // Transpose flag
969 inline bool isDefault( const Subvector<VT,AF,TF,false>& sv )
970 {
972 
973  const ConstIterator end( sv.end() );
974  for( ConstIterator element=sv.begin(); element!=end; ++element )
975  if( !isDefault<RF>( element->value() ) ) return false;
976  return true;
977 }
979 //*************************************************************************************************
980 
981 
982 //*************************************************************************************************
999 template< typename VT // Type of the vector
1000  , bool AF // Alignment flag
1001  , bool TF // Transpose flag
1002  , bool DF > // Density flag
1003 inline bool isIntact( const Subvector<VT,AF,TF,DF>& sv ) noexcept
1004 {
1005  return ( sv.offset_ + sv.size_ <= sv.vector_.size() &&
1006  isIntact( sv.vector_ ) );
1007 }
1008 //*************************************************************************************************
1009 
1010 
1011 //*************************************************************************************************
1023 template< typename VT // Type of the vector
1024  , bool AF // Alignment flag
1025  , bool TF // Transpose flag
1026  , bool DF > // Density flag
1027 inline bool isSame( const Subvector<VT,AF,TF,DF>& a, const Vector<VT,TF>& b ) noexcept
1028 {
1029  return ( isSame( a.vector_, ~b ) && ( a.size() == (~b).size() ) );
1030 }
1031 //*************************************************************************************************
1032 
1033 
1034 //*************************************************************************************************
1046 template< typename VT // Type of the vector
1047  , bool AF // Alignment flag
1048  , bool TF // Transpose flag
1049  , bool DF > // Density flag
1050 inline bool isSame( const Vector<VT,TF>& a, const Subvector<VT,AF,TF,DF>& b ) noexcept
1051 {
1052  return ( isSame( ~a, b.vector_ ) && ( (~a).size() == b.size() ) );
1053 }
1054 //*************************************************************************************************
1055 
1056 
1057 //*************************************************************************************************
1069 template< typename VT // Type of the vector
1070  , bool AF // Alignment flag
1071  , bool TF // Transpose flag
1072  , bool DF > // Density flag
1073 inline bool isSame( const Subvector<VT,AF,TF,DF>& a, const Subvector<VT,AF,TF,DF>& b ) noexcept
1074 {
1075  return ( isSame( a.vector_, b.vector_ ) && ( a.offset_ == b.offset_ ) && ( a.size_ == b.size_ ) );
1076 }
1077 //*************************************************************************************************
1078 
1079 
1080 //*************************************************************************************************
1095 template< typename VT1 // Type of the vector
1096  , bool AF // Alignment flag
1097  , bool TF // Transpose flag
1098  , bool DF // Density flag
1099  , typename VT2 > // Type of the right-hand side vector
1100 inline bool tryAssign( const Subvector<VT1,AF,TF,DF>& lhs, const Vector<VT2,TF>& rhs, size_t index )
1101 {
1102  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1103  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
1104 
1105  return tryAssign( lhs.vector_, ~rhs, lhs.offset_ + index );
1106 }
1108 //*************************************************************************************************
1109 
1110 
1111 //*************************************************************************************************
1126 template< typename VT1 // Type of the vector
1127  , bool AF // Alignment flag
1128  , bool TF // Transpose flag
1129  , bool DF // Density flag
1130  , typename VT2 > // Type of the right-hand side vector
1131 inline bool tryAddAssign( const Subvector<VT1,AF,TF,DF>& lhs, const Vector<VT2,TF>& rhs, size_t index )
1132 {
1133  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1134  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
1135 
1136  return tryAddAssign( lhs.vector_, ~rhs, lhs.offset_ + index );
1137 }
1139 //*************************************************************************************************
1140 
1141 
1142 //*************************************************************************************************
1157 template< typename VT1 // Type of the vector
1158  , bool AF // Alignment flag
1159  , bool TF // Transpose flag
1160  , bool DF // Density flag
1161  , typename VT2 > // Type of the right-hand side vector
1162 inline bool trySubAssign( const Subvector<VT1,AF,TF,DF>& lhs, const Vector<VT2,TF>& rhs, size_t index )
1163 {
1164  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1165  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
1166 
1167  return trySubAssign( lhs.vector_, ~rhs, lhs.offset_ + index );
1168 }
1170 //*************************************************************************************************
1171 
1172 
1173 //*************************************************************************************************
1188 template< typename VT1 // Type of the vector
1189  , bool AF // Alignment flag
1190  , bool TF // Transpose flag
1191  , bool DF // Density flag
1192  , typename VT2 > // Type of the right-hand side vector
1193 inline bool tryMultAssign( const Subvector<VT1,AF,TF,DF>& lhs, const Vector<VT2,TF>& rhs, size_t index )
1194 {
1195  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1196  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
1197 
1198  return tryMultAssign( lhs.vector_, ~rhs, lhs.offset_ + index );
1199 }
1201 //*************************************************************************************************
1202 
1203 
1204 //*************************************************************************************************
1219 template< typename VT1 // Type of the vector
1220  , bool AF // Alignment flag
1221  , bool TF // Transpose flag
1222  , bool DF // Density flag
1223  , typename VT2 > // Type of the right-hand side vector
1224 inline bool tryDivAssign( const Subvector<VT1,AF,TF,DF>& lhs, const Vector<VT2,TF>& rhs, size_t index )
1225 {
1226  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1227  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.size() - index, "Invalid vector size" );
1228 
1229  return tryDivAssign( lhs.vector_, ~rhs, lhs.offset_ + index );
1230 }
1232 //*************************************************************************************************
1233 
1234 
1235 //*************************************************************************************************
1250 template< typename VT // Type of the vector
1251  , bool AF // Alignment flag
1252  , bool TF // Transpose flag
1253  , bool DF > // Density flag
1255 {
1257  return ReturnType( derestrict( sv.vector_ ), sv.offset_, sv.size_ );
1258 }
1260 //*************************************************************************************************
1261 
1262 
1263 
1264 
1265 //=================================================================================================
1266 //
1267 // ISRESTRICTED SPECIALIZATIONS
1268 //
1269 //=================================================================================================
1270 
1271 //*************************************************************************************************
1273 template< typename VT, bool AF, bool TF, bool DF >
1274 struct IsRestricted< Subvector<VT,AF,TF,DF> >
1275  : public BoolConstant< IsRestricted<VT>::value >
1276 {};
1278 //*************************************************************************************************
1279 
1280 
1281 
1282 
1283 //=================================================================================================
1284 //
1285 // DERESTRICTTRAIT SPECIALIZATIONS
1286 //
1287 //=================================================================================================
1288 
1289 //*************************************************************************************************
1291 template< typename VT, bool AF, bool TF, bool DF >
1292 struct DerestrictTrait< Subvector<VT,AF,TF,DF> >
1293 {
1294  using Type = Subvector< RemoveReference_< DerestrictTrait_<VT> >, AF, TF, DF >;
1295 };
1297 //*************************************************************************************************
1298 
1299 
1300 
1301 
1302 //=================================================================================================
1303 //
1304 // HASCONSTDATAACCESS SPECIALIZATIONS
1305 //
1306 //=================================================================================================
1307 
1308 //*************************************************************************************************
1310 template< typename VT, bool AF, bool TF >
1311 struct HasConstDataAccess< Subvector<VT,AF,TF,true> >
1312  : public BoolConstant< HasConstDataAccess<VT>::value >
1313 {};
1315 //*************************************************************************************************
1316 
1317 
1318 
1319 
1320 //=================================================================================================
1321 //
1322 // HASMUTABLEDATAACCESS SPECIALIZATIONS
1323 //
1324 //=================================================================================================
1325 
1326 //*************************************************************************************************
1328 template< typename VT, bool AF, bool TF >
1329 struct HasMutableDataAccess< Subvector<VT,AF,TF,true> >
1330  : public BoolConstant< HasMutableDataAccess<VT>::value >
1331 {};
1333 //*************************************************************************************************
1334 
1335 
1336 
1337 
1338 //=================================================================================================
1339 //
1340 // ISALIGNED SPECIALIZATIONS
1341 //
1342 //=================================================================================================
1343 
1344 //*************************************************************************************************
1346 template< typename VT, bool TF >
1347 struct IsAligned< Subvector<VT,aligned,TF,true> > : public TrueType
1348 {};
1350 //*************************************************************************************************
1351 
1352 
1353 
1354 
1355 //=================================================================================================
1356 //
1357 // ADDTRAIT SPECIALIZATIONS
1358 //
1359 //=================================================================================================
1360 
1361 //*************************************************************************************************
1363 template< typename VT, bool AF, bool TF, bool DF, typename T >
1364 struct AddTrait< Subvector<VT,AF,TF,DF>, T >
1365 {
1366  using Type = AddTrait_< SubvectorTrait_<VT>, T >;
1367 };
1368 
1369 template< typename T, typename VT, bool AF, bool TF, bool DF >
1370 struct AddTrait< T, Subvector<VT,AF,TF,DF> >
1371 {
1372  using Type = AddTrait_< T, SubvectorTrait_<VT> >;
1373 };
1375 //*************************************************************************************************
1376 
1377 
1378 
1379 
1380 //=================================================================================================
1381 //
1382 // SUBTRAIT SPECIALIZATIONS
1383 //
1384 //=================================================================================================
1385 
1386 //*************************************************************************************************
1388 template< typename VT, bool AF, bool TF, bool DF, typename T >
1389 struct SubTrait< Subvector<VT,AF,TF,DF>, T >
1390 {
1391  using Type = SubTrait_< SubvectorTrait_<VT>, T >;
1392 };
1393 
1394 template< typename T, typename VT, bool AF, bool TF, bool DF >
1395 struct SubTrait< T, Subvector<VT,AF,TF,DF> >
1396 {
1397  using Type = SubTrait_< T, SubvectorTrait_<VT> >;
1398 };
1400 //*************************************************************************************************
1401 
1402 
1403 
1404 
1405 //=================================================================================================
1406 //
1407 // MULTTRAIT SPECIALIZATIONS
1408 //
1409 //=================================================================================================
1410 
1411 //*************************************************************************************************
1413 template< typename VT, bool AF, bool TF, bool DF, typename T >
1414 struct MultTrait< Subvector<VT,AF,TF,DF>, T >
1415 {
1416  using Type = MultTrait_< SubvectorTrait_<VT>, T >;
1417 };
1418 
1419 template< typename T, typename VT, bool AF, bool TF, bool DF >
1420 struct MultTrait< T, Subvector<VT,AF,TF,DF> >
1421 {
1422  using Type = MultTrait_< T, SubvectorTrait_<VT> >;
1423 };
1425 //*************************************************************************************************
1426 
1427 
1428 
1429 
1430 //=================================================================================================
1431 //
1432 // CROSSTRAIT SPECIALIZATIONS
1433 //
1434 //=================================================================================================
1435 
1436 //*************************************************************************************************
1438 template< typename VT, bool AF, bool TF, bool DF, typename T >
1439 struct CrossTrait< Subvector<VT,AF,TF,DF>, T >
1440 {
1441  using Type = CrossTrait_< SubvectorTrait_<VT>, T >;
1442 };
1443 
1444 template< typename T, typename VT, bool AF, bool TF, bool DF >
1445 struct CrossTrait< T, Subvector<VT,AF,TF,DF> >
1446 {
1447  using Type = CrossTrait_< T, SubvectorTrait_<VT> >;
1448 };
1450 //*************************************************************************************************
1451 
1452 
1453 
1454 
1455 //=================================================================================================
1456 //
1457 // DIVTRAIT SPECIALIZATIONS
1458 //
1459 //=================================================================================================
1460 
1461 //*************************************************************************************************
1463 template< typename VT, bool AF, bool TF, bool DF, typename T >
1464 struct DivTrait< Subvector<VT,AF,TF,DF>, T >
1465 {
1466  using Type = DivTrait_< SubvectorTrait_<VT>, T >;
1467 };
1468 
1469 template< typename T, typename VT, bool AF, bool TF, bool DF >
1470 struct DivTrait< T, Subvector<VT,AF,TF,DF> >
1471 {
1472  using Type = DivTrait_< T, SubvectorTrait_<VT> >;
1473 };
1475 //*************************************************************************************************
1476 
1477 
1478 
1479 
1480 //=================================================================================================
1481 //
1482 // SUBVECTORTRAIT SPECIALIZATIONS
1483 //
1484 //=================================================================================================
1485 
1486 //*************************************************************************************************
1488 template< typename VT, bool AF, bool TF, bool DF >
1489 struct SubvectorTrait< Subvector<VT,AF,TF,DF> >
1490 {
1492 };
1494 //*************************************************************************************************
1495 
1496 
1497 
1498 
1499 //=================================================================================================
1500 //
1501 // SUBVECTOREXPRTRAIT SPECIALIZATIONS
1502 //
1503 //=================================================================================================
1504 
1505 //*************************************************************************************************
1507 template< typename VT, bool AF1, bool TF, bool DF, bool AF2 >
1508 struct SubvectorExprTrait< Subvector<VT,AF1,TF,DF>, AF2 >
1509 {
1510  using Type = Subvector<VT,AF2,TF,DF>;
1511 };
1513 //*************************************************************************************************
1514 
1515 
1516 //*************************************************************************************************
1518 template< typename VT, bool AF1, bool TF, bool DF, bool AF2 >
1519 struct SubvectorExprTrait< const Subvector<VT,AF1,TF,DF>, AF2 >
1520 {
1521  using Type = Subvector<VT,AF2,TF,DF>;
1522 };
1524 //*************************************************************************************************
1525 
1526 
1527 //*************************************************************************************************
1529 template< typename VT, bool AF1, bool TF, bool DF, bool AF2 >
1530 struct SubvectorExprTrait< volatile Subvector<VT,AF1,TF,DF>, AF2 >
1531 {
1532  using Type = Subvector<VT,AF2,TF,DF>;
1533 };
1535 //*************************************************************************************************
1536 
1537 
1538 //*************************************************************************************************
1540 template< typename VT, bool AF1, bool TF, bool DF, bool AF2 >
1541 struct SubvectorExprTrait< const volatile Subvector<VT,AF1,TF,DF>, AF2 >
1542 {
1543  using Type = Subvector<VT,AF2,TF,DF>;
1544 };
1546 //*************************************************************************************************
1547 
1548 
1549 //*************************************************************************************************
1551 template< typename VT1, typename VT2, bool TF, bool AF >
1552 struct SubvectorExprTrait< DVecDVecCrossExpr<VT1,VT2,TF>, AF >
1553 {
1554  public:
1555  //**********************************************************************************************
1556  using Type = Subvector< DVecDVecCrossExpr<VT1,VT2,TF>, unaligned, TF, true >;
1557  //**********************************************************************************************
1558 };
1560 //*************************************************************************************************
1561 
1562 
1563 //*************************************************************************************************
1565 template< typename VT1, typename VT2, bool TF, bool AF >
1566 struct SubvectorExprTrait< DVecSVecCrossExpr<VT1,VT2,TF>, AF >
1567 {
1568  public:
1569  //**********************************************************************************************
1570  using Type = Subvector< DVecSVecCrossExpr<VT1,VT2,TF>, unaligned, TF, true >;
1571  //**********************************************************************************************
1572 };
1574 //*************************************************************************************************
1575 
1576 
1577 //*************************************************************************************************
1579 template< typename VT1, typename VT2, bool TF, bool AF >
1580 struct SubvectorExprTrait< SVecDVecCrossExpr<VT1,VT2,TF>, AF >
1581 {
1582  public:
1583  //**********************************************************************************************
1584  using Type = Subvector< SVecDVecCrossExpr<VT1,VT2,TF>, unaligned, TF, true >;
1585  //**********************************************************************************************
1586 };
1588 //*************************************************************************************************
1589 
1590 
1591 //*************************************************************************************************
1593 template< typename VT1, typename VT2, bool TF, bool AF >
1594 struct SubvectorExprTrait< SVecSVecCrossExpr<VT1,VT2,TF>, AF >
1595 {
1596  public:
1597  //**********************************************************************************************
1598  using Type = Subvector< SVecSVecCrossExpr<VT1,VT2,TF>, unaligned, TF, true >;
1599  //**********************************************************************************************
1600 };
1602 //*************************************************************************************************
1603 
1604 } // namespace blaze
1605 
1606 #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.
typename DerestrictTrait< T >::Type DerestrictTrait_
Auxiliary alias declaration for the DerestrictTrait type trait.The DerestrictTrait_ alias declaration...
Definition: DerestrictTrait.h:110
View on a specific subvector of a dense or sparse vector.The Subvector class template represents a vi...
Definition: Forward.h:50
Compile time check for low-level access to constant data.This type trait tests whether the given data...
Definition: HasConstDataAccess.h:75
Evaluation of the expression type type of a subvector operation.Via this type trait it is possible to...
Definition: SubvectorExprTrait.h:79
Header file for the alignment flag values.
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:721
Header file for basic type definitions.
Header file for the IsVecVecMultExpr type trait class.
Header file for the IsCrossExpr type trait class.
Header file for the serial shim.
Header file for the IsVecVecSubExpr type trait class.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:261
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
Subvector specialization for sparse vectors.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
Header file for the IsVecForEachExpr type trait class.
Header file for the IsTransExpr type trait class.
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:245
Header file for the IsVecSerialExpr type trait class.
Base template for the CrossTrait class.
Definition: CrossTrait.h:110
Compile time check for data types with restricted data access.This type trait tests whether the given...
Definition: IsRestricted.h:82
Base template for the SubvectorTrait class.
Definition: SubvectorTrait.h:120
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 IsVecEvalExpr type trait class.
SubvectorExprTrait_< VT, unaligned > 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:152
Header file for the IsVecVecAddExpr type trait class.
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsVecVecDivExpr type trait class.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2939
Header file for the Or class template.
typename SubvectorTrait< VT >::Type SubvectorTrait_
Auxiliary alias declaration for the SubvectorTrait type trait.The SubvectorTrait_ alias declaration p...
Definition: SubvectorTrait.h:155
const DMatForEachExpr< MT, OP, SO > forEach(const DenseMatrix< MT, SO > &dm, OP op)
Evaluates the given custom operation on each single element of the dense matrix dm.
Definition: DMatForEachExpr.h:1046
Header file for the implementation of the Subvector base template.
typename SubvectorExprTrait< VT, AF >::Type SubvectorExprTrait_
Auxiliary alias declaration for the SubvectorExprTrait type trait.The SubvectorExprTrait_ alias decla...
Definition: SubvectorExprTrait.h:133
Header file for the subvector trait.
Header file for the IsVecScalarDivExpr type trait class.
Header file for the IsAligned type trait.
Header file for the exception macros of the math module.
typename CrossTrait< T1, T2 >::Type CrossTrait_
Auxiliary alias declaration for the CrossTrait class template.The CrossTrait_ alias declaration provi...
Definition: CrossTrait.h:135
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:260
const bool unaligned
Alignment flag for unaligned vectors and matrices.Via this flag it is possible to specify subvectors...
Definition: AlignmentFlag.h:64
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
typename DivTrait< T1, T2 >::Type DivTrait_
Auxiliary alias declaration for the DivTrait class template.The DivTrait_ alias declaration provides ...
Definition: DivTrait.h:245
Compile time check whether the given type is a transposition expression template.This type trait clas...
Definition: IsTransExpr.h:71
Header file for the HasConstDataAccess type trait.
Header file for the IsVecTransExpr type trait class.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2934
Base template for the AddTrait class.
Definition: AddTrait.h:143
Base template for the MultTrait class.
Definition: MultTrait.h:143
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:93
Header file for the isDefault shim.
Header file for the HasMutableDataAccess type trait.
const DMatEvalExpr< MT, SO > eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:703
Evaluation of the return type of the derestrict function.Via this type trait it is possible to evalua...
Definition: DerestrictTrait.h:73
Header file for the RemoveReference type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
Base template for the DivTrait class.
Definition: DivTrait.h:143
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
Header file for the IsVecScalarMultExpr type trait class.
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:164
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:733
Header file for the IsComputation type trait class.
typename SubTrait< T1, T2 >::Type SubTrait_
Auxiliary alias declaration for the SubTrait class template.The SubTrait_ alias declaration provides ...
Definition: SubTrait.h:245
Header file for the IntegralConstant class template.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:249
Header file for the SubvectorExprTrait class template.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Base template for the SubTrait class.
Definition: SubTrait.h:143
Header file for the Vector CRTP base class.
typename AddTrait< T1, T2 >::Type AddTrait_
Auxiliary alias declaration for the AddTrait class template.The AddTrait_ alias declaration provides ...
Definition: AddTrait.h:245
#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.