Aron Lee
Aron Lee

Reputation: 617

Vector Space plus Matrix as category

I try to understand what is category in Haskell with Vector Space. I draw a picture, can anyone review it for me. I'm not sure this is good/right picture for category.

enter image description here

Upvotes: 2

Views: 273

Answers (1)

leftaroundabout
leftaroundabout

Reputation: 120711

One thing that's perhaps not quite accurate in your picture: it's important that the objects are vector spaces (not vectors!), whereas the morphisms are matrices (I prefer to say, linear mappings. These are single entities at any rate, not “spaces of matrices”). And while matrices are themselves elements of vector spaces, a matrix is not a vector space but just a single vector. So, the “objects” bubbles should be changed to contain not matrices but sets of matrices. And, getting more into details: a linear mapping between spaces of 3×3 matrices would actually be a 9×9 matrix, not another 3×3 matrix (though it makes sense to see it as a (3×3)×(3×3) tensor).
Apart from that, great! I think the category vector spaces is a very good entry point to category theory.

This does however not directly relate to “what is category in Haskell”, except insofar as categories in Haskell also obey the category laws. If you just wanted to understand these laws by some example to grok categories in general and ultimately also use them in Haskell – fair.
But if you actually want to use particular categories such as Vectk themselves in Haskell, that's a bit more of a tricky story because what most people call “categories in Haskell” are actually way too weak: they require that all Haskell types can be objects. But most types can't sensibly be seen as vector spaces, so you need a more nuanced notion of category. This is provided by the subhask library or my own constrained-categories. Both have been used to implement the category of vector spaces:

http://hackage.haskell.org/package/subhask-0.1.1.0/docs/SubHask-Algebra-Vector.html http://hackage.haskell.org/package/linearmap-category-0.3.4.0/docs/Math-LinearMap-Category.html

Upvotes: 4

Related Questions