<> <> DIRECTORY Rope USING [ROPE], Ascii, IO USING [STREAM], AlgebraClasses, Variables; DistribPolys: CEDAR DEFINITIONS IMPORTS Ascii = BEGIN OPEN AC: AlgebraClasses, VARS: Variables; <> DPolynomial: TYPE = LIST OF DTerm; -- Distributed rep DTerm: TYPE = RECORD [ coefficient: REF, degreeVector: DegreeVector ]; ZeroDPoly: DPolynomial = NIL; DegreeVector: TYPE = LIST OF CARDINAL; <> RatPolynomialFirstChar: PROC [c: CHAR] RETURNS [BOOL] ~ INLINE { RETURN[Ascii.Digit[c] OR Ascii.Letter[c] OR c='- OR c='+] }; TermCharProc: TYPE = PROC [char: CHAR] RETURNS [BOOL]; DollarProc: TermCharProc; -- RETURN[char='$] RightBracketProc: TermCharProc; -- RETURN[char='] OR char=')] DollarRope: Rope.ROPE; -- " $" ReadDPoly: PROC [in: IO.STREAM, V: VARS.VariableSeq, coeffRing: AC.Structure, termCharProc: TermCharProc _ DollarProc] RETURNS [poly: DPolynomial, termChar: CHAR]; <> DPolyFromRope: PROC [in: Rope.ROPE, V: VARS.VariableSeq, coeffRing: AC.Structure, termCharProc: TermCharProc _ DollarProc] RETURNS [out: DPolynomial]; DPolyToRope: PROC [in: DPolynomial, V: VARS.VariableSeq, coeffRing: AC.Structure, termRope: Rope.ROPE _ DollarRope] RETURNS [out: Rope.ROPE]; <> WriteDPoly: PROC [in: DPolynomial, V: VARS.VariableSeq, coeffRing: AC.Structure, out: IO.STREAM, termRope: Rope.ROPE _ DollarRope]; DPReverse: PROC [list: DPolynomial] RETURNS[val: DPolynomial]; <> DVInsertVariablePower: PROC [varIndex, exponent: CARDINAL, inDegreeVec: DegreeVector] RETURNS [ok: BOOL, outDegreeVec: DegreeVector]; DVCompare: PROC [dv1, dv2: DegreeVector] RETURNS [ [-1..1] ]; DVDegree: PROC [degreeVec: DegreeVector, numVars: CARDINAL] RETURNS [degree: CARDINAL]; DVRemoveMainVariablePower: PROC [in: DegreeVector, numVars: CARDINAL] RETURNS [out: DegreeVector]; DVAddMainVariablePower: PROC [in: DegreeVector, varIndex, exponent: CARDINAL] RETURNS [out: DegreeVector]; DVCons4: PROC [x1, x2, x3, x4: CARDINAL, degreeVec: DegreeVector] RETURNS [DegreeVector]; DVNconc: PROC [l1, l2: DegreeVector] RETURNS [DegreeVector]; DVReverse: PROC [list: DegreeVector] RETURNS[val: DegreeVector]; END.