diff options
author | dos-reis <gdr@axiomatics.org> | 2010-06-30 02:10:11 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2010-06-30 02:10:11 +0000 |
commit | 4b6d9e4b6f9438b4268ed1230b23d1d83ad8aff3 (patch) | |
tree | 53780ec8d4d29b20fae29b27548405604eece847 /src/algebra/poly.spad.pamphlet | |
parent | a55bfb825d07c51e240a73dd46292ea4ed181f67 (diff) | |
download | open-axiom-4b6d9e4b6f9438b4268ed1230b23d1d83ad8aff3.tar.gz |
More cleanups
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} |