AI Engine API User Guide (AIE-API) 2024.1
Loading...
Searching...
No Matches
Elementary Functions

Overview

Modules

 Floating-point Scalar Operations
 

Functions

template<ComplexElem E>
constexpr auto aie::abs_square (const E &v) -> detail::utils::get_complex_component_type_t< operand_base_type_t< E > >
 Compute the absolute square of a scalar complex value.
 
template<RealVector Vec>
requires (arch::is(arch::AIE))
auto aie::cos (const Vec &v) -> aie_dm_resource_remove_t< Vec >
 Performs a cosine operation on all elements in the input vector.
 
template<typename E >
requires (arch::is(arch::AIE) && (RealElem<E> || std::is_integral_v<E>))
auto aie::cos (E a)
 Performs a cosine operation on a single value.
 
template<unsigned Elems>
requires (arch::is(arch::AIE))
accum< accfloat, Elems > aie::inv (const accum< accfloat, Elems > &v)
 
template<Vector Vec>
auto aie::inv (const Vec &v) -> aie_dm_resource_remove_t< Vec >
 
template<RealElem E>
auto aie::inv (E a)
 
template<unsigned Elems>
requires (arch::is(arch::AIE))
accum< accfloat, Elems > aie::invsqrt (const accum< accfloat, Elems > &v)
 
template<Vector Vec>
auto aie::invsqrt (const Vec &v) -> aie_dm_resource_remove_t< Vec >
 
template<Elem E>
auto aie::invsqrt (E a)
 
template<RealVector Vec>
requires (arch::is(arch::AIE))
auto aie::sin (const Vec &v) -> aie_dm_resource_remove_t< Vec >
 Performs a sine operation on all elements in the input vector.
 
template<typename E >
requires (arch::is(arch::AIE) && (RealElem<E> || std::is_integral_v<E>))
auto aie::sin (E a)
 Performs a sine operation on a single value.
 
template<RealVector Vec>
requires (arch::is(arch::AIE))
auto aie::sincos (const Vec &v) -> std::pair< aie_dm_resource_remove_t< Vec >, aie_dm_resource_remove_t< Vec > >
 Same as sin and cos, but performs both operations and returns a std::pair of vectors of result values.
 
template<typename E >
requires (arch::is(arch::AIE) && (RealElem<E> || std::is_integral_v<E>))
auto aie::sincos (E a)
 Performs both sin and cos, and returns both values as an std::pair (sin first, then cos).
 
template<RealVector Vec>
requires (arch::is(arch::AIE))
auto aie::sincos_complex (const Vec &v) -> vector< std::conditional_t< Vec::is_floating_point(), cfloat, cint16 >, Vec::size()>
 Same as sincos, but returns both values as the real and imaginary parts in a vector of complex values (cos in the real part, sin in the imaginary).
 
template<typename E >
requires (arch::is(arch::AIE) && (RealElem<E> || std::is_integral_v<E>))
auto aie::sincos_complex (E a) -> std::conditional_t< detail::is_floating_point_v< operand_base_type_t< E > >, cfloat, cint16 >
 Same as sincos, but returns both values as the real and imaginary parts of a complex number (cos in the real part, sin in the imaginary part).
 
template<unsigned Elems>
requires (arch::is(arch::AIE))
accum< accfloat, Elems > aie::sqrt (const accum< accfloat, Elems > &v)
 
template<Vector Vec>
auto aie::sqrt (const Vec &v) -> aie_dm_resource_remove_t< Vec >
 
template<Elem E>
auto aie::sqrt (E a)
 

Function Documentation

◆ abs_square()

template<ComplexElem E>
constexpr auto aie::abs_square ( const E &  v) -> detail::utils::get_complex_component_type_t<operand_base_type_t<E>>
constexpr

Compute the absolute square of a scalar complex value.

out = v.realĀ² + v.imagĀ²;
Parameters
vInput complex scalar

◆ cos() [1/2]

template<RealVector Vec>
requires (arch::is(arch::AIE))
auto aie::cos ( const Vec &  v) -> aie_dm_resource_remove_t<Vec>

Performs a cosine operation on all elements in the input vector.

The input vector can either be of float values in radians or integers. The floating-point range is [-Pi, Pi]. Integer values are handled as a fixed-point input value in Q1.31 format scaled with 1/Pi (input value 2^31 corresponds to Pi). In this case only the upper 20-bit of the input value are used.

According to input type, returns a vector of float or of signed Q.15 fixed-point format.

Parameters
vInput vector. The type must meet aie::RealVector.

◆ cos() [2/2]

template<typename E >
requires (arch::is(arch::AIE) && (RealElem<E> || std::is_integral_v<E>))
auto aie::cos ( a)

Performs a cosine operation on a single value.

The input can either be a float value in radians or an integer. The floating-point range is [-Pi, Pi]. Integer values are handled as a fixed-point input value in Q1.31 format scaled with 1/Pi (input value 2^31 corresponds to Pi). In this case only the upper 20-bit of the input value are used.

