mirror of
https://github.com/vale981/arb
synced 2025-03-06 01:41:39 -05:00
commit
f70440b434
28 changed files with 276 additions and 98 deletions
27
acb.h
27
acb.h
|
@ -32,6 +32,7 @@
|
|||
#define ACB_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "arf.h"
|
||||
#include "arb.h"
|
||||
|
||||
|
@ -984,16 +985,28 @@ _acb_vec_scalar_div_fmpz(acb_ptr res, acb_srcptr vec, slong len, const fmpz_t c,
|
|||
}
|
||||
|
||||
ACB_INLINE void
|
||||
acb_print(const acb_t x)
|
||||
acb_fprint(FILE * file, const acb_t x)
|
||||
{
|
||||
flint_printf("(");
|
||||
arb_print(acb_realref(x));
|
||||
flint_printf(", ");
|
||||
arb_print(acb_imagref(x));
|
||||
flint_printf(")");
|
||||
flint_fprintf(file, "(");
|
||||
arb_fprint(file, acb_realref(x));
|
||||
flint_fprintf(file, ", ");
|
||||
arb_fprint(file, acb_imagref(x));
|
||||
flint_fprintf(file, ")");
|
||||
}
|
||||
|
||||
void acb_printd(const acb_t z, slong digits);
|
||||
ACB_INLINE void
|
||||
acb_print(const acb_t x)
|
||||
{
|
||||
acb_fprint(stdout, x);
|
||||
}
|
||||
|
||||
void acb_fprintd(FILE * file, const acb_t z, slong digits);
|
||||
|
||||
ACB_INLINE void
|
||||
acb_printd(const acb_t z, slong digits)
|
||||
{
|
||||
acb_fprintd(stdout, z, digits);
|
||||
}
|
||||
|
||||
void acb_randtest(acb_t z, flint_rand_t state, slong prec, slong mag_bits);
|
||||
|
||||
|
|
|
@ -20,36 +20,37 @@
|
|||
/******************************************************************************
|
||||
|
||||
Copyright (C) 2012 Fredrik Johansson
|
||||
Copyright (C) 2015 Arb authors
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "acb.h"
|
||||
|
||||
void
|
||||
acb_printd(const acb_t z, slong digits)
|
||||
acb_fprintd(FILE * file, const acb_t z, slong digits)
|
||||
{
|
||||
flint_printf("(");
|
||||
arf_printd(arb_midref(acb_realref(z)), digits);
|
||||
flint_fprintf(file, "(");
|
||||
arf_fprintd(file, arb_midref(acb_realref(z)), digits);
|
||||
|
||||
if (arf_sgn(arb_midref(acb_imagref(z))) < 0)
|
||||
{
|
||||
arf_t t;
|
||||
arf_init_neg_shallow(t, arb_midref(acb_imagref(z)));
|
||||
flint_printf(" - ");
|
||||
arf_printd(t, digits);
|
||||
flint_fprintf(file, " - ");
|
||||
arf_fprintd(file, t, digits);
|
||||
}
|
||||
else
|
||||
{
|
||||
flint_printf(" + ");
|
||||
arf_printd(arb_midref(acb_imagref(z)), digits);
|
||||
flint_fprintf(file, " + ");
|
||||
arf_fprintd(file, arb_midref(acb_imagref(z)), digits);
|
||||
}
|
||||
flint_printf("j)");
|
||||
flint_fprintf(file, "j)");
|
||||
|
||||
flint_printf(" +/- ");
|
||||
flint_fprintf(file, " +/- ");
|
||||
|
||||
flint_printf("(");
|
||||
mag_printd(arb_radref(acb_realref(z)), 3);
|
||||
flint_printf(", ");
|
||||
mag_printd(arb_radref(acb_imagref(z)), 3);
|
||||
flint_printf("j)");
|
||||
flint_fprintf(file, "(");
|
||||
mag_fprintd(file, arb_radref(acb_realref(z)), 3);
|
||||
flint_fprintf(file, ", ");
|
||||
mag_fprintd(file, arb_radref(acb_imagref(z)), 3);
|
||||
flint_fprintf(file, "j)");
|
||||
}
|
|
@ -32,6 +32,7 @@
|
|||
#define ACB_MAT_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "arb.h"
|
||||
#include "acb.h"
|
||||
#include "fmpz_mat.h"
|
||||
|
@ -99,7 +100,13 @@ void acb_mat_randtest(acb_mat_t mat, flint_rand_t state, slong prec, slong mag_b
|
|||
|
||||
/* I/O */
|
||||
|
||||
void acb_mat_printd(const acb_mat_t mat, slong digits);
|
||||
void acb_mat_fprintd(FILE * file, const acb_mat_t mat, slong digits);
|
||||
|
||||
ACB_MAT_INLINE void
|
||||
acb_mat_printd(const acb_mat_t mat, slong digits)
|
||||
{
|
||||
acb_mat_fprintd(stdout, mat, digits);
|
||||
}
|
||||
|
||||
/* Comparisons */
|
||||
|
||||
|
|
|
@ -20,28 +20,29 @@
|
|||
/******************************************************************************
|
||||
|
||||
Copyright (C) 2012 Fredrik Johansson
|
||||
Copyright (C) 2015 Arb authors
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "acb_mat.h"
|
||||
|
||||
void
|
||||
acb_mat_printd(const acb_mat_t mat, slong digits)
|
||||
acb_mat_fprintd(FILE * file, const acb_mat_t mat, slong digits)
|
||||
{
|
||||
slong i, j;
|
||||
|
||||
for (i = 0; i < acb_mat_nrows(mat); i++)
|
||||
{
|
||||
flint_printf("[");
|
||||
flint_fprintf(file, "[");
|
||||
|
||||
for (j = 0; j < acb_mat_ncols(mat); j++)
|
||||
{
|
||||
acb_printd(acb_mat_entry(mat, i, j), digits);
|
||||
acb_fprintd(file, acb_mat_entry(mat, i, j), digits);
|
||||
|
||||
if (j < acb_mat_ncols(mat) - 1)
|
||||
flint_printf(", ");
|
||||
flint_fprintf(file, ", ");
|
||||
}
|
||||
|
||||
flint_printf("]\n");
|
||||
flint_fprintf(file, "]\n");
|
||||
}
|
||||
}
|
|
@ -26,6 +26,7 @@
|
|||
#ifndef ACB_MODULAR_H
|
||||
#define ACB_MODULAR_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "acb.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -89,14 +90,20 @@ psl2z_one(psl2z_t g)
|
|||
fmpz_one(&g->d);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
psl2z_fprint(FILE * file, const psl2z_t g)
|
||||
{
|
||||
flint_fprintf(file, "[");
|
||||
fmpz_fprint(file, &g->a); flint_fprintf(file, " ");
|
||||
fmpz_fprint(file, &g->b); flint_fprintf(file, "; ");
|
||||
fmpz_fprint(file, &g->c); flint_fprintf(file, " ");
|
||||
fmpz_fprint(file, &g->d); flint_fprintf(file, "]");
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
psl2z_print(const psl2z_t g)
|
||||
{
|
||||
flint_printf("[");
|
||||
fmpz_print(&g->a); flint_printf(" ");
|
||||
fmpz_print(&g->b); flint_printf("; ");
|
||||
fmpz_print(&g->c); flint_printf(" ");
|
||||
fmpz_print(&g->d); flint_printf("]");
|
||||
psl2z_fprint(stdout, g);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#define ACB_POLY_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "acb.h"
|
||||
#include "arb_poly.h"
|
||||
|
||||
|
@ -129,7 +130,13 @@ void _acb_poly_majorant(arb_ptr res, acb_srcptr vec, slong len, slong prec);
|
|||
|
||||
void acb_poly_majorant(arb_poly_t res, const acb_poly_t poly, slong prec);
|
||||
|
||||
void acb_poly_printd(const acb_poly_t poly, slong digits);
|
||||
void acb_poly_fprintd(FILE * file, const acb_poly_t poly, slong digits);
|
||||
|
||||
ACB_POLY_INLINE void
|
||||
acb_poly_printd(const acb_poly_t poly, slong digits)
|
||||
{
|
||||
acb_poly_fprintd(stdout, poly, digits);
|
||||
}
|
||||
|
||||
void _acb_poly_evaluate_horner(acb_t res, acb_srcptr f, slong len, const acb_t a, slong prec);
|
||||
void acb_poly_evaluate_horner(acb_t res, const acb_poly_t f, const acb_t a, slong prec);
|
||||
|
|
|
@ -20,24 +20,25 @@
|
|||
/******************************************************************************
|
||||
|
||||
Copyright (C) 2012 Fredrik Johansson
|
||||
Copyright (C) 2015 Arb authors
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "acb_poly.h"
|
||||
|
||||
void
|
||||
acb_poly_printd(const acb_poly_t poly, slong digits)
|
||||
acb_poly_fprintd(FILE * file, const acb_poly_t poly, slong digits)
|
||||
{
|
||||
slong i;
|
||||
|
||||
flint_printf("[");
|
||||
flint_fprintf(file, "[");
|
||||
|
||||
for (i = 0; i < poly->length; i++)
|
||||
{
|
||||
acb_printd(poly->coeffs + i, digits);
|
||||
acb_fprintd(file, poly->coeffs + i, digits);
|
||||
if (i + 1 < poly->length)
|
||||
flint_printf("\n");
|
||||
flint_fprintf(file, "\n");
|
||||
}
|
||||
|
||||
flint_printf("]");
|
||||
flint_fprintf(file, "]");
|
||||
}
|
25
arb.h
25
arb.h
|
@ -32,6 +32,7 @@
|
|||
#define ARB_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "fmprb.h"
|
||||
#include "mag.h"
|
||||
#include "arf.h"
|
||||
|
@ -269,11 +270,29 @@ arb_one(arb_t f)
|
|||
mag_zero(arb_radref(f));
|
||||
}
|
||||
|
||||
void arb_print(const arb_t x);
|
||||
void arb_fprint(FILE * file, const arb_t x);
|
||||
|
||||
void arb_printd(const arb_t x, slong digits);
|
||||
void arb_fprintd(FILE * file, const arb_t x, slong digits);
|
||||
|
||||
void arb_printn(const arb_t x, slong digits, ulong flags);
|
||||
void arb_fprintn(FILE * file, const arb_t x, slong digits, ulong flags);
|
||||
|
||||
ARB_INLINE void
|
||||
arb_print(const arb_t x)
|
||||
{
|
||||
arb_fprint(stdout, x);
|
||||
}
|
||||
|
||||
ARB_INLINE void
|
||||
arb_printd(const arb_t x, slong digits)
|
||||
{
|
||||
arb_fprintd(stdout, x, digits);
|
||||
}
|
||||
|
||||
ARB_INLINE void
|
||||
arb_printn(const arb_t x, slong digits, ulong flags)
|
||||
{
|
||||
arb_fprintn(stdout, x, digits, flags);
|
||||
}
|
||||
|
||||
ARB_INLINE void
|
||||
arb_mul_2exp_si(arb_t y, const arb_t x, slong e)
|
||||
|
|
|
@ -20,32 +20,33 @@
|
|||
/******************************************************************************
|
||||
|
||||
Copyright (C) 2015 Fredrik Johansson
|
||||
Copyright (C) 2015 Arb authors
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "arb.h"
|
||||
|
||||
void
|
||||
arb_print(const arb_t x)
|
||||
arb_fprint(FILE * file, const arb_t x)
|
||||
{
|
||||
arf_print(arb_midref(x));
|
||||
flint_printf(" +/- ");
|
||||
mag_print(arb_radref(x));
|
||||
arf_fprint(file, arb_midref(x));
|
||||
flint_fprintf(file, " +/- ");
|
||||
mag_fprint(file, arb_radref(x));
|
||||
}
|
||||
|
||||
void
|
||||
arb_printd(const arb_t x, slong digits)
|
||||
arb_fprintd(FILE * file, const arb_t x, slong digits)
|
||||
{
|
||||
arf_printd(arb_midref(x), FLINT_MAX(digits, 1));
|
||||
flint_printf(" +/- ");
|
||||
mag_printd(arb_radref(x), 5);
|
||||
arf_fprintd(file, arb_midref(x), FLINT_MAX(digits, 1));
|
||||
flint_fprintf(file, " +/- ");
|
||||
mag_fprintd(file, arb_radref(x), 5);
|
||||
}
|
||||
|
||||
void
|
||||
arb_printn(const arb_t x, slong digits, ulong flags)
|
||||
arb_fprintn(FILE * file, const arb_t x, slong digits, ulong flags)
|
||||
{
|
||||
char * s = arb_get_str(x, digits, flags);
|
||||
flint_printf("%s", s);
|
||||
flint_fprintf(file, "%s", s);
|
||||
flint_free(s);
|
||||
}
|
||||
|
17
arb_calc.h
17
arb_calc.h
|
@ -26,6 +26,7 @@
|
|||
#ifndef ARB_CALC_H
|
||||
#define ARB_CALC_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "arb.h"
|
||||
#include "arb_poly.h"
|
||||
#include "arb_mat.h"
|
||||
|
@ -111,14 +112,20 @@ arf_interval_get_arb(arb_t x, const arf_interval_t v, slong prec)
|
|||
arb_set_interval_arf(x, &v->a, &v->b, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
arf_interval_fprintd(FILE * file, const arf_interval_t v, slong n)
|
||||
{
|
||||
flint_fprintf(file, "[");
|
||||
arf_fprintd(file, &v->a, n);
|
||||
flint_fprintf(file, ", ");
|
||||
arf_fprintd(file, &v->b, n);
|
||||
flint_fprintf(file, "]");
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
arf_interval_printd(const arf_interval_t v, slong n)
|
||||
{
|
||||
flint_printf("[");
|
||||
arf_printd(&v->a, n);
|
||||
flint_printf(", ");
|
||||
arf_printd(&v->b, n);
|
||||
flint_printf("]");
|
||||
arf_interval_fprintd(stdout, v, n);
|
||||
}
|
||||
|
||||
/* bisection */
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#define ARB_MAT_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "arb.h"
|
||||
#include "fmpz_mat.h"
|
||||
#include "fmpq_mat.h"
|
||||
|
@ -93,7 +94,13 @@ void arb_mat_randtest(arb_mat_t mat, flint_rand_t state, slong prec, slong mag_b
|
|||
|
||||
/* I/O */
|
||||
|
||||
void arb_mat_printd(const arb_mat_t mat, slong digits);
|
||||
void arb_mat_fprintd(FILE * file, const arb_mat_t mat, slong digits);
|
||||
|
||||
ARB_MAT_INLINE void
|
||||
arb_mat_printd(const arb_mat_t mat, slong digits)
|
||||
{
|
||||
arb_mat_fprintd(stdout, mat, digits);
|
||||
}
|
||||
|
||||
/* Comparisons */
|
||||
|
||||
|
|
|
@ -20,28 +20,29 @@
|
|||
/******************************************************************************
|
||||
|
||||
Copyright (C) 2012 Fredrik Johansson
|
||||
Copyright (C) 2015 Arb authors
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "arb_mat.h"
|
||||
|
||||
void
|
||||
arb_mat_printd(const arb_mat_t mat, slong digits)
|
||||
arb_mat_fprintd(FILE * file, const arb_mat_t mat, slong digits)
|
||||
{
|
||||
slong i, j;
|
||||
|
||||
for (i = 0; i < arb_mat_nrows(mat); i++)
|
||||
{
|
||||
flint_printf("[");
|
||||
flint_fprintf(file, "[");
|
||||
|
||||
for (j = 0; j < arb_mat_ncols(mat); j++)
|
||||
{
|
||||
arb_printd(arb_mat_entry(mat, i, j), digits);
|
||||
arb_fprintd(file, arb_mat_entry(mat, i, j), digits);
|
||||
|
||||
if (j < arb_mat_ncols(mat) - 1)
|
||||
flint_printf(", ");
|
||||
flint_fprintf(file, ", ");
|
||||
}
|
||||
|
||||
flint_printf("]\n");
|
||||
flint_fprintf(file, "]\n");
|
||||
}
|
||||
}
|
|
@ -32,6 +32,7 @@
|
|||
#define ARB_POLY_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "arb.h"
|
||||
#include "acb.h"
|
||||
#include "fmpz_poly.h"
|
||||
|
@ -175,7 +176,13 @@ void arb_poly_majorant(arb_poly_t res, const arb_poly_t poly, slong prec);
|
|||
|
||||
/* IO */
|
||||
|
||||
void arb_poly_printd(const arb_poly_t poly, slong digits);
|
||||
void arb_poly_fprintd(FILE * file, const arb_poly_t poly, slong digits);
|
||||
|
||||
ARB_POLY_INLINE void
|
||||
arb_poly_printd(const arb_poly_t poly, slong digits)
|
||||
{
|
||||
arb_poly_fprintd(stdout, poly, digits);
|
||||
}
|
||||
|
||||
/* Random generation */
|
||||
|
||||
|
|
|
@ -20,27 +20,28 @@
|
|||
/******************************************************************************
|
||||
|
||||
Copyright (C) 2012 Fredrik Johansson
|
||||
Copyright (C) 2015 Arb authors
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "arb_poly.h"
|
||||
|
||||
void
|
||||
arb_poly_printd(const arb_poly_t poly, slong digits)
|
||||
arb_poly_fprintd(FILE * file, const arb_poly_t poly, slong digits)
|
||||
{
|
||||
slong i;
|
||||
|
||||
flint_printf("[");
|
||||
flint_fprintf(file, "[");
|
||||
|
||||
for (i = 0; i < poly->length; i++)
|
||||
{
|
||||
flint_printf("(");
|
||||
arb_printd(poly->coeffs + i, digits);
|
||||
flint_printf(")");
|
||||
flint_fprintf(file, "(");
|
||||
arb_fprintd(file, poly->coeffs + i, digits);
|
||||
flint_fprintf(file, ")");
|
||||
|
||||
if (i + 1 < poly->length)
|
||||
flint_printf(", ");
|
||||
flint_fprintf(file, ", ");
|
||||
}
|
||||
|
||||
flint_printf("]");
|
||||
flint_fprintf(file, "]");
|
||||
}
|
17
arf.h
17
arf.h
|
@ -35,6 +35,7 @@
|
|||
#define ARF_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "flint.h"
|
||||
#include "fmpr.h"
|
||||
|
@ -827,9 +828,21 @@ void arf_ceil(arf_t z, const arf_t x);
|
|||
|
||||
void arf_debug(const arf_t x);
|
||||
|
||||
void arf_print(const arf_t x);
|
||||
void arf_fprint(FILE * file, const arf_t x);
|
||||
|
||||
void arf_printd(const arf_t y, slong d);
|
||||
void arf_fprintd(FILE * file, const arf_t y, slong d);
|
||||
|
||||
ARF_INLINE void
|
||||
arf_print(const arf_t x)
|
||||
{
|
||||
arf_fprint(stdout, x);
|
||||
}
|
||||
|
||||
ARF_INLINE void
|
||||
arf_printd(const arf_t y, slong d)
|
||||
{
|
||||
arf_fprintd(stdout, y, d);
|
||||
}
|
||||
|
||||
void arf_randtest(arf_t x, flint_rand_t state, slong bits, slong mag_bits);
|
||||
|
||||
|
|
|
@ -20,13 +20,14 @@
|
|||
/******************************************************************************
|
||||
|
||||
Copyright (C) 2012 Fredrik Johansson
|
||||
Copyright (C) 2015 Arb authors
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "arf.h"
|
||||
|
||||
void
|
||||
arf_print(const arf_t x)
|
||||
arf_fprint(FILE * file, const arf_t x)
|
||||
{
|
||||
if (arf_is_normal(x))
|
||||
{
|
||||
|
@ -37,31 +38,31 @@ arf_print(const arf_t x)
|
|||
|
||||
arf_get_fmpz_2exp(man, exp, x);
|
||||
|
||||
flint_printf("(");
|
||||
fmpz_print(man);
|
||||
flint_printf(" * 2^");
|
||||
fmpz_print(exp);
|
||||
flint_printf(")");
|
||||
flint_fprintf(file, "(");
|
||||
fmpz_fprint(file, man);
|
||||
flint_fprintf(file, " * 2^");
|
||||
fmpz_fprint(file, exp);
|
||||
flint_fprintf(file, ")");
|
||||
|
||||
fmpz_clear(man);
|
||||
fmpz_clear(exp);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (arf_is_zero(x)) flint_printf("(0)");
|
||||
else if (arf_is_pos_inf(x)) flint_printf("(+inf)");
|
||||
else if (arf_is_neg_inf(x)) flint_printf("(-inf)");
|
||||
else flint_printf("(nan)");
|
||||
if (arf_is_zero(x)) flint_fprintf(file, "(0)");
|
||||
else if (arf_is_pos_inf(x)) flint_fprintf(file, "(+inf)");
|
||||
else if (arf_is_neg_inf(x)) flint_fprintf(file, "(-inf)");
|
||||
else flint_fprintf(file, "(nan)");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
arf_printd(const arf_t x, slong d)
|
||||
arf_fprintd(FILE * file, const arf_t x, slong d)
|
||||
{
|
||||
if (arf_is_finite(x) && (ARF_EXP(x) <= MPFR_EMIN_MIN + 1 ||
|
||||
ARF_EXP(x) >= MPFR_EMAX_MAX - 1))
|
||||
{
|
||||
arf_print(x);
|
||||
arf_fprint(file, x);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -70,7 +71,7 @@ arf_printd(const arf_t x, slong d)
|
|||
mpfr_set_emin(MPFR_EMIN_MIN);
|
||||
mpfr_set_emax(MPFR_EMAX_MAX);
|
||||
arf_get_mpfr(t, x, MPFR_RNDN);
|
||||
mpfr_printf("%.*Rg", FLINT_MAX(d, 1), t);
|
||||
mpfr_fprintf(file, "%.*Rg", FLINT_MAX(d, 1), t);
|
||||
mpfr_clear(t);
|
||||
}
|
||||
}
|
|
@ -158,6 +158,17 @@ Input and output
|
|||
to compensate for the fact that the binary-to-decimal conversion
|
||||
of both the midpoint and the radius introduces additional error.
|
||||
|
||||
.. function:: void acb_fprint(FILE * file, const acb_t x)
|
||||
|
||||
Prints the internal representation of *x* to the stream *file*.
|
||||
|
||||
.. function:: void acb_fprintd(FILE * file, const acb_t z, slong digits)
|
||||
|
||||
Prints *x* in decimal to the stream *file*.
|
||||
The printed value of the radius is not adjusted
|
||||
to compensate for the fact that the binary-to-decimal conversion
|
||||
of both the midpoint and the radius introduces additional error.
|
||||
|
||||
|
||||
Random number generation
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
|
@ -85,6 +85,11 @@ Input and output
|
|||
|
||||
Prints each entry in the matrix with the specified number of decimal digits.
|
||||
|
||||
.. function:: void acb_mat_fprintd(FILE * file, const acb_mat_t mat, slong digits)
|
||||
|
||||
Prints each entry in the matrix with the specified number of decimal
|
||||
digits to the stream *file*.
|
||||
|
||||
Comparisons
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -68,6 +68,10 @@ The modular group
|
|||
|
||||
Prints *g* to standard output.
|
||||
|
||||
.. function:: void psl2z_fprint(FILE * file, const psl2z_t g)
|
||||
|
||||
Prints *g* to the stream *file*.
|
||||
|
||||
.. function:: int psl2z_equal(const psl2z_t f, const psl2z_t g)
|
||||
|
||||
Returns nonzero iff *f* and *g* are equal.
|
||||
|
|
|
@ -134,7 +134,12 @@ Input and output
|
|||
.. function:: void acb_poly_printd(const acb_poly_t poly, slong digits)
|
||||
|
||||
Prints the polynomial as an array of coefficients, printing each
|
||||
coefficient using *arb_printd*.
|
||||
coefficient using *acb_printd*.
|
||||
|
||||
.. function:: void acb_poly_fprintd(FILE * file, const acb_poly_t poly, slong digits)
|
||||
|
||||
Prints the polynomial as an array of coefficients to the stream *file*,
|
||||
printing each coefficient using *acb_fprintd*.
|
||||
|
||||
Random generation
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
|
@ -243,6 +243,24 @@ Input and output
|
|||
in the last digit. An error bound is also printed explicitly.
|
||||
See :func:`arb_get_str` for details.
|
||||
|
||||
.. function:: void arb_fprint(FILE * file, const arb_t x)
|
||||
|
||||
Prints the internal representation of *x* to the stream *file*.
|
||||
|
||||
.. function:: void arb_fprintd(FILE * file, const arb_t x, slong digits)
|
||||
|
||||
Prints *x* in decimal to the stream *file*.
|
||||
The printed value of the radius is not adjusted
|
||||
to compensate for the fact that the binary-to-decimal conversion
|
||||
of both the midpoint and the radius introduces additional error.
|
||||
|
||||
.. function:: void arb_fprintn(FILE * file, const arb_t x, slong digits, ulong flags)
|
||||
|
||||
Prints a nice decimal representation of *x* to the stream *file*.
|
||||
By default, the output is guaranteed to be correct to within one unit
|
||||
in the last digit. An error bound is also printed explicitly.
|
||||
See :func:`arb_get_str` for details.
|
||||
|
||||
Random number generation
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -105,6 +105,10 @@ Subdivision-based root finding
|
|||
|
||||
Helper functions for endpoint-based intervals.
|
||||
|
||||
.. function:: void arf_interval_fprintd(FILE * file, const arf_interval_t v, slong n)
|
||||
|
||||
Helper functions for endpoint-based intervals.
|
||||
|
||||
.. function:: slong arb_calc_isolate_roots(arf_interval_ptr * found, int ** flags, arb_calc_func_t func, void * param, const arf_interval_t interval, slong maxdepth, slong maxeval, slong maxfound, slong prec)
|
||||
|
||||
Rigorously isolates single roots of a real analytic function
|
||||
|
|
|
@ -81,6 +81,11 @@ Input and output
|
|||
|
||||
Prints each entry in the matrix with the specified number of decimal digits.
|
||||
|
||||
.. function:: void arb_mat_fprintd(FILE * file, const arb_mat_t mat, slong digits)
|
||||
|
||||
Prints each entry in the matrix with the specified number of decimal
|
||||
digits to the stream *file*.
|
||||
|
||||
Comparisons
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -142,6 +142,11 @@ Input and output
|
|||
Prints the polynomial as an array of coefficients, printing each
|
||||
coefficient using *arb_printd*.
|
||||
|
||||
.. function:: void arb_poly_fprintd(FILE * file, const arb_poly_t poly, slong digits)
|
||||
|
||||
Prints the polynomial as an array of coefficients to the stream *file*,
|
||||
printing each coefficient using *arb_fprintd*.
|
||||
|
||||
|
||||
Random generation
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
|
@ -457,6 +457,16 @@ Input and output
|
|||
This function is currently implemented using MPFR,
|
||||
and does not support large exponents.
|
||||
|
||||
.. function:: void arf_fprint(FILE * file, const arf_t x)
|
||||
|
||||
Prints *x* as an integer mantissa and exponent to the stream *file*.
|
||||
|
||||
.. function:: void arf_fprintd(FILE * file, const arf_t y, slong d)
|
||||
|
||||
Prints *x* as a decimal floating-point number to the stream *file*,
|
||||
rounding to *d* digits. This function is currently implemented using MPFR,
|
||||
and does not support large exponents.
|
||||
|
||||
Addition and multiplication
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -120,6 +120,10 @@ Input and output
|
|||
|
||||
Prints *x* to standard output.
|
||||
|
||||
.. function:: void mag_fprint(FILE * file, const mag_t x)
|
||||
|
||||
Prints *x* to the stream *file*.
|
||||
|
||||
Random generation
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
|
17
mag.h
17
mag.h
|
@ -32,6 +32,7 @@
|
|||
#define MAG_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "flint.h"
|
||||
#include "fmpz.h"
|
||||
|
@ -486,9 +487,21 @@ void mag_randtest_special(mag_t x, flint_rand_t state, slong expbits);
|
|||
|
||||
void mag_randtest(mag_t x, flint_rand_t state, slong expbits);
|
||||
|
||||
void mag_print(const mag_t x);
|
||||
void mag_fprint(FILE * file, const mag_t x);
|
||||
|
||||
void mag_printd(const mag_t x, slong d);
|
||||
void mag_fprintd(FILE * file, const mag_t x, slong d);
|
||||
|
||||
MAG_INLINE void
|
||||
mag_print(const mag_t x)
|
||||
{
|
||||
mag_fprint(stdout, x);
|
||||
}
|
||||
|
||||
MAG_INLINE void
|
||||
mag_printd(const mag_t x, slong d)
|
||||
{
|
||||
mag_fprintd(stdout, x, d);
|
||||
}
|
||||
|
||||
void mag_get_fmpq(fmpq_t y, const mag_t x);
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
/******************************************************************************
|
||||
|
||||
Copyright (C) 2014 Fredrik Johansson
|
||||
Copyright (C) 2015 Arb authors
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
|
@ -27,32 +28,31 @@
|
|||
#include "arf.h"
|
||||
|
||||
void
|
||||
mag_print(const mag_t x)
|
||||
mag_fprint(FILE * file, const mag_t x)
|
||||
{
|
||||
flint_printf("(");
|
||||
flint_fprintf(file, "(");
|
||||
if (mag_is_zero(x))
|
||||
flint_printf("0");
|
||||
flint_fprintf(file, "0");
|
||||
else if (mag_is_inf(x))
|
||||
flint_printf("inf");
|
||||
flint_fprintf(file, "inf");
|
||||
else
|
||||
{
|
||||
fmpz_t t;
|
||||
fmpz_init(t);
|
||||
fmpz_sub_ui(t, MAG_EXPREF(x), MAG_BITS);
|
||||
flint_printf("%wu * 2^", MAG_MAN(x));
|
||||
fmpz_print(t);
|
||||
flint_fprintf(file, "%wu * 2^", MAG_MAN(x));
|
||||
fmpz_fprint(file, t);
|
||||
fmpz_clear(t);
|
||||
}
|
||||
flint_printf(")");
|
||||
flint_fprintf(file, ")");
|
||||
}
|
||||
|
||||
void
|
||||
mag_printd(const mag_t x, slong d)
|
||||
mag_fprintd(FILE * file, const mag_t x, slong d)
|
||||
{
|
||||
arf_t t;
|
||||
arf_init(t);
|
||||
arf_set_mag(t, x);
|
||||
arf_printd(t, d);
|
||||
arf_fprintd(file, t, d);
|
||||
arf_clear(t);
|
||||
}
|
||||
|
Loading…
Add table
Reference in a new issue