35 #ifndef _BLAZE_MATH_SPARSE_SPARSEVECTOR_H_
36 #define _BLAZE_MATH_SPARSE_SPARSEVECTOR_H_
69 template<
typename T1,
bool TF1,
typename T2,
bool TF2 >
70 inline bool operator==(
const SparseVector<T1,TF1>& lhs,
const SparseVector<T2,TF2>& rhs );
72 template<
typename T1,
bool TF1,
typename T2,
bool TF2 >
73 inline bool operator!=(
const SparseVector<T1,TF1>& lhs,
const SparseVector<T2,TF2>& rhs );
98 if( (~lhs).
size() != (~rhs).
size() )
return false;
106 const LhsConstIterator lend( a.end() );
107 const RhsConstIterator rend( b.end() );
109 LhsConstIterator lelem( a.begin() );
110 RhsConstIterator relem( b.begin() );
112 while( lelem != lend && relem != rend )
114 if(
isDefault( lelem->value() ) ) { ++lelem;
continue; }
115 if(
isDefault( relem->value() ) ) { ++relem;
continue; }
117 if( lelem->index() != relem->index() || !
equal( lelem->value(), relem->value() ) ) {
126 while( lelem != lend ) {
132 while( relem != rend ) {
151 template<
typename T1
157 return !( lhs == rhs );
173 template<
typename VT,
bool TF >
174 bool isnan(
const SparseVector<VT,TF>& sv );
176 template<
typename VT,
bool TF >
177 typename CMathTrait<typename VT::ElementType>::Type
length(
const SparseVector<VT,TF>& sv );
179 template<
typename VT,
bool TF >
182 template<
typename VT,
bool TF >
185 template<
typename VT,
bool TF >
211 template<
typename VT
220 const ConstIterator
end( a.end() );
221 for( ConstIterator element=a.begin(); element!=
end; ++element ) {
222 if(
isnan( element->value() ) )
return true;
262 template<
typename VT
273 for( ConstIterator element=(~sv).
begin(); element!=(~sv).
end(); ++element )
274 sum +=
sq( element->value() );
275 return std::sqrt( sum );
293 template<
typename VT
302 ElementType
sum( 0 );
303 for( ConstIterator element=(~sv).
begin(); element!=(~sv).
end(); ++element )
304 sum +=
sq( element->value() );
332 template<
typename VT
344 const ConstIterator
end( a.end() );
345 ConstIterator element( a.begin() );
347 if( element ==
end ) {
350 else if( a.nonZeros() == a.size() ) {
351 ET minimum( element->value() );
353 for( ; element!=
end; ++element )
354 minimum =
min( minimum, element->value() );
359 for( ; element!=
end; ++element )
360 minimum =
min( minimum, element->value() );
389 template<
typename VT
401 const ConstIterator
end( a.end() );
402 ConstIterator element( a.begin() );
404 if( element ==
end ) {
407 else if( a.nonZeros() == a.size() ) {
408 ET maximum( element->value() );
410 for( ; element!=
end; ++element )
411 maximum =
max( maximum, element->value() );
416 for( ; element!=
end; ++element )
417 maximum =
max( maximum, element->value() );
Header file for the isnan shim.
BLAZE_ALWAYS_INLINE int16_t sum(const sse_int16_t &a)
Returns the sum of all elements in the 16-bit integral intrinsic vector.
Definition: Reduction.h:63
const MT::ElementType max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:994
Constraint on the data type.
Header file for mathematical functions.
Header file for the SparseVector base class.
Header file for the square shim.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:258
double Type
Return type of the functions for integral and double arguments.
Definition: CMathTrait.h:79
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:258
const Quaternion< Type > sq(const Quaternion< Type > &m)
Squaring the given quaternion.
Definition: Quaternion.h:1034
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2478
bool isnan(const DenseMatrix< MT, SO > &dm)
Checks the given dense matrix for not-a-number elements.
Definition: DenseMatrix.h:609
Header file for the vector transpose flag types.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2482
const MT::ElementType min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:947
Header file for the equal shim.
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:195
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2476
CMathTrait< typename VT::ElementType >::Type length(const DenseVector< VT, TF > &dv)
Calculation of the dense vector length .
Definition: DenseVector.h:463
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
Header file for run time assertion macros.
bool equal(const T1 &a, const T2 &b)
Generic equality check.
Definition: Equal.h:376
#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:79
Header file for the isDefault shim.
BLAZE_ALWAYS_INLINE bool isDefault(const NonNumericProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: NonNumericProxy.h:874
Header file for the RemoveReference type trait.
Header file for the cmath trait.
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:108
bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:249
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
Header file for basic type definitions.
const VT::ElementType sqrLength(const DenseVector< VT, TF > &dv)
Calculation of the dense vector square length .
Definition: DenseVector.h:493