Modules | Classes | Functions
Sparse Vectors

Modules

 Expressions
 
 CompressedVector
 
 ZeroVector
 

Classes

struct  blaze::SparseVector< VT, TF >
 Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dimensional) sparse vectors. It provides an abstraction from the actual type of the sparse vector, but enables a conversion back to this type via the Vector base class. More...
 
class  blaze::VectorAccessProxy< VT >
 Access proxy for sparse, N-dimensional vectors.The VectorAccessProxy provides safe access to the elements of a non-const sparse vector.
The proxied access to the elements of a sparse vector is necessary since it may be possible that several insertion operations happen in the same statement. The following code illustrates this with two examples by means of the CompressedVector class: 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::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::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, 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::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< IsNumeric_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::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::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::maxNorm (const SparseVector< VT, TF > &sv)
 Computes the maximum norm for the given sparse vector. 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 , typename ST , bool TF, EnableIf_t< IsNumeric_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< IsNumeric_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< IsNumeric_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 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::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 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 operators

template<typename VT , bool TF, typename ST >
auto blaze::operator*= (SparseVector< VT, TF > &vec, ST scalar) -> EnableIf_t< IsNumeric_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< IsNumeric_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< IsNumeric_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< IsNumeric_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<bool 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<bool RF, typename VT , bool TF>
bool blaze::isZero (const SparseVector< VT, TF > &sv)
 Checks if the given sparse vector is a zero vector. More...
 
template<typename VT , bool TF>
const ElementType_t< VT > 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>
auto blaze::length (const SparseVector< VT, TF > &sv) -> decltype(sqrt(sqrLength(~sv)))
 Calculation of the length (magnitude) of the sparse vector $|\vec{a}|$. More...
 

VectorAccessProxy global functions

template<typename VT >
void blaze::reset (const VectorAccessProxy< VT > &proxy)
 Resetting the represented element to the default initial values. More...
 
template<typename VT >
void blaze::clear (const VectorAccessProxy< VT > &proxy)
 Clearing the represented element. More...
 
template<bool RF, typename VT >
bool blaze::isDefault (const VectorAccessProxy< VT > &proxy)
 Returns whether the represented element is in default state. More...
 
template<bool RF, typename VT >
bool blaze::isReal (const VectorAccessProxy< VT > &proxy)
 Returns whether the vector element represents a real number. More...
 
template<bool RF, typename VT >
bool blaze::isZero (const VectorAccessProxy< VT > &proxy)
 Returns whether the represented element is 0. More...
 
template<bool RF, typename VT >
bool blaze::isOne (const VectorAccessProxy< VT > &proxy)
 Returns whether the represented element is 1. More...
 
template<typename VT >
bool blaze::isnan (const VectorAccessProxy< VT > &proxy)
 Returns whether the represented element is not a number. More...
 
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 );

◆ 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 );
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 );
Note
All non-zero elements are expected to be in the range $[1..\infty)$. No runtime checks are performed to assert this precondition!

◆ 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 );
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 );

◆ 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 );

◆ 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 );
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 );
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 );

◆ 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 );

◆ clear()

template<typename VT >
void blaze::clear ( const VectorAccessProxy< VT > &  proxy)
inline

Clearing the represented element.

Parameters
proxyThe given access proxy.
Returns
void

◆ 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 );

◆ 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 );

◆ 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 );

◆ 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 );

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

◆ 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 );

◆ 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 );

◆ eval()

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

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 );

◆ 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 );

◆ 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 );

◆ 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 );

◆ expand() [1/2]

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

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 );

◆ expand() [2/2]

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

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 );

◆ 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 );

◆ 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 ); } );

◆ 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 );

◆ 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 );
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 );
Note
All non-zero elements are expected to be in the range $(0..\infty)$. No runtime checks are performed to assert this precondition!

◆ isDefault()

template<bool RF, typename VT >
bool blaze::isDefault ( const VectorAccessProxy< VT > &  proxy)
inline

Returns whether the represented element is in default state.

Parameters
proxyThe given access proxy.
Returns
true in case the represented element is in default state, false otherwise.

This function checks whether the element represented by the access proxy is in default state. In case it is in default state, the function returns true, otherwise it returns false.

◆ isnan() [1/2]

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 ) ) { ... }

Note that this function only works for vectors with floating point elements. The attempt to use it for a vector with a non-floating point element type results is a compile time error.

◆ isnan() [2/2]

template<typename VT >
bool blaze::isnan ( const VectorAccessProxy< VT > &  proxy)
inline

Returns whether the represented element is not a number.

Parameters
proxyThe given access proxy.
Returns
true in case the represented element is in not a number, false otherwise.

