Haskell linear algebra libraries that are polymorphic with classes of kind * -


i want use linear algebra library netwire. because netwire's types instances of applicative, provides num , fractional instances types automagically lifta2 appropriate function. nice because can things multiply time-varying values without effort.

i've been using linear, functions defined polymorphic on non-* kind, ie matrix product:

(!*!) :: (functor m, foldable t, additive t, additive n, num a)     => m (t a) -> t (n a) -> m (n a) 

this means, if not mistaken, can't define instances additive , company, because there no sane form instance take. while can write

instance num b => num (wire s e m b) ... 

there no way write

instance additive n => additive (wire s e m (n x)) ... 

because (wire s e m (n x)) has wrong kind (* opposed * -> *). other libraries i've seen aren't polymorphic @ all.

what want know is, linear algebra libraries polymorphic on kind *?

i've looked @ vec, seems better. matrix multiply has type

(map v v' m1 m3, map v b v', transpose m2 b, fold v a, num v, num a)     => m1 -> m2 -> m3 

which want. there other libraries this?

there's vector-space, indeed in many ways more elegant libraries parameterised on scalars (vectorspace has field instead associated type synonym).

part of it's totally not based on free vector spaces linear is, means signature based on foldables wouldn't make sense in first place. (indeed, doesn't talk matrices @ all, linear mappings, the morphisms of category of vector spaces)

instance (additivegroup a) => additivegroup (wire a)   ...  instance (vectorspace v) => vectorspace (wire v)   type scalar (wire v) = scalar v  -- or perhaps `wire (scalar v)`   ... 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -