LMMP 4.3.0
Lamina High-Precision Arithmetic Library
载入中...
搜索中...
未找到
sqrt.c 文件参考
#include "support/perf.h"
#include "lmmp/lmmpn.h"
#include "lmmp/numth.h"
sqrt.c 的引用(Include)关系图:

浏览该文件的源代码.

函数

static double bench_sqrt (mp_size_t n, const bench_options *o)
 Copyright (C) 2026 HJimmyK (Jericho Knox)
int main (void)
static void run_sqrt (void)

函数说明

◆ bench_sqrt()

double bench_sqrt ( mp_size_t n,
const bench_options * o )
static

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

在文件 sqrt.c 第 27 行定义.

27 {
28 mp_ptr a = alloc_limbs(n / 2 + 1), b = alloc_limbs(n);
29 fill_random(b, n, 0x92cab5432211ull + n);
30 double us;
31 BENCH_MEASURE(us, o, lmmp_sqrt_(a, NULL, b, n, 0););
32 lmmp_free(a);
33 lmmp_free(b);
34 return us;
35}
mp_limb_t * mp_ptr
定义 lmmp.h:96
void lmmp_free(void *ptr)
内存释放函数(调用lmmp_heap_free_fn)
#define n
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) 的平方根和余数
定义 sqrt.c:441
#define BENCH_MEASURE(result, options,...)
定义 perf.h:93

引用了 BENCH_MEASURE, bench_sqrt(), lmmp_free(), lmmp_sqrt_() , 以及 n.

被这些函数引用 bench_sqrt() , 以及 run_sqrt().

函数调用图:
这是这个函数的调用关系图:

◆ main()

int main ( void )

在文件 sqrt.c 第 45 行定义.

45 {
46 setvbuf(stdout, NULL, _IONBF, 0);
48 puts("[numth/sqrt/sqrt]");
49 run_sqrt();
51 return 0;
52}
void lmmp_global_init(void)
全局初始化函数(线程局部的)
void lmmp_global_deinit(void)
全局释放函数(线程局部的)
static void run_sqrt(void)
定义 sqrt.c:37

引用了 lmmp_global_deinit(), lmmp_global_init(), main() , 以及 run_sqrt().

函数调用图:

◆ run_sqrt()

void run_sqrt ( void )
static

在文件 sqrt.c 第 37 行定义.

37 {
38 const mp_size_t SZ[] = {5000, 20000, 50000};
39 for (size_t i = 0; i < ARRAY_SIZE(SZ); ++i) {
40 mp_size_t n = SZ[i];
41 report_n("sqrt", n, bench_sqrt(n, &bench_default), n * 8.0);
42 }
43}
uint64_t mp_size_t
定义 lmmp.h:93
static double bench_sqrt(mp_size_t n, const bench_options *o)
Copyright (C) 2026 HJimmyK (Jericho Knox)
定义 sqrt.c:27
#define ARRAY_SIZE(a)
Copyright (C) 2026 HJimmyK (Jericho Knox)
定义 perf.h:40

引用了 ARRAY_SIZE, bench_sqrt(), n , 以及 run_sqrt().

被这些函数引用 main() , 以及 run_sqrt().

函数调用图:
这是这个函数的调用关系图: