AI Engine API User Guide (AIE) 2022.2
Elementary Functions

Overview

Modules

 Floating-point Scalar Operations
 

Functions

template<RealVector Vec>
auto aie::cos (const Vec &v) -> aie_dm_resource_remove_t< Vec >
  More...
 
template<typename E >
auto aie::cos (E a)
  More...
 
template<unsigned Elems>
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<Elem E>
auto aie::inv (E a)
 
template<unsigned Elems>
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>
auto aie::sin (const Vec &v) -> aie_dm_resource_remove_t< Vec >
  More...
 
template<typename E >
auto aie::sin (E a)
  More...
 
template<RealVector Vec>
auto aie::sincos (const Vec &v) -> std::pair< aie_dm_resource_remove_t< Vec >, aie_dm_resource_remove_t< Vec >>
  More...
 
template<typename E >
auto aie::sincos (E a)
  More...
 
template<RealVector Vec>
auto aie::sincos_complex (const Vec &v) -> vector< std::conditional_t< Vec::is_floating_point(), cfloat, cint16 >, Vec::size()>
  More...
 
template<typename E >
auto aie::sincos_complex (E a) -> std::conditional_t< detail::is_floating_point_v< operand_base_type_t< E >>, cfloat, cint16 >
  More...
 
template<unsigned Elems>
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

◆ cos() [1/2]

template<RealVector Vec>
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 RealVector.

◆ cos() [2/2]

template<typename 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 RealElem.

◆ sin() [1/2]

template<RealVector Vec>
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 RealVector.

◆ sin() [2/2]

template<typename 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 RealElem.

◆ sincos() [1/2]

template<RealVector Vec>
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 RealVector.

◆ sincos() [2/2]

template<typename 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 RealElem.

◆ sincos_complex() [1/2]

template<RealVector Vec>
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 RealVector.

◆ sincos_complex() [2/2]

template<typename 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 RealElem.