|
LMMC
Lamina Mathematic core
|
LMMC binary real type and arithmetic spelling. 更多...
#include <math.h>宏定义 | |
| #define | LMMC_LIBM(function) |
| #define | LMMC_PRI_REAL "f" |
用于 printf 的 lmmc_real_t 格式说明符。 | |
| #define | LMMC_SCN_REAL "lf" |
用于 scanf 的 lmmc_real_t 格式说明符。 | |
| #define | LMMC_REAL_INIT(x) |
| 初始化一个 lmmc_real_t 变量(POD 类型为空操作)。 | |
| #define | LMMC_REAL_CLEAR(x) |
| 释放一个 lmmc_real_t 变量(POD 类型为空操作)。 | |
| #define | LMMC_REAL_SET(dst, src) |
将一个 lmmc_real_t 赋值到另一个:*dst = *src 。 | |
| #define | LMMC_REAL_SET_D(dst, dbl) |
将一个 double 字面量赋值到 lmmc_real_t 。 | |
| #define | LMMC_REAL_ADD(res, a, b) |
计算 *res = *a + *b 。 | |
| #define | LMMC_REAL_SUB(res, a, b) |
计算 *res = *a - *b 。 | |
| #define | LMMC_REAL_MUL(res, a, b) |
计算 *res = *a * *b 。 | |
| #define | LMMC_REAL_DIV(res, a, b) |
计算 *res = *a / *b 。 | |
| #define | LMMC_REAL_NEG(res, a) |
取相反数,*res = -*a 。 | |
| #define | LMMC_REAL_SQRT(res, a) |
计算平方根,*res = sqrt(*a) 。 | |
| #define | LMMC_REAL_ABS(res, a) |
计算绝对值,*res = |*a| 。 | |
| #define | LMMC_REAL_EXP(res, a) |
计算自然指数,*res = exp(*a) 。 | |
| #define | LMMC_REAL_LOG(res, a) |
计算自然对数,*res = log(*a) 。 | |
| #define | LMMC_REAL_SIN(res, a) |
计算正弦,*res = sin(*a) 。 | |
| #define | LMMC_REAL_COS(res, a) |
计算余弦,*res = cos(*a) 。 | |
| #define | LMMC_REAL_TAN(res, a) |
计算正切,*res = tan(*a) 。 | |
| #define | LMMC_REAL_COSH(res, a) |
计算双曲余弦,*res = cosh(*a) 。 | |
| #define | LMMC_REAL_SINH(res, a) |
计算双曲正弦,*res = sinh(*a) 。 | |
| #define | LMMC_REAL_ATAN2(res, y, x) |
计算反正切2,*res = atan2(*y, *x) 。 | |
| #define | LMMC_REAL_CMP(a, b) |
比较 *a 与 *b ,返回 -1/0/1 。 | |
| #define | LMMC_REAL_IS_FINITE(x) |
判断 *x 是否为有限数。 | |
| #define | LMMC_REAL_EPSILON ((lmmc_real_t)1e-15) |
| 既有算法的经验近似阈值,非机器 epsilon。 | |
| #define | LMMC_CONST_PI ((lmmc_real_t)3.14159265358979323846) |
| 圆周率常数 \(\pi\) 。 | |
类型定义 | |
| typedef double | lmmc_real_t |
| Public and internal LMMC real type. | |
LMMC binary real type and arithmetic spelling.
LMMC's C ABI is fixed to IEEE-754 binary64 (double). The operation macros centralize initialization and arithmetic syntax; they are not a pluggable precision backend.
在文件 config.h 中定义.
| #define LMMC_PRI_REAL "f" |
用于 printf 的 lmmc_real_t 格式说明符。
| #define LMMC_SCN_REAL "lf" |
用于 scanf 的 lmmc_real_t 格式说明符。
| #define LMMC_REAL_INIT | ( | x | ) |
初始化一个 lmmc_real_t 变量(POD 类型为空操作)。
被这些函数引用 lmmc_approx_eq(), lmmc_cholesky_decompose_inplace(), lmmc_cholesky_solve(), lmmc_double_nearly_equal(), lmmc_double_nearly_equal_tol(), lmmc_ilu_impl_reserve(), lmmc_itersolve_default_config(), lmmc_itersolve_validate(), lmmc_lu_decompose_inplace(), lmmc_lu_solve(), lmmc_mat_add(), lmmc_mat_create(), lmmc_mat_elementwise_div(), lmmc_mat_hadamard(), lmmc_mat_identity(), lmmc_mat_norm1(), lmmc_mat_norm_inf(), lmmc_mat_rank(), lmmc_mat_scale(), lmmc_mat_sub(), lmmc_mat_trace(), lmmc_nan(), lmmc_qr_decompose_inplace(), lmmc_qr_solve(), lmmc_sparse_bsr_to_dense(), lmmc_sparse_builder_create(), lmmc_sparse_coo_create(), lmmc_sparse_coo_to_csc(), lmmc_sparse_coo_to_csr(), lmmc_sparse_dense_to_bsr(), lmmc_sparse_diag(), lmmc_sparse_from_dense(), lmmc_sparse_mat_mat_mul_dense(), lmmc_sparse_mat_vec_mul(), lmmc_sparse_scale(), lmmc_sparse_sym_spmv(), lmmc_sparse_to_dense(), lmmc_tensor3_add(), lmmc_tensor3_div(), lmmc_tensor3_max(), lmmc_tensor3_min(), lmmc_tensor3_mul(), lmmc_tensor3_scale(), lmmc_tensor3_sub(), lmmc_tensor3_sum(), lmmc_tensor3_sum_axis(), lmmc_vec_asum(), lmmc_vec_axpy(), lmmc_vec_cmp_eq(), lmmc_vec_create(), lmmc_vec_cross(), lmmc_vec_dot(), lmmc_vec_elementwise_div(), lmmc_vec_hadamard(), lmmc_vec_iamax(), lmmc_vec_norm_inf() , 以及 lmmc_vec_scale().
| #define LMMC_REAL_CLEAR | ( | x | ) |
释放一个 lmmc_real_t 变量(POD 类型为空操作)。
被这些函数引用 lmmc_approx_eq(), lmmc_cholesky_decompose_inplace(), lmmc_cholesky_solve(), lmmc_double_nearly_equal(), lmmc_double_nearly_equal_tol(), lmmc_ilu_impl_destroy(), lmmc_ilu_impl_reserve(), lmmc_lu_decompose_inplace(), lmmc_lu_solve(), lmmc_mat_add(), lmmc_mat_destroy(), lmmc_mat_elementwise_div(), lmmc_mat_hadamard(), lmmc_mat_identity(), lmmc_mat_norm1(), lmmc_mat_norm_inf(), lmmc_mat_rank(), lmmc_mat_scale(), lmmc_mat_sub(), lmmc_mat_trace(), lmmc_nan(), lmmc_qr_decompose_inplace(), lmmc_qr_solve(), lmmc_sparse_add(), lmmc_sparse_bsr_to_dense(), lmmc_sparse_builder_destroy(), lmmc_sparse_coo_destroy(), lmmc_sparse_coo_to_csc(), lmmc_sparse_coo_to_csr(), lmmc_sparse_dense_to_bsr(), lmmc_sparse_destroy(), lmmc_sparse_diag(), lmmc_sparse_from_dense(), lmmc_sparse_mat_mat_mul_dense(), lmmc_sparse_mat_vec_mul(), lmmc_sparse_scale(), lmmc_sparse_sym_spmv(), lmmc_sparse_to_dense(), lmmc_tensor3_add(), lmmc_tensor3_destroy(), lmmc_tensor3_div(), lmmc_tensor3_max(), lmmc_tensor3_min(), lmmc_tensor3_mul(), lmmc_tensor3_scale(), lmmc_tensor3_sub(), lmmc_tensor3_sum(), lmmc_tensor3_sum_axis(), lmmc_tensor_nd_destroy(), lmmc_vec_asum(), lmmc_vec_axpy(), lmmc_vec_cmp_eq(), lmmc_vec_cross(), lmmc_vec_destroy(), lmmc_vec_dot(), lmmc_vec_elementwise_div(), lmmc_vec_hadamard(), lmmc_vec_iamax(), lmmc_vec_norm_inf() , 以及 lmmc_vec_scale().
| #define LMMC_REAL_SET | ( | dst, | |
| src ) |
将一个 lmmc_real_t 赋值到另一个:*dst = *src 。
被这些函数引用 lmmc_approx_eq(), lmmc_cholesky_decompose_inplace(), lmmc_cholesky_solve(), lmmc_complex_conj(), lmmc_complex_create(), lmmc_ilu_impl_reserve(), lmmc_lu_decompose_inplace(), lmmc_mat_add(), lmmc_mat_copy(), lmmc_mat_det(), lmmc_mat_elementwise_div(), lmmc_mat_fill(), lmmc_mat_hadamard(), lmmc_mat_identity(), lmmc_mat_norm1(), lmmc_mat_norm_inf(), lmmc_mat_scale(), lmmc_mat_sub(), lmmc_mat_trace(), lmmc_mat_transpose_to(), lmmc_ode_default_config(), lmmc_qr_decompose_inplace(), lmmc_qr_solve(), lmmc_sparse_builder_add(), lmmc_sparse_coo_add_entry(), lmmc_sparse_from_dense(), lmmc_sparse_mat_mat_mul_dense(), lmmc_sparse_mat_vec_mul(), lmmc_sparse_scale(), lmmc_sparse_to_csc(), lmmc_sparse_to_csr(), lmmc_sparse_to_dense(), lmmc_sparse_transpose(), lmmc_stats_factorial(), lmmc_stats_npr(), lmmc_tensor3_add(), lmmc_tensor3_div(), lmmc_tensor3_fill(), lmmc_tensor3_get(), lmmc_tensor3_max(), lmmc_tensor3_min(), lmmc_tensor3_mul(), lmmc_tensor3_scale(), lmmc_tensor3_set(), lmmc_tensor3_sub(), lmmc_tensor3_sum(), lmmc_tensor3_sum_axis(), lmmc_tensor_nd_get(), lmmc_tensor_nd_set(), lmmc_vec_asum(), lmmc_vec_axpy(), lmmc_vec_copy(), lmmc_vec_cross(), lmmc_vec_dot(), lmmc_vec_elementwise_div(), lmmc_vec_fill(), lmmc_vec_hadamard(), lmmc_vec_iamax(), lmmc_vec_norm_inf() , 以及 lmmc_vec_scale().
| #define LMMC_REAL_SET_D | ( | dst, | |
| dbl ) |
将一个 double 字面量赋值到 lmmc_real_t 。
被这些函数引用 lmmc_approx_eq(), lmmc_atan2(), lmmc_cholesky_decompose_inplace(), lmmc_double_nearly_equal(), lmmc_double_nearly_equal_tol(), lmmc_eps(), lmmc_exp2(), lmmc_expm1(), lmmc_fmod(), lmmc_hypot(), lmmc_ilu_impl_reserve(), lmmc_inf(), lmmc_itersolve_default_config(), lmmc_itersolve_validate(), lmmc_ldexp(), lmmc_log1p(), lmmc_log2(), lmmc_mat_elementwise_div(), lmmc_mat_identity(), lmmc_mat_norm1(), lmmc_mat_norm_inf(), lmmc_mat_rank(), lmmc_mat_trace(), lmmc_nan(), lmmc_nextafter(), lmmc_ode_default_config(), lmmc_qr_decompose_inplace(), lmmc_sincos(), lmmc_sparse_bsr_to_dense(), lmmc_sparse_dense_to_bsr(), lmmc_sparse_diag(), lmmc_sparse_from_dense(), lmmc_sparse_mat_mat_mul_dense(), lmmc_sparse_mat_vec_mul(), lmmc_sparse_sym_spmv(), lmmc_sparse_to_dense(), lmmc_split_int_frac(), lmmc_stats_factorial(), lmmc_stats_ncr(), lmmc_stats_npr(), lmmc_tensor3_div(), lmmc_tensor3_sum(), lmmc_vec_asum(), lmmc_vec_dot(), lmmc_vec_elementwise_div() , 以及 lmmc_vec_norm_inf().
| #define LMMC_REAL_ADD | ( | res, | |
| a, | |||
| b ) |
计算 *res = *a + *b 。
被这些函数引用 lmmc_complex_add(), lmmc_mat_add(), lmmc_mat_norm1(), lmmc_mat_norm_inf(), lmmc_mat_trace(), lmmc_nonlinear_x_tolerance(), lmmc_qr_decompose_inplace(), lmmc_sparse_mat_vec_mul(), lmmc_tensor3_add(), lmmc_tensor3_sum(), lmmc_vec_asum(), lmmc_vec_axpy() , 以及 lmmc_vec_dot().
| #define LMMC_REAL_SUB | ( | res, | |
| a, | |||
| b ) |
计算 *res = *a - *b 。
被这些函数引用 lmmc_approx_eq(), lmmc_cholesky_decompose_inplace(), lmmc_cholesky_solve(), lmmc_complex_sub(), lmmc_double_nearly_equal_tol(), lmmc_lu_decompose_inplace(), lmmc_lu_solve(), lmmc_mat_sub(), lmmc_ode_default_config(), lmmc_ode_euler_solve(), lmmc_ode_rk45_solve(), lmmc_ode_rk4_solve(), lmmc_tensor3_sub(), lmmc_vec_cmp_eq() , 以及 lmmc_vec_cross().
| #define LMMC_REAL_MUL | ( | res, | |
| a, | |||
| b ) |
计算 *res = *a * *b 。
被这些函数引用 lmmc_cholesky_decompose_inplace(), lmmc_cholesky_solve(), lmmc_complex_exp(), lmmc_double_nearly_equal_tol(), lmmc_lu_decompose_inplace(), lmmc_lu_solve(), lmmc_mat_hadamard(), lmmc_mat_rank(), lmmc_mat_scale(), lmmc_nonlinear_x_tolerance(), lmmc_ode_default_config(), lmmc_qr_decompose_inplace(), lmmc_sparse_mat_vec_mul(), lmmc_sparse_scale(), lmmc_tensor3_mul(), lmmc_tensor3_scale(), lmmc_vec_axpy(), lmmc_vec_cross(), lmmc_vec_dot(), lmmc_vec_hadamard() , 以及 lmmc_vec_scale().
| #define LMMC_REAL_DIV | ( | res, | |
| a, | |||
| b ) |
计算 *res = *a / *b 。
被这些函数引用 lmmc_cholesky_decompose_inplace(), lmmc_cholesky_solve(), lmmc_lu_decompose_inplace(), lmmc_lu_solve(), lmmc_mat_elementwise_div(), lmmc_nan(), lmmc_ode_default_config(), lmmc_tensor3_div() , 以及 lmmc_vec_elementwise_div().
| #define LMMC_REAL_NEG | ( | res, | |
| a ) |
| #define LMMC_REAL_SQRT | ( | res, | |
| a ) |
计算平方根,*res = sqrt(*a) 。
被这些函数引用 lmmc_cholesky_decompose_inplace().
| #define LMMC_REAL_ABS | ( | res, | |
| a ) |
计算绝对值,*res = |*a| 。
被这些函数引用 lmmc_double_nearly_equal_tol(), lmmc_mat_norm1(), lmmc_mat_norm_inf(), lmmc_sparse_from_dense(), lmmc_vec_asum(), lmmc_vec_cmp_eq(), lmmc_vec_iamax() , 以及 lmmc_vec_norm_inf().
| #define LMMC_REAL_EXP | ( | res, | |
| a ) |
| #define LMMC_REAL_LOG | ( | res, | |
| a ) |
| #define LMMC_REAL_SIN | ( | res, | |
| a ) |
计算正弦,*res = sin(*a) 。
被这些函数引用 lmmc_complex_cos(), lmmc_complex_exp() , 以及 lmmc_complex_sin().
| #define LMMC_REAL_COS | ( | res, | |
| a ) |
计算余弦,*res = cos(*a) 。
被这些函数引用 lmmc_complex_cos(), lmmc_complex_exp() , 以及 lmmc_complex_sin().
| #define LMMC_REAL_TAN | ( | res, | |
| a ) |
| #define LMMC_REAL_COSH | ( | res, | |
| a ) |
| #define LMMC_REAL_SINH | ( | res, | |
| a ) |
| #define LMMC_REAL_ATAN2 | ( | res, | |
| y, | |||
| x ) |
| #define LMMC_REAL_CMP | ( | a, | |
| b ) |
比较 *a 与 *b ,返回 -1/0/1 。
被这些函数引用 lmmc_approx_eq(), lmmc_cholesky_decompose_inplace(), lmmc_double_nearly_equal_tol(), lmmc_lu_decompose_inplace(), lmmc_mat_elementwise_div(), lmmc_mat_norm1(), lmmc_mat_norm_inf(), lmmc_mat_rank(), lmmc_qr_decompose_inplace(), lmmc_sparse_dense_to_bsr(), lmmc_sparse_from_dense(), lmmc_tensor3_div(), lmmc_tensor3_max(), lmmc_tensor3_min(), lmmc_vec_cmp_eq(), lmmc_vec_cmp_ge(), lmmc_vec_cmp_gt(), lmmc_vec_cmp_le(), lmmc_vec_cmp_lt(), lmmc_vec_elementwise_div() , 以及 lmmc_vec_iamax().
| #define LMMC_REAL_IS_FINITE | ( | x | ) |
判断 *x 是否为有限数。
被这些函数引用 lmmc_double_nearly_equal_tol(), lmmc_lu_decompose_inplace() , 以及 lmmc_lu_solve().
| #define LMMC_REAL_EPSILON ((lmmc_real_t)1e-15) |
既有算法的经验近似阈值,非机器 epsilon。
被这些函数引用 lmmc_mat_rank() , 以及 lmmc_ode_jacobian_eval().
| #define LMMC_CONST_PI ((lmmc_real_t)3.14159265358979323846) |
| typedef double lmmc_real_t |