35 #ifndef _BLAZE_MATH_VIEWS_SUBVECTOR_H_ 36 #define _BLAZE_MATH_VIEWS_SUBVECTOR_H_ 149 template<
typename VT
151 inline SubvectorExprTrait_<VT,unaligned>
156 return subvector<unaligned>( ~vector, index,
size );
217 template<
typename VT
224 return subvector<unaligned>( ~vector, index,
size );
244 template<
typename VT
251 return subvector<unaligned>( ~vector, index,
size );
481 return subvector<AF>( (~vector).leftOperand() , index,
size ) +
482 subvector<AF>( (~vector).rightOperand(), index,
size );
509 return subvector<AF>( (~vector).leftOperand() , index,
size ) -
510 subvector<AF>( (~vector).rightOperand(), index,
size );
537 return subvector<AF>( (~vector).leftOperand() , index,
size ) *
538 subvector<AF>( (~vector).rightOperand(), index,
size );
565 return subvector<AF>( (~vector).leftOperand() , index,
size ) /
566 subvector<AF>( (~vector).rightOperand(), index,
size );
620 return subvector<AF>( (~vector).leftOperand(), index,
size ) * (~vector).rightOperand();
647 return subvector<AF>( (~vector).leftOperand(), index,
size ) / (~vector).rightOperand();
674 return forEach( subvector<AF>( (~vector).operand(), index, size ), (~vector).operation() );
701 return eval( subvector<AF>( (~vector).operand(), index, size ) );
728 return serial( subvector<AF>( (~vector).operand(), index, size ) );
755 return trans( subvector<AF>( (~vector).operand(), index, size ) );
783 if( index + size > sv.size() ) {
804 template<
typename VT,
bool AF,
bool TF,
bool DF >
807 template<
typename VT,
bool AF,
bool TF,
bool DF >
810 template<
typename VT,
bool AF,
bool TF,
bool DF >
813 template<
typename VT,
bool AF,
bool TF,
bool DF >
816 template<
bool RF,
typename VT,
bool AF,
bool TF,
bool DF >
819 template<
typename VT,
bool AF,
bool TF,
bool DF >
822 template<
typename VT,
bool AF,
bool TF,
bool DF >
825 template<
typename VT,
bool AF,
bool TF,
bool DF >
828 template<
typename VT,
bool AF,
bool TF,
bool DF >
841 template<
typename VT
859 template<
typename VT
877 template<
typename VT
895 template<
typename VT
939 for(
size_t i=0UL; i<sv.size(); ++i )
940 if( !isDefault<RF>( sv[i] ) )
return false;
973 const ConstIterator
end( sv.end() );
974 for( ConstIterator element=sv.begin(); element!=
end; ++element )
975 if( !isDefault<RF>( element->value() ) )
return false;
999 template<
typename VT
1005 return ( sv.offset_ + sv.size_ <= sv.vector_.size() &&
1023 template<
typename VT
1029 return (
isSame( a.vector_, ~b ) && ( a.size() == (~b).
size() ) );
1046 template<
typename VT
1052 return (
isSame( ~a, b.vector_ ) && ( (~a).size() == b.size() ) );
1069 template<
typename VT
1075 return (
isSame( a.vector_, b.vector_ ) && ( a.offset_ == b.offset_ ) && ( a.size_ == b.size_ ) );
1095 template<
typename VT1
1105 return tryAssign( lhs.vector_, ~rhs, lhs.offset_ + index );
1126 template<
typename VT1
1136 return tryAddAssign( lhs.vector_, ~rhs, lhs.offset_ + index );
1157 template<
typename VT1
1167 return trySubAssign( lhs.vector_, ~rhs, lhs.offset_ + index );
1188 template<
typename VT1
1198 return tryMultAssign( lhs.vector_, ~rhs, lhs.offset_ + index );
1219 template<
typename VT1
1229 return tryDivAssign( lhs.vector_, ~rhs, lhs.offset_ + index );
1250 template<
typename VT
1257 return ReturnType( derestrict( sv.vector_ ), sv.offset_, sv.size_ );
1273 template<
typename VT,
bool AF,
bool TF,
bool DF >
1291 template<
typename VT,
bool AF,
bool TF,
bool DF >
1310 template<
typename VT,
bool AF,
bool TF >
1328 template<
typename VT,
bool AF,
bool TF >
1330 :
public BoolConstant< HasMutableDataAccess<VT>::value >
1346 template<
typename VT,
bool TF >
1363 template<
typename VT,
bool AF,
bool TF,
bool DF,
typename T >
1364 struct AddTrait< Subvector<VT,AF,TF,DF>, T >
1369 template<
typename T,
typename VT,
bool AF,
bool TF,
bool DF >
1370 struct AddTrait< T, Subvector<VT,AF,TF,DF> >
1388 template<
typename VT,
bool AF,
bool TF,
bool DF,
typename T >
1389 struct SubTrait< Subvector<VT,AF,TF,DF>, T >
1394 template<
typename T,
typename VT,
bool AF,
bool TF,
bool DF >
1395 struct SubTrait< T, Subvector<VT,AF,TF,DF> >
1413 template<
typename VT,
bool AF,
bool TF,
bool DF,
typename T >
1414 struct MultTrait< Subvector<VT,AF,TF,DF>, T >
1419 template<
typename T,
typename VT,
bool AF,
bool TF,
bool DF >
1420 struct MultTrait< T, Subvector<VT,AF,TF,DF> >
1438 template<
typename VT,
bool AF,
bool TF,
bool DF,
typename T >
1439 struct CrossTrait< Subvector<VT,AF,TF,DF>, T >
1444 template<
typename T,
typename VT,
bool AF,
bool TF,
bool DF >
1445 struct CrossTrait< T, Subvector<VT,AF,TF,DF> >
1463 template<
typename VT,
bool AF,
bool TF,
bool DF,
typename T >
1464 struct DivTrait< Subvector<VT,AF,TF,DF>, T >
1469 template<
typename T,
typename VT,
bool AF,
bool TF,
bool DF >
1470 struct DivTrait< T, Subvector<VT,AF,TF,DF> >
1488 template<
typename VT,
bool AF,
bool TF,
bool DF >
1507 template<
typename VT,
bool AF1,
bool TF,
bool DF,
bool AF2 >
1518 template<
typename VT,
bool AF1,
bool TF,
bool DF,
bool AF2 >
1529 template<
typename VT,
bool AF1,
bool TF,
bool DF,
bool AF2 >
1540 template<
typename VT,
bool AF1,
bool TF,
bool DF,
bool AF2 >
1551 template<
typename VT1,
typename VT2,
bool TF,
bool AF >
1565 template<
typename VT1,
typename VT2,
bool TF,
bool AF >
1579 template<
typename VT1,
typename VT2,
bool TF,
bool AF >
1593 template<
typename VT1,
typename VT2,
bool TF,
bool AF >
#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.