Linear Solver Helpers
Gentleman's Solver for Least Squares
Abstract Types
RLinearAlgebra.GentData
— TypeGentData{S, M<:Matrix{S}, V<:Vector{S}}
This is a preallocated data structure for solving least squares problems with Gentleman's algorithm. This data structure is not exported and thus is not designed to be manipulated by the user.
Fields
A::M
, the matrix to be solved.B::M
, the block of rows ofA
that are used to update the QR decomposition.R::UpperTriangular
, the upper triangular part ofB
.tab::SubArray
, the last column ofB
where the constant vector entries corresponding
to the rows of A
that were brought to B
are stored.
v::V
, a buffer vector that stores the scaling constants from the Householder reflections,
see LAPACK.geqrf!
in LinearAlgebra
for more information.
bsize::Int64
, the number of rows transported toB
at each iteration.
Calling Gent(A, bsize)
will allocate a B
matrix with the n + 1
columns and n + bsize + 1
rows where n is the number of columns of A. It also allocates a buffer vector v
with n + 1
entries. Finally, it allocates a view of the upper triangular part of B[1:n, 1:n]
and a view of the last column of B
.
Miller, Alan J. “Algorithm AS 274: Least Squares Routines to Supplement Those of Gentleman.” Journal of the Royal Statistical Society. Series C (Applied Statistics), vol. 41, no. 2, 1992, pp. 458–78. JSTOR, https://doi.org/10.2307/2347583.
Solver
RLinearAlgebra.gentleman!
— Functiongentleman!(G::GentData)
A function that updates the GenData
structure with the Gentleman's algorithm applied to a single row block of A
.
Inputs
G::GentData
, a data structure with the information to be updated
by an iteration of Gentlemans.
Output
The function will result in updates to the upper triangular part R
and the tab
vector of the GentData
structure.
LinearAlgebra.ldiv!
— Functionldiv!(x::AbstractVector, G::GentData, b::AbstractVector)
Function that takes the allocated GentData
structure to solve the least squares problem $\min_x \|A x-b\|_2^2$. The function overwrites x
with the solution.
RLinearAlgebra.copy_block_from_mat!
— FunctioncopyBlockFromMat!(B::AbstractMatrix, A::AbstractMatrix, b::AbstractVector, index::Union{UnitRange{Int64}, Vector{Int64}})
Function that updates matrix B
with the entries at indicies index
corresponding to the rows of the A
matrix and the entries of the b
constant vector of the linear system.
RLinearAlgebra.reset_gent!
— FunctionresetGent!(G::GentData)
Function that sets all the allocated memory of GentData
to zero.