LAMMP 4.1.0
Lamina High-Precision Arithmetic Library
载入中...
搜索中...
未找到
base_table.h
浏览该文件的文档.
1/*
2 * [LAMMP]
3 * Copyright (C) [2025-2026] [HJimmyK(Jericho Knox)]
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19#ifndef __LAMMP_BASE_TABLE_H__
20#define __LAMMP_BASE_TABLE_H__
21
22#include "../lmmpn.h"
23
24typedef struct mp_base_t {
25 // 单个limb能容纳的基数的最大幂次
26 // 二的幂次存储 log2(base)
27 // large_base = base ^ digits_in_limb
29 // ceiling(2^64*log2(base)/log2(2^64))
30 // N 位 base 数最多需要 N * lg_base / 2^64 + 1 个 limb
32 // N 位二进制数最多需要 N * inv_lg_base / 2^64 + 1 个 base 进制位
33 // ceiling(2^64/log2(base))
35 // 单个limb可容纳的最大基数位数
36 // floor(64/log2(base))
38 // 基数(2~256)
39 int base;
41
42typedef struct mp_basepow_t {
43 // 基数幂值(base^digits)
45 // p的 limb 长度
47 // 归一化p的逆元
49 // invp的有效长度
51 // 去除的末尾零 limb 长度
53 // 基数幂的指数(log_base(p))
55 // p归一化时的移位位数
57 // 基数
58 int base;
60
61extern const mp_base_t lmmp_bases_table[255];
62
63#endif // __LAMMP_BASE_TABLE_H__
mp_size_t ni
Definition base_table.h:50
int digits_in_limb
Definition base_table.h:37
mp_size_t digits
Definition base_table.h:54
mp_ptr invp
Definition base_table.h:48
mp_size_t np
Definition base_table.h:46
mp_limb_t lg_base
Definition base_table.h:31
const mp_base_t lmmp_bases_table[255]
Definition base_table.c:9
mp_limb_t large_base
Definition base_table.h:28
mp_limb_t inv_lg_base
Definition base_table.h:34
mp_size_t zeros
Definition base_table.h:52
mp_limb_t * mp_ptr
Definition lmmp.h:215
uint64_t mp_size_t
Definition lmmp.h:212
uint64_t mp_limb_t
Definition lmmp.h:211