|
LMMC
Lamina Mathematic core
|
#include <math.h>#include "lmmc/config.h"#include "lmmc/numeric.h"#include "lmmc/stats.h"#include "statistics_internal.h"函数 | |
| void | lmmc_stats_factorial (lmmc_real_t *out_val, uint32_t n) |
| 计算 \(n!\) ,溢出时按 IEEE-754 规则返回 inf 。 | |
| void | lmmc_stats_npr (lmmc_real_t *out_val, uint32_t n, uint32_t r) |
| 计算排列数 \(P(n,r)=n!/(n-r)!\) 。 | |
| void | lmmc_stats_ncr (lmmc_real_t *out_val, uint32_t n, uint32_t r) |
| 计算组合数 \(C(n,r)=\binom{n}{r}\) 的近似 binary64 值。 r>n 返回 0;r=0 或 r=n 返回 1。乘除递推处理可溢出的中间乘积, 仅最终结果不可表示时返回正 inf。输出为 NULL 时直接返回。 | |
| void lmmc_stats_factorial | ( | lmmc_real_t * | out_val, |
| uint32_t | n ) |
计算 \(n!\) ,溢出时按 IEEE-754 规则返回 inf 。
在文件 statistics_combinatorics.c 第 13 行定义.
引用了 LMMC_REAL_SET, LMMC_REAL_SET_D , 以及 lmmc_stats_factorial().
被这些函数引用 lmmc_stats_factorial().
| void lmmc_stats_npr | ( | lmmc_real_t * | out_val, |
| uint32_t | n, | ||
| uint32_t | r ) |
计算排列数 \(P(n,r)=n!/(n-r)!\) 。
在文件 statistics_combinatorics.c 第 29 行定义.
引用了 LMMC_REAL_SET, LMMC_REAL_SET_D , 以及 lmmc_stats_npr().
被这些函数引用 lmmc_stats_npr().
| void lmmc_stats_ncr | ( | lmmc_real_t * | out_val, |
| uint32_t | n, | ||
| uint32_t | r ) |
计算组合数 \(C(n,r)=\binom{n}{r}\) 的近似 binary64 值。 r>n 返回 0;r=0 或 r=n 返回 1。乘除递推处理可溢出的中间乘积, 仅最终结果不可表示时返回正 inf。输出为 NULL 时直接返回。
尾数乘积小于 2^32;完成除法归一化后再检查结果可表示性。
在文件 statistics_combinatorics.c 第 49 行定义.
引用了 LMMC_REAL_SET_D , 以及 lmmc_stats_ncr().
被这些函数引用 lmmc_stats_ncr().