Blaze 3.9
Modules | Classes | Functions
Sparse Vectors

Modules

 Expressions
 
 CompressedVector
 
 ZeroVector
 

Classes

class  blaze::SparseVector< VT, TF >
 Base class for sparse vectors. More...
 
class  blaze::VectorAccessProxy< VT >
 Access proxy for sparse, N-dimensional vectors. More...
 

Functions

template<typename VT1 , typename VT2 >
decltype(auto) blaze::operator* (const DenseVector< VT1, true > &lhs, const SparseVector< VT2, false > &rhs)
 Multiplication operator for the scalar product (inner product) of a dense and a sparse vector ( $ s=\vec{a}*\vec{b} $). More...
 
template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::kron (const DenseVector< VT1, TF > &lhs, const SparseVector< VT2, TF > &rhs)
 Computes the Kronecker product of a dense vector and a sparse vector ( $ a=b \otimes c $). More...
 
template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::operator* (const DenseVector< VT1, TF > &lhs, const SparseVector< VT2, TF > &rhs)
 Multiplication operator for the componentwise product of a dense vector and a sparse vector ( $ \vec{a}=\vec{b}*\vec{c} $). More...
 
template<typename MT , typename VT >
decltype(auto) blaze::operator* (const SparseMatrix< MT, false > &mat, const SparseVector< VT, false > &vec)
 Multiplication operator for the multiplication of a row-major sparse matrix and a sparse vector ( $ \vec{a}=B*\vec{c} $). More...
 
template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::operator/ (const SparseVector< VT1, TF > &lhs, const DenseVector< VT2, TF > &rhs)
 Division operator for the componentwise division of a sparse vector and a dense vector ( $ \vec{a}=\vec{b}/\vec{c} $). More...
 
template<typename VT1 , typename VT2 >
decltype(auto) blaze::operator* (const SparseVector< VT1, true > &lhs, const DenseVector< VT2, false > &rhs)
 Multiplication operator for the scalar product (inner product) of a sparse and a dense vector ( $ s=\vec{a}*\vec{b} $). More...
 
template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::kron (const SparseVector< VT1, TF > &lhs, const DenseVector< VT2, TF > &rhs)
 Computes the Kronecker product of a sparse vector and a vector vector ( $ a=b \otimes c $). More...
 
template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::operator* (const SparseVector< VT1, TF > &lhs, const DenseVector< VT2, TF > &rhs)
 Multiplication operator for the componentwise product of a sparse vector and a dense vector ( $ \vec{a}=\vec{b}*\vec{c} $). More...
 
template<typename VT , bool TF>
decltype(auto) blaze::eval (const SparseVector< VT, TF > &sv)
 Forces the evaluation of the given sparse vector expression sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::expand (const SparseVector< VT, TF > &sv, size_t expansion)
 Expansion of the given sparse vector. More...
 
template<size_t E, typename VT , bool TF>
decltype(auto) blaze::expand (const SparseVector< VT, TF > &sv)
 Expansion of the given sparse vector. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::fix (SparseVector< VT, TF > &sv) noexcept
 Fixing the size of the given sparse vector. More...
 
template<typename VT , bool TF, typename OP >
decltype(auto) blaze::map (const SparseVector< VT, TF > &sv, OP op)
 Evaluates the given custom operation on each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF, typename OP >
decltype(auto) blaze::forEach (const SparseVector< VT, TF > &sv, OP op)
 Evaluates the given custom operation on each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::abs (const SparseVector< VT, TF > &sv)
 Applies the abs() function to each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::sign (const SparseVector< VT, TF > &sv)
 Applies the sign() function to each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::floor (const SparseVector< VT, TF > &sv)
 Applies the floor() function to each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::ceil (const SparseVector< VT, TF > &sv)
 Applies the ceil() function to each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::trunc (const SparseVector< VT, TF > &sv)
 Applies the trunc() function to each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::round (const SparseVector< VT, TF > &sv)
 Applies the round() function to each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::conj (const SparseVector< VT, TF > &sv)
 Returns a vector containing the complex conjugate of each single element of sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::ctrans (const SparseVector< VT, TF > &sv)
 Returns the conjugate transpose vector of sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::real (const SparseVector< VT, TF > &sv)
 Returns a vector containing the real parts of each single element of sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::imag (const SparseVector< VT, TF > &sv)
 Returns a vector containing the imaginary parts of each single element of sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::arg (const SparseVector< VT, TF > &sv)
 Returns a vector containing the phase angle of each single element of sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::sqrt (const SparseVector< VT, TF > &sv)
 Computes the square root of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::invsqrt (const SparseVector< VT, TF > &sv)
 Computes the inverse square root of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::cbrt (const SparseVector< VT, TF > &sv)
 Computes the cubic root of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::invcbrt (const SparseVector< VT, TF > &sv)
 Computes the inverse cubic root of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF, typename DT >
decltype(auto) blaze::clamp (const SparseVector< VT, TF > &sv, const DT &min, const DT &max)
 Restricts each single element of the sparse vector sv to the range $[min..max]$. More...
 
template<typename VT , bool TF, typename ST , EnableIf_t< IsScalar_v< ST > > * = nullptr>
decltype(auto) blaze::pow (const SparseVector< VT, TF > &sv, ST exp)
 Computes the exponential value for each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::exp (const SparseVector< VT, TF > &sv)
 Computes $ e^x $ of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::exp2 (const SparseVector< VT, TF > &sv)
 Computes $ 2^x $ of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::exp10 (const SparseVector< VT, TF > &sv)
 Computes $ 10^x $ of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::log (const SparseVector< VT, TF > &sv)
 Computes the natural logarithm of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::log2 (const SparseVector< VT, TF > &sv)
 Computes the binary logarithm of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::log10 (const SparseVector< VT, TF > &sv)
 Computes the common logarithm of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::log1p (const SparseVector< VT, TF > &sv)
 Computes the natural logarithm of x+1 of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::lgamma (const SparseVector< VT, TF > &sv)
 Computes the natural logarithm of the absolute value of the gamma function of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::sin (const SparseVector< VT, TF > &sv)
 Computes the sine of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::asin (const SparseVector< VT, TF > &sv)
 Computes the inverse sine of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::sinh (const SparseVector< VT, TF > &sv)
 Computes the hyperbolic sine of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::asinh (const SparseVector< VT, TF > &sv)
 Computes the inverse hyperbolic sine of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::cos (const SparseVector< VT, TF > &sv)
 Computes the cosine of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::acos (const SparseVector< VT, TF > &sv)
 Computes the inverse cosine of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::cosh (const SparseVector< VT, TF > &sv)
 Computes the hyperbolic cosine of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::acosh (const SparseVector< VT, TF > &sv)
 Computes the inverse hyperbolic cosine of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::tan (const SparseVector< VT, TF > &sv)
 Computes the tangent of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::atan (const SparseVector< VT, TF > &sv)
 Computes the inverse tangent of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::tanh (const SparseVector< VT, TF > &sv)
 Computes the hyperbolic tangent of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::atanh (const SparseVector< VT, TF > &sv)
 Computes the inverse hyperbolic tangent of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::erf (const SparseVector< VT, TF > &sv)
 Computes the error function of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::erfc (const SparseVector< VT, TF > &sv)
 Computes the complementary error function of each non-zero element of the sparse vector sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::mean (const SparseVector< VT, TF > &sv)
 Computes the (arithmetic) mean for the given sparse vector. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::noalias (const SparseVector< VT, TF > &sv)
 Forces the non-aliased evaluation of the given sparse vector expression sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::norm (const SparseVector< VT, TF > &sv)
 Computes the L2 norm for the given sparse vector. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::sqrNorm (const SparseVector< VT, TF > &sv)
 Computes the squared L2 norm for the given sparse vector. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::l1Norm (const SparseVector< VT, TF > &sv)
 Computes the L1 norm for the given sparse vector. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::l2Norm (const SparseVector< VT, TF > &sv)
 Computes the L2 norm for the given sparse vector. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::l3Norm (const SparseVector< VT, TF > &sv)
 Computes the L3 norm for the given sparse vector. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::l4Norm (const SparseVector< VT, TF > &sv)
 Computes the L4 norm for the given sparse vector. More...
 
template<typename VT , bool TF, typename ST >
decltype(auto) blaze::lpNorm (const SparseVector< VT, TF > &sv, ST p)
 Computes the Lp norm for the given sparse vector. More...
 
template<size_t P, typename VT , bool TF>
decltype(auto) blaze::lpNorm (const SparseVector< VT, TF > &sv)
 Computes the Lp norm for the given sparse vector. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::linfNorm (const SparseVector< VT, TF > &sv)
 Computes the infinity norm for the given sparse vector. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::maxNorm (const SparseVector< VT, TF > &sv)
 Computes the maximum norm for the given sparse vector. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::minNorm (const SparseVector< VT, TF > &sv)
 Computes the minimum norm for the given sparse vector. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::sqrLength (const SparseVector< VT, TF > &sv)
 Calculation of the square length (magnitude) of the sparse vector $|\vec{a}|^2$. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::length (const SparseVector< VT, TF > &sv)
 Calculation of the length (magnitude) of the sparse vector $|\vec{a}|$. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::nosimd (const SparseVector< VT, TF > &sv)
 Disables the SIMD evaluation of the given sparse vector expression sv. More...
 
template<typename VT , bool TF, typename OP >
decltype(auto) blaze::reduce (const SparseVector< VT, TF > &sv, OP op)
 Performs a custom reduction operation on the given sparse vector. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::sum (const SparseVector< VT, TF > &sv)
 Reduces the given sparse vector by means of addition. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::prod (const SparseVector< VT, TF > &sv)
 Reduces the given sparse vector by means of multiplication. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::min (const SparseVector< VT, TF > &sv)
 Returns the smallest element of the sparse vector. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::max (const SparseVector< VT, TF > &sv)
 Returns the largest element of the sparse vector. More...
 
template<typename VT , bool TF>
size_t blaze::argmin (const SparseVector< VT, TF > &sv)
 Returns the index of the first smallest non-zero element of the sparse vector. More...
 
template<typename VT , bool TF>
size_t blaze::argmax (const SparseVector< VT, TF > &sv)
 Returns the index of the first largest non-zero element of the sparse vector. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::repeat (const SparseVector< VT, TF > &sv, size_t repetitions)
 Repeats the given sparse vector. More...
 
template<size_t R0, typename VT , bool TF>
decltype(auto) blaze::repeat (const SparseVector< VT, TF > &sv)
 Repeats the given sparse vector. More...
 
template<typename VT , typename ST , bool TF, EnableIf_t< IsScalar_v< ST > > * = nullptr>
decltype(auto) blaze::operator/ (const SparseVector< VT, TF > &vec, ST scalar)
 Division operator for the divison of a sparse vector by a scalar value ( $ \vec{a}=\vec{b}/s $). More...
 
template<typename VT , bool TF>
decltype(auto) blaze::operator- (const SparseVector< VT, TF > &sv)
 Unary minus operator for the negation of a sparse vector ( $ \vec{a} = -\vec{b} $). More...
 
template<typename VT , typename ST , bool TF, EnableIf_t< IsScalar_v< ST > > * = nullptr>
decltype(auto) blaze::operator* (const SparseVector< VT, TF > &vec, ST scalar)
 Multiplication operator for the multiplication of a sparse vector and a scalar value ( $ \vec{a}=\vec{b}*s $). More...
 
template<typename ST , typename VT , bool TF, EnableIf_t< IsScalar_v< ST > > * = nullptr>
decltype(auto) blaze::operator* (ST scalar, const SparseVector< VT, TF > &vec)
 Multiplication operator for the multiplication of a scalar value and a sparse vector ( $ \vec{a}=s*\vec{b} $). More...
 
template<typename VT , bool TF>
decltype(auto) blaze::serial (const SparseVector< VT, TF > &sv)
 Forces the serial evaluation of the given sparse vector expression sv. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::stddev (const SparseVector< VT, TF > &sv)
 Computes the standard deviation for the given sparse vector. More...
 
