|
LMMP 4.3.0
Lamina High-Precision Arithmetic Library
|
#include "impl/inlines.h"#include "mparam.h"#include "impl/tmp_alloc.h"#include "impl/mul_cache.h"#include "lmmp/lmmpn.h"宏定义 | |
| #define | a0 (numa) |
| #define | a0 (numa) |
| #define | a1 (numa + m) |
| #define | a1 (numa + m) |
| #define | b0 (numb) |
| #define | b1 (numb + m) |
| #define | c0 (dst) |
| #define | c0 (dst) |
| #define | c1 (dst + m) |
| #define | c1 (dst + m) |
| #define | lo (tp) |
| #define | lo1 (tp) |
| #define | lo2 (tp + t) |
| #define | scratch (tp + t) |
| #define | scratch (tp + 2 * t) |
函数 | |
| void | lmmp_mullo_ (mp_ptr restrict dst, mp_srcptr restrict numa, mp_srcptr restrict numb, mp_size_t n) |
| static void | lmmp_mullo_crt_ (mp_ptr dst, mp_ptr lp, mp_ptr hp, mp_size_t n, mp_size_t hn) |
| Copyright (C) 2026 HJimmyK (Jericho Knox) | |
| void | lmmp_mullo_dc_ (mp_ptr restrict dst, mp_srcptr restrict numa, mp_srcptr restrict numb, mp_ptr restrict tp, mp_size_t n) |
| void | lmmp_mullo_fft_ (mp_ptr dst, mp_srcptr numa, mp_srcptr numb, mp_size_t n, mp_ptr scratch) |
| 低位FFT乘法 [dst,n] = [numa,n] * [numb,n] mod B^n | |
| void | lmmp_mullo_fft_cache_ (mp_ptr dst, mp_srcptr numa, mp_ptr scratch, fft_mullo_cache *ctx) |
| 低位乘法(缓存版) [dst,n] = [numa,n] * 缓存numb mod B^n | |
| void | lmmp_mullo_fft_cache_init_ (mp_ptr dst, mp_srcptr numa, mp_srcptr numb, mp_size_t n, mp_ptr scratch, fft_mullo_cache *ctx) |
| 低位乘法(缓存版) [dst,n] = [numa,n] * [numb,n] mod B^n 第二个操作数将被缓存 | |
| void | lmmp_sqrlo_dc_ (mp_ptr restrict dst, mp_srcptr restrict numa, mp_ptr restrict tp, mp_size_t n) |
| #define a0 (numa) |
| #define a0 (numa) |
| #define a1 (numa + m) |
| #define a1 (numa + m) |
| #define b0 (numb) |
| #define b1 (numb + m) |
| #define c0 (dst) |
| #define c0 (dst) |
| #define c1 (dst + m) |
| #define c1 (dst + m) |
被这些函数引用 _udiv128by64to64_(), lmmp_cbrt_divide_(), lmmp_hgcd_matrix_mul_u_(), lmmp_mod_2p48sub1_(), lmmp_mod_4chunk_1_(), lmmp_mod_8chunk_1_(), lmmp_mullo_dc_(), lmmp_nthroot_(), lmmp_sqrlo_dc_(), mont2_redc(), mont2_redc(), nthroot_add_small_(), nthroot_sub_small_(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE() , 以及 TEST_CASE().
| #define lo (tp) |
被这些函数引用 check_prime_2_agreement(), ctz_u128(), expect2(), icbrt_u64(), is2_notrial_i_(), is_square_2(), isqrt_u64(), isqrt_u64(), less_sw(), lmmp_binvert_unbalance_1_(), lmmp_cbrt_divide_(), lmmp_div_divide_n_(), lmmp_divexact_1_(), lmmp_divexact_odd_pi_(), lmmp_is_prime_2_(), lmmp_is_prime_2_notrial_(), lmmp_powmod_(), lmmp_prime_cnt16_(), lmmp_shr64_(), lmmp_shr64_(), lmmp_sqrlo_dc_(), lmmp_sqrt_divide_(), lshl_u128(), lshr_u128(), mont2_redc(), mont2_redc(), mont2_redc_mul_1(), mul_128(), mul_128(), sqr_128(), sqr_128(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE() , 以及 TEST_CASE().
| #define lo1 (tp) |
被这些函数引用 lmmp_mullo_dc_().
被这些函数引用 lmmp_mullo_dc_().
| void lmmp_mullo_ | ( | mp_ptr restrict | dst, |
| mp_srcptr restrict | numa, | ||
| mp_srcptr restrict | numb, | ||
| mp_size_t | n ) |
引用了 lmmp_mullo_(), lmmp_mullo_dc_(), lmmp_mullo_fft_(), lmmp_param_assert, lmmp_sqrlo_dc_(), MULLO_DC_THRESHOLD, n, numb, restrict, TALLOC_TYPE, TEMP_DECL, TEMP_FREE , 以及 tp.
Copyright (C) 2026 HJimmyK (Jericho Knox)
This file is part of LMMP.
LMMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library. If not, see https://www.gnu.org/licenses/.
SPDX-License-Identifier: LGPL-3.0-or-later
mullo 双域 CRT 尾部:由梅森域积与费马域积重构低位乘积 [dst,n] = P mod B^n,其中 P = [numa,n]*[numb,n] mod B^(2n), [lp,hn] = P mod B^hn-1(梅森域结果),[hp,hn+1] = P mod B^hn+1(费马域结果)
| dst | 输出结果(n 个 limb) |
| lp | 输入输出:梅森域结果,兼作重构工作区(需 2*n 个 limb 容量; n==hn 时写入 [hn,2hn),n<hn 时写入 [hn,2n)) |
| hp | 输入输出:费马域结果(hn+1 个 limb;n<hn 时 [2n-hn,hn) 段被复写) |
| n | 低位乘积截断长度 |
| hn | 变换阶数,hn = lmmp_fft_next_size_(n) |
引用了 LIMB_BITS, lmmp_copy, lmmp_dec_1, lmmp_inc, lmmp_mullo_crt_(), lmmp_shr1add_nc_(), lmmp_sub_1_(), lmmp_sub_n_(), lmmp_sub_nc_() , 以及 n.
被这些函数引用 lmmp_mullo_crt_(), lmmp_mullo_fft_(), lmmp_mullo_fft_cache_() , 以及 lmmp_mullo_fft_cache_init_().
| void lmmp_mullo_dc_ | ( | mp_ptr restrict | dst, |
| mp_srcptr restrict | numa, | ||
| mp_srcptr restrict | numb, | ||
| mp_ptr restrict | tp, | ||
| mp_size_t | n ) |
引用了 a0, a1, b0, b1, c0, c1, lmmp_add_n_(), lmmp_copy, lmmp_debug_assert, lmmp_mul_n_, lmmp_mullo_basecase_(), lmmp_mullo_dc_(), lo1, lo2, MUL_TOOM33_THRESHOLD, MUL_TOOM44_THRESHOLD, MUL_TOOM6H_THRESHOLD, MUL_TOOM8H_THRESHOLD, MULLO_BASECASE_THRESHOLD, n, numb, restrict, scratch, t , 以及 tp.
低位FFT乘法 [dst,n] = [numa,n] * [numb,n] mod B^n
| dst | 输出结果缓冲区,长度至少为 n |
| numa | 第一个输入操作数,长度为 n |
| numb | 第二个输入操作数,长度为 n |
| scratch | 临时缓冲区,长度至少为 2*n |
| n | 缓冲区 limb 长度 |
引用了 ALLOC_TYPE, lmmp_debug_assert, lmmp_fft_next_size_(), lmmp_free(), lmmp_mul_fermat_(), lmmp_mul_mersenne_fft_(), lmmp_mullo_crt_(), lmmp_mullo_fft_(), lmmp_param_assert, lmmp_sqr_fermat_(), lmmp_sqr_mersenne_fft_(), n, numb, scratch , 以及 tp.
被这些函数引用 bench_mullo_fft(), lmmp_mullo_(), lmmp_mullo_fft_(), lmmp_mullo_n_(), lmmp_mullo_n_(), lmmp_mullo_n_(), lmmp_redc_(), lmmp_sqrlo_dc_() , 以及 lmmp_sqrlo_n_().
| void lmmp_mullo_fft_cache_ | ( | mp_ptr | dst, |
| mp_srcptr | numa, | ||
| mp_ptr | scratch, | ||
| fft_mullo_cache * | ctx ) |
低位乘法(缓存版) [dst,n] = [numa,n] * 缓存numb mod B^n
| dst | 输出结果缓冲区,长度至少为 n |
| numa | 第一个输入操作数,长度为 lmmp_mullo_fft_cache_init_() 中输入参数的 n |
| scratch | 临时空间(2*n 个 limb) |
| ctx | mullo 缓存上下文 |
引用了 fft_cache::fermat, fft_mullo_cache::hn, lmmp_mul_fermat_cache_(), lmmp_mul_mersenne_cache_(), lmmp_mullo_crt_(), lmmp_mullo_fft_cache_(), lmmp_param_assert, fft_cache::mersenne, fft_mullo_cache::mul, fft_mullo_cache::n, scratch , 以及 fft_cache::tp.
被这些函数引用 lmmp_binvert_unbalance_(), lmmp_divexact_mu_run_(), lmmp_mont_redc_() , 以及 lmmp_mullo_fft_cache_().
| void lmmp_mullo_fft_cache_init_ | ( | mp_ptr | dst, |
| mp_srcptr | numa, | ||
| mp_srcptr | numb, | ||
| mp_size_t | n, | ||
| mp_ptr | scratch, | ||
| fft_mullo_cache * | ctx ) |
低位乘法(缓存版) [dst,n] = [numa,n] * [numb,n] mod B^n 第二个操作数将被缓存
| dst | 输出结果缓冲区,长度至少为 n |
| numa | 第一个输入操作数,长度为 n |
| numb | 第二个输入操作数,长度为 n |
| n | 操作数的 limb 长度 |
| scratch | 临时空间(2*n 个 limb,两操作数分离) |
| ctx | mullo 缓存上下文 |
引用了 ALLOC_TYPE, fft_cache::fermat, fft_cache::hn, fft_mullo_cache::hn, lmmp_debug_assert, lmmp_fft_next_size_(), lmmp_mul_fermat_cache_init_(), lmmp_mul_mersenne_cache_init_(), lmmp_mullo_crt_(), lmmp_mullo_fft_cache_init_(), lmmp_param_assert, fft_cache::mersenne, fft_mullo_cache::mul, fft_mullo_cache::n, n, fft_cache::na, fft_cache::nb, numb, scratch , 以及 fft_cache::tp.
被这些函数引用 lmmp_binvert_unbalance_(), lmmp_divexact_mu_run_(), lmmp_mont_redc_() , 以及 lmmp_mullo_fft_cache_init_().
| void lmmp_sqrlo_dc_ | ( | mp_ptr restrict | dst, |
| mp_srcptr restrict | numa, | ||
| mp_ptr restrict | tp, | ||
| mp_size_t | n ) |
引用了 a0, a1, c0, c1, lmmp_addshl1_n_(), lmmp_copy, lmmp_mullo_dc_(), lmmp_sqr_, lmmp_sqrlo_basecase_(), lmmp_sqrlo_dc_(), lo, MUL_TOOM33_THRESHOLD, MUL_TOOM44_THRESHOLD, MUL_TOOM6H_THRESHOLD, MUL_TOOM8H_THRESHOLD, MULLO_BASECASE_THRESHOLD, n, restrict, scratch, t , 以及 tp.