An overview of all expression chain builders.
More...
An overview of all expression chain builders.
Expression chain builders are used to build of chains of vector expressions using the << operator. Example:
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.
◆ abs
Computes the absolute value of the source values.
Complex source values are transformed into real values. Unsigned integers remain unaltered.
◆ acos
Computes the inverse cosine of each source element.
◆ acosh
Computes the inverse hyperbolic cosine of each source element.
◆ angle
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
Computes the inverse sine of each source element.
◆ asinh
Computes the inverse hyperbolic sine of each source element.
◆ atan
Computes the inverse tangent of each source element.
◆ atanh
Computes the inverse hyperbolic tangent of each source element.
◆ clampByConstant
template<auto lowerBound, auto upperBound>
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>
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>
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
Computes the complex conjugate of the source values.
This operation reverses the sign of the imaginary part.
◆ cos
Computes the cosine of each source element.
◆ cosh
Computes the hyperbolic cosine of each source element.
◆ cube
Raises the source values to the power of three.
◆ dbToMag
template<is::constant DecibelConstant>
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
-
◆ dontUseAcceleration
This filter expression ensures that only basic operator[] based evaluation of the previous expression is possible.
◆ exp
Computes e (Euler's number, 2.7182818...) raised to the source vector elements power.
◆ imag
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
Computes the natural logarithm of the source values.
◆ log10
Computes the logarithm to the base of ten of the source values.
◆ log2
Computes the logarithm to the base of two of the source values.
◆ magToDb
template<is::constant DecibelConstant, auto minDb = -100>
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
-
◆ max
Computes the maximum value of the source values.
◆ maxAbs
Computes the maximum value of the absolute value of the source values.
◆ mean
Computes the mean value of the source values.
◆ meanSquare
Computes the mean value of the squared source values.
◆ min
Computes the minimum value of the source values.
◆ minAbs
Computes the minimum value of the absolute value of the source values.
◆ multiplyByConstant
template<auto constantValue>
Returns an expression that multiplies a vector or expression source with a compile time constant.
◆ normalizeSum
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
Evaluates base raised to the power of the source elements.
◆ powConstantExponent
Evaluates the source elements raised to the power of exponent.
◆ powerSpectrum
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
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
Computes the square root of the mean value of the squared source values.
◆ sin
Computes the sine of each source element.
◆ sinh
Computes the hyperbolic sine of each source element.
◆ sqrt
Computes the square root of the source values.
◆ square
Squares the source values.
◆ sum
Computes the sum of the source values.
◆ tan
Computes the tangent of each source element.
◆ tanh
Computes the hyperbolic tangent of each source element.
◆ transformedByStaticCastTo
Transforms all source elements to DstValueType by applying a static_cast<DstValueType> to them.
◆ useAVX
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
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
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
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.
◆ clamp()
template<class T >
constexpr auto vctr::clamp |
( |
T |
lowerBound, |
|
|
T |
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 |
( |
T |
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 |
( |
T |
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 |
( |
T |
srcValueRangeStart, |
|
|
T |
srcValueRangeEnd, |
|
|
T |
dstValueRangeStart, |
|
|
T |
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 |
( |
T |
dstValueRangeStart, |
|
|
T |
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 |
( |
T |
srcValueRangeStart, |
|
|
T |
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.