For matrix addition and subtraction all matrices must have the same shape.
For matrix product the number of columns of one matrix must equal the number of rows in the following matrix.
(array #[#[6 8] #[10 12]])
(array #[#[-4 -4] #[-4 -4]])
(array #[#[33 36 39] #[75 82 89]])
(array #[#[354224848179261915075] #[218922995834555169026]])
(array #[#[354224848179261915075] #[218922995834555169026]])
(array #[#[2 4] #[6 8]])
(mutable-array
#[#[7 8 14 16]
#[9 10 18 20]
#[21 24 28 32]
#[27 30 36 40]
#[35 40 42 48]
#[45 50 54 60]])
Added in version 1.2 of package math-lib.
procedure
( matrix-map fM)→(Matrix R)
(array #[#[1 4] #[9 16]])
(array #[#[6 8] #[10 12]])
See matrix-relative-error and matrix-absolute-error for equality testing that is tolerant to floating-point error.