Commit Graph

11 Commits

Author SHA1 Message Date
Neil Toronto
c29c4056a1 Added back partial pivoting to Gaussian elimination 2013-01-01 12:12:07 -07:00
Neil Toronto
c8e3b45e38 Added QR decomposition tests (mostly a pretty thorough randomized test);
fixed error in `matrix-cols-orthogonal?' revealed by testing
2012-12-31 15:20:25 -07:00
Neil Toronto
f5fa93572d Moar `math/matrix' review/refactoring
* 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)
2012-12-31 14:17:17 -07:00
Neil Toronto
7ac8e1bbce Slightly more `math/matrix'
* Moved to-do list in "matrix-operations.rkt" to the wiki

* Added more mutating vector ops

* Added "matrix-basis.rkt" (unfinished)
2012-12-27 17:30:04 -07:00
Neil Toronto
fc02d40a66 Faster LU decomposition 2012-12-27 17:30:03 -07:00
Neil Toronto
1aebd171c5 Moar matrix review/refactoring
* Consolidated Gauss and Gauss-Jordan elimination

* Fixed Gaussian elimination to return all indexes for pivotless columns,
  not just those < m

* Consolidated `matrix-row-echelon' and `matrix-reduced-row-echelon'

* Specialized row reduction for determinants; removed option to not do
  partial pivoting (it's never necessary otherwise)

* Added `matrix-invertible?'

* Removed `matrix-solve-many'; now `matrix-solve' solves for multiple
  columns

* Gave `matrix-inverse' and `matrix-solve' optional failure thunk arguments

* Made some functions that return multiple columns return arrays instead
  (i.e. `matrix-column-space')

* Added more tests
2012-12-21 22:59:59 -07:00
Neil Toronto
3bc4c1ffdc More efficient Gaussian elimination using vectors of vectors (non-strict
arrays can't help an inherently sequential algorithm)
2012-12-21 22:59:59 -07:00
Neil Toronto
8d5a069d41 Moar `math/matrix' review/refactoring
* Split "matrix-constructors.rkt" into three parts:
 * "matrix-constructors.rkt"
 * "matrix-conversion.rkt"
 * "matrix-syntax.rkt"

* Made `matrix-map' automatically inline (it's dirt simple)

* Renamed a few things, changed some type signatures

* Fixed error in `matrix-dot' caught by testing (it was broadcasting)

* Rewrote matrix comprehensions in terms of array comprehensions

* Removed `in-column' and `in-row' (can use `in-array', `matrix-col' and
  `matrix-row')

* Tons of new rackunit tests: only "matrix-2d.rkt" and
  "matrix-operations.rkt" are left (though the latter is large)
2012-12-20 17:32:16 -07:00
Neil Toronto
155ec7dc41 Reviewing and refactoring `math/matrix', part 1
* Finally added `array-axis-expand' as a dual for `array-axis-reduce'
  in order to implement `vandermonde-matrix' elegantly

* Better, shorter matrix multiply; reworked all matrix arithmetic

* Split "matrix-operations.rkt" into at least 5 parts:
 * "matrix-operations.rkt"
 * "matrix-basic.rkt"
 * "matrix-comprehension.rkt"
 * "matrix-sequences.rkt"
 * "matrix-column.rkt"

Added "matrix-constructors.rkt"

Added `matrix', `row-matrix', and `col-matrix' macros

A lot of other little changes

Currently, `in-row' and `in-column' are broken. I intend to implement
them in a way that makes them work in untyped and Typed Racket.
2012-12-20 17:32:16 -07:00
Jens Axel Søgaard
bbef490fb0 Fixed missing import for curry 2012-11-17 21:02:36 -09:00
Neil Toronto
f2dc2027f6 Initial math library commit. The history for these changes is preserved
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.
2012-11-16 11:39:51 -07:00