VCTR
Loading...
Searching...
No Matches
Expressions

An overview of all expression chain builders. More...

Detailed Description

An overview of all expression chain builders.

Expression chain builders are used to build of chains of vector expressions using the << operator. Example:

auto expression = vctr::ln << vctr::abs << (src - 3);
constexpr ExpressionChainBuilder< expressions::Ln > ln
Computes the natural logarithm of the source values.
Definition: Ln.h:84
constexpr ExpressionChainBuilder< expressions::Abs > abs
Computes the absolute value of the source values.
Definition: Abs.h:133

Will create an expression that evaluates the natural logarithm of the absolute value of the difference of the source vector src and the constant value 3. This expression can then be assigned to an existing Vector, Array or Span of a matching extent or be used to initialize a new Vector or Array.

Variable Documentation

◆ abs

constexpr ExpressionChainBuilder<expressions::Abs> vctr::abs
inlineconstexpr

Computes the absolute value of the source values.

Complex source values are transformed into real values. Unsigned integers remain unaltered.

◆ acos

constexpr ExpressionChainBuilder<expressions::Acos> vctr::acos
inlineconstexpr

Computes the inverse cosine of each source element.

◆ acosh

constexpr ExpressionChainBuilder<expressions::Acosh> vctr::acosh
inlineconstexpr

Computes the inverse hyperbolic cosine of each source element.

◆ angle

constexpr ExpressionChainBuilder<expressions::Angle> vctr::angle
inlineconstexpr

Computes the phase angles of the complex source values.

In case you want to chain more computationally expensive expressions on the complex source values before this expression, consider buffering the complex results to an intermediate complex container for better performance.

◆ asin

constexpr ExpressionChainBuilder<expressions::Asin> vctr::asin
inlineconstexpr

Computes the inverse sine of each source element.

◆ asinh

constexpr ExpressionChainBuilder<expressions::Asinh> vctr::asinh
inlineconstexpr

Computes the inverse hyperbolic sine of each source element.

◆ atan

constexpr ExpressionChainBuilder<expressions::Atan> vctr::atan
inlineconstexpr

Computes the inverse tangent of each source element.

◆ atanh

constexpr ExpressionChainBuilder<expressions::Atanh> vctr::atanh
inlineconstexpr

Computes the inverse hyperbolic tangent of each source element.

◆ clampByConstant

template<auto lowerBound, auto upperBound>
constexpr ExpressionChainBuilder<expressions::ClampByConstant, Constant<lowerBound>, Constant<upperBound> > vctr::clampByConstant
inlineconstexpr

Ensures that the elements are not lower than lowerBound and not higher than upperBound.

Note: At this time, most compilers will refuse to take floating point non-type template values. Passing integer bounds will also work for floating point expressions. In case you need decimal precision, better use clamp which works fine with floating point values.

◆ clampHighByConstant

template<auto upperBound>
constexpr ExpressionChainBuilder<expressions::ClampByConstant, DisabledConstant, Constant<upperBound> > vctr::clampHighByConstant
inlineconstexpr

Ensures that the elements are not higher than upperBound.

Note: At this time, most compilers will refuse to take floating point non-type template values. Passing an integer bound will also work for floating point expressions. In case you need decimal precision, better use clampHigh which works fine with floating point values.

◆ clampLowByConstant

template<auto lowerBound>
constexpr ExpressionChainBuilder<expressions::ClampByConstant, Constant<lowerBound>, DisabledConstant> vctr::clampLowByConstant
inlineconstexpr

Ensures that the elements are not lower than lowerBound.

Note: At this time, most compilers will refuse to take floating point non-type template values. Passing an integer bound will also work for floating point expressions. In case you need decimal precision, better use clampLow which works fine with floating point values.

◆ conjugate

constexpr ExpressionChainBuilder<expressions::Conjugate> vctr::conjugate
inlineconstexpr

Computes the complex conjugate of the source values.

This operation reverses the sign of the imaginary part.

◆ cos

constexpr ExpressionChainBuilder<expressions::Cos> vctr::cos
inlineconstexpr

Computes the cosine of each source element.

◆ cosh

constexpr ExpressionChainBuilder<expressions::Cosh> vctr::cosh
inlineconstexpr

Computes the hyperbolic cosine of each source element.

◆ cube

constexpr ExpressionChainBuilder<expressions::Cube> vctr::cube
inlineconstexpr

