Main Content

Conditions for Code Replacement of MATLAB Functions with QHL

R2026b

Each MATLAB® function that can be used with the Embedded Coder® Support Package for Qualcomm® Hexagon® Processors requires specific conditions to allow code replacement by using the Qualcomm Hexagon library (QHL). You use this code replacement library to generate C/C++ code from a Simulink® model or from MATLAB code.

When you satisfy the specified conditions, the generated C/C++ code uses QHL support to achieve optimized execution on Qualcomm Hexagon processors.

Basic Math Operations

QHL supports these MATLAB math functions for floating-point data type only when you configure the required properties, as specified in this table.

FunctionInput RequirementsProperty RequirementsEquivalent Functions
abs
  • Input must be a scalar, vector, or matrix

  • Real values

Input length must be > 11

  • Vector, and matrix real inputs

    • qhmath_abs_af

sqrt
  • Input must be a scalar, vector, or matrix

  • Real values

-
  • Scalar real inputs

    • qhmath_sqrt_f

  • Vector, and matrix real inputs

    • qhmath_sqrt_af

rsqrt (Fixed-Point Designer)
  • Input must be a scalar, vector, or matrix

  • Real values

-
  • Scalar real inputs

    • qhmath_rsqrt_f

  • Vector, and matrix real inputs

    • qhmath_rsqrt_af

log
  • Input must be a scalar, vector, or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_log_f

  • Vector, and matrix real inputs

    • qhmath_log_af

  • Scalar complex inputs

    • mw_qhcomplex_clog_f

  • Vector and matrix complex inputs

    • mw_qhcomplex_clog_af

log2
  • Input must be a scalar, vector, or matrix

  • Real values

-
  • Scalar real inputs

    • qhmath_log2_f

  • Vector, and matrix real inputs

    • qhmath_log2_af

log10
  • Input must be a scalar, vector, or matrix

  • Real values

-
  • Scalar real inputs

    • qhmath_log10_f

  • Vector, and matrix real inputs

    • qhmath_log10_af

exp
  • Input must be a scalar, vector, or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_cexp_f

  • vector, and matrix real inputs

    • qhmath_cexp_af

  • scalar complex inputs

    • mw_qhcomplex_cexp_f

  • Vector, and Matrix complex inputs

    • mw_qhcomplex_cexp_af

power
  • Input must be a scalar, vector, or matrix

  • Real and complex values

-
  • Scalar, matrix real inputs (base) and vector, matrix real inputs (exponent)

    • mw_qhmath_pow_f

  • Vector real inputs (base) and scalar real inputs (exponent)

    • qhmath_pow_af

  • Scalar, vector, and matrix complex inputs (base and exponent)

    • mw_qhcomplex_cpow_f

ceil
  • Input must be a scalar real value

-
  • Scalar real inputs

    • qhmath_ceil

floor
  • Input must be a scalar real value

-
  • Scalar real inputs

    • qhmath_floor

norm
  • Input must be a vector or matrix

  • Real values

-
  • Vector and matrix real inputs

    • qhblas_f_vector_norm_af

min
  • Input must be a vector or matrix

  • Real values

Input length must be > 22

  • Vector and matrix real inputs

    • mw_qhblas_f_vector_self_min_af

max
  • Input must be a vector or matrix

  • Real values

Input length must be > 22

  • Vector and matrix real inputs

    • mw_qhblas_f_vector_self_max_af

QHL supports these MATLAB math functions for fixed-point Q15 data type only when you configure the required properties, as specified in this table.

FunctionInput RequirementsInput DataTypeProperty RequirementsEquivalent Functions
abs
  • Input must be a vector or matrix

  • Real values

fixdt(1,16,15)

Input length must be > 8

  • Vector and matrix real inputs

    • mw_qhmath_abs_ah

sqrt
  • Input must be a scalar, vector, or matrix

  • Real unsigned values

fixdt(0,16,*)

-
  • Scalar real inputs

    • qhmath_sqrt_h

  • Vector and matrix real inputs

    • qhmath_sqrt_ah

max
  • Input must be a vector or matrix

  • Real values

fixdt(1,16,15)

Input length must be > 22

  • Vector and matrix real inputs

    • mw_qhblas_h_vector_self_max_ah

