elementsSquared =
map (\x -> x ^ 2)elementWiseDivision =
map2 (/)The identity matrix.
I = |1 0|
|0 1|
I*A = A = A*IConstruct a matrix from rows.
fromRows (1,2) (3,4) == ((1,2),(3,4))Construct a matrix from columns.
fromColumns (1,2) (3,4) == ((1,3),(2,4))Matrix addition.
|a b| |e f| |a+e b+f|
|c d| + |g h| = |c+g d+h|Matrix subtraction.
A - B
Matrix multiplication.
A*B
Element wise multiplication. Also called Hadamard product, Schur product or entrywise product.
|a b| |e f| |ae bf|
|c d| .* |g h| = |cg dh|a*A
Multiply a matrix by a constant
The transpose. Flips a matrix along it's diagonal.
|a b|T |a c|
|c d| = |b d|Matrix-vector multiplication.
|a b| |x| |ax+by|
A*v = |c d|*|y| = |cx+dy|This checks whether |A - B| < eps.
almostEqual eps a bThis is useful for testing, see the tests of this library for how this makes testing easy.
Since any definition of a norm can be used for this, it uses the simple maxNorm
The max norm. This is the biggest element of a matrix. Useful for fuzz testing.