35 #ifndef _BLAZE_MATH_EXPRESSIONS_TDVECDVECMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_TDVECDVECMULTEXPR_H_
70 struct TDVecDVecMultExprHelper
74 typedef typename RemoveReference< typename T1::CompositeType >::Type CT1;
77 typedef typename RemoveReference< typename T2::CompositeType >::Type CT2;
81 enum { value = CT1::vectorizable &&
83 IsSame< typename CT1::ElementType, typename CT2::ElementType>::value &&
84 IntrinsicTrait< typename CT1::ElementType >::addition &&
85 IntrinsicTrait< typename CT2::ElementType >::multiplication };
126 template<
typename T1
128 inline typename DisableIf< TDVecDVecMultExprHelper<T1,T2>,
129 const typename MultTrait<typename T1::ElementType,typename T2::ElementType>::Type >::Type
134 if( (~lhs).size() != (~rhs).size() )
135 throw std::invalid_argument(
"Vector sizes do not match" );
143 if( (~lhs).size() == 0UL )
return MultType();
148 MultType sp( left[0UL] * right[0UL] );
150 for(
size_t i=1UL; i<left.size(); ++i )
151 sp += left[i] * right[i];
186 template<
typename T1
188 inline typename EnableIf< TDVecDVecMultExprHelper<T1,T2>,
189 const typename MultTrait<typename T1::ElementType,typename T2::ElementType>::Type >::Type
194 if( (~lhs).size() != (~rhs).size() )
195 throw std::invalid_argument(
"Vector sizes do not match" );
204 if( (~lhs).size() == 0UL )
return MultType();
209 typename IT::Type xmm1, xmm2, xmm3, xmm4;
211 const size_t N ( left.size() );
212 const size_t end( N - N % (IT::size*4UL) );
214 for(
size_t i=0UL; i<end; i+=IT::size*4UL ) {
215 xmm1 = xmm1 + ( left.load(i ) * right.load(i ) );
216 xmm2 = xmm2 + ( left.load(i+IT::size ) * right.load(i+IT::size ) );
217 xmm3 = xmm3 + ( left.load(i+IT::size*2UL) * right.load(i+IT::size*2UL) );
218 xmm4 = xmm4 + ( left.load(i+IT::size*3UL) * right.load(i+IT::size*3UL) );
221 MultType sp(
sum( xmm1 + xmm2 + xmm3 + xmm4 ) );
223 for(
size_t i=end; i<N; ++i )
224 sp += left[i] * right[i];
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:4329
int16_t sum(const sse_int16_t &a)
Returns the sum of all elements in the 16-bit integral intrinsic vector.
Definition: Reduction.h:62
Header file for the IsSame and IsStrictlySame type traits.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2408
Header file for the DenseVector base class.
Header file for the DisableIf class template.
Header file for the multiplication trait.
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2406
Header file for the EnableIf class template.
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:748
Base template for the MultTrait class.
Definition: MultTrait.h:141
Header file for the RemoveReference type trait.
Header file for all intrinsic functionality.
#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 basic type definitions.
Header file for the FunctionTrace class.