as_complex_float

as_complex_float#

Cast an operator to cuda::std::complex<float>

template<typename T>
auto __MATX_INLINE__ matx::as_complex_float(const T &t)#

Helper function to cast an input operator to a cuda::std::complex<float>

Template Parameters:

T – Input type

Parameters:

t – Input operator

Returns:

Operator output casted to cuda::std::complex<float>

template<typename T1, typename T2>
auto __MATX_INLINE__ matx::as_complex_float(const T1 &t1, const T2 &t2)#

Helper function to cast an input operator to a cuda::std::complex<float>

Template Parameters:
  • T1 – Input type for real components of the complex output type

  • T2 – Input type for imaginary components of the complex output type

Parameters:
  • t1 – Input operator for real components of the complex output type

  • t2 – Input operator for imaginary components of the complex output type

Returns:

Operator output casted to cuda::std::complex<float>

Examples#

auto c32 = make_tensor<cuda::std::complex<float>>({});
auto s64 = make_tensor<double>({});
s64.SetVals({5.0});
(c32 = as_complex_float(s64)).run();
// c32() will be (5.0f, 0.0f)
auto c32 = make_tensor<cuda::std::complex<float>>({});
auto in_real = make_tensor<TestType>({});
auto in_imag = make_tensor<TestType>({});
in_real.SetVals({3});
in_imag.SetVals({5});
(c32 = as_complex_float(in_real, in_imag)).run(exec);
// c32() will be (3.0f, 5.0f)