Annotation of OpenXM_contrib/pari-2.2/doc/usersch5.tex, Revision 1.2
1.2 ! noro 1: % $Id: usersch5.tex,v 1.9 2002/06/08 13:14:21 karim Exp $
1.1 noro 2: % Copyright (c) 2000 The PARI Group
3: %
4: % This file is part of the PARI/GP documentation
5: %
6: % Permission is granted to copy, distribute and/or modify this document
7: % under the terms of the GNU Free Documentation License
8: \chapter{Technical Reference Guide for Low-Level Functions}
9:
10: In this chapter, we give a description all public low-level functions of the
11: PARI system. These essentially include functions for handling all the PARI
12: types. Higher level functions, such as arithmetic or transcendental
13: functions, are described fully in Chapter~3 of this manual.
14:
15: Many other undocumented functions can be found throughout the source code.
16: These private functions are more efficient than the library functions that
17: call them, but much sloppier on argument checking and damage control. Use
18: them at your own risk!
19:
20: \section{Level 0 kernel (operations on unsigned longs)}
21:
22: \noindent
23: For the non-68k versions, we need level 0 operations simulating basic
24: operations of the 68020 processor (on which PARI was originally
25: implemented). The type \tet{ulong} is defined in the file \kbd{parigen.h} as
26: \kbd{unsigned long}. Note that in the prototypes below a \kbd{ulong} is
27: sometimes implicitly typecast to \kbd{int} or \kbd{long}.
28:
29: The global \kbd{ulong} variables \kbd{overflow} (which will contain
30: only 0 or 1) and \kbd{hiremainder} used to be declared in the file
31: \kbd{pariinl.h}. However, for certain architectures they are no longer
32: needed, and/or have been replaced with local variables for efficiency;
33: and the `functions' mentioned below are really chunks of assembler code which
34: will be inlined at each invocation by the compiler. If you really need to
35: use these lowest-level operations directly, make sure you know your way
36: through the PARI kernel sources, and understand the architecture dependencies.
37:
38: To make the following descriptions valid both for 32-bit and 64-bit
39: machines, we will set \B\ to be equal to 32 (resp.~64), an abbreviation of
40: \kbd{BITS\_IN\_LONG}, which is what is actually used in the source code.
41:
42: \fun{int}{addll}{int x, int y} adds the ulongs \kbd{x} and \kbd{y},
43: returns the lower \B\ bits and puts the carry bit into \kbd{overflow}.
44:
45: \fun{int}{addllx}{int x, int y} adds \kbd{overflow} to the sum of the
46: ulongs \kbd{x} and \kbd{y}, returns the lower \B\ bits and puts the
47: carry bit into \kbd{overflow}.
48:
49: \fun{int}{subll}{int x, int y} subtracts the ulongs \kbd{x} and \kbd{y},
50: returns the lower \B\ bits and put the carry (borrow) bit into \kbd{overflow}.
51:
52: \fun{int}{subllx}{int x, int y} subtracts \kbd{overflow} from the
53: difference of the ulongs \kbd{x} and \kbd{y}, returns the lower \B\ bits
54: and puts the carry (borrow) bit into \kbd{overflow}.
55:
56: \fun{int}{shiftl}{ulong x, ulong y} shifts the ulong \kbd{x} left by \kbd{y}
57: bits, returns the lower \B\ bits and stores the high-order \B\ bits into
58: \kbd{hiremainder}. We must have $1\le\kbd{y}\le\B$. In particular, \kbd{y}
59: must be non-zero; the caller is responsible for testing this.
60:
61: \fun{int}{shiftlr}{ulong x, ulong y} shifts the ulong \kbd{x << \B} right
62: by \kbd{y} bits, returns the higher \B\ bits and stores the low-order
63: \B\ bits into \kbd{hiremainder}. We must have $1\le\kbd{y}\le\B$. In
64: particular, \kbd{y} must be non-zero.
65:
66: \fun{int}{bfffo}{ulong x} returns the number of leading zero bits in the
67: ulong \kbd{x} (i.e. the number of bit positions by which it would have to be
68: shifted left until its leftmost bit first becomes equal to~1, which can be
69: between 0 and $\B-1$ for nonzero \kbd{x}). When \kbd{x} is~0, \B\ is returned.
70:
71: \fun{int}{mulll}{ulong x, ulong y} multiplies the ulong \kbd{x} by the ulong
72: \kbd{y}, returns the lower \B\ bits and stores the high-order \B\ bits into
73: \kbd{hiremainder}.
74:
75: \fun{int}{addmul}{ulong x, ulong y} adds \kbd{hiremainder} to the product
76: of the ulongs \kbd{x} and \kbd{y}, returns the lower \B\ bits and stores the
77: high-order \B\ bits into \kbd{hiremainder}.
78:
79: \fun{int}{divll}{ulong x, ulong y} returns the Euclidean quotient of
80: (\kbd{hiremainder << \B})${}+{}$\kbd{x} and the ulong divisor \kbd{y} and
81: stores the remainder into \kbd{hiremainder}. An error occurs if the quotient
82: cannot be represented by a ulong, i.e.~if $\kbd{hiremainder}\ge\kbd{y}$
83: initially.
84:
85: \section{Level 1 kernel (operations on longs, integers and reals)}
86:
87: \noindent
88: In this section as elsewhere, \kbd{long} denotes a \B-bit signed C-integer,
89: ``integer'' denotes a PARI multiprecise integer (type \typ{INT}), ``real''
90: denotes a PARI multiprecise real (type \typ{REAL}). Refer to Chapters
91: 1--2 and~4 for general background.
92:
93: \misctitle{Note:} Many functions consist of an elementary operation,
94: immediately followed by an assignment statement. All such functions are
95: obtained using macros (see the file \kbd{paricom.h}), hence you can easily
96: extend the list. Below, they will be introduced like in the following
97: example:
98:
99: \fun{GEN}{gadd[z]}{GEN x, GEN y[, GEN z]} followed by the explicit
100: description of the function
101:
102: \kbd{GEN \key{gadd}(GEN x, GEN y)}
103:
104: \noindent which creates its result on the stack, returning a \kbd{GEN} pointer
105: to it, and the parts in brackets indicate that there exists also a function
106:
107: \kbd{void \key{gaddz}(GEN x, GEN y, GEN z)}
108:
109: \noindent which assigns its result to the pre-existing object
110: \kbd{z}, leaving the stack unchanged.
111:
112: \subsec{Basic unit and subunit handling functions}
113:
114: \fun{long}{typ}{GEN x} returns the type number of~\kbd{x}. (The header files
115: included through \kbd{pari.h} will give you access to the symbolic constants
116: \typ{INT} etc., so you should never need to know the actual numerical values.)
117:
118: \fun{long}{lg}{GEN x} returns the length of~\kbd{x} in \B-bit words.
119:
120: \fun{long}{lgef}{GEN x} returns the effective length of the polynomial \kbd{x}
121: in \B-bit words.
122:
123: \fun{long}{lgefint}{GEN x} returns the effective length of the integer \kbd{x}
124: in \B-bit words.
125:
126: \fun{long}{signe}{GEN x} returns the sign ($-1$, 0 or 1) of~\kbd{x}. Can be
127: used for integers, reals, polynomials and power series (for the last two
128: types, only 0 or 1 are possible).
129:
130: \fun{long}{gsigne}{GEN x} same as \kbd{signe}, but also valid for rational
131: numbers (and marginally less efficient for the other types).
132:
133: \fun{long}{expo}{GEN x} returns the unbiased binary exponent of the real
134: number~\kbd{x}.
135:
136: \fun{long}{gexpo}{GEN x} same as \kbd{expo}, but also valid when \kbd{x}
137: is not a real number. When \kbd{x} is an exact~0, this returns
138: \hbox{\kbd{-HIGHEXPOBIT}}.
139:
140: \fun{long}{expi}{GEN x} returns the binary exponent of the real number equal
141: to the integer~\kbd{x}. This is a special case of \kbd{gexpo} above, covering
142: the case where \kbd{x} is of type~\typ{INT}.
143:
144: \fun{long}{valp}{GEN x} returns the unbiased 16-bit $p$-adic valuation (for
145: a $p$-adic) or $X$-adic valuation (for a power series, taken with respect
146: to the main variable) of~\kbd{x}.
147:
148: \fun{long}{precp}{GEN x} returns the precision of the $p$-adic~\kbd{x}.
149:
150: \fun{long}{varn}{GEN x} returns the variable number of \kbd{x} (between 0 and
151: \kbd{MAXVARN}). Should be used only for polynomials and power series.
152:
153: \fun{long}{gvar}{(GEN x)} returns the main variable number when any variable
154: at all occurs in the composite object~\kbd{x} (the smallest variable number
155: which occurs), and \kbd{BIGINT} otherwise.
156:
157: \fun{void}{settyp}{GEN x, long s} sets the type number of~\kbd{x} to~\kbd{s}.
158: This should be used with extreme care since usually the type is set
159: otherwise, and the components and further codeword fields (which are left
160: unchanged) may not match the PARI conventions for the new type.
161:
162: \fun{void}{setlg}{GEN x, long s} sets the length of~\kbd{x} to~\kbd{s}. Again
163: this should be used with extreme care since usually the length is set
164: otherwise, and increasing the length joins previously unrelated memory words
165: to the root node of~\kbd{x}. This is, however, an extremely efficient way of
166: truncating vectors or polynomials.
167:
168: \fun{void}{setlgef}{GEN x, long s} sets the effective length of \kbd{x}
169: to~\kbd{s}, where \kbd{x} is a polynomial. The number \kbd{s} must be less
170: than or equal to the length of~\kbd{x}.
171:
172: \fun{void}{setlgefint}{GEN x, long s} sets the effective length
173: of the integer \kbd{x} to~\kbd{s}. The number \kbd{s} must be less than or
174: equal to the length of~\kbd{x}.
175:
176: \fun{void}{setsigne}{GEN x, long s} sets the sign of~\kbd{x} to~\kbd{s}.
177: If \kbd{x} is an integer or real, \kbd{s} must be equal to $-1$, 0 or~1,
178: and if \kbd{x} is a polynomial or a power series, \kbd{s} must be equal to
179: 0 or~1.
180:
181: \fun{void}{setexpo}{GEN x, long s} sets the binary exponent of the real
182: number~\kbd{x} to \kbd{s}, after adding the appropriate bias. The unbiased
183: value \kbd{s} must be a 24-bit signed number.
184:
185: \fun{void}{setvalp}{GEN x, long s} sets the $p$-adic or $X$-adic valuation
186: of~\kbd{x} to~\kbd{s}, if \kbd{x} is a $p$-adic or a power series,
187: respectively.
188:
189: \fun{void}{setprecp}{GEN x, long s} sets the $p$-adic precision of the
190: $p$-adic number~\kbd{x} to~\kbd{s}.
191:
192: \fun{void}{setvarn}{GEN x, long s} sets the variable number of the polynomial
193: or power series~\kbd{x} to~\kbd{s} (where $0\le \kbd{s}\le\kbd{MAXVARN}$).
194:
195:
196: \subsec{Memory allocation on the PARI stack}
197:
198: \fun{GEN}{cgetg}{long n, long t} allocates memory on the PARI stack for
199: an object of length \kbd{n} and type~\kbd{t}, and initializes its first
200: codeword.
201:
202: \fun{GEN}{cgeti}{long n} allocates memory on the PARI stack for an
203: integer of length~\kbd{n}, and initializes its first codeword. Identical to
204: {\tt cgetg(n,\typ{INT})}.
205:
206: \fun{GEN}{cgetr}{long n} allocates memory on the PARI stack for a real
207: of length~\kbd{n}, and initializes its first codeword. Identical to
208: {\tt cgetg(n,\typ{REAL})}.
209:
210: \fun{void}{cgiv}{GEN x} frees object \kbd{x} if it is the last created on the
211: PARI stack (otherwise disaster occurs).
212:
213: \fun{GEN}{gerepile}{long p, long q, GEN x} general garbage collector
214: for the PARI stack. See \secref{se:garbage} for a detailed explanation and
215: many examples.
216:
217: \subsec{Assignments, conversions and integer parts}
218:
219: \fun{void}{mpaff}{GEN x, GEN z} assigns \kbd{x} into~\kbd{z} (where
220: \kbd{x} and \kbd{z} are integers or reals).
221:
222: \fun{void}{affsz}{long s, GEN z} assigns the long \kbd{s} into the integer or
223: real~\kbd{z}.
224:
225: \fun{void}{affsi}{long s, GEN z} assigns the long \kbd{s} into the
226: integer~\kbd{z}.
227:
228: \fun{void}{affsr}{long s, GEN z} assigns the long \kbd{s} into the
229: real~\kbd{z}.
230:
231: \fun{void}{affii}{GEN x, GEN z} assigns the integer \kbd{x} into the
232: integer~\kbd{z}.
233:
234: \fun{void}{affir}{GEN x, GEN z} assigns the integer \kbd{x} into the
235: real~\kbd{z}.
236:
237: \fun{void}{affrs}{GEN x, long s} assigns the real \kbd{x} into the
238: long~\kbd{s}\dots not. This is a forbidden assignment in PARI, so an error
239: message is issued.
240:
241: \fun{void}{affri}{GEN x, GEN z} assigns the real \kbd{x} into the
242: integer~\kbd{z}\dots no it doesn't. This is a forbidden assignment in PARI,
243: so an error message is issued.
244:
245: \fun{void}{affrr}{GEN x, GEN z} assigns the real \kbd{x} into the real~\kbd{z}.
246: \smallskip
247:
1.2 ! noro 248: \fun{GEN}{itor}{GEN x, long prec} assigns the \typ{INT} \kbd{x} into a
! 249: \typ{REAL} of length \kbd{prec} and return the latter.
! 250:
! 251: \fun{long}{itos}{GEN x} converts the PARI integer \kbd{x} to a C long (if
! 252: possible, otherwise an error message is issued).
! 253:
1.1 noro 254: \fun{GEN}{stoi}{long s} creates the PARI integer corresponding to the
255: long~\kbd{s}.
256:
1.2 ! noro 257: \fun{GEN}{stor}{long s, long prec} assigns the long \kbd{s} into a
! 258: \typ{REAL} of length \kbd{prec} and return the latter.
! 259:
1.1 noro 260: \smallskip
261:
262: \fun{GEN}{mptrunc[z]}{GEN x[, GEN z]} truncates the integer or real~\kbd{x}
263: (not the same as the integer part if \kbd{x} is non-integer and negative).
264:
265: \fun{GEN}{mpent[z]}{GEN x[, GEN z]} true integer part of the integer or
266: real~\kbd{x} (i.e.~the \kbd{floor} function).
267:
268: \subsec{Valuation and shift}
269:
270: \fun{long}{vals}{long s} 2-adic valuation of the long~\kbd{s}. Returns $-1$
271: if \kbd{s} is equal to 0, with no error.
272:
273: \fun{long}{vali}{GEN x} 2-adic valuation of the integer~\kbd{x}. Returns $-1$
274: if \kbd{s} is equal to 0, with no error.
275:
276: \fun{GEN}{mpshift[z]}{GEN x, long n[, GEN z]} shifts the real or
277: integer \kbd{x} by~\kbd{n}. If \kbd{n} is positive, this is a left shift,
278: i.e.~multiplication by $2^{\kbd{n}}$. If \kbd{n} is negative, it is a right
279: shift by~$-\kbd{n}$, which amounts to the truncation of the quotient of \kbd{x}
280: by~$2^{-\kbd{n}}$.
281:
282: \fun{GEN}{shifts}{long s, long n} converts the long \kbd{s} into a PARI
283: integer and shifts the value by~\kbd{n}.
284:
285: \fun{GEN}{shifti}{GEN x, long n} shifts the integer~\kbd{x} by~\kbd{n}.
286:
287: \fun{GEN}{shiftr}{GEN x, long n} shifts the real~\kbd{x} by~\kbd{n}.
288:
289: \subsec{Unary operations}
290:
291: \noindent
292: Let ``\op'' be some unary operation of type \kbd{GEN (*)(GEN)}. The names and
293: prototypes of the low-level functions corresponding to \op\ will be as follows.
294:
295: \funno{GEN}{mp\op}{GEN x} creates the result of \op\ applied to the integer
296: or real~\kbd{x}.
297:
298: \funno{GEN}{\op s}{long s} creates the result of \op\ applied to the
299: long~\kbd{s}.
300:
301: \funno{GEN}{\op i}{GEN x} creates the result of \op\ applied to the
302: integer~\kbd{x}.
303:
304: \funno{GEN}{\op r}{GEN x} creates the result of \op\ applied to the real~\kbd{x}.
305:
306: \funno{GEN}{mp\op z}{GEN x, GEN z} assigns the result of applying \op\ to the
307: integer or real~\kbd{x} into the integer or real \kbd{z}.
308:
309: \misctitle{Remark:} it has not been considered useful to include the
310: functions {\tt void \op sz(long,GEN)}, {\tt void \op iz(GEN,GEN)} and
311: {\tt void \op rz(GEN, GEN)}.
312: \smallskip
313:
314: \noindent The above prototype schemes apply to the following operators:
315:
316: \op=\key{neg}: negation ($-$\kbd{x}). The result is of the same type
317: as~\kbd{x}.
318:
319: \op=\key{abs}: absolute value ($|\kbd{x}|$). The result is of the same type
320: as~\kbd{x}.
321:
322: \noindent In addition, there exist the following special unary functions with
323: assignment:
324:
325: \fun{void}{mpinvz}{GEN x, GEN z} assigns the inverse of the integer or
326: real \kbd{x} into the real~\kbd{z}. The inverse is computed as a quotient
327: of real numbers, not as a Euclidean division.
328:
329: \fun{void}{mpinvsr}{long s, GEN z} assigns the inverse of the long \kbd{s}
330: into the real~\kbd{z}.
331:
332: \fun{void}{mpinvir}{GEN x, GEN z} assigns the inverse of the integer \kbd{x}
333: into the real~\kbd{z}.
334:
335: \fun{void}{mpinvrr}{GEN x, GEN z} assigns the inverse of the real \kbd{x} into
336: the real~\kbd{z}.
337:
338: \subsec{Comparison operators}
339:
340: \fun{long}{mpcmp}{GEN x, GEN y} compares the integer or real \kbd{x} to the
341: integer or real~\kbd{y}. The result is the sign of $\kbd{x}-\kbd{y}$.
342:
343: \fun{long}{cmpsi}{long s, GEN x} compares the long \kbd{s} to the
344: integer~\kbd{x}.
345:
346: \fun{long}{cmpsr}{long s, GEN x} compares the long \kbd{s} to the real~\kbd{x}.
347:
348: \fun{long}{cmpis}{GEN x, long s} compares the integer \kbd{x} to the
349: long~\kbd{s}.
350:
351: \fun{long}{cmpii}{GEN x, GEN y} compares the integer \kbd{x} to the
352: integer~\kbd{y}.
353:
354: \fun{long}{cmpir}{GEN x, GEN y} compares the integer \kbd{x} to the
355: real~\kbd{y}.
356:
357: \fun{long}{cmprs}{GEN x, long s} compares the real \kbd{x} to the
358: long~\kbd{s}.
359:
360: \fun{long}{cmpri}{GEN x, GEN y} compares the real \kbd{x} to the
361: integer~\kbd{y}.
362:
363: \fun{long}{cmprr}{GEN x, GEN y} compares the real \kbd{x} to the real~\kbd{y}.
364:
365: \subsec{Binary operations}
366:
367: \noindent
368: Let ``\op'' be some operation of type \kbd{GEN (*)(GEN,GEN)}. The names and
369: prototypes of the low-level functions corresponding to \op\ will be as follows.
370: In this section, the \kbd{z} argument in the \kbd{z}-functions must be of type
371: \typ{INT} or~\typ{REAL}.
372:
373: \funno{GEN}{mp\op[z]}{GEN x, GEN y[, GEN z]} applies \op\ to
374: the integer-or-reals \kbd{x} and~\kbd{y}.
375:
376: \funno{GEN}{\op ss[z]}{long s, long t[, GEN z]} applies \op\ to the longs
377: \kbd{s} and~\kbd{t}.
378:
379: \funno{GEN}{\op si[z]}{long s, GEN x[, GEN z]} applies \op\ to the long \kbd{s}
380: and the integer~\kbd{x}.
381:
382: \funno{GEN}{\op sr[z]}{long s, GEN x[, GEN z]} applies \op\ to the long \kbd{s}
383: and the real~\kbd{x}.
384:
385: \funno{GEN}{\op is[z]}{GEN x, long s[, GEN z]} applies \op\ to the
386: integer \kbd{x} and the long~\kbd{s}.
387:
388: \funno{GEN}{\op ii[z]}{GEN x, GEN y[, GEN z]} applies \op\ to the
389: integers \kbd{x} and~\kbd{y}.
390:
391: \funno{GEN}{\op ir[z]}{GEN x, GEN y[, GEN z]} applies \op\ to the
392: integer \kbd{x} and the real~\kbd{y}.
393:
394: \funno{GEN}{\op rs[z]}{GEN x, long s[, GEN z]} applies \op\ to the real \kbd{x}
395: and the long~\kbd{s}.
396:
397: \funno{GEN}{\op ri[z]}{GEN x, GEN y[, GEN z]} applies \op\ to the real \kbd{x}
398: and the integer~\kbd{y}.
399:
400: \funno{GEN}{\op rr[z]}{GEN x, GEN y[, GEN z]} applies \op\ to the reals \kbd{x}
401: and~\kbd{y}.
402: \smallskip
403: \noindent Each of the above can be used with the following operators.
404:
405: \op=\key{add}: addition (\kbd{x + y}). The result is real unless both \kbd{x}
406: and \kbd{y} are integers (or longs).
407:
408: \op=\key{sub}: subtraction (\kbd{x - y}). The result is real unless both
409: \kbd{x} and \kbd{y} are integers (or longs).
410:
411: \op=\key{mul}: multiplication (\kbd{x * y}). The result is real unless both
412: \kbd{x} and \kbd{y} are integers (or longs), OR if \kbd{x} or \kbd{y} is the
413: integer or long zero.
414:
415: \op=\key{div}: division (\kbd{x / y}). In the case where \kbd{x} and \kbd{y}
416: are both integers or longs, the result is the Euclidean quotient, where the
417: remainder has the same sign as the dividend~\kbd{x}. If one of \kbd{x} or
418: \kbd{y} is real, the result is real unless \kbd{x} is the integer or long
419: zero. A division-by-zero error occurs if \kbd{y} is equal to zero.
420:
421: \op=\key{res}: remainder (``\kbd{x \% y}''). This operation is defined only
422: when \kbd{x} and \kbd{y} are longs or integers. The result is the Euclidean
423: remainder corresponding to \kbd{div},~i.e. its sign is that of the
424: dividend~\kbd{x}. The result is always an integer.
425:
426: \op=\key{mod}: remainder (\kbd{x \% y}). This operation is defined only when
427: \kbd{x} and \kbd{y} are longs or integers. The result is the true Euclidean
428: remainder, i.e.~non-negative and less than the absolute value of~\kbd{y}.
429:
430: \subsec{Division with remainder}: the following functions return two objects,
431: unless specifically asked for only one of them~--- a quotient and a remainder.
432: The remainder will be created on the stack, and a \kbd{GEN} pointer to this
433: object will be returned through the variable whose address is passed as the
434: \kbd{r} argument.
435:
436: \fun{GEN}{dvmdss}{long s, long t, GEN *r} creates the Euclidean
437: quotient and remainder of the longs \kbd{s} and~\kbd{t}. If \kbd{r} is not
438: \kbd{NULL} or \kbd{ONLY\_REM}, this puts the remainder into \kbd{*r},
439: and returns the quotient. If \kbd{r} is equal to \kbd{NULL}, only the
440: quotient is returned. If \kbd{r} is equal to \kbd{ONLY\_REM}, the remainder
441: is returned instead of the quotient. In the generic case, the remainder is
442: created after the quotient and can be disposed of individually with a
443: \kbd{cgiv(r)}. The remainder is always of the sign of the dividend~\kbd{s}.
444:
445: \fun{GEN}{dvmdsi}{long s, GEN x, GEN *r} creates the Euclidean
446: quotient and remainder of the long \kbd{s} by the integer~\kbd{x}.
447: Obeys the same conventions with respect to~\kbd{r}.
448:
449: \fun{GEN}{dvmdis}{GEN x, long s, GEN *r} create the Euclidean
450: quotient and remainder of the integer x by the long~s.
451:
452: \fun{GEN}{dvmdii}{GEN x, GEN y, GEN *r} returns the Euclidean quotient
453: of the integer \kbd{x} by the integer \kbd{y} and puts the remainder
454: into~\kbd{*r}. If \kbd{r} is equal to \kbd{NULL}, the remainder is not
455: created, and if \kbd{r} is equal to \kbd{ONLY\_REM}, only the remainder
456: is created and returned. In the generic case, the remainder is created
457: after the quotient and can be disposed of individually with a \kbd{cgiv(r)}.
458: The remainder is always of the sign of the dividend~\kbd{x}.
459:
460: \fun{GEN}{truedvmdii}{GEN x, GEN y, GEN *r}, as \kbd{dvmdii} but with a
461: non-negative remainder.
462:
463: \fun{void}{mpdvmdz}{GEN x, GEN y, GEN z, GEN *r} assigns the Euclidean
464: quotient of the integers \kbd{x} and \kbd{y} into the integer or real~\kbd{z},
465: putting the remainder into~\kbd{*r} (unless \kbd{r} is equal to \kbd{NULL} or
466: \kbd{ONLY\_REM} as above).
467:
468: \fun{void}{dvmdssz}{long s, long t, GEN z, GEN *r} assigns the Euclidean
469: quotient of the longs \kbd{s} and \kbd{t} into the integer or real~\kbd{z},
470: putting the remainder into~\kbd{*r} (unless \kbd{r} is equal to \kbd{NULL} or
471: \kbd{ONLY\_REM} as above).
472:
473: \fun{void}{dvmdsiz}{long s, GEN x, GEN z, GEN *r} assigns the Euclidean
474: quotient of the long \kbd{s} and the integer \kbd{x} into the integer or
475: real~\kbd{z}, putting the remainder into \kbd{*r} (unless \kbd{r} is equal
476: to \kbd{NULL} or \kbd{ONLY\_REM} as above).
477:
478: \fun{void}{dvmdisz}{GEN x, long s, GEN z, GEN *r} assigns the Euclidean
479: quotient of the integer \kbd{x} and the long \kbd{s} into the integer or
480: real~\kbd{z}, putting the remainder into~\kbd{*r} (unless \kbd{r} is equal
481: to \kbd{NULL} or \kbd{ONLY\_REM} as above).
482:
483: \fun{void}{dvmdiiz}{GEN x, GEN y, GEN z, GEN *r} assigns the Euclidean
484: quotient of the integers \kbd{x} and \kbd{y} into the integer or real~\kbd{z},
485: putting the address of the remainder into~\kbd{*r} (unless \kbd{r} is equal
486: to \kbd{NULL} or \kbd{ONLY\_REM} as above).
487:
488: \subsec{Miscellaneous functions}
489:
490: \fun{void}{addsii}{long s, GEN x, GEN z} assigns the sum of the long \kbd{s}
491: and the integer \kbd{x} into the integer~\kbd{z} (essentially identical to
492: \kbd{addsiz} except that \kbd{z} is specifically an integer).
493:
494: \fun{long}{divise}{GEN x, GEN y} if the integer \kbd{y} divides the
495: integer~\kbd{x}, returns 1 (true), otherwise returns 0 (false).
496:
497: \fun{long}{divisii}{GEN x, long s, GEN z} assigns the Euclidean quotient of
498: the integer \kbd{x} and the long \kbd{s} into the integer \kbd{z}, and returns
499: the remainder as a long.
500:
501: \fun{long}{mpdivis}{GEN x, GEN y, GEN z} if the integer \kbd{y} divides the
502: integer~\kbd{x}, assigns the quotient to the integer~\kbd{z} and returns
503: 1 (true), otherwise returns 0 (false).
504:
505: \fun{void}{mulsii}{long s, GEN x, GEN z} assigns the product of the long
506: \kbd{s} and the integer \kbd{x} into the integer~\kbd{z} (essentially
1.2 ! noro 507: identical to \kbd{mulsiz} except that \kbd{z} is specifically an integer).
1.1 noro 508:
509: \section{Level 2 kernel (operations on general PARI objects)}
510:
511: \noindent The functions available to handle subunits are the following.
512:
513: \fun{GEN}{compo}{GEN x, long n} creates a copy of the \kbd{n}-th true
514: component (i.e.\ not counting the codewords) of the object~\kbd{x}.
515:
516: \fun{GEN}{truecoeff}{GEN x, long n} creates a copy of the coefficient of
517: degree~\kbd{n} of~\kbd{x} if \kbd{x} is a scalar, polynomial or power series,
518: and otherwise of the \kbd{n}-th component of~\kbd{x}.
519:
520: \noindent % borderline case -- looks better like this [GN]
521: The remaining two are macros, NOT functions (see \secref{se:typecast} for a
522: detailed explanation):
523:
524: \fun{long}{coeff}{GEN x, long i, long j} applied to a matrix \kbd{x} (type
525: \typ{MAT}), this gives the address of the coefficient at row \kbd{i} and
526: column~\kbd{j} of~\kbd{x}.
527:
528: \fun{long}{mael$n$}{GEN x, long $a_1$, ..., long $a_n$} stands for
529: \kbd{x[$a_1$][$a_2$]...[$a_n$]}, where $2\le n \le 5$, with all the
530: necessary typecasts.
531:
532: \subsec{Copying and conversion}
533:
534: \fun{GEN}{cgetp}{GEN x} creates space sufficient to hold the $p$-adic~\kbd{x},
535: and sets the prime $p$ and the $p$-adic precision to those of~\kbd{x}, but
536: does not copy (the $p$-adic unit or zero representative and the modulus
537: of)~\kbd{x}.
538:
539: \fun{GEN}{gcopy}{GEN x} creates a new copy of the object~\kbd{x} on the PARI
540: stack. For permanent subobjects, only the pointer is copied.
541:
542: \fun{GEN}{forcecopy}{GEN x} same as \key{copy} except that even permanent
543: subobjects are copied onto the stack.
544:
545: \fun{long}{taille}{GEN x} returns the total number of \B-bit words occupied
546: by the tree representing~\kbd{x}.
547:
548: \fun{GEN}{gclone}{GEN x} creates a new permanent copy of the object \kbd{x}
549: on the heap.
550:
551: \fun{GEN}{greffe}{GEN x, long l, int use\_stack} applied to a
552: polynomial~\kbd{x} (type \typ{POL}), creates a power series (type \typ{SER})
553: of length~\kbd{l} starting with~\kbd{x}, but without actually copying the
554: coefficients, just the pointers. If \kbd{use\_stack} is zero, this is created
555: through malloc, and must be freed after use. Intended for internal use only.
556:
557: \fun{double}{rtodbl}{GEN x} applied to a real~\kbd{x} (type \typ{REAL}),
558: converts \kbd{x} into a C double if possible.
559:
560: \fun{GEN}{dbltor}{double x} converts the C double \kbd{x} into a PARI real.
561:
562: \fun{double}{gtodouble}{GEN x} if \kbd{x} is a real number (but not
563: necessarily of type \typ{REAL}), converts \kbd{x} into a C double if possible.
564:
565: \fun{long}{gtolong}{GEN x} if \kbd{x} is an integer (not a C long,
566: but not necessarily of type \typ{INT}), converts \kbd{x} into a C long
567: if possible.
568:
569: \fun{GEN}{gtopoly}{GEN x, long v} converts or truncates the object~\kbd{x}
570: into a polynomial with main variable number~\kbd{v}. A common application
571: would be the conversion of coefficient vectors.
572:
573: \fun{GEN}{gtopolyrev}{GEN x, long v} converts or truncates the object~\kbd{x}
574: into a polynomial with main variable number~\kbd{v}, but vectors are converted
575: in reverse order.
576:
577: \fun{GEN}{gtoser}{GEN x, long v} converts the object~\kbd{x} into a power
578: series with main variable number~\kbd{v}.
579:
580: \fun{GEN}{gtovec}{GEN x} converts the object~\kbd{x} into a (row) vector.
581:
582: \fun{GEN}{co8}{GEN x, long l} applied to a quadratic number~\kbd{x}
583: (type \typ{QUAD}), converts \kbd{x} into a real or complex number
584: depending on the sign of the discriminant of~\kbd{x}, to precision
585: \hbox{\kbd{l} \B-bit} words.% absolutely forbid line brk at hyphen here [GN]
586:
587: \fun{GEN}{gcvtop}{GEN x, GEN p, long l} converts \kbd{x} into a \kbd{p}-adic
588: number of precision~\kbd{l}.
589:
590: \fun{GEN}{gmodulcp}{GEN x, GEN y} creates the object \kbd{\key{Mod}(x,y)}
591: on the PARI stack, where \kbd{x} and \kbd{y} are either both integers, and
592: the result is an integermod (type \typ{INTMOD}), or \kbd{x} is a scalar or
593: a polynomial and \kbd{y} a polynomial, and the result is a polymod
594: (type \typ{POLMOD}).
595:
596: \fun{GEN}{gmodulgs}{GEN x, long y} same as \key{gmodulcp} except \kbd{y} is a
597: \kbd{long}.
598:
599: \fun{GEN}{gmodulss}{long x, long y} same as \key{gmodulcp} except both \kbd{x}
600: and \kbd{y} are \kbd{long}s.
601:
602: \fun{GEN}{gmodulo}{GEN x, GEN y} same as \key{gmodulcp} except that the
603: modulus \kbd{y} is copied onto the heap and not onto the PARI stack.
604:
605: \fun{long}{gexpo}{GEN x} returns the binary exponent of \kbd{x} or the maximal
606: binary exponent of the coefficients of~\kbd{x}. Returns
607: \hbox{\kbd{-HIGHEXPOBIT}} if \kbd{x} has no components or is an exact zero.
608:
609: \fun{long}{gsigne}{GEN x} returns the sign of~\kbd{x} ($-1$, 0 or 1) when
610: \kbd{x} is an integer, real or (irreducible or reducible) fraction. Raises
611: an error for all other types.
612:
613: \fun{long}{gvar}{GEN x} returns the main variable of~\kbd{x}. If no component
614: of~\kbd{x} is a polynomial or power series, this returns \kbd{BIGINT}.
615:
616: \fun{int}{precision}{GEN x} If \kbd{x} is of type \typ{REAL}, returns the
617: precision of~\kbd{x} (the length of \kbd{x} in \B-bit words if \kbd{x} is
618: not zero, and a reasonable quantity obtained from the exponent of \kbd{x}
619: if \kbd{x} is numerically equal to zero). If \kbd{x} is of type \typ{COMPLEX},
620: returns the minimum of the precisions of the real and imaginary part.
621: Otherwise, returns~0 (which stands in fact for infinite precision).
622:
623: \fun{long}{sizedigit}{GEN x} returns 0 if \kbd{x} is exactly~0. Otherwise,
624: returns \kbd{\key{gexpo}(x)} multiplied by $\log_{10}(2)$. This gives a
625: crude estimate for the maximal number of decimal digits of the components
626: of~\kbd{x}.
627:
628: \subsec{Comparison operators and valuations}
629:
630: \fun{int}{gcmp0}{GEN x} returns 1 (true) if \kbd{x} is equal to~0, 0~(false)
631: otherwise.
632:
633: \fun{int}{isexactzero}{GEN x} returns 1 (true) if \kbd{x} is exactly equal
634: to~0, 0~(false) otherwise. Note that many PARI functions will return a
635: pointer to \key{gzero} when they are aware that the result they return is
636: an exact zero, so it is almost always faster to test for pointer equality
637: first, and call \key{isexactzero} (or \key{gcmp0}) only when the first
638: test fails.
639:
640: \fun{int}{gcmp1}{GEN x} returns 1 (true) if \kbd{x} is equal to~1, 0~(false)
641: otherwise.
642:
643: \fun{int}{gcmp\_1}{GEN x} returns 1 (true) if \kbd{x} is equal to~$-1$,
644: 0~(false) otherwise.
645:
646: \fun{long}{gcmp}{GEN x, GEN y} comparison of \kbd{x} with \kbd{y} (returns
647: the sign of $\kbd{x}-\kbd{y}$).
648:
649: \fun{long}{gcmpsg}{long s, GEN x} comparison of the long \kbd{s} with~\kbd{x}.
650:
651: \fun{long}{gcmpgs}{GEN x, long s} comparison of \kbd{x} with the long~\kbd{s}.
652:
653: \fun{long}{lexcmp}{GEN x, GEN y} comparison of \kbd{x} with \kbd{y} for the
654: lexicographic ordering.
655:
656: \fun{long}{gegal}{GEN x, GEN y} returns 1 (true) if \kbd{x} is equal
657: to~\kbd{y}, 0~otherwise.
658:
659: \fun{long}{gegalsg}{long s, GEN x} returns 1 (true) if the long \kbd{s} is
660: equal to~\kbd{x}, 0~otherwise.
661:
662: \fun{long}{gegalgs}{GEN x, long s} returns 1 (true) if \kbd{x} is equal to
663: the long~\kbd{s}, 0~otherwise.
664:
665: \fun{long}{iscomplex}{GEN x} returns 1 (true) if \kbd{x} is a complex number
666: (of component types embeddable into the reals) but is not itself real, 0~if
667: \kbd{x} is a real (not necessarily of type \typ{REAL}), or raises an error
668: if \kbd{x} is not embeddable into the complex numbers.
669:
670: \fun{long}{ismonome}{GEN x} returns 1 (true) if \kbd{x} is a non-zero monomial
671: in its main variable, 0~otherwise.
672:
673: \fun{long}{ggval}{GEN x, GEN p} returns the greatest exponent~$e$ such that
674: $\kbd{p}^e$ divides~\kbd{x}, when this makes sense.
675:
676: \fun{long}{gval}{GEN x, long v} returns the highest power of the variable
677: number \kbd{v} dividing the polynomial~\kbd{x}.
678:
679: \fun{int}{pvaluation}{GEN x, GEN p, GEN *r} applied to non-zero integers
680: \kbd{x} and~\kbd{p}, returns the highest exponent $e$ such that
681: $\kbd{p}^{e}$ divides~\kbd{x}, creates the quotient $\kbd{x}/\kbd{p}^{e}$
682: and returns its address in~\kbd{*r}.
683: In particular, if \kbd{p} is a prime, this returns the valuation at \kbd{p}
684: of~\kbd{x}, and \kbd{*r} will obtain the prime-to-\kbd{p} part of~\kbd{x}.
685:
686: \subsec{Assignment statements}
687:
688: \fun{void}{gaffsg}{long s, GEN x} assigns the long \kbd{s} into the
689: object~\kbd{x}.
690:
691: \fun{void}{gaffect}{GEN x, GEN y} assigns the object \kbd{x} into the
692: object~\kbd{y}.
693:
694: \subsec{Unary operators}
695:
696: \funno{GEN}{gneg[\key{z}]}{GEN x[, GEN z]} yields $-\kbd{x}$.
697:
698: \funno{GEN}{gabs[\key{z}]}{GEN x[, GEN z]} yields $|\kbd{x}|$.
699:
700: \fun{GEN}{gsqr}{GEN x} creates the square of~\kbd{x}.
701:
702: \fun{GEN}{ginv}{GEN x} creates the inverse of~\kbd{x}.
703:
704: \fun{GEN}{gfloor}{GEN x} creates the floor of~\kbd{x}, i.e.\ the (true)
705: integral part.
706:
707: \fun{GEN}{gfrac}{GEN x} creates the fractional part of~\kbd{x}, i.e.\ \kbd{x}
708: minus the floor of~\kbd{x}.
709:
710: \fun{GEN}{gceil}{GEN x} creates the ceiling of~\kbd{x}.
711:
712: \fun{GEN}{ground}{GEN x} rounds the components of \kbd{x} to the nearest
713: integers. Exact half-integers are rounded towards~$+\infty$.
714:
715: \fun{GEN}{grndtoi}{GEN x, long *e} same as \key{round}, but in addition puts
716: minus the number of significant binary bits left after rounding into~\kbd{*e}.
717: If \kbd{*e} is positive, all significant bits have been lost. This kind of
718: situation raises an error message in \key{ground} but not in \key{grndtoi}.
719:
720: \fun{GEN}{gtrunc}{GEN x} truncates~\kbd{x}. This is the (false) integer part
721: if \kbd{x} is an integer (i.e.~the unique integer closest to \kbd{x} among
722: those between 0 and~\kbd{x}). If \kbd{x} is a series, it will be truncated
723: to a polynomial; if \kbd{x} is a rational function, this takes the
724: polynomial part.
725:
726: \fun{GEN}{gcvtoi}{GEN x, long *e} same as \key{grndtoi} except that
727: rounding is replaced by truncation.
728:
729: \fun{GEN}{gred[z]}{GEN x[, GEN z]} reduces \kbd{x} to lowest terms if \kbd{x}
730: is a fraction or rational function (types \typ{FRAC}, \typ{FRACN},
731: \typ{RFRAC} and \typ{RFRACN}), otherwise creates a copy of~\kbd{x}.
732:
733: \fun{GEN}{content}{GEN x} creates the GCD of all the components of~\kbd{x}.
734:
735: \fun{GEN}{normalize}{GEN x} applied to an unnormalized power series~\kbd{x}
736: (i.e.~type \typ{SER} with all coefficients correctly set except that \kbd{x[2]}
737: might be zero), normalizes \kbd{x} correctly in place. Returns~\kbd{x}.
738: For internal use.
739:
740: \fun{GEN}{normalizepol}{GEN x} applied to an unnormalized polynomial~\kbd{x}
741: (i.e.~type \typ{POL} with all coefficients correctly set except that \kbd{x[2]}
742: might be zero), normalizes \kbd{x} correctly in place and returns~\kbd{x}.
743: For internal use.
744:
745: \subsec{Binary operators}
746:
747: \fun{GEN}{gmax[z]}{GEN x, GEN y[, GEN z]} yields the maximum of the objects
748: \kbd{x} and~\kbd{y} if they can be compared.
749:
750: \fun{GEN}{gmaxsg[z]}{long s, GEN x[, GEN z]} yields the maximum of the long
751: \kbd{s} and the object~\kbd{x}.
752:
753: \fun{GEN}{gmaxgs[z]}{GEN x, long s[, GEN z]} yields the maximum of the object
754: \kbd{x} and the long~\kbd{s}.
755:
756: \fun{GEN}{gmin[z]}{GEN x, GEN y[, GEN z]} yields the minimum of the objects
757: \kbd{x} and~\kbd{y} if they can be compared.
758:
759: \fun{GEN}{gminsg[z]}{long s, GEN x[, GEN z]} yields the minimum of the long
760: \kbd{s} and the object~\kbd{x}.
761:
762: \fun{GEN}{gmings[z]}{GEN x, long s[, GEN z]} yields the minimum of the object
763: \kbd{x} and the long~\kbd{s}.
764:
765: \fun{GEN}{gadd[z]}{GEN x, GEN y[, GEN z]} yields the sum of the objects \kbd{x}
766: and~\kbd{y}.
767:
768: \fun{GEN}{gaddsg[z]}{long s, GEN x[, GEN z]} yields the sum of the long \kbd{s}
769: and the object~\kbd{x}.
770:
771: \fun{GEN}{gaddgs[z]}{GEN x, long s[, GEN z]} yields the sum of the object
772: \kbd{x} and the long~\kbd{s}.
773:
774: \fun{GEN}{gsub[z]}{GEN x, GEN y[, GEN z]} yields the difference of the objects
775: \kbd{x} and~\kbd{y}.
776:
777: \fun{GEN}{gsubgs[z]}{GEN x, long s[, GEN z]} yields the difference of the
778: object \kbd{x} and the long~\kbd{s}.
779:
780: \fun{GEN}{gsubsg[z]}{long s, GEN x[, GEN z]} yields the difference of the
781: long \kbd{s} and the object~\kbd{x}.
782:
783: \fun{GEN}{gmul[z]}{GEN x, GEN y[, GEN z]} yields the product of the objects
784: \kbd{x} and~\kbd{y}.
785:
786: \fun{GEN}{gmulsg[z]}{long s, GEN x[, GEN z]} yields the product of the long
787: \kbd{s} with the object~\kbd{x}.
788:
789: \fun{GEN}{gmulgs[z]}{GEN x, long s[, GEN z]} yields the product of the object
790: \kbd{x} with the long~\kbd{s}.
791:
792: \fun{GEN}{gshift[z]}{GEN x, long n[, GEN z]} yields the result of shifting
793: (the components of) \kbd{x} left by \kbd{n} (if \kbd{n} is non-negative)
794: or right by $-\kbd{n}$ (if \kbd{n} is negative).
795: Applies only to integers, reals and vectors/matrices of such. For other
796: types, it is simply multiplication by~$2^{\kbd{n}}$.
797:
798: \fun{GEN}{gmul2n[z]}{GEN x, long n[, GEN z]} yields the product of \kbd{x}
799: and~$2^{\kbd{n}}$. This is different from \kbd{gshift} when \kbd{n} is negative
800: and \kbd{x} is of type \typ{INT}: \key{gshift} truncates, while \key{gmul2n}
801: creates a fraction if necessary.
802:
803: \fun{GEN}{gdiv[z]}{GEN x, GEN y[, GEN z]} yields the quotient of the objects
804: \kbd{x} and~\kbd{y}.
805:
806: \fun{GEN}{gdivgs[z]}{GEN x, long s[, GEN z]} yields the quotient of the object
807: \kbd{x} and the long~\kbd{s}.
808:
809: \fun{GEN}{gdivsg[z]}{long s, GEN x[, GEN z]} yields the quotient of the long
810: \kbd{s} and the object~\kbd{x}.
811:
812: \fun{GEN}{gdivent[z]}{GEN x, GEN y[, GEN z]} yields the true Euclidean
813: quotient of \kbd{x} and the integer or polynomial~\kbd{y}.
814:
815: \fun{GEN}{gdiventsg[z]}{long s, GEN x[, GEN z]} yields the true Euclidean
816: quotient of the long \kbd{s} by the integer~\kbd{x}.
817:
818: \fun{GEN}{gdiventgs[z]}{GEN x, long s[, GEN z]} yields the true Euclidean
819: quotient of the integer \kbd{x} by the long~\kbd{s}.
820:
821: \fun{GEN}{gdiventres}{GEN x, GEN y} creates a 2-component vertical
822: vector whose components are the true Euclidean quotient and remainder
823: of \kbd{x} and~\kbd{y}.
824:
825: \fun{GEN}{gdivmod}{GEN x, GEN y, GEN *r} If \kbd{r} is not equal to
826: \kbd{NULL} or \kbd{ONLY\_REM}, creates the (false) Euclidean quotient of
827: \kbd{x} and~\kbd{y}, and puts (the address of) the remainder into~\kbd{*r}.
828: If \kbd{r} is equal to \kbd{NULL}, do not create the remainder, and if
829: \kbd{r} is equal to \kbd{ONLY\_REM}, create and output only the remainder.
830: The remainder is created after the quotient and can be disposed of
831: individually with a \kbd{cgiv(r)}.
832:
833: \fun{GEN}{poldivres}{GEN x, GEN y, GEN *r} same as \key{gdivmod} but
834: specifically for polynomials \kbd{x} and~\kbd{y}.
835:
836: \fun{GEN}{gdeuc}{GEN x, GEN y} creates the Euclidean quotient of the
837: polynomials \kbd{x} and~\kbd{y}.
838:
839: \fun{GEN}{gdivround}{GEN x, GEN y} if \kbd{x} and \kbd{y} are integers,
840: returns the quotient $\kbd{x}/\kbd{y}$ of \kbd{x} and~\kbd{y}, rounded to
841: the nearest integer. If $\kbd{x}/\kbd{y}$ falls exactly halfway between
842: two consecutive integers, then it is rounded towards~$+\infty$ (as for
843: \key{round}). If \kbd{x} and \kbd{y} are not both integers, the result
844: is the same as that of \key{gdivent}.
845:
846: \fun{GEN}{gmod[z]}{GEN x, GEN y[, GEN z]} yields the true remainder of \kbd{x}
847: modulo the integer or polynomial~\kbd{y}.
848:
849: \fun{GEN}{gmodsg[z]}{long s, GEN x[, GEN z]} yields the true remainder of the
850: long \kbd{s} modulo the integer~\kbd{x}.
851:
852: \fun{GEN}{gmodgs[z]}{GEN x, long s[, GEN z]} yields the true remainder of the
853: integer \kbd{x} modulo the long~\kbd{s}.
854:
855: \fun{GEN}{gres}{GEN x, GEN y} creates the Euclidean remainder of the
856: polynomial \kbd{x} divided by the polynomial~\kbd{y}.
857:
858: \fun{GEN}{ginvmod}{GEN x, GEN y} creates the inverse of \kbd{x} modulo \kbd{y}
859: when it exists.
860:
861: \fun{GEN}{gpow}{GEN x, GEN y, long l} creates $\kbd{x}^{\kbd{y}}$. The
862: precision \kbd{l} is taken into account only if \kbd{y} is not an integer
863: and \kbd{x} is an exact object. If \kbd{y} is an integer, binary powering
864: is done. Otherwise, the result is $\exp(\kbd{y}*\log(\kbd{x}))$ computed
865: to precision~\kbd{l}.
866:
867: \fun{GEN}{ggcd}{GEN x, GEN y} creates the GCD of \kbd{x} and~\kbd{y}.
868:
869: \fun{GEN}{glcm}{GEN x, GEN y} creates the LCM of \kbd{x} and~\kbd{y}.
870:
871: \fun{GEN}{subres}{GEN x, GEN y} creates the resultant of the polynomials
872: \kbd{x} and~\kbd{y} computed using the subresultant algorithm.
873:
874: \fun{GEN}{gpowgs}{GEN x, long n} creates $\kbd{x}^{\kbd{n}}$ using
875: binary powering.
876:
877: \fun{GEN}{gsubst}{GEN x, long v, GEN y} substitutes the object \kbd{y}
878: into~\kbd{x} for the variable number~\kbd{v}.
879:
880: \fun{int}{gdivise}{GEN x, GEN y} returns 1 (true) if \kbd{y} divides~\kbd{x},
881: 0~otherwise.
882:
883: \fun{GEN}{gbezout}{GEN x,GEN y, GEN *u,GEN *v} creates the GCD of \kbd{x}
1.2 ! noro 884: and~\kbd{y}, and puts (the addresses of) objects $u$ and~$v$ such that
1.1 noro 885: $u\kbd{x}+v\kbd{y}=\gcd(\kbd{x},\kbd{y})$ into \kbd{*u} and~\kbd{*v}.
886: \vfill\eject
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>