According to input type, the returned value is either a float or a signed Q.15 fixed-point format.

Parameters
aValue. The type must meet aie::RealElem.

◆ inv() [1/3]

template<unsigned Elems>
requires (arch::is(arch::AIE))
accum< accfloat, Elems > aie::inv ( const accum< accfloat, Elems > &  v)

◆ inv() [2/3]

template<Vector Vec>
auto aie::inv ( const Vec &  v) -> aie_dm_resource_remove_t<Vec>

◆ inv() [3/3]

template<RealElem E>
auto aie::inv ( a)

◆ invsqrt() [1/3]

template<unsigned Elems>
requires (arch::is(arch::AIE))
accum< accfloat, Elems > aie::invsqrt ( const accum< accfloat, Elems > &  v)

◆ invsqrt() [2/3]

template<Vector Vec>
auto aie::invsqrt ( const Vec &  v) -> aie_dm_resource_remove_t<Vec>

◆ invsqrt() [3/3]

template<Elem E>
auto aie::invsqrt ( a)

◆ sin() [1/2]

template<RealVector Vec>
requires (arch::is(arch::AIE))
auto aie::sin ( const Vec &  v) -> aie_dm_resource_remove_t<Vec>

Performs a sine operation on all elements in the input vector.

The input vector can either be of float values in radians or integers. The floating-point range is [-Pi, Pi]. Integer values are handled as a fixed-point input value in Q1.31 format scaled with 1/Pi (input value 2^31 corresponds to Pi). In this case only the upper 20-bit of the input value are used.

According to input type, returns a vector of float or of signed Q.15 fixed-point format.

Parameters
vInput vector. The type must meet aie::RealVector.

◆ sin() [2/2]

template<typename E >
requires (arch::is(arch::AIE) && (RealElem<E> || std::is_integral_v<E>))
auto aie::sin ( a)

Performs a sine operation on a single value.

The input can either be a float value in radians or an integer. The floating-point range is [-Pi, Pi]. Integer values are handled as a fixed-point input value in Q1.31 format scaled with 1/Pi (input value 2^31 corresponds to Pi). In this case only the upper 20-bit of the input value are used.

Parameters
aValue. The type must meet aie::RealElem.

◆ sincos() [1/2]

template<RealVector Vec>
requires (arch::is(arch::AIE))
auto aie::sincos ( const Vec &  v) -> std::pair<aie_dm_resource_remove_t<Vec>, aie_dm_resource_remove_t<Vec>>

Same as sin and cos, but performs both operations and returns a std::pair of vectors of result values.

The first vector contains the sine values, the second contains the cosine values

According to input type, returns a pair of vectors of float or of signed Q.15 fixed-point format.

Parameters
vInput vector. The type must meet aie::RealVector.

◆ sincos() [2/2]

template<typename E >
requires (arch::is(arch::AIE) && (RealElem<E> || std::is_integral_v<E>))
auto aie::sincos ( a)

Performs both sin and cos, and returns both values as an std::pair (sin first, then cos).

The input can either be a float value in radians or an integer. The floating-point range is [-Pi, Pi]. Integer values are handled as a fixed-point input value in Q1.31 format scaled with 1/Pi (input value 2^31 corresponds to Pi). In this case only the upper 20-bit of the input value are used.

According to input type, the returned values are either float or signed Q.15 fixed-point format.

Parameters
aValue. The type must meet aie::RealElem.

◆ sincos_complex() [1/2]

template<RealVector Vec>
requires (arch::is(arch::AIE))
auto aie::sincos_complex ( const Vec &  v) -> vector<std::conditional_t<Vec::is_floating_point(), cfloat, cint16>, Vec::size()>

Same as sincos, but returns both values as the real and imaginary parts in a vector of complex values (cos in the real part, sin in the imaginary).

According to input type, returns a vector of float or of signed Q.15 fixed-point format.

Parameters
vInput vector. The type must meet aie::RealVector.

◆ sincos_complex() [2/2]

template<typename E >
requires (arch::is(arch::AIE) && (RealElem<E> || std::is_integral_v<E>))
auto aie::sincos_complex ( a) -> std::conditional_t<detail::is_floating_point_v<operand_base_type_t<E>>, cfloat, cint16>

Same as sincos, but returns both values as the real and imaginary parts of a complex number (cos in the real part, sin in the imaginary part).

Each part of the returned complex number is either a float or a signed Q.15 fixed-point format.

Parameters
aValue. The type must meet aie::RealElem.

◆ sqrt() [1/3]

template<unsigned Elems>
requires (arch::is(arch::AIE))
accum< accfloat, Elems > aie::sqrt ( const accum< accfloat, Elems > &  v)

◆ sqrt() [2/3]

template<Vector Vec>
auto aie::sqrt ( const Vec &  v) -> aie_dm_resource_remove_t<Vec>

◆ sqrt() [3/3]

template<Elem E>
auto aie::sqrt ( a)