Code

Representation theory in algebraic statistics

Coming soon: a program to decompose certain polynomial rings using Schur-Weyl duality, with applications to algebraic statistics.


The cyclohedron test

Implementation of the cyclohedron test in R and a fast version in Python capable of handling hundreds of time points.


Simple sparse ring classes for Python and Haskell

pyring.py is a very simple but useful class to make dictionaries into rings (commutative or not). Just inherit ring_elt, pick an object as a key and implement + for it, or define a key_multiplication_function. For example, to make a multivariate polynomial ring (no pretty printing):

class polynomial_ring_elt(ring_elt):
    def key_multiplication_function(self,x,y):
        """
        Add the tuples as vectors of integers
        """
        return tuple(i+j for i,j in zip(x,y))

There is also a version for Haskell: MapRing.hs, as well as some examples. In this version, you define a semigroup and then use that as the keys, eg:

newtype Z2 = Z2 (Integer,Integer)
    deriving (Eq,Show,Ord)

instance Semigroup Z2 where
    semigroupOperation (Z2 (x,y)) (Z2 (z,w)) = Z2 (x+z,y+w)
    semigroupIdentity = Z2 (0,0)

x = singleMapRing 1 (Z2 (1,0))
y = singleMapRing 1 (Z2 (0,1))