A module internal to Core_bench
. Please look at [root:Bench].
Some basic linear algebra code, so that basic operations can be done without introducing a dependency on Lacaml/LAPACK. Currently only has the minimum needed to do ordinary least squares.
Matrices are represented via float array array
, in row-major order.
ols A b
computes the ordinary least-squares solution to A x = b. A
must have at
least as many rows as columns and have full rank.
This can be used to compute solutions to non-singular square systems, but is somewhat sub-optimal for that purpose. The algorithm is to factor A = Q * R and solve R x = Q' b where Q' denotes the transpose of Q.
If in_place
(default: false
) is true
, then A
will be destroyed.