35 #ifndef _BLAZE_MATH_DENSE_DENSEVECTOR_H_ 36 #define _BLAZE_MATH_DENSE_DENSEVECTOR_H_ 80 template<
typename T1,
bool TF1,
typename T2,
bool TF2 >
81 inline bool operator==(
const DenseVector<T1,TF1>& lhs,
const DenseVector<T2,TF2>& rhs );
83 template<
typename T1,
bool TF1,
typename T2,
bool TF2 >
84 inline bool operator==(
const DenseVector<T1,TF1>& lhs,
const SparseVector<T2,TF2>& rhs );
86 template<
typename T1,
bool TF1,
typename T2,
bool TF2 >
87 inline bool operator==(
const SparseVector<T1,TF1>& lhs,
const DenseVector<T2,TF2>& rhs );
89 template<
typename T1,
typename T2,
bool TF >
90 inline EnableIf_< IsNumeric<T2>,
bool >
operator==(
const DenseVector<T1,TF>& vec, T2 scalar );
92 template<
typename T1,
typename T2,
bool TF >
93 inline EnableIf_< IsNumeric<T1>,
bool >
operator==( T1 scalar,
const DenseVector<T2,TF>& vec );
95 template<
typename T1,
bool TF1,
typename T2,
bool TF2 >
96 inline bool operator!=(
const DenseVector<T1,TF1>& lhs,
const DenseVector<T2,TF2>& rhs );
98 template<
typename T1,
bool TF1,
typename T2,
bool TF2 >
99 inline bool operator!=(
const DenseVector<T1,TF1>& lhs,
const SparseVector<T2,TF2>& rhs );
101 template<
typename T1,
bool TF1,
typename T2,
bool TF2 >
102 inline bool operator!=(
const SparseVector<T1,TF1>& lhs,
const DenseVector<T2,TF2>& rhs );
104 template<
typename T1,
typename T2,
bool TF >
105 inline EnableIf_< IsNumeric<T2>,
bool >
operator!=(
const DenseVector<T1,TF>& vec, T2 scalar );
107 template<
typename T1,
typename T2,
bool TF >
108 inline EnableIf_< IsNumeric<T1>,
bool >
operator!=( T1 scalar,
const DenseVector<T2,TF>& vec );
110 template<
typename VT,
bool TF,
typename ST >
111 inline EnableIf_< IsNumeric<ST>, VT& >
operator*=( DenseVector<VT,TF>& vec, ST scalar );
113 template<
typename VT,
bool TF,
typename ST >
114 inline EnableIf_< IsNumeric<ST>, VT& >
operator*=( DenseVector<VT,TF>&& vec, ST scalar );
116 template<
typename VT,
bool TF,
typename ST >
117 inline EnableIf_< IsNumeric<ST>, VT& >
operator/=( DenseVector<VT,TF>& vec, ST scalar );
119 template<
typename VT,
bool TF,
typename ST >
120 inline EnableIf_< IsNumeric<ST>, VT& >
operator/=( DenseVector<VT,TF>&& vec, ST scalar );
133 template<
typename T1
143 if( (~lhs).
size() != (~rhs).
size() )
return false;
151 for(
size_t i=0; i<a.size(); ++i )
152 if( !
equal( a[i], b[i] ) )
return false;
166 template<
typename T1
177 if( (~lhs).
size() != (~rhs).
size() )
return false;
187 for(
ConstIterator element=b.begin(); element!=b.end(); ++element, ++i ) {
188 for( ; i<element->index(); ++i ) {
191 if( !
equal( element->value(), a[i] ) )
return false;
193 for( ; i<a.size(); ++i ) {
210 template<
typename T1
216 return ( rhs == lhs );
233 template<
typename T1
245 for(
size_t i=0; i<a.size(); ++i )
246 if( !
equal( a[i], scalar ) )
return false;
264 template<
typename T1
269 return ( vec == scalar );
282 template<
typename T1
288 return !( lhs == rhs );
301 template<
typename T1
307 return !( lhs == rhs );
320 template<
typename T1
326 return !( rhs == lhs );
343 template<
typename T1
348 return !( vec == scalar );
365 template<
typename T1
370 return !( vec == scalar );
388 template<
typename VT
394 if( !tryMult( ~vec, 0UL, (~vec).
size(), scalar ) ) {
399 BLAZE_DECLTYPE_AUTO( left, derestrict( ~vec ) );
423 template<
typename VT
448 template<
typename VT
456 if( !tryDiv( ~vec, 0UL, (~vec).
size(), scalar ) ) {
461 BLAZE_DECLTYPE_AUTO( left, derestrict( ~vec ) );
487 template<
typename VT
508 template<
typename VT,
bool TF >
511 template<
typename VT,
bool TF >
514 template<
typename VT,
bool TF >
517 template<
typename VT,
bool TF >
520 template<
typename VT,
bool TF >
523 template<
typename VT,
bool TF >
526 template<
typename VT,
bool TF >
552 template<
typename VT
558 for(
size_t i=0UL; i<a.size(); ++i ) {
559 if(
isnan( a[i] ) )
return true;
582 template<
typename VT
588 for(
size_t i=0UL; i<a.size(); ++i ) {
622 template<
typename VT
636 for(
size_t i=1UL; i<a.size(); ++i ) {
659 template<
typename VT
668 for(
size_t i=0UL; i<(~dv).
size(); ++i )
669 sum +=
pow2( (~dv)[i] );
712 template<
typename VT
733 template<
typename VT
744 if( a.size() == 0UL )
return ET();
747 for(
size_t i=1UL; i<a.size(); ++i )
748 minimum =
min( minimum, a[i] );
766 template<
typename VT
777 if( a.size() == 0UL )
return ET();
780 for(
size_t i=1UL; i<a.size(); ++i )
781 maximum =
max( maximum, a[i] );
Header file for the isnan shim.
#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.
Headerfile for the generic min algorithm.
Constraint on the data type.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for basic type definitions.
Header file for the SparseVector base class.
constexpr bool equal(const T1 &a, const T2 &b)
Generic equality check.
Definition: Equal.h:76
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
const ElementType_< VT > sqrLength(const DenseVector< VT, TF > &dv)
Calculation of the square length (magnitude) of the dense vector .
Definition: DenseVector.h:661
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
Header file for the DenseVector base class.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3083
Header file for the decltype(auto) workaround.
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1950
Header file for the vector transpose flag types.
auto length(const DenseVector< VT, TF > &dv) -> decltype(sqrt(sqrLength(~dv)))
Calculation of the length (magnitude) of the dense vector .
Definition: DenseVector.h:714
Compile time check for data types with restricted data access.This type trait tests whether the given...
Definition: IsRestricted.h:82
bool isZero(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is 0.
Definition: DiagonalProxy.h:670
Header file for the sqrt shim.
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
Headerfile for the generic max algorithm.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:102
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3079
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
Header file for the isZero shim.
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
Header file for the pow2 shim.
Header file for the equal shim.
bool isnan(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is not a number.
Definition: DiagonalProxy.h:710
Header file for the exception macros of the math module.
bool isUniform(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a uniform matrix.
Definition: DenseMatrix.h:1151
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Header file for the EnableIf class template.
Header file for the IsNumeric type trait.
bool isDivisor(const DenseVector< VT, TF > &dv)
Returns whether the given dense vector is a valid divisor.
Definition: DenseVector.h:584
BLAZE_ALWAYS_INLINE ValueType_< T > sum(const SIMDi8< T > &a) noexcept
Returns the sum of all elements in the 8-bit integral SIMD vector.
Definition: Reduction.h:65
Header file for run time assertion macros.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
Header file for the isDefault shim.
BLAZE_ALWAYS_INLINEdecltype(auto) constexpr pow2(const T &a) noexcept(noexcept(a *a))
Squaring the given value/object.
Definition: Pow2.h:65
Header file for the RemoveReference type trait.
typename T::ConstReference ConstReference_
Alias declaration for nested ConstReference type definitions.The ConstReference_ alias declaration pr...
Definition: Aliases.h:143
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
EnableIf_< IsNumeric< ST >, MT &> operator/=(DenseMatrix< MT, SO > &mat, ST scalar)
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:655
decltype(auto) sqrt(const DenseMatrix< MT, SO > &dm)
Computes the square root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1448
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:130
Header file for the isDivisor shim.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
EnableIf_< IsNumeric< ST >, MT &> operator*=(DenseMatrix< MT, SO > &mat, ST scalar)
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:593
Header file for the IsRestricted type trait.
#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