Commit Graph

1089 Commits (3db98706691d38f0d1c5d099ed990ae0c6eaa6ee)

Author SHA1 Message Date
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
John Benediktsson bd9676e152 core/basis/extra: use none?. 2018-02-14 11:56:31 -08:00
John Benediktsson ed92cb066b math.bitwise: add >signed to docs next to >even, >odd. 2018-01-23 15:37:21 -08:00
John Benediktsson b40ba26bac basis/extra: removing '[ @ ] in favor of _ for fried quotations. 2018-01-19 23:40:23 -08:00
John Benediktsson 3147593b2c math.combinatorics: make selections use change-nth-unsafe again. 2018-01-17 14:17:44 -08:00
John Benediktsson 1beaa8f494 math.combinatorics: fix selections bug, geez. 2018-01-17 13:59:22 -08:00
John Benediktsson 9d35cd9048 math.combinatorics: fix selections bug that went missing before previous commit. 2018-01-17 13:55:05 -08:00
John Benediktsson 3bf23d242d math.combinatorics: speed up selections word. 2018-01-17 10:36:12 -08:00
John Benediktsson 9a4441a80e math.combinatorics: remove memoize of factorial.
If lots of large factorials are computed could use too much memory.
2018-01-16 14:57:17 -08:00
Doug Coleman 9dbfc9351c math.functions: nan: -> NAN: oops 2017-12-28 00:43:51 -08:00
Doug Coleman 099549940a math.functions: disable a test. 2017-12-27 22:28:20 -08:00
John Benediktsson aa5623eede math: using ``v.`` instead of ``v* sum`` in a few places. 2017-10-24 12:26:39 -07:00
Alexander Iljin 504c9959a1 Update some copyright headers to follow the current convention
Had to look through the history to find years for some headers. Added
authors to some files as well.
2017-09-11 15:43:03 -07:00
Doug Coleman 27b3c4cccf functors: FUNCTOR: ;FUNCTOR -> <FUNCTOR: ;FUNCTOR>
Functors contain nested definitions, much like <PRIVATE PRIVATE> blocks.
A new parser will be able to parse nested definitions unambigiously without
knowledge of the definition of <FUNCTOR: itself, which is not the case if
it looks like FUNCTOR: instead.
2017-08-05 20:41:19 -05:00
Doug Coleman 0ac181c797 tools.test: Fix unit-test~ and a couple of tests. 2017-07-23 11:50:52 -05:00
Doug Coleman 49b01011c7 math.vectors.simd.intrinsics: Add a comment so I am not tempted to delete this word. 2017-07-23 11:44:01 -05:00
Doug Coleman 62129ffea4 basis: Add unit-test~ and unit-test-v~ for testing floats.
Use unit-test~ in math.functions in some places to make sure we like it.
2017-07-22 18:47:59 -05:00
Doug Coleman 01aab7c884 Factor: Rename <enum> to <enumerated> to not confuse with ENUM:s 2017-07-03 12:47:19 -07:00
John Benediktsson c503659a93 math.functions: fix another test impacted by float truncate change. 2017-06-10 13:33:01 -07:00
John Benediktsson 57de1f5ab0 math.functions: make -0.3 truncate return 0.0 instead of -0.0. 2017-06-08 11:27:48 -07:00
Jon Harper 80e9d7c115 move math.extras:round-to-even to math.functions to use in basis:formatting
Also add round-to-odd in case it is needed.
Also change float rounding to be independent of the current rounding mode
2017-06-08 11:23:37 -07:00