min
  • Input must be a vector or matrix

  • Real values

fixdt(1,16,15)

Input length must be > 22

  • Vector and matrix real inputs

    • mw_qhblas_h_vector_self_min_ah

Trigonometric Operations

FunctionInput RequirementsProperty RequirementsEquivalent Functions
sin
  • Input must be a scalar, vector or matrix

  • Real or complex Values

-
  • Scalar real inputs

    • qhmath_sin_f

  • Scalar, vector, and matrix real inputs

    • qhmath_sin_af

  • Scalar, vector, and matrix complex inputs

    • mw_qhcomplex_csin_f

cos
  • Input must be a scalar, vector or matrix

  • Real or complex Values

-
  • Scalar real inputs

    • qhmath_cos_f

  • Scalar, vector, and matrix real inputs

    • qhmath_cos_af

  • Scalar, vector, and matrix complex inputs

    • mw_qhcomplex_ccos_f

tan
  • Input must be a scalar, vector, or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_tan_f

  • Vector and matrix real inputs

    • qhmath_tan_af

  • Scalar, vector, and matrix complex inputs

    • mw_qhcomplex_ctan_f

asin
  • Input must be a scalar, vector or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_asin_f

  • Vector, and matrix real inputs

    • qhmath_asin_af

  • Scalar complex inputs

    • mw_qhcomplex_casin_f

  • Vector and matrix complex inputs

    • mw_qhcomplex_casin_af

acos
  • Input must be a scalar, vector or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_acos_f

  • Vector, and matrix real inputs

    • qhmath_acos_af

  • Scalar complex inputs

    • mw_qhcomplex_cacos_f

  • Vector and matrix complex inputs

    • mw_qhcomplex_cacos_af

atan
  • Input must be a scalar, vector or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_atan_f

  • Vector and matrix real inputs

    • qhmath_atan_af

  • Scalar complex inputs

    • mw_qhcomplex_catan_f

  • Vector and matrix complex inputs

    • mw_qhcomplex_catan_af

sinh
  • Input must be a scalar, vector or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_asinh_f

  • Vector and matrix real inputs

    • qhmath_asinh_af

  • Scalar complex inputs

    • mw_qhcomplex_csinh_f

  • Vector and matrix complex inputs

    • mw_qhcomplex_csinh_af

cosh
  • Input must be a scalar, vector or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_acosh_f

  • Vector and matrix real inputs

    • qhmath_acosh_af

  • Scalar complex inputs

    • mw_qhcomplex_ccosh_f

  • Vector and matrix complex inputs

    • mw_qhcomplex_ccosh_af

tanh
  • Input must be a scalar, vector, or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_ctanh_f

  • Vector and matrix real inputs

    • qhmath_ctanh_af

  • Scalar complex inputs

    • mw_qhcomplex_ctanh_f

  • Vector and matrix complex inputs

    • mw_qhcomplex_ccosh_af

hypot
  • Input must be a scalar real value

-
  • Scalar real inputs

    • qhmath_hypot

Fourier Transform Operations

FunctionInput RequirementsOutput RequirementsInput AlignmentOutput AlignmentProperty RequirementsEquivalent Functions
fft

  • Input must be real

  • Supports input sizes that are powers of 2, starting from 16.

  • Output must be complex

88

Note

To enable code replacement, use the syntax fft(x). The code generator replaces only this form with a QHL implementation.

If you specify additional inputs such as n or dim (for example, fft(X,n) or fft(X,n,dim)), the code generator uses the default generated code.

mw_qhdsp_acf_r1dfft_af_opt_builtin
fft

  • Input must be complex

  • Supports input sizes that are powers of 2, starting from 8.

  • Output must be complex

size*88mw_qhdsp_c1dfft_acf_builtin
ifft
  • Input must be complex

  • Supports input sizes that are powers of 2, starting from 16.

  • Output must be complex

size*88

Note

To enable code replacement, use the syntax ifft(x). The code generator replaces only this form with a QHL implementation.

If you specify additional inputs such as n or dim (for example, ifft(X,n) or ifft(X,n,dim)), the code generator uses the default generated code.

mw_qhdsp_c1difft_acf_builtin

See Also

Topics