diff options
Diffstat (limited to 'src/algebra/poly.spad.pamphlet')
-rw-r--r-- | src/algebra/poly.spad.pamphlet | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/algebra/poly.spad.pamphlet b/src/algebra/poly.spad.pamphlet index 9b641589..e0688ad4 100644 --- a/src/algebra/poly.spad.pamphlet +++ b/src/algebra/poly.spad.pamphlet @@ -27,7 +27,7 @@ ++ Each element can be expressed as a finite linear combination of ++ generators. Only non-zero terms are stored. -FreeModule(R:Ring,S:OrderedSet): +FreeModule(R:Ring,S:OrderedType): Join(BiModule(R,R),IndexedDirectProductCategory(R,S)) with if R has CommutativeRing then Module(R) == IndexedDirectProductAbelianGroup(R,S) add @@ -66,13 +66,14 @@ FreeModule(R:Ring,S:OrderedSet): --map(r*#1,x) [[u.k,a] for u in x | (a:=u.c*r) ~= 0$R] - coerce(x) : OutputForm == - null x => (0$R) :: OutputForm - le : List OutputForm := nil - for rec in reverse x repeat - rec.c = 1 => le := cons(rec.k :: OutputForm, le) - le := cons(rec.c :: OutputForm * rec.k :: OutputForm, le) - reduce("+",le) + if S has CoercibleTo OutputForm then + coerce(x) : OutputForm == + null x => (0$R) :: OutputForm + le : List OutputForm := nil + for rec in reverse x repeat + rec.c = 1 => le := cons(rec.k :: OutputForm, le) + le := cons(rec.c :: OutputForm * rec.k :: OutputForm, le) + reduce("+",le) @ \section{domain PR PolynomialRing} |