35 #ifndef _BLAZE_MATH_SPARSE_SPARSEVECTOR_H_ 36 #define _BLAZE_MATH_SPARSE_SPARSEVECTOR_H_ 72 template<
typename T1,
bool TF1,
typename T2,
bool TF2 >
73 inline bool operator==(
const SparseVector<T1,TF1>& lhs,
const SparseVector<T2,TF2>& rhs );
75 template<
typename T1,
bool TF1,
typename T2,
bool TF2 >
76 inline bool operator!=(
const SparseVector<T1,TF1>& lhs,
const SparseVector<T2,TF2>& rhs );
101 if( (~lhs).
size() != (~rhs).
size() )
return false;
109 const LhsConstIterator lend( a.end() );
110 const RhsConstIterator rend( b.end() );
112 LhsConstIterator lelem( a.begin() );
113 RhsConstIterator relem( b.begin() );
115 while( lelem != lend && relem != rend )
117 if(
isDefault( lelem->value() ) ) { ++lelem;
continue; }
118 if(
isDefault( relem->value() ) ) { ++relem;
continue; }
120 if( lelem->index() != relem->index() || !
equal( lelem->value(), relem->value() ) ) {
129 while( lelem != lend ) {
135 while( relem != rend ) {
154 template<
typename T1
160 return !( lhs == rhs );
176 template<
typename VT,
bool TF >
179 template<
typename VT,
bool TF >
182 template<
typename VT,
bool TF >
185 template<
typename VT,
bool TF >
188 template<
typename VT,
bool TF >
191 template<
typename VT,
bool TF >
217 template<
typename VT
228 if(
isnan( element->value() ) )
return true;
261 template<
typename VT
274 if( a.nonZeros() != a.size() )
276 for(
ConstIterator element=a.begin(); element!=a.end(); ++element ) {
288 for( ; element!=a.end(); ++element ) {
289 if( element->value() != cmp )
312 template<
typename VT
323 sum +=
sq( element->value() );
366 template<
typename VT
397 template<
typename VT
412 if( element ==
end ) {
415 else if( a.nonZeros() == a.size() ) {
416 ET minimum( element->value() );
418 for( ; element!=
end; ++element )
419 minimum =
min( minimum, element->value() );
424 for( ; element!=
end; ++element )
425 minimum =
min( minimum, element->value() );
454 template<
typename VT
469 if( element ==
end ) {
472 else if( a.nonZeros() == a.size() ) {
473 ET maximum( element->value() );
475 for( ; element!=
end; ++element )
476 maximum =
max( maximum, element->value() );
481 for( ; element!=
end; ++element )
482 maximum =
max( maximum, element->value() );
Header file for the isnan shim.
Header file for auxiliary alias declarations.
Headerfile for the generic min algorithm.
Constraint on the data type.
Header file for basic type definitions.
Header file for the SparseVector base class.
Header file for the square shim.
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:523
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:198
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1762
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3085
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1809
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:576
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.
BLAZE_ALWAYS_INLINE constexpr MultExprTrait_< T, T > sq(const T &a) noexcept(noexcept(a *a))
Squaring the given value/object.
Definition: Square.h:66
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3081
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
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
Header file for the equal shim.
bool isnan(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is not a number.
Definition: DiagonalProxy.h:682
bool isUniform(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a uniform matrix.
Definition: DenseMatrix.h:1010
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:264
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
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.
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
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
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:600