Functions that implement math functions. Take care that some of the implementations will return results with less precision than what the FPU calculates.
Functions | |
| Vc::Vector< T > | sqrt (const Vc::Vector< T > &v) |
Returns the square root of v. | |
| Vc::Vector< T > | rsqrt (const Vc::Vector< T > &v) |
Returns the reciprocal square root of v. | |
| Vc::Vector< T > | reciprocal (const Vc::Vector< T > &v) |
Returns the reciprocal of v. | |
| Vc::Vector< T > | abs (const Vc::Vector< T > &v) |
Returns the absolute value of v. | |
| Vc::Vector< T > | round (const Vc::Vector< T > &v) |
Returns the closest integer to v; 0.5 is rounded to even. | |
| Vc::Vector< T > | log (const Vc::Vector< T > &v) |
| Vc::Vector< T > | log2 (const Vc::Vector< T > &v) |
| Vc::Vector< T > | log10 (const Vc::Vector< T > &v) |
| Vc::Vector< T > | exp (const Vc::Vector< T > &v) |
| Vc::Vector< T > | min (const Vc::Vector< T > &x, const Vc::Vector< T > &y) |
| Vc::Vector< T > | max (const Vc::Vector< T > &x, const Vc::Vector< T > &y) |
| Vc::Vector< T > | frexp (const Vc::Vector< T > &x, Vc::SimdArray< int, size()> *e) |
| Convert floating-point number to fractional and integral components. More... | |
| Vc::Vector< T > | ldexp (Vc::Vector< T > x, Vc::SimdArray< int, size()> e) |
| Multiply floating-point number by integral power of 2. More... | |
| Vc::Mask< T > | isfinite (const Vc::Vector< T > &x) |
| Vc::Mask< T > | isnan (const Vc::Vector< T > &x) |
| Vc::Vector< T > | fma (Vc::Vector< T > a, Vc::Vector< T > b, Vc::Vector< T > c) |
Multiplies a with b and then adds c, without rounding between the multiplication and the addition. More... | |
| template<typename T , typename Abi > | |
| Vector< T, detail::not_fixed_size_abi< Abi > > | sin (const Vector< T, Abi > &x) |
Returns the sine of all input values in x. More... | |
| template<typename T , typename Abi > | |
| Vector< T, detail::not_fixed_size_abi< Abi > > | cos (const Vector< T, Abi > &x) |
Returns the cosine of all input values in x. More... | |
| template<typename T , typename Abi > | |
| Vector< T, detail::not_fixed_size_abi< Abi > > | asin (const Vector< T, Abi > &x) |
Returns the arcsine of all input values in x. More... | |
| template<typename T , typename Abi > | |
| Vector< T, detail::not_fixed_size_abi< Abi > > | atan (const Vector< T, Abi > &x) |
Returns the arctangent of all input values in x. More... | |
| template<typename T , typename Abi > | |
| Vector< T, detail::not_fixed_size_abi< Abi > > | atan2 (const Vector< T, Abi > &y, const Vector< T, Abi > &x) |
Returns the arctangent of all input values in x and y. More... | |
| template<typename T , typename Abi > | |
| void | sincos (const Vector< T, Abi > &x, Vector< T, detail::not_fixed_size_abi< Abi >> *sin, Vector< T, Abi > *cos) |
| template<typename T , typename Abi , typename = enable_if<std::is_floating_point<T>::value && !detail::is_fixed_size_abi<Abi>::value>> | |
| Vector< T, Abi > | copysign (Vector< T, Abi > magnitude, Vector< T, Abi > sign) |
Copies the sign(s) of sign to the value(s) in magnitude and returns the resulting vector. More... | |
| template<typename T , typename Abi , typename = enable_if<std::is_floating_point<T>::value && !detail::is_fixed_size_abi<Abi>::value>> | |
| Vector< T, Abi > | exponent (Vector< T, Abi > x) |
| Extracts the exponent of each floating-point vector component. More... | |
| template<typename T , typename Abi > | |
| Vector< T, detail::not_fixed_size_abi< Abi > >::MaskType | isnegative (Vector< T, Abi > x) |
| Returns for each vector component whether it stores a negative value. More... | |
| Vc::Vector<T> Vc::log | ( | const Vc::Vector< T > & | v | ) |
| v | The values to apply the logarithm on. |
v.| Vc::Vector<T> Vc::log2 | ( | const Vc::Vector< T > & | v | ) |
| v | The values to apply the logarithm on. |
v.| Vc::Vector<T> Vc::log10 | ( | const Vc::Vector< T > & | v | ) |
| v | The values to apply the logarithm on. |
v.| Vc::Vector<T> Vc::exp | ( | const Vc::Vector< T > & | v | ) |
| v | The values to apply the exponential function on. |
v. | Vc::Vector<T> Vc::min | ( | const Vc::Vector< T > & | x, |
| const Vc::Vector< T > & | y | ||
| ) |
| x | \(\mathcal{W}_\mathtt{T}\) values to compare component-wise against y. |
| y | \(\mathcal{W}_\mathtt{T}\) values to compare component-wise against x. |
x and y. Referenced by SimdArray< T, N >::sorted().
| Vc::Vector<T> Vc::max | ( | const Vc::Vector< T > & | x, |
| const Vc::Vector< T > & | y | ||
| ) |
| x | \(\mathcal{W}_\mathtt{T}\) values to compare component-wise against y. |
| y | \(\mathcal{W}_\mathtt{T}\) values to compare component-wise against x. |
x and y. Referenced by SimdArray< T, N >::sorted().
| Vc::Vector<T> Vc::frexp | ( | const Vc::Vector< T > & | x, |
| Vc::SimdArray< int, size()> * | e | ||
| ) |
Convert floating-point number to fractional and integral components.
| x | value to be split into normalized fraction and exponent |
| e | the exponent to base 2 of x |
x is non-zero, the return value is x times a power of two, and its absolute value is always in the range [0.5,1).x is zero, then the normalized fraction is zero and zero is stored in e.x is a NaN, a NaN is returned, and the value of *e is unspecified.x is positive infinity (negative infinity), positive infinity (nega‐ tive infinity) is returned, and the value of *e is unspecified. | Vc::Vector<T> Vc::ldexp | ( | Vc::Vector< T > | x, |
| Vc::SimdArray< int, size()> | e | ||
| ) |
Multiply floating-point number by integral power of 2.
| x | value to be multiplied by 2 ^ e |
| e | exponent |
x * 2 ^ e | Vc::Mask<T> Vc::isfinite | ( | const Vc::Vector< T > & | x | ) |
| x | The \(\mathcal{W}_\mathtt{T}\) values to check for finite values. |
| Vc::Mask<T> Vc::isnan | ( | const Vc::Vector< T > & | x | ) |
| x | The \(\mathcal{W}_\mathtt{T}\) values to check for NaN values. |
| Vc::Vector<T> Vc::fma | ( | Vc::Vector< T > | a, |
| Vc::Vector< T > | b, | ||
| Vc::Vector< T > | c | ||
| ) |
Multiplies a with b and then adds c, without rounding between the multiplication and the addition.
| a | First multiplication factor. |
| b | Second multiplication factor. |
| c | Summand that will be added after multiplication. |
a * b + c with higher precision due to no rounding between multiplication and addition.Returns the sine of all input values in x.
| x | The values to apply the sine function on. |
x.Abi (e.g. Scalar uses the <cmath> implementationVc_HAVE_LIBMVEC is defined<cmath> fallback, the implementations differ (e.g. MacOS vs. Linux vs. Windows; fpmath=sse vs. fpmath=387)Definition at line 134 of file trigonometric.h.
Referenced by Vc::sincos().
Returns the cosine of all input values in x.
| x | The values to apply the cosine function on. |
x.Definition at line 151 of file trigonometric.h.
Returns the arcsine of all input values in x.
| x | The values to apply the arcsine function on. |
x.Definition at line 168 of file trigonometric.h.
Returns the arctangent of all input values in x.
| x | The values to apply the arctangent function on. |
x. Definition at line 183 of file trigonometric.h.
|
inline |
Returns the arctangent of all input values in x and y.
Calculates the angle given the lengths of the opposite and adjacent legs in a right triangle.
| y | The opposite leg. |
| x | The adjacent leg. |
y / x. Definition at line 199 of file trigonometric.h.
|
inline |
| x | Input value to both sine and cosine. |
| sin | A non-null pointer to a potentially uninitialized object of type Vector. When sincos returns, *sin contains the result of sin(x). |
| cos | A non-null pointer to a potentially uninitialized object of type Vector. When sincos returns, *cos contains the result of cos(x). |
Definition at line 217 of file trigonometric.h.
Copies the sign(s) of sign to the value(s) in magnitude and returns the resulting vector.
| magnitude | This vector's magnitude will be used in the return vector. |
| sign | This vector's sign bit will be used in the return vector. |
sign. I.e. sign(copysign(v, r)) == sign(r). Referenced by Vector< T, Abi >::scatter().
Extracts the exponent of each floating-point vector component.
| x | The vector of values to check for the sign. |
This function provides efficient access to the exponent of the floating point number. The returned value is a fast approximation to the logarithm of base 2. The absolute error of that approximation is between [0, 1[.
Examples:
value | exponent | log2 =======|==========|======= 1.0 | 0 | 0 2.0 | 1 | 1 3.0 | 1 | 1.585 3.9 | 1 | 1.963 4.0 | 2 | 2 4.1 | 2 | 2.036
You may use abs to apply this function to negative values: