35#ifndef _BLAZE_MATH_EXPRESSIONS_DVECDVECEQUALEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_DVECDVECEQUALEXPR_H_
73struct DVecDVecEqualExprHelper
77 using CT1 = RemoveReference_t< CompositeType_t<VT1> >;
80 using CT2 = RemoveReference_t< CompositeType_t<VT2> >;
84 static constexpr bool value =
85 ( useOptimizedKernels &&
88 HasSIMDEqual_v< ElementType_t<CT1>, ElementType_t<CT2> > );
121inline auto equal(
const DenseVector<VT1,TF1>& lhs,
const DenseVector<VT2,TF2>& rhs )
122 -> DisableIf_t< DVecDVecEqualExprHelper<VT1,VT2>::value,
bool >
124 using CT1 = CompositeType_t<VT1>;
125 using CT2 = CompositeType_t<VT2>;
128 if( (*lhs).size() != (*rhs).size() )
return false;
136 for(
size_t i=0UL; i<a.size(); ++i )
137 if( !equal<RF>( a[i], b[i] ) )
return false;
162inline auto equal(
const DenseVector<VT1,TF1>& lhs,
const DenseVector<VT2,TF2>& rhs )
163 -> EnableIf_t< DVecDVecEqualExprHelper<VT1,VT2>::value,
bool >
165 using CT1 = CompositeType_t<VT1>;
166 using CT2 = CompositeType_t<VT2>;
167 using XT1 = RemoveReference_t<CT1>;
168 using XT2 = RemoveReference_t<CT2>;
171 if( (*lhs).size() != (*rhs).size() )
return false;
177 constexpr size_t SIMDSIZE = SIMDTrait< ElementType_t<VT1> >
::size;
178 constexpr bool remainder( !IsPadded_v<XT1> || !IsPadded_v<XT2> );
180 const size_t N( a.size() );
182 const size_t ipos( remainder ?
prevMultiple( N, SIMDSIZE ) : N );
187 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
188 if( !equal<RF>( a.load(i ), b.load(i ) ) )
return false;
189 if( !equal<RF>( a.load(i+SIMDSIZE ), b.load(i+SIMDSIZE ) ) )
return false;
190 if( !equal<RF>( a.load(i+SIMDSIZE*2UL), b.load(i+SIMDSIZE*2UL) ) )
return false;
191 if( !equal<RF>( a.load(i+SIMDSIZE*3UL), b.load(i+SIMDSIZE*3UL) ) )
return false;
193 for( ; (i+SIMDSIZE) < ipos; i+=SIMDSIZE*2UL ) {
194 if( !equal<RF>( a.load(i ), b.load(i ) ) )
return false;
195 if( !equal<RF>( a.load(i+SIMDSIZE), b.load(i+SIMDSIZE) ) )
return false;
197 for( ; i<ipos; i+=SIMDSIZE ) {
198 if( !equal<RF>( a.load(i), b.load(i) ) )
return false;
200 for( ; remainder && i<N; ++i ) {
201 if( !equal<RF>( a[i], b[i] ) )
return false;
218template<
typename VT1
224 return equal<relaxed>( lhs, rhs );
237template<
typename VT1
243 return !equal<relaxed>( lhs, rhs );
Header file for auxiliary alias declarations.
Header file for the EnableIf class template.
Header file for the HasSIMDEqual type trait.
Header file for the IsPadded type trait.
Deactivation of problematic macros.
Header file for the prevMultiple shim.
Header file for the relaxation flag enumeration.
Header file for the RemoveReference type trait.
Header file for all SIMD functionality.
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
Header file for the DenseVector base class.
bool operator!=(const DenseVector< VT1, TF1 > &lhs, const DenseVector< VT2, TF2 > &rhs)
Inequality operator for the comparison of two dense vectors.
Definition: DVecDVecEqualExpr.h:241
bool operator==(const DenseVector< VT1, TF1 > &lhs, const DenseVector< VT2, TF2 > &rhs)
Equality operator for the comparison of two dense vectors.
Definition: DVecDVecEqualExpr.h:222
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition: RelaxationFlag.h:66
BLAZE_ALWAYS_INLINE constexpr auto prevMultiple(T1 value, T2 factor) noexcept
Rounds down an integral value to the previous multiple of a given factor.
Definition: PrevMultiple.h:68
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:676
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
bool equal(const SharedValue< T1 > &lhs, const SharedValue< T2 > &rhs)
Equality check for a two shared values.
Definition: SharedValue.h:343
Header file for the equal shim.
System settings for performance optimizations.
Header file for basic type definitions.