Ralf Hemmecke
2007-03-19 14:19:53 UTC
Hello,
I should probably put that stuff into trunk, but before it gets
accidentially removed from my hard disk I want to archive it via the
mailing list.
With it one can easily print the series and structures without invoking
Axiom.
Compile with
trunk/combinat/src>aldor -fx -Y . -i ../include/ -l combinatd -lalgebrad
-laldord -DDEBUG speciestest.as
Ralf
---BEGIN speciestest.as
#include "combinat"
#include "aldorio"
macro {
V == CycleIndexVariable;
NonNegativeMachineInteger == MachineInteger;
T == SparseIndexedPowerProduct(V, NonNegativeMachineInteger);
P == SparseDistributedPolynomial(Q, V, T);
PrimePowerProduct == SparseIndexedPowerProduct(I, I);
I == MachineInteger;
Z == Integer;
Q == Fraction Integer;
E == SetSpecies;
}
t(S: (L: LabelType)->CombinatorialSpecies L): () == {
import from I, Z, P, S Z, Trace, List Z;
stdout << "=====================" << newline;
stdout << name(S Z) << newline;
stdout << "=====================" << newline;
for n: I in 0..5 repeat {
stdout << n << "---------------------------------------";
stdout << newline;
import from ExponentialGeneratingSeries;
import from OrdinaryGeneratingSeries;
egs := count(generatingSeries$S(Z), n);
ogs := count(isomorphismTypeGeneratingSeries$S(Z), n);
stdout << "-- count(egs, ogs)(" << n << ") = (";
stdout << egs << ", " << ogs << ")" << newline;
e: E(Z) := set [z for z: Z in 1..(n::Z)];
for k: I in 1.. for s in structures(e)$S(Z) repeat {
stdout << "structure " << n << "-" << k << ": ";
stdout << s << newline;
}
stdout << newline;
for k: I in 1.. for s in isomorphismTypes(e)$S(Z) repeat {
stdout << "isotype " << n << "-" << k << ": ";
stdout << s << newline;
}
stdout << newline << newline;
}
}
main(): () == {
macro {
CS == CombinatorialSpecies;
X == SingletonSpecies;
+ == Plus;
* == Times;
N == NonEmpty;
** == Compose;
}
--t(E);
--t(Subset);
--t(X * X);
t(E ** N(E));
t(N(E) ** N(E));
t(Partition);
--B(L: LabelType): CS L == Plus(X, Times(B,B))(L) add;
--t(B);
--t(Compose(B, N E));
}
main();
---END speciestest.as
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
I should probably put that stuff into trunk, but before it gets
accidentially removed from my hard disk I want to archive it via the
mailing list.
With it one can easily print the series and structures without invoking
Axiom.
Compile with
trunk/combinat/src>aldor -fx -Y . -i ../include/ -l combinatd -lalgebrad
-laldord -DDEBUG speciestest.as
Ralf
---BEGIN speciestest.as
#include "combinat"
#include "aldorio"
macro {
V == CycleIndexVariable;
NonNegativeMachineInteger == MachineInteger;
T == SparseIndexedPowerProduct(V, NonNegativeMachineInteger);
P == SparseDistributedPolynomial(Q, V, T);
PrimePowerProduct == SparseIndexedPowerProduct(I, I);
I == MachineInteger;
Z == Integer;
Q == Fraction Integer;
E == SetSpecies;
}
t(S: (L: LabelType)->CombinatorialSpecies L): () == {
import from I, Z, P, S Z, Trace, List Z;
stdout << "=====================" << newline;
stdout << name(S Z) << newline;
stdout << "=====================" << newline;
for n: I in 0..5 repeat {
stdout << n << "---------------------------------------";
stdout << newline;
import from ExponentialGeneratingSeries;
import from OrdinaryGeneratingSeries;
egs := count(generatingSeries$S(Z), n);
ogs := count(isomorphismTypeGeneratingSeries$S(Z), n);
stdout << "-- count(egs, ogs)(" << n << ") = (";
stdout << egs << ", " << ogs << ")" << newline;
e: E(Z) := set [z for z: Z in 1..(n::Z)];
for k: I in 1.. for s in structures(e)$S(Z) repeat {
stdout << "structure " << n << "-" << k << ": ";
stdout << s << newline;
}
stdout << newline;
for k: I in 1.. for s in isomorphismTypes(e)$S(Z) repeat {
stdout << "isotype " << n << "-" << k << ": ";
stdout << s << newline;
}
stdout << newline << newline;
}
}
main(): () == {
macro {
CS == CombinatorialSpecies;
X == SingletonSpecies;
+ == Plus;
* == Times;
N == NonEmpty;
** == Compose;
}
--t(E);
--t(Subset);
--t(X * X);
t(E ** N(E));
t(N(E) ** N(E));
t(Partition);
--B(L: LabelType): CS L == Plus(X, Times(B,B))(L) add;
--t(B);
--t(Compose(B, N E));
}
main();
---END speciestest.as
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV