35#ifndef _BLAZE_MATH_SPARSE_SPARSEVECTOR_H_
36#define _BLAZE_MATH_SPARSE_SPARSEVECTOR_H_
87template<
typename VT,
bool TF,
typename ST >
91template<
typename VT,
bool TF,
typename ST >
95template<
typename VT,
bool TF,
typename ST >
99template<
typename VT,
bool TF,
typename ST >
126 if( !tryMult( *vec, 0UL, (*vec).size(), scalar ) ) {
137 decltype(
auto) left( derestrict( *vec ) );
139 const auto last( left.end() );
140 for(
auto element=left.begin(); element!=last; ++element ) {
141 element->value() *= scalar;
200 if( !tryDiv( *vec, 0UL, (*vec).size(), scalar ) ) {
212 decltype(
auto) left( derestrict( *vec ) );
215 const ScalarType tmp( ScalarType(1)/
static_cast<ScalarType
>( scalar ) );
216 for(
auto element=left.begin(); element!=left.end(); ++element ) {
217 element->value() *= tmp;
221 for(
auto element=left.begin(); element!=left.end(); ++element ) {
222 element->value() /= scalar;
270template<
typename VT,
bool TF >
271bool isnan(
const SparseVector<VT,TF>& sv );
273template<
typename VT,
bool TF >
274bool isinf(
const SparseVector<VT,TF>& sv );
276template<
typename VT,
bool TF >
277bool isfinite(
const SparseVector<VT,TF>& sv );
279template< RelaxationFlag RF,
typename VT,
bool TF >
280bool isUniform(
const SparseVector<VT,TF>& sv );
282template< RelaxationFlag RF,
typename VT,
bool TF >
283bool isZero(
const SparseVector<VT,TF>& sv );
316 const auto end( a.end() );
317 for(
auto element=a.begin(); element!=
end; ++element ) {
318 if(
isnan( element->value() ) )
return true;
353 const auto end( a.end() );
354 for(
auto element=a.begin(); element!=
end; ++element ) {
355 if(
isinf( element->value() ) )
return true;
390 const auto end( a.end() );
391 for(
auto element=a.begin(); element!=
end; ++element ) {
392 if( !
isfinite( element->value() ) )
return false;
444 if( a.nonZeros() != a.size() )
446 const auto end( a.end() );
447 for(
auto element=a.begin(); element!=
end; ++element ) {
454 const auto& cmp( a[0] );
455 auto element( a.begin() );
456 const auto end( a.end() );
460 for( ; element!=
end; ++element ) {
461 if( !
equal<RF>( element->value(), cmp ) )
514 const auto end( a.end() );
515 for(
auto element=a.begin(); element!=
end; ++element ) {
542auto erase( SparseVector<VT,TF>& sv, Args&&... args )
543 ->
decltype( (*sv).erase( std::forward<Args>( args )... ) )
545 return (*sv).erase( std::forward<Args>( args )... );
Header file for auxiliary alias declarations.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition Aliases.h:110
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition Aliases.h:190
Header file for run time assertion macros.
Header file for the division trait.
Header file for the EnableIf class template.
Header file for the If class template.
Header file for the IsBuiltin type trait.
Header file for the IsComplex type trait.
Header file for the isDefault shim.
Header file for the isfinite shim.
Header file for the IsFloatingPoint type trait.
Header file for the isinf shim.
Header file for the IsInvertible type trait.
Header file for the isnan shim.
Header file for the IsResizable type trait.
Header file for the IsRestricted type trait.
Header file for the IsScalar type trait.
Constraint on the data type.
Header file for the relaxation flag enumeration.
Header file for the RemoveReference type trait.
Header file for the UnderlyingBuiltin type trait.
Header file for the UnderlyingScalar type trait.
Base class for sparse vectors.
Definition SparseVector.h:72
Header file for the SparseVector base class.
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( ).
Definition DenseMatrix.h:574
bool isinf(const DenseMatrix< MT, SO > &dm)
Checks the given dense matrix for infinite elements.
Definition DenseMatrix.h:1339
bool isUniform(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a uniform matrix.
Definition DenseMatrix.h:1766
bool isnan(const DenseMatrix< MT, SO > &dm)
Checks the given dense matrix for not-a-number elements.
Definition DenseMatrix.h:1290
bool isfinite(const DenseMatrix< MT, SO > &dm)
Checks the given dense matrix for finite elements.
Definition DenseMatrix.h:1389
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( ).
Definition DenseMatrix.h:510
bool isZero(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a zero matrix.
Definition DenseMatrix.h:1819
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition DiagonalMatrix.h:207
bool isDefault(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the given diagonal matrix is in default state.
Definition DiagonalMatrix.h:169
typename DivTrait< T1, T2 >::Type DivTrait_t
Auxiliary alias declaration for the DivTrait class template.
Definition DivTrait.h:164
typename UnderlyingBuiltin< T >::Type UnderlyingBuiltin_t
Auxiliary alias declaration for the UnderlyingBuiltin type trait.
Definition UnderlyingBuiltin.h:117
constexpr bool IsUniform_v
Auxiliary variable template for the IsUniform type trait.
Definition IsUniform.h:164
constexpr bool IsInvertible_v
Auxiliary variable template for the IsInvertible type trait.
Definition IsInvertible.h:103
constexpr bool IsZero_v
Auxiliary variable template for the IsZero type trait.
Definition IsZero.h:166
constexpr bool IsRestricted_v
Auxiliary variable template for the IsRestricted type trait.
Definition IsRestricted.h:140
constexpr bool IsResizable_v
Auxiliary variable template for the IsResizable type trait.
Definition IsResizable.h:136
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition RelaxationFlag.h:66
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition Matrix.h:806
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:584
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition Assert.h:101
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition Assert.h:117
bool equal(const SharedValue< T1 > &lhs, const SharedValue< T2 > &rhs)
Equality check for a two shared values.
Definition SharedValue.h:343
constexpr bool IsFloatingPoint_v
Auxiliary variable template for the IsFloatingPoint type trait.
Definition IsFloatingPoint.h:95
constexpr bool IsBuiltin_v
Auxiliary variable template for the IsBuiltin type trait.
Definition IsBuiltin.h:95
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition EnableIf.h:138
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition Exception.h:235
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition If.h:108
Header file for the exception macros of the math module.
Header file for the equal shim.
Header file for the isZero shim.
Header file for the pow2 shim.
Header file for the sqrt shim.
Header file for the IsZero type trait.
Header file for basic type definitions.