35 #ifndef _BLAZE_MATH_VIEWS_SUBVECTOR_H_
36 #define _BLAZE_MATH_VIEWS_SUBVECTOR_H_
140 template<
typename VT
142 inline typename SubvectorExprTrait<VT,unaligned>::Type
147 return subvector<unaligned>( ~vector, index,
size );
208 template<
typename VT
210 inline typename SubvectorExprTrait<const VT,unaligned>::Type
215 return subvector<unaligned>( ~vector, index,
size );
294 inline typename DisableIf< Or< IsComputation<VT>, IsTransExpr<VT> >
295 ,
typename SubvectorExprTrait<VT,AF>::Type >::Type
380 inline typename DisableIf< Or< IsComputation<VT>, IsTransExpr<VT> >
381 ,
typename SubvectorExprTrait<const VT,AF>::Type >::Type
416 inline typename EnableIf< IsVecVecAddExpr<VT>,
typename SubvectorExprTrait<VT,AF>::Type >::Type
417 subvector(
const Vector<VT,TF>& vector,
size_t index,
size_t size )
421 return subvector<AF>( (~vector).leftOperand() , index,
size ) +
422 subvector<AF>( (~vector).rightOperand(), index,
size );
444 inline typename EnableIf< IsVecVecSubExpr<VT>,
typename SubvectorExprTrait<VT,AF>::Type >::Type
445 subvector(
const Vector<VT,TF>& vector,
size_t index,
size_t size )
449 return subvector<AF>( (~vector).leftOperand() , index,
size ) -
450 subvector<AF>( (~vector).rightOperand(), index,
size );
472 inline typename EnableIf< IsVecVecMultExpr<VT>,
typename SubvectorExprTrait<VT,AF>::Type >::Type
473 subvector(
const Vector<VT,TF>& vector,
size_t index,
size_t size )
477 return subvector<AF>( (~vector).leftOperand() , index,
size ) *
478 subvector<AF>( (~vector).rightOperand(), index,
size );
500 inline typename EnableIf< IsCrossExpr<VT>,
typename SubvectorExprTrait<VT,unaligned>::Type >::Type
501 subvector(
const Vector<VT,TF>& vector,
size_t index,
size_t size )
505 typedef typename SubvectorExprTrait<VT,unaligned>::Type
ReturnType;
528 inline typename EnableIf< IsMatVecMultExpr<VT>,
typename SubvectorExprTrait<VT,AF>::Type >::Type
529 subvector(
const Vector<VT,TF>& vector,
size_t index,
size_t size )
533 typedef typename RemoveReference< typename VT::LeftOperand >::Type MT;
535 typename VT::LeftOperand left ( (~vector).leftOperand() );
536 typename VT::RightOperand right( (~vector).rightOperand() );
538 const size_t column( ( IsUpper<MT>::value )
539 ?( ( !AF && IsStrictlyUpper<MT>::value )?( index + 1UL ):( index ) )
541 const size_t n( ( IsLower<MT>::value )
542 ?( ( IsUpper<MT>::value )?( size )
543 :( ( IsStrictlyLower<MT>::value && size > 0UL )
544 ?( index + size - 1UL )
545 :( index + size ) ) )
546 :( ( IsUpper<MT>::value )?( left.columns() -
column )
547 :( left.columns() ) ) );
549 return submatrix<AF>( left, index,
column,
size, n ) * subvector<AF>( right, column, n );
571 inline typename EnableIf< IsTVecMatMultExpr<VT>,
typename SubvectorExprTrait<VT,AF>::Type >::Type
572 subvector(
const Vector<VT,TF>& vector,
size_t index,
size_t size )
576 typedef typename RemoveReference< typename VT::RightOperand>::Type MT;
578 typename VT::LeftOperand left ( (~vector).leftOperand() );
579 typename VT::RightOperand right( (~vector).rightOperand() );
581 const size_t row( ( IsLower<MT>::value )
582 ?( ( !AF && IsStrictlyLower<MT>::value )?( index + 1UL ):( index ) )
584 const size_t m( ( IsUpper<MT>::value )
585 ?( ( IsLower<MT>::value )?( size )
586 :( ( IsStrictlyUpper<MT>::value && size > 0UL )
587 ?( index + size - 1UL )
588 :( index + size ) ) )
589 :( ( IsLower<MT>::value )?( right.rows() -
row )
590 :( right.rows() ) ) );
592 return subvector<AF>( left,
row, m ) * submatrix<AF>( right, row, index, m, size );
614 inline typename EnableIf< IsVecScalarMultExpr<VT>,
typename SubvectorExprTrait<VT,AF>::Type >::Type
615 subvector(
const Vector<VT,TF>& vector,
size_t index,
size_t size )
619 return subvector<AF>( (~vector).leftOperand(), index,
size ) * (~vector).rightOperand();
641 inline typename EnableIf< IsVecScalarDivExpr<VT>,
typename SubvectorExprTrait<VT,AF>::Type >::Type
642 subvector(
const Vector<VT,TF>& vector,
size_t index,
size_t size )
646 return subvector<AF>( (~vector).leftOperand(), index,
size ) / (~vector).rightOperand();
668 inline typename EnableIf< IsVecAbsExpr<VT>,
typename SubvectorExprTrait<VT,AF>::Type >::Type
669 subvector(
const Vector<VT,TF>& vector,
size_t index,
size_t size )
673 return abs( subvector<AF>( (~vector).operand(), index, size ) );
695 inline typename EnableIf< IsVecConjExpr<VT>,
typename SubvectorExprTrait<VT,AF>::Type >::Type
696 subvector(
const Vector<VT,TF>& vector,
size_t index,
size_t size )
700 return conj( subvector<AF>( (~vector).operand(), index, size ) );
722 inline typename EnableIf< IsVecRealExpr<VT>,
typename SubvectorExprTrait<VT,AF>::Type >::Type
723 subvector(
const Vector<VT,TF>& vector,
size_t index,
size_t size )
727 return real( subvector<AF>( (~vector).operand(), index, size ) );
749 inline typename EnableIf< IsVecImagExpr<VT>,
typename SubvectorExprTrait<VT,AF>::Type >::Type
750 subvector(
const Vector<VT,TF>& vector,
size_t index,
size_t size )
754 return imag( subvector<AF>( (~vector).operand(), index, size ) );
776 inline typename EnableIf< IsVecEvalExpr<VT>,
typename SubvectorExprTrait<VT,AF>::Type >::Type
777 subvector(
const Vector<VT,TF>& vector,
size_t index,
size_t size )
781 return eval( subvector<AF>( (~vector).operand(), index, size ) );
803 inline typename EnableIf< IsVecSerialExpr<VT>,
typename SubvectorExprTrait<VT,AF>::Type >::Type
804 subvector(
const Vector<VT,TF>& vector,
size_t index,
size_t size )
808 return serial( subvector<AF>( (~vector).operand(), index, size ) );
830 inline typename EnableIf< IsVecTransExpr<VT>,
typename SubvectorExprTrait<VT,AF>::Type >::Type
831 subvector(
const Vector<VT,TF>& vector,
size_t index,
size_t size )
835 return trans( subvector<AF>( (~vector).operand(), index, size ) );
Evaluation of the expression type type of a subvector operation.Via this type trait it is possible to...
Definition: SubvectorExprTrait.h:78
Header file for the alignment flag values.
Header file for the IsVecRealExpr type trait class.
Header file for basic type definitions.
Header file for the IsTVecMatMultExpr type trait class.
Header file for the IsVecVecMultExpr type trait class.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
Header file for the IsCrossExpr type trait class.
Header file for the IsVecVecSubExpr type trait class.
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename ColumnExprTrait< MT >::Type >::Type column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:107
const DMatAbsExpr< MT, SO > abs(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the absolute values of each single element of dm.
Definition: DMatAbsExpr.h:938
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
Header file for the IsMatVecMultExpr type trait class.
Header file for the IsVecSerialExpr type trait class.
const ImagExprTrait< MT >::Type imag(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the imaginary part of each single element of dm.
Definition: DMatImagExpr.h:920
ConjExprTrait< typename DiagonalProxy< MT >::RepresentedType >::Type conj(const DiagonalProxy< MT > &proxy)
Computing the complex conjugate of the represented element.
Definition: DiagonalProxy.h:487
Header file for the IsVecEvalExpr type trait class.
Header file for the IsVecVecAddExpr type trait class.
Header file for the DisableIf class template.
Header file for the IsVecImagExpr type trait class.
Header file for the IsStrictlyUpper type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the Or class template.
const RealExprTrait< MT >::Type real(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the real part of each single element of dm.
Definition: DMatRealExpr.h:920
Header file for the IsVecScalarDivExpr type trait class.
Header file for the IsLower type trait.
Header file for the IsVecAbsExpr type trait class.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
Header file for the serial shim.
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename RowExprTrait< MT >::Type >::Type row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:107
Header file for the IsVecTransExpr type trait class.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Header file for the IsVecConjExpr type trait class.
SubvectorExprTrait< VT, unaligned >::Type 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:143
const DMatEvalExpr< MT, SO > eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:703
Header file for the RemoveReference type trait.
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:944
Header file for the IsComputation type trait class.
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
Header file for the SubvectorExprTrait class template.
Header file for the IsUpper type trait.
Header file for the Vector CRTP base class.
Header file for the FunctionTrace class.