https://en.wikipedia.org/wiki/Cracovian
The Cracovian product of two matrices, say A and B, is defined by
A ∧ B = BT A,
where BT and A are assumed compatible for the common (Cayley) type of matrix multiplication and BT is the transpose of B.
Since (AB)T = BT AT, the products (A ∧ B) ∧ C and A ∧ (B ∧ C) will generally be different; thus, Cracovian multiplication is non-associative.
A good reference how to use them and why they are useful is here (pdf):
https://archive.computerhistory.org/resources/access/text/20...
Matrices come with the matrix product defined over them.
This is one of four possible closed first order tensor contractions for an order two tensor, viz. AijBik AijBki AijBjk AijBkj. Only the third is applicable to matrices, all other contractions only work for general tensors without transposition.
What we deal with in computer science are actually n dimensional arrays since we don't have the co and contravariant indices that define tensors in physics.
The thing described by the article can be summarized by: "Any time you see A x B, you replace it with A x B^T" and it would, in practice, be exactly the same. I'm not sure the author understood this because then then go on to do a bunch of performance checks to see if there is any difference between the two. Which there isn't, because under the hood it is the exact same operations. They just multiple columns into columns (or rows into rows) instead of rows into columns. But the implicit transpose would undo that.
You can note (correctly) that this doesn't line up with the precise, but arbitrary traditional definition of a matrix, and that is correct. But that is just word games because you can very simply, using only syntax and no calculations, transform one into the other.
Old texts got really worked up whether a vector was a row or column. The programming language APL resolved this quite nicely: A scalar has no dimensions, a vector has its length as its one dimension, ... Arbitrary rank objects all played nicely with each other, in this system.
A Cracovian is a character or two's difference in APL code. There's a benign form of mental illness learning anything, where one clutches onto something novel and obsesses over it, rather than asking "That was exciting! What novel idea will I learn in the next five minutes?" I have friends from my working class high school who still say "ASSUME makes an ask of you and me" as if they just heard it for the first time, while the most successful mathematicians that I know keep moving like sharks.
I wouldn't stall too long thinking about Cracovians, as amusing a skim as the post provided.
That's very specific of Python. A few years ago we were multiplying a lot of matrices in Fortran and we tried to transpose one of the matrices before the multiplication. With -o0 it was a huge difference because the calculation used contiguous numbers and was more chache friendly. Anyway, with -o3 the compiler made some trick that made the difference disappear, but I never tried to understand what the compiler was doing.
There was a claim near the top that some things are easier to compute when viewed as cracovians. then some explanation, then suddently it switches to numpy and showing the time is the same.
New title: "Cracovians are a Waste of (the Reader's) Time"?
kubb•5mo ago
Am I the only one for whom this crucial explanation didn’t click? Admittedly, I might be stupid.
Wikipedia is a bit more understandable: „The Cracovian product of two matrices, say A and B, is defined by A ∧ B = (B^T)A
tempodox•5mo ago
tgv•5mo ago
But in another link I found that it's column by column multiplication. So A × B = C, then C[i][j] = sum(A[k][i] * B[k][j]). Unfortunately, the example doesn't match that definition...
burnished•5mo ago
kubb•5mo ago
AdamH12113•5mo ago
andrewla•5mo ago
Better I think would be to say "the result in column i and row j is the sum of product of elements in column i of the left cracovian and column j of the right cracovian".
And even by this definition the example given doesn't seem to track (and the strangeness of sometimes saying "+" and sometimes not, and having both "0" and "-0" in the example is bananas!):
mci•5mo ago
pomian•5mo ago
pomian•5mo ago
mci•5mo ago