File: float.gd

package info (click to toggle)
gap-float 1.0.3%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 576 kB
  • sloc: ansic: 2,162; cpp: 2,025; xml: 194; makefile: 113; sh: 1
file content (187 lines) | stat: -rw-r--r-- 6,494 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#############################################################################
##
#W  float.gd                       GAP library              Laurent Bartholdi
##
#Y  Copyright (C) 2008 Laurent Bartholdi
##
##  This file deals with general float functions
##

# with precision
DeclareConstructor("NewFloat",[IsFloat,IsFloat,IsInt]);
DeclareOperation("MakeFloat",[IsFloat,IsFloat,IsInt]);

#############################################################################
##
#C IsMPFRFloat
##
## <#GAPDoc Label="IsMPFRFloat">
## <ManSection>
##   <Filt Name="IsMPFRFloat"/>
##   <Var Name="TYPE_MPFR"/>
##   <Description>
##     The category of floating-point numbers.
##
##     <P/> Note that they are treated as commutative and scalar, but are
##     not necessarily associative.
##   </Description>
## </ManSection>
## <#/GAPDoc>
##
if IsBound(MPFR_INT) then
DeclareRepresentation("IsMPFRFloat", IsFloat and IsDataObjectRep, []);
BIND_GLOBAL("MPFRFloatsFamily", NewFamily("MPFRFloatsFamily", IsMPFRFloat));
DeclareProperty("IsMPFRFloatFamily",IsFloatFamily);
SetIsMPFRFloatFamily(MPFRFloatsFamily,true);
BIND_GLOBAL("TYPE_MPFR", NewType(MPFRFloatsFamily, IsMPFRFloat));
DeclareGlobalVariable("MPFR");
fi;
#############################################################################

#############################################################################
##
#C IsMPFIFloat
##
## <#GAPDoc Label="IsMPFIFloat">
## <ManSection>
##   <Filt Name="IsMPFIFloat"/>
##   <Var Name="TYPE_MPFI"/>
##   <Description>
##     The category of intervals of floating-point numbers.
##
##     <P/> Note that they are treated as commutative and scalar, but are
##     not necessarily associative.
##   </Description>
## </ManSection>
## <#/GAPDoc>
##
if IsBound(MPFI_INT) then
DeclareRepresentation("IsMPFIFloat", IsFloatInterval and IsDataObjectRep, []);
BIND_GLOBAL("MPFIFloatsFamily", NewFamily("MPFIFloatsFamily", IsMPFIFloat));
DeclareProperty("IsMPFIFloatFamily",IsFloatFamily);
SetIsMPFIFloatFamily(MPFIFloatsFamily,true);
BIND_GLOBAL("TYPE_MPFI", NewType(MPFIFloatsFamily, IsMPFIFloat));
DeclareGlobalVariable("MPFI");
fi;
#############################################################################

#############################################################################
##
#C IsMPCFloat
##
## <#GAPDoc Label="IsMPCFloat">
## <ManSection>
##   <Filt Name="IsMPCFloat"/>
##   <Var Name="TYPE_MPC"/>
##   <Description>
##     The category of intervals of floating-point numbers.
##
##     <P/> Note that they are treated as commutative and scalar, but are
##     not necessarily associative.
##   </Description>
## </ManSection>
## <#/GAPDoc>
##
if IsBound(MPC_INT) then
DeclareRepresentation("IsMPCFloat", IsComplexFloat and IsDataObjectRep, []);
BIND_GLOBAL("MPCFloatsFamily", NewFamily("MPCFloatsFamily", IsMPCFloat));
DeclareProperty("IsMPCFloatFamily",IsFloatFamily);
SetIsMPCFloatFamily(MPCFloatsFamily,true);
BIND_GLOBAL("TYPE_MPC", NewType(MPCFloatsFamily, IsMPCFloat));
DeclareGlobalVariable("MPC");

DeclareAttribute("SphereProject", IsMPCFloat);
fi;
#############################################################################