template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::operator+ (const SparseVector< VT1, TF > &lhs, const SparseVector< VT2, TF > &rhs)
 Addition operator for the addition of two sparse vectors ( $ \vec{a}=\vec{b}+\vec{c} $). More...
 
template<typename VT1 , bool TF1, typename VT2 , bool TF2>
bool blaze::operator== (const SparseVector< VT1, TF1 > &lhs, const SparseVector< VT2, TF2 > &rhs)
 Equality operator for the comparison of two sparse vectors. More...
 
template<typename VT1 , bool TF1, typename VT2 , bool TF2>
bool blaze::operator!= (const SparseVector< VT1, TF1 > &lhs, const SparseVector< VT2, TF2 > &rhs)
 Inequality operator for the comparison of two sparse vectors. More...
 
template<typename VT1 , typename VT2 >
decltype(auto) blaze::operator* (const SparseVector< VT1, true > &lhs, const SparseVector< VT2, false > &rhs)
 Multiplication operator for the scalar product (inner product) of two sparse vectors ( $ s=\vec{a}*\vec{b} $). More...
 
template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::kron (const SparseVector< VT1, TF > &lhs, const SparseVector< VT2, TF > &rhs)
 Computes the Kronecker product of two sparse vectors ( $ a=b \otimes c $). More...
 
template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::operator* (const SparseVector< VT1, TF > &lhs, const SparseVector< VT2, TF > &rhs)
 Multiplication operator for the componentwise multiplication of two sparse vectors ( $ \vec{a}=\vec{b}*\vec{c} $). More...
 
template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::operator- (const SparseVector< VT1, TF > &lhs, const SparseVector< VT2, TF > &rhs)
 Subtraction operator for the subtraction of two sparse vectors ( $ \vec{a}=\vec{b}-\vec{c} $). More...
 
template<typename VT , bool TF>
decltype(auto) blaze::trans (const SparseVector< VT, TF > &sv)
 Calculation of the transpose of the given sparse vector. More...
 
template<bool TTF, typename VT , bool TF>
decltype(auto) blaze::transTo (const SparseVector< VT, TF > &sv)
 Conditional calculation of the transpose of the given sparse vector. More...
 
template<typename VT , bool TF>
decltype(auto) blaze::var (const SparseVector< VT, TF > &sv)
 Computes the variance for the given sparse vector. More...
 
template<typename MT , typename VT >
decltype(auto) blaze::operator* (const SparseMatrix< MT, true > &mat, const SparseVector< VT, false > &vec)
 Multiplication operator for the multiplication of a transpose sparse matrix and a sparse vector ( $ \vec{y}=A*\vec{x} $). More...
 
template<typename VT , typename MT >
decltype(auto) blaze::operator* (const SparseVector< VT, true > &vec, const SparseMatrix< MT, false > &mat)
 Multiplication operator for the multiplication of a transpose sparse vector and a row-major sparse matrix ( $ \vec{y}^T=\vec{x}^T*A $). More...
 
template<typename VT , typename MT >
decltype(auto) blaze::operator* (const SparseVector< VT, true > &vec, const SparseMatrix< MT, true > &mat)
 Multiplication operator for the multiplication of a transpose sparse vector and a column-major sparse matrix ( $ \vec{y}^T=\vec{x}^T*A $). More...
 

SparseVector global functions

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::Iterator blaze::find (SparseVector< VT, TF > &sv, size_t index)
 Searches for a specific sparse vector element. More...
 
template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::ConstIterator blaze::find (const SparseVector< VT, TF > &sv, size_t index)
 Searches for a specific sparse vector element. More...
 
template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::Iterator blaze::lowerBound (SparseVector< VT, TF > &sv, size_t index)
 Returns an iterator to the first index not less then the given index. More...
 
template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::ConstIterator blaze::lowerBound (const SparseVector< VT, TF > &sv, size_t index)
 Returns an iterator to the first index not less then the given index. More...
 
template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::Iterator blaze::upperBound (SparseVector< VT, TF > &sv, size_t index)
 Returns an iterator to the first index greater then the given index. More...
 
template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::ConstIterator blaze::upperBound (const SparseVector< VT, TF > &sv, size_t index)
 Returns an iterator to the first index greater then the given index. More...
 

SparseVector operators

template<typename VT , bool TF, typename ST >
auto blaze::operator*= (SparseVector< VT, TF > &vec, ST scalar) -> EnableIf_t< IsScalar_v< ST >, VT & >
 Multiplication assignment operator for the multiplication of a sparse vector and a scalar value ( $ \vec{a}*=s $). More...
 
template<typename VT , bool TF, typename ST >
auto blaze::operator*= (SparseVector< VT, TF > &&vec, ST scalar) -> EnableIf_t< IsScalar_v< ST >, VT & >
 Multiplication assignment operator for the multiplication of a temporary sparse vector and a scalar ( $ v*=s $). More...
 
template<typename VT , bool TF, typename ST >
auto blaze::operator/= (SparseVector< VT, TF > &vec, ST scalar) -> EnableIf_t< IsScalar_v< ST >, VT & >
 Division assignment operator for the division of a sparse vector by a scalar value ( $ \vec{a}/=s $). More...
 
template<typename VT , bool TF, typename ST >
auto blaze::operator/= (SparseVector< VT, TF > &&vec, ST scalar) -> EnableIf_t< IsScalar_v< ST >, VT & >
 Division assignment operator for the division of a temporary sparse vector by a scalar value ( $ \vec{a}/=s $). More...
 

SparseVector functions

template<typename VT , bool TF>
bool blaze::isnan (const SparseVector< VT, TF > &sv)
 Checks the given sparse vector for not-a-number elements. More...
 
template<typename VT , bool TF>
bool blaze::isinf (const SparseVector< VT, TF > &sv)
 Checks the given sparse vector for infinite elements. More...
 
template<typename VT , bool TF>
bool blaze::isfinite (const SparseVector< VT, TF > &sv)
 Checks the given sparse vector for finite elements. More...
 
template<RelaxationFlag RF, typename VT , bool TF>
bool blaze::isUniform (const SparseVector< VT, TF > &sv)
 Checks if the given sparse vector is a uniform vector. More...
 
template<RelaxationFlag RF, typename VT , bool TF>
bool blaze::isZero (const SparseVector< VT, TF > &sv)
 Checks if the given sparse vector is a zero vector. More...
 

VectorAccessProxy global functions

template<typename VT >
void blaze::swap (const VectorAccessProxy< VT > &a, const VectorAccessProxy< VT > &b) noexcept
 Swapping the contents of two access proxies. More...
 
template<typename VT , typename T >
void blaze::swap (const VectorAccessProxy< VT > &a, T &b) noexcept
 Swapping the contents of an access proxy with another element. More...
 
template<typename T , typename VT >
void blaze::swap (T &a, const VectorAccessProxy< VT > &b) noexcept
 Swapping the contents of an access proxy with another element. More...
 

Detailed Description

Function Documentation

◆ abs()

template<typename VT , bool TF>
decltype(auto) blaze::abs ( const SparseVector< VT, TF > &  sv)
inline

Applies the abs() function to each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The resulting sparse vector.

This function applies the abs() function to each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the abs() function:

// ... Resizing and initialization
b = abs( a );
Efficient implementation of an arbitrary sized vector.
Definition: DynamicVector.h:223
decltype(auto) abs(const DenseMatrix< MT, SO > &dm)
Applies the abs() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1296

◆ acos()

template<typename VT , bool TF>
decltype(auto) blaze::acos ( const SparseVector< VT, TF > &  sv)
inline

Computes the inverse cosine of each non-zero element of the sparse vector sv.

Parameters
svThe input vector; all non-zero elements must be in the range $[-1..1]$.
Returns
The inverse cosine of each non-zero element of sv.

The acos() function computes the inverse cosine for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the acos() function:

// ... Resizing and initialization
b = acos( a );
Efficient implementation of an arbitrary sized sparse vector.
Definition: CompressedVector.h:220
decltype(auto) acos(const DenseMatrix< MT, SO > &dm)
Computes the inverse cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2190
Note
All non-zero elements are expected to be in the range $[-1..1]$. No runtime checks are performed to assert this precondition!

◆ acosh()

template<typename VT , bool TF>
decltype(auto) blaze::acosh ( const SparseVector< VT, TF > &  sv)
inline

Computes the inverse hyperbolic cosine of each non-zero element of the sparse vector sv.

Parameters
svThe input vector; all non-zero elements must be in the range $[1..\infty)$.
Returns
The inverse hyperbolic cosine of each non-zero element of sv.

The acosh() function computes the inverse hyperbolic cosine for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the acosh() function:

// ... Resizing and initialization
b = acosh( a );
decltype(auto) acosh(const DenseMatrix< MT, SO > &dm)
Computes the inverse hyperbolic cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2249
Note
All non-zero elements are expected to be in the range $[1..\infty)$. No runtime checks are performed to assert this precondition!

◆ arg()

template<typename VT , bool TF>
decltype(auto) blaze::arg ( const SparseVector< VT, TF > &  sv)
inline

Returns a vector containing the phase angle of each single element of sv.

Parameters
svThe integral sparse input vector.
Returns
The phase angle of each single element of sv.

The arg() function calculates the phase angle of each element of the sparse input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the arg() function:

