RcdMathLib_doc
Open Source Library for Linear and Non-linear Algebra
combinatorics.h File Reference

Calculate possible $ \binom{n}{k} combinations $ without repetition in ascending order. More...

#include <stdint.h>

Go to the source code of this file.

Macros

#define COMBI_ERROR   -1
 Case of an error.
 
#define COMBI_EMPTY   0
 Case of an empty combination set.
 
#define COMBI_SUCCESS   1
 Case of successfully calculated combination set.
 
#define COMBI_END   2
 Case of completion of calculating combination sets.
 

Functions

uint8_t combinatorics_init (uint8_t n, uint8_t k, uint8_t comb_arr[])
 Initialize the combinations generator. More...
 
uint8_t combinatorics_get_next_without_rep (uint8_t n, uint8_t k, uint8_t comb_arr[])
 Generate the next combination. More...
 

Detailed Description

Calculate possible $ \binom{n}{k} combinations $ without repetition in ascending order.

Author
Zakaria Kasmi zkasm.nosp@m.i@in.nosp@m.f.fu-.nosp@m.berl.nosp@m.in.de

Definition in file combinatorics.h.

Function Documentation

◆ combinatorics_get_next_without_rep()

uint8_t combinatorics_get_next_without_rep ( uint8_t  n,
uint8_t  k,
uint8_t  comb_arr[] 
)

Generate the next combination.

Parameters
[in]nsize of the set.
[in]ksize of the sub-set.
[in,out]comb_arr[]pointer to the combination set.

return COMBI_END, if the last combination is generated. return COMBI_SUCCESS, if successful.

Definition at line 48 of file combinatorics.c.

References COMBI_END, and COMBI_SUCCESS.

Referenced by recog_mitigate_multipath().

◆ combinatorics_init()

uint8_t combinatorics_init ( uint8_t  n,
uint8_t  k,
uint8_t  comb_arr[] 
)

Initialize the combinations generator.

Parameters
[in]nsize of the set.
[in]ksize of the sub-set.
[out]comb_arr[]pointer to the combination set.

return COMBI_ERROR, if k > n. return COMBI_EMPTY, if k =0. return COMBI_SUCCESS, if successful.

Definition at line 29 of file combinatorics.c.

References COMBI_EMPTY, COMBI_ERROR, and COMBI_SUCCESS.

Referenced by recog_mitigate_multipath().