Main Content

Conditions for Code Replacement of Math Operators with QHL

Each math operator 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.

Float Data Type

The library supports these math operators for Float data type input only when you set specific properties, as indicated in this table:

OperatorsFloat Input RequirementsFloat Parameter RequirementsEquivalent Functions
Addition (+)
  • 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 (-)
  • 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
  • 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
  • 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 matrix input

  • Dimension = 2, 3 and 4

 
  • Matrix real inputs

    • mw_qhblas_matrix_inverse_af

  • Matrix complex inputs

    • mw_qhblas_matrix_inverse_acf

Comparators
  • Vector or matrix

  • Real or Complex values

      • Equal (==)

      • Not Equal (~=)

  • 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

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 (.>>)

  • 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

Dot Product
  • 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

Fixed-point Q15 Data Types

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 RequirementsFixed-point Q15 Parameter RequirementsEquivalent Functions
Addition (+)
  • Vector or matrix

  • Real or Complex values

  • Real Input Length ≥ 16

    OR

    Complex Input Length ≥ 8

  • Vector and matrix real inputs

    • mw_qhblas_vector_add_ah

  • Vector and matrix complex inputs

    • mw_qhblas_vector_add_ach

Subtraction (-)
  • Vector or matrix

  • Real or Complex Values

  • Real Input Length ≥ 16

    OR

    Complex Input Length ≥ 8

  • Vector and matrix real inputs

    • mw_qhblas_vector_sub_ah

  • Vector and matrix complex inputs

    • mw_qhblas_vector_sub_ach

Element-wise matrix multiplication
  • Vector or matrix

  • Real values

  • Real Input Length ≥ 8

  • Vector and matrix real inputs

    • mw_qhblas_vector_hadamard_ah

Multiplication - Scaling
  • Vector or matrix

  • Real or Complex values

  • Real Input Length ≥ 8

    OR

    Complex Input Length ≥ 1

  • Vector and matrix real inputs

    • mw_qhblas_vector_scaling_ach

  • Vector and matrix complex inputs

    • mw_qhblas_vector_add_acf

Matrix inverse
  • Real or Complex values

  • Square matrix input

  • Dimension = 2, 3 and 4

 
  • Matrix real inputs

    • mw_qhblas_matrix_inverse_af

  • Matrix complex inputs

    • mw_qhblas_matrix_inverse_acf

Comparators
  • Vector or matrix

  • Real or Complex values

      • Equal (==)

      • Not Equal (~=)

  • 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

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 (.>>)

  • 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

Dot Product
  • Vector or matrix

  • Real and complex 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

See Also

| | | | |

Topics