-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathacb_norm.c
More file actions
37 lines (29 loc) · 1.02 KB
/
acb_norm.c
File metadata and controls
37 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
Author: Randall L. Rathbun
Date: Tue 11 Nov 2025 09:51:26 AM PST
This file is intended to become part of FLINT.
FLINT 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 3 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/
#include "flint/acb.h"
void acb_norm(arb_t mod, const acb_t x, const slong prec)
{
arb_t re, im, re_sq, im_sq, mod_sq;
arb_init(re); arb_init(im);
arb_init(re_sq); arb_init(im_sq);
arb_init(mod_sq);
// get real and imag parts
arb_set(re, acb_realref(x));
arb_set(im, acb_imagref(x));
// find squares for each part
arb_sqr(re_sq,re,prec);
arb_sqr(im_sq,im,prec);
arb_clear(re); arb_clear(im);
// find square of the modulus
arb_add(mod_sq,re_sq,im_sq,prec);
arb_clear(re_sq); arb_clear(im_sq);
arb_sqrt(mod, mod_sq, prec);
arb_clear(mod_sq);
}