mirror of
https://github.com/vale981/arb
synced 2025-03-04 17:01:40 -05:00
add inline functions to library
This commit is contained in:
parent
0e014342af
commit
d7a1a84f25
16 changed files with 604 additions and 332 deletions
194
acb.h
194
acb.h
|
@ -26,6 +26,12 @@
|
|||
#ifndef ACB_H
|
||||
#define ACB_H
|
||||
|
||||
#ifdef ACB_INLINES_C
|
||||
#define ACB_INLINE
|
||||
#else
|
||||
#define ACB_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include "arf.h"
|
||||
#include "arb.h"
|
||||
|
||||
|
@ -48,21 +54,21 @@ typedef const acb_struct * acb_srcptr;
|
|||
#define acb_imagref(x) (&(x)->imag)
|
||||
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_init(acb_t x)
|
||||
{
|
||||
arb_init(acb_realref(x));
|
||||
arb_init(acb_imagref(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_clear(acb_t x)
|
||||
{
|
||||
arb_clear(acb_realref(x));
|
||||
arb_clear(acb_imagref(x));
|
||||
}
|
||||
|
||||
static __inline__ acb_ptr
|
||||
ACB_INLINE acb_ptr
|
||||
_acb_vec_init(long n)
|
||||
{
|
||||
long i;
|
||||
|
@ -74,7 +80,7 @@ _acb_vec_init(long n)
|
|||
return v;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_clear(acb_ptr v, long n)
|
||||
{
|
||||
long i;
|
||||
|
@ -83,173 +89,173 @@ _acb_vec_clear(acb_ptr v, long n)
|
|||
flint_free(v);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ACB_INLINE int
|
||||
acb_is_zero(const acb_t z)
|
||||
{
|
||||
return arb_is_zero(acb_realref(z)) && arb_is_zero(acb_imagref(z));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ACB_INLINE int
|
||||
acb_is_one(const acb_t z)
|
||||
{
|
||||
return arb_is_one(acb_realref(z)) && arb_is_zero(acb_imagref(z));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ACB_INLINE int
|
||||
acb_is_exact(const acb_t z)
|
||||
{
|
||||
return arb_is_exact(acb_realref(z)) && arb_is_exact(acb_imagref(z));
|
||||
}
|
||||
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_zero(acb_t z)
|
||||
{
|
||||
arb_zero(acb_realref(z));
|
||||
arb_zero(acb_imagref(z));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_one(acb_t z)
|
||||
{
|
||||
arb_one(acb_realref(z));
|
||||
arb_zero(acb_imagref(z));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_onei(acb_t z)
|
||||
{
|
||||
arb_zero(acb_realref(z));
|
||||
arb_one(acb_imagref(z));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_set(acb_t z, const acb_t x)
|
||||
{
|
||||
arb_set(acb_realref(z), acb_realref(x));
|
||||
arb_set(acb_imagref(z), acb_imagref(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_set_round(acb_t z, const acb_t x, long prec)
|
||||
{
|
||||
arb_set_round(acb_realref(z), acb_realref(x), prec);
|
||||
arb_set_round(acb_imagref(z), acb_imagref(x), prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_neg_round(acb_t z, const acb_t x, long prec)
|
||||
{
|
||||
arb_neg_round(acb_realref(z), acb_realref(x), prec);
|
||||
arb_neg_round(acb_imagref(z), acb_imagref(x), prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_swap(acb_t z, acb_t x)
|
||||
{
|
||||
arb_swap(acb_realref(z), acb_realref(x));
|
||||
arb_swap(acb_imagref(z), acb_imagref(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ACB_INLINE int
|
||||
acb_equal(const acb_t x, const acb_t y)
|
||||
{
|
||||
return arb_equal(acb_realref(x), acb_realref(y)) &&
|
||||
arb_equal(acb_imagref(x), acb_imagref(y));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ACB_INLINE int
|
||||
acb_overlaps(const acb_t x, const acb_t y)
|
||||
{
|
||||
return arb_overlaps(acb_realref(x), acb_realref(y)) &&
|
||||
arb_overlaps(acb_imagref(x), acb_imagref(y));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ACB_INLINE int
|
||||
acb_contains_zero(const acb_t x)
|
||||
{
|
||||
return arb_contains_zero(acb_realref(x)) &&
|
||||
arb_contains_zero(acb_imagref(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ACB_INLINE int
|
||||
acb_contains_fmpq(const acb_t x, const fmpq_t y)
|
||||
{
|
||||
return arb_contains_fmpq(acb_realref(x), y) &&
|
||||
arb_contains_zero(acb_imagref(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ACB_INLINE int
|
||||
acb_contains_fmpz(const acb_t x, const fmpz_t y)
|
||||
{
|
||||
return arb_contains_fmpz(acb_realref(x), y) &&
|
||||
arb_contains_zero(acb_imagref(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ACB_INLINE int
|
||||
acb_contains(const acb_t x, const acb_t y)
|
||||
{
|
||||
return arb_contains(acb_realref(x), acb_realref(y)) &&
|
||||
arb_contains(acb_imagref(x), acb_imagref(y));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_set_ui(acb_t z, ulong c)
|
||||
{
|
||||
arb_set_ui(acb_realref(z), c);
|
||||
arb_zero(acb_imagref(z));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_set_si(acb_t z, long c)
|
||||
{
|
||||
arb_set_si(acb_realref(z), c);
|
||||
arb_zero(acb_imagref(z));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_set_fmpz(acb_t z, const fmpz_t c)
|
||||
{
|
||||
arb_set_fmpz(acb_realref(z), c);
|
||||
arb_zero(acb_imagref(z));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_set_round_fmpz(acb_t z, const fmpz_t y, long prec)
|
||||
{
|
||||
arb_set_round_fmpz(acb_realref(z), y, prec);
|
||||
arb_zero(acb_imagref(z));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_set_fmpq(acb_t z, const fmpq_t c, long prec)
|
||||
{
|
||||
arb_set_fmpq(acb_realref(z), c, prec);
|
||||
arb_zero(acb_imagref(z));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_set_arb(acb_t z, const arb_t c)
|
||||
{
|
||||
arb_set(acb_realref(z), c);
|
||||
arb_zero(acb_imagref(z));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_set_round_arb(acb_t z, const arb_t x, long prec)
|
||||
{
|
||||
arb_set_round(acb_realref(z), x, prec);
|
||||
arb_zero(acb_imagref(z));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_trim(acb_t z, const acb_t x)
|
||||
{
|
||||
arb_trim(acb_realref(z), acb_realref(x));
|
||||
arb_trim(acb_imagref(z), acb_imagref(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_add_error_arf(acb_t x, const arf_t err)
|
||||
{
|
||||
arb_add_error_arf(acb_realref(x), err);
|
||||
|
@ -257,7 +263,7 @@ acb_add_error_arf(acb_t x, const arf_t err)
|
|||
}
|
||||
|
||||
/* TODO: document */
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_add_error_mag(acb_t x, const mag_t err)
|
||||
{
|
||||
arb_add_error_mag(acb_realref(x), err);
|
||||
|
@ -268,7 +274,7 @@ void acb_get_mag(mag_t z, const acb_t x);
|
|||
|
||||
void acb_get_mag_lower(mag_t z, const acb_t x);
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_get_abs_ubound_arf(arf_t u, const acb_t z, long prec)
|
||||
{
|
||||
if (arb_is_zero(acb_imagref(z)))
|
||||
|
@ -296,7 +302,7 @@ acb_get_abs_ubound_arf(arf_t u, const acb_t z, long prec)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_get_abs_lbound_arf(arf_t u, const acb_t z, long prec)
|
||||
{
|
||||
if (arb_is_zero(acb_imagref(z)))
|
||||
|
@ -324,7 +330,7 @@ acb_get_abs_lbound_arf(arf_t u, const acb_t z, long prec)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_get_rad_ubound_arf(arf_t u, const acb_t z, long prec)
|
||||
{
|
||||
/* fixme: this bound is very sloppy */
|
||||
|
@ -339,111 +345,111 @@ acb_get_rad_ubound_arf(arf_t u, const acb_t z, long prec)
|
|||
|
||||
void acb_arg(arb_t r, const acb_t z, long prec);
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_add(acb_t z, const acb_t x, const acb_t y, long prec)
|
||||
{
|
||||
arb_add(acb_realref(z), acb_realref(x), acb_realref(y), prec);
|
||||
arb_add(acb_imagref(z), acb_imagref(x), acb_imagref(y), prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_sub(acb_t z, const acb_t x, const acb_t y, long prec)
|
||||
{
|
||||
arb_sub(acb_realref(z), acb_realref(x), acb_realref(y), prec);
|
||||
arb_sub(acb_imagref(z), acb_imagref(x), acb_imagref(y), prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_add_ui(acb_t z, const acb_t x, ulong c, long prec)
|
||||
{
|
||||
arb_add_ui(acb_realref(z), acb_realref(x), c, prec);
|
||||
arb_set_round(acb_imagref(z), acb_imagref(x), prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_sub_ui(acb_t z, const acb_t x, ulong c, long prec)
|
||||
{
|
||||
arb_sub_ui(acb_realref(z), acb_realref(x), c, prec);
|
||||
arb_set_round(acb_imagref(z), acb_imagref(x), prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_add_fmpz(acb_t z, const acb_t x, const fmpz_t y, long prec)
|
||||
{
|
||||
arb_add_fmpz(acb_realref(z), acb_realref(x), y, prec);
|
||||
arb_set_round(acb_imagref(z), acb_imagref(x), prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_add_arb(acb_t z, const acb_t x, const arb_t y, long prec)
|
||||
{
|
||||
arb_add(acb_realref(z), acb_realref(x), y, prec);
|
||||
arb_set_round(acb_imagref(z), acb_imagref(x), prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_sub_fmpz(acb_t z, const acb_t x, const fmpz_t y, long prec)
|
||||
{
|
||||
arb_sub_fmpz(acb_realref(z), acb_realref(x), y, prec);
|
||||
arb_set_round(acb_imagref(z), acb_imagref(x), prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_sub_arb(acb_t z, const acb_t x, const arb_t y, long prec)
|
||||
{
|
||||
arb_sub(acb_realref(z), acb_realref(x), y, prec);
|
||||
arb_set_round(acb_imagref(z), acb_imagref(x), prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_neg(acb_t z, const acb_t x)
|
||||
{
|
||||
arb_neg(acb_realref(z), acb_realref(x));
|
||||
arb_neg(acb_imagref(z), acb_imagref(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_conj(acb_t z, const acb_t x)
|
||||
{
|
||||
arb_set(acb_realref(z), acb_realref(x));
|
||||
arb_neg(acb_imagref(z), acb_imagref(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_abs(arb_t u, const acb_t z, long prec)
|
||||
{
|
||||
arb_hypot(u, acb_realref(z), acb_imagref(z), prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_mul_ui(acb_t z, const acb_t x, ulong y, long prec)
|
||||
{
|
||||
arb_mul_ui(acb_realref(z), acb_realref(x), y, prec);
|
||||
arb_mul_ui(acb_imagref(z), acb_imagref(x), y, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_mul_si(acb_t z, const acb_t x, long y, long prec)
|
||||
{
|
||||
arb_mul_si(acb_realref(z), acb_realref(x), y, prec);
|
||||
arb_mul_si(acb_imagref(z), acb_imagref(x), y, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_mul_fmpz(acb_t z, const acb_t x, const fmpz_t y, long prec)
|
||||
{
|
||||
arb_mul_fmpz(acb_realref(z), acb_realref(x), y, prec);
|
||||
arb_mul_fmpz(acb_imagref(z), acb_imagref(x), y, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_mul_arb(acb_t z, const acb_t x, const arb_t y, long prec)
|
||||
{
|
||||
arb_mul(acb_realref(z), acb_realref(x), y, prec);
|
||||
arb_mul(acb_imagref(z), acb_imagref(x), y, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_mul_onei(acb_t z, const acb_t x)
|
||||
{
|
||||
if (z == x)
|
||||
|
@ -462,14 +468,14 @@ void acb_mul(acb_t z, const acb_t x, const acb_t y, long prec);
|
|||
|
||||
void acb_mul_naive(acb_t z, const acb_t x, const acb_t y, long prec);
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_mul_2exp_si(acb_t z, const acb_t x, long e)
|
||||
{
|
||||
arb_mul_2exp_si(acb_realref(z), acb_realref(x), e);
|
||||
arb_mul_2exp_si(acb_imagref(z), acb_imagref(x), e);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_mul_2exp_fmpz(acb_t z, const acb_t x, const fmpz_t c)
|
||||
{
|
||||
arb_mul_2exp_fmpz(acb_realref(z), acb_realref(x), c);
|
||||
|
@ -480,56 +486,56 @@ void acb_addmul(acb_t z, const acb_t x, const acb_t y, long prec);
|
|||
|
||||
void acb_submul(acb_t z, const acb_t x, const acb_t y, long prec);
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_addmul_ui(acb_t z, const acb_t x, ulong y, long prec)
|
||||
{
|
||||
arb_addmul_ui(acb_realref(z), acb_realref(x), y, prec);
|
||||
arb_addmul_ui(acb_imagref(z), acb_imagref(x), y, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_addmul_si(acb_t z, const acb_t x, long y, long prec)
|
||||
{
|
||||
arb_addmul_si(acb_realref(z), acb_realref(x), y, prec);
|
||||
arb_addmul_si(acb_imagref(z), acb_imagref(x), y, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_submul_ui(acb_t z, const acb_t x, ulong y, long prec)
|
||||
{
|
||||
arb_submul_ui(acb_realref(z), acb_realref(x), y, prec);
|
||||
arb_submul_ui(acb_imagref(z), acb_imagref(x), y, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_submul_si(acb_t z, const acb_t x, long y, long prec)
|
||||
{
|
||||
arb_submul_si(acb_realref(z), acb_realref(x), y, prec);
|
||||
arb_submul_si(acb_imagref(z), acb_imagref(x), y, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_addmul_fmpz(acb_t z, const acb_t x, const fmpz_t y, long prec)
|
||||
{
|
||||
arb_addmul_fmpz(acb_realref(z), acb_realref(x), y, prec);
|
||||
arb_addmul_fmpz(acb_imagref(z), acb_imagref(x), y, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_submul_fmpz(acb_t z, const acb_t x, const fmpz_t y, long prec)
|
||||
{
|
||||
arb_submul_fmpz(acb_realref(z), acb_realref(x), y, prec);
|
||||
arb_submul_fmpz(acb_imagref(z), acb_imagref(x), y, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_addmul_arb(acb_t z, const acb_t x, const arb_t y, long prec)
|
||||
{
|
||||
arb_addmul(acb_realref(z), acb_realref(x), y, prec);
|
||||
arb_addmul(acb_imagref(z), acb_imagref(x), y, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_submul_arb(acb_t z, const acb_t x, const arb_t y, long prec)
|
||||
{
|
||||
arb_submul(acb_realref(z), acb_realref(x), y, prec);
|
||||
|
@ -540,28 +546,28 @@ void acb_inv(acb_t z, const acb_t x, long prec);
|
|||
|
||||
void acb_div(acb_t z, const acb_t x, const acb_t y, long prec);
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_div_ui(acb_t z, const acb_t x, ulong c, long prec)
|
||||
{
|
||||
arb_div_ui(acb_realref(z), acb_realref(x), c, prec);
|
||||
arb_div_ui(acb_imagref(z), acb_imagref(x), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_div_si(acb_t z, const acb_t x, long c, long prec)
|
||||
{
|
||||
arb_div_si(acb_realref(z), acb_realref(x), c, prec);
|
||||
arb_div_si(acb_imagref(z), acb_imagref(x), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_div_arb(acb_t z, const acb_t x, const arb_t c, long prec)
|
||||
{
|
||||
arb_div(acb_realref(z), acb_realref(x), c, prec);
|
||||
arb_div(acb_imagref(z), acb_imagref(x), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_div_fmpz(acb_t z, const acb_t x, const fmpz_t c, long prec)
|
||||
{
|
||||
arb_div_fmpz(acb_realref(z), acb_realref(x), c, prec);
|
||||
|
@ -573,7 +579,7 @@ void acb_pow_fmpz(acb_t y, const acb_t b, const fmpz_t e, long prec);
|
|||
void acb_pow_ui(acb_t y, const acb_t b, ulong e, long prec);
|
||||
void acb_pow_si(acb_t y, const acb_t b, long e, long prec);
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_const_pi(acb_t x, long prec)
|
||||
{
|
||||
arb_const_pi(acb_realref(x), prec);
|
||||
|
@ -638,21 +644,21 @@ void acb_root(acb_t r, const acb_t a, long m, long index, long prec);
|
|||
*/
|
||||
|
||||
/* TODO: document */
|
||||
static __inline__ int
|
||||
ACB_INLINE int
|
||||
acb_is_finite(const acb_t x)
|
||||
{
|
||||
return arb_is_finite(acb_realref(x)) && arb_is_finite(acb_imagref(x));
|
||||
}
|
||||
|
||||
/* TODO: document */
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_indeterminate(acb_t x)
|
||||
{
|
||||
arb_indeterminate(acb_realref(x));
|
||||
arb_indeterminate(acb_imagref(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_zero(acb_ptr A, long n)
|
||||
{
|
||||
long i;
|
||||
|
@ -660,7 +666,7 @@ _acb_vec_zero(acb_ptr A, long n)
|
|||
acb_zero(A + i);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ACB_INLINE int
|
||||
_acb_vec_is_zero(acb_srcptr vec, long len)
|
||||
{
|
||||
long i;
|
||||
|
@ -670,7 +676,7 @@ _acb_vec_is_zero(acb_srcptr vec, long len)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_set(acb_ptr res, acb_srcptr vec, long len)
|
||||
{
|
||||
long i;
|
||||
|
@ -678,7 +684,7 @@ _acb_vec_set(acb_ptr res, acb_srcptr vec, long len)
|
|||
acb_set(res + i, vec + i);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_set_round(acb_ptr res, acb_srcptr vec, long len, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -686,7 +692,7 @@ _acb_vec_set_round(acb_ptr res, acb_srcptr vec, long len, long prec)
|
|||
acb_set_round(res + i, vec + i, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_neg(acb_ptr res, acb_srcptr vec, long len)
|
||||
{
|
||||
long i;
|
||||
|
@ -694,7 +700,7 @@ _acb_vec_neg(acb_ptr res, acb_srcptr vec, long len)
|
|||
acb_neg(res + i, vec + i);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_add(acb_ptr res, acb_srcptr vec1, acb_srcptr vec2, long len, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -702,7 +708,7 @@ _acb_vec_add(acb_ptr res, acb_srcptr vec1, acb_srcptr vec2, long len, long prec)
|
|||
acb_add(res + i, vec1 + i, vec2 + i, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_sub(acb_ptr res, acb_srcptr vec1, acb_srcptr vec2, long len, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -710,7 +716,7 @@ _acb_vec_sub(acb_ptr res, acb_srcptr vec1, acb_srcptr vec2, long len, long prec)
|
|||
acb_sub(res + i, vec1 + i, vec2 + i, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_scalar_submul(acb_ptr res, acb_srcptr vec, long len, const acb_t c, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -718,7 +724,7 @@ _acb_vec_scalar_submul(acb_ptr res, acb_srcptr vec, long len, const acb_t c, lon
|
|||
acb_submul(res + i, vec + i, c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_scalar_addmul(acb_ptr res, acb_srcptr vec, long len, const acb_t c, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -726,7 +732,7 @@ _acb_vec_scalar_addmul(acb_ptr res, acb_srcptr vec, long len, const acb_t c, lon
|
|||
acb_addmul(res + i, vec + i, c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_scalar_mul(acb_ptr res, acb_srcptr vec, long len, const acb_t c, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -734,7 +740,7 @@ _acb_vec_scalar_mul(acb_ptr res, acb_srcptr vec, long len, const acb_t c, long p
|
|||
acb_mul(res + i, vec + i, c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_scalar_mul_ui(acb_ptr res, acb_srcptr vec, long len, ulong c, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -742,7 +748,7 @@ _acb_vec_scalar_mul_ui(acb_ptr res, acb_srcptr vec, long len, ulong c, long prec
|
|||
acb_mul_ui(res + i, vec + i, c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_scalar_mul_2exp_si(acb_ptr res, acb_srcptr vec, long len, long c)
|
||||
{
|
||||
long i;
|
||||
|
@ -750,7 +756,7 @@ _acb_vec_scalar_mul_2exp_si(acb_ptr res, acb_srcptr vec, long len, long c)
|
|||
acb_mul_2exp_si(res + i, vec + i, c);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_scalar_div_ui(acb_ptr res, acb_srcptr vec, long len, ulong c, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -758,7 +764,7 @@ _acb_vec_scalar_div_ui(acb_ptr res, acb_srcptr vec, long len, ulong c, long prec
|
|||
acb_div_ui(res + i, vec + i, c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_scalar_div(acb_ptr res, acb_srcptr vec, long len, const acb_t c, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -766,7 +772,7 @@ _acb_vec_scalar_div(acb_ptr res, acb_srcptr vec, long len, const acb_t c, long p
|
|||
acb_div(res + i, vec + i, c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_scalar_mul_arb(acb_ptr res, acb_srcptr vec, long len, const arb_t c, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -774,7 +780,7 @@ _acb_vec_scalar_mul_arb(acb_ptr res, acb_srcptr vec, long len, const arb_t c, lo
|
|||
acb_mul_arb(res + i, vec + i, c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_scalar_div_arb(acb_ptr res, acb_srcptr vec, long len, const arb_t c, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -785,7 +791,7 @@ _acb_vec_scalar_div_arb(acb_ptr res, acb_srcptr vec, long len, const arb_t c, lo
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_scalar_mul_fmpz(acb_ptr res, acb_srcptr vec, long len, const fmpz_t c, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -793,7 +799,7 @@ _acb_vec_scalar_mul_fmpz(acb_ptr res, acb_srcptr vec, long len, const fmpz_t c,
|
|||
acb_mul_fmpz(res + i, vec + i, c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_scalar_div_fmpz(acb_ptr res, acb_srcptr vec, long len, const fmpz_t c, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -801,7 +807,7 @@ _acb_vec_scalar_div_fmpz(acb_ptr res, acb_srcptr vec, long len, const fmpz_t c,
|
|||
acb_div_fmpz(res + i, vec + i, c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
acb_print(const acb_t x)
|
||||
{
|
||||
printf("(");
|
||||
|
@ -817,7 +823,7 @@ void acb_randtest(acb_t z, flint_rand_t state, long prec, long mag_bits);
|
|||
|
||||
void acb_randtest_special(acb_t z, flint_rand_t state, long prec, long mag_bits);
|
||||
|
||||
static __inline__ long
|
||||
ACB_INLINE long
|
||||
acb_bits(const acb_t x)
|
||||
{
|
||||
long b1, b2;
|
||||
|
@ -826,13 +832,13 @@ acb_bits(const acb_t x)
|
|||
return FLINT_MAX(b1, b2);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ACB_INLINE int
|
||||
acb_is_real(const acb_t x)
|
||||
{
|
||||
return arb_is_zero(acb_imagref(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ACB_INLINE int
|
||||
_acb_vec_is_real(acb_srcptr v, long len)
|
||||
{
|
||||
long i;
|
||||
|
@ -846,13 +852,13 @@ _acb_vec_is_real(acb_srcptr v, long len)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static __inline__ long
|
||||
ACB_INLINE long
|
||||
_acb_vec_bits(acb_srcptr vec, long len)
|
||||
{
|
||||
return _arb_vec_bits((arb_srcptr) vec, 2 * len);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_set_powers(acb_ptr xs, const acb_t x, long len, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -870,7 +876,7 @@ _acb_vec_set_powers(acb_ptr xs, const acb_t x, long len, long prec)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_add_error_arf_vec(acb_ptr res, arf_srcptr err, long len)
|
||||
{
|
||||
long i;
|
||||
|
@ -878,7 +884,7 @@ _acb_vec_add_error_arf_vec(acb_ptr res, arf_srcptr err, long len)
|
|||
acb_add_error_arf(res + i, err + i);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_add_error_mag_vec(acb_ptr res, mag_srcptr err, long len)
|
||||
{
|
||||
long i;
|
||||
|
@ -891,13 +897,13 @@ _acb_vec_add_error_mag_vec(acb_ptr res, mag_srcptr err, long len)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_indeterminate(acb_ptr vec, long len)
|
||||
{
|
||||
_arb_vec_indeterminate((arb_ptr) vec, 2 * len);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_INLINE void
|
||||
_acb_vec_trim(acb_ptr res, acb_srcptr vec, long len)
|
||||
{
|
||||
long i;
|
||||
|
|
28
acb/inlines.c
Normal file
28
acb/inlines.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*=============================================================================
|
||||
|
||||
This file is part of ARB.
|
||||
|
||||
ARB is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ARB 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with ARB; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
=============================================================================*/
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (C) 2014 Fredrik Johansson
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#define ACB_INLINES_C
|
||||
#include "acb.h"
|
||||
|
36
acb_mat.h
36
acb_mat.h
|
@ -26,6 +26,12 @@
|
|||
#ifndef ACB_MAT_H
|
||||
#define ACB_MAT_H
|
||||
|
||||
#ifdef ACB_MAT_INLINES_C
|
||||
#define ACB_MAT_INLINE
|
||||
#else
|
||||
#define ACB_MAT_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include "arb.h"
|
||||
#include "acb.h"
|
||||
#include "fmpz_mat.h"
|
||||
|
@ -59,7 +65,7 @@ void acb_mat_init(acb_mat_t mat, long r, long c);
|
|||
|
||||
void acb_mat_clear(acb_mat_t mat);
|
||||
|
||||
static __inline__ void
|
||||
ACB_MAT_INLINE void
|
||||
acb_mat_swap(acb_mat_t mat1, acb_mat_t mat2)
|
||||
{
|
||||
acb_mat_struct t = *mat1;
|
||||
|
@ -115,7 +121,7 @@ void acb_mat_pow_ui(acb_mat_t B, const acb_mat_t A, ulong exp, long prec);
|
|||
|
||||
/* Scalar arithmetic */
|
||||
|
||||
static __inline__ void
|
||||
ACB_MAT_INLINE void
|
||||
acb_mat_scalar_mul_2exp_si(acb_mat_t B, const acb_mat_t A, long c)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -125,7 +131,7 @@ acb_mat_scalar_mul_2exp_si(acb_mat_t B, const acb_mat_t A, long c)
|
|||
acb_mul_2exp_si(acb_mat_entry(B, i, j), acb_mat_entry(A, i, j), c);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_MAT_INLINE void
|
||||
acb_mat_scalar_addmul_si(acb_mat_t B, const acb_mat_t A, long c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -135,7 +141,7 @@ acb_mat_scalar_addmul_si(acb_mat_t B, const acb_mat_t A, long c, long prec)
|
|||
acb_addmul_si(acb_mat_entry(B, i, j), acb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_MAT_INLINE void
|
||||
acb_mat_scalar_mul_si(acb_mat_t B, const acb_mat_t A, long c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -145,7 +151,7 @@ acb_mat_scalar_mul_si(acb_mat_t B, const acb_mat_t A, long c, long prec)
|
|||
acb_mul_si(acb_mat_entry(B, i, j), acb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_MAT_INLINE void
|
||||
acb_mat_scalar_div_si(acb_mat_t B, const acb_mat_t A, long c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -155,7 +161,7 @@ acb_mat_scalar_div_si(acb_mat_t B, const acb_mat_t A, long c, long prec)
|
|||
acb_div_si(acb_mat_entry(B, i, j), acb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_MAT_INLINE void
|
||||
acb_mat_scalar_addmul_fmpz(acb_mat_t B, const acb_mat_t A, const fmpz_t c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -165,7 +171,7 @@ acb_mat_scalar_addmul_fmpz(acb_mat_t B, const acb_mat_t A, const fmpz_t c, long
|
|||
acb_addmul_fmpz(acb_mat_entry(B, i, j), acb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_MAT_INLINE void
|
||||
acb_mat_scalar_mul_fmpz(acb_mat_t B, const acb_mat_t A, const fmpz_t c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -175,7 +181,7 @@ acb_mat_scalar_mul_fmpz(acb_mat_t B, const acb_mat_t A, const fmpz_t c, long pre
|
|||
acb_mul_fmpz(acb_mat_entry(B, i, j), acb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_MAT_INLINE void
|
||||
acb_mat_scalar_div_fmpz(acb_mat_t B, const acb_mat_t A, const fmpz_t c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -185,7 +191,7 @@ acb_mat_scalar_div_fmpz(acb_mat_t B, const acb_mat_t A, const fmpz_t c, long pre
|
|||
acb_div_fmpz(acb_mat_entry(B, i, j), acb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_MAT_INLINE void
|
||||
acb_mat_scalar_addmul_acb(acb_mat_t B, const acb_mat_t A, const acb_t c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -195,7 +201,7 @@ acb_mat_scalar_addmul_acb(acb_mat_t B, const acb_mat_t A, const acb_t c, long pr
|
|||
acb_addmul(acb_mat_entry(B, i, j), acb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_MAT_INLINE void
|
||||
acb_mat_scalar_mul_acb(acb_mat_t B, const acb_mat_t A, const acb_t c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -205,7 +211,7 @@ acb_mat_scalar_mul_acb(acb_mat_t B, const acb_mat_t A, const acb_t c, long prec)
|
|||
acb_mul(acb_mat_entry(B, i, j), acb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_MAT_INLINE void
|
||||
acb_mat_scalar_div_acb(acb_mat_t B, const acb_mat_t A, const acb_t c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -215,7 +221,7 @@ acb_mat_scalar_div_acb(acb_mat_t B, const acb_mat_t A, const acb_t c, long prec)
|
|||
acb_div(acb_mat_entry(B, i, j), acb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_MAT_INLINE void
|
||||
acb_mat_scalar_addmul_arb(acb_mat_t B, const acb_mat_t A, const arb_t c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -225,7 +231,7 @@ acb_mat_scalar_addmul_arb(acb_mat_t B, const acb_mat_t A, const arb_t c, long pr
|
|||
acb_addmul_arb(acb_mat_entry(B, i, j), acb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_MAT_INLINE void
|
||||
acb_mat_scalar_mul_arb(acb_mat_t B, const acb_mat_t A, const arb_t c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -235,7 +241,7 @@ acb_mat_scalar_mul_arb(acb_mat_t B, const acb_mat_t A, const arb_t c, long prec)
|
|||
acb_mul_arb(acb_mat_entry(B, i, j), acb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_MAT_INLINE void
|
||||
acb_mat_scalar_div_arb(acb_mat_t B, const acb_mat_t A, const arb_t c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -247,7 +253,7 @@ acb_mat_scalar_div_arb(acb_mat_t B, const acb_mat_t A, const arb_t c, long prec)
|
|||
|
||||
/* Solving */
|
||||
|
||||
static __inline__ void
|
||||
ACB_MAT_INLINE void
|
||||
acb_mat_swap_rows(acb_mat_t mat, long * perm, long r, long s)
|
||||
{
|
||||
if (r != s)
|
||||
|
|
28
acb_mat/inlines.c
Normal file
28
acb_mat/inlines.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*=============================================================================
|
||||
|
||||
This file is part of ARB.
|
||||
|
||||
ARB is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ARB 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with ARB; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
=============================================================================*/
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (C) 2014 Fredrik Johansson
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#define ACB_MAT_INLINES_C
|
||||
#include "acb_mat.h"
|
||||
|
28
acb_poly.h
28
acb_poly.h
|
@ -26,6 +26,12 @@
|
|||
#ifndef ACB_POLY_H
|
||||
#define ACB_POLY_H
|
||||
|
||||
#ifdef ACB_POLY_INLINES_C
|
||||
#define ACB_POLY_INLINE
|
||||
#else
|
||||
#define ACB_POLY_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include "acb.h"
|
||||
#include "arb_poly.h"
|
||||
|
||||
|
@ -58,7 +64,7 @@ void _acb_poly_set_length(acb_poly_t poly, long len);
|
|||
|
||||
void _acb_poly_normalise(acb_poly_t poly);
|
||||
|
||||
static __inline__ void
|
||||
ACB_POLY_INLINE void
|
||||
acb_poly_swap(acb_poly_t poly1, acb_poly_t poly2)
|
||||
{
|
||||
acb_poly_struct t = *poly1;
|
||||
|
@ -66,22 +72,22 @@ acb_poly_swap(acb_poly_t poly1, acb_poly_t poly2)
|
|||
*poly2 = t;
|
||||
}
|
||||
|
||||
static __inline__ long acb_poly_length(const acb_poly_t poly)
|
||||
ACB_POLY_INLINE long acb_poly_length(const acb_poly_t poly)
|
||||
{
|
||||
return poly->length;
|
||||
}
|
||||
|
||||
static __inline__ long acb_poly_degree(const acb_poly_t poly)
|
||||
ACB_POLY_INLINE long acb_poly_degree(const acb_poly_t poly)
|
||||
{
|
||||
return poly->length - 1;
|
||||
}
|
||||
|
||||
static __inline__ void acb_poly_zero(acb_poly_t poly)
|
||||
ACB_POLY_INLINE void acb_poly_zero(acb_poly_t poly)
|
||||
{
|
||||
poly->length = 0;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_POLY_INLINE void
|
||||
acb_poly_one(acb_poly_t poly)
|
||||
{
|
||||
acb_poly_fit_length(poly, 1);
|
||||
|
@ -106,7 +112,7 @@ void _acb_poly_shift_left(acb_ptr res, acb_srcptr poly, long len, long n);
|
|||
|
||||
void acb_poly_shift_left(acb_poly_t res, const acb_poly_t poly, long n);
|
||||
|
||||
static __inline__ void
|
||||
ACB_POLY_INLINE void
|
||||
acb_poly_truncate(acb_poly_t poly, long newlen)
|
||||
{
|
||||
if (poly->length > newlen)
|
||||
|
@ -159,7 +165,7 @@ void acb_poly_set2_fmpq_poly(acb_poly_t poly, const fmpq_poly_t re, const fmpq_p
|
|||
|
||||
void acb_poly_set_fmpz_poly(acb_poly_t poly, const fmpz_poly_t src, long prec);
|
||||
|
||||
static __inline__ void
|
||||
ACB_POLY_INLINE void
|
||||
acb_poly_set_acb(acb_poly_t poly, const acb_t c)
|
||||
{
|
||||
acb_poly_fit_length(poly, 1);
|
||||
|
@ -196,7 +202,7 @@ void _acb_poly_sub(acb_ptr res, acb_srcptr poly1, long len1,
|
|||
void acb_poly_sub(acb_poly_t res, const acb_poly_t poly1,
|
||||
const acb_poly_t poly2, long prec);
|
||||
|
||||
static __inline__ void
|
||||
ACB_POLY_INLINE void
|
||||
acb_poly_neg(acb_poly_t res, const acb_poly_t poly)
|
||||
{
|
||||
acb_poly_fit_length(res, poly->length);
|
||||
|
@ -204,7 +210,7 @@ acb_poly_neg(acb_poly_t res, const acb_poly_t poly)
|
|||
_acb_poly_set_length(res, poly->length);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ACB_POLY_INLINE void
|
||||
acb_poly_scalar_mul_2exp_si(acb_poly_t res, const acb_poly_t poly, long c)
|
||||
{
|
||||
acb_poly_fit_length(res, poly->length);
|
||||
|
@ -251,7 +257,7 @@ void _acb_poly_mul(acb_ptr C,
|
|||
void acb_poly_mul(acb_poly_t res, const acb_poly_t poly1,
|
||||
const acb_poly_t poly2, long prec);
|
||||
|
||||
static __inline__ void
|
||||
ACB_POLY_INLINE void
|
||||
_acb_poly_mul_monic(acb_ptr res, acb_srcptr poly1, long len1,
|
||||
acb_srcptr poly2, long len2, long prec)
|
||||
{
|
||||
|
@ -517,7 +523,7 @@ void _acb_poly_rising_ui_series(acb_ptr res, acb_srcptr f, long flen, ulong r, l
|
|||
void acb_poly_rising_ui_series(acb_poly_t res, const acb_poly_t f, ulong r, long trunc, long prec);
|
||||
|
||||
/* TODO: document */
|
||||
static __inline__ void
|
||||
ACB_POLY_INLINE void
|
||||
_acb_poly_acb_pow_cpx(acb_ptr w, const acb_t a, const acb_t b, long len, long prec)
|
||||
{
|
||||
if (len == 1)
|
||||
|
|
28
acb_poly/inlines.c
Normal file
28
acb_poly/inlines.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*=============================================================================
|
||||
|
||||
This file is part of ARB.
|
||||
|
||||
ARB is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ARB 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with ARB; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
=============================================================================*/
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (C) 2014 Fredrik Johansson
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#define ACB_POLY_INLINES_C
|
||||
#include "acb_poly.h"
|
||||
|
146
arb.h
146
arb.h
|
@ -26,6 +26,12 @@
|
|||
#ifndef ARB_H
|
||||
#define ARB_H
|
||||
|
||||
#ifdef ARB_INLINES_C
|
||||
#define ARB_INLINE
|
||||
#else
|
||||
#define ARB_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include "fmprb.h"
|
||||
#include "mag.h"
|
||||
#include "arf.h"
|
||||
|
@ -54,21 +60,21 @@ typedef const arb_struct * arb_srcptr;
|
|||
|
||||
#define ARB_RND ARF_RND_DOWN
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_init(arb_t x)
|
||||
{
|
||||
arf_init(arb_midref(x));
|
||||
mag_init(arb_radref(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_clear(arb_t x)
|
||||
{
|
||||
arf_clear(arb_midref(x));
|
||||
mag_clear(arb_radref(x));
|
||||
}
|
||||
|
||||
static __inline__ arb_ptr
|
||||
ARB_INLINE arb_ptr
|
||||
_arb_vec_init(long n)
|
||||
{
|
||||
long i;
|
||||
|
@ -80,7 +86,7 @@ _arb_vec_init(long n)
|
|||
return v;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_clear(arb_ptr v, long n)
|
||||
{
|
||||
long i;
|
||||
|
@ -89,75 +95,75 @@ _arb_vec_clear(arb_ptr v, long n)
|
|||
flint_free(v);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_set_fmprb(arb_t x, const fmprb_t y)
|
||||
{
|
||||
arf_set_fmpr(arb_midref(x), fmprb_midref(y));
|
||||
mag_set_fmpr(arb_radref(x), fmprb_radref(y));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_get_fmprb(fmprb_t x, const arb_t y)
|
||||
{
|
||||
arf_get_fmpr(fmprb_midref(x), arb_midref(y));
|
||||
mag_get_fmpr(fmprb_radref(x), arb_radref(y));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
arb_is_exact(const arb_t x)
|
||||
{
|
||||
return mag_is_zero(arb_radref(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
arb_equal(const arb_t x, const arb_t y)
|
||||
{
|
||||
return arf_equal(arb_midref(x), arb_midref(y)) &&
|
||||
mag_equal(arb_radref(x), arb_radref(y));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_zero(arb_t x)
|
||||
{
|
||||
arf_zero(arb_midref(x));
|
||||
mag_zero(arb_radref(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
arb_is_zero(const arb_t x)
|
||||
{
|
||||
return arf_is_zero(arb_midref(x)) && mag_is_zero(arb_radref(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_pos_inf(arb_t x)
|
||||
{
|
||||
arf_pos_inf(arb_midref(x));
|
||||
mag_zero(arb_radref(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_neg_inf(arb_t x)
|
||||
{
|
||||
arf_neg_inf(arb_midref(x));
|
||||
mag_zero(arb_radref(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_zero_pm_inf(arb_t x)
|
||||
{
|
||||
arf_zero(arb_midref(x));
|
||||
mag_inf(arb_radref(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_indeterminate(arb_t x)
|
||||
{
|
||||
arf_nan(arb_midref(x));
|
||||
mag_inf(arb_radref(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
arb_is_finite(const arb_t x)
|
||||
{
|
||||
return arf_is_finite(arb_midref(x)) && mag_is_finite(arb_radref(x));
|
||||
|
@ -165,7 +171,7 @@ arb_is_finite(const arb_t x)
|
|||
|
||||
void arb_set(arb_t x, const arb_t y);
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_swap(arb_t x, arb_t y)
|
||||
{
|
||||
arb_struct t = *x;
|
||||
|
@ -183,35 +189,35 @@ void arb_neg_round(arb_t x, const arb_t y, long prec);
|
|||
|
||||
void arb_abs(arb_t x, const arb_t y);
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_set_arf(arb_t x, const arf_t y)
|
||||
{
|
||||
arf_set(arb_midref(x), y);
|
||||
mag_zero(arb_radref(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_set_si(arb_t x, long y)
|
||||
{
|
||||
arf_set_si(arb_midref(x), y);
|
||||
mag_zero(arb_radref(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_set_ui(arb_t x, ulong y)
|
||||
{
|
||||
arf_set_ui(arb_midref(x), y);
|
||||
mag_zero(arb_radref(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_set_fmpz(arb_t x, const fmpz_t y)
|
||||
{
|
||||
arf_set_fmpz(arb_midref(x), y);
|
||||
mag_zero(arb_radref(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_set_fmpz_2exp(arb_t x, const fmpz_t y, const fmpz_t exp)
|
||||
{
|
||||
arf_set_fmpz_2exp(arb_midref(x), y, exp);
|
||||
|
@ -222,19 +228,19 @@ void arb_set_round_fmpz_2exp(arb_t y, const fmpz_t x, const fmpz_t exp, long pre
|
|||
|
||||
void arb_set_round_fmpz(arb_t y, const fmpz_t x, long prec);
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
arb_is_one(const arb_t f)
|
||||
{
|
||||
return arf_is_one(arb_midref(f)) && mag_is_zero(arb_radref(f));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_one(arb_t f)
|
||||
{
|
||||
arb_set_ui(f, 1UL);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_print(const arb_t x)
|
||||
{
|
||||
arf_print(arb_midref(x));
|
||||
|
@ -242,7 +248,7 @@ arb_print(const arb_t x)
|
|||
mag_print(arb_radref(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_printd(const arb_t x, long digits)
|
||||
{
|
||||
arf_printd(arb_midref(x), FLINT_MAX(digits, 1));
|
||||
|
@ -250,40 +256,40 @@ arb_printd(const arb_t x, long digits)
|
|||
mag_printd(arb_radref(x), 5);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_mul_2exp_si(arb_t y, const arb_t x, long e)
|
||||
{
|
||||
arf_mul_2exp_si(arb_midref(y), arb_midref(x), e);
|
||||
mag_mul_2exp_si(arb_radref(y), arb_radref(x), e);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_mul_2exp_fmpz(arb_t y, const arb_t x, const fmpz_t e)
|
||||
{
|
||||
arf_mul_2exp_fmpz(arb_midref(y), arb_midref(x), e);
|
||||
mag_mul_2exp_fmpz(arb_radref(y), arb_radref(x), e);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
arb_is_int(const arb_t x)
|
||||
{
|
||||
return mag_is_zero(arb_radref(x)) &&
|
||||
arf_is_int(arb_midref(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
arb_contains_zero(const arb_t x)
|
||||
{
|
||||
return arf_cmpabs_mag(arb_midref(x), arb_radref(x)) <= 0;
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
arb_is_nonzero(const arb_t x)
|
||||
{
|
||||
return !arb_contains_zero(x);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
arb_is_positive(const arb_t x)
|
||||
{
|
||||
return (arf_sgn(arb_midref(x)) > 0) &&
|
||||
|
@ -291,7 +297,7 @@ arb_is_positive(const arb_t x)
|
|||
!arf_is_nan(arb_midref(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
arb_is_nonnegative(const arb_t x)
|
||||
{
|
||||
return (arf_sgn(arb_midref(x)) >= 0) &&
|
||||
|
@ -299,7 +305,7 @@ arb_is_nonnegative(const arb_t x)
|
|||
!arf_is_nan(arb_midref(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
arb_is_negative(const arb_t x)
|
||||
{
|
||||
return (arf_sgn(arb_midref(x)) < 0) &&
|
||||
|
@ -307,7 +313,7 @@ arb_is_negative(const arb_t x)
|
|||
!arf_is_nan(arb_midref(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
arb_is_nonpositive(const arb_t x)
|
||||
{
|
||||
return (arf_sgn(arb_midref(x)) <= 0) &&
|
||||
|
@ -315,7 +321,7 @@ arb_is_nonpositive(const arb_t x)
|
|||
!arf_is_nan(arb_midref(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
arb_contains_negative(const arb_t x)
|
||||
{
|
||||
return (arf_sgn(arb_midref(x)) < 0) ||
|
||||
|
@ -323,7 +329,7 @@ arb_contains_negative(const arb_t x)
|
|||
|| arf_is_nan(arb_midref(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
arb_contains_nonpositive(const arb_t x)
|
||||
{
|
||||
return (arf_sgn(arb_midref(x)) <= 0) ||
|
||||
|
@ -331,7 +337,7 @@ arb_contains_nonpositive(const arb_t x)
|
|||
|| arf_is_nan(arb_midref(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
arb_contains_positive(const arb_t x)
|
||||
{
|
||||
return (arf_sgn(arb_midref(x)) > 0) ||
|
||||
|
@ -339,7 +345,7 @@ arb_contains_positive(const arb_t x)
|
|||
|| arf_is_nan(arb_midref(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
arb_contains_nonnegative(const arb_t x)
|
||||
{
|
||||
return (arf_sgn(arb_midref(x)) >= 0) ||
|
||||
|
@ -351,7 +357,7 @@ void arb_get_mag_lower(mag_t z, const arb_t x);
|
|||
|
||||
void arb_get_mag_lower_nonnegative(mag_t z, const arb_t x);
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_get_mag(mag_t z, const arb_t x)
|
||||
{
|
||||
mag_t t;
|
||||
|
@ -360,7 +366,7 @@ arb_get_mag(mag_t z, const arb_t x)
|
|||
mag_clear(t);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_get_abs_ubound_arf(arf_t u, const arb_t x, long prec)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -374,7 +380,7 @@ arb_get_abs_ubound_arf(arf_t u, const arb_t x, long prec)
|
|||
arf_abs(u, u);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_get_abs_lbound_arf(arf_t u, const arb_t x, long prec)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -396,13 +402,13 @@ arb_get_abs_lbound_arf(arf_t u, const arb_t x, long prec)
|
|||
|
||||
long arb_rel_error_bits(const arb_t x);
|
||||
|
||||
static __inline__ long
|
||||
ARB_INLINE long
|
||||
arb_rel_accuracy_bits(const arb_t x)
|
||||
{
|
||||
return -arb_rel_error_bits(x);
|
||||
}
|
||||
|
||||
static __inline__ long
|
||||
ARB_INLINE long
|
||||
arb_bits(const arb_t x)
|
||||
{
|
||||
return arf_bits(arb_midref(x));
|
||||
|
@ -427,7 +433,7 @@ void arb_add_error_2exp_fmpz(arb_t x, const fmpz_t err);
|
|||
void arb_add_error(arb_t x, const arb_t error);
|
||||
|
||||
/* TODO: document */
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_add_error_mag(arb_t x, const mag_t err)
|
||||
{
|
||||
mag_add(arb_radref(x), arb_radref(x), err);
|
||||
|
@ -501,13 +507,13 @@ void arb_div_fmpz(arb_t z, const arb_t x, const fmpz_t y, long prec);
|
|||
void arb_fmpz_div_fmpz(arb_t z, const fmpz_t x, const fmpz_t y, long prec);
|
||||
void arb_ui_div(arb_t z, ulong x, const arb_t y, long prec);
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_inv(arb_t y, const arb_t x, long prec)
|
||||
{
|
||||
arb_ui_div(y, 1, x, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
arb_set_fmpq(arb_t y, const fmpq_t x, long prec)
|
||||
{
|
||||
arb_fmpz_div_fmpz(y, fmpq_numref(x), fmpq_denref(x), prec);
|
||||
|
@ -651,7 +657,7 @@ void arb_chebyshev_u2_ui(arb_t a, arb_t b, ulong n, const arb_t x, long prec);
|
|||
|
||||
/* vector functions */
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_zero(arb_ptr A, long n)
|
||||
{
|
||||
long i;
|
||||
|
@ -659,7 +665,7 @@ _arb_vec_zero(arb_ptr A, long n)
|
|||
arb_zero(A + i);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
_arb_vec_is_zero(arb_srcptr vec, long len)
|
||||
{
|
||||
long i;
|
||||
|
@ -669,7 +675,7 @@ _arb_vec_is_zero(arb_srcptr vec, long len)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARB_INLINE int
|
||||
_arb_vec_is_finite(arb_srcptr x, long len)
|
||||
{
|
||||
long i;
|
||||
|
@ -681,7 +687,7 @@ _arb_vec_is_finite(arb_srcptr x, long len)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_set(arb_ptr res, arb_srcptr vec, long len)
|
||||
{
|
||||
long i;
|
||||
|
@ -689,7 +695,7 @@ _arb_vec_set(arb_ptr res, arb_srcptr vec, long len)
|
|||
arb_set(res + i, vec + i);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_set_round(arb_ptr res, arb_srcptr vec, long len, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -697,7 +703,7 @@ _arb_vec_set_round(arb_ptr res, arb_srcptr vec, long len, long prec)
|
|||
arb_set_round(res + i, vec + i, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_swap(arb_ptr res, arb_ptr vec, long len)
|
||||
{
|
||||
long i;
|
||||
|
@ -705,7 +711,7 @@ _arb_vec_swap(arb_ptr res, arb_ptr vec, long len)
|
|||
arb_swap(res + i, vec + i);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_neg(arb_ptr B, arb_srcptr A, long n)
|
||||
{
|
||||
long i;
|
||||
|
@ -713,7 +719,7 @@ _arb_vec_neg(arb_ptr B, arb_srcptr A, long n)
|
|||
arb_neg(B + i, A + i);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_sub(arb_ptr C, arb_srcptr A,
|
||||
arb_srcptr B, long n, long prec)
|
||||
{
|
||||
|
@ -722,7 +728,7 @@ _arb_vec_sub(arb_ptr C, arb_srcptr A,
|
|||
arb_sub(C + i, A + i, B + i, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_add(arb_ptr C, arb_srcptr A,
|
||||
arb_srcptr B, long n, long prec)
|
||||
{
|
||||
|
@ -731,7 +737,7 @@ _arb_vec_add(arb_ptr C, arb_srcptr A,
|
|||
arb_add(C + i, A + i, B + i, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_scalar_mul(arb_ptr res, arb_srcptr vec,
|
||||
long len, const arb_t c, long prec)
|
||||
{
|
||||
|
@ -740,7 +746,7 @@ _arb_vec_scalar_mul(arb_ptr res, arb_srcptr vec,
|
|||
arb_mul(res + i, vec + i, c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_scalar_div(arb_ptr res, arb_srcptr vec,
|
||||
long len, const arb_t c, long prec)
|
||||
{
|
||||
|
@ -749,7 +755,7 @@ _arb_vec_scalar_div(arb_ptr res, arb_srcptr vec,
|
|||
arb_div(res + i, vec + i, c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_scalar_mul_fmpz(arb_ptr res, arb_srcptr vec,
|
||||
long len, const fmpz_t c, long prec)
|
||||
{
|
||||
|
@ -762,7 +768,7 @@ _arb_vec_scalar_mul_fmpz(arb_ptr res, arb_srcptr vec,
|
|||
arf_clear(t);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_scalar_mul_2exp_si(arb_ptr res, arb_srcptr src, long len, long c)
|
||||
{
|
||||
long i;
|
||||
|
@ -770,7 +776,7 @@ _arb_vec_scalar_mul_2exp_si(arb_ptr res, arb_srcptr src, long len, long c)
|
|||
arb_mul_2exp_si(res + i, src + i, c);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_scalar_addmul(arb_ptr res, arb_srcptr vec,
|
||||
long len, const arb_t c, long prec)
|
||||
{
|
||||
|
@ -779,7 +785,7 @@ _arb_vec_scalar_addmul(arb_ptr res, arb_srcptr vec,
|
|||
arb_addmul(res + i, vec + i, c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_dot(arb_t res, arb_srcptr vec1, arb_srcptr vec2, long len2, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -788,7 +794,7 @@ _arb_vec_dot(arb_t res, arb_srcptr vec1, arb_srcptr vec2, long len2, long prec)
|
|||
arb_addmul(res, vec1 + i, vec2 + i, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_norm(arb_t res, arb_srcptr vec, long len, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -798,7 +804,7 @@ _arb_vec_norm(arb_t res, arb_srcptr vec, long len, long prec)
|
|||
}
|
||||
|
||||
/* TODO: mag version? */
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_get_abs_ubound_arf(arf_t bound, arb_srcptr vec,
|
||||
long len, long prec)
|
||||
{
|
||||
|
@ -823,7 +829,7 @@ _arb_vec_get_abs_ubound_arf(arf_t bound, arb_srcptr vec,
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ long
|
||||
ARB_INLINE long
|
||||
_arb_vec_bits(arb_srcptr x, long len)
|
||||
{
|
||||
long i, b, c;
|
||||
|
@ -838,7 +844,7 @@ _arb_vec_bits(arb_srcptr x, long len)
|
|||
return b;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_set_powers(arb_ptr xs, const arb_t x, long len, long prec)
|
||||
{
|
||||
long i;
|
||||
|
@ -856,7 +862,7 @@ _arb_vec_set_powers(arb_ptr xs, const arb_t x, long len, long prec)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_add_error_arf_vec(arb_ptr res, arf_srcptr err, long len)
|
||||
{
|
||||
long i;
|
||||
|
@ -864,7 +870,7 @@ _arb_vec_add_error_arf_vec(arb_ptr res, arf_srcptr err, long len)
|
|||
arb_add_error_arf(res + i, err + i);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_add_error_mag_vec(arb_ptr res, mag_srcptr err, long len)
|
||||
{
|
||||
long i;
|
||||
|
@ -872,7 +878,7 @@ _arb_vec_add_error_mag_vec(arb_ptr res, mag_srcptr err, long len)
|
|||
mag_add(arb_radref(res + i), arb_radref(res + i), err + i);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_indeterminate(arb_ptr vec, long len)
|
||||
{
|
||||
long i;
|
||||
|
@ -880,7 +886,7 @@ _arb_vec_indeterminate(arb_ptr vec, long len)
|
|||
arb_indeterminate(vec + i);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_INLINE void
|
||||
_arb_vec_trim(arb_ptr res, arb_srcptr vec, long len)
|
||||
{
|
||||
long i;
|
||||
|
@ -1001,7 +1007,7 @@ void _arb_sin_cos_taylor_rs(mp_ptr ysin, mp_ptr ycos,
|
|||
int _arb_get_mpn_fixed_mod_pi4(mp_ptr w, fmpz_t q, int * octant,
|
||||
mp_limb_t * error, const arf_t x, mp_size_t wn);
|
||||
|
||||
static __inline__ mp_bitcnt_t
|
||||
ARB_INLINE mp_bitcnt_t
|
||||
_arb_mpn_leading_zeros(mp_srcptr d, mp_size_t n)
|
||||
{
|
||||
mp_limb_t t;
|
||||
|
|
28
arb/inlines.c
Normal file
28
arb/inlines.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*=============================================================================
|
||||
|
||||
This file is part of ARB.
|
||||
|
||||
ARB is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ARB 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with ARB; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
=============================================================================*/
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (C) 2014 Fredrik Johansson
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#define ARB_INLINES_C
|
||||
#include "arb.h"
|
||||
|
30
arb_mat.h
30
arb_mat.h
|
@ -26,6 +26,12 @@
|
|||
#ifndef ARB_MAT_H
|
||||
#define ARB_MAT_H
|
||||
|
||||
#ifdef ARB_MAT_INLINES_C
|
||||
#define ARB_MAT_INLINE
|
||||
#else
|
||||
#define ARB_MAT_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include "arb.h"
|
||||
#include "fmpz_mat.h"
|
||||
#include "fmpq_mat.h"
|
||||
|
@ -57,7 +63,7 @@ void arb_mat_init(arb_mat_t mat, long r, long c);
|
|||
|
||||
void arb_mat_clear(arb_mat_t mat);
|
||||
|
||||
static __inline__ void
|
||||
ARB_MAT_INLINE void
|
||||
arb_mat_swap(arb_mat_t mat1, arb_mat_t mat2)
|
||||
{
|
||||
arb_mat_struct t = *mat1;
|
||||
|
@ -117,7 +123,7 @@ void arb_mat_pow_ui(arb_mat_t B, const arb_mat_t A, ulong exp, long prec);
|
|||
|
||||
/* Scalar arithmetic */
|
||||
|
||||
static __inline__ void
|
||||
ARB_MAT_INLINE void
|
||||
arb_mat_scalar_mul_2exp_si(arb_mat_t B, const arb_mat_t A, long c)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -127,7 +133,7 @@ arb_mat_scalar_mul_2exp_si(arb_mat_t B, const arb_mat_t A, long c)
|
|||
arb_mul_2exp_si(arb_mat_entry(B, i, j), arb_mat_entry(A, i, j), c);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_MAT_INLINE void
|
||||
arb_mat_scalar_addmul_si(arb_mat_t B, const arb_mat_t A, long c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -137,7 +143,7 @@ arb_mat_scalar_addmul_si(arb_mat_t B, const arb_mat_t A, long c, long prec)
|
|||
arb_addmul_si(arb_mat_entry(B, i, j), arb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_MAT_INLINE void
|
||||
arb_mat_scalar_mul_si(arb_mat_t B, const arb_mat_t A, long c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -147,7 +153,7 @@ arb_mat_scalar_mul_si(arb_mat_t B, const arb_mat_t A, long c, long prec)
|
|||
arb_mul_si(arb_mat_entry(B, i, j), arb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_MAT_INLINE void
|
||||
arb_mat_scalar_div_si(arb_mat_t B, const arb_mat_t A, long c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -157,7 +163,7 @@ arb_mat_scalar_div_si(arb_mat_t B, const arb_mat_t A, long c, long prec)
|
|||
arb_div_si(arb_mat_entry(B, i, j), arb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_MAT_INLINE void
|
||||
arb_mat_scalar_addmul_fmpz(arb_mat_t B, const arb_mat_t A, const fmpz_t c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -167,7 +173,7 @@ arb_mat_scalar_addmul_fmpz(arb_mat_t B, const arb_mat_t A, const fmpz_t c, long
|
|||
arb_addmul_fmpz(arb_mat_entry(B, i, j), arb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_MAT_INLINE void
|
||||
arb_mat_scalar_mul_fmpz(arb_mat_t B, const arb_mat_t A, const fmpz_t c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -177,7 +183,7 @@ arb_mat_scalar_mul_fmpz(arb_mat_t B, const arb_mat_t A, const fmpz_t c, long pre
|
|||
arb_mul_fmpz(arb_mat_entry(B, i, j), arb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_MAT_INLINE void
|
||||
arb_mat_scalar_div_fmpz(arb_mat_t B, const arb_mat_t A, const fmpz_t c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -187,7 +193,7 @@ arb_mat_scalar_div_fmpz(arb_mat_t B, const arb_mat_t A, const fmpz_t c, long pre
|
|||
arb_div_fmpz(arb_mat_entry(B, i, j), arb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_MAT_INLINE void
|
||||
arb_mat_scalar_addmul_arb(arb_mat_t B, const arb_mat_t A, const arb_t c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -197,7 +203,7 @@ arb_mat_scalar_addmul_arb(arb_mat_t B, const arb_mat_t A, const arb_t c, long pr
|
|||
arb_addmul(arb_mat_entry(B, i, j), arb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_MAT_INLINE void
|
||||
arb_mat_scalar_mul_arb(arb_mat_t B, const arb_mat_t A, const arb_t c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -207,7 +213,7 @@ arb_mat_scalar_mul_arb(arb_mat_t B, const arb_mat_t A, const arb_t c, long prec)
|
|||
arb_mul(arb_mat_entry(B, i, j), arb_mat_entry(A, i, j), c, prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_MAT_INLINE void
|
||||
arb_mat_scalar_div_arb(arb_mat_t B, const arb_mat_t A, const arb_t c, long prec)
|
||||
{
|
||||
long i, j;
|
||||
|
@ -219,7 +225,7 @@ arb_mat_scalar_div_arb(arb_mat_t B, const arb_mat_t A, const arb_t c, long prec)
|
|||
|
||||
/* Solving */
|
||||
|
||||
static __inline__ void
|
||||
ARB_MAT_INLINE void
|
||||
arb_mat_swap_rows(arb_mat_t mat, long * perm, long r, long s)
|
||||
{
|
||||
if (r != s)
|
||||
|
|
28
arb_mat/inlines.c
Normal file
28
arb_mat/inlines.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*=============================================================================
|
||||
|
||||
This file is part of ARB.
|
||||
|
||||
ARB is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ARB 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with ARB; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
=============================================================================*/
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (C) 2014 Fredrik Johansson
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#define ARB_MAT_INLINES_C
|
||||
#include "arb_mat.h"
|
||||
|
30
arb_poly.h
30
arb_poly.h
|
@ -26,6 +26,12 @@
|
|||
#ifndef ARB_POLY_H
|
||||
#define ARB_POLY_H
|
||||
|
||||
#ifdef ARB_POLY_INLINES_C
|
||||
#define ARB_POLY_INLINE
|
||||
#else
|
||||
#define ARB_POLY_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include "arb.h"
|
||||
#include "acb.h"
|
||||
#include "fmpz_poly.h"
|
||||
|
@ -60,7 +66,7 @@ void _arb_poly_set_length(arb_poly_t poly, long len);
|
|||
|
||||
void _arb_poly_normalise(arb_poly_t poly);
|
||||
|
||||
static __inline__ void
|
||||
ARB_POLY_INLINE void
|
||||
arb_poly_swap(arb_poly_t poly1, arb_poly_t poly2)
|
||||
{
|
||||
arb_poly_struct t = *poly1;
|
||||
|
@ -72,22 +78,22 @@ void arb_poly_set(arb_poly_t poly, const arb_poly_t src);
|
|||
|
||||
/* Basic manipulation */
|
||||
|
||||
static __inline__ long arb_poly_length(const arb_poly_t poly)
|
||||
ARB_POLY_INLINE long arb_poly_length(const arb_poly_t poly)
|
||||
{
|
||||
return poly->length;
|
||||
}
|
||||
|
||||
static __inline__ long arb_poly_degree(const arb_poly_t poly)
|
||||
ARB_POLY_INLINE long arb_poly_degree(const arb_poly_t poly)
|
||||
{
|
||||
return poly->length - 1;
|
||||
}
|
||||
|
||||
static __inline__ void arb_poly_zero(arb_poly_t poly)
|
||||
ARB_POLY_INLINE void arb_poly_zero(arb_poly_t poly)
|
||||
{
|
||||
poly->length = 0;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_POLY_INLINE void
|
||||
arb_poly_one(arb_poly_t poly)
|
||||
{
|
||||
arb_poly_fit_length(poly, 1);
|
||||
|
@ -114,7 +120,7 @@ void _arb_poly_shift_left(arb_ptr res, arb_srcptr poly, long len, long n);
|
|||
|
||||
void arb_poly_shift_left(arb_poly_t res, const arb_poly_t poly, long n);
|
||||
|
||||
static __inline__ void
|
||||
ARB_POLY_INLINE void
|
||||
arb_poly_truncate(arb_poly_t poly, long newlen)
|
||||
{
|
||||
if (poly->length > newlen)
|
||||
|
@ -133,7 +139,7 @@ void arb_poly_set_fmpz_poly(arb_poly_t poly, const fmpz_poly_t src, long prec);
|
|||
|
||||
void arb_poly_set_fmpq_poly(arb_poly_t poly, const fmpq_poly_t src, long prec);
|
||||
|
||||
static __inline__ void
|
||||
ARB_POLY_INLINE void
|
||||
arb_poly_set_arb(arb_poly_t poly, const arb_t c)
|
||||
{
|
||||
arb_poly_fit_length(poly, 1);
|
||||
|
@ -180,7 +186,7 @@ void _arb_poly_sub(arb_ptr res, arb_srcptr poly1, long len1,
|
|||
void arb_poly_sub(arb_poly_t res, const arb_poly_t poly1,
|
||||
const arb_poly_t poly2, long prec);
|
||||
|
||||
static __inline__ void
|
||||
ARB_POLY_INLINE void
|
||||
arb_poly_neg(arb_poly_t res, const arb_poly_t poly)
|
||||
{
|
||||
arb_poly_fit_length(res, poly->length);
|
||||
|
@ -188,7 +194,7 @@ arb_poly_neg(arb_poly_t res, const arb_poly_t poly)
|
|||
_arb_poly_set_length(res, poly->length);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARB_POLY_INLINE void
|
||||
arb_poly_scalar_mul_2exp_si(arb_poly_t res, const arb_poly_t poly, long c)
|
||||
{
|
||||
arb_poly_fit_length(res, poly->length);
|
||||
|
@ -233,7 +239,7 @@ void _arb_poly_mul(arb_ptr C,
|
|||
void arb_poly_mul(arb_poly_t res, const arb_poly_t poly1,
|
||||
const arb_poly_t poly2, long prec);
|
||||
|
||||
static __inline__ void
|
||||
ARB_POLY_INLINE void
|
||||
_arb_poly_mul_monic(arb_ptr res, arb_srcptr poly1, long len1,
|
||||
arb_srcptr poly2, long len2, long prec)
|
||||
{
|
||||
|
@ -589,7 +595,7 @@ void _arb_poly_newton_refine_root(arb_t r, arb_srcptr poly,
|
|||
|
||||
|
||||
/* counts zero bits in the binary representation of e */
|
||||
static __inline__ int
|
||||
ARB_POLY_INLINE int
|
||||
n_zerobits(mp_limb_t e)
|
||||
{
|
||||
int zeros = 0;
|
||||
|
@ -603,7 +609,7 @@ n_zerobits(mp_limb_t e)
|
|||
return zeros;
|
||||
}
|
||||
|
||||
static __inline__ long
|
||||
ARB_POLY_INLINE long
|
||||
poly_pow_length(long poly_len, ulong exp, long trunc)
|
||||
{
|
||||
mp_limb_t hi, lo;
|
||||
|
|
28
arb_poly/inlines.c
Normal file
28
arb_poly/inlines.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*=============================================================================
|
||||
|
||||
This file is part of ARB.
|
||||
|
||||
ARB is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ARB 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with ARB; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
=============================================================================*/
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (C) 2014 Fredrik Johansson
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#define ARB_POLY_INLINES_C
|
||||
#include "arb_poly.h"
|
||||
|
168
arf.h
168
arf.h
|
@ -29,6 +29,12 @@
|
|||
#ifndef ARF_H
|
||||
#define ARF_H
|
||||
|
||||
#ifdef ARF_INLINES_C
|
||||
#define ARF_INLINE
|
||||
#else
|
||||
#define ARF_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include "flint.h"
|
||||
#include "fmpr.h"
|
||||
|
@ -45,7 +51,7 @@ extern "C" {
|
|||
#define ARF_RND_CEIL FMPR_RND_CEIL
|
||||
#define ARF_RND_NEAR FMPR_RND_NEAR
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_rounds_down(arf_rnd_t rnd, int sgnbit)
|
||||
{
|
||||
if (rnd == ARF_RND_DOWN) return 1;
|
||||
|
@ -54,7 +60,7 @@ arf_rounds_down(arf_rnd_t rnd, int sgnbit)
|
|||
return sgnbit;
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_rounds_up(arf_rnd_t rnd, int sgnbit)
|
||||
{
|
||||
if (rnd == ARF_RND_DOWN) return 0;
|
||||
|
@ -63,7 +69,7 @@ arf_rounds_up(arf_rnd_t rnd, int sgnbit)
|
|||
return !sgnbit;
|
||||
}
|
||||
|
||||
static __inline__ mpfr_rnd_t
|
||||
ARF_INLINE mpfr_rnd_t
|
||||
arf_rnd_to_mpfr(arf_rnd_t rnd)
|
||||
{
|
||||
if (rnd == ARF_RND_DOWN) return MPFR_RNDZ;
|
||||
|
@ -228,98 +234,98 @@ void _arf_demote(arf_t x);
|
|||
ARF_XSIZE(x) = ARF_MAKE_XSIZE(__xn, 0); \
|
||||
} while (0)
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_init(arf_t x)
|
||||
{
|
||||
fmpz_init(ARF_EXPREF(x));
|
||||
ARF_XSIZE(x) = 0;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_clear(arf_t x)
|
||||
{
|
||||
fmpz_clear(ARF_EXPREF(x));
|
||||
ARF_DEMOTE(x);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_zero(arf_t x)
|
||||
{
|
||||
ARF_MAKE_SPECIAL(x);
|
||||
ARF_EXP(x) = ARF_EXP_ZERO;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_pos_inf(arf_t x)
|
||||
{
|
||||
ARF_MAKE_SPECIAL(x);
|
||||
ARF_EXP(x) = ARF_EXP_POS_INF;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_neg_inf(arf_t x)
|
||||
{
|
||||
ARF_MAKE_SPECIAL(x);
|
||||
ARF_EXP(x) = ARF_EXP_NEG_INF;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_nan(arf_t x)
|
||||
{
|
||||
ARF_MAKE_SPECIAL(x);
|
||||
ARF_EXP(x) = ARF_EXP_NAN;
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_is_special(const arf_t x)
|
||||
{
|
||||
return ARF_IS_SPECIAL(x);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_is_zero(const arf_t x)
|
||||
{
|
||||
return ARF_IS_SPECIAL(x) && (ARF_EXP(x) == ARF_EXP_ZERO);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_is_pos_inf(const arf_t x)
|
||||
{
|
||||
return ARF_IS_SPECIAL(x) && (ARF_EXP(x) == ARF_EXP_POS_INF);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_is_neg_inf(const arf_t x)
|
||||
{
|
||||
return ARF_IS_SPECIAL(x) && (ARF_EXP(x) == ARF_EXP_NEG_INF);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_is_nan(const arf_t x)
|
||||
{
|
||||
return ARF_IS_SPECIAL(x) && (ARF_EXP(x) == ARF_EXP_NAN);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_is_normal(const arf_t x)
|
||||
{
|
||||
return !ARF_IS_SPECIAL(x);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_is_finite(const arf_t x)
|
||||
{
|
||||
return !ARF_IS_SPECIAL(x) || (ARF_EXP(x) == ARF_EXP_ZERO);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_is_inf(const arf_t x)
|
||||
{
|
||||
return ARF_IS_SPECIAL(x) && (ARF_EXP(x) == ARF_EXP_POS_INF ||
|
||||
ARF_EXP(x) == ARF_EXP_NEG_INF);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_one(arf_t x)
|
||||
{
|
||||
fmpz_clear(ARF_EXPREF(x));
|
||||
|
@ -329,14 +335,14 @@ arf_one(arf_t x)
|
|||
ARF_NOPTR_D(x)[0] = LIMB_TOP;
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_is_one(const arf_t x)
|
||||
{
|
||||
return (ARF_EXP(x) == 1) && (ARF_XSIZE(x) == ARF_MAKE_XSIZE(1, 0))
|
||||
&& ARF_NOPTR_D(x)[0] == LIMB_TOP;
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_sgn(const arf_t x)
|
||||
{
|
||||
if (arf_is_special(x))
|
||||
|
@ -355,7 +361,7 @@ int arf_cmp(const arf_t x, const arf_t y);
|
|||
|
||||
int arf_cmpabs(const arf_t x, const arf_t y);
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_swap(arf_t y, arf_t x)
|
||||
{
|
||||
if (x != y)
|
||||
|
@ -366,7 +372,7 @@ arf_swap(arf_t y, arf_t x)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_set(arf_t y, const arf_t x)
|
||||
{
|
||||
if (x != y)
|
||||
|
@ -399,7 +405,7 @@ arf_set(arf_t y, const arf_t x)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_neg(arf_t y, const arf_t x)
|
||||
{
|
||||
arf_set(y, x);
|
||||
|
@ -417,7 +423,7 @@ arf_neg(arf_t y, const arf_t x)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_init_set_ui(arf_t x, ulong v)
|
||||
{
|
||||
if (v == 0)
|
||||
|
@ -435,7 +441,7 @@ arf_init_set_ui(arf_t x, ulong v)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_init_set_si(arf_t x, long v)
|
||||
{
|
||||
arf_init_set_ui(x, FLINT_ABS(v));
|
||||
|
@ -443,7 +449,7 @@ arf_init_set_si(arf_t x, long v)
|
|||
ARF_NEG(x);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_set_ui(arf_t x, ulong v)
|
||||
{
|
||||
ARF_DEMOTE(x);
|
||||
|
@ -464,7 +470,7 @@ arf_set_ui(arf_t x, ulong v)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_set_si(arf_t x, long v)
|
||||
{
|
||||
arf_set_ui(x, FLINT_ABS(v));
|
||||
|
@ -472,7 +478,7 @@ arf_set_si(arf_t x, long v)
|
|||
ARF_NEG(x);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_cmpabs_ui(const arf_t x, ulong y)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -480,20 +486,20 @@ arf_cmpabs_ui(const arf_t x, ulong y)
|
|||
return arf_cmpabs(x, t);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_init_set_shallow(arf_t z, const arf_t x)
|
||||
{
|
||||
*z = *x;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_init_neg_shallow(arf_t z, const arf_t x)
|
||||
{
|
||||
*z = *x;
|
||||
arf_neg(z, z);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_init_set_mag_shallow(arf_t y, const mag_t x)
|
||||
{
|
||||
mp_limb_t t = MAG_MAN(x);
|
||||
|
@ -502,14 +508,14 @@ arf_init_set_mag_shallow(arf_t y, const mag_t x)
|
|||
ARF_NOPTR_D(y)[0] = t << (FLINT_BITS - MAG_BITS);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_init_neg_mag_shallow(arf_t z, const mag_t x)
|
||||
{
|
||||
arf_init_set_mag_shallow(z, x);
|
||||
arf_neg(z, z);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_cmpabs_mag(const arf_t x, const mag_t y)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -517,7 +523,7 @@ arf_cmpabs_mag(const arf_t x, const mag_t y)
|
|||
return arf_cmpabs(x, t);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_mag_cmpabs(const mag_t x, const arf_t y)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -529,7 +535,7 @@ arf_mag_cmpabs(const mag_t x, const arf_t y)
|
|||
/* TBD: 1, 2 limb versions */
|
||||
void arf_set_mpn(arf_t y, mp_srcptr x, mp_size_t xn, int sgnbit);
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_set_mpz(arf_t y, const mpz_t x)
|
||||
{
|
||||
long size = x->_mp_size;
|
||||
|
@ -540,7 +546,7 @@ arf_set_mpz(arf_t y, const mpz_t x)
|
|||
arf_set_mpn(y, x->_mp_d, FLINT_ABS(size), size < 0);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_set_fmpz(arf_t y, const fmpz_t x)
|
||||
{
|
||||
if (!COEFF_IS_MPZ(*x))
|
||||
|
@ -559,19 +565,19 @@ int
|
|||
_arf_set_round_mpn(arf_t y, long * exp_shift, mp_srcptr x, mp_size_t xn,
|
||||
int sgnbit, long prec, arf_rnd_t rnd);
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_set_round_ui(arf_t x, ulong v, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
return _arf_set_round_ui(x, v, 0, prec, rnd);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_set_round_si(arf_t x, long v, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
return _arf_set_round_ui(x, FLINT_ABS(v), v < 0, prec, rnd);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_set_round_mpz(arf_t y, const mpz_t x, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
int inexact;
|
||||
|
@ -591,7 +597,7 @@ arf_set_round_mpz(arf_t y, const mpz_t x, long prec, arf_rnd_t rnd)
|
|||
return inexact;
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_set_round_fmpz(arf_t y, const fmpz_t x, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
if (!COEFF_IS_MPZ(*x))
|
||||
|
@ -614,7 +620,7 @@ void arf_set_mpfr(arf_t x, const mpfr_t y);
|
|||
|
||||
int arf_equal(const arf_t x, const arf_t y);
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_min(arf_t z, const arf_t a, const arf_t b)
|
||||
{
|
||||
if (arf_cmp(a, b) <= 0)
|
||||
|
@ -623,7 +629,7 @@ arf_min(arf_t z, const arf_t a, const arf_t b)
|
|||
arf_set(z, b);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_max(arf_t z, const arf_t a, const arf_t b)
|
||||
{
|
||||
if (arf_cmp(a, b) > 0)
|
||||
|
@ -632,7 +638,7 @@ arf_max(arf_t z, const arf_t a, const arf_t b)
|
|||
arf_set(z, b);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_abs(arf_t y, const arf_t x)
|
||||
{
|
||||
if (arf_sgn(x) < 0)
|
||||
|
@ -641,7 +647,7 @@ arf_abs(arf_t y, const arf_t x)
|
|||
arf_set(y, x);
|
||||
}
|
||||
|
||||
static __inline__ long
|
||||
ARF_INLINE long
|
||||
arf_bits(const arf_t x)
|
||||
{
|
||||
if (arf_is_special(x))
|
||||
|
@ -658,7 +664,7 @@ arf_bits(const arf_t x)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_bot(fmpz_t e, const arf_t x)
|
||||
{
|
||||
if (arf_is_special(x))
|
||||
|
@ -667,7 +673,7 @@ arf_bot(fmpz_t e, const arf_t x)
|
|||
fmpz_sub_si(e, ARF_EXPREF(x), arf_bits(x));
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_is_int(const arf_t x)
|
||||
{
|
||||
if (arf_is_special(x))
|
||||
|
@ -684,7 +690,7 @@ arf_is_int(const arf_t x)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_is_int_2exp_si(const arf_t x, long e)
|
||||
{
|
||||
if (arf_is_special(x))
|
||||
|
@ -705,7 +711,7 @@ int arf_cmp_2exp_si(const arf_t x, long e);
|
|||
|
||||
int arf_cmpabs_2exp_si(const arf_t x, long e);
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_set_si_2exp_si(arf_t x, long man, long exp)
|
||||
{
|
||||
arf_set_si(x, man);
|
||||
|
@ -713,7 +719,7 @@ arf_set_si_2exp_si(arf_t x, long man, long exp)
|
|||
fmpz_add_si_inline(ARF_EXPREF(x), ARF_EXPREF(x), exp);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_set_ui_2exp_si(arf_t x, ulong man, long exp)
|
||||
{
|
||||
arf_set_ui(x, man);
|
||||
|
@ -721,7 +727,7 @@ arf_set_ui_2exp_si(arf_t x, ulong man, long exp)
|
|||
fmpz_add_si_inline(ARF_EXPREF(x), ARF_EXPREF(x), exp);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_mul_2exp_si(arf_t y, const arf_t x, long e)
|
||||
{
|
||||
arf_set(y, x);
|
||||
|
@ -729,7 +735,7 @@ arf_mul_2exp_si(arf_t y, const arf_t x, long e)
|
|||
fmpz_add_si_inline(ARF_EXPREF(y), ARF_EXPREF(y), e);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_mul_2exp_fmpz(arf_t y, const arf_t x, const fmpz_t e)
|
||||
{
|
||||
arf_set(y, x);
|
||||
|
@ -737,7 +743,7 @@ arf_mul_2exp_fmpz(arf_t y, const arf_t x, const fmpz_t e)
|
|||
fmpz_add_inline(ARF_EXPREF(y), ARF_EXPREF(y), e);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_set_round_fmpz_2exp(arf_t y, const fmpz_t x, const fmpz_t exp, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
if (fmpz_is_zero(x))
|
||||
|
@ -753,7 +759,7 @@ arf_set_round_fmpz_2exp(arf_t y, const fmpz_t x, const fmpz_t exp, long prec, ar
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_abs_bound_lt_2exp_fmpz(fmpz_t b, const arf_t x)
|
||||
{
|
||||
if (arf_is_special(x))
|
||||
|
@ -762,7 +768,7 @@ arf_abs_bound_lt_2exp_fmpz(fmpz_t b, const arf_t x)
|
|||
fmpz_set(b, ARF_EXPREF(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_abs_bound_le_2exp_fmpz(fmpz_t b, const arf_t x)
|
||||
{
|
||||
if (arf_is_special(x))
|
||||
|
@ -781,7 +787,7 @@ void arf_get_fmpz(fmpz_t z, const arf_t x, arf_rnd_t rnd);
|
|||
|
||||
long arf_get_si(const arf_t x, arf_rnd_t rnd);
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_get_fmpz_fixed_fmpz(fmpz_t y, const arf_t x, const fmpz_t e)
|
||||
{
|
||||
int r;
|
||||
|
@ -793,7 +799,7 @@ arf_get_fmpz_fixed_fmpz(fmpz_t y, const arf_t x, const fmpz_t e)
|
|||
return r;
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_get_fmpz_fixed_si(fmpz_t y, const arf_t x, long e)
|
||||
{
|
||||
int r;
|
||||
|
@ -805,7 +811,7 @@ arf_get_fmpz_fixed_si(fmpz_t y, const arf_t x, long e)
|
|||
return r;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_set_fmpz_2exp(arf_t x, const fmpz_t man, const fmpz_t exp)
|
||||
{
|
||||
arf_set_fmpz(x, man);
|
||||
|
@ -944,7 +950,7 @@ int arf_mul_rnd_down(arf_ptr z, arf_srcptr x, arf_srcptr y, long prec);
|
|||
? arf_mul_rnd_down(z, x, y, prec) \
|
||||
: arf_mul_rnd_any(z, x, y, prec, rnd))
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_neg_mul(arf_t z, const arf_t x, const arf_t y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
if (arf_is_special(y))
|
||||
|
@ -962,7 +968,7 @@ arf_neg_mul(arf_t z, const arf_t x, const arf_t y, long prec, arf_rnd_t rnd)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_mul_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -970,7 +976,7 @@ arf_mul_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd)
|
|||
return arf_mul(z, x, t, prec, rnd);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_mul_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -980,7 +986,7 @@ arf_mul_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd)
|
|||
|
||||
int arf_mul_mpz(arf_ptr z, arf_srcptr x, const mpz_t y, long prec, arf_rnd_t rnd);
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_mul_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
if (!COEFF_IS_MPZ(*y))
|
||||
|
@ -1045,7 +1051,7 @@ int arf_sub_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t r
|
|||
|
||||
int arf_addmul(arf_ptr z, arf_srcptr x, arf_srcptr y, long prec, arf_rnd_t rnd);
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_addmul_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -1053,7 +1059,7 @@ arf_addmul_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd)
|
|||
return arf_addmul(z, x, t, prec, rnd);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_addmul_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -1063,7 +1069,7 @@ arf_addmul_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd)
|
|||
|
||||
int arf_addmul_mpz(arf_ptr z, arf_srcptr x, const mpz_t y, long prec, arf_rnd_t rnd);
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_addmul_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
if (!COEFF_IS_MPZ(*y))
|
||||
|
@ -1074,7 +1080,7 @@ arf_addmul_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rn
|
|||
|
||||
int arf_submul(arf_ptr z, arf_srcptr x, arf_srcptr y, long prec, arf_rnd_t rnd);
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_submul_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -1082,7 +1088,7 @@ arf_submul_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd)
|
|||
return arf_submul(z, x, t, prec, rnd);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_submul_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -1092,7 +1098,7 @@ arf_submul_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd)
|
|||
|
||||
int arf_submul_mpz(arf_ptr z, arf_srcptr x, const mpz_t y, long prec, arf_rnd_t rnd);
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_submul_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
if (!COEFF_IS_MPZ(*y))
|
||||
|
@ -1103,7 +1109,7 @@ arf_submul_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rn
|
|||
|
||||
int arf_div(arf_ptr z, arf_srcptr x, arf_srcptr y, long prec, arf_rnd_t rnd);
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_div_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -1111,7 +1117,7 @@ arf_div_ui(arf_ptr z, arf_srcptr x, ulong y, long prec, arf_rnd_t rnd)
|
|||
return arf_div(z, x, t, prec, rnd);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_ui_div(arf_ptr z, ulong x, arf_srcptr y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -1119,7 +1125,7 @@ arf_ui_div(arf_ptr z, ulong x, arf_srcptr y, long prec, arf_rnd_t rnd)
|
|||
return arf_div(z, t, y, prec, rnd);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_div_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -1127,7 +1133,7 @@ arf_div_si(arf_ptr z, arf_srcptr x, long y, long prec, arf_rnd_t rnd)
|
|||
return arf_div(z, x, t, prec, rnd);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_si_div(arf_ptr z, long x, arf_srcptr y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -1135,7 +1141,7 @@ arf_si_div(arf_ptr z, long x, arf_srcptr y, long prec, arf_rnd_t rnd)
|
|||
return arf_div(z, t, y, prec, rnd);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_div_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -1147,7 +1153,7 @@ arf_div_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, long prec, arf_rnd_t rnd)
|
|||
return r;
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_fmpz_div(arf_ptr z, const fmpz_t x, arf_srcptr y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
arf_t t;
|
||||
|
@ -1159,7 +1165,7 @@ arf_fmpz_div(arf_ptr z, const fmpz_t x, arf_srcptr y, long prec, arf_rnd_t rnd)
|
|||
return r;
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_fmpz_div_fmpz(arf_ptr z, const fmpz_t x, const fmpz_t y, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
arf_t t, u;
|
||||
|
@ -1188,7 +1194,7 @@ void arf_get_mag(mag_t y, const arf_t x);
|
|||
|
||||
void arf_get_mag_lower(mag_t y, const arf_t x);
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_set_mag(arf_t y, const mag_t x)
|
||||
{
|
||||
if (mag_is_zero(x))
|
||||
|
@ -1208,14 +1214,14 @@ arf_set_mag(arf_t y, const mag_t x)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
mag_init_set_arf(mag_t y, const arf_t x)
|
||||
{
|
||||
mag_init(y);
|
||||
arf_get_mag(y, x);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
mag_fast_init_set_arf(mag_t y, const arf_t x)
|
||||
{
|
||||
if (ARF_IS_SPECIAL(x)) /* x == 0 */
|
||||
|
@ -1236,13 +1242,13 @@ mag_fast_init_set_arf(mag_t y, const arf_t x)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_mag_fast_add_ulp(mag_t z, const mag_t x, const arf_t y, long prec)
|
||||
{
|
||||
mag_fast_add_2exp_si(z, x, ARF_EXP(y) - prec);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_mag_add_ulp(mag_t z, const mag_t x, const arf_t y, long prec)
|
||||
{
|
||||
if (ARF_IS_SPECIAL(y))
|
||||
|
@ -1264,7 +1270,7 @@ arf_mag_add_ulp(mag_t z, const mag_t x, const arf_t y, long prec)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
ARF_INLINE void
|
||||
arf_mag_set_ulp(mag_t z, const arf_t y, long prec)
|
||||
{
|
||||
if (ARF_IS_SPECIAL(y))
|
||||
|
@ -1281,7 +1287,7 @@ arf_mag_set_ulp(mag_t z, const arf_t y, long prec)
|
|||
|
||||
void arf_get_fmpq(fmpq_t y, const arf_t x);
|
||||
|
||||
static __inline__ int
|
||||
ARF_INLINE int
|
||||
arf_set_fmpq(arf_t y, const fmpq_t x, long prec, arf_rnd_t rnd)
|
||||
{
|
||||
return arf_fmpz_div_fmpz(y, fmpq_numref(x), fmpq_denref(x), prec, rnd);
|
||||
|
|
28
arf/inlines.c
Normal file
28
arf/inlines.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*=============================================================================
|
||||
|
||||
This file is part of ARB.
|
||||
|
||||
ARB is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ARB 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with ARB; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
=============================================================================*/
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (C) 2014 Fredrik Johansson
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#define ARF_INLINES_C
|
||||
#include "arf.h"
|
||||
|
80
mag.h
80
mag.h
|
@ -26,6 +26,12 @@
|
|||
#ifndef MAG_H
|
||||
#define MAG_H
|
||||
|
||||
#ifdef MAG_INLINES_C
|
||||
#define MAG_INLINE
|
||||
#else
|
||||
#define MAG_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include "flint.h"
|
||||
#include "fmpz.h"
|
||||
|
@ -196,27 +202,27 @@ typedef mag_struct mag_t[1];
|
|||
typedef mag_struct * mag_ptr;
|
||||
typedef const mag_struct * mag_srcptr;
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_init(mag_t x)
|
||||
{
|
||||
fmpz_init(MAG_EXPREF(x));
|
||||
MAG_MAN(x) = 0;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_init_set(mag_t x, const mag_t y)
|
||||
{
|
||||
fmpz_init_set(MAG_EXPREF(x), MAG_EXPREF(y));
|
||||
MAG_MAN(x) = MAG_MAN(y);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_clear(mag_t x)
|
||||
{
|
||||
fmpz_clear(MAG_EXPREF(x));
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_swap(mag_t x, mag_t y)
|
||||
{
|
||||
mag_struct t = *x;
|
||||
|
@ -224,40 +230,40 @@ mag_swap(mag_t x, mag_t y)
|
|||
*y = t;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_set(mag_t x, const mag_t y)
|
||||
{
|
||||
_fmpz_set_fast(MAG_EXPREF(x), MAG_EXPREF(y));
|
||||
x->man = y->man;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_zero(mag_t x)
|
||||
{
|
||||
fmpz_zero(MAG_EXPREF(x));
|
||||
MAG_MAN(x) = 0;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_one(mag_t x)
|
||||
{
|
||||
fmpz_one(MAG_EXPREF(x));
|
||||
MAG_MAN(x) = MAG_ONE_HALF;
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
MAG_INLINE int
|
||||
mag_is_special(const mag_t x)
|
||||
{
|
||||
return MAG_MAN(x) == 0;
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
MAG_INLINE int
|
||||
mag_is_zero(const mag_t x)
|
||||
{
|
||||
return (MAG_MAN(x) == 0) && (MAG_EXP(x) == 0);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_inf(mag_t x)
|
||||
{
|
||||
fmpz_clear(MAG_EXPREF(x));
|
||||
|
@ -265,19 +271,19 @@ mag_inf(mag_t x)
|
|||
MAG_MAN(x) = 0;
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
MAG_INLINE int
|
||||
mag_is_inf(const mag_t x)
|
||||
{
|
||||
return (MAG_MAN(x) == 0) && (MAG_EXP(x) != 0);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
MAG_INLINE int
|
||||
mag_is_finite(const mag_t x)
|
||||
{
|
||||
return !mag_is_inf(x);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
MAG_INLINE int
|
||||
mag_equal(const mag_t x, const mag_t y)
|
||||
{
|
||||
return (MAG_MAN(x) == MAG_MAN(y))
|
||||
|
@ -300,7 +306,7 @@ void mag_add_lower(mag_t z, const mag_t x, const mag_t y);
|
|||
|
||||
void mag_div(mag_t z, const mag_t x, const mag_t y);
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_mul_2exp_si(mag_t z, const mag_t x, long y)
|
||||
{
|
||||
if (mag_is_special(x))
|
||||
|
@ -317,7 +323,7 @@ mag_mul_2exp_si(mag_t z, const mag_t x, long y)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_mul_2exp_fmpz(mag_t z, const mag_t x, const fmpz_t y)
|
||||
{
|
||||
if (mag_is_special(x))
|
||||
|
@ -336,27 +342,27 @@ void mag_sub_lower(mag_t z, const mag_t x, const mag_t y);
|
|||
/* Fast versions (no infs/nans, small exponents). Note that this
|
||||
applies to outputs too! */
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_fast_init_set(mag_t x, const mag_t y)
|
||||
{
|
||||
MAG_EXP(x) = MAG_EXP(y);
|
||||
MAG_MAN(x) = MAG_MAN(y);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_fast_zero(mag_t x)
|
||||
{
|
||||
MAG_EXP(x) = 0;
|
||||
MAG_MAN(x) = 0;
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
MAG_INLINE int
|
||||
mag_fast_is_zero(const mag_t x)
|
||||
{
|
||||
return MAG_MAN(x) == 0;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_fast_mul(mag_t z, const mag_t x, const mag_t y)
|
||||
{
|
||||
if (MAG_MAN(x) == 0 || MAG_MAN(y) == 0)
|
||||
|
@ -371,7 +377,7 @@ mag_fast_mul(mag_t z, const mag_t x, const mag_t y)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_fast_mul_2exp_si(mag_t z, const mag_t x, long y)
|
||||
{
|
||||
if (MAG_MAN(x) == 0)
|
||||
|
@ -385,7 +391,7 @@ mag_fast_mul_2exp_si(mag_t z, const mag_t x, long y)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_fast_addmul(mag_t z, const mag_t x, const mag_t y)
|
||||
{
|
||||
if (MAG_MAN(z) == 0)
|
||||
|
@ -428,7 +434,7 @@ mag_fast_addmul(mag_t z, const mag_t x, const mag_t y)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_fast_add_2exp_si(mag_t z, const mag_t x, long e)
|
||||
{
|
||||
/* Must be zero */
|
||||
|
@ -490,7 +496,7 @@ int mag_cmp(const mag_t x, const mag_t y);
|
|||
|
||||
int mag_cmp_2exp_si(const mag_t x, long e);
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_min(mag_t z, const mag_t x, const mag_t y)
|
||||
{
|
||||
if (mag_cmp(x, y) <= 0)
|
||||
|
@ -499,7 +505,7 @@ mag_min(mag_t z, const mag_t x, const mag_t y)
|
|||
mag_set(z, y);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_max(mag_t z, const mag_t x, const mag_t y)
|
||||
{
|
||||
if (mag_cmp(x, y) >= 0)
|
||||
|
@ -508,7 +514,7 @@ mag_max(mag_t z, const mag_t x, const mag_t y)
|
|||
mag_set(z, y);
|
||||
}
|
||||
|
||||
static __inline__ mag_ptr
|
||||
MAG_INLINE mag_ptr
|
||||
_mag_vec_init(long n)
|
||||
{
|
||||
long i;
|
||||
|
@ -520,7 +526,7 @@ _mag_vec_init(long n)
|
|||
return v;
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
_mag_vec_clear(mag_ptr v, long n)
|
||||
{
|
||||
long i;
|
||||
|
@ -529,7 +535,7 @@ _mag_vec_clear(mag_ptr v, long n)
|
|||
flint_free(v);
|
||||
}
|
||||
|
||||
static __inline__ void mag_set_d(mag_t z, double x)
|
||||
MAG_INLINE void mag_set_d(mag_t z, double x)
|
||||
{
|
||||
fmpz_t e;
|
||||
fmpz_init(e);
|
||||
|
@ -550,7 +556,7 @@ void mag_log_ui(mag_t t, ulong n);
|
|||
|
||||
void mag_exp_maglim(mag_t y, const mag_t x, long maglim);
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_exp(mag_t y, const mag_t x)
|
||||
{
|
||||
mag_exp_maglim(y, x, 128);
|
||||
|
@ -583,14 +589,14 @@ void mag_set_ui(mag_t z, ulong x);
|
|||
void mag_set_ui_lower(mag_t z, ulong x);
|
||||
|
||||
/* TODO: test functions below */
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_set_ui_2exp_si(mag_t z, ulong v, long e)
|
||||
{
|
||||
mag_set_ui(z, v);
|
||||
mag_mul_2exp_si(z, z, e);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_set_fmpz(mag_t z, const fmpz_t x)
|
||||
{
|
||||
fmpz_t exp;
|
||||
|
@ -598,7 +604,7 @@ mag_set_fmpz(mag_t z, const fmpz_t x)
|
|||
mag_set_fmpz_2exp_fmpz(z, x, exp);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_set_fmpz_lower(mag_t z, const fmpz_t x)
|
||||
{
|
||||
fmpz_t exp;
|
||||
|
@ -606,7 +612,7 @@ mag_set_fmpz_lower(mag_t z, const fmpz_t x)
|
|||
mag_set_fmpz_2exp_fmpz_lower(z, x, exp);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_mul_ui(mag_t z, const mag_t x, ulong y)
|
||||
{
|
||||
mag_t t;
|
||||
|
@ -616,7 +622,7 @@ mag_mul_ui(mag_t z, const mag_t x, ulong y)
|
|||
mag_clear(t);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_mul_ui_lower(mag_t z, const mag_t x, ulong y)
|
||||
{
|
||||
mag_t t;
|
||||
|
@ -626,7 +632,7 @@ mag_mul_ui_lower(mag_t z, const mag_t x, ulong y)
|
|||
mag_clear(t);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_mul_fmpz(mag_t z, const mag_t x, const fmpz_t y)
|
||||
{
|
||||
mag_t t;
|
||||
|
@ -636,7 +642,7 @@ mag_mul_fmpz(mag_t z, const mag_t x, const fmpz_t y)
|
|||
mag_clear(t);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_mul_fmpz_lower(mag_t z, const mag_t x, const fmpz_t y)
|
||||
{
|
||||
mag_t t;
|
||||
|
@ -646,7 +652,7 @@ mag_mul_fmpz_lower(mag_t z, const mag_t x, const fmpz_t y)
|
|||
mag_clear(t);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_div_ui(mag_t z, const mag_t x, ulong y)
|
||||
{
|
||||
mag_t t;
|
||||
|
@ -656,7 +662,7 @@ mag_div_ui(mag_t z, const mag_t x, ulong y)
|
|||
mag_clear(t);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
MAG_INLINE void
|
||||
mag_div_fmpz(mag_t z, const mag_t x, const fmpz_t y)
|
||||
{
|
||||
mag_t t;
|
||||
|
|
28
mag/inlines.c
Normal file
28
mag/inlines.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*=============================================================================
|
||||
|
||||
This file is part of ARB.
|
||||
|
||||
ARB is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ARB 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with ARB; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
=============================================================================*/
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (C) 2014 Fredrik Johansson
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#define MAG_INLINES_C
|
||||
#include "mag.h"
|
||||
|
Loading…
Add table
Reference in a new issue