]> gitweb.factorcode.org Git - factor.git/commit
math.matrices: fix/rename mnorm, update all norms
authorCat Stevens <catb0t@protonmail.ch>
Sun, 1 Mar 2020 02:46:38 +0000 (21:46 -0500)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 1 Mar 2020 03:31:28 +0000 (03:31 +0000)
commit573e4ed198584f17126549f708bd8426e93058be
treec3b7a62ef1802450a86888d131909b4de1a99034
parent2511fa72def02a9650e9f8bd2705ea762668170f
math.matrices: fix/rename mnorm, update all norms

closes #2244

- `mnorm` has been renamed to `normalize-matrix`
to reflect what it actually does, which
is normalize a matrix, not find a norm
of a matrix.

- `mnorm` is no longer a word defined here.

- bugfix: previously, `normalize-matrix` found
the supremum of a matrix (`mmax`),
before taking the supremum's absolute
value (`abs`) and dividing the matrix
by it (`m/n`).
for matrices containing only negative
values and 0, the supremum is 0, and
a `div-by-zero` error was thrown.

`normalize-matrix` has been fixed to
first `abs` all the matrix elements,
and then find the supremum and divide,

it also receieved a zero-matrix? guard
for optimization and preventing
`div-by-zero`.

- new alias: `hilbert-schmidt-norm` for
`frobenius-norm`,  to go along with
`math.matrices.extras.<hilbert-matrix>`
and improve searchability by physicists.

- new word: `matrix-p-norm`, written as an
analogue of `math.vectors.p-norm`.

- new word: `matrix-p-q-norm`, which generalizes
entrywise matrix norm over the L^p,q
vector space.

- new word: `matrix-p-norm-entrywise`:
`matrix-p-norm`'s fallback
for p =/= 1, 2, inf; analogue of
`math.vectors.p-norm-default`.

- all norm words have gotten new docs,
`zero-matrix?` guards as an optimisation,
and most have gotten new tests.
basis/math/matrices/matrices-docs.factor
basis/math/matrices/matrices-tests.factor
basis/math/matrices/matrices.factor
extra/math/matrices/extras/extras-docs.factor