35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATREDUCEEXPR_H_ 36 #define _BLAZE_MATH_EXPRESSIONS_DMATREDUCEEXPR_H_ 101 template<
typename MT
124 template<
typename MT
127 :
public MatReduceExpr< DenseVector< DMatReduceExpr<MT,OP,columnwise>, true >, columnwise >
144 template<
typename VT >
145 static constexpr
bool UseSMPAssign_v = ( !
MT::smpAssignable && RequiresEvaluation_v<MT> );
169 static constexpr
bool simdEnabled =
false;
207 if( index >= dm_.columns() ) {
210 return (*
this)[index];
219 inline size_t size() const noexcept {
220 return dm_.columns();
250 template<
typename T >
251 inline bool canAlias(
const T* alias )
const noexcept {
252 return ( dm_.isAliased( alias ) );
262 template<
typename T >
263 inline bool isAliased(
const T* alias )
const noexcept {
264 return ( dm_.isAliased( alias ) );
284 return dm_.canSMPAssign() || (
size() > SMP_DMATREDUCE_THRESHOLD );
306 template<
typename VT1 >
313 const size_t M( rhs.dm_.rows() );
323 for(
size_t i=1UL; i<M; ++i ) {
342 template<
typename VT1 >
372 template<
typename VT1 >
373 friend inline void addAssign( DenseVector<VT1,true>& lhs,
const DMatReduceExpr& rhs )
379 if( rhs.dm_.rows() == 0UL ) {
382 else if( IsSame_v<OP,Add> ) {
383 CT tmp(
serial( rhs.dm_ ) );
384 const size_t M( tmp.rows() );
385 for(
size_t i=0UL; i<M; ++i ) {
391 addAssign( ~lhs, tmp );
410 template<
typename VT1 >
411 friend inline void addAssign( SparseVector<VT1,true>& lhs,
const DMatReduceExpr& rhs )
422 addAssign( ~lhs, tmp );
440 template<
typename VT1 >
441 friend inline void subAssign( DenseVector<VT1,true>& lhs,
const DMatReduceExpr& rhs )
447 if( rhs.dm_.rows() == 0UL ) {
450 else if( IsSame_v<OP,Add> ) {
451 CT tmp(
serial( rhs.dm_ ) );
452 const size_t M( tmp.rows() );
453 for(
size_t i=0UL; i<M; ++i ) {
459 subAssign( ~lhs, tmp );
478 template<
typename VT1 >
479 friend inline void subAssign( SparseVector<VT1,true>& lhs,
const DMatReduceExpr& rhs )
490 subAssign( ~lhs, tmp );
508 template<
typename VT1 >
509 friend inline void multAssign( DenseVector<VT1,true>& lhs,
const DMatReduceExpr& rhs )
515 if( rhs.dm_.rows() == 0UL ) {
518 else if( IsSame_v<OP,Mult> ) {
519 CT tmp(
serial( rhs.dm_ ) );
520 const size_t M( tmp.rows() );
521 for(
size_t i=0UL; i<M; ++i ) {
527 multAssign( ~lhs, tmp );
546 template<
typename VT1 >
547 friend inline void multAssign( SparseVector<VT1,true>& lhs,
const DMatReduceExpr& rhs )
558 multAssign( ~lhs, tmp );
576 template<
typename VT1 >
577 friend inline void divAssign( Vector<VT1,true>& lhs,
const DMatReduceExpr& rhs )
588 divAssign( ~lhs, tmp );
607 template<
typename VT1 >
608 friend inline auto smpAssign( Vector<VT1,true>& lhs,
const DMatReduceExpr& rhs )
609 -> EnableIf_t< UseSMPAssign_v<VT1> >
615 const RT tmp( rhs.dm_ );
616 smpAssign( ~lhs, reduce<columnwise>( tmp, rhs.op_ ) );
636 template<
typename VT1 >
637 friend inline auto smpAddAssign( Vector<VT1,true>& lhs,
const DMatReduceExpr& rhs )
638 -> EnableIf_t< UseSMPAssign_v<VT1> >
644 const RT tmp( rhs.dm_ );
645 smpAddAssign( ~lhs, reduce<columnwise>( tmp, rhs.op_ ) );
665 template<
typename VT1 >
666 friend inline auto smpSubAssign( Vector<VT1,true>& lhs,
const DMatReduceExpr& rhs )
667 -> EnableIf_t< UseSMPAssign_v<VT1> >
673 const RT tmp( rhs.dm_ );
674 smpSubAssign( ~lhs, reduce<columnwise>( tmp, rhs.op_ ) );
694 template<
typename VT1 >
695 friend inline auto smpMultAssign( Vector<VT1,true>& lhs,
const DMatReduceExpr& rhs )
696 -> EnableIf_t< UseSMPAssign_v<VT1> >
702 const RT tmp( rhs.dm_ );
723 template<
typename VT1 >
724 friend inline auto smpDivAssign( Vector<VT1,true>& lhs,
const DMatReduceExpr& rhs )
725 -> EnableIf_t< UseSMPAssign_v<VT1> >
731 const RT tmp( rhs.dm_ );
732 smpDivAssign( ~lhs, reduce<columnwise>( tmp, rhs.op_ ) );
762 template<
typename MT
765 :
public MatReduceExpr< DenseVector< DMatReduceExpr<MT,OP,rowwise>, false >, rowwise >
782 static constexpr
bool useAssign = RequiresEvaluation_v<MT>;
785 template<
typename VT >
787 static constexpr
bool UseAssign_v = useAssign;
798 template<
typename VT >
941 return index_ == rhs.index_;
952 return index_ != rhs.index_;
963 return index_ < rhs.index_;
974 return index_ > rhs.index_;
985 return index_ <= rhs.index_;
996 return index_ >= rhs.index_;
1007 return index_ - rhs.index_;
1058 static constexpr
bool simdEnabled =
false;
1096 if( index >= dm_.rows() ) {
1099 return (*
this)[index];
1128 inline size_t size() const noexcept {
1159 template<
typename T >
1160 inline bool canAlias(
const T* alias )
const noexcept {
1161 return ( dm_.isAliased( alias ) );
1171 template<
typename T >
1173 return ( dm_.isAliased( alias ) );
1193 return dm_.canSMPAssign() || (
size() > SMP_DMATREDUCE_THRESHOLD );
1217 template<
typename VT1 >
1226 assign( ~lhs, reduce<rowwise>( tmp, rhs.op_ ) );
1245 template<
typename VT1 >
1253 const RT tmp(
serial( rhs.dm_ ) );
1254 addAssign( ~lhs, reduce<rowwise>( tmp, rhs.op_ ) );
1274 template<
typename VT1 >
1275 friend inline auto subAssign( Vector<VT1,false>& lhs,
const DMatReduceExpr& rhs )
1276 -> EnableIf_t< UseAssign_v<VT1> >
1282 const RT tmp(
serial( rhs.dm_ ) );
1283 subAssign( ~lhs, reduce<rowwise>( tmp, rhs.op_ ) );
1303 template<
typename VT1 >
1304 friend inline auto multAssign( Vector<VT1,false>& lhs,
const DMatReduceExpr& rhs )
1305 -> EnableIf_t< UseAssign_v<VT1> >
1311 const RT tmp(
serial( rhs.dm_ ) );
1312 multAssign( ~lhs, reduce<rowwise>( tmp, rhs.op_ ) );
1331 template<
typename VT1 >
1332 friend inline auto divAssign( Vector<VT1,false>& lhs,
const DMatReduceExpr& rhs )
1333 -> EnableIf_t< UseAssign_v<VT1> >
1339 const RT tmp(
serial( rhs.dm_ ) );
1340 divAssign( ~lhs, reduce<rowwise>( tmp, rhs.op_ ) );
1359 template<
typename VT1 >
1360 friend inline auto smpAssign( Vector<VT1,false>& lhs,
const DMatReduceExpr& rhs )
1361 -> EnableIf_t< UseSMPAssign_v<VT1> >
1367 const RT tmp( rhs.dm_ );
1368 smpAssign( ~lhs, reduce<rowwise>( tmp, rhs.op_ ) );
1388 template<
typename VT1 >
1389 friend inline auto smpAddAssign( Vector<VT1,false>& lhs,
const DMatReduceExpr& rhs )
1390 -> EnableIf_t< UseSMPAssign_v<VT1> >
1396 const RT tmp( rhs.dm_ );
1417 template<
typename VT1 >
1418 friend inline auto smpSubAssign( Vector<VT1,false>& lhs,
const DMatReduceExpr& rhs )
1419 -> EnableIf_t< UseSMPAssign_v<VT1> >
1425 const RT tmp( rhs.dm_ );
1446 template<
typename VT1 >
1447 friend inline auto smpMultAssign( Vector<VT1,false>& lhs,
const DMatReduceExpr& rhs )
1448 -> EnableIf_t< UseSMPAssign_v<VT1> >
1454 const RT tmp( rhs.dm_ );
1475 template<
typename VT1 >
1476 friend inline auto smpDivAssign( Vector<VT1,false>& lhs,
const DMatReduceExpr& rhs )
1477 -> EnableIf_t< UseSMPAssign_v<VT1> >
1483 const RT tmp( rhs.dm_ );
1512 template<
typename MT
1514 struct DMatReduceExprHelper
1518 using CT = RemoveReference_t< CompositeType_t<MT> >;
1521 using ET = ElementType_t<CT>;
1525 static constexpr
bool value =
1526 ( CT::simdEnabled &&
1527 If_t< HasSIMDEnabled_v<OP>, GetSIMDEnabled<OP,ET,ET>, HasLoad<OP> >::value );
1555 template<
typename MT
1557 inline auto dmatreduce(
const DenseMatrix<MT,false>& dm, OP op )
1558 -> DisableIf_t< DMatReduceExprHelper<MT,OP>::value, ElementType_t<MT> >
1560 using CT = CompositeType_t<MT>;
1561 using ET = ElementType_t<MT>;
1563 const size_t M( (~dm).
rows() );
1564 const size_t N( (~dm).
columns() );
1566 if( M == 0UL || N == 0UL )
return ET{};
1567 if( M == 1UL && N == 1UL )
return (~dm)(0UL,0UL);
1577 redux0 = tmp(0UL,0UL);
1579 for(
size_t j=1UL; j<N; ++j ) {
1580 redux0 = op( redux0, tmp(0UL,j) );
1586 for( ; (i+2UL) <= M; i+=2UL )
1588 ET redux1( tmp(i ,0UL) );
1589 ET redux2( tmp(i+1UL,0UL) );
1591 for(
size_t j=1UL; j<N; ++j ) {
1592 redux1 = op( redux1, tmp(i ,j) );
1593 redux2 = op( redux2, tmp(i+1UL,j) );
1596 redux1 = op( redux1, redux2 );
1597 redux0 = op( redux0, redux1 );
1602 ET redux1( tmp(i,0UL) );
1604 for(
size_t j=1UL; j<N; ++j ) {
1605 redux1 = op( redux1, tmp(i,j) );
1608 redux0 = op( redux0, redux1 );
1630 template<
typename MT
1632 inline auto dmatreduce(
const DenseMatrix<MT,false>& dm, OP op )
1633 -> EnableIf_t< DMatReduceExprHelper<MT,OP>::value, ElementType_t<MT> >
1635 using CT = CompositeType_t<MT>;
1636 using ET = ElementType_t<MT>;
1638 const size_t M( (~dm).
rows() );
1639 const size_t N( (~dm).
columns() );
1641 if( M == 0UL || N == 0UL )
return ET{};
1650 alignas( AlignmentOf_v<ET> ) ET array1[SIMDSIZE];
1651 alignas( AlignmentOf_v<ET> ) ET array2[SIMDSIZE];
1652 alignas( AlignmentOf_v<ET> ) ET array3[SIMDSIZE];
1653 alignas( AlignmentOf_v<ET> ) ET array4[SIMDSIZE];
1659 const size_t jpos( N &
size_t(-SIMDSIZE) );
1662 SIMDTrait_t<ET> xmm1;
1665 xmm1 = tmp.load(0UL,0UL);
1666 size_t j( SIMDSIZE );
1668 for( ; j<jpos; j+=SIMDSIZE ) {
1669 xmm1 = op( xmm1, tmp.load(0UL,j) );
1677 array1[0UL] = op( array1[0UL], tmp(0UL,j) );
1680 xmm1 =
loada( array1 );
1686 for( ; (i+4UL) <= M; i+=4UL )
1688 xmm1 = op( xmm1, tmp.load(i,0UL) );
1689 SIMDTrait_t<ET> xmm2( tmp.load(i+1UL,0UL) );
1690 SIMDTrait_t<ET> xmm3( tmp.load(i+2UL,0UL) );
1691 SIMDTrait_t<ET> xmm4( tmp.load(i+3UL,0UL) );
1692 size_t j( SIMDSIZE );
1694 for( ; j<jpos; j+=SIMDSIZE ) {
1695 xmm1 = op( xmm1, tmp.load(i ,j) );
1696 xmm2 = op( xmm2, tmp.load(i+1UL,j) );
1697 xmm3 = op( xmm3, tmp.load(i+2UL,j) );
1698 xmm4 = op( xmm4, tmp.load(i+3UL,j) );
1709 array1[0UL] = op( array1[0UL], tmp(i ,j) );
1710 array2[0UL] = op( array2[0UL], tmp(i+1UL,j) );
1711 array3[0UL] = op( array3[0UL], tmp(i+2UL,j) );
1712 array4[0UL] = op( array4[0UL], tmp(i+3UL,j) );
1715 xmm1 =
loada( array1 );
1716 xmm2 =
loada( array2 );
1717 xmm3 =
loada( array3 );
1718 xmm4 =
loada( array4 );
1721 xmm1 = op( xmm1, xmm2 );
1722 xmm3 = op( xmm3, xmm4 );
1723 xmm1 = op( xmm1, xmm3 );
1728 xmm1 = op( xmm1, tmp.load(i,0UL) );
1729 SIMDTrait_t<ET> xmm2( tmp.load(i+1UL,0UL) );
1730 size_t j( SIMDSIZE );
1732 for( ; j<jpos; j+=SIMDSIZE ) {
1733 xmm1 = op( xmm1, tmp.load(i ,j) );
1734 xmm2 = op( xmm2, tmp.load(i+1UL,j) );
1743 array1[0UL] = op( array1[0UL], tmp(i ,j) );
1744 array2[0UL] = op( array2[0UL], tmp(i+1UL,j) );
1747 xmm1 =
loada( array1 );
1748 xmm2 =
loada( array2 );
1751 xmm1 = op( xmm1, xmm2 );
1758 xmm1 = op( xmm1, tmp.load(i,0UL) );
1759 size_t j( SIMDSIZE );
1761 for( ; j<jpos; j+=SIMDSIZE ) {
1762 xmm1 = op( xmm1, tmp.load(i,j) );
1770 array1[0] = op( array1[0], tmp(i,j) );
1773 xmm1 =
loada( array1 );
1777 redux =
reduce( xmm1, op );
1782 redux = tmp(0UL,0UL);
1783 for(
size_t j=1UL; j<N; ++j ) {
1784 redux = op( redux, tmp(0UL,j) );
1787 for(
size_t i=1UL; i<M; ++i ) {
1788 for(
size_t j=0UL; j<N; ++j ) {
1789 redux = op( redux, tmp(i,j) );
1812 template<
typename MT >
1813 inline auto dmatreduce(
const DenseMatrix<MT,false>& dm, Add )
1814 -> EnableIf_t< DMatReduceExprHelper<MT,Add>::value, ElementType_t<MT> >
1816 using CT = CompositeType_t<MT>;
1817 using ET = ElementType_t<MT>;
1819 const size_t M( (~dm).
rows() );
1820 const size_t N( (~dm).
columns() );
1822 if( M == 0UL || N == 0UL )
return ET{};
1829 constexpr
bool remainder( !usePadding || !
IsPadded_v< RemoveReference_t<CT> > );
1834 if( !remainder || N >= SIMDSIZE )
1836 const size_t jpos( ( remainder )?( N &
size_t(-SIMDSIZE) ):( N ) );
1839 SIMDTrait_t<ET> xmm1;
1842 for( ; (i+4UL) <= M; i+=4UL )
1844 xmm1 += tmp.load(i,0UL);
1845 SIMDTrait_t<ET> xmm2( tmp.load(i+1UL,0UL) );
1846 SIMDTrait_t<ET> xmm3( tmp.load(i+2UL,0UL) );
1847 SIMDTrait_t<ET> xmm4( tmp.load(i+3UL,0UL) );
1848 size_t j( SIMDSIZE );
1850 for( ; j<jpos; j+=SIMDSIZE ) {
1851 xmm1 += tmp.load(i ,j);
1852 xmm2 += tmp.load(i+1UL,j);
1853 xmm3 += tmp.load(i+2UL,j);
1854 xmm4 += tmp.load(i+3UL,j);
1856 for( ; remainder && j<N; ++j ) {
1858 redux += tmp(i+1UL,j);
1859 redux += tmp(i+2UL,j);
1860 redux += tmp(i+3UL,j);
1870 xmm1 += tmp.load(i,0UL);
1871 SIMDTrait_t<ET> xmm2( tmp.load(i+1UL,0UL) );
1872 size_t j( SIMDSIZE );
1874 for( ; j<jpos; j+=SIMDSIZE ) {
1875 xmm1 += tmp.load(i ,j);
1876 xmm2 += tmp.load(i+1UL,j);
1878 for( ; remainder && j<N; ++j ) {
1880 redux += tmp(i+1UL,j);
1890 xmm1 += tmp.load(i,0UL);
1891 size_t j( SIMDSIZE );
1893 for( ; j<jpos; j+=SIMDSIZE ) {
1894 xmm1 += tmp.load(i,j);
1896 for( ; remainder && j<N; ++j ) {
1901 redux +=
sum( xmm1 );
1905 for(
size_t i=0UL; i<M; ++i ) {
1906 for(
size_t j=0UL; j<N; ++j ) {
1930 template<
typename MT >
1931 inline auto dmatreduce(
const DenseMatrix<MT,false>& dm, Min )
1932 -> EnableIf_t< IsUniform_v<MT>, ElementType_t<MT> >
1934 return (~dm)(0UL,0UL);
1951 template<
typename MT >
1952 inline auto dmatreduce(
const DenseMatrix<MT,false>& dm, Max )
1953 -> EnableIf_t< IsUniform_v<MT>, ElementType_t<MT> >
1955 return (~dm)(0UL,0UL);
1974 template<
typename MT
1976 inline ElementType_t<MT> dmatreduce(
const DenseMatrix<MT,true>& dm, OP op )
1978 return dmatreduce(
trans( ~dm ), op );
2013 template<
typename MT
2020 return dmatreduce( ~dm, op );
2037 inline const DMatReduceExpr<MT,OP,RF> reduce_backend(
const DenseMatrix<MT,false>& dm, OP op )
2039 using ReturnType =
const DMatReduceExpr<MT,OP,RF>;
2058 inline decltype(
auto) reduce_backend( const DenseMatrix<MT,true>& dm, OP op )
2060 return trans( reduce<1UL-RF>(
trans( ~dm ), op ) );
2122 return reduce_backend<RF>( ~dm, op );
2144 template<
typename MT
2195 return reduce<RF>( ~dm,
Add() );
2217 template<
typename MT
2268 return reduce<RF>( ~dm,
Mult() );
2291 template<
typename MT
2339 return reduce<RF>( ~dm,
Min() );
2362 template<
typename MT
2410 return reduce<RF>( ~dm,
Max() );
ElementType_t< MT > ET
Element type of the dense matrix expression.
Definition: DMatReduceExpr.h:133
Pointer difference type of the Blaze library.
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Header file for the blaze::checked and blaze::unchecked instances.
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatReduceExpr.h:973
ConstIterator & operator--()
Pre-decrement operator.
Definition: DMatReduceExpr.h:908
ConstIterator(Operand dm, size_t index, OP op)
Constructor for the ConstIterator class.
Definition: DMatReduceExpr.h:851
Header file for the HasLoad type trait.
DMatReduceExpr(const MT &dm, OP op) noexcept
Constructor for the DMatReduceExpr class.
Definition: DMatReduceExpr.h:181
Header file for basic type definitions.
ElementType * PointerType
Pointer return type.
Definition: DMatReduceExpr.h:832
Header file for the Add functor.
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenien...
Definition: If.h:109
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatReduceExpr.h:1182
Header file for the MatReduceExpr base class.
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
SIMDTrait_t< ElementType > SIMDType
Resulting SIMD element type.
Definition: DMatReduceExpr.h:810
Header file for the serial shim.
Base class for all matrix reduction expression templates.The MatReduceExpr class serves as a tag for ...
Definition: MatReduceExpr.h:67
ResultType_t< MT > RT
Result type of the dense matrix expression.
Definition: DMatReduceExpr.h:132
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:224
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DMatReduceExpr.h:263
Header file for the IsSame and IsStrictlySame type traits.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3077
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
const ResultType CompositeType
Data type for composite expression templates.
Definition: DMatReduceExpr.h:158
Expression object for row-wise row-major dense matrix reduction operations.This specialization of the...
Definition: DMatReduceExpr.h:764
typename SIMDTrait< T >::Type SIMDTrait_t
Auxiliary alias declaration for the SIMDTrait class template.The SIMDTrait_t alias declaration provid...
Definition: SIMDTrait.h:315
decltype(auto) prod(const DenseMatrix< MT, SO > &dm)
Reduces the given dense matrix by means of multiplication.
Definition: DMatReduceExpr.h:2219
Header file for the DenseVector base class.
Generic wrapper for the addition operator.
Definition: Add.h:80
PointerType pointer
Pointer return type.
Definition: DMatReduceExpr.h:839
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DMatReduceExpr.h:1095
Header file for the Computation base class.
ResultType_t< MT > RT
Result type of the dense matrix expression.
Definition: DMatReduceExpr.h:770
Constraints on the storage order of matrix types.
Header file for the RequiresEvaluation type trait.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DMatReduceExpr.h:283
#define BLAZE_STATIC_ASSERT_MSG(expr, msg)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:123
OP Operation
Data type of the custom unary operation.
Definition: DMatReduceExpr.h:164
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DMatReduceExpr.h:809
Header file for the reduce trait.
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DMatReduceExpr.h:1042
DMatReduceExpr(const MT &dm, OP op) noexcept
Constructor for the DMatReduceExpr class.
Definition: DMatReduceExpr.h:1070
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
Expression object for column-wise row-major dense matrix reduction operations.This specialization of ...
Definition: DMatReduceExpr.h:126
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:80
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
auto smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:220
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatReduceExpr.h:876
size_t index_
Index to the current matrix row.
Definition: DMatReduceExpr.h:1050
const ElementType ReturnType
Return type for expression template evaluations.
Definition: DMatReduceExpr.h:811
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatReduceExpr.h:1006
Constraint on the transpose flag of vector types.
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatReduceExpr.h:962
Base template for row-major dense matrix reduction operations.The DMatReduceExpr class represents the...
Definition: DMatReduceExpr.h:104
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DMatReduceExpr.h:1172
Constraint on the data type.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DMatReduceExpr.h:193
decltype(auto) reduce(const DenseMatrix< MT, SO > &dm, OP op)
Performs a custom reduction operation on the given dense matrix.
Definition: DMatReduceExpr.h:2016
Header file for the DisableIf class template.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DMatReduceExpr.h:1108
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DMatReduceExpr.h:1082
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DMatReduceExpr.h:940
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3080
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1147
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DMatReduceExpr.h:154
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatReduceExpr.h:919
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
decltype(auto) sum(const DenseMatrix< MT, SO > &dm)
Reduces the given dense matrix by means of addition.
Definition: DMatReduceExpr.h:2146
Header file for the Mult functor.
Header file for the DenseMatrix base class.
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DMatReduceExpr.h:1128
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
Header file for all SIMD functionality.
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
Operation op_
The reduction operation.
Definition: DMatReduceExpr.h:1200
Operation operation() const
Returns a copy of the reduction operation.
Definition: DMatReduceExpr.h:1148
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatReduceExpr.h:995
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:78
ReduceTrait_t< RT, OP, rowwise > ResultType
Result type for expression template evaluations.
Definition: DMatReduceExpr.h:807
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatReduceExpr.h:984
Constraint on the data type.
Header file for the exception macros of the math module.
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1179
Constraint on the data type.
Header file for all forward declarations for expression class templates.
ReferenceType reference
Reference return type.
Definition: DMatReduceExpr.h:840
Header file for the EnableIf class template.
Header file for the IsPadded type trait.
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatReduceExpr.h:273
ReduceTrait_t< RT, OP, columnwise > ResultType
Result type for expression template evaluations.
Definition: DMatReduceExpr.h:153
If_t< useAssign, const ResultType, const DMatReduceExpr &> CompositeType
Data type for composite expression templates.
Definition: DMatReduceExpr.h:814
If_t< IsExpression_v< MT >, const MT, const MT &> Operand
Composite type of the left-hand side dense matrix expression.
Definition: DMatReduceExpr.h:161
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DMatReduceExpr.h:206
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DMatReduceExpr.h:951
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatReduceExpr.h:864
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DMatReduceExpr.h:219
Header file for the IsSIMDEnabled type trait.
constexpr size_t columnwise
Reduction flag for column-wise reduction operations.
Definition: ReductionFlag.h:90
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:61
typename ReduceTrait< T, OP, RF... >::Type ReduceTrait_t
Auxiliary alias declaration for the ReduceTrait class template.The ReduceTrait_t alias declaration pr...
Definition: ReduceTrait.h:174
Operand dm_
Dense matrix of the reduction expression.
Definition: DMatReduceExpr.h:1049
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
Header file for run time assertion macros.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
Generic wrapper for the max() function.
Definition: Max.h:79
ElementType_t< MT > ET
Element type of the dense matrix expression.
Definition: DMatReduceExpr.h:771
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
Operand dm_
Dense matrix of the reduction expression.
Definition: DMatReduceExpr.h:290
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatReduceExpr.h:1030
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatReduceExpr.h:898
constexpr bool IsPadded_v
Auxiliary variable template for the IsPadded type trait.The IsPadded_v variable template provides a c...
Definition: IsPadded.h:135
Operand dm_
Dense matrix of the reduction expression.
Definition: DMatReduceExpr.h:1199
#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
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatReduceExpr.h:830
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DMatReduceExpr.h:1160
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DMatReduceExpr.h:155
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Operation op_
The reduction operation.
Definition: DMatReduceExpr.h:291
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
Operand operand() const noexcept
Returns the dense matrix operand.
Definition: DMatReduceExpr.h:1138
Constraints on the storage order of matrix types.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
Header file for the HasMember type traits.
ConstIterator & operator++()
Pre-increment operator.
Definition: DMatReduceExpr.h:887
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
Header file for the RemoveReference type trait.
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:79
If_t< IsExpression_v< MT >, const MT, const MT &> Operand
Composite type of the left-hand side dense matrix expression.
Definition: DMatReduceExpr.h:817
ValueType value_type
Type of the underlying elements.
Definition: DMatReduceExpr.h:838
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DMatReduceExpr.h:929
Generic wrapper for the min() function.
Definition: Min.h:79
CompositeType_t< MT > CT
Composite type of the dense matrix expression.
Definition: DMatReduceExpr.h:134
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DMatReduceExpr.h:808
Header file for the Min functor.
IteratorCategory iterator_category
The iterator category.
Definition: DMatReduceExpr.h:837
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DMatReduceExpr.h:251
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
OP op_
The reduction operation.
Definition: DMatReduceExpr.h:1051
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DMatReduceExpr.h:1192
constexpr size_t rowwise
Reduction flag for row-wise reduction operations.
Definition: ReductionFlag.h:70
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:186
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DMatReduceExpr.h:1018
Generic wrapper for the multiplication operator.
Definition: Mult.h:77
const ElementType ReturnType
Return type for expression template evaluations.
Definition: DMatReduceExpr.h:157
ElementType ValueType
Type of the underlying elements.
Definition: DMatReduceExpr.h:831
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:66
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:138
ElementType & ReferenceType
Reference return type.
Definition: DMatReduceExpr.h:833
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a row dense or sparse vector type (i...
Definition: RowVector.h:61
Header file for the Max functor.
Operation operation() const
Returns a copy of the reduction operation.
Definition: DMatReduceExpr.h:239
SIMDTrait_t< ElementType > SIMDType
Resulting SIMD element type.
Definition: DMatReduceExpr.h:156
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DMatReduceExpr.h:1118
Operand operand() const noexcept
Returns the dense matrix operand.
Definition: DMatReduceExpr.h:229
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#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
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:191
OP Operation
Data type of the custom unary operation.
Definition: DMatReduceExpr.h:820
Header file for the reduction flags.
Constraint on the transpose flag of vector types.
Header file for the IsExpression type trait 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:1110