#############################################################################
##
#C IsCXSCFloat
##
## <#GAPDoc Label="IsCXSCFloat">
## <ManSection>
##   <Filt Name="IsCXSCReal"/>
##   <Filt Name="IsCXSCComplex"/>
##   <Filt Name="IsCXSCInterval"/>
##   <Filt Name="IsCXSCBox"/>
##   <Var Name="TYPE_CXSC_RP"/>
##   <Var Name="TYPE_CXSC_CP"/>
##   <Var Name="TYPE_CXSC_RI"/>
##   <Var Name="TYPE_CXSC_CI"/>
##   <Description>
##     The category of floating-point numbers.
##
##     <P/> Note that they are treated as commutative and scalar, but are
##     not necessarily associative.
##   </Description>
## </ManSection>
## <#/GAPDoc>
##
if IsBound(CXSC_INT) then
DeclareCategory("IsCXSCFloat", IsFloat); # virtual class containing all below

DeclareRepresentation("IsCXSCFloatRep", IsCXSCFloat and IsDataObjectRep, []);

DeclareCategory("IsCXSCReal", IsFloat and IsCXSCFloatRep);
DeclareCategoryCollections("IsCXSCReal");
DeclareCategoryCollections("IsCXSCRealCollection");
DeclareCategory("IsCXSCComplex", IsComplexFloat and IsCXSCFloatRep);
DeclareCategoryCollections("IsCXSCComplex");
DeclareCategoryCollections("IsCXSCComplexCollection");
DeclareCategory("IsCXSCInterval", IsFloatInterval and IsCXSCFloatRep);
DeclareCategoryCollections("IsCXSCInterval");
DeclareCategoryCollections("IsCXSCIntervalCollection");
DeclareCategory("IsCXSCBox", IsComplexFloatInterval and IsCXSCFloatRep);
DeclareCategoryCollections("IsCXSCBox");
DeclareCategoryCollections("IsCXSCBoxCollection");

BIND_GLOBAL("CXSCFloatsFamily", NewFamily("CXSCFloatsFamily", IsCXSCFloat));
DeclareProperty("IsCXSCFloatFamily",IsFloatFamily);
SetIsCXSCFloatFamily(CXSCFloatsFamily,true);

BindGlobal("TYPE_CXSC_RP", NewType(CXSCFloatsFamily, IsCXSCReal));
BindGlobal("TYPE_CXSC_CP", NewType(CXSCFloatsFamily, IsCXSCComplex));
BindGlobal("TYPE_CXSC_RI", NewType(CXSCFloatsFamily, IsCXSCInterval));
BindGlobal("TYPE_CXSC_CI", NewType(CXSCFloatsFamily, IsCXSCBox));

DeclareGlobalVariable("CXSC");
fi;
#############################################################################

#############################################################################
##
#C FPLLL
##
## <#GAPDoc Label="FPLLL">
## <ManSection>
##   <Oper Name="FPLLLReducedBasis" Arg="m"/>
##   <Returns>A matrix spanning the same lattice as <A>m</A>.</Returns>
##   <Description>
##     This function implements the LLL (Lenstra-Lenstra-Lovász) lattice
##     reduction algorithm via the external library <Package>fplll</Package>.
##
##     <P/> The result is guaranteed to be optimal up to 1%.
##   </Description>
## </ManSection>
##
## <ManSection>
##   <Oper Name="FPLLLShortestVector" Arg="m"/>
##   <Returns>A short vector in the lattice spanned by <A>m</A>.</Returns>
##   <Description>
##     This function implements the LLL (Lenstra-Lenstra-Lovász) lattice
##     reduction algorithm via the external library <Package>fplll</Package>,
##     and then computes a short vector in this lattice.
##
##     <P/> The result is guaranteed to be optimal up to 1%.
##   </Description>
## </ManSection>
## <#/GAPDoc>
##
if IsBound(@FPLLL) then
DeclareOperation("FPLLLReducedBasis", [IsMatrix]);
DeclareOperation("FPLLLShortestVector", [IsMatrix]);
fi;
#############################################################################

#############################################################################
#E