19 SparseDistributedPolynomial
This file contains an implementation of polynomials in arbitrarily many variables
given by the domain V over an ring A. The representation of the power products is
given through the domain J.
The tests can be found in test/poly/distpoly.as.nw.
525⟨* 13⟩+
≡ ⊲505 535 ⊳
-------------------------------------------------------------------
----
---- Combinat
---- Copyright (C) Ralf Hemmecke <ralf@hemmecke.de>
---- svn co svn://svn.risc.uni-linz.ac.at/hemmecke/combinat/
----
-------------------------------------------------------------------
#include "combinat"
⟨dom: SparseDistributedPolynomial 526⟩
Type Constructor
SparseDistributedPolynomial
Usage
Description
Implements Polynomials in infinitely many variables.
This domain implements the polynomial domain A[x1,x2,x3,…] where each variable
xi has weight i.
526⟨dom: SparseDistributedPolynomial 526⟩≡ (525)
SparseDistributedPolynomial(
A: with {
zero?: % -> Boolean;
one?: % -> Boolean;
0: %;
1: %;
+: (%, %) -> %;
*: (%, %) -> %;
},
V: TotallyOrderedType, -- VariableType
J: with {
TotallyOrderedType;
1: %;
*: (%, %) -> %;
}-- == SparseIndexedPowerProduct(V, NonNegativeMachineInteger);
): with {
⟨exports: SparseDistributedPolynomial 527⟩
} == SparseFiniteMonoidRing(A, J) add {
Rep == SparseFiniteMonoidRing(A, J);
import from Rep, A, J;
⟨implementation: SparseDistributedPolynomial 528b⟩
}
Defines:
SparseDistributedPolynomial, used in chunks 55, 307, 626, 707, 710–17, 719, 721, 723,
725–27, 749, and 751.
Uses SparseFiniteMonoidRing 501, SparseIndexedPowerProduct 506,
and TotallyOrderedType 571.
Exports of SparseDistributedPolynomial
-
-
IndexedFreeArithmeticType(A, J);
-
-
coerce: A -> % Inclusion monomorphism.
-
-
coerce: J -> % Inclusion monomorphism.
-
-
*: (A, %) -> % Module multiplication by a coefficient.
-
-
if A has with {*: (Integer, %) -> %} then {
-
-
*: (Integer, %) -> % ℤ-module multiplication.
-
-
}
-
-
if A has with {*: (Fraction Integer, %) -> %} then {
-
-
*: (Fraction Integer, %) -> % ℚ-module multiplication.
-
-
}
528b⟨implementation: SparseDistributedPolynomial 528b⟩≡ (526) 529b ⊳
coerce(a: A): % == [a, 1$J];
529b⟨implementation: SparseDistributedPolynomial 528b⟩+
≡ (526) ⊲528b 530b ⊳
coerce(j: J): % == [1$A, j];
Export of SparseDistributedPolynomial
*: (A, %) -> %
Description
Module multiplication by a coefficient.
The call a*x for a: A and x: % is equivalent to (a :: %) * x.
530b⟨implementation: SparseDistributedPolynomial 528b⟩+
≡ (526) ⊲529b 532 ⊳
(a: A) * (x: %): % == {
zero? a => 0;
map((b: A): A +-> a*b)(x);
}
Export of SparseDistributedPolynomial
*: (Integer, %) -> %
Description
ℤ-module multiplication.
The call z*x for z: Integer and x: % is equivalent to multiplying every coefficient
of x by z.
531b⟨exports: SparseDistributedPolynomial 527⟩+
≡ (526) ⊲530a 533b ⊳
if A has with {*: (Integer, %) -> %} then {
⟨exports: SparseDistributedPolynomial: Z-module 531a⟩
}
Uses Integer 66.
531c⟨implementation: SparseDistributedPolynomial: Z-module 531c⟩≡ (532)
(z: Z) * (x: %): % == {
zero? z => 0;
map((a: A): A +-> z*a)(x);
}
Uses Z 47.
532⟨implementation: SparseDistributedPolynomial 528b⟩+
≡ (526) ⊲530b 534 ⊳
if A has with {*: (Integer, %) -> %} then {
⟨implementation: SparseDistributedPolynomial: Z-module 531c⟩
}
Uses Integer 66.
Export of SparseDistributedPolynomial
*: (Fraction Integer, %) -> %
Description
ℚ-module multiplication.
The call q*x for q: Fraction(Integer) and x: % is equivalent to multiplying every
coefficient of x with q.
533a⟨exports: SparseDistributedPolynomial: Q-module 533a⟩≡ (533b)
*: (Fraction Integer, %) -> %;
Uses Integer 66.
533b⟨exports: SparseDistributedPolynomial 527⟩+
≡ (526) ⊲531b
if A has with {*: (Fraction Integer, %) -> %} then {
⟨exports: SparseDistributedPolynomial: Q-module 533a⟩
}
Uses Integer 66.
533c⟨implementation: SparseDistributedPolynomial: Q-module 533c⟩≡ (534)
(q: Q) * (x: %): % == {
zero? q => 0;
map((a: A): A +-> q*a)(x);
}
Uses Q 47.
534⟨implementation: SparseDistributedPolynomial 528b⟩+
≡ (526) ⊲532
if A has with {*: (Fraction Integer, %) -> %} then {
⟨implementation: SparseDistributedPolynomial: Q-module 533c⟩
}
Uses Integer 66.