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.
math.matrices.elimination: move to extra
math.matrices.extras: expand with esoteric, less-used and unfinished code from basis
- math.matrices and .extras receive more words, tests, and docs
- matrix has become a predicate class
- 94% of matrices words have complete docs
- 77% of matrices.extras words have complete docs
- much more consistent naming for constructors etc
- added missing words / features such as main-diagonal and anti-transpose
- optimizations
- lots of documentation
This is for calculating e^x-1 for small values more accurately. You can also
call expm1(x) function if you want, and it's available on your platform.
FUNCTION: double expm1 ( double x )
IN: scratchpad [
{ byte-array } declare
[ 0 alien-unsigned-4 32 shift ]
[ 4 alien-unsigned-4 ] bi bitor
64 >signed
] optimized.
! working
[
dup >R 0 alien-unsigned-4 32 fixnum-shift
R> 4 alien-unsigned-4 over tag 0 eq?
[ fixnum-bitor ] [ fixnum>bignum bignum-bitor ] if
18446744073709551615 >R >bignum R> bignum-bitand
dup 63 bignum-bit? [ 18446744073709551616 bignum- ] [ ] if
]
! broken
[
dup >R 0 alien-unsigned-4 32 fixnum-shift
R> 4 alien-unsigned-4 over tag 0 eq?
[ fixnum-bitor ] [ fixnum>bignum bignum-bitor ] if
dup 63 bignum-bit? [ 18446744073709551616 bignum- ] [ ] if
]
The second case correctly eliminates the bitand but incorrectly assumes
that the item on the stack (which is an integer -- either a fixnum or a
bignum), was converted to a bignum.
Addresses #2170
- fixed: `interval-bitor` caused bit-growth
- improved: `interval-bitor` more exact about lower bounds
The added utility words could be used as a basis to make the other bitwise
interval operations more exact also.
Make both `empty-interval` and `full-interval` singletons, use generic functions
and methods where they are special-cased.
All words which work with interval points should also now work with the special
intervals.