3d-matrices
3d-matrices copied to clipboard
Typecases should be updated
Currently the MATN
function tries to be clever and construct one of MAT{2,3,4}
when it detects those dimensions.
This is ok by itself, however, the general versions of every (?) binary (?) operation (when the matrix is a MATN
) assume that the second operand will also be a MATN
, which won't be the case if you constructed your array using MATN
since it might give you a MAT{2,3,4}
instead.
As an example, the following will work if len
is 2 since both p
and q
will be of type MAT2
. However, it will fail if len
is 3 since then p
is a MATN
and q
is a MAT3
, and M*
doesn't handle this case.
(let* ((p (matn 2 len))
(q (matn len len)))
(m* p (minv q)))