|
LMMP 4.3.0
Lamina High-Precision Arithmetic Library
|
#include "mparam.h"#include "impl/mul_hard.h"#include "impl/tmp_alloc.h"#include "impl/inlines.h"#include "lmmp/lmmpn.h"#include "lmmp/numth.h"宏定义 | |
| #define | Ahr (dst + lo) |
| #define | Alr (tp) |
| #define | Alr2 (tp + lo + 1) |
| #define | R (numa) |
| #define | rk (numa + 2 * lo) |
函数 | |
| void | lmmp_invsqrt_newton_ (mp_ptr restrict dstis, mp_size_t ns, mp_srcptr restrict numa, mp_size_t na) |
| void | lmmp_sqrt_ (mp_ptr dsts, mp_ptr dstr, mp_srcptr numa, mp_size_t na, mp_size_t nf) |
| 计算 [numa,na] * B^(2*nf) 的平方根和余数 | |
| void | lmmp_sqrt_divide_ (mp_ptr restrict dst, mp_ptr restrict numa, mp_size_t ns, mp_ptr restrict tp, int calr) |
| Copyright (C) 2026 HJimmyK (Jericho Knox) | |
| void | lmmp_sqrt_newton_ (mp_ptr dsts, mp_srcptr numa, mp_size_t na, mp_size_t nf) |
| 计算近似平方根 [dsts,nf+na/2+1]=[floor|round](sqrt([numa,na]*B^(2*nf))) | |
| #define Ahr (dst + lo) |
| #define Alr (tp) |
| #define R (numa) |
| #define rk (numa + 2 * lo) |
| void lmmp_invsqrt_newton_ | ( | mp_ptr restrict | dstis, |
| mp_size_t | ns, | ||
| mp_srcptr restrict | numa, | ||
| mp_size_t | na ) |
引用了 LIMB_B_4, LIMB_BITS, LIMB_MAX, lmmp_add_(), lmmp_copy, lmmp_dec, lmmp_dec_1, lmmp_div_s_(), lmmp_inc, lmmp_inc_1, lmmp_invsqrt_newton_(), lmmp_mersenne_next_size_(), LMMP_MIN, lmmp_mul_(), lmmp_mul_mersenne_(), lmmp_mul_n_, lmmp_not_(), lmmp_param_assert, lmmp_shlnot_(), lmmp_shr_(), lmmp_sqr_, lmmp_sqr_mersenne_(), lmmp_sqrt_divide_(), lmmp_zero, lmmp_zero_q_(), restrict, SQRT_NEWTON_MODM_THRESHOLD, TALLOC_TYPE, TEMP_DECL, TEMP_FREE, tp , 以及 xp.
计算 [numa,na] * B^(2*nf) 的平方根和余数
| dsts | 平方根结果输出指针(长度为 nf+na/2+1 个limb) |
| dstr | 余数结果输出指针(NULL表示不计算余数) |
| numa | 源操作数指针(长度为 na 个limb) |
| na | 操作数的 limb 长度 |
| nf | 精度因子 |
引用了 LIMB_BITS, lmmp_addmul_1_(), lmmp_copy, lmmp_debug_assert, lmmp_leading_zeros_, lmmp_shl_(), lmmp_shr_(), lmmp_sqrt_(), lmmp_sqrt_1_(), lmmp_sqrt_2_(), lmmp_sqrt_3_(), lmmp_sqrt_4_(), lmmp_sqrt_divide_(), lmmp_sqrt_newton_(), lmmp_sub_1_(), lmmp_submul_1_(), lmmp_zero, restrict, s, SQRT_INVNEWTON_K_THRESHOLD, t, TALLOC_TYPE, TEMP_DECL, TEMP_FREE, tmp , 以及 tp.
被这些函数引用 bench_sqrt(), lmmp_invsqrt_newton_(), lmmp_nthroot_(), lmmp_perfsqr_(), lmmp_sqrt_(), TEST_CASE(), TEST_CASE() , 以及 TEST_CASE().
| void lmmp_sqrt_divide_ | ( | mp_ptr restrict | dst, |
| mp_ptr restrict | numa, | ||
| mp_size_t | ns, | ||
| mp_ptr restrict | tp, | ||
| int | calr ) |
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
引用了 Ahr, Alr, Alr2, LIMB_B_4, LIMB_BITS, LIMB_MAX, lmmp_add_1_(), lmmp_addmul_1_(), lmmp_addshl1_n_(), lmmp_copy, lmmp_debug_assert, lmmp_dec, lmmp_div_s_(), lmmp_fill_n(), lmmp_param_assert, lmmp_shl_c_(), lmmp_shr_(), lmmp_sqr_, lmmp_sqr_hard_2_(), lmmp_sqrt_2_(), lmmp_sqrt_4_(), lmmp_sqrt_divide_(), lmmp_sub_(), lmmp_sub_1_(), lo, R, restrict, rk , 以及 tp.
计算近似平方根 [dsts,nf+na/2+1]=[floor|round](sqrt([numa,na]*B^(2*nf)))
| dsts | 目标数组(长度为 nf+na/2+1 个limb) |
| numa | 输入数组(长度为 na 个limb) |
| na | numa数组的 limb 长度 |
| nf | 精度因子 |
引用了 LIMB_BITS, lmmp_copy, lmmp_inc, lmmp_invsqrt_newton_(), lmmp_leading_zeros_, lmmp_mul_(), lmmp_param_assert, lmmp_shl_(), lmmp_shr_(), lmmp_sqrt_newton_(), restrict, TALLOC_TYPE, TEMP_DECL, TEMP_FREE , 以及 tp.
被这些函数引用 lmmp_invsqrt_newton_(), lmmp_sqrt_(), lmmp_sqrt_newton_() , 以及 TEST_CASE().