top | item 34664826

Reimagining Matrices (2012)

32 points| g0xA52A2A | 3 years ago |conal.net | reply

33 comments

order
[+] Koshkin|3 years ago|reply
More specifically, this is about “reimagining matrices in the context of a pure functional language.” To be honest, as much as I appreciate the functional paradigm, I have been haunted by the impression that trying to apply it to some things makes them unnecessary complicated. Speaking of matrices, their “first principles” come from solving systems of linear equations; the (abstract) linear algebra reduces their role to being mere representations of linear maps in a given basis, which makes matrices look like some sort of technicality and thus hides their intrinsic beauty, complexity, and huge importance in their own right.
[+] ndriscoll|3 years ago|reply
How are matrices important in their own right besides as representations of linear maps (taking that to mean module homomorphisms)?

Funny enough a couple years back I implemented matrices as representations of linear maps for fun (I think I fixed the dimension to 3. I don't remember whether being generic on dimension makes it more complicated), and while that's not going to win any awards for performance, I found that it's the exact opposite of unnecessarily complicated: a "matrix" is just a way to "print"/serialize a function as an array of its values on a basis, addition is literally `f + g = x -> f(x) + g(x)` and multiplication is literally `f * g = x -> f(g(x))`. The code almost writes itself.

[+] fatneckbeard|3 years ago|reply
interesting that matrices are a kind of data structure in mathematics that has so many 'invalid' operations.

in the integers basically the only thing you can do to break arithmetic is 'divide by 0'

in matrices there are a lot more ways to do something resulting in an error.

there are ways to reimagine integers so that divide by zero is not an error. they are esoteric but they exist.

i wonder if they have done this for the matrix?

[+] chongli|3 years ago|reply
I think the key here is that matrices are a "higher-kinded" data structure. That is, they're parameterized not only by the shape (number of rows and columns) but also by the type of the elements themselves. Furthermore, the elements of a matrix need not be plain numbers (such as plain integers or floats) but can themselves be elements of any sort of ring, such as polynomials or even elements of a quotient ring.

Now, you may think a matrix whose elements are polynomials with coefficients that are integers modulo some prime p with the polynomial ring itself quotiented by some irreducible polynomial might be too bizarre and esoteric to be useful but in fact these structures do see a lot of use in cryptography.

[+] Yoric|3 years ago|reply
In mathematics, operations are basically sets. The fact that `n/0` is not defined... doesn't really make 0 or division special, so I don't suppose that anybody has seriously worked on that.

It's very different in programming, of course.

[+] Koshkin|3 years ago|reply
> basically the only thing

There is also the overflow which is even more nasty than the zero-divide, because often it goes unnoticed.