Commit Graph

1109 Commits (14b1418f6a0c76397d0030c548408c56b4031163)

Author SHA1 Message Date
John Benediktsson 05796cb497 math.bitwise: some docs cleanup. 2020-05-02 07:43:39 -07:00
Doug Coleman 94c6c8e5db math.bitwise: Add some more docs to find bits form >signed. 2020-05-01 22:49:14 -05:00
Doug Coleman c21608b0a0 math.bitwise: Add an in-order bitfield word called bitfield*. 2020-05-01 22:48:48 -05:00
Doug Coleman e6b546c358 math.bitwise: Fix shift "right" to shift "left" for bitfield.
This word was really hard to understand so I reworked the docs and added another example.
2020-04-18 19:46:29 -05:00
John Benediktsson de3b74d1c6 basis/extra: move fewer things. 2020-04-01 21:37:28 -07:00
John Benediktsson 42cf41e616 Revert "basis: Move any vocabularies required by basis into basis."
This reverts commit 59c2956570.
2020-04-01 21:37:28 -07:00
Doug Coleman 59c2956570 basis: Move any vocabularies required by basis into basis. 2020-03-28 09:30:37 -05:00
John Benediktsson a8d35345c4 extra: moving hash-sets.numbers, hashtables.numbers to basis. 2020-03-01 20:50:58 -08:00
Cat Stevens 573e4ed198 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.
2020-03-01 03:31:28 +00:00
John Benediktsson 43b82b03ad math.vectors: rename "h." to "hdot" 2020-02-26 13:06:52 -08:00
John Benediktsson da5d010c5b math.vectors.simd: fix typo in simd vdot intrinsic. 2020-02-26 12:56:52 -08:00
John Benediktsson 07a5912afa math.matrices: rename m./m.v/v.m to mdot/mdotv/vdotm. 2020-02-26 12:51:04 -08:00
John Benediktsson 1c5d417100 math.vectors: rename "v." to "vdot" 2020-02-26 12:40:16 -08:00
John Benediktsson 2cbcacad88 core/basis/extra: update some tags.txt. 2020-02-26 10:57:08 -08:00
John Benediktsson 2e5cec428a help.markup: adding a $slots word to document slots, use it. 2020-02-16 22:36:19 -08:00
John Benediktsson 38bfcd4bf1 help: add more bold table headings. 2020-02-13 15:18:43 -08:00
John Benediktsson dfc4901857 math.statistics: adding interquartile-range, midhinge, and fivenum. 2020-02-06 11:40:53 -08:00
John Benediktsson dfdbde9f33 math.matrices: use any? and all? directly in tests. 2020-01-28 20:44:19 -08:00
John Benediktsson 464f0a11ef math.matrices: update using on tests. 2020-01-28 20:38:43 -08:00
John Benediktsson 548109bf4b math: use sorted-histogram values in a few places. 2020-01-28 16:21:33 -08:00
Cat Stevens 4350bcbfcd math.matrices: rewrite, modernize and overhaul
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
2019-12-08 08:08:54 -08:00
John Benediktsson 388dc83efd math.primes.factors: flush in unix-factor. 2019-11-06 20:12:55 -08:00
John Benediktsson 6492f1c9cb math.floats.half: improve the roundtrip of subnormal float16. 2019-11-06 19:40:37 -08:00
John Benediktsson da64b05e6d math.functions: adding e^-1.
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 )
2019-11-05 10:19:32 -08:00
John Benediktsson e256a4ba18 math.intervals: workaround possible compiler bug by widening interval-bitor.
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.
2019-10-31 10:45:54 -07:00
John Benediktsson f68df75b84 math.intervals: simplify interval-bitand. 2019-10-31 10:45:36 -07:00
John Benediktsson 52123559f3 math.partial-dispatch: simplify using fry. 2019-10-31 10:27:29 -07:00
John Benediktsson bccdb5419b math.intervals: improve interval-bitand. 2019-10-31 10:27:17 -07:00
John Benediktsson 20c4e2feaa math.intervals: remove extra non-interval tests. 2019-10-30 09:47:04 -07:00
timor 30f2d6e78f math.intervals.tests: clean up literal syntax 2019-10-30 09:44:39 -07:00
timor 449224878f math.intervals: more exact interval-bitxor operation
- fixed: `interval-bitxor` caused bit-growth
- improved: `interval-bitxor` more exact case for negative intervals
2019-10-30 09:44:23 -07:00
timor 713cfa79f8 math.intervals: more exact interval-bitor operation
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.
2019-10-30 09:43:44 -07:00
John Benediktsson 522d176762 math.vectors: use $sequence in docs. 2019-10-24 20:38:05 -07:00
John Benediktsson cb091281bb math.floats.env: use $sequence in docs. 2019-10-24 13:54:58 -07:00
timor 14d75bbbcb math.intervals: Consistent handling of special intervals
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.
2019-09-09 14:09:57 -07:00
Alexander Iljin 0007789795 continuations[-docs]: add the finally word 2019-04-22 21:57:51 -07:00
Doug Coleman 3f0ff53369 math.functions: add logit function and a test.
sigmoid is known as expit in scipy
2019-02-24 11:15:58 -06:00
Doug Coleman 4b614cc15b factor: Make source files/resources 644 instead of 755. 2018-07-13 20:36:50 -05:00
Doug Coleman 4e9d383fe5 docs: Fix help-lint-all mistakes. 2018-07-07 01:13:19 -05:00
Doug Coleman 0e51880199 math.matrices: Add some more matrix norms. 2018-07-04 16:14:44 -05:00
Doug Coleman 9f213f96f6 core: Add the shuffler words but without primitives.
The nipd branch slowed bootstrap by a minute, this patch does not.

sorry about changing the fjsc line endings...
2018-06-19 22:52:58 -05:00
Cat Stevens 358eb29357 math.functions docs: add logn to "powers and logarithms" article
logn function was omitted from the subsections in "powers and logarithms"
2018-06-03 13:42:18 -07:00
John Benediktsson 9b2eac2942 math.functions: one line logn 2018-03-22 15:19:14 -07:00
Cat Stevens 4c96c9343c basis/math: add logn to math.functions (fix #1981) 2018-03-22 15:11:45 -07:00
John Benediktsson 607de53ad3 more test IN: cleanup. 2018-02-25 15:44:16 -08:00
Björn Lindqvist 3b36e969b2 math.statistics: the sample and population mean is the same
Afaik, the mean word works both for population data and for
samples. Which is different from standard deviations, where you have
different formulas for population and sample std.
2018-02-24 23:11:22 +01:00
Björn Lindqvist 97d9cee732 math.matrices: rename for consistency
Getting the sample cov matrix is actually much more common than getting
the population one.
2018-02-24 23:11:22 +01:00
John Benediktsson 42b37dcc8a fix some tests broken by previous commit. 2018-02-15 13:16:39 -08:00
John Benediktsson ca03896d74 more test IN: cleanup. 2018-02-15 09:20:01 -08:00
John Benediktsson 4a144e5ea7 more test IN: cleanup. 2018-02-15 08:45:08 -08:00