passagemath-gap-pkg-float 10.8.1a4__cp311-cp311-macosx_13_0_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gap/pkg/float/COPYING +340 -0
- gap/pkg/float/PackageInfo.g +109 -0
- gap/pkg/float/README.md +76 -0
- gap/pkg/float/THANKS +1 -0
- gap/pkg/float/TODO +9 -0
- gap/pkg/float/bin/x86_64-apple-darwin24-default64-kv10/float.so +0 -0
- gap/pkg/float/build-aux/compile +348 -0
- gap/pkg/float/build-aux/config.guess~ +1748 -0
- gap/pkg/float/build-aux/config.sub~ +1884 -0
- gap/pkg/float/build-aux/depcomp +791 -0
- gap/pkg/float/build-aux/install-sh +541 -0
- gap/pkg/float/build-aux/install-sh~ +541 -0
- gap/pkg/float/build-aux/ltmain.sh +11524 -0
- gap/pkg/float/build-aux/missing +215 -0
- gap/pkg/float/config.h.in +105 -0
- gap/pkg/float/init.g +51 -0
- gap/pkg/float/lib/cxsc.gi +604 -0
- gap/pkg/float/lib/float.gd +187 -0
- gap/pkg/float/lib/fplll.gi +27 -0
- gap/pkg/float/lib/mpc.gi +243 -0
- gap/pkg/float/lib/mpfi.gi +270 -0
- gap/pkg/float/lib/mpfr.gi +328 -0
- gap/pkg/float/lib/pickle.g +131 -0
- gap/pkg/float/lib/polynomial.gi +12 -0
- gap/pkg/float/lib/pslq.gi +431 -0
- gap/pkg/float/libtool +12190 -0
- gap/pkg/float/makedoc.g +11 -0
- gap/pkg/float/read.g +46 -0
- gap/pkg/float/tst/arithmetic.tst +35 -0
- gap/pkg/float/tst/fplll.tst +19 -0
- gap/pkg/float/tst/polynomials.tst +30 -0
- gap/pkg/float/tst/testall.g +63 -0
- passagemath_gap_pkg_float/.dylibs/libfplll.9.dylib +0 -0
- passagemath_gap_pkg_float/.dylibs/libgmp.10.dylib +0 -0
- passagemath_gap_pkg_float/.dylibs/libmpc.3.dylib +0 -0
- passagemath_gap_pkg_float/.dylibs/libmpfi.0.dylib +0 -0
- passagemath_gap_pkg_float/.dylibs/libmpfr.6.dylib +0 -0
- passagemath_gap_pkg_float/__init__.py +3 -0
- passagemath_gap_pkg_float-10.8.1a4.dist-info/METADATA +92 -0
- passagemath_gap_pkg_float-10.8.1a4.dist-info/METADATA.bak +93 -0
- passagemath_gap_pkg_float-10.8.1a4.dist-info/RECORD +46 -0
- passagemath_gap_pkg_float-10.8.1a4.dist-info/WHEEL +6 -0
- passagemath_gap_pkg_float-10.8.1a4.dist-info/top_level.txt +2 -0
- sage/all__sagemath_gap_pkg_float.py +1 -0
- sage/libs/all__sagemath_gap_pkg_float.py +1 -0
- sage/libs/gap_pkg_float.cpython-311-darwin.so +0 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
#############################################################################
|
|
2
|
+
##
|
|
3
|
+
#W float.gd GAP library Laurent Bartholdi
|
|
4
|
+
##
|
|
5
|
+
#Y Copyright (C) 2008 Laurent Bartholdi
|
|
6
|
+
##
|
|
7
|
+
## This file deals with general float functions
|
|
8
|
+
##
|
|
9
|
+
|
|
10
|
+
# with precision
|
|
11
|
+
DeclareConstructor("NewFloat",[IsFloat,IsFloat,IsInt]);
|
|
12
|
+
DeclareOperation("MakeFloat",[IsFloat,IsFloat,IsInt]);
|
|
13
|
+
|
|
14
|
+
#############################################################################
|
|
15
|
+
##
|
|
16
|
+
#C IsMPFRFloat
|
|
17
|
+
##
|
|
18
|
+
## <#GAPDoc Label="IsMPFRFloat">
|
|
19
|
+
## <ManSection>
|
|
20
|
+
## <Filt Name="IsMPFRFloat"/>
|
|
21
|
+
## <Var Name="TYPE_MPFR"/>
|
|
22
|
+
## <Description>
|
|
23
|
+
## The category of floating-point numbers.
|
|
24
|
+
##
|
|
25
|
+
## <P/> Note that they are treated as commutative and scalar, but are
|
|
26
|
+
## not necessarily associative.
|
|
27
|
+
## </Description>
|
|
28
|
+
## </ManSection>
|
|
29
|
+
## <#/GAPDoc>
|
|
30
|
+
##
|
|
31
|
+
if IsBound(MPFR_INT) then
|
|
32
|
+
DeclareRepresentation("IsMPFRFloat", IsFloat and IsDataObjectRep, []);
|
|
33
|
+
BindGlobal("MPFRFloatsFamily", NewFamily("MPFRFloatsFamily", IsMPFRFloat));
|
|
34
|
+
DeclareProperty("IsMPFRFloatFamily",IsFloatFamily);
|
|
35
|
+
SetIsMPFRFloatFamily(MPFRFloatsFamily,true);
|
|
36
|
+
BindGlobal("TYPE_MPFR", NewType(MPFRFloatsFamily, IsMPFRFloat));
|
|
37
|
+
DeclareGlobalVariable("MPFR");
|
|
38
|
+
fi;
|
|
39
|
+
#############################################################################
|
|
40
|
+
|
|
41
|
+
#############################################################################
|
|
42
|
+
##
|
|
43
|
+
#C IsMPFIFloat
|
|
44
|
+
##
|
|
45
|
+
## <#GAPDoc Label="IsMPFIFloat">
|
|
46
|
+
## <ManSection>
|
|
47
|
+
## <Filt Name="IsMPFIFloat"/>
|
|
48
|
+
## <Var Name="TYPE_MPFI"/>
|
|
49
|
+
## <Description>
|
|
50
|
+
## The category of intervals of floating-point numbers.
|
|
51
|
+
##
|
|
52
|
+
## <P/> Note that they are treated as commutative and scalar, but are
|
|
53
|
+
## not necessarily associative.
|
|
54
|
+
## </Description>
|
|
55
|
+
## </ManSection>
|
|
56
|
+
## <#/GAPDoc>
|
|
57
|
+
##
|
|
58
|
+
if IsBound(MPFI_INT) then
|
|
59
|
+
DeclareRepresentation("IsMPFIFloat", IsFloatInterval and IsDataObjectRep, []);
|
|
60
|
+
BindGlobal("MPFIFloatsFamily", NewFamily("MPFIFloatsFamily", IsMPFIFloat));
|
|
61
|
+
DeclareProperty("IsMPFIFloatFamily",IsFloatFamily);
|
|
62
|
+
SetIsMPFIFloatFamily(MPFIFloatsFamily,true);
|
|
63
|
+
BindGlobal("TYPE_MPFI", NewType(MPFIFloatsFamily, IsMPFIFloat));
|
|
64
|
+
DeclareGlobalVariable("MPFI");
|
|
65
|
+
fi;
|
|
66
|
+
#############################################################################
|
|
67
|
+
|
|
68
|
+
#############################################################################
|
|
69
|
+
##
|
|
70
|
+
#C IsMPCFloat
|
|
71
|
+
##
|
|
72
|
+
## <#GAPDoc Label="IsMPCFloat">
|
|
73
|
+
## <ManSection>
|
|
74
|
+
## <Filt Name="IsMPCFloat"/>
|
|
75
|
+
## <Var Name="TYPE_MPC"/>
|
|
76
|
+
## <Description>
|
|
77
|
+
## The category of intervals of floating-point numbers.
|
|
78
|
+
##
|
|
79
|
+
## <P/> Note that they are treated as commutative and scalar, but are
|
|
80
|
+
## not necessarily associative.
|
|
81
|
+
## </Description>
|
|
82
|
+
## </ManSection>
|
|
83
|
+
## <#/GAPDoc>
|
|
84
|
+
##
|
|
85
|
+
if IsBound(MPC_INT) then
|
|
86
|
+
DeclareRepresentation("IsMPCFloat", IsComplexFloat and IsDataObjectRep, []);
|
|
87
|
+
BindGlobal("MPCFloatsFamily", NewFamily("MPCFloatsFamily", IsMPCFloat));
|
|
88
|
+
DeclareProperty("IsMPCFloatFamily",IsFloatFamily);
|
|
89
|
+
SetIsMPCFloatFamily(MPCFloatsFamily,true);
|
|
90
|
+
BindGlobal("TYPE_MPC", NewType(MPCFloatsFamily, IsMPCFloat));
|
|
91
|
+
DeclareGlobalVariable("MPC");
|
|
92
|
+
|
|
93
|
+
DeclareAttribute("SphereProject", IsMPCFloat);
|
|
94
|
+
fi;
|
|
95
|
+
#############################################################################
|
|
96
|
+
|
|
97
|
+
#############################################################################
|
|
98
|
+
##
|
|
99
|
+
#C IsCXSCFloat
|
|
100
|
+
##
|
|
101
|
+
## <#GAPDoc Label="IsCXSCFloat">
|
|
102
|
+
## <ManSection>
|
|
103
|
+
## <Filt Name="IsCXSCReal"/>
|
|
104
|
+
## <Filt Name="IsCXSCComplex"/>
|
|
105
|
+
## <Filt Name="IsCXSCInterval"/>
|
|
106
|
+
## <Filt Name="IsCXSCBox"/>
|
|
107
|
+
## <Var Name="TYPE_CXSC_RP"/>
|
|
108
|
+
## <Var Name="TYPE_CXSC_CP"/>
|
|
109
|
+
## <Var Name="TYPE_CXSC_RI"/>
|
|
110
|
+
## <Var Name="TYPE_CXSC_CI"/>
|
|
111
|
+
## <Description>
|
|
112
|
+
## The category of floating-point numbers.
|
|
113
|
+
##
|
|
114
|
+
## <P/> Note that they are treated as commutative and scalar, but are
|
|
115
|
+
## not necessarily associative.
|
|
116
|
+
## </Description>
|
|
117
|
+
## </ManSection>
|
|
118
|
+
## <#/GAPDoc>
|
|
119
|
+
##
|
|
120
|
+
if IsBound(CXSC_INT) then
|
|
121
|
+
DeclareCategory("IsCXSCFloat", IsFloat); # virtual class containing all below
|
|
122
|
+
|
|
123
|
+
DeclareRepresentation("IsCXSCFloatRep", IsCXSCFloat and IsDataObjectRep, []);
|
|
124
|
+
|
|
125
|
+
DeclareCategory("IsCXSCReal", IsFloat and IsCXSCFloatRep);
|
|
126
|
+
DeclareCategoryCollections("IsCXSCReal");
|
|
127
|
+
DeclareCategoryCollections("IsCXSCRealCollection");
|
|
128
|
+
DeclareCategory("IsCXSCComplex", IsComplexFloat and IsCXSCFloatRep);
|
|
129
|
+
DeclareCategoryCollections("IsCXSCComplex");
|
|
130
|
+
DeclareCategoryCollections("IsCXSCComplexCollection");
|
|
131
|
+
DeclareCategory("IsCXSCInterval", IsFloatInterval and IsCXSCFloatRep);
|
|
132
|
+
DeclareCategoryCollections("IsCXSCInterval");
|
|
133
|
+
DeclareCategoryCollections("IsCXSCIntervalCollection");
|
|
134
|
+
DeclareCategory("IsCXSCBox", IsComplexFloatInterval and IsCXSCFloatRep);
|
|
135
|
+
DeclareCategoryCollections("IsCXSCBox");
|
|
136
|
+
DeclareCategoryCollections("IsCXSCBoxCollection");
|
|
137
|
+
|
|
138
|
+
BindGlobal("CXSCFloatsFamily", NewFamily("CXSCFloatsFamily", IsCXSCFloat));
|
|
139
|
+
DeclareProperty("IsCXSCFloatFamily",IsFloatFamily);
|
|
140
|
+
SetIsCXSCFloatFamily(CXSCFloatsFamily,true);
|
|
141
|
+
|
|
142
|
+
BindGlobal("TYPE_CXSC_RP", NewType(CXSCFloatsFamily, IsCXSCReal));
|
|
143
|
+
BindGlobal("TYPE_CXSC_CP", NewType(CXSCFloatsFamily, IsCXSCComplex));
|
|
144
|
+
BindGlobal("TYPE_CXSC_RI", NewType(CXSCFloatsFamily, IsCXSCInterval));
|
|
145
|
+
BindGlobal("TYPE_CXSC_CI", NewType(CXSCFloatsFamily, IsCXSCBox));
|
|
146
|
+
|
|
147
|
+
DeclareGlobalVariable("CXSC");
|
|
148
|
+
fi;
|
|
149
|
+
#############################################################################
|
|
150
|
+
|
|
151
|
+
#############################################################################
|
|
152
|
+
##
|
|
153
|
+
#C FPLLL
|
|
154
|
+
##
|
|
155
|
+
## <#GAPDoc Label="FPLLL">
|
|
156
|
+
## <ManSection>
|
|
157
|
+
## <Oper Name="FPLLLReducedBasis" Arg="m"/>
|
|
158
|
+
## <Returns>A matrix spanning the same lattice as <A>m</A>.</Returns>
|
|
159
|
+
## <Description>
|
|
160
|
+
## This function implements the LLL (Lenstra-Lenstra-Lovász) lattice
|
|
161
|
+
## reduction algorithm via the external library <Package>fplll</Package>.
|
|
162
|
+
##
|
|
163
|
+
## <P/> The result is guaranteed to be optimal up to 1%.
|
|
164
|
+
## </Description>
|
|
165
|
+
## </ManSection>
|
|
166
|
+
##
|
|
167
|
+
## <ManSection>
|
|
168
|
+
## <Oper Name="FPLLLShortestVector" Arg="m"/>
|
|
169
|
+
## <Returns>A short vector in the lattice spanned by <A>m</A>.</Returns>
|
|
170
|
+
## <Description>
|
|
171
|
+
## This function implements the LLL (Lenstra-Lenstra-Lovász) lattice
|
|
172
|
+
## reduction algorithm via the external library <Package>fplll</Package>,
|
|
173
|
+
## and then computes a short vector in this lattice.
|
|
174
|
+
##
|
|
175
|
+
## <P/> The result is guaranteed to be optimal up to 1%.
|
|
176
|
+
## </Description>
|
|
177
|
+
## </ManSection>
|
|
178
|
+
## <#/GAPDoc>
|
|
179
|
+
##
|
|
180
|
+
if IsBound(@FPLLL) then
|
|
181
|
+
DeclareOperation("FPLLLReducedBasis", [IsMatrix]);
|
|
182
|
+
DeclareOperation("FPLLLShortestVector", [IsMatrix]);
|
|
183
|
+
fi;
|
|
184
|
+
#############################################################################
|
|
185
|
+
|
|
186
|
+
#############################################################################
|
|
187
|
+
#E
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#############################################################################
|
|
2
|
+
##
|
|
3
|
+
#W fplll.gi GAP library Laurent Bartholdi
|
|
4
|
+
##
|
|
5
|
+
#Y Copyright (C) 2012 Laurent Bartholdi
|
|
6
|
+
##
|
|
7
|
+
## This file deals with fplll's implementation of LLL lattice reduction
|
|
8
|
+
##
|
|
9
|
+
|
|
10
|
+
#!!! implement all options, arguments etc. to control quality of reduction
|
|
11
|
+
InstallMethod(FPLLLReducedBasis, [IsMatrix], function(m)
|
|
12
|
+
while not ForAll(m,r->IsSubset(Integers,r)) do
|
|
13
|
+
Error(m," must be an integer matrix");
|
|
14
|
+
od;
|
|
15
|
+
return @FPLLL(m,0,true,fail);
|
|
16
|
+
end);
|
|
17
|
+
|
|
18
|
+
InstallMethod(FPLLLShortestVector, [IsMatrix], function(m)
|
|
19
|
+
while not ForAll(m,r->IsSubset(Integers,r)) do
|
|
20
|
+
Error(m," must be an integer matrix");
|
|
21
|
+
od;
|
|
22
|
+
return @FPLLL(m,0,true,true);
|
|
23
|
+
end);
|
|
24
|
+
|
|
25
|
+
#############################################################################
|
|
26
|
+
##
|
|
27
|
+
#E
|
gap/pkg/float/lib/mpc.gi
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
#############################################################################
|
|
2
|
+
##
|
|
3
|
+
#W mpc.gi GAP library Laurent Bartholdi
|
|
4
|
+
##
|
|
5
|
+
#Y Copyright (C) 2008 Laurent Bartholdi
|
|
6
|
+
##
|
|
7
|
+
## This file deals with complex floats
|
|
8
|
+
##
|
|
9
|
+
|
|
10
|
+
################################################################
|
|
11
|
+
# viewers
|
|
12
|
+
################################################################
|
|
13
|
+
InstallMethod(ViewString, "float", [IsMPCFloat],
|
|
14
|
+
function(obj)
|
|
15
|
+
return VIEWSTRING_MPC(obj,FLOAT.VIEW_DIG);
|
|
16
|
+
end);
|
|
17
|
+
|
|
18
|
+
InstallMethod(String, "float, int", [IsMPCFloat, IsInt],
|
|
19
|
+
function(obj,len)
|
|
20
|
+
return STRING_MPC(obj,len);
|
|
21
|
+
end);
|
|
22
|
+
|
|
23
|
+
InstallMethod(String, "float", [IsMPCFloat],
|
|
24
|
+
obj->STRING_MPC(obj,0));
|
|
25
|
+
|
|
26
|
+
BindGlobal("MPCBITS@", function(obj)
|
|
27
|
+
local s;
|
|
28
|
+
s := ValueOption("bits");
|
|
29
|
+
if IsInt(s) then return s; fi;
|
|
30
|
+
if IsMPCFloat(obj) then return PrecisionFloat(obj); fi;
|
|
31
|
+
return MPC.constants.MANT_DIG;
|
|
32
|
+
end);
|
|
33
|
+
|
|
34
|
+
BindGlobal("MPCFLOAT_STRING", s->MPC_STRING(s,MPCBITS@(fail)));
|
|
35
|
+
|
|
36
|
+
################################################################
|
|
37
|
+
# constants
|
|
38
|
+
################################################################
|
|
39
|
+
EAGER_FLOAT_LITERAL_CONVERTERS.c := MPCFLOAT_STRING;
|
|
40
|
+
|
|
41
|
+
DeclareCategory("IsMPCPseudoField", IsFloatPseudoField);
|
|
42
|
+
BindGlobal("MPC_PSEUDOFIELD",
|
|
43
|
+
Objectify(NewType(CollectionsFamily(MPCFloatsFamily),
|
|
44
|
+
IsMPCPseudoField and IsAttributeStoringRep),rec()));
|
|
45
|
+
SetName(MPC_PSEUDOFIELD, FLOAT_COMPLEX_STRING);
|
|
46
|
+
|
|
47
|
+
SetLeftActingDomain(MPC_PSEUDOFIELD,Rationals);
|
|
48
|
+
SetCharacteristic(MPC_PSEUDOFIELD,0);
|
|
49
|
+
SetDimension(MPC_PSEUDOFIELD,infinity);
|
|
50
|
+
SetSize(MPC_PSEUDOFIELD,infinity);
|
|
51
|
+
SetIsWholeFamily(MPC_PSEUDOFIELD,true);
|
|
52
|
+
SetZero(MPC_PSEUDOFIELD,MPC_INT(0));
|
|
53
|
+
SetOne(MPC_PSEUDOFIELD,MPC_INT(1));
|
|
54
|
+
InstallMethod( \in, [IsMPCFloat,IsMPCPseudoField], ReturnTrue);
|
|
55
|
+
|
|
56
|
+
SetIsUFDFamily(MPCFloatsFamily,true);
|
|
57
|
+
SetZero(MPCFloatsFamily,MPC_INT(0));
|
|
58
|
+
SetOne(MPCFloatsFamily,MPC_INT(1));
|
|
59
|
+
|
|
60
|
+
InstallValue(MPC, rec(
|
|
61
|
+
creator := MPCFLOAT_STRING,
|
|
62
|
+
eager := 'c',
|
|
63
|
+
filter := IsMPCFloat,
|
|
64
|
+
field := MPC_PSEUDOFIELD,
|
|
65
|
+
reals := MPFR,
|
|
66
|
+
constants := rec(INFINITY := MPC_MAKEINFINITY(1),
|
|
67
|
+
VIEW_DIG := 6,
|
|
68
|
+
DECIMAL_DIG := 30,
|
|
69
|
+
MANT_DIG := 100,
|
|
70
|
+
NAN := MPC_MAKENAN(1),
|
|
71
|
+
recompute := function(r,prec)
|
|
72
|
+
r.PI := MPC_MPFR(MPFR_PI(prec));
|
|
73
|
+
r.1_PI := Inverse(r.PI);
|
|
74
|
+
r.2PI := MPC_INT(2)*r.PI;
|
|
75
|
+
r.2_PI := MPC_INT(2)*r.1_PI;
|
|
76
|
+
r.2_SQRTPI := MPC_INT(2)/Sqrt(r.PI);
|
|
77
|
+
r.PI_2 := r.PI/MPC_INT(2);
|
|
78
|
+
r.PI_4 := r.PI_2/MPC_INT(2);
|
|
79
|
+
|
|
80
|
+
r.SQRT2 := Sqrt(MPC_INTPREC(2,prec));
|
|
81
|
+
r.1_SQRT2 := Inverse(r.SQRT2);
|
|
82
|
+
|
|
83
|
+
r.E := Exp(MPC_INTPREC(1,prec));
|
|
84
|
+
r.LN2 := Log(MPC_INTPREC(2,prec));
|
|
85
|
+
r.LN10 := Log(MPC_INTPREC(10,prec));
|
|
86
|
+
r.LOG10E := Inverse(r.LN10);
|
|
87
|
+
r.LOG2E := Inverse(r.LN2);
|
|
88
|
+
|
|
89
|
+
r.I := MPC_2MPFR(MPFR_INT(0),MPFR_INTPREC(1,prec));
|
|
90
|
+
r.2IPI := r.I*r.2PI;
|
|
91
|
+
r.OMEGA := MPC_2MPFR(MPFR_INT(1),Sqrt(MPFR_INTPREC(3,prec)))/MPC_INT(2);
|
|
92
|
+
end)));
|
|
93
|
+
|
|
94
|
+
InstallMethod(ObjByExtRep, [IsMPCFloatFamily,IsCyclotomicCollection],
|
|
95
|
+
function(family,obj)
|
|
96
|
+
return OBJBYEXTREP_MPC(obj);
|
|
97
|
+
end);
|
|
98
|
+
|
|
99
|
+
################################################################
|
|
100
|
+
# unary operations
|
|
101
|
+
################################################################
|
|
102
|
+
CallFuncList(function(arg)
|
|
103
|
+
local i;
|
|
104
|
+
for i in arg do
|
|
105
|
+
InstallOtherMethod(VALUE_GLOBAL(i[1]), "MPC float", [IsMPCFloat], i[2]);
|
|
106
|
+
od;
|
|
107
|
+
end, [["AdditiveInverseSameMutability",AINV_MPC],
|
|
108
|
+
["AdditiveInverseMutable",AINV_MPC],
|
|
109
|
+
["InverseMutable",INV_MPC],
|
|
110
|
+
["InverseSameMutability",INV_MPC],
|
|
111
|
+
["AbsoluteValue",ABS_MPC],
|
|
112
|
+
["ZeroMutable",ZERO_MPC],
|
|
113
|
+
["ZeroImmutable",ZERO_MPC],
|
|
114
|
+
["ZeroSameMutability",ZERO_MPC],
|
|
115
|
+
["OneMutable",ONE_MPC],
|
|
116
|
+
["OneImmutable",ONE_MPC],
|
|
117
|
+
["OneSameMutability",ONE_MPC],
|
|
118
|
+
["Sqrt",SQRT_MPC],
|
|
119
|
+
["Cos",COS_MPC],
|
|
120
|
+
["Sin",SIN_MPC],
|
|
121
|
+
["Tan",TAN_MPC],
|
|
122
|
+
["Asin",ASIN_MPC],
|
|
123
|
+
["Acos",ACOS_MPC],
|
|
124
|
+
["Atan",ATAN_MPC],
|
|
125
|
+
["Cosh",COSH_MPC],
|
|
126
|
+
["Sinh",SINH_MPC],
|
|
127
|
+
["Tanh",TANH_MPC],
|
|
128
|
+
["Asinh",ASINH_MPC],
|
|
129
|
+
["Acosh",ACOSH_MPC],
|
|
130
|
+
["Atanh",ATANH_MPC],
|
|
131
|
+
["Log",LOG_MPC],
|
|
132
|
+
["Exp",EXP_MPC],
|
|
133
|
+
["Square",SQR_MPC],
|
|
134
|
+
["SphereProject",PROJ_MPC],
|
|
135
|
+
["FrExp",FREXP_MPC],
|
|
136
|
+
["Norm",NORM_MPC],
|
|
137
|
+
["Argument",ARG_MPC],
|
|
138
|
+
["IsXInfinity",ISINF_MPC],
|
|
139
|
+
["IsPInfinity",ISINF_MPC],
|
|
140
|
+
["IsNInfinity",ISINF_MPC],
|
|
141
|
+
["IsFinite",ISNUMBER_MPC],
|
|
142
|
+
["IsNaN",ISNAN_MPC],
|
|
143
|
+
["ExtRepOfObj",EXTREPOFOBJ_MPC],
|
|
144
|
+
["RealPart",REAL_MPC],
|
|
145
|
+
["ImaginaryPart",IMAG_MPC],
|
|
146
|
+
["ComplexConjugate",CONJ_MPC],
|
|
147
|
+
["PrecisionFloat",PREC_MPC]]);
|
|
148
|
+
|
|
149
|
+
################################################################
|
|
150
|
+
# binary operations
|
|
151
|
+
################################################################
|
|
152
|
+
CallFuncList(function(arg)
|
|
153
|
+
local i;
|
|
154
|
+
for i in arg do
|
|
155
|
+
InstallMethod(VALUE_GLOBAL(i), "MPC float, MPC float", [IsMPCFloat, IsMPCFloat],
|
|
156
|
+
VALUE_GLOBAL(Concatenation(i,"_MPC")));
|
|
157
|
+
InstallMethod(VALUE_GLOBAL(i), "MPC float, MPFR float", [IsMPCFloat, IsMPFRFloat],
|
|
158
|
+
VALUE_GLOBAL(Concatenation(i,"_MPC_MPFR")));
|
|
159
|
+
InstallMethod(VALUE_GLOBAL(i), "MPFR float, MPC float", [IsMPFRFloat, IsMPCFloat],
|
|
160
|
+
VALUE_GLOBAL(Concatenation(i,"_MPFR_MPC")));
|
|
161
|
+
od;
|
|
162
|
+
end, ["SUM","DIFF","QUO","PROD","LQUO","POW","EQ","LT"]);
|
|
163
|
+
|
|
164
|
+
InstallMethod(LdExp, "MPC float, int", [IsMPCFloat, IsInt], LDEXP_MPC);
|
|
165
|
+
|
|
166
|
+
InstallMethod(RootsFloatOp, "MPC float list, MPC float",
|
|
167
|
+
[IsList,IsMPCFloat],
|
|
168
|
+
function(coeff,tag)
|
|
169
|
+
if ForAll(coeff,x->IsMPCFloat(x)) then
|
|
170
|
+
return ROOTPOLY_MPC(coeff,MPCBITS@(fail));
|
|
171
|
+
fi;
|
|
172
|
+
TryNextMethod();
|
|
173
|
+
end);
|
|
174
|
+
|
|
175
|
+
################################################################
|
|
176
|
+
# constructor
|
|
177
|
+
################################################################
|
|
178
|
+
|
|
179
|
+
INSTALLFLOATCREATOR("for list", [IsMPCFloat,IsList],
|
|
180
|
+
function(filter,list)
|
|
181
|
+
return OBJBYEXTREP_MPC(list);
|
|
182
|
+
end);
|
|
183
|
+
|
|
184
|
+
INSTALLFLOATCREATOR("for integers", [IsMPCFloat,IsInt],
|
|
185
|
+
function(filter,int)
|
|
186
|
+
return MPC_INTPREC(int,MPCBITS@(filter));
|
|
187
|
+
end);
|
|
188
|
+
|
|
189
|
+
INSTALLFLOATCREATOR("for rationals", [IsMPCFloat,IsRat], -1,
|
|
190
|
+
function(filter,rat)
|
|
191
|
+
local n, d, prec;
|
|
192
|
+
n := NumeratorRat(rat);
|
|
193
|
+
d := DenominatorRat(rat);
|
|
194
|
+
prec := MPCBITS@(filter);
|
|
195
|
+
return MPC_INTPREC(n,prec)/MPC_INTPREC(d,prec);
|
|
196
|
+
end);
|
|
197
|
+
|
|
198
|
+
INSTALLFLOATCREATOR("for strings", [IsMPCFloat,IsString],
|
|
199
|
+
function(filter,s)
|
|
200
|
+
return MPC_STRING(s,MPCBITS@(filter));
|
|
201
|
+
end);
|
|
202
|
+
|
|
203
|
+
INSTALLFLOATCREATOR("for MPC float", [IsMPCFloat,IsMPCFloat],
|
|
204
|
+
function(filter,obj)
|
|
205
|
+
return MPC_MPCPREC(obj,MPCBITS@(filter));
|
|
206
|
+
end);
|
|
207
|
+
|
|
208
|
+
INSTALLFLOATCREATOR("for MPFR float", [IsMPCFloat,IsMPFRFloat],
|
|
209
|
+
function(filter,obj)
|
|
210
|
+
return MPC_MPFR(obj);
|
|
211
|
+
end);
|
|
212
|
+
|
|
213
|
+
DECLAREFLOATCREATOR(IsMPCFloat,IsMPFRFloat,IsMPFRFloat);
|
|
214
|
+
INSTALLFLOATCREATOR("for 2 MPFR floats", [IsMPCFloat,IsMPFRFloat,IsMPFRFloat],
|
|
215
|
+
function(filter,re,im)
|
|
216
|
+
return MPC_2MPFR(re,im);
|
|
217
|
+
end);
|
|
218
|
+
|
|
219
|
+
DECLAREFLOATCREATOR(IsMPCFloat,IsInt,IsInt);
|
|
220
|
+
INSTALLFLOATCREATOR("for 2 ints", [IsMPCFloat,IsInt,IsInt],
|
|
221
|
+
function(filter,re,im)
|
|
222
|
+
return MPC_2MPFR(MPFR_INT(re),MPFR_INT(im));
|
|
223
|
+
end);
|
|
224
|
+
|
|
225
|
+
INSTALLFLOATCREATOR("for macfloat", [IsMPCFloat,IsIEEE754FloatRep],
|
|
226
|
+
function(filter,obj)
|
|
227
|
+
return MPC_MPFR(MPFR_MACFLOAT(obj));
|
|
228
|
+
end);
|
|
229
|
+
|
|
230
|
+
INSTALLFLOATCREATOR("for cyc", [IsMPCFloat,IsCyc], -2,
|
|
231
|
+
function(filter,obj)
|
|
232
|
+
local l, z;
|
|
233
|
+
l := ExtRepOfObj(obj);
|
|
234
|
+
z := MPC_2MPFR(0.0_r,2.0_r*MPFR_PI(MPCBITS@(filter)))/Length(l);
|
|
235
|
+
return l*List([0..Length(l)-1],i->Exp(z*i));
|
|
236
|
+
end);
|
|
237
|
+
|
|
238
|
+
INSTALLFLOATCONSTRUCTORS(MPC);
|
|
239
|
+
MPC.constants.recompute(MPC.constants,MPC.constants.MANT_DIG);
|
|
240
|
+
|
|
241
|
+
#############################################################################
|
|
242
|
+
##
|
|
243
|
+
#E
|