Module Core_bench.Linear_algebra
module Vec : sig ... end
Vectors
module Mat : sig ... end
Matrices
val qr : ?in_place:bool -> Mat.t -> Mat.t * Mat.t
qr A
returns the QR-decomposition ofA
as a pair (Q,R).A
must have at least as many rows as columns and have full rank.If
in_place
(default:false
) istrue
, thenA
is overwritten withQ
.
val triu_solve : Mat.t -> Vec.t -> Vec.t Core.Or_error.t
triu_solve R b
solves R x = b whereR
is an m x m upper-triangular matrix andb
is an m x 1 column vector.
val mul_mv : ?transa:bool -> Mat.t -> Vec.t -> Vec.t
mul_mv A x
computes the productA * x
(whereM
is a matrix andx
is a column vector).
val ols : ?in_place:bool -> Mat.t -> Vec.t -> Vec.t Core.Or_error.t
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
) istrue
, thenA
will be destroyed.