# Hungarian

- enum FadasHungarianMethod\_e

    - Defines the optimization method in the Hungarian algorithm.

*Values:*

- enumerator FADAS\_HUNGARIAN\_METHOD\_MIN\_COST

    - Minimization of cost method.

- enumerator FADAS\_HUNGARIAN\_METHOD\_MAX\_SCORE

    - Maximization of score method.

- enum FadasHungarianCostType\_e

    - Defines the type of cost matrix in the Hungarian algorithm.

*Values:*

- enumerator FADAS\_HUNGARIAN\_COST\_TYPE\_U64

    - The cost matrix is of type uint64\_t.

- enumerator FADAS\_HUNGARIAN\_COST\_TYPE\_F32

    - The cost matrix is of type float32\_t.

- enumerator FADAS\_HUNGARIAN\_COST\_TYPE\_F64

    - The cost matrix is of type float64\_t.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasHungarian\_Init(const char \*licenseKey)

    - Initialize the Hungarian solver module. **WARNING:** Must be called once before other FastADAS functions except [FadasVersion()](https://docs.qualcomm.com/doc/80-63309-1/topic/misc.html#group__misc_1ga55cbdff48d751f2a0227ae4ac106d746).

- Parameters:

    - **licenseKey** – Pointer to the license key string.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasHungarian\_DeInit(void)

    - Deinitialize the Hungarian module. **WARNING:** Must be called once after all other FastADAS functions except [FadasVersion()](https://docs.qualcomm.com/doc/80-63309-1/topic/misc.html#group__misc_1ga55cbdff48d751f2a0227ae4ac106d746).

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasHungarian\_Create(uint64\_t numRows, uint64\_t numCols, [FadasHungarianCostType\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_group__hungarian_1gaf04fbb3bf446352e54ecbe639cfdaea0.html#_CPPv424FadasHungarianCostType_e) eCostType, void \*\*phHungarian)

    - Create the Hungarian algorithm vector.

- Parameters:

    - - **numRows** – Number of rows in cost matrix.
- **numCols** – Number of columns in cost matrix.
- **eCostType** – Type of the cost matrix.
- **hungarianHandle** – Handle to the Hungarian algorithm object.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasHungarian\_Destroy(void \*hHungarian)

    - Function to release Hungarian algorithm resources.

- Parameters:

    - **hungarianHandle** – Handle to the Hungarian algorithm object.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasHungarian\_Run(void \*hHungarian, [FadasMatrix\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrix__t.html#_CPPv413FadasMatrix_t) \*costMatrix, [FadasHungarianMethod\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_group__hungarian_1ga8c096bae8da976e650e55d152fc571c9.html#_CPPv422FadasHungarianMethod_e) optMethod, uint64\_t \*\_\_restrict assignVector)

    - Solves the assignment problem by minimizing the cost of assignment. This function will not work properly if the cost matrix is not in proper format.

- Parameters:

    - - **hungarianHandle** – Handle to the Hungarian algorithm object.
- **costMatrix** – Pointer to the input matrix object to solve the assignment problem.
- **optMethod** – Type of optimization problem.
- **assignVector** – Pointer to the output row vector object.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasHungarian\_Runu64(void \*hHungarian, [FadasMatrixu64\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrixu64__t.html#_CPPv416FadasMatrixu64_t) \*costMatrix, [FadasHungarianMethod\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_group__hungarian_1ga8c096bae8da976e650e55d152fc571c9.html#_CPPv422FadasHungarianMethod_e) optMethod, uint64\_t \*\_\_restrict assignVector)

    - Solves the assignment problem by minimizing the cost of assignment. This function will not work properly if the cost matrix is not in proper format.

- Parameters:

    - - **hungarianHandle** – Handle to the Hungarian algorithm object.
- **costMatrix** – Pointer to the input matrix object to solve the assignment problem.
- **optMethod** – Type of optimization problem.
- **assignVector** – Pointer to the output row vector object.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasHungarian\_Runf64(void \*hHungarian, [FadasMatrixf64v2\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrixf64v2__t.html#_CPPv418FadasMatrixf64v2_t) \*costMatrix, [FadasHungarianMethod\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_group__hungarian_1ga8c096bae8da976e650e55d152fc571c9.html#_CPPv422FadasHungarianMethod_e) optMethod, uint64\_t \*\_\_restrict assignVector)

    - Solves the assignment problem by minimizing the cost of assignment. This function will not work properly if the cost matrix is not in proper format.

- Parameters:

    - - **hungarianHandle** – Handle to the Hungarian algorithm object.
- **costMatrix** – Pointer to the input matrix object to solve the assignment problem.
- **optMethod** – Type of optimization problem.
- **assignVector** – Pointer to the output row vector object.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

Last Published: Sep 30, 2024

[Previous Topic
Histogram Of Gradients](https://docs.qualcomm.com/bundle/publicresource/80-63309-1/topics/histogram-of-gradients.md) [Next Topic
Matrix](https://docs.qualcomm.com/bundle/publicresource/80-63309-1/topics/matrix.md)