This function checks whether the element represented by the access proxy is not a number (NaN). In case it is not a number, the function returns true, otherwise it returns false.

◆ isOne()

template<bool RF, typename VT >
bool blaze::isOne ( const VectorAccessProxy< VT > &  proxy)
inline

Returns whether the represented element is 1.

Parameters
proxyThe given access proxy.
Returns
true in case the represented element is 1, false otherwise.

This function checks whether the element represented by the access proxy represents the numeric value 1. In case it is 1, the function returns true, otherwise it returns false.

◆ isReal()

template<bool RF, typename VT >
bool blaze::isReal ( const VectorAccessProxy< VT > &  proxy)
inline

Returns whether the vector element represents a real number.

Parameters
proxyThe given access proxy.
Returns
true in case the vector element represents a real number, false otherwise.

This function checks whether the element represented by the access proxy represents the a real number. In case the element is of built-in type, the function returns true. In case the element is of complex type, the function returns true if the imaginary part is equal to 0. Otherwise it returns false.

◆ isUniform()

template<bool 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 ) ) { ... }

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() [1/2]

template<bool 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 ) ) { ... }

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.

◆ isZero() [2/2]

template<bool RF, typename VT >
bool blaze::isZero ( const VectorAccessProxy< VT > &  proxy)
inline

Returns whether the represented element is 0.

Parameters
proxyThe given access proxy.
Returns
true in case the represented element is 0, false otherwise.

This function checks whether the element represented by the access proxy represents the numeric value 0. In case it is 0, the function returns true, otherwise it returns false.

◆ 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 );

◆ 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 );

◆ 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 );

◆ 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 );

◆ length()

template<typename VT , bool TF>
auto blaze::length ( const SparseVector< VT, TF > &  sv) -> decltype(sqrt(sqrLength(~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 return type of the length() function depends on the actual element type of the vector instance:

Type LengthType
float float
integral data types and double double
long double long double
complex<T> complex<T>
Note
This operation is only defined for numeric data types. In case the element type is not a numeric data type (i.e. a user defined data type or boolean) the attempt to use the length() function results in a compile time error!

◆ 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 );
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 );
Note
All non-zero elements are expected to be in the range $[0..\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 );
Note
All non-zero elements are expected to be in the range $[0..\infty)$. No runtime checks are performed to assert this precondition!

◆ lpNorm() [1/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 );
Note
The norm parameter p is expected to be larger than 0. This precondition is only checked by a user assertion.

◆ lpNorm() [2/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!.

◆ map()

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.

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 ); } );

◆ 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

◆ 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 );

◆ 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

◆ 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 );

◆ 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 >
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:

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*() [2/12]

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} $).

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*() [3/12]

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} $).

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*() [4/12]

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} $).

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*() [5/12]

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} $).

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*() [6/12]

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} $).

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*() [7/12]

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} $).

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*() [8/12]

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 $).

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*() [9/12]

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 $).

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*() [10/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*() [11/12]

template<typename VT , typename ST , bool TF, EnableIf_t< IsNumeric_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*() [12/12]

template<typename ST , typename VT , bool TF, EnableIf_t< IsNumeric_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< IsNumeric_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*=() [2/2]

template<typename VT , bool TF, typename ST >
auto blaze::operator*= ( SparseVector< VT, TF > &&  vec,
ST  scalar 
) -> EnableIf_t< IsNumeric_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+()

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} $).

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 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} $).

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/() [2/2]

template<typename VT , typename ST , bool TF, EnableIf_t< IsNumeric_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/=() [1/2]

template<typename VT , bool TF, typename ST >
auto blaze::operator/= ( SparseVector< VT, TF > &  vec,
ST  scalar 
) -> EnableIf_t< IsNumeric_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/=() [2/2]

template<typename VT , bool TF, typename ST >
auto blaze::operator/= ( SparseVector< VT, TF > &&  vec,
ST  scalar 
) -> EnableIf_t< IsNumeric_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==()

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< IsNumeric_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 );

◆ 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

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 
)

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; } );

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.

◆ reset()

template<typename VT >
void blaze::reset ( const VectorAccessProxy< VT > &  proxy)
inline

Resetting the represented element to the default initial values.

Parameters
proxyThe given access proxy.
Returns
void

◆ 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 );

◆ serial()

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.

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 );

◆ 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 );

◆ 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 );

◆ 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 );

◆ sqrLength()

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

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 vector.

This function calculates the actual square length (magnitude) of the sparse vector.

Note
This operation is only defined for numeric data types. In case the element type is not a numeric data type (i.e. a user defined data type or boolean) the attempt to use the sqrLength() function results in a compile time error!

◆ 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 );

◆ 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!

◆ 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

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 );

◆ 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 );
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)

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)

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 );