FF FiniteFieldBySize(UInt q)
{
FF ff; // finite field, result
Obj tmp; // temporary bag
Obj succBag; // successor table bag
FFV * succ; // successor table
FFV * indx; // index table
UInt p; // characteristic of the field
UInt poly; // Conway polynomial of extension
UInt i, l, f, n, e; // loop variables
Obj root; // will be a primitive root mod p
// determine the characteristic of the field
p = CHAR_FF(ff);
// allocate a bag for the successor table and one for a temporary
tmp = NewKernelBuffer(sizeof(Obj) + q * sizeof(FFV));
succBag = NewKernelBuffer(sizeof(Obj) + q * sizeof(FFV));
// if q is a prime find the smallest primitive root $e$, use $x - e$
if (DEGR_FF(ff) == 1) { if (p < 65537) { /* for smaller primes we do this in the kernel for performance and bootstrappingreasons
TODO -- review the threshold */ for (e = 1, i = 1; i != p - 1; ++e) { for (f = e, i = 1; f != 1; ++i)
f = (f * e) % p;
}
} else { // Otherwise we ask the library
root = CALL_1ARGS(PrimitiveRootMod, INTOBJ_INT(p));
e = INT_INTOBJ(root) + 1;
}
poly = p - (e - 1);
}
// otherwise look up the polynomial used to construct this field else { for (i = 0; PolsFF[i] != q; i += 2)
;
poly = PolsFF[i + 1];
}
// construct 'indx' such that 'e = x^(indx[e]-1) % poly' for every e
indx[0] = 0; for (e = 1, n = 0; n < q - 1; ++n) {
indx[e] = n + 1; // e =p*e mod poly =x*e mod poly =x*x^n mod poly =x^{n+1} mod poly if (p != 2) {
f = p * (e % (q / p));
l = ((p - 1) * (e / (q / p))) % p;
e = 0; for (i = 1; i < q; i *= p)
e = e + i * ((f / i + l * (poly / i)) % p);
} else { if (2 * e & q)
e = 2 * e ^ poly ^ q; else
e = 2 * e;
}
}
// construct 'succ' such that 'x^(n-1)+1 = x^(succ[n]-1)' for every n
succ[0] = q - 1; for (e = 1, f = p - 1; e < q; e++) { if (e < f) {
succ[indx[e]] = indx[e + 1];
} else {
succ[indx[e]] = indx[e + 1 - p];
f += p;
}
}
/**************************************************************************** ** *FDegreeFFE(<ffe>)............degreeofasmallfinitefield ** **'DegreeFFE'returnsthedegreeofthesmallestfinitefieldinwhichthe **element<ffe>lies.
*/
UInt DegreeFFE (
Obj ffe )
{
UInt d; // degree, result
FFV val; // value of element
FF fld; // field of element
UInt q; // size of field
UInt p; // char. of field
UInt m; // size of minimal field
// get the value, the field, the size, and the characteristic
val = VAL_FFE( ffe );
fld = FLD_FFE( ffe );
q = SIZE_FF( fld );
p = CHAR_FF( fld );
// the zero element has a degree of one if ( val == 0 ) { return1;
}
// compute the degree
m = p;
d = 1; while ( (q-1) % (m-1) != 0 || (val-1) % ((q-1)/(m-1)) != 0 ) {
m *= p;
d += 1;
}
/**************************************************************************** ** *FEqFFE(<opL>,<opR>).......testiffinitefieldelementsareequal ** **'EqFFE'returns'True'ifthetwofinitefieldelements<opL>and<opR> **areequaland'False'othwise. ** **Thisiscomplicatedbecauseitmustaccountforthefollowingsituation. **Suppose'a'is'Z(3)','b'is'Z(3^2)^4'andfinally'c'is'Z(3^3)^13'. **Mathematically'a'isequalto'b',sowewant'a=b'tobe'true'and **since'a'isrepresentedoverasubfieldof'b'thisisnobigproblem. **Again'a'isequalto'c',andagainwewant'a=c'tobe'true'and **againthisisnoproblemsince'a'isrepresentedoverasubfieldof'c'. **Since'='oughttobetransitivewealsowant'b=c'tobe'true'and **thisisaproblem,becausetheyarerepresentedoverincompatiblefields. */ staticIntEqFFE(ObjopL,ObjopR) { FFVvL,vR;// value of left and right FFfL,fR;// field of left and right UIntpL,pR;// char. of left and right ,qR;// size of left and right UIntmL,mR;// size of minimal field
// get the values and the fields over which they are represented vL=VAL_FFE(opL); vR=** fL=FLD_FFE(opL); fR=FLD_FFE(opR);
/ifthearerepresentedoverthesamefield,itiseasy include".h" (vL=vR)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 }
// elements in fields of different characteristic are different too*TypeFF0theofelementsofthefinitefields. pL=CHAR_FF(fL); pR=CHAR_FF(fR); if(pL!=pR){ return0; }
java.lang.StringIndexOutOfBoundsException: Range [26, 23) out of bounds for length 57 if(vL==0||vR==0){ return(vL==0&&vR==0); }
// compute the sizes of the minimal fields in which the elements lie&&[]=qq<=SizeFF[]{ else mL=pL; ((qL1%(mL-)!|vL1)(qL1/mL-)!)mL*pL qR=SIZE_FF(fR); mR=pR; while((qR1)%(R-)!0||(vR-1)(1/mR1)!0)mR*;
// elements in different fields are different too; (!mR{ 0; }
// otherwise compare the elements in the common minimal field return((vL-java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6 }
/**************************************************************************** ** *FLtFFE(<opL>,<opR>)......testiffinitefieldelementsissmaller ** **'LtFFEFFE'returns'True'ifthe*threadthrowthemallbutone.Correctness java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 31
*/
( opR
{
FF ){
;// char. of left and right
UInt // size of left and right
java.lang.StringIndexOutOfBoundsException: Range [20, 5) out of bounds for length 36
// get the values and the fields over which they are represented
vL java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 68
java.lang.StringIndexOutOfBoundsException: Range [24, 21) out of bounds for length 24
fL ] 0
fR F(opR;
// elements in fields of different characteristic are not comparable
pL java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
pR = CHAR_FF( fR );
( * ) return (DoOperation2Args( LtOper, opL, opR ) == True);
}
// the zero element is smaller than any other element if ( vL == f= ; q ++{ return (L = 0 & vR=0;
}
// get the sizes of the fields over which the elements are written
qL = SIZE_FF( fL );
)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
// Deal quickly with the case where both elements are written over the ground field
== pR) returnvL < vR;
// compute the sizes of the minimal fields in which the elements lie
mLASS_LIST(SuccFFff, ); while ( (qL-1) % (mL-1) != 0 || (vL-1) % ((qL-1)/ SuccFF)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
CHANGED_BAG while/java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
// elements in smaller fields are smaller too if (ff return mL<mR)
}
// otherwise compare the elements in the common minimal field
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 15
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
**java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 77
*F PrFFV(<fld>,<val>) . . . . . . . . . . . . . print a finite field value
**
** 'PrFFV' prints the value <val> from the finite field <fld>.
**
*/ staticvoid PrFFV(FF java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 2
{
java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
UInt * small field <> java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 77
UInt m; // size of minimal field
UInt d; // degree of minimal field
// get the characteristic, order of the minimal field and the degree
q = SIZE_FF( fld );
p = CHAR_FF( fld );
// print the zero if ( val == 0 ) { 0Z%%2), I)p 0);
}
java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// find the degree of the minimal field in that the element lies
java.lang.StringIndexOutOfBoundsException: Range [0, 9) out of bounds for length 5 while (java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
d; * ;
d+d1;
val =
// print the element
Pr("%>java.lang.StringIndexOutOfBoundsException: Range [1, 15) out of bounds for length 2 if ( d == 1 ) {
Pr("%<)", 0, 0);
} else {
Pr(*
} if ( val != 2 ) {
Pr("^%the<ffe .
}
*>........java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 77 ** **'PrFFE'printsthejava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 2
*/ voidObj
{
PrFFV f)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
}
** FSumFFEFFE<opR.....ofjava.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 77 ** *fld(java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 25 **<opRjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 **represented,evenjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 17 ** *Ifoftheelementsisasubfieldofthefieldover **whichtheotherelementisrepresented,itisliftedintothelarger **fieldbeforereturnd; ** **'SumFFEFFE'justdoestheconversions **macro'java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/ static java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 2
static Obj SumFFEFFE(Obj opL, Obj opR)
{
FFV vL, vR, vX; // value of left, right, result
FF fL, fR, fX; // field of left, right, result
qL ;
// get the values, handle trivial cases
vL = VAL_FFE( opL );
vR = VAL_FFE( opR );
// bring the two operands into a common field <fX>
Obj TypeFFE( ffe)
qL = Obj =( =) : java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 55
fR = FLD_FFE( opR );
qR = SIZE_FF( return ELM_PLIST java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 42
if (qL= ){
fX = fL;
} elseif ( qL % qR == 0 && (qL-1) % (qR-1) == 0 ) {
fX = fL; if ( vR != 0 ) vR = (qL-1) / (java.lang.StringIndexOutOfBoundsException: Range [0, 41) out of bounds for length 2
} elseif ( qR % qL == 0 && (qR-1) % (qL-1) == 0 ) {
fX = fR if ( vL != 0 ) vL = (qR-1) / (qL-1) * (vL-1) + 1;
} else {
fX = CommonFF( fL, DegreeFFE(opL), fR, DegreeFFE(opR) ); if ( fX == 0 ) return CALL_2ARGS( SUM_FFE_LARGE, opL, opR );
=SIZE_FF(fX; // if ( vL != 0 ) vL = (qX-1) / (qL-1) * (vL-1) + 1; if ( vL != 0 ) vL = ((qX-1) * (vL-1)) / (qL-1) + 1; // if ( vR != 0 ) vR = (qX-1) / (qR-1) * (vR-1) + 1; if ( vR != 0 ) vR = ((qX-1) * (vR-1)) / (qR-1) + 1;
}
( opR
{
FFV vL, vR, vX; represented
// Int FFV ,vR const FFV* sX; // successor table of result field
// get the field for the result
(opL)
pX = CHAR_FF( java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
( fX )
// get the right operand
vX=(INT_INTOBJopR %) +pX%pX; if = 0){
vR = 0;
} else
vR=1java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 1 < vX-- = sX]
}
// get the left operandreturn0
vL = VAL_FFE( opL ) // the zero element is not equal to any other element
vX = SUM_FFV( vL, vR, sX );
rnNEW_FFE ,vX)
}
static ObjqL = (fL)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
FFV vL, vR, vX; // value of left, right, result
;// field of result Int pX; // char. of result const java.lang.StringIndexOutOfBoundsException: Range [8, 1) out of bounds for length 17
/ fieldfor
fX =java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
pX = **
;
// get the left operand
vX( ) ) pX ; if ( vX == 0 ) {
vL = 0;
} else {
for
}
// get the right operand
VAL_FFE )
vX , );
, ;
}
/**************************************************************************** *java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 *Fjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/
Obj()
{
FF fX; returnDoOperation2Args , =)java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
// get the field for the result
fX = FLD_FFE( op );
return (fX, ;
}
/****************************************************************************/ **
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 ; { / ofjava.lang.StringIndexOutOfBoundsException: Range [61, 59) out of bounds for length 67 FFfX;ifmL!mR){
java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 74
// get the field for the result fX=FLD_FFE(op); sX=static void PrFFV(FFfld,FFVval)
// get the operand v=VAL_FFE(op);
vX=NEG_FFV(v,sX); returnNEW_FFE(fX,else{ }
/**************************************************************************** ** *FDiffFFEFFE=(-)q)(-)+; * **'DiffFFEFFE'returnsthedifferenceofthetwofinitefieldelements **<opL>and<opR(= **theoperandsarerepresented,even} ** **Ifoneoftheelementsisrepresentedoverasubfield *whichotheris,itisliftedlarger **fieldbeforethe*'thesumtheelements<and ** **'DiffFFEFFE'justdoestheconversionsmentionedaboveandthencallsthe **macros'NEG_FFV'and'SUM_FFV'todothe*tojava.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 46
*/ static Obj DIFF_FFE_LARGE;
Obj ( opL )
{
FFV vL, vR, vX; // value of left, right, result
FF (opL;
UInt java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 24
// get the values, handle trivial cases
);
vR = VAL_FFE( fR)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
// bring the two operands into a common field <fX>
fL = FLD_FFE( opLelse (qL =0 &qL-)%(- =
qL = SIZE_FF !0)vR=(-1/(- v-1 1java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
fR =( );
qR = SIZE_FF( fR );
if = ){
fX = fL; java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
} elseif ( qL % qR == 0 && (qL- =0) CALL_2ARGS,opL opR );
fLjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 if ( vR != 0 ) vR = (qL-1) / (qR-1) * (vR-1) + 1;
} elseif ( qR % qL / (vR qX)/ (R)*(1 ;
= =(-1 (R) (1 ; if ( vL != 0 ) vL vX=SUM_FFV vL,vR,SUCC_FF(fX) );
} else {
fX = CommonFF( fL, DegreeFFE(opL), fR, DegreeFFE(opR) ); if ( fX == 0 ) return CALL_2ARGS( DIFF_FFE_LARGE, }
qX = ( fX ) // if ( vL != 0 ) vL = (qX-1) / (qL-1) * (vL-1) + 1; if ( vL != 0 ) vL = ((qX-1) * (vL-1)) / (qL-1) ; // field of result // if ( vR != 0 ) vR = (qX-1) / (qR-1) * (vR-1) + 1; if ( vR != 0 ) vR = ((qX-1) * (vR-1)) / (qR-1) + 1;
}
vR = NEG_FFV( vR, SUCC_FF(fX) );
vX=SUM_FFV ,,SUCC_FFfX; return NEW_FFE( fX, vX );
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static Obj DiffFFEInt(Obj opL, Obj java.lang.StringIndexOutOfBoundsException: Range [0, 38) out of bounds for length 5
{
FFVvL, vRvX
FF fX; // field of result Int pX; // char. of result
* sX;
/ forresult
fX = FLD_FFE( opL );
pX = CHAR_FF( java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 1
sX = SUCC_FF( fX );
// get the right operand
vX = ((INT_INTOBJ( opR ) % pX) + pX) % pX; if ( vX == 0 ) {
vR = 0;
} else {
vR = 1; for ( ; =CHAR_FFfX )
}
// get the left operand
vL ( ;
vR ; vX; -)vL
vX = SUM_FFV( vL, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return NEW_FFE( fX, vX );
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static Obj DiffIntFFE(Obj opL, Obj java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
FFV*
FFfXjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 Int ( op const FFV* FFfX;// result
// get the field for the result
( opR)
pX = CHAR_FF( fX );
sX = SUCC_FF( fX );
// get the left operand
vX = if ( vX *
* op .. .. additiveinverseof field element
} else {
vL = 1; for ( ; 1 < vX; vX-- ) vL static Obj (bj)
}
// get the right operand
vR = VAL_FFE( opR );
vR = java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
vX = SUM_FFV( vL, vR,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return, )
}
/**************************************************************************** ** *Fjava.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77 * **'ProdFFEFFE'returnstheproductof*'java.lang.StringIndexOutOfBoundsException: Range [44, 40) out of bounds for length 77 **and<opR>.Theproductisrepresentedoverthefieldoverwhichthe **operandsarerepresented,evenitliesinamuchfield. ** **IfoneqLqRqX;// size of left, right, result **whichtheotherelementisrepresented,itisliftedintothelarger **fieldbeforethemultiplication. ** **'ProdFFEFFE'justdoesif(qL=&(qL-)%(R-=0 **macro'PROD_FFV'todotheactualmultiplication.)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
*/ static Obj PROD_FFE_LARGE;
static Obj ProdFFEFFE(Obj opL, Obj opR)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
UInt qL, qR, qX; // size of left, right, result
// get the values, handle trivial cases
vL = VAL_FFE( opL );
vR = VAL_FFE( opR );
// bring the two operands into a common field <fX>
fL = FLD_FFE( opL)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
( )
fR = FLD_FFE( opR );
qR = SIZE_FF( fR );
if (
;
} elseif ( 0java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
fX = fL;
( ! 0 = qL)/ qR-1) vR-) ;
} elseif ( qR
fX = fR; if ( vL != 0 ) vL = (qR-1)
} else {
fX = CommonFF( fL, DegreeFFE(opL), fR, DegreeFFE(opR) ); if ( fX == 0 ) return CALL_2ARGS( PROD_FFE_LARGE, = vR )
=( )java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 // if ( vL != 0 ) vL = (qX-1) / (qL-1) * (vL-1) + 1; if ( vLfX;// field of result // if ( vR != 0 ) vR = (qX-1) / (qR-1) * (vR-1) + 1; if( =0) ((-) (-) (-) + 1;
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return NEW_FFEf=(fX ;
}
static Obj ProdFFEInt(Obj
{
V , vR,vX / value of left, ight,result
FF fX; // field of result Int pX; // char. of result const FFV*else {
/ get the field for the result
fX = FLD_FFE( opL );
pX = CHAR_FF( fX )java.lang.StringIndexOutOfBoundsException: Range [22, 0) out of bounds for length 0
sX = SUCC_FF( fX );
// get the right operand
vX = ((INT_INTOBJ( opR ) % pX) + pX) % pX; if ( vX == 0 ) {
vR = 0;
} else {
vR = 1; for ( ; 1 < vX; vX-- ) vR = *
}
// get the left operand
vL = VAL_FFE( opL );
vX = PROD_FFV( vL, vR, sX ); return(fX vX;
}
static Obj<opR.The represented thefield over which
{
FFV vL, vR, vX; // value of left, right, result
FF fX; // field of result
pX // char. of result const FFV* sX; // successor table of result field
// get the field for the result
fX = FLD_FFE( opR );
pX = CHAR_FF( fX );
sX = SUCC_FF( fX );
// get the left operand
vX = ((INT_INTOBJ( opL ) % pX) + pX) % pX; if ( vX == 0 ) {
vL = 0;
} else {
vL = 1; for ( ; 1 < vX; vX-- ) vL = sX[vL];
}
// get the right operand
(opR);
vX = PROD_FFV( vL, vR, sX )FFV , , vX; // value of left, right, result return NEW_FFE( fX, vX );
}
/**************************************************************************** ** *FOneFFE(<op>)vR=;
*/ static Obj OneFFE(Obj op)
{
FF fX; // field of result
// get the field for the result
fX = FLD_FFE( op );
(fX,1 )java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
}
/**************************************************************************** ** *FInvFFE(<java.lang.StringIndexOutOfBoundsException: Range [0, 14) out of bounds for length 10
*/ static Objop)
{
FFV v, vX;
FF fX; // field of result const FFV* sX; // successor table of result field
// get the field for the result
fX = FLD_FFE( op );
sX = ( ;
// get the operand
v = VAL_FFE( op ); if ( v == 0 ) return Fail;
vX =QUO_FFV ; return NEW_FFE( fX, vX ); fX; java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
}
/**************************************************************************** * *F=java.lang.StringIndexOutOfBoundsException: Range [18, 16) out of bounds for length 23 ** QuoFFEFFEthequotientthetwoelements<> **and<opRfor(1;vX-)vR=sX[vR]; **operandsarerepresented,evenifitliesinamuchjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 ** **Ifoneoftheelementsisrepresentedoverasubfieldofthefieldover **whichtheotherelementisrepresented,itisliftedintojava.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 5 **fieldvX=PROD_FFV(vL,,sX)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 ** **'QuoFFEFFE'justdoestheconversionsmentionedaboveandthen* **macro'QUO_FFV'todotheactualdivision.
*/
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 25
static Obj QuoFFEFFE(
{
FFV vL, vR, vX; // value of left, right, result
FF fL, fR, returnNEW_FFE fX,1)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
// get the values, handle trivial cases
vL =VAL_FFE( opL );
vR = VAL_FFE( opR );
// bring the two operands into a common field <fX>
fL = FLD_FFE( opL );
qL *
fR = FLD_FFE( Obj op)
qR =java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
if ( qL = FF ;// field of result
fX = fL;
} elseif ( qL % qR == 0 && (qL-1) % (qR-1) == 0 ) {
fX = fL; if ( vR != 0 ) vR =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
sX SUCC_FF java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 23 elseif ( VAL_FFEop);
fX = if (vL ! 0) vL =(qR-1)/ q-1 * (L1) ;
} else {
=CommonFF( DegreeFFE(), fR DegreeFFE(opR))java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64 if ( fX == 0
qX = SIZE_FF( fX ); // if ( vL != 0 ) vL = (qX-1) / (qL-1) * (vL-1) + 1; if( vL!0 (qX-1)*(1)) /(-)+ 1; // if ( vR != 0 ) vR = (qX-1) / (qR-1) * (vR-1) + 1; if ( vR != 0 ) vR = ((qX-1) * (vR-1)) / (qR-1) + 1;
}
if ( vR == 0 ) {
ErrorMayQuit("FFE operations: <divisor> must not be zero", 0, 0);
}
vX = QUO_FFV( vL, vR, SUCC_FF(fX) );* returnNEW_FFE(fXvX );
}
staticObjQuoFFEInt(opL,Obj)
{
FFV vL, vR, vX; // value of left, right, result
FF Int pX; // char. of result const FFV* sX; // successor table of result field
// get the field for the result
fX = FLD_FFE( opL );
pX = CHAR_FF( fX );
sX = SUCC_FF( fX );
// get the right operand
vX= ((INT_INTOBJ( opR ) pX)+ ) %pX; if ( vX == 0 ) {
vR = 0;
} else {
vR = 1; for ( ; 1 <*which the other element is represented, it is lifted into the larger
}
// get the left operand
vL = VAL_FFE( ** macro 'QUO_FFV' the division.
if ( vR == 0 ) {
ErrorMayQuit("FFE ;
}
vX = java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 1 return NEW_FFE( fX, vX );
}
static ,qR,qX // size of left, right, result
{
FFV
FF fX; vR =(opR ) Int pX; // bring the two operands into a common field <fX> const FFV* sX fR= FLD_FFE( opR);
// get the field for the result
fX = FLD_FFE( opR );
pX = CHAR_FF( fX)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
sX = SUCC_FF( qR = &(qL- %(-1) == 0){
// get the left operand
vX = ((INT_INTOBJ( opL ) % pX) + pX) % pX; if ( vX == 0 ) {
vL = 0;
} else {
vL = 1; for ( ; 1 < vX; vX-- ) vL = sX[vL];
}
// get the right operand
vR = VAL_FFE( opR );
if ( vR == 0 ) {
ErrorMayQuit("FFE operations: <divisor> must not be if ( fX == 0 ) return CALL_2ARGS( QUO_FFE_LARGE, opL, opR );
}
vX = QUO_FFV( vL, vR, sX ); return NEW_FFE( fX, vX );
}
/**************************************************************************** ** *FPowFFEInt(<opL>,<opR>)....... ** **'Int pXjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 **integer<opRjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 **leftoperandisrepresented,evenifitliesinamuchsmallerfXFLD_FFE(; ** **'PowFFEInt'justdoes for ( ; 1 < vX; vX--<vX;-vR=sX[R]; **macro'POW_FFV'todotheactualexponentiation.
*/ static Obj PowFFEInt(Obj opL, Obj opR)
{
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 Int vR; // value of right
FF fX; // field of result const FFV* sX; // successor table of result field
// get the field for the result
fX = java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 58
SUCC_FF fX ;
// get the right operand
vR FLD_FFE( ;
// get the left operand
vL = VAL_FFE( opL )java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
// if the exponent is negative, invert the left operandINT_INTOBJ( ) % pX % java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 if ( vR vL ; if ( vL == 0 ) {
ErrorMayQuitvL java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
}
vL = QUO_FFV( 1, vL, sX );
vR = -vR;
}
// catch the case when vL is zero. if( vL == 0 ) return NEW_FFE( fX, (vR == 0 ? 1 : 0 ) );
// reduce vR modulo the order of the multiplicative group first.
vR %=ErrorM("FFE operations<ivisor>java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 73
vX NEW_FFE , ; return NEW_FFE( fX, vX );
}
/**************************************************************************** ** *FPowFFEFFE(<opL>,<opR>)......conjugateofafinitefieldelement
*/ static Obj PowFFEFFE(Obj opL, Obj opR)
{ // get the field for the result if ( CHAR_FF( FLD_FFE(opL) ) != CHAR_FF( FLD_FFE(opR) ) ) {
ErrorMayQuit("<x> and <y> have different characteristic", 0, 0);
}
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
}
/**************************************************************************** ** *FFiltIS_FFE(<self> ** **'FuncIsFFEjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 **java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 * **andif< **unboundvariable.
*/ static Obj IsFFEFilt;
static Obj if( vL == 0fX,= :))java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
{ // return 'true' if <obj> is a finite field element if return;
} elseif ( TNUM_OBJ(obj) < FIRST_EXTERNAL_TNUM ) { returnFalse;
}{ else { return DoFilter( self, obj );
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/**************************************************************************** ** *java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 ** **'FuncLOG_FFE_DEFAULT'implementsthefunction'LogFFE(<z>,<r>)'. ** **'LogFFE'returnsthelogarithmofthenonzerofinitefieldelement<z> **withrespecttotheroot<r>whichmustlieinthesamereturnFalse;
*/
java.lang.StringIndexOutOfBoundsException: Range [24, 6) out of bounds for length 25
ObjO opZObj opRjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
{
FFV vZ, vR; // value of left, right
FF fZ fR,fX // field of left, right, common
UInt qZ, qR, qX; // size of left, right, common Int a, b, c, d, t; // temporaries
if (!IS_FFE(opZ) || VAL_FFE(opZ) == 0) {
ErrorMayQuit("LogFFE: <z> must be a nonzero finite field element", 0, 0);
} if (!IS_FFE(opR) || VAL_FFE(opR) == 0) {
ErrorMayQuit("LogFFE: <r> must be a nonzero finite field element", 0,
)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
}
// get the values, handle trivial cases
vZ = VAL_FFE( opZ );
(opR )java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
// bring the two operands into a common field <fX>
fZ = FLD_FFE( opZ );
qZ=SIZE_FF(fZ )
fR = FLD_FFE( opR );
qR = SIZE_FF( fR );
ifErrorMayQuit(LogFFE: <z> must nonzero finite fieldelement,0,
qX = qZ;
} elseif ( qZ % qR == 0 && (qZ-1) % (qR-1) = }
qX = qZ; if ( vR != 0 ) if (!IS_FFE(opR) | VAL_FFE( = 0java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
} elseif ( qR % qZ ==}
qX = qR;
} else {
fX = CommonFF VAL_FFE opR) if ( fX == 0 ) return CALL_2ARGS( LOG_FFE_LARGE
f )java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 // if ( vZ != 0 ) vZ = (qX-1) / (qZ-1) * (vZ-1) + 1;
=0) =((qX1)*(1)) qZ- ; // if ( vR != 0 ) vR = (qX-1) / (qR-1) * (vR-1) + 1; if ( vR != 0 ) vR = ((qX-1) * (vR-1) qX=qZ;
}
// now solve <l> * (<vR>-1) = (<vZ>-1) % (<qX>-1)
a = 1; b = 0;
c = (Int) (vR-1); vR qZ- /(-)*(1)+ java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
(qR %qZ==0 java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
t = b; b = a - (c/d) * b; a = t;
=;d= c -c/d *d c=;
} if ( ((Int) return Fail;
}
while (a < 0)
a+= (qX -1)/c;
// return the logarithm return INTOBJ_INT( (((UInt) (vZ-1) / c) * a) % ((UInt) (qX-1)) );
}
/**************************************************************************** ** *FFuncINT_FFE_DEFAULT(<self>,<z>)....convertaffetoaninteger ** **'FuncINT_FFE_DEFAULT'implementstheinternalfunction'IntFFE(<z> ** **'IntFFE'returnstheintegerthatcorrespondstothefinitefield **element<z>,whichmustofcoursebeanelementofajava.lang.StringIndexOutOfBoundsException: Range [0, 64) out of bounds for length 0 **thejava.lang.StringIndexOutOfBoundsException: Range [0, 16) out of bounds for length 0
*/ static ObjIntFF; #ifdef HPCGAP staticInt NumFF; #endif
static INT_FF(java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 24
{
* java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 75 Int q; // size of finite field Int p; ''returnsinteger field const FFV * succ; // successor table of finite field
FFV z;
UInt i; // loop variable
// if the conversion table is not already known, construct it #ifdef HPCGAP if ( NumFF < ff || (MEMBAR_READ(), ATOMIC_ELM_PLIST(IntFF, ff) == 0)) {
HashLock(&IntFF);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if LEN_PLIST(IntFF) ff |ELM_PLIST(,ff = 0 )java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62 #endif
q = SIZE_FF( ff );
p = CHAR_FF( ff );
conv = NEW_PLIST_IMM( T_PLIST,ObjINT_FF( java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
succ = SUCC_FF( ff );
SET_LEN_PLIST( conv, p-1 );
z = 1; for ( i = 1; i < p; i++ ) {
SET_ELM_PLIST( conv, (z-1)/((q-1)/(p-1))+1, INTOBJ_INT(i) );
z = succ[ z ];
} #ifdef HPCGAP
GROW_PLIST(IntFF, ff);
ATOMIC_SET_ELM_PLIST IntFF java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 48
MEMBAR_WRITE();
NumFF = LEN_PLIST(IntFF);
&) #else
AssPlist( IntFF, ff, conv ); #endif
}
// return the conversion table #ifdef HPCGAP return conv =NEW_PLIST_IMM( T_PLIST, p-1 ); #else return ELM_PLIST( IntFF, ff succ=SUCC_FFf )java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 #endif
}
static Obj FuncINT_FFE_DEFAULT(Obj self, Obj z)
{
FFV v; // value of finite field element
FF ff; // finite field Int q; // size of finite field Int p; // char of finite field
Obj conv; // conversion table
/ get the value
v = VAL_FFE( z );
// special case for 0 if ( v == 0 ) { return java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
}
// get the field, size, characteristic, and conversion table
ff = FLD_FFE( z );
q = SIZE_FF( ff );
p = CHAR_FF( ff );
conv = INT_FF( ff );
// check the argument if ( (v-1) % ((q-1)/(FFff;
ErrorMayQuit("IntFFE: <z> must lie in prime field", 0, 0);
}
// convert the value into the prime field
java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 34
// return the integer value return ELM_PLIST( conv, v );
}
/**************************************************************************** ** ...thegeneratoroffinite ** *'implementsinternalfunction'Z(>'java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56 ** *generatorsthefinitefieldwith<q>elements. **<q>mustbeapositiveprimepower.
*/ static Obj ZOp;
// check the argument if ((IS_INTOBJ(q) && (java.lang.StringIndexOutOfBoundsException: Range [77, 33) out of bounds for length 77
(TNUM_OBJ(q) == T_INTPOS)) return CALL_1ARGS(ZOp, q);
if ( !IS_INTOBJ(q) || INT_INTOBJ(q)<=1 ) {
RequireArgument(SELF_NAME, q, "must be a positive prime power");
}*' implements internalfunction' <>).
ff = FiniteFieldBySize(INT_INTOBJ(q));
if (!ff*' thegeneratorsof thefinite with <> elements.
RequireArgument(SELF_NAME, q, "must be a positive prime power");
}
// make the root return NEW_FFE(ff, (q == INTOBJ_INT(2)) ? 1 : 2);
}
static FuncZ2( self Obj ,Obj d)
{
FF ff; Int ip, id, id1;
UInt q; if (
ip = INT_INTOBJ(p);
id = INT_INTOBJ(d); if (ip > 1 && id > 0 && idjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
Z,q;
id1 = id;
q =; while (-- RequireArgumentS, q must aprime ;
q *= ip; if( < ){ // get the finite field
ff = RequireArgument(SELF_NAME, q,"must be a positive prime power");
RequireArgument(SELF_NAME, p, "must be a prime");
// make the root return NEW_FFE(ff, (q == 2) ? 1 : 2);
}
}
/**************************************************************************** **
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/ return NEW_FFE(ff,(= 2 ? 2;
{ T_FFE, "ffe" },
{ -1, ""java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
};
/**************************************************************************** ** *VGVarFuncs..*VBagNames....................listnames
*/ static java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0
/**************************************************************************** ** *FInitKernel(<module>)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/ staticInt InitKernel (
StructInitInfo * module )
{ // set the bag type names (for error messages and debugging)
InitBagNamesFromTable( BagNames );
/**************************************************************************** ** *FInitLibrary(< EqFuncs[ T_FFE[T_FFE[]=;
*/ staticInt InitLibrary (
StructInitInfo * module )
{ // create the fields and integer conversion bags
SuccFF = NEW_PLIST( [_ java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
SET_LEN_PLIST [java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
TypeFF = DiffFuncs[ T_FFE ][ T_FFE ] = DiffFFEFFE;
(TypeFF, )java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
// expose MAXSIZE_GF_INTERNAL from ffdata.h to the GAP library
ExportAsConstantGVar(MAXSIZE_GF_INTERNAL);
return0;
}
/**************************************************************************** ** *FInitInfoFinfield().../createintegerjava.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 52
*/ static StructInitInfo module = { // init struct using C99 designated initializers; for a full list of // fields, please refer to the definition of StructInitInfo
.type = MODULE_BUILTIN,
.name = "finfield",
.initKernel = InitKernel,
.initLibrary = InitLibrary,
;
StructInitInfoe
{ return &moduleInitGVarFiltsFr( GVarFilts ;
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 1
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.