The fix consists of three parts:
1. Rewriting `inline-matrix*'. The material change here is that the
expansion now contains only direct applications of `+' and `*'.
TR's optimizer replaces them with `unsafe-fx+' and `unsafe-fx*',
which keeps intermediate flonum values from being boxed.
2. Making the types of all functions that operate on (Matrix Number)
values more precise. Now TR can prove that matrix operations preserve
inexactness. For example, matrix-conjugate : (Matrix Flonum) ->
(Matrix Flonum) and three other cases for Real, Float-Complex, and
Number.
3. Changing the return types of some functions that used to return
things like (Matrix (U A 0)). Now that we worry about preserving
inexactness, we can't have `matrix-upper-triangle' always return a
matrix that contains exact zeros. It now accepts an optional `zero'
argument of type A.
* Gram-Schmidt using vector type
* QR decomposition
* Operator 1-norm and maximum norm; stub for 2-norm and angle between
subspaces (`matrix-basis-angle')
* `matrix-absolute-error' and `matrix-relative-error'; also predicates
based on them, such as `matrix-identity?'
* Lots of shuffling code about
* Types that can have contracts, and an exhaustive test to make sure
every value exported by `math/matrix' has a contract when used in
untyped code
* Some more tests (still needs some)
Cleaned up other docs in preparation for alpha-testing announcement
Created `math/utils' module for stuff that doesn't go anywhere else (e.g.
FFT scaling convention, max-math-threads parameters)
Reduced the number of macros that expand to applications of `array-map'
Added `flvector-sum', defined `flsum' in terms of it
Reduced the number of pointwise `flvector', `flarray' and `fcarray' operations
Reworked `inline-build-flvector' and `inline-flvector-map' to be faster and
expand to less code in both typed and untyped Racket
Redefined conversions like `list->flvector' in terms of for loops (can do
it now that TR has working `for/flvector:', etc.)
Fixed a few limit cases in some distributions (e.g. (uniform-dist 0 0) didn't
act like a delta distribution, (beta-dist 0 0) and (beta-dist +inf.0 +inf.0)
pretended to be defined by unique limits even though they can't be)
Made integer distributions' pdfs return +nan.0 when given non-integers
Added "private/statistics/counting.rkt", for hashing and binning samples
Added `flvector-sums' (cumulative sums with single rounding error)
Added `flinteger?', `flnan?' and `flrational?', which are faster than their
non-flonum counterparts (at least in Typed Racket; haven't tested untyped)
in the original GitHub fork:
https://github.com/ntoronto/racket
Some things about this are known to be broken (most egregious is that the
array tests DO NOT RUN because of a problem in typed/rackunit), about half
has no coverage in the tests, and half has no documentation. Fixes and
docs are coming. This is committed now to allow others to find errors and
inconsistency in the things that appear to be working, and to give the
author a (rather incomplete) sense of closure.