3 Star 3 Fork 0

Gitee 极速下载/Arb

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/fredrik-johansson/arb
克隆/下载
dct.c 1.30 KB
一键复制 编辑 原始数据 按行查看 历史
/*
Copyright (C) 2018 Fredrik Johansson
This file is part of Arb.
Arb is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/
#include "arb_mat.h"
#include "acb_dirichlet.h"
void
arb_mat_dct(arb_mat_t res, int kind, slong prec)
{
acb_dirichlet_roots_t roots;
acb_t t;
arb_t v;
slong n, r, c, i, j;
r = arb_mat_nrows(res);
c = arb_mat_ncols(res);
n = FLINT_MIN(r, c);
if (n == 0)
return;
acb_dirichlet_roots_init(roots, 4 * n, (r - 1) * c, prec);
acb_init(t);
arb_init(v);
arb_set_ui(v, n);
arb_rsqrt(v, v, prec);
if (r > 0)
{
for (j = 0; j < c; j++)
arb_set(arb_mat_entry(res, 0, j), v);
}
arb_set_ui(v, n);
arb_mul_2exp_si(v, v, -1);
arb_rsqrt(v, v, prec);
for (i = 1; i < r; i++)
{
for (j = 0; j < c; j++)
{
acb_dirichlet_root(t, roots, i * (2 * j + 1), prec);
arb_mul(arb_mat_entry(res, i, j), acb_realref(t), v, prec);
}
}
acb_dirichlet_roots_clear(roots);
acb_clear(t);
arb_clear(v);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C/C++
1
https://gitee.com/mirrors/Arb.git
git@gitee.com:mirrors/Arb.git
mirrors
Arb
Arb
master

搜索帮助