{"body":"I whipped up this in raku:\n\n  use Physics::Measure :ALL;\n\n  sub infix:<·> { dot-product @^a, @^b }\n\n  sub dot-product(@mx1, @mx2) {\n    die \"Incompatible dimensions for dot product.\"\n        unless @mx1 == @mx2[0] && @mx1[0] == @mx2;\n\n    [for ^@mx1 -> $i {\n        [for ^@mx1 -> $j {\n            [+] @mx1[$i;*] >>*<< @mx2[*;$j]\n        }]  \n    }]  \n  }\n\n  my @m = [[1m,2m],[3m,4m]]; \n\n  say @m · [Z] @m;    #[[5m^2 11m^2] [11m^2 25m^2]]\n\nSince Physics::Measure is strong on illegal combinations and since there are not many realistic random combinations of Units (s^2 anyone) I have not gone random for my example.","name":"","extension":"txt","url":"https://www.irccloud.com/pastebin/uDgZDgDY","modified":1732389796,"id":"uDgZDgDY","size":618,"lines":22,"own_paste":false,"theme":"","date":1732389796}