// ... Resizing and initialization
b = arg( a );
decltype(auto) arg(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the phase angle of each single element of dm.
Definition: DMatMapExpr.h:1585

◆ argmax()

template<typename VT , bool TF>
size_t blaze::argmax ( const SparseVector< VT, TF > &  sv)
inline

Returns the index of the first largest non-zero element of the sparse vector.

Parameters
svThe given sparse vector.
Returns
The index of the first largest sparse vector element.

This function returns the index of the first largest non-zero element of the given sparse vector. This function can only be used for element types that support the largest-than relationship. I case the given vector currently has a size of 0 or no non-zero elements, the returned index is 0.

const size_t maxindex = argmax( a ); // Results in 2
size_t argmax(const DenseVector< VT, TF > &dv)
Returns the index of the first largest element of the dense vector.
Definition: DVecReduceExpr.h:584

◆ argmin()

template<typename VT , bool TF>
size_t blaze::argmin ( const SparseVector< VT, TF > &  sv)
inline

Returns the index of the first smallest non-zero element of the sparse vector.

Parameters
svThe given sparse vector.
Returns
The index of the first smallest sparse vector element.

This function returns the index of the first smallest non-zero element of the given sparse vector. This function can only be used for element types that support the smaller-than relationship. I case the given vector currently has a size of 0 or no non-zero elements, the returned index is 0.

const size_t minindex = argmin( a ); // Results in 1
size_t argmin(const DenseVector< VT, TF > &dv)
Returns the index of the first smallest element of the dense vector.
Definition: DVecReduceExpr.h:542

◆ asin()

template<typename VT , bool TF>
decltype(auto) blaze::asin ( const SparseVector< VT, TF > &  sv)
inline

Computes the inverse sine of each non-zero element of the sparse vector sv.

Parameters
svThe input vector; all non-zero elements must be in the range $[-1..1]$.
Returns
The inverse sine of each non-zero element of sv.

The asin() function computes the inverse sine for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the asin() function:

// ... Resizing and initialization
b = asin( a );
decltype(auto) asin(const DenseMatrix< MT, SO > &dm)
Computes the inverse sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2075
Note
All non-zero elements are expected to be in the range $[-1..1]$. No runtime checks are performed to assert this precondition!

◆ asinh()

template<typename VT , bool TF>
decltype(auto) blaze::asinh ( const SparseVector< VT, TF > &  sv)
inline

Computes the inverse hyperbolic sine of each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The inverse hyperbolic sine of each non-zero element of sv.

The asinh() function computes the inverse hyperbolic sine for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the asinh() function:

// ... Resizing and initialization
b = asinh( a );
decltype(auto) asinh(const DenseMatrix< MT, SO > &dm)
Computes the inverse hyperbolic sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2131

◆ atan()

template<typename VT , bool TF>
decltype(auto) blaze::atan ( const SparseVector< VT, TF > &  sv)
inline

Computes the inverse tangent of each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The inverse tangent of each non-zero element of sv.

The atan() function computes the inverse tangent for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the atan() function:

// ... Resizing and initialization
b = atan( a );
decltype(auto) atan(const DenseMatrix< MT, SO > &dm)
Computes the inverse tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2305

◆ atanh()

template<typename VT , bool TF>
decltype(auto) blaze::atanh ( const SparseVector< VT, TF > &  sv)
inline

Computes the inverse hyperbolic tangent of each non-zero element of the sparse vector sv.

Parameters
svThe input vector; all non-zero elements must be in the range $[-1..1]$.
Returns
The inverse hyperbolic tangent of each non-zero element of sv.

The atanh() function computes the inverse hyperbolic tangent for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the atanh() function:

// ... Resizing and initialization
b = atanh( a );
decltype(auto) atanh(const DenseMatrix< MT, SO > &dm)
Computes the inverse hyperbolic tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2367
Note
All non-zero elements are expected to be in the range $[-1..1]$. No runtime checks are performed to assert this precondition!

◆ cbrt()

template<typename VT , bool TF>
decltype(auto) blaze::cbrt ( const SparseVector< VT, TF > &  sv)
inline

Computes the cubic root of each non-zero element of the sparse vector sv.

Parameters
svThe input vector; all non-zero elements must be in the range $[0..\infty)$.
Returns
The cubic root of each single element of sv.

The cbrt() function computes the cubic root of each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the cbrt() function:

// ... Resizing and initialization
b = cbrt( a );
decltype(auto) cbrt(const DenseMatrix< MT, SO > &dm)
Computes the cubic root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1678
Note
All non-zero elements are expected to be in the range $[0..\infty)$. No runtime checks are performed to assert this precondition!

◆ ceil()

template<typename VT , bool TF>
decltype(auto) blaze::ceil ( const SparseVector< VT, TF > &  sv)
inline

Applies the ceil() function to each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The resulting sparse vector.

This function applies the ceil() function to each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the ceil() function:

// ... Resizing and initialization
b = ceil( a );
decltype(auto) ceil(const DenseMatrix< MT, SO > &dm)
Applies the ceil() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1380

◆ clamp()

template<typename VT , bool TF, typename DT >
decltype(auto) blaze::clamp ( const SparseVector< VT, TF > &  sv,
const DT &  min,
const DT &  max 
)
inline

Restricts each single element of the sparse vector sv to the range $[min..max]$.

Parameters
svThe input vector.
minThe lower delimiter.
maxThe upper delimiter.
Returns
The vector with restricted elements.

The clamp() function resetricts each element of the input vector sv to the range $[min..max]$. The function returns an expression representing this operation.
The following example demonstrates the use of the clamp() function:

// ... Resizing and initialization
b = clamp( a, -1.0, 1.0 );
decltype(auto) clamp(const DenseMatrix< MT, SO > &dm, const DT &min, const DT &max)
Restricts each single element of the dense matrix dm to the range .
Definition: DMatMapExpr.h:1740

◆ conj()

template<typename VT , bool TF>
decltype(auto) blaze::conj ( const SparseVector< VT, TF > &  sv)
inline

Returns a vector containing the complex conjugate of each single element of sv.

Parameters
svThe integral sparse input vector.
Returns
The complex conjugate of each single element of sv.

The conj() function calculates the complex conjugate of each element of the sparse input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the conj() function:

// ... Resizing and initialization
b = conj( a );
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1464

◆ cos()

template<typename VT , bool TF>
decltype(auto) blaze::cos ( const SparseVector< VT, TF > &  sv)
inline

Computes the cosine of each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The cosine of each non-zero element of sv.

The cos() function computes the cosine for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the cos() function:

// ... Resizing and initialization
b = cos( a );
decltype(auto) cos(const DenseMatrix< MT, SO > &dm)
Computes the cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2159

◆ cosh()

template<typename VT , bool TF>
decltype(auto) blaze::cosh ( const SparseVector< VT, TF > &  sv)
inline

Computes the hyperbolic cosine of each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The hyperbolic cosine of each non-zero element of sv.

The cosh() function computes the hyperbolic cosine for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the cosh() function:

// ... Resizing and initialization
b = cosh( a );
decltype(auto) cosh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic cosine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2218

◆ ctrans()

template<typename VT , bool TF>
decltype(auto) blaze::ctrans ( const SparseVector< VT, TF > &  sv)
inline

Returns the conjugate transpose vector of sv.

Parameters
svThe input vector.
Returns
The conjugate transpose of sv.

The ctrans() function returns an expression representing the conjugate transpose (also called adjoint matrix, Hermitian conjugate matrix or transjugate matrix) of the given input vector sv.
The following example demonstrates the use of the ctrans() function:

// ... Resizing and initialization
b = ctrans( a );
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatMapExpr.h:1501

Note that the ctrans() function has the same effect as manually applying the conj() and trans function in any order:

b = trans( conj( a ) ); // Computing the conjugate transpose vector
b = conj( trans( a ) ); // Computing the conjugate transpose vector
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766

◆ erf()

template<typename VT , bool TF>
decltype(auto) blaze::erf ( const SparseVector< VT, TF > &  sv)
inline

Computes the error function of each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The error function of each non-zero element of sv.

The erf() function computes the error function for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the erf() function:

// ... Resizing and initialization
b = erf( a );
decltype(auto) erf(const DenseMatrix< MT, SO > &dm)
Computes the error function for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2395

◆ erfc()

template<typename VT , bool TF>
decltype(auto) blaze::erfc ( const SparseVector< VT, TF > &  sv)
inline

Computes the complementary error function of each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The complementary error function of each non-zero element of sv.

The erfc() function computes the complementary error function for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the erfc() function:

// ... Resizing and initialization
b = erfc( a );
decltype(auto) erfc(const DenseMatrix< MT, SO > &dm)
Computes the complementary error function for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2423

◆ eval()

template<typename VT , bool TF>
decltype(auto) blaze::eval ( const SparseVector< VT, TF > &  sv)
inline

Forces the evaluation of the given sparse vector expression sv.

Parameters
svThe input vector.
Returns
The evaluated sparse vector.

The eval function forces the evaluation of the given sparse vector expression sv. The function returns an expression representing this operation.
The following example demonstrates the use of the eval function:

// ... Resizing and initialization
b = eval( a );
decltype(auto) eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:790

◆ exp()

template<typename VT , bool TF>
decltype(auto) blaze::exp ( const SparseVector< VT, TF > &  sv)
inline

Computes $ e^x $ of each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The resulting sparse vector.

The exp() function computes $ e^x $ for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the exp() function:

// ... Resizing and initialization
b = exp( a );
decltype(auto) exp(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1801

◆ exp10()

template<typename VT , bool TF>
decltype(auto) blaze::exp10 ( const SparseVector< VT, TF > &  sv)
inline

Computes $ 10^x $ of each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The resulting sparse vector.

The exp10() function computes $ 10^x $ for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the exp10() function:

// ... Resizing and initialization
b = exp10( a );
decltype(auto) exp10(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1857

◆ exp2()

template<typename VT , bool TF>
decltype(auto) blaze::exp2 ( const SparseVector< VT, TF > &  sv)
inline

Computes $ 2^x $ of each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The resulting sparse vector.

The exp2() function computes $ 2^x $ for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the exp2() function:

// ... Resizing and initialization
b = exp2( a );
decltype(auto) exp2(const DenseMatrix< MT, SO > &dm)
Computes for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1829

◆ expand() [1/2]

template<size_t E, typename VT , bool TF>
decltype(auto) blaze::expand ( const SparseVector< VT, TF > &  sv)
inline

Expansion of the given sparse vector.

Parameters
svThe sparse vector to be expanded.
Returns
The expansion of the vector.

This function returns an expression representing the expansion of the given sparse vector:

// ... Resizing and initialization
// Expansion of the column vector 'a' to 4x3 column-major matrix
//
// ( 1 1 1 )
// ( 0 0 0 )
// ( -2 -2 -2 )
// ( 0 0 0 )
//
A = expand<3UL>( a );
// Expansion of the row vector 'b' to a 3x4 row-major matrix
//
// ( 0, -1, 7, 0 )
// ( 0, -1, 7, 0 )
// ( 0, -1, 7, 0 )
//
B = expand<3UL>( b );
Efficient implementation of a compressed matrix.
Definition: CompressedMatrix.h:239
constexpr bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
constexpr bool columnMajor
Storage order flag for column-major matrices.
Definition: StorageOrder.h:99
constexpr bool columnVector
Transpose flag for column vectors.
Definition: TransposeFlag.h:58
constexpr bool rowVector
Transpose flag for row vectors.
Definition: TransposeFlag.h:73

◆ expand() [2/2]

template<typename VT , bool TF>
decltype(auto) blaze::expand ( const SparseVector< VT, TF > &  sv,
size_t  expansion 
)
inline

Expansion of the given sparse vector.

Parameters
svThe sparse vector to be expanded.
expansionThe expansion.
Returns
The expansion of the vector.

This function returns an expression representing the expansion of the given sparse vector:

// ... Resizing and initialization
// Expansion of the column vector 'a' to 4x3 column-major matrix
//
// ( 1 1 1 )
// ( 0 0 0 )
// ( -2 -2 -2 )
// ( 0 0 0 )
//
A = expand( a, 3UL );
// Expansion of the row vector 'b' to a 3x4 row-major matrix
//
// ( 0, -1, 7, 0 )
// ( 0, -1, 7, 0 )
// ( 0, -1, 7, 0 )
//
B = expand( b, 3UL );
decltype(auto) expand(const DenseVector< VT, TF > &dv, size_t expansion)
Expansion of the given dense vector.
Definition: DVecExpandExpr.h:746

◆ find() [1/2]

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::ConstIterator blaze::find ( const SparseVector< VT, TF > &  sv,
size_t  index 
)

Searches for a specific sparse vector element.

Parameters
svThe given sparse vector.
indexThe index of the search element. The index has to be in the range $[0..N-1]$.
Returns
Iterator to the element in case the index is found, end() iterator otherwise.

This function can be used to check whether a specific element is contained in the sparse vector. It specifically searches for the element with index index. In case the element is found, the function returns an iterator to the element. Otherwise an iterator just past the last non-zero element of the sparse vector (the end() iterator) is returned. Note that the returned sparse vector iterator is subject to invalidation due to inserting operations via the subscript operator, the set() function or the insert() function!

◆ find() [2/2]

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::Iterator blaze::find ( SparseVector< VT, TF > &  sv,
size_t  index 
)

Searches for a specific sparse vector element.

Parameters
svThe given sparse vector.
indexThe index of the search element. The index has to be in the range $[0..N-1]$.
Returns
Iterator to the element in case the index is found, end() iterator otherwise.

This function can be used to check whether a specific element is contained in the sparse vector. It specifically searches for the element with index index. In case the element is found, the function returns an iterator to the element. Otherwise an iterator just past the last non-zero element of the sparse vector (the end() iterator) is returned. Note that the returned sparse vector iterator is subject to invalidation due to inserting operations via the subscript operator, the set() function or the insert() function!

◆ fix()

template<typename VT , bool TF>
decltype(auto) blaze::fix ( SparseVector< VT, TF > &  sv)
noexcept

Fixing the size of the given sparse vector.

Parameters
svThe sparse vector to be size-fixed.
Returns
The size-fixed sparse vector.

This function returns an expression representing the size-fixed given sparse vector:

// ... Resizing and initialization
fix( b ) = a;
decltype(auto) fix(DenseMatrix< MT, SO > &dm) noexcept
Fixing the size of the given dense matrix.
Definition: DMatFixExpr.h:227

◆ floor()

template<typename VT , bool TF>
decltype(auto) blaze::floor ( const SparseVector< VT, TF > &  sv)
inline

Applies the floor() function to each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The resulting sparse vector.

This function applies the floor() function to each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the floor() function:

// ... Resizing and initialization
b = floor( a );
decltype(auto) floor(const DenseMatrix< MT, SO > &dm)
Applies the floor() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1352

◆ forEach()

template<typename VT , bool TF, typename OP >
decltype(auto) blaze::forEach ( const SparseVector< VT, TF > &  sv,
OP  op 
)
inline

Evaluates the given custom operation on each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
opThe custom operation.
Returns
The custom operation applied to each single element of sv.

The forEach() function evaluates the given custom operation on each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the forEach() function:

// ... Resizing and initialization
b = forEach( a, []( double a ){ return std::sqrt( a ); } );
decltype(auto) forEach(const DenseMatrix< MT, SO > &dm, OP op)
Evaluates the given custom operation on each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1132
decltype(auto) sqrt(const DenseMatrix< MT, SO > &dm)
Computes the square root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1616

◆ imag()

template<typename VT , bool TF>
decltype(auto) blaze::imag ( const SparseVector< VT, TF > &  sv)
inline

Returns a vector containing the imaginary parts of each single element of sv.

Parameters
svThe integral sparse input vector.
Returns
The imaginary part of each single element of sv.

The imag() function calculates the imaginary part of each element of the sparse input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the imag() function:

// ... Resizing and initialization
b = imag( a );
decltype(auto) imag(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the imaginary part of each single element of dm.
Definition: DMatMapExpr.h:1557

◆ invcbrt()

template<typename VT , bool TF>
decltype(auto) blaze::invcbrt ( const SparseVector< VT, TF > &  sv)
inline

Computes the inverse cubic root of each non-zero element of the sparse vector sv.

Parameters
svThe input vector; all non-zero elements must be in the range $(0..\infty)$.
Returns
The inverse cubic root of each single element of sv.

The invcbrt() function computes the inverse cubic root of each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the invcbrt() function:

// ... Resizing and initialization
b = invcbrt( a );
decltype(auto) invcbrt(const DenseMatrix< MT, SO > &dm)
Computes the inverse cubic root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1709
Note
All non-zero elements are expected to be in the range $(0..\infty)$. No runtime checks are performed to assert this precondition!

◆ invsqrt()

template<typename VT , bool TF>
decltype(auto) blaze::invsqrt ( const SparseVector< VT, TF > &  sv)
inline

Computes the inverse square root of each non-zero element of the sparse vector sv.

Parameters
svThe input vector; all non-zero elements must be in the range $(0..\infty)$.
Returns
The inverse square root of each single element of sv.

The invsqrt() function computes the inverse square root of each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the invsqrt() function:

// ... Resizing and initialization
b = invsqrt( a );
decltype(auto) invsqrt(const DenseMatrix< MT, SO > &dm)
Computes the inverse square root of each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1647
Note
All non-zero elements are expected to be in the range $(0..\infty)$. No runtime checks are performed to assert this precondition!

◆ isfinite()

template<typename VT , bool TF>
bool blaze::isfinite ( const SparseVector< VT, TF > &  sv)
inline

Checks the given sparse vector for finite elements.

Parameters
svThe sparse vector to be checked for finite elements.
Returns
true if all elements of the vector are finite, false otherwise.

This function checks if all elements of the N-dimensional sparse vector are finite elements (i.e. normal, subnormal or zero elements, but not infinite or NaN). If all elements of the vector are finite, the function returns true, otherwise it returns false.

// ... Resizing and initialization
if( isfinite( a ) ) { ... }
bool isfinite(const DenseMatrix< MT, SO > &dm)
Checks the given dense matrix for finite elements.
Definition: DenseMatrix.h:1389

◆ isinf()

template<typename VT , bool TF>
bool blaze::isinf ( const SparseVector< VT, TF > &  sv)
inline

Checks the given sparse vector for infinite elements.

Parameters
svThe sparse vector to be checked for infinite elements.
Returns
true if at least one element of the vector is infinite, false otherwise.

This function checks the N-dimensional sparse vector for infinite (inf) elements. If at least one element of the vector is infinite, the function returns true, otherwise it returns false.

// ... Resizing and initialization
if( isinf( a ) ) { ... }
bool isinf(const DenseMatrix< MT, SO > &dm)
Checks the given dense matrix for infinite elements.
Definition: DenseMatrix.h:1339

◆ isnan()

template<typename VT , bool TF>
bool blaze::isnan ( const SparseVector< VT, TF > &  sv)
inline

Checks the given sparse vector for not-a-number elements.

Parameters
svThe sparse vector to be checked for not-a-number elements.
Returns
true if at least one element of the vector is not-a-number, false otherwise.

This function checks the N-dimensional sparse vector for not-a-number (NaN) elements. If at least one element of the vector is not-a-number, the function returns true, otherwise it returns false.

// ... Resizing and initialization
if( isnan( a ) ) { ... }
bool isnan(const DenseMatrix< MT, SO > &dm)
Checks the given dense matrix for not-a-number elements.
Definition: DenseMatrix.h:1290

◆ isUniform()

template<RelaxationFlag RF, typename VT , bool TF>
bool blaze::isUniform ( const SparseVector< VT, TF > &  sv)

Checks if the given sparse vector is a uniform vector.

Parameters
svThe sparse vector to be checked.
Returns
true if the vector is a uniform vector, false if not.

This function checks if the given sparse vector is a uniform vector. The vector is considered to be uniform if all its elements are identical. The following code example demonstrates the use of the function:

// ... Initialization
if( isUniform( a ) ) { ... }
bool isUniform(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a uniform matrix.
Definition: DenseMatrix.h:1766

Optionally, it is possible to switch between strict semantics (blaze::strict) and relaxed semantics (blaze::relaxed):

if( isUniform<relaxed>( a ) ) { ... }

It is also possible to check if a vector expression results is a uniform vector:

if( isUniform( a + b ) ) { ... }

However, note that this might require the complete evaluation of the expression, including the generation of a temporary vector.

◆ isZero()

template<RelaxationFlag RF, typename VT , bool TF>
bool blaze::isZero ( const SparseVector< VT, TF > &  sv)

Checks if the given sparse vector is a zero vector.

Parameters
svThe sparse vector to be checked.
Returns
true if the vector is a zero vector, false if not.

This function checks if the given sparse vector is a zero vector. The vector is considered to be zero if all its elements are zero. The following code example demonstrates the use of the function:

// ... Initialization
if( isZero( a ) ) { ... }
bool isZero(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a zero matrix.
Definition: DenseMatrix.h:1819

Optionally, it is possible to switch between strict semantics (blaze::strict) and relaxed semantics (blaze::relaxed):

if( isZero<relaxed>( a ) ) { ... }

It is also possible to check if a vector expression results is a zero vector:

if( isZero( a + b ) ) { ... }

However, note that this might require the complete evaluation of the expression, including the generation of a temporary vector.

◆ kron() [1/3]

template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::kron ( const DenseVector< VT1, TF > &  lhs,
const SparseVector< VT2, TF > &  rhs 
)
inline

Computes the Kronecker product of a dense vector and a sparse vector ( $ a=b \otimes c $).

Parameters
lhsThe left-hand side dense vector for the Kronecker product.
rhsThe right-hand side sparse vector for the Kronecker product.
Returns
The Kronecker product of the two vectors.

This kron() function computes the Kronecker product of the given dense vector and sparse vector:

// ... Resizing and initialization
c = kron( a, b );
decltype(auto) kron(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the Kronecker product of two dense matrices ( ).
Definition: DMatDMatKronExpr.h:957

The function returns an expression representing a sparse vector of the higher-order element type of the two involved vector element types VT1::ElementType and VT2::ElementType. Both vector types VT1 and VT2 as well as the two element types VT1::ElementType and VT2::ElementType have to be supported by the MultTrait class template.

◆ kron() [2/3]

template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::kron ( const SparseVector< VT1, TF > &  lhs,
const DenseVector< VT2, TF > &  rhs 
)
inline

Computes the Kronecker product of a sparse vector and a vector vector ( $ a=b \otimes c $).

Parameters
lhsThe left-hand side sparse vector for the Kronecker product.
rhsThe right-hand side dense vector for the Kronecker product.
Returns
The Kronecker product of the two vectors.

This kron() function computes the Kronecker product of the given sparse vector and dense vector:

// ... Resizing and initialization
c = kron( a, b );

The function returns an expression representing a sparse vector of the higher-order element type of the two involved vector element types VT1::ElementType and VT2::ElementType. Both vector types VT1 and VT2 as well as the two element types VT1::ElementType and VT2::ElementType have to be supported by the MultTrait class template.

◆ kron() [3/3]

template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::kron ( const SparseVector< VT1, TF > &  lhs,
const SparseVector< VT2, TF > &  rhs 
)
inline

Computes the Kronecker product of two sparse vectors ( $ a=b \otimes c $).

Parameters
lhsThe left-hand side sparse vector for the Kronecker product.
rhsThe right-hand side sparse vector for the Kronecker product.
Returns
The Kronecker product of the two vectors.

The kron() function computes the Kronecker product of the two given sparse vectors:

// ... Resizing and initialization
c = kron( a, b );

The function returns an expression representing a sparse vector of the higher-order element type of the two involved vector element types VT1::ElementType and VT2::ElementType. Both vector types VT1 and VT2 as well as the two element types VT1::ElementType and VT2::ElementType have to be supported by the MultTrait class template.

◆ l1Norm()

template<typename VT , bool TF>
decltype(auto) blaze::l1Norm ( const SparseVector< VT, TF > &  sv)

Computes the L1 norm for the given sparse vector.

Parameters
svThe given sparse vector for the norm computation.
Returns
The L1 norm of the given sparse vector.

This function computes the L1 norm of the given sparse vector:

// ... Resizing and initialization
const double l1 = l1Norm( a );
decltype(auto) l1Norm(const DenseMatrix< MT, SO > &dm)
Computes the L1 norm for the given dense matrix.
Definition: DMatNormExpr.h:625

◆ l2Norm()

template<typename VT , bool TF>
decltype(auto) blaze::l2Norm ( const SparseVector< VT, TF > &  sv)

Computes the L2 norm for the given sparse vector.

Parameters
svThe given sparse vector for the norm computation.
Returns
The L2 norm of the given sparse vector.

This function computes the L2 norm of the given sparse vector:

// ... Resizing and initialization
const double l2 = l2Norm( a );
decltype(auto) l2Norm(const DenseMatrix< MT, SO > &dm)
Computes the L2 norm for the given dense matrix.
Definition: DMatNormExpr.h:651

◆ l3Norm()

template<typename VT , bool TF>
decltype(auto) blaze::l3Norm ( const SparseVector< VT, TF > &  sv)

Computes the L3 norm for the given sparse vector.

Parameters
svThe given sparse vector for the norm computation.
Returns
The L3 norm of the given sparse vector.

This function computes the L3 norm of the given sparse vector:

// ... Resizing and initialization
const double l3 = l3Norm( a );
decltype(auto) l3Norm(const DenseMatrix< MT, SO > &dm)
Computes the L3 norm for the given dense matrix.
Definition: DMatNormExpr.h:677

◆ l4Norm()

template<typename VT , bool TF>
decltype(auto) blaze::l4Norm ( const SparseVector< VT, TF > &  sv)

Computes the L4 norm for the given sparse vector.

Parameters
svThe given sparse vector for the norm computation.
Returns
The L4 norm of the given sparse vector.

This function computes the L4 norm of the given sparse vector:

// ... Resizing and initialization
const double l4 = l4Norm( a );
decltype(auto) l4Norm(const DenseMatrix< MT, SO > &dm)
Computes the L4 norm for the given dense matrix.
Definition: DMatNormExpr.h:703

◆ length()

template<typename VT , bool TF>
decltype(auto) blaze::length ( const SparseVector< VT, TF > &  sv)
inline

Calculation of the length (magnitude) of the sparse vector $|\vec{a}|$.

Parameters
svThe given sparse vector.
Returns
The length (magnitude) of the sparse vector.

This function calculates the actual length (magnitude) of the sparse vector. The function has the same effect as calling the norm() function on the sparse vector.

◆ lgamma()

template<typename VT , bool TF>
decltype(auto) blaze::lgamma ( const SparseVector< VT, TF > &  sv)
inline

Computes the natural logarithm of the absolute value of the gamma function of each non-zero element of the sparse vector sv.

Parameters
svThe input vector; all non-zero elements must be in the range $[0..\infty)$.
Returns
The natural logarithm of the absolute value of the gamma function of each non-zero element of sv.

The lgamma() function computes the natural logarithm of the absolute value of the gamma function for each non-zero element. The function returns an expression representing this operation.
The following example demonstrates the use of the lgamma() function:

// ... Resizing and initialization
b = lgamma( a );
decltype(auto) lgamma(const DenseMatrix< MT, SO > &dm)
Computes the natural logarithm of the absolute value of the gamma function for each single element of...
Definition: DMatMapExpr.h:2016
Note
All non-zero elements are expected to be in the range $[0..\infty)$. No runtime checks are performed to assert this precondition!

◆ linfNorm()

template<typename VT , bool TF>
decltype(auto) blaze::linfNorm ( const SparseVector< VT, TF > &  sv)

Computes the infinity norm for the given sparse vector.

Parameters
svThe given sparse vector for the norm computation.
Returns
The infinity norm of the given sparse vector.

This function computes the infinity norm of the given sparse vector:

// ... Resizing and initialization
const double linf = linfNorm( a );
decltype(auto) linfNorm(const DenseMatrix< MT, SO > &dm)
Computes the infinity norm for the given dense matrix.
Definition: DMatNormExpr.h:799

◆ log()

template<typename VT , bool TF>
decltype(auto) blaze::log ( const SparseVector< VT, TF > &  sv)
inline

Computes the natural logarithm of each non-zero element of the sparse vector sv.

Parameters
svThe input vector; all non-zero elements must be in the range $[0..\infty)$.
Returns
The natural logaritm of each non-zero element of sv.

The log() function computes the natural logarithm for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the log() function:

// ... Resizing and initialization
b = log( a );
decltype(auto) log(const DenseMatrix< MT, SO > &dm)
Computes the natural logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1888
Note
All non-zero elements are expected to be in the range $[0..\infty)$. No runtime checks are performed to assert this precondition!

◆ log10()

template<typename VT , bool TF>
decltype(auto) blaze::log10 ( const SparseVector< VT, TF > &  sv)
inline

Computes the common logarithm of each non-zero element of the sparse vector sv.

Parameters
svThe input vector; all non-zero elements must be in the range $[0..\infty)$.
Returns
The common logaritm of each non-zero element of sv.

The log10() function computes the common logarithm for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the log10() function:

// ... Resizing and initialization
b = log10( a );
decltype(auto) log10(const DenseMatrix< MT, SO > &dm)
Computes the common logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1950
Note
All non-zero elements are expected to be in the range $[0..\infty)$. No runtime checks are performed to assert this precondition!

◆ log1p()

template<typename VT , bool TF>
decltype(auto) blaze::log1p ( const SparseVector< VT, TF > &  sv)
inline

Computes the natural logarithm of x+1 of each non-zero element of the sparse vector sv.

Parameters
svThe input vector; all non-zero elements must be in the range $[-1..\infty)$.
Returns
The natural logarithm of x+1 of each non-zero element of sv.

The log1p() function computes the natural logarithm of x+1 for each non-zero element of the input vector sv. This may be preferred over the natural logarithm for higher precision computing the natural logarithm of a quantity very close to 1. The function returns an expression representing this operation.
The following example demonstrates the use of the log1p() function:

// ... Resizing and initialization
b = log1p( a );
decltype(auto) log1p(const DenseMatrix< MT, SO > &dm)
Computes the natural logarithm of x+1 for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1983
Note
All non-zero elements are expected to be in the range $[-1..\infty)$. No runtime checks are performed to assert this precondition!

◆ log2()

template<typename VT , bool TF>
decltype(auto) blaze::log2 ( const SparseVector< VT, TF > &  sv)
inline

Computes the binary logarithm of each non-zero element of the sparse vector sv.

Parameters
svThe input vector; all non-zero elements must be in the range $[0..\infty)$.
Returns
The binary logaritm of each non-zero element of sv.

The log2() function computes the binary logarithm for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the log2() function:

// ... Resizing and initialization
b = log2( a );
decltype(auto) log2(const DenseMatrix< MT, SO > &dm)
Computes the binary logarithm for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1919
Note
All non-zero elements are expected to be in the range $[0..\infty)$. No runtime checks are performed to assert this precondition!

◆ lowerBound() [1/2]

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::ConstIterator blaze::lowerBound ( const SparseVector< VT, TF > &  sv,
size_t  index 
)

Returns an iterator to the first index not less then the given index.

Parameters
svThe given sparse vector.
indexThe index of the search element. The index has to be in the range $[0..N-1]$.
Returns
Iterator to the first index not less then the given index, end() iterator otherwise.

This function returns an iterator to the first element with an index not less then the given index. In combination with the upperBound() function this function can be used to create a pair of iterators specifying a range of indices. Note that the returned sparse vector iterator is subject to invalidation due to inserting operations via the subscript operator, the set() function or the insert() function!

◆ lowerBound() [2/2]

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::Iterator blaze::lowerBound ( SparseVector< VT, TF > &  sv,
size_t  index 
)

Returns an iterator to the first index not less then the given index.

Parameters
svThe given sparse vector.
indexThe index of the search element. The index has to be in the range $[0..N-1]$.
Returns
Iterator to the first index not less then the given index, end() iterator otherwise.

This function returns an iterator to the first element with an index not less then the given index. In combination with the upperBound() function this function can be used to create a pair of iterators specifying a range of indices. Note that the returned sparse vector iterator is subject to invalidation due to inserting operations via the subscript operator, the set() function or the insert() function!

◆ lpNorm() [1/2]

template<size_t P, typename VT , bool TF>
decltype(auto) blaze::lpNorm ( const SparseVector< VT, TF > &  sv)
inline

Computes the Lp norm for the given sparse vector.

Parameters
svThe given sparse vector for the norm computation.
Returns
The Lp norm of the given sparse vector.

This function computes the Lp norm of the given sparse vector, where the norm is specified by the runtime argument P:

// ... Resizing and initialization
const double lp = lpNorm<2>( a );
Note
The norm parameter P is expected to be larger than 0. A value of 0 results in a compile time error!.

◆ lpNorm() [2/2]

template<typename VT , bool TF, typename ST >
decltype(auto) blaze::lpNorm ( const SparseVector< VT, TF > &  sv,
ST  p 
)

Computes the Lp norm for the given sparse vector.

Parameters
svThe given sparse vector for the norm computation.
pThe norm parameter (p > 0).
Returns
The Lp norm of the given sparse vector.

This function computes the Lp norm of the given sparse vector, where the norm is specified by the runtime argument p:

// ... Resizing and initialization
const double lp = lpNorm( a, 2.3 );
decltype(auto) lpNorm(const DenseMatrix< MT, SO > &dm, ST p)
Computes the Lp norm for the given dense matrix.
Definition: DMatNormExpr.h:735
Note
The norm parameter p is expected to be larger than 0. This precondition is only checked by a user assertion.

◆ map()

template<typename VT , bool TF, typename OP >
decltype(auto) blaze::map ( const SparseVector< VT, TF > &  sv,
OP  op 
)
inline

Evaluates the given custom operation on each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
opThe custom operation.
Returns
The custom operation applied to each single element of sv.

The map() function evaluates the given custom operation on each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the map() function:

// ... Resizing and initialization
b = map( a, []( double a ){ return std::sqrt( a ); } );
decltype(auto) map(const DenseMatrix< MT1, SO > &lhs, const DenseMatrix< MT2, SO > &rhs, OP op)
Elementwise evaluation of the given binary operation on each single element of the dense matrices lhs...
Definition: DMatDMatMapExpr.h:1144

◆ max()

template<typename VT , bool TF>
decltype(auto) blaze::max ( const SparseVector< VT, TF > &  sv)
inline

Returns the largest element of the sparse vector.

Parameters
svThe given sparse vector.
Returns
The largest sparse vector element.

This function returns the largest non-zero element of the given sparse vector. This function can only be used for element types that support the smaller-than relationship. In case the given vector currently has a size of 0, the returned value is the default value (e.g. 0 in case of fundamental data types).

Note
In case the sparse vector is not completely filled, the implicit zero elements are NOT taken into account. Example: the following compressed vector has only 2 non-zero elements. However, the maximum of this vector is -1:
blaze::CompressedVector<int> a{ -1, 0, -3, 0 };
const int totalmin = max( a ); // Results in -1
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1375

◆ maxNorm()

template<typename VT , bool TF>
decltype(auto) blaze::maxNorm ( const SparseVector< VT, TF > &  sv)

Computes the maximum norm for the given sparse vector.

Parameters
svThe given sparse vector for the norm computation.
Returns
The maximum norm of the given sparse vector.

This function computes the maximum norm of the given sparse vector:

// ... Resizing and initialization
const double max = maxNorm( a );
decltype(auto) maxNorm(const DenseMatrix< MT, SO > &dm)
Computes the maximum norm for the given dense matrix.
Definition: DMatNormExpr.h:825

◆ mean()

template<typename VT , bool TF>
decltype(auto) blaze::mean ( const SparseVector< VT, TF > &  sv)
inline

Computes the (arithmetic) mean for the given sparse vector.

Parameters
svThe given sparse vector for the mean computation.
Returns
The mean of the given vector.
Exceptions
std::invalid_argumentInvalid input vector.

This function computes the (arithmetic) mean for the given sparse vector sv. Both the non-zero and zero elements of the sparse vector are taken into account. Example:

CompressedVector<int> v{ 1, 0, 4, 0, 3, 0, 6, 0, 7, 0 };
const double m = mean( v ); // Results in 2.1 (i.e. 21/10 )
decltype(auto) mean(const DenseMatrix< MT, SO > &dm)
Computes the (arithmetic) mean for the given dense matrix.
Definition: DMatMeanExpr.h:134

In case the size of the given vector is 0, a std::invalid_argument is thrown.

◆ min()

template<typename VT , bool TF>
decltype(auto) blaze::min ( const SparseVector< VT, TF > &  sv)
inline

Returns the smallest element of the sparse vector.

Parameters
svThe given sparse vector.
Returns
The smallest sparse vector element.

This function returns the smallest non-zero element of the given sparse vector. This function can only be used for element types that support the smaller-than relationship. In case the given vector currently has a size of 0, the returned value is the default value (e.g. 0 in case of fundamental data types).

Note
In case the sparse vector is not completely filled, the implicit zero elements are NOT taken into account. Example: the following compressed vector has only 2 non-zero elements. However, the minimum of this vector is 1:
const int totalmin = min( a ); // Results in 1
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1339

◆ minNorm()

template<typename VT , bool TF>
decltype(auto) blaze::minNorm ( const SparseVector< VT, TF > &  sv)

Computes the minimum norm for the given sparse vector.

Parameters
svThe given sparse vector for the norm computation.
Returns
The minimum norm of the given sparse vector.

This function computes the minimum norm of the given sparse vector:

// ... Resizing and initialization
const double min = minNorm( a );
decltype(auto) minNorm(const DenseMatrix< MT, SO > &dm)
Computes the minimum norm for the given dense matrix.
Definition: DMatNormExpr.h:851

◆ noalias()

template<typename VT , bool TF>
decltype(auto) blaze::noalias ( const SparseVector< VT, TF > &  sv)
inline

Forces the non-aliased evaluation of the given sparse vector expression sv.

Parameters
svThe input vector.
Returns
The non-aliased sparse vector.

The noalias function forces the non-aliased evaluation of the given sparse vector expression sv. The function returns an expression representing this operation.
The following example demonstrates the use of the noalias function:

// ... Resizing and initialization
b = noalias( a );
decltype(auto) noalias(const DenseMatrix< MT, SO > &dm)
Forces the non-aliased evaluation of the given dense matrix expression dm.
Definition: DMatNoAliasExpr.h:679

◆ norm()

template<typename VT , bool TF>
decltype(auto) blaze::norm ( const SparseVector< VT, TF > &  sv)

Computes the L2 norm for the given sparse vector.

Parameters
svThe given sparse vector for the norm computation.
Returns
The L2 norm of the given sparse vector.

This function computes the L2 norm of the given sparse vector:

// ... Resizing and initialization
const double l2 = norm( a );
decltype(auto) norm(const DenseMatrix< MT, SO > &dm)
Computes the L2 norm for the given dense matrix.
Definition: DMatNormExpr.h:573

◆ nosimd()

template<typename VT , bool TF>
decltype(auto) blaze::nosimd ( const SparseVector< VT, TF > &  sv)
inline

Disables the SIMD evaluation of the given sparse vector expression sv.

Parameters
svThe input vector.
Returns
The SIMD-disabled sparse vector.

The nosimd function disables the SIMD evaluation of the given sparse vector expression sv. The function returns an expression representing this operation.
The following example demonstrates the use of the nosimd function:

// ... Resizing and initialization
b = nosimd( a );
decltype(auto) nosimd(const DenseMatrix< MT, SO > &dm)
Disables the SIMD evaluation of the given dense matrix expression dm.
Definition: DMatNoSIMDExpr.h:717

◆ operator!=()

template<typename VT1 , bool TF1, typename VT2 , bool TF2>
bool blaze::operator!= ( const SparseVector< VT1, TF1 > &  lhs,
const SparseVector< VT2, TF2 > &  rhs 
)
inline

Inequality operator for the comparison of two sparse vectors.

Parameters
lhsThe left-hand side sparse vector for the comparison.
rhsThe right-hand side sparse vector for the comparison.
Returns
true if the two vectors are not equal, false if they are equal.

◆ operator*() [1/12]

template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::operator* ( const DenseVector< VT1, TF > &  lhs,
const SparseVector< VT2, TF > &  rhs 
)
inline

Multiplication operator for the componentwise product of a dense vector and a sparse vector ( $ \vec{a}=\vec{b}*\vec{c} $).

Parameters
lhsThe left-hand side dense vector for the component product.
rhsThe right-hand side sparse vector for the component product.
Returns
The product of the two vectors.
Exceptions
std::invalid_argumentVector sizes do not match.

This operator represents the componentwise multiplication of a dense vector and a sparse vector:

// ... Resizing and initialization
c = a * b;

The operator returns an expression representing a sparse vector of the higher-order element type of the two involved vector element types VT1::ElementType and VT2::ElementType. Both vector types VT1 and VT2 as well as the two element types VT1::ElementType and VT2::ElementType have to be supported by the MultTrait class template.
In case the current sizes of the two given vectors don't match, a std::invalid_argument is thrown.

◆ operator*() [2/12]

template<typename VT1 , typename VT2 >
decltype(auto) blaze::operator* ( const DenseVector< VT1, true > &  lhs,
const SparseVector< VT2, false > &  rhs 
)
inline

Multiplication operator for the scalar product (inner product) of a dense and a sparse vector ( $ s=\vec{a}*\vec{b} $).

Parameters
lhsThe left-hand side dense vector for the inner product.
rhsThe right-hand side sparse vector for the inner product.
Returns
The scalar product.
Exceptions
std::invalid_argumentVector sizes do not match.

This operator represents the scalar product (inner product) of a dense vector and a sparse vector:

// ... Resizing and initialization
res = a * b;
decltype(auto) real(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the real part of each single element of dm.
Definition: DMatMapExpr.h:1529

The operator returns a scalar value of the higher-order element type of the two involved vector element types VT1::ElementType and VT2::ElementType. Both vector types VT1 and VT2 as well as the two element types VT1::ElementType and VT2::ElementType have to be supported by the MultTrait class template.
In case the current sizes of the two given vectors don't match, a std::invalid_argument is thrown.

◆ operator*() [3/12]

template<typename MT , typename VT >
decltype(auto) blaze::operator* ( const SparseMatrix< MT, false > &  mat,
const SparseVector< VT, false > &  vec 
)
inline

Multiplication operator for the multiplication of a row-major sparse matrix and a sparse vector ( $ \vec{a}=B*\vec{c} $).

Parameters
matThe left-hand side sparse matrix for the multiplication.
vecThe right-hand side sparse vector for the multiplication.
Returns
The resulting vector.
Exceptions
std::invalid_argumentMatrix and vector sizes do not match.

This operator represents the multiplication between a row-major sparse matrix and a sparse vector:

The operator returns an expression representing a sparse vector of the higher-order element type of the two involved element types MT::ElementType and VT::ElementType. Both the sparse matrix type MT and the sparse vector type VT as well as the two element types MT::ElementType and VT::ElementType have to be supported by the MultTrait class template.
In case the current size of the vector vec doesn't match the current number of columns of the matrix mat, a std::invalid_argument is thrown.

◆ operator*() [4/12]

template<typename MT , typename VT >
decltype(auto) blaze::operator* ( const SparseMatrix< MT, true > &  mat,
const SparseVector< VT, false > &  vec 
)
inline

Multiplication operator for the multiplication of a transpose sparse matrix and a sparse vector ( $ \vec{y}=A*\vec{x} $).

Parameters
matThe left-hand side sparse matrix for the multiplication.
vecThe right-hand side sparse vector for the multiplication.
Returns
The resulting vector.
Exceptions
std::invalid_argumentMatrix and vector sizes do not match.

This operator represents the multiplication between a transpose sparse matrix and a sparse vector:

The operator returns an expression representing a sparse vector of the higher-order element type of the two involved element types MT::ElementType and VT::ElementType. Both the sparse matrix type MT and the sparse vector type VT as well as the two element types MT::ElementType and VT::ElementType have to be supported by the MultTrait class template.
In case the current size of the vector vec doesn't match the current number of columns of the matrix mat, a std::invalid_argument is thrown.

◆ operator*() [5/12]

template<typename VT , typename ST , bool TF, EnableIf_t< IsScalar_v< ST > > * = nullptr>
decltype(auto) blaze::operator* ( const SparseVector< VT, TF > &  vec,
ST  scalar 
)
inline

Multiplication operator for the multiplication of a sparse vector and a scalar value ( $ \vec{a}=\vec{b}*s $).

Parameters
vecThe left-hand side sparse vector for the multiplication.
scalarThe right-hand side scalar value for the multiplication.
Returns
The scaled result vector.

This operator represents the multiplication between a sparse vector and a scalar value:

// ... Resizing and initialization
b = a * 1.25;

The operator returns a sparse vector of the higher-order element type of the involved data types VT::ElementType and ST. Note that this operator only works for scalar values of built-in data type.

◆ operator*() [6/12]

template<typename VT , typename MT >
decltype(auto) blaze::operator* ( const SparseVector< VT, true > &  vec,
const SparseMatrix< MT, false > &  mat 
)
inline

Multiplication operator for the multiplication of a transpose sparse vector and a row-major sparse matrix ( $ \vec{y}^T=\vec{x}^T*A $).

Parameters
vecThe left-hand side transpose sparse vector for the multiplication.
matThe right-hand side row-major sparse matrix for the multiplication.
Returns
The resulting transpose vector.
Exceptions
std::invalid_argumentVector and matrix sizes do not match.

This operator represents the multiplication between a transpose sparse vector and a row-major sparse matrix:

The operator returns an expression representing a transpose sparse vector of the higher-order element type of the two involved element types VT::ElementType and MT::ElementType. Both the sparse vector type VT and the sparse matrix type MT as well as the two element types VT::ElementType and MT::ElementType have to be supported by the MultTrait class template.
In case the current size of the vector vec doesn't match the current number of rows of the matrix mat, a std::invalid_argument is thrown.

◆ operator*() [7/12]

template<typename VT , typename MT >
decltype(auto) blaze::operator* ( const SparseVector< VT, true > &  vec,
const SparseMatrix< MT, true > &  mat 
)
inline

Multiplication operator for the multiplication of a transpose sparse vector and a column-major sparse matrix ( $ \vec{y}^T=\vec{x}^T*A $).

Parameters
vecThe left-hand side transpose sparse vector for the multiplication.
matThe right-hand side column-major sparse matrix for the multiplication.
Returns
The resulting transpose vector.
Exceptions
std::invalid_argumentVector and matrix sizes do not match.

This operator represents the multiplication between a transpose sparse vector and a column-major sparse matrix:

The operator returns an expression representing a transpose sparse vector of the higher-order element type of the two involved element types VT::ElementType and MT::ElementType. Both the sparse vector type VT and the sparse matrix type MT as well as the two element types VT::ElementType and MT::ElementType have to be supported by the MultTrait class template.
In case the current size of the vector vec doesn't match the current number of rows of the matrix mat, a std::invalid_argument is thrown.

◆ operator*() [8/12]

template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::operator* ( const SparseVector< VT1, TF > &  lhs,
const DenseVector< VT2, TF > &  rhs 
)
inline

Multiplication operator for the componentwise product of a sparse vector and a dense vector ( $ \vec{a}=\vec{b}*\vec{c} $).

Parameters
lhsThe left-hand side sparse vector for the component product.
rhsThe right-hand side dense vector for the component product.
Returns
The product of the two vectors.
Exceptions
std::invalid_argumentVector sizes do not match.

This operator represents the componentwise multiplication of a sparse vector and a dense vector:

// ... Resizing and initialization
c = a * b;

The operator returns an expression representing a sparse vector of the higher-order element type of the two involved vector element types VT1::ElementType and VT2::ElementType. Both vector types VT1 and VT2 as well as the two element types VT1::ElementType and VT2::ElementType have to be supported by the MultTrait class template.
In case the current sizes of the two given vectors don't match, a std::invalid_argument is thrown.

◆ operator*() [9/12]

template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::operator* ( const SparseVector< VT1, TF > &  lhs,
const SparseVector< VT2, TF > &  rhs 
)
inline

Multiplication operator for the componentwise multiplication of two sparse vectors ( $ \vec{a}=\vec{b}*\vec{c} $).

Parameters
lhsThe left-hand side sparse vector for the component product.
rhsThe right-hand side sparse vector for the component product.
Returns
The product of the two sparse vectors.
Exceptions
std::invalid_argumentVector sizes do not match.

This operator represents the componentwise multiplication of two sparse vectors:

// ... Resizing and initialization
c = a * b;

The operator returns a sparse vector of the higher-order element type of the two involved vector element types VT1::ElementType and VT2::ElementType. Both vector types VT1 and VT2 as well as the two element types VT1::ElementType and VT2::ElementType have to be supported by the MultTrait class template.
In case the current sizes of the two given vectors don't match, a std::invalid_argument is thrown.

◆ operator*() [10/12]

template<typename VT1 , typename VT2 >
decltype(auto) blaze::operator* ( const SparseVector< VT1, true > &  lhs,
const DenseVector< VT2, false > &  rhs 
)
inline

Multiplication operator for the scalar product (inner product) of a sparse and a dense vector ( $ s=\vec{a}*\vec{b} $).

Parameters
lhsThe left-hand side sparse vector for the inner product.
rhsThe right-hand side dense vector for the inner product.
Returns
The scalar product.
Exceptions
std::invalid_argumentVector sizes do not match.

This operator represents the scalar product (inner product) of a sparse vector and a dense vector:

The operator returns a scalar value of the higher-order element type of the two involved vector element types VT1::ElementType and VT2::ElementType. Both vector types VT1 and VT2 as well as the two element types VT1::ElementType and VT2::ElementType have to be supported by the MultTrait class template.
In case the current sizes of the two given vectors don't match, a std::invalid_argument is thrown.

◆ operator*() [11/12]

template<typename VT1 , typename VT2 >
decltype(auto) blaze::operator* ( const SparseVector< VT1, true > &  lhs,
const SparseVector< VT2, false > &  rhs 
)
inline

Multiplication operator for the scalar product (inner product) of two sparse vectors ( $ s=\vec{a}*\vec{b} $).

Parameters
lhsThe left-hand side sparse vector for the inner product.
rhsThe right-hand side sparse vector for the inner product.
Returns
The scalar product.
Exceptions
std::invalid_argumentVector sizes do not match.

This operator represents the scalar product (inner product) of two sparse vectors:

// ... Resizing and initialization
res = trans(a) * b;

The operator returns a scalar value of the higher-order element type of the two involved vector element types VT1::ElementType and VT2::ElementType. Both vector types VT1 and VT2 as well as the two element types VT1::ElementType and VT2::ElementType have to be supported by the MultTrait class template.
In case the current sizes of the two given vectors don't match, a std::invalid_argument is thrown.

◆ operator*() [12/12]

template<typename ST , typename VT , bool TF, EnableIf_t< IsScalar_v< ST > > * = nullptr>
decltype(auto) blaze::operator* ( ST  scalar,
const SparseVector< VT, TF > &  vec 
)
inline

Multiplication operator for the multiplication of a scalar value and a sparse vector ( $ \vec{a}=s*\vec{b} $).

Parameters
scalarThe left-hand side scalar value for the multiplication.
vecThe right-hand side sparse vector for the multiplication.
Returns
The scaled result vector.

This operator represents the multiplication between a a scalar value and sparse vector:

// ... Resizing and initialization
b = 1.25 * a;

The operator returns a sparse vector of the higher-order element type of the involved data types ST and VT::ElementType. Note that this operator only works for scalar values of built-in data type.

◆ operator*=() [1/2]

template<typename VT , bool TF, typename ST >
auto blaze::operator*= ( SparseVector< VT, TF > &&  vec,
ST  scalar 
) -> EnableIf_t< IsScalar_v< ST >, VT & >
inline

Multiplication assignment operator for the multiplication of a temporary sparse vector and a scalar ( $ v*=s $).

Parameters
vecThe left-hand side temporary sparse vector for the multiplication.
scalarThe right-hand side scalar value for the multiplication.
Returns
Reference to the left-hand side sparse vector.
Exceptions
std::invalid_argumentInvalid scaling of restricted vector.

In case the vector VT is restricted and the assignment would violate an invariant of the vector, a std::invalid_argument exception is thrown.

◆ operator*=() [2/2]

template<typename VT , bool TF, typename ST >
auto blaze::operator*= ( SparseVector< VT, TF > &  vec,
ST  scalar 
) -> EnableIf_t< IsScalar_v< ST >, VT & >
inline

Multiplication assignment operator for the multiplication of a sparse vector and a scalar value ( $ \vec{a}*=s $).

Parameters
vecThe left-hand side sparse vector for the multiplication.
scalarThe right-hand side scalar value for the multiplication.
Returns
Reference to the left-hand side sparse vector.
Exceptions
std::invalid_argumentInvalid scaling of restricted vector.

In case the vector VT is restricted and the assignment would violate an invariant of the vector, a std::invalid_argument exception is thrown.

◆ operator+()

template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::operator+ ( const SparseVector< VT1, TF > &  lhs,
const SparseVector< VT2, TF > &  rhs 
)
inline

Addition operator for the addition of two sparse vectors ( $ \vec{a}=\vec{b}+\vec{c} $).

Parameters
lhsThe left-hand side sparse vector for the vector addition.
rhsThe right-hand side sparse vector for the vector addition.
Returns
The sum of the two sparse vectors.
Exceptions
std::invalid_argumentVector sizes do not match.

This operator represents the addition of two sparse vectors:

// ... Resizing and initialization
c = a + b;

The operator returns a sparse vector of the higher-order element type of the two involved vector element types VT1::ElementType and VT2::ElementType. Both vector types VT1 and VT2 as well as the two element types VT1::ElementType and VT2::ElementType have to be supported by the AddTrait class template.
In case the current sizes of the two given vectors don't match, a std::invalid_argument is thrown.

◆ operator-() [1/2]

template<typename VT , bool TF>
decltype(auto) blaze::operator- ( const SparseVector< VT, TF > &  sv)
inline

Unary minus operator for the negation of a sparse vector ( $ \vec{a} = -\vec{b} $).

Parameters
svThe sparse vector to be negated.
Returns
The negation of the vector.

This operator represents the negation of a sparse vector:

// ... Resizing and initialization
b = -a;

The operator returns an expression representing the negation of the given sparse vector.

◆ operator-() [2/2]

template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::operator- ( const SparseVector< VT1, TF > &  lhs,
const SparseVector< VT2, TF > &  rhs 
)
inline

Subtraction operator for the subtraction of two sparse vectors ( $ \vec{a}=\vec{b}-\vec{c} $).

Parameters
lhsThe left-hand side sparse vector for the vector subtraction.
rhsThe right-hand side sparse vector to be subtracted from the vector.
Returns
The difference of the two sparse vectors.
Exceptions
std::invalid_argumentVector sizes do not match.

This operator represents the subtraction of two sparse vectors:

// ... Resizing and initialization
c = a - b;

The operator returns a sparse vector of the higher-order element type of the two involved vector element types VT1::ElementType and VT2::ElementType. Both vector types VT1 and VT2 as well as the two element types VT1::ElementType and VT2::ElementType have to be supported by the SubTrait class template.
In case the current sizes of the two given vectors don't match, a std::invalid_argument is thrown.

◆ operator/() [1/2]

template<typename VT , typename ST , bool TF, EnableIf_t< IsScalar_v< ST > > * = nullptr>
decltype(auto) blaze::operator/ ( const SparseVector< VT, TF > &  vec,
ST  scalar 
)
inline

Division operator for the divison of a sparse vector by a scalar value ( $ \vec{a}=\vec{b}/s $).

Parameters
vecThe left-hand side sparse vector for the division.
scalarThe right-hand side scalar value for the division.
Returns
The scaled result vector.

This operator represents the division of a sparse vector by a scalar value:

// ... Resizing and initialization
b = a / 0.24;

The operator returns a sparse vector of the higher-order element type of the involved data types VT::ElementType and ST. Note that this operator only works for scalar values of built-in data type.

Note
A division by zero is only checked by an user assert.

◆ operator/() [2/2]

template<typename VT1 , typename VT2 , bool TF>
decltype(auto) blaze::operator/ ( const SparseVector< VT1, TF > &  lhs,
const DenseVector< VT2, TF > &  rhs 
)
inline

Division operator for the componentwise division of a sparse vector and a dense vector ( $ \vec{a}=\vec{b}/\vec{c} $).

Parameters
lhsThe left-hand side sparse vector for the component quotient.
rhsThe right-hand side dense vector for the component quotient.
Returns
The quotient of the two vectors.
Exceptions
std::invalid_argumentVector sizes do not match.

This operator represents the component quotient of a sparse vector and a dense vector:

// ... Resizing and initialization
c = a / b;

The operator returns an expression representing a sparse vector of the higher-order element type of the two involved vector element types VT1::ElementType and VT2::ElementType. Both vector types VT1 and VT2 as well as the two element types VT1::ElementType and VT2::ElementType have to be supported by the DivTrait class template.
In case the current sizes of the two given vectors don't match, a std::invalid_argument is thrown.

◆ operator/=() [1/2]

template<typename VT , bool TF, typename ST >
auto blaze::operator/= ( SparseVector< VT, TF > &&  vec,
ST  scalar 
) -> EnableIf_t< IsScalar_v< ST >, VT & >
inline

Division assignment operator for the division of a temporary sparse vector by a scalar value ( $ \vec{a}/=s $).

Parameters
vecThe left-hand side temporary sparse vector for the division.
scalarThe right-hand side scalar value for the division.
Returns
Reference to the left-hand side sparse vector.
Exceptions
std::invalid_argumentInvalid scaling of restricted vector.

In case the vector VT is restricted and the assignment would violate an invariant of the vector, a std::invalid_argument exception is thrown.

Note
A division by zero is only checked by an user assert.

◆ operator/=() [2/2]

template<typename VT , bool TF, typename ST >
auto blaze::operator/= ( SparseVector< VT, TF > &  vec,
ST  scalar 
) -> EnableIf_t< IsScalar_v< ST >, VT & >
inline

Division assignment operator for the division of a sparse vector by a scalar value ( $ \vec{a}/=s $).

Parameters
vecThe left-hand side sparse vector for the division.
scalarThe right-hand side scalar value for the division.
Returns
Reference to the left-hand side sparse vector.
Exceptions
std::invalid_argumentInvalid scaling of restricted vector.

In case the vector VT is restricted and the assignment would violate an invariant of the vector, a std::invalid_argument exception is thrown.

Note
A division by zero is only checked by an user assert.

◆ operator==()

template<typename VT1 , bool TF1, typename VT2 , bool TF2>
bool blaze::operator== ( const SparseVector< VT1, TF1 > &  lhs,
const SparseVector< VT2, TF2 > &  rhs 
)
inline

Equality operator for the comparison of two sparse vectors.

Parameters
lhsThe left-hand side sparse vector for the comparison.
rhsThe right-hand side sparse vector for the comparison.
Returns
true if the two sparse vectors are equal, false if not.

◆ pow()

template<typename VT , bool TF, typename ST , EnableIf_t< IsScalar_v< ST > > * = nullptr>
decltype(auto) blaze::pow ( const SparseVector< VT, TF > &  sv,
ST  exp 
)
inline

Computes the exponential value for each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
expThe scalar exponent.
Returns
The exponential value of each non-zero element of sv.

The pow() function computes the exponential value for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the pow() function:

// ... Resizing and initialization
B = pow( A, 4.2 );
decltype(auto) pow(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise exponential value for the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1448

◆ prod()

template<typename VT , bool TF>
decltype(auto) blaze::prod ( const SparseVector< VT, TF > &  sv)
inline

Reduces the given sparse vector by means of multiplication.

Parameters
svThe given sparse vector for the reduction operation.
Returns
The result of the reduction operation.

This function reduces the non-zero elements of the given sparse vector sv by means of multiplication:

const int totalprod = prod( a ); // Results in 24
decltype(auto) prod(const DenseMatrix< MT, SO > &dm)
Reduces the given dense matrix by means of multiplication.
Definition: DMatReduceExpr.h:2229

Please note that the evaluation order of the reduction operation is unspecified.

◆ real()

template<typename VT , bool TF>
decltype(auto) blaze::real ( const SparseVector< VT, TF > &  sv)
inline

Returns a vector containing the real parts of each single element of sv.

Parameters
svThe integral sparse input vector.
Returns
The real part of each single element of sv.

The real() function calculates the real part of each element of the sparse input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the real() function:

// ... Resizing and initialization
b = real( a );

◆ reduce()

template<typename VT , bool TF, typename OP >
decltype(auto) blaze::reduce ( const SparseVector< VT, TF > &  sv,
OP  op 
)
inline

Performs a custom reduction operation on the given sparse vector.

Parameters
svThe given sparse vector for the reduction computation.
opThe reduction operation.
Returns
The result of the reduction operation.

This function reduces the non-zero elements of the given sparse vector sv by means of the given reduction operation op:

// ... Resizing and initialization
const double totalsum1 = reduce( a, blaze::Add() );
const double totalsum2 = reduce( a, []( double a, double b ){ return a + b; } );
decltype(auto) reduce(const DenseMatrix< MT, SO > &dm, OP op)
Performs a custom reduction operation on the given dense matrix.
Definition: DMatReduceExpr.h:2025
Generic wrapper for the addition operator.
Definition: Add.h:85

As demonstrated in the example it is possible to pass any binary callable as custom reduction operation. See Custom Operations for a detailed overview of the possibilities of custom operations.

Please note that the evaluation order of the reduction operation is unspecified. Thus the behavior is non-deterministic if op is not associative or not commutative. Also, the operation is undefined if the given reduction operation modifies the values.

◆ repeat() [1/2]

template<size_t R0, typename VT , bool TF>
decltype(auto) blaze::repeat ( const SparseVector< VT, TF > &  sv)
inline

Repeats the given sparse vector.

Parameters
svThe sparse vector to be repeated.
Returns
The repeated sparse vector.

This function returns an expression representing the repeated sparse vector:

// ... Resizing and initialization
a2 = repeat<3UL>( a1 ); // Results in ( 1, 0, -2, 1, 0, -2, 1, 0, -2 )
b2 = repeat<3UL>( b1 ); // Results in ( 0, -1, 7, 0, -1, 7, 0, -1, 7 )

◆ repeat() [2/2]

template<typename VT , bool TF>
decltype(auto) blaze::repeat ( const SparseVector< VT, TF > &  sv,
size_t  repetitions 
)
inline

Repeats the given sparse vector.

Parameters
svThe sparse vector to be repeated.
repetitionsThe number of repetitions.
Returns
The repeated sparse vector.

This function returns an expression representing the repeated sparse vector:

// ... Resizing and initialization
a2 = repeat( a1, 3UL ); // Results in ( 1, 0, -2, 1, 0, -2, 1, 0, -2 )
b2 = repeat( b1, 3UL ); // Results in ( 0, -1, 7, 0, -1, 7, 0, -1, 7 )
decltype(auto) repeat(const DenseMatrix< MT, SO > &dm, size_t m, size_t n)
Repeats the given dense matrix.
Definition: DMatRepeatExpr.h:543

◆ round()

template<typename VT , bool TF>
decltype(auto) blaze::round ( const SparseVector< VT, TF > &  sv)
inline

Applies the round() function to each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The resulting sparse vector.

This function applies the round() function to each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the round() function:

// ... Resizing and initialization
b = round( a );
decltype(auto) round(const DenseMatrix< MT, SO > &dm)
Applies the round() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1436

◆ serial()

template<typename VT , bool TF>
decltype(auto) blaze::serial ( const SparseVector< VT, TF > &  sv)
inline

Forces the serial evaluation of the given sparse vector expression sv.

Parameters
svThe input vector.
Returns
The evaluated sparse vector.

The serial function forces the serial evaluation of the given sparse vector expression sv. The function returns an expression representing this operation.
The following example demonstrates the use of the serial function:

// ... Resizing and initialization
b = serial( a );
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812

◆ sign()

template<typename VT , bool TF>
decltype(auto) blaze::sign ( const SparseVector< VT, TF > &  sv)
inline

Applies the sign() function to each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The resulting sparse vector.

This function applies the sign() function to each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the sign() function:

// ... Resizing and initialization
b = sign( a );
decltype(auto) sign(const DenseMatrix< MT, SO > &dm)
Applies the sign() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1324

◆ sin()

template<typename VT , bool TF>
decltype(auto) blaze::sin ( const SparseVector< VT, TF > &  sv)
inline

Computes the sine of each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The sine of each non-zero element of sv.

The sin() function computes the sine for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the sin() function:

// ... Resizing and initialization
b = sin( a );
decltype(auto) sin(const DenseMatrix< MT, SO > &dm)
Computes the sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2044

◆ sinh()

template<typename VT , bool TF>
decltype(auto) blaze::sinh ( const SparseVector< VT, TF > &  sv)
inline

Computes the hyperbolic sine of each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The hyperbolic sine of each non-zero element of sv.

The sinh() function computes the hyperbolic sine for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the sinh() function:

// ... Resizing and initialization
b = sinh( a );
decltype(auto) sinh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic sine for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2103

◆ sqrLength()

template<typename VT , bool TF>
decltype(auto) blaze::sqrLength ( const SparseVector< VT, TF > &  sv)
inline

Calculation of the square length (magnitude) of the sparse vector $|\vec{a}|^2$.

Parameters
svThe given sparse vector.
Returns
The square length (magnitude) of the sparse vector.

This function calculates the actual square length (magnitude) of the sparse vector. The function has the same effect as calling the sqrNorm() function on the sparse vector.

◆ sqrNorm()

template<typename VT , bool TF>
decltype(auto) blaze::sqrNorm ( const SparseVector< VT, TF > &  sv)

Computes the squared L2 norm for the given sparse vector.

Parameters
svThe given sparse vector for the norm computation.
Returns
The squared L2 norm of the given sparse vector.

This function computes the squared L2 norm of the given sparse vector:

// ... Resizing and initialization
const double l2 = sqrNorm( a );
decltype(auto) sqrNorm(const DenseMatrix< MT, SO > &dm)
Computes the squared L2 norm for the given dense matrix.
Definition: DMatNormExpr.h:599

◆ sqrt()

template<typename VT , bool TF>
decltype(auto) blaze::sqrt ( const SparseVector< VT, TF > &  sv)
inline

Computes the square root of each non-zero element of the sparse vector sv.

Parameters
svThe input vector; all non-zero elements must be in the range $[0..\infty)$.
Returns
The square root of each single element of sv.

The sqrt() function computes the square root of each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the sqrt() function:

// ... Resizing and initialization
b = sqrt( a );
Note
All non-zero elements are expected to be in the range $[0..\infty)$. No runtime checks are performed to assert this precondition!

◆ stddev()

template<typename VT , bool TF>
decltype(auto) blaze::stddev ( const SparseVector< VT, TF > &  sv)

Computes the standard deviation for the given sparse vector.

Parameters
svThe given sparse vector for the standard deviation computation.
Returns
The standard deviation of the given vector.
Exceptions
std::invalid_argumentInvalid input vector.

This function computes the standard deviation for the given sparse vector sv. Both the non-zero and zero elements of the sparse vector are taken into account. Example:

CompressedVector<int> v{ 1, 4, 3, 6, 7 };
const double m = stddev( v ); // Results in 2.38747
decltype(auto) stddev(const DenseMatrix< MT, SO > &dm)
Computes the standard deviation for the given dense matrix.
Definition: DMatStdDevExpr.h:83

In case the size of the given vector is smaller than 2, a std::invalid_argument is thrown.

◆ sum()

template<typename VT , bool TF>
decltype(auto) blaze::sum ( const SparseVector< VT, TF > &  sv)
inline

Reduces the given sparse vector by means of addition.

Parameters
svThe given sparse vector for the reduction operation.
Returns
The result of the reduction operation.

This function reduces the non-zero elements of the given sparse vector sv by means of addition:

const int totalsum = sum( a ); // Results in 10
decltype(auto) sum(const DenseMatrix< MT, SO > &dm)
Reduces the given dense matrix by means of addition.
Definition: DMatReduceExpr.h:2156

Please note that the evaluation order of the reduction operation is unspecified.

◆ swap() [1/3]

template<typename VT >
void blaze::swap ( const VectorAccessProxy< VT > &  a,
const VectorAccessProxy< VT > &  b 
)
inlinenoexcept

Swapping the contents of two access proxies.

Parameters
aThe first access proxy to be swapped.
bThe second access proxy to be swapped.
Returns
void

◆ swap() [2/3]

template<typename VT , typename T >
void blaze::swap ( const VectorAccessProxy< VT > &  a,
T &  b 
)
inlinenoexcept

Swapping the contents of an access proxy with another element.

Parameters
aThe access proxy to be swapped.
bThe other element to be swapped.
Returns
void

◆ swap() [3/3]

template<typename T , typename VT >
void blaze::swap ( T &  a,
const VectorAccessProxy< VT > &  b 
)
inlinenoexcept

Swapping the contents of an access proxy with another element.

Parameters
aThe other element to be swapped.
bThe access proxy to be swapped.
Returns
void

◆ tan()

template<typename VT , bool TF>
decltype(auto) blaze::tan ( const SparseVector< VT, TF > &  sv)
inline

Computes the tangent of each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The tangent of each non-zero element of sv.

The tan() function computes the tangent for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the tan() function:

// ... Resizing and initialization
b = tan( a );
decltype(auto) tan(const DenseMatrix< MT, SO > &dm)
Computes the tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2277

◆ tanh()

template<typename VT , bool TF>
decltype(auto) blaze::tanh ( const SparseVector< VT, TF > &  sv)
inline

Computes the hyperbolic tangent of each non-zero element of the sparse vector sv.

Parameters
svThe input vector; all non-zero elements must be in the range $[-1..1]$.
Returns
The hyperbolic tangent of each non-zero element of sv.

The tanh() function computes the hyperbolic tangent for each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the tanh() function:

// ... Resizing and initialization
b = tanh( a );
decltype(auto) tanh(const DenseMatrix< MT, SO > &dm)
Computes the hyperbolic tangent for each single element of the dense matrix dm.
Definition: DMatMapExpr.h:2336
Note
All non-zero elements are expected to be in the range $[-1..1]$. No runtime checks are performed to assert this precondition!

◆ trans()

template<typename VT , bool TF>
decltype(auto) blaze::trans ( const SparseVector< VT, TF > &  sv)
inline

Calculation of the transpose of the given sparse vector.

Parameters
svThe sparse vector to be transposed.
Returns
The transpose of the sparse vector.

This function returns an expression representing the transpose of the given sparse vector:

◆ transTo()

template<bool TTF, typename VT , bool TF>
decltype(auto) blaze::transTo ( const SparseVector< VT, TF > &  sv)
inline

Conditional calculation of the transpose of the given sparse vector.

Parameters
svThe sparse vector to be transposed.
Returns
The sparse vector with the specified transpose flag.

This function transposes the given sparse vector in case the target transpose flag is different from the current transpose flag of the vector and performs no action if the two transpose flags match. It returns an expression representing the the given sparse vector with the specified transpose flag.

◆ trunc()

template<typename VT , bool TF>
decltype(auto) blaze::trunc ( const SparseVector< VT, TF > &  sv)
inline

Applies the trunc() function to each non-zero element of the sparse vector sv.

Parameters
svThe input vector.
Returns
The resulting sparse vector.

This function applies the trunc() function to each non-zero element of the input vector sv. The function returns an expression representing this operation.
The following example demonstrates the use of the trunc() function:

// ... Resizing and initialization
b = trunc( a );
decltype(auto) trunc(const DenseMatrix< MT, SO > &dm)
Applies the trunc() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1408

◆ upperBound() [1/2]

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::ConstIterator blaze::upperBound ( const SparseVector< VT, TF > &  sv,
size_t  index 
)

Returns an iterator to the first index greater then the given index.

Parameters
svThe given sparse vector.
indexThe index of the search element. The index has to be in the range $[0..N-1]$.
Returns
Iterator to the first index greater then the given index, end() iterator otherwise.

This function returns an iterator to the first element with an index greater then the given index. In combination with the lowerBound() function this function can be used to create a pair of iterators specifying a range of indices. Note that the returned sparse vector iterator is subject to invalidation due to inserting operations via the subscript operator, the set() function or the insert() function!

◆ upperBound() [2/2]

template<typename VT , bool TF>
BLAZE_ALWAYS_INLINE VT::Iterator blaze::upperBound ( SparseVector< VT, TF > &  sv,
size_t  index 
)

Returns an iterator to the first index greater then the given index.

Parameters
svThe given sparse vector.
indexThe index of the search element. The index has to be in the range $[0..N-1]$.
Returns
Iterator to the first index greater then the given index, end() iterator otherwise.

This function returns an iterator to the first element with an index greater then the given index. In combination with the lowerBound() function this function can be used to create a pair of iterators specifying a range of indices. Note that the returned sparse vector iterator is subject to invalidation due to inserting operations via the subscript operator, the set() function or the insert() function!

◆ var()

template<typename VT , bool TF>
decltype(auto) blaze::var ( const SparseVector< VT, TF > &  sv)

Computes the variance for the given sparse vector.

Parameters
svThe given sparse vector for the variance computation.
Returns
The variance of the given vector.
Exceptions
std::invalid_argumentInvalid input vector.

This function computes the variance for the given sparse vector sv. Both the non-zero and zero elements of the sparse vector are taken into account. Example:

CompressedVector<int> v{ 1, 4, 3, 6, 7 };
const double m = var( v ); // Results in 5.7
decltype(auto) var(const DenseMatrix< MT, SO > &dm)
Computes the variance for the given dense matrix.
Definition: DMatVarExpr.h:138

In case the size of the given vector is smaller than 2, a std::invalid_argument is thrown.