File indexing completed on 2026-11-07 10:15:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef CA_EXT_H
0013 #define CA_EXT_H
0014
0015 #ifdef CA_EXT_INLINES_C
0016 #define CA_EXT_INLINE
0017 #else
0018 #define CA_EXT_INLINE static inline
0019 #endif
0020
0021 #include "ca.h"
0022
0023 #ifdef __cplusplus
0024 extern "C" {
0025 #endif
0026
0027
0028
0029
0030
0031 void ca_ext_init_qqbar(ca_ext_t res, const qqbar_t x, ca_ctx_t ctx);
0032 void ca_ext_init_const(ca_ext_t res, calcium_func_code func, ca_ctx_t ctx);
0033 void ca_ext_init_fx(ca_ext_t res, calcium_func_code func, const ca_t x, ca_ctx_t ctx);
0034 void ca_ext_init_fxy(ca_ext_t res, calcium_func_code func, const ca_t x, const ca_t y, ca_ctx_t ctx);
0035 void ca_ext_init_fxn(ca_ext_t res, calcium_func_code func, ca_srcptr x, slong nargs, ca_ctx_t ctx);
0036
0037
0038 CA_EXT_INLINE void
0039 ca_ext_init_set(ca_ext_t res, const ca_ext_t x, ca_ctx_t ctx)
0040 {
0041 if (CA_EXT_HEAD(x) == CA_QQBar)
0042 {
0043 ca_ext_init_qqbar(res, CA_EXT_QQBAR(x), ctx);
0044 }
0045 else
0046 {
0047 ca_ext_init_fxn(res, CA_EXT_HEAD(x), CA_EXT_FUNC_ARGS(x), CA_EXT_FUNC_NARGS(x), ctx);
0048 }
0049 }
0050
0051 void ca_ext_clear(ca_ext_t res, ca_ctx_t ctx);
0052
0053 CA_EXT_INLINE slong ca_ext_nargs(const ca_ext_t x, ca_ctx_t FLINT_UNUSED(ctx))
0054 {
0055 if (CA_EXT_HEAD(x) == CA_QQBar)
0056 return 0;
0057 else
0058 return CA_EXT_FUNC_NARGS(x);
0059 }
0060
0061 CA_EXT_INLINE void ca_ext_get_arg(ca_t res, const ca_ext_t x, slong i, ca_ctx_t ctx)
0062 {
0063 if (CA_EXT_HEAD(x) == CA_QQBar || i < 0 || i >= CA_EXT_FUNC_NARGS(x))
0064 {
0065 flint_throw(FLINT_ERROR, "ca_ext_get_arg: index out of range\n");
0066 }
0067 else
0068 {
0069 ca_set(res, CA_EXT_FUNC_ARGS(x) + i, ctx);
0070 }
0071 }
0072
0073 CA_EXT_INLINE ulong ca_ext_hash(const ca_ext_t x, ca_ctx_t FLINT_UNUSED(ctx))
0074 {
0075 return CA_EXT_HASH(x);
0076 }
0077
0078 int ca_ext_equal_repr(const ca_ext_t x, const ca_ext_t y, ca_ctx_t ctx);
0079 int ca_ext_cmp_repr(const ca_ext_t x, const ca_ext_t y, ca_ctx_t ctx);
0080
0081 void ca_ext_print(const ca_ext_t x, ca_ctx_t ctx);
0082
0083 void ca_ext_get_acb_raw(acb_t res, ca_ext_t x, slong prec, ca_ctx_t ctx);
0084
0085
0086 void ca_ext_cache_init(ca_ext_cache_t cache, ca_ctx_t ctx);
0087 void ca_ext_cache_clear(ca_ext_cache_t cache, ca_ctx_t ctx);
0088 ca_ext_ptr ca_ext_cache_insert(ca_ext_cache_t cache, const ca_ext_t x, ca_ctx_t ctx);
0089
0090 #ifdef __cplusplus
0091 }
0092 #endif
0093
0094 #endif