Raises the source values to the power of three.

◆ dbToMag

template<is::constant DecibelConstant>
constexpr ExpressionChainBuilderWithRuntimeArgs<expressions::DBToMag, detail::RuntimeArgChain<std::tuple<>, std::tuple<>, std::tuple<> >, DecibelConstant> vctr::dbToMag
inlineconstexpr

Converts the source decibel values into their magnitude representation.

The calculation is pow (10, src * (1 / constant), with constant being either 20 for dBFS or dBVoltage (the typical value when dealing with digital audio amplitudes) or 10 for dBPower.

Template Parameters
DecibelConstantEither vctr::dBFS, vctr::dBVoltage or vctr::dBPower.

◆ dontUseAcceleration

constexpr ExpressionChainBuilder<expressions::NoAccelerationFilter> vctr::dontUseAcceleration
inlineconstexpr

This filter expression ensures that only basic operator[] based evaluation of the previous expression is possible.

◆ exp

constexpr ExpressionChainBuilder<expressions::Exp> vctr::exp
inlineconstexpr

Computes e (Euler's number, 2.7182818...) raised to the source vector elements power.

◆ imag

constexpr ExpressionChainBuilder<expressions::Imag> vctr::imag
inlineconstexpr

Extracts the imaginary parts of the complex source values.

In case you want to chain more computationally expensive expressions on the complex source values before this expression, consider buffering the complex results to an intermediate complex container for better performance.

◆ ln

constexpr ExpressionChainBuilder<expressions::Ln> vctr::ln
inlineconstexpr

Computes the natural logarithm of the source values.

◆ log10

constexpr ExpressionChainBuilder<expressions::Log10> vctr::log10
inlineconstexpr

Computes the logarithm to the base of ten of the source values.

◆ log2

constexpr ExpressionChainBuilder<expressions::Log2> vctr::log2
inlineconstexpr

Computes the logarithm to the base of two of the source values.

◆ magToDb

template<is::constant DecibelConstant, auto minDb = -100>
constexpr ExpressionChainBuilderWithRuntimeArgs<expressions::MagToDb, detail::RuntimeArgChain<std::tuple<>, std::tuple<>, std::tuple<> >, DecibelConstant, Constant<minDb> > vctr::magToDb
inlineconstexpr

Converts the source magnitude into a decibel representation.

The calculation is max (constant * log10 (src), minDb), with constant being either 20 for dBFS or dBVoltage (the typical value when dealing with digital audio amplitudes) or 10 for dBPower.

Template Parameters
DecibelConstantEither vctr::dBFS, vctr::dBVoltage or vctr::dBPower.
minDbThe lower threshold for the resulting dB value and thus the value for a magnitude of 0.

◆ max

constexpr ExpressionChainBuilder<expressions::Max> vctr::max
inlineconstexpr

Computes the maximum value of the source values.

◆ maxAbs

constexpr ExpressionChainBuilder<expressions::MaxAbs> vctr::maxAbs
inlineconstexpr

Computes the maximum value of the absolute value of the source values.

◆ mean

constexpr ExpressionChainBuilder<expressions::Mean> vctr::mean
inlineconstexpr

Computes the mean value of the source values.

◆ meanSquare

constexpr ExpressionChainBuilder<expressions::MeanSquare> vctr::meanSquare
inlineconstexpr

Computes the mean value of the squared source values.

◆ min

constexpr ExpressionChainBuilder<expressions::Min> vctr::min
inlineconstexpr

Computes the minimum value of the source values.

◆ minAbs

constexpr ExpressionChainBuilder<expressions::MinAbs> vctr::minAbs
inlineconstexpr

Computes the minimum value of the absolute value of the source values.

◆ multiplyByConstant

template<auto constantValue>
constexpr ExpressionChainBuilder<expressions::MultiplyVecByConstant, Constant<constantValue> > vctr::multiplyByConstant
inlineconstexpr

Returns an expression that multiplies a vector or expression source with a compile time constant.

◆ normalizeSum

constexpr ExpressionChainBuilder<expressions::NormalizeSum> vctr::normalizeSum
inlineconstexpr

Computes the sum of the source elements and divides all source elements by that sum.

Note: If the source is an expression itself, that source expression will possibly be evaluated twice since we need to evaluate it once to compute the sum and then again to compute the normalized expression result. For performance critical applications, you should consider buffering a source expression to an intermediate container.

Attention
The required sum is computed once when the source is assigned to the expression. In case the source values are changed after that time point, evaluating the expression will use an outdated sum. Therefore, we might consider deprecating and eventually removing this expression in a future release.

◆ powConstantBase

template<auto base>
constexpr ExpressionChainBuilder<expressions::PowConstantBase, Constant<base> > vctr::powConstantBase
inlineconstexpr

Evaluates base raised to the power of the source elements.

◆ powConstantExponent

template<auto exponent>
constexpr ExpressionChainBuilder<expressions::PowConstantExponent, Constant<exponent> > vctr::powConstantExponent
inlineconstexpr

Evaluates the source elements raised to the power of exponent.

◆ powerSpectrum

constexpr ExpressionChainBuilder<expressions::PowerSpectrum> vctr::powerSpectrum
inlineconstexpr

Computes the power spectrum of the complex source values.

The power spectrum is defined as the sum of the square of real and imaginary part like

res[i] = (in_real[i]) ^ 2 + (in_imag[i]) ^ 2

In case you want to chain more computationally expensive expressions on the complex source values before this expression, consider buffering the complex results to an intermediate complex container for better performance.

◆ real

constexpr ExpressionChainBuilder<expressions::Real> vctr::real
inlineconstexpr

Extracts the real parts of the complex source values.

In case you want to chain more computationally expensive expressions on the complex source values before this expression, consider buffering the complex results to an intermediate complex container for better performance.

◆ rms

constexpr ExpressionChainBuilder<expressions::RootMeanSquare> vctr::rms
inlineconstexpr

Computes the square root of the mean value of the squared source values.

◆ sin

constexpr ExpressionChainBuilder<expressions::Sin> vctr::sin
inlineconstexpr

Computes the sine of each source element.

◆ sinh

constexpr ExpressionChainBuilder<expressions::Sinh> vctr::sinh
inlineconstexpr

Computes the hyperbolic sine of each source element.

◆ sqrt

constexpr ExpressionChainBuilder<expressions::Sqrt> vctr::sqrt
inlineconstexpr

Computes the square root of the source values.

◆ square

constexpr ExpressionChainBuilder<expressions::Square> vctr::square
inlineconstexpr

Squares the source values.

◆ sum

constexpr ExpressionChainBuilder<expressions::Sum> vctr::sum
inlineconstexpr

Computes the sum of the source values.

◆ tan

constexpr ExpressionChainBuilder<expressions::Tan> vctr::tan
inlineconstexpr

Computes the tangent of each source element.

◆ tanh

constexpr ExpressionChainBuilder<expressions::Tanh> vctr::tanh
inlineconstexpr

Computes the hyperbolic tangent of each source element.

◆ transformedByStaticCastTo

template<class DstType >
constexpr ExpressionChainBuilder<expressions::TransformedByStaticCast, DstType> vctr::transformedByStaticCastTo
inlineconstexpr

Transforms all source elements to DstValueType by applying a static_cast<DstValueType> to them.

◆ useAVX

constexpr ExpressionChainBuilder<expressions::AVXFilter> vctr::useAVX
inlineconstexpr

This filter expression ensures that only AVX based accelerated evaluation of the previous expression is possible.

If getAVX is not available on the source, this will only forward the basic operator[] based interface.

◆ useNeon

constexpr ExpressionChainBuilder<expressions::NeonFilter> vctr::useNeon
inlineconstexpr

This filter expression ensures that only Neon based accelerated evaluation of the previous expression is possible.

If getNeon is not available on the source, this will only forward the basic operator[] based interface.

◆ usePlatformVectorOps

constexpr ExpressionChainBuilder<expressions::PlatformVectorOpsFilter> vctr::usePlatformVectorOps
inlineconstexpr

Filter expression to force platform vector operation based accelerated evaluation.

This filter expression ensures that only platform vector operation based accelerated evaluation of the previous expression is possible. If evalNextVectorOpInExpressionChain is not available on the source, this will only forward the basic operator[] based interface.

◆ useSSE

constexpr ExpressionChainBuilder<expressions::SSEFilter> vctr::useSSE
inlineconstexpr

This filter expression ensures that only SSE based accelerated evaluation of the previous expression is possible.

If getSSE is not available on the source, this will only forward the basic operator[] based interface.

Function Documentation

◆ clamp()

template<class T >
constexpr auto vctr::clamp ( lowerBound,
upperBound 
)
constexpr

Ensures that the elements are not lower than lowerBound and not higher than upperBound.

This version takes runtime computed values. If compile time fix constants suit your needs, consider clampByConstant.

◆ clampHigh()

template<class T >
constexpr auto vctr::clampHigh ( upperBound)
constexpr

Ensures that the elements are not greater than upperBound.

This version takes a runtime computed value. If a compile time fix constant lower bound suits your needs, consider clampHighByConstant.

◆ clampLow()

template<class T >
constexpr auto vctr::clampLow ( lowerBound)
constexpr

Ensures that the elements are not lower than lowerBound.

This version takes a runtime computed value. If a compile time fix constant lower bound suits your needs, consider clampLowByConstant.

◆ map() [1/2]

template<is::range RangeType>
auto vctr::map ( RangeType &&  srcValueRange,
RangeType &&  dstValueRange 
)

Maps all source element values from srcValueRange to values in dstValueRange.

The expression does not check if the source values are actually in the expected range.

◆ map() [2/2]

template<is::realFloatNumber T>
auto vctr::map ( srcValueRangeStart,
srcValueRangeEnd,
dstValueRangeStart,
dstValueRangeEnd 
)

Maps all source element values from the range srcValueRangeStart to srcValueRangeEnd to values in [dstValueRangeStart, dstValueRangeEnd].

The expression does not check if the source values are actually in the expected range.

◆ mapFrom0To1() [1/2]

template<is::range RangeType>
auto vctr::mapFrom0To1 ( RangeType &&  dstValueRange)

Maps all source element values from the range [0.0 to 1.0] to values in dstValueRange.

The expression does not check if the source values are actually in the expected range.

◆ mapFrom0To1() [2/2]

template<is::realFloatNumber T>
auto vctr::mapFrom0To1 ( dstValueRangeStart,
dstValueRangeEnd 
)

Maps all source element values from the range [0.0 to 1.0] to values in the range from [dstValueRangeStart to dstValueRangeEnd].

The expression does not check if the source values are actually in the expected range.

◆ mapTo0To1() [1/2]

template<is::range RangeType>
auto vctr::mapTo0To1 ( RangeType &&  srcValueRange)

Maps all source element values from srcValueRange to values in the range [0.0 to 1.0].

The expression does not check if the source values are actually in the expected range.

◆ mapTo0To1() [2/2]

template<is::realFloatNumber T>
auto vctr::mapTo0To1 ( srcValueRangeStart,
srcValueRangeEnd 
)

Maps all source element values from teh range [srcValueRangeStart to srcValueRangeEnd] to values in the range [0.0 to 1.0].

The expression does not check if the source values are actually in the expected range.

◆ operator*() [1/3]

template<class Src >
requires is::anyVctrOrExpression<Src>
constexpr auto vctr::operator* ( Src &&  vec,
typename std::remove_cvref_t< Src >::value_type  single 
)
constexpr

Returns an expression that multiplies a vector or expression source with a single value.

◆ operator*() [2/3]

template<class SrcAType , class SrcBType >
requires (is::anyVctrOrExpression<std::remove_cvref_t<SrcAType>> && is::anyVctrOrExpression<std::remove_cvref_t<SrcBType>>)
constexpr auto vctr::operator* ( SrcAType &&  a,
SrcBType &&  b 
)
constexpr

Returns an expression that multiplies vector or expression a with vector or expression b.

◆ operator*() [3/3]

template<class Src >
requires is::anyVctrOrExpression<Src>
constexpr auto vctr::operator* ( typename std::remove_cvref_t< Src >::value_type  single,
Src &&  vec 
)
constexpr

Returns an expression that multiplies a single value with a vector or expression source.

◆ operator+() [1/3]

template<is::anyVctrOrExpression Src>
constexpr auto vctr::operator+ ( Src &&  vec,
typename std::remove_cvref_t< Src >::value_type  single 
)
constexpr

Returns an expression that adds a vector or expression source to a single value.

◆ operator+() [2/3]

template<is::anyVctrOrExpression SrcAType, is::anyVctrOrExpression SrcBType>
constexpr auto vctr::operator+ ( SrcAType &&  a,
SrcBType &&  b 
)
constexpr

Returns an expression that adds two vector or expression sources.

◆ operator+() [3/3]

template<is::anyVctrOrExpression Src>
constexpr auto vctr::operator+ ( typename std::remove_cvref_t< Src >::value_type  single,
Src &&  vec 
)
constexpr

Returns an expression that adds a single value to a vector or expression source.

◆ operator-() [1/3]

template<class Src >
requires is::anyVctrOrExpression<Src>
constexpr auto vctr::operator- ( Src &&  vec,
typename std::remove_cvref_t< Src >::value_type  single 
)
constexpr

Returns an expression that subtracts a single value from a vector or expression.

◆ operator-() [2/3]

template<class SrcAType , class SrcBType >
requires (is::anyVctrOrExpression<std::remove_cvref_t<SrcAType>> && is::anyVctrOrExpression<std::remove_cvref_t<SrcBType>>)
constexpr auto vctr::operator- ( SrcAType &&  a,
SrcBType &&  b 
)
constexpr

Returns an expression that subtracts vector or expression b from vector or expression a.

◆ operator-() [3/3]

template<class Src >
requires is::anyVctrOrExpression<Src>
constexpr auto vctr::operator- ( typename std::remove_cvref_t< Src >::value_type  single,
Src &&  vec 
)
constexpr

Returns an expression that subtracts a vector or expression source from a single value.

◆ operator/() [1/3]

template<class Src >
requires is::anyVctrOrExpression<Src>
constexpr auto vctr::operator/ ( Src &&  vec,
typename std::remove_cvref_t< Src >::value_type  single 
)
constexpr

Returns an expression that divides a vector or expression source by a single value.

◆ operator/() [2/3]

template<class SrcAType , class SrcBType >
requires (is::anyVctrOrExpression<std::remove_cvref_t<SrcAType>> && is::anyVctrOrExpression<std::remove_cvref_t<SrcBType>>)
constexpr auto vctr::operator/ ( SrcAType &&  a,
SrcBType &&  b 
)
constexpr

Returns an expression that divides vector or expression a by vector or expression b.

◆ operator/() [3/3]

template<class Src >
requires is::anyVctrOrExpression<Src>
constexpr auto vctr::operator/ ( typename std::remove_cvref_t< Src >::value_type  single,
Src &&  vec 
)
constexpr

Returns an expression that divides a single value by a vector or expression source.

◆ pow() [1/3]

template<is::anyVctrOrExpression Src>
constexpr auto vctr::pow ( Src &&  bases,
typename std::remove_cvref_t< Src >::value_type  exponent 
)
constexpr

Returns an expression that raises the elements in bases to the power of the exponent value.

In case you want to raise the elements to the power of 2 or 3, better use the square or cube expression.

See also
square
cube

◆ pow() [2/3]

template<is::anyVctrOrExpression SrcBaseType, is::anyVctrOrExpression SrcExpType>
constexpr auto vctr::pow ( SrcBaseType &&  bases,
SrcExpType &&  exponents 
)
constexpr

Returns an expression that raises the elements in bases element-wise to the power of the elements in exponents.

◆ pow() [3/3]

template<is::anyVctrOrExpression Src>
constexpr auto vctr::pow ( typename std::remove_cvref_t< Src >::value_type  base,
Src &&  exponents 
)
constexpr

Returns an expression that raises the base value base to the power of the elements in exponents.

◆ transformedBy()

template<class Fn >
constexpr auto vctr::transformedBy ( Fn &&  fn)
constexpr

Transforms all source elements by applying fn to them.

Fn can either be a function, a std::function or an object with a call operator. It must return a non-void value which will then be assigned to the destination of the expression - so the return type of Fn will become the value type of the expression.

Note: This expression will create a copy of the function object. Depending on the type of Fn, this expression might or might not allocate heap memory. For all trivially copyable types such as simple function pointers or lambdas without any capture, you can expect this expression to not allocate any heap memory. For other types of functions you should expect a copy involving heap memory allocation.

Classes

struct  vctr::dBFS
 Decibel constant dbFS to be passed to dbToMag or magToDb. More...
 
struct  vctr::dBVoltage
 Decibel constant dbVoltage to be passed to dbToMag or magToDb. More...
 
struct  vctr::dBPower
 Decibel constant dbPower to be passed to dbToMag or magToDb. More...