1 | The structure pointed to by "coeffs" describes a commutative ring with 1 |
---|
2 | which could be used as coeffcients for polynomials. |
---|
3 | |
---|
4 | To create a new representant of coeffs, implement all of the following |
---|
5 | properties/functions and register it via nRegister(n_unknown,<InitCharFunc>) |
---|
6 | |
---|
7 | properties(mandatory): |
---|
8 | -has_simple_Alloc (i.e. number is not a pointer) |
---|
9 | -has_simple_Inverse |
---|
10 | -is_field |
---|
11 | -is_domain |
---|
12 | |
---|
13 | mandatory: |
---|
14 | -cfCoeffWrite |
---|
15 | -cfCoeffString |
---|
16 | -cfMult, cfSub, cfAdd, cfDiv |
---|
17 | cfDiv is supposed to be a Euclidean division in rings that are meant |
---|
18 | to be Euclidean and an exact division otherwise. |
---|
19 | -cfInit |
---|
20 | -cfInt (returns 0, if the arguemnt is not in int) |
---|
21 | -cfMPZ (returns mpz_init_si(0), if the arguemnt is not an integer) |
---|
22 | -cfInpNeg |
---|
23 | negates (mult. by -1) in-place. |
---|
24 | -cfInvers |
---|
25 | -cfWriteLong |
---|
26 | -cfRead |
---|
27 | -cfGreater |
---|
28 | -cfEqual |
---|
29 | -cfIsZero |
---|
30 | -cfIsOne |
---|
31 | -cfIsMOne |
---|
32 | -cfGreaterZero |
---|
33 | -cfSetMap |
---|
34 | -ch |
---|
35 | |
---|
36 | mandatory for certain types of coeffs: |
---|
37 | -nCoeffIsEqual: if cfInitChar really uses its additional parameter |
---|
38 | -cfKillChar: if additional initializations have to be undone (data, etc) |
---|
39 | -cfSetChar: if additional initializations to use numbers from this coeffs is needed (should not be needed) |
---|
40 | -cfIntMod: if the ring has a meaningful Euclidean structure |
---|
41 | In this case, this computes the remainder under the Euclidean division. |
---|
42 | -cfGcd, cfExtGcd,cfXExtGcd,cfEucNorm: if the ring (or a subring) has a meaningful Euclidean structure |
---|
43 | +Gcd: the usual Gcd |
---|
44 | +ExtGcd(a,b) -> g = ea+fb, the usual extended version with co-factors |
---|
45 | +XExtGcd(a,b) -> (a,b)*((e,f)(u,v)) = (g,0) and the matrix is unimodular. |
---|
46 | If the Euclidean ring is a domain, one can compute the matrix from the normal |
---|
47 | ExtGcd, however in the presence of zero-divisors, this does not work, hence the |
---|
48 | more general function. |
---|
49 | -cfSubringGcd: if cf is q quotient field of a ring: Gcd of that ring |
---|
50 | (example: Q: Gcd for Z, Q(t): Gcd for Z[t], Z/p(t): Gcd for Z/p[t]) |
---|
51 | Z[t] has no gcd. Is there a function to get the ring as well? |
---|
52 | -cfAnn: in a principal ideal ring (with zero divisors) |
---|
53 | a generator for the annihilator |
---|
54 | -cfWriteFd,cfReadFd: for use of ssi |
---|
55 | -cfDelete: if has_simple_Alloc==0, otherwise noop |
---|
56 | -cfCopy: if has_simple_Alloc==0, otherwise trivial |
---|
57 | -iNumberOfParameters (otherwise 0) |
---|
58 | probably related to (multivariate) polynomial rings. |
---|
59 | -pParameterNames (otherwise NULL) |
---|
60 | -if cf is not a field: cfDivComp, cfIsUnit, cfGetUnit, cfDivBy |
---|
61 | +DivComp(a,b) returns 2 if b|a and a|b, -1 if b|a, 1 if a|b and 0 otherwise. |
---|
62 | +IsUnit |
---|
63 | +GetUnit(a) returns a unit u s.th. au is normalised (ie. positive for Z, |
---|
64 | a canonical rep in Z/mZ, a monic polynomial in K[x], ..) |
---|
65 | +DivBy(a,b) returns TRUE iff b divides a |
---|
66 | -cfDBTest: for debugging, noop otherwise |
---|
67 | -cfInitMPZ: otherwise via cfInit |
---|
68 | -cfQuot1 (if cf is not a field) |
---|
69 | appears to create a quotient ring modulo 1 element. Probably mainly |
---|
70 | supported by Z -> Zm and Zm -> Zn |
---|
71 | |
---|
72 | optional: |
---|
73 | -cfExactDiv (otherwise: it is cfDiv): for optimization. Behaviour undefined if |
---|
74 | the division does not work |
---|
75 | -cfSize (otherwise: !cfIsZero(..)) |
---|
76 | should measure the complexity, used for pivot strategies etc. |
---|
77 | Required: size(0)==0, size(a)>0 for a!=0 |
---|
78 | -cfRePart (otherwise: cfCopy) |
---|
79 | -cfImPart (otherwise returns cfInit(0)) |
---|
80 | -cfWriteShort (otherwise: cfWriteLong) |
---|
81 | -cfNormalize (otherwise: noop) paired with cfGetUnit: a == Normalize(a)*GetUnit(a) |
---|
82 | Question: make GetUnit return the inverse? |
---|
83 | -cfGetDenom (otherwise cfInit(1)) |
---|
84 | Question: what is the use? Is a*Den(a) mathematically integral or has no |
---|
85 | denominator in the current rep? |
---|
86 | Stupid example: take K=Q as a number field with basis 1/2. Then wrt to the basis |
---|
87 | 1/2, the element 1/2 has no denominator, hence Den(1/2)=1. However... |
---|
88 | -cfGetNumerator (otherwiser cfCopy) |
---|
89 | -cfInpMult (otherwise via cfMult/cfDelet): for optimization |
---|
90 | -cfInpAdd (otherwise via cfAdd/cfDelet): for optimization |
---|
91 | -cfFarey:(x, M) find a/b in the quotient field of R sth. a = bx mod M and both |
---|
92 | a and b are suitable smaller than M. Implemented for Z -> Q currently. |
---|
93 | -cfChineseRemainder (otherwise: error) |
---|
94 | takes arrays a and q of length r to find a single |
---|
95 | A = a[i]mod q[i]. A can be chosen in the symmetric or positive remainder. |
---|
96 | Question: do the q[i] have to be coprime? |
---|
97 | |
---|
98 | -cfParDeg (otherwise: -1 for 0, 0 for non-zero) |
---|
99 | Use? |
---|
100 | -cfParameter (otherwise: error) |
---|
101 | Use? |
---|
102 | |
---|
103 | automatic: |
---|
104 | -ref (by nInitChar,nKillChar) |
---|
105 | -type (by nInitChar) |
---|
106 | to describe: |
---|
107 | -cfLcm for Euclidean rings the product divided by the (a) gcd. |
---|
108 | -cfNormalizeHelper |
---|
109 | -cfQuotRem |
---|
110 | returns both the Euclidean quotient and the remainder in one go. |
---|
111 | -cfRandom |
---|
112 | Question: random(Z)? |
---|
113 | -cfClearContent |
---|
114 | -cfClearDenominators |
---|
115 | -cfPower only small exponents (machine int) supported right now. |
---|
116 | |
---|
117 | ---------------------------------------------------------------------------- |
---|
118 | Howto define a new coeff type: |
---|
119 | // register the new class of coeffs: |
---|
120 | n_coeffType type=nRegister(n_unknown,<your InitChar procedure>); |
---|
121 | // create the new coeff type: |
---|
122 | coeffs cf=nInitChar(type,<your paramater for the InitChar procedure>); |
---|
123 | // cf may now be used for (polynomial) ring definitions etc. |
---|
124 | |
---|