Main Content

Conditions for Code Replacement of Math Operators with QHL

R2026b

Each math operators 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 when generating C/C++ code from a model or from MATLAB® code.

If you do not meet the specific requirements, then the generated C/C++ code runs on the Qualcomm Hexagon Processors. However, this generated code does not use library support.

The library supports these math operators for floating-point data type input only when you set specific properties, as indicated in this table.

OperatorsFloat Input RequirementsFloat Parameter RequirementsEquivalent Functions
Addition (+)
  • Input can be vector or matrix

  • Real or Complex Values

  • Real Input Length > 1000

    OR

    Complex Input Length >= 500

  • Vector and matrix real inputs

    • qhblas_vector_add_af

  • Vector and matrix complex inputs

    • mw_qhblas_vector_add_acf

Subtraction (-)
  • Input can be vector or matrix

  • Real or Complex Values

  • Real Input Length > 1000

    OR

    Complex Input Length >= 500

  • Vector and matrix real inputs

    • qhblas_vector_sub_af

  • Vector and matrix complex inputs

    • mw_qhblas_vector_sub_acf

Element-wise matrix multiplication
  • Input can be vector or matrix

  • Real or Complex Values

  • Real Input Length > 1000

    OR

    Complex Input Length >= 500

  • Vector and matrix real inputs

    • qhblas_vector_hadamard_af

  • Vector and matrix complex inputs

    • mw_qhblas_vector_hadamard_acf

Multiplication - scaling
  • Input can be vector or matrix

  • Real or Complex Values

  • Real Input Length > 1000

    OR

    Complex Input Length >= 500

  • Vector and matrix real inputs

    • qhblas_vector_add_af

  • Vector and matrix complex inputs

    • mw_qhblas_vector_add_acf

Matrix inverse
  • Real or Complex Values

  • square input

  • Dim = 2, 3 and 4

-
  • Matrix real inputs

    • mw_qhblas_matrix_inverse_af

  • Matrix complex inputs

    • mw_qhblas_matrix_inverse_acf

Conjugate
  • Input can be a vector or matrix

  • Complex values

-
  • Vector and matrix complex inputs

    • mw_qhcomplex_conj_af

Comparators
  • Input can be a vector or matrix

  • Real or Complex values

      • Equal (==)

      • Not Equal (~=)

  • Input can be a vector or matrix

  • Real values

      • Greater than (>)

      • Greater than or equal (>=)

      • Less than (<)

      • Less than or equal (<=)

  • Equal (==)

Real Input Length >= 20 OR Complex Input Length > inf

  • Not Equal (~=)

Real Input Length > = 16 OR Complex Input Length > inf

  • Greater than (>)

  • Greater than or equal (>=)

Real Input Length > 16

  • Less than (<)

  • Less than or equal (<=)

Real Input Length > 16

  • Equal (==) - Real - mw_q6_cmp_eq_af

    Complex - mw_q6_cmp_eq_acf

  • Not Equal (~=) - Real - mw_q6_cmp_neq_af

    Complex - mw_q6_cmp_neq_acf

  • Greater than (>) - mw_q6_cmp_gt_af

  • Greater than or equal (>=) - mw_q6_cmp_ge_af

  • Less than (<) - mw_q6_cmp_lt_af

  • Less than or equal (<=) - mw_q6_cmp_le_af

Dot product
  • Input can be a vector or matrix

  • Real values

  • Real Input Length > =100

  • For vector, and matrix real inputs - qhblas_f_vector_dot_af

  • For vector, and matrix complex inputs - qhblas_cf_vector_dot_acf

The library supports these math operators for fixed-point Q15 data types only when you set specific properties, as indicated in this table.

OperatorsFixed-point Q15 Input RequirementsInput DataTypeFixed-point Q15 Parameter RequirementsEquivalent Functions
Addition (+)
  • Input can be vector or matrix

  • Real or Complex Values

fixdt(1,16,*)

  • Real Input Length ≥ 16

    OR

    Complex Input Length ≥ 8

  • Word length must be 16 bits with adjustable fractional length (0–15 bits)

  • Vector and matrix real inputs

    • mw_qhblas_vector_add_ah

  • Vector and matrix complex inputs

    • mw_qhblas_vector_add_ach

Subtraction (-)
  • Input can be vector or matrix

  • Real or Complex Values

fixdt(1,16,*)

  • Real Input Length ≥ 16

    OR

    Complex Input Length ≥ 8

  • Word length must be 16 bits with adjustable fractional length (0–15 bits)

  • Vector and matrix real inputs

    • mw_qhblas_vector_sub_ah

  • Vector and matrix complex inputs

    • mw_qhblas_vector_sub_ach

Element-wise matrix multiplication
  • Input can be vector or matrix

  • Real Value

fixdt(1,16,*)

  • Real Input Length ≥ 8

  • Word length must be 16 bits with adjustable fractional length (0–15 bits)

  • Vector and matrix real inputs

    • mw_qhblas_vector_hadamard_ah

Multiplication - scaling
  • Input can be vector or matrix

  • Real or Complex Values

fixdt(1,16,*)

  • Real Input Length ≥ 8

    OR

    Complex Input Length ≥ 1

  • Vector and matrix real inputs

    • mw_qhblas_vector_scaling_ah

  • Vector and matrix complex inputs

    • mw_qhblas_vector_add_ach

The library supports these integer operations for fixed-point Q15 data types only when you set specific properties, as indicated in this table.

OperatorsFixed-point Q15 Input RequirementsInput DataTypeFixed-point Q15 Parameter RequirementsEquivalent Functions
Shift
  • Shift value via input port. Input can be a vector or matrix (int32 or uint32)

  • Real value

    • Shift left (<<)

    • Shift right arithmetic (>>)

  • Shift value via dialog. Input can be a vector or matrix (int32 or uint32)

  • Real value

    • Shift left (<<)

    • Shift right arithmetic (>>)

    • Shift right logical (.>>)

  • int32

  • uint32

  • Real Input Length > 26

  • Shift left (<<) - mw_q6_asl_aw/mw_q6_lsl_aw

  • Shift right arithmetic (>>) - mw_q6_asr_aw

  • Shift right logical (.>>) - mw_q6_lsr_aw

See Also

| | | | |

Topics