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.
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.
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.
"for matrix multiplication, even in relatively simple cases, every step can present more than 10^12 options." [1] Not sure if valid, but it's worth considering: what if we don't have the best matmul algorithm yet.
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.
[+] [-] ly3xqhl8g9|3 years ago|reply
https://web.archive.org/web/20230205025754/http://conal.net/...
[+] [-] layer8|3 years ago|reply
[+] [-] Koshkin|3 years ago|reply
[+] [-] ndriscoll|3 years ago|reply
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
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
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.
[+] [-] ly3xqhl8g9|3 years ago|reply
[1] https://www.quantamagazine.org/ai-reveals-new-possibilities-...
[+] [-] Yoric|3 years ago|reply
It's very different in programming, of course.
[+] [-] mmdski|3 years ago|reply
[+] [-] Koshkin|3 years ago|reply
There is also the overflow which is even more nasty than the zero-divide, because often it goes unnoticed.
[+] [-] naasking|3 years ago|reply
https://github.com/conal/talk-2012-reimagining-matrices
[+] [-] atan2|3 years ago|reply
[+] [-] LargoLasskhyfv|3 years ago|reply