If you use StructuredQR.jl in your work, please cite using the format given in CITATION.cff.
Whenever a matrix has a specific well-known structure, taking it into account for factorizations can help to save time and memory allocations. So that, this package has been made to exploit some specific structures of matrices that can be found in some applied problems to compute efficiently a QR factorisation of it.
Julia 1.8 and up.
pkg> add StructuredQR
pkg> test StructuredQRFirst of all, the QR factorizations presented here have been devised for full-rank overdetermined matrices. It means, for a matrix
This matrix
Depending on the type of A (and so far its structure as well), a specific QR-factorisation will be executed.
For a dense matrix (i.e. a matrix without any specific structure), qrH! is the function applying the QR-Factorization using Reflections of Householder. It can be used just as follows :
m = 10
n = 8
A = rand(m, n)
qrH!(A)The QR factorisation is computed inside of A, so its previous coefficients have been now replaced by those of A.
The QR-hat function qrhat! can be used instead whenever you have an AbstractMatrix in input.
m = 10
n = 8
A = rand(m, n)
qrhat!(A)For Block-Diagonal matrices defined with the BlockDiagonals.jl module already existing in Julia, QRblocdiag! can be used to exploit this specific structure.
using BlockDiagonals
A = BlockDiagonal([rand(4,4), rand(3,2)])
QRblocdiag!!(A)Just like for dense matrices, qrhat! can be used instead and will apply the suitable method for this structure.
using BlockDiagonals
A = BlockDiagonal([rand(4,4), rand(3,2)])
qrhat!(A)To treat the case of horizontally concatenated matrices, this module uses the structure of BlockArray from the module BlockArrays.jl but only the very particular case of a 1x2-Block-Matrix.
using BlockArrays
A = BlockArray(rand(6,5), [6], [2,3])
QRhcat!(A)Like the two previous cases, qrhat! can be used to apply the suitable method for horizontally concatenated matrices whenever the function has in input a Block-Array.
using BlockArrays
A = BlockArray(rand(6,5), [6], [2,3])
qrhat!(A)One of the relevant specific features of this package is that all of the functions available do not allocate additionnal memory. This feature is a real advantage to avoid some Out of Memory errors when you handle very large matrices.
A second convenient feature is the hat function devised in this package is here to apply the most suitable method for the structure of the input matrix. But if the user prefers to use directly the most appropriate function for their case, they can simply call the desired QR-factorization function.
Another feature is the QOperations.jl in which you have several linear operations using
In QOperations.jl, there is as well operations to solve some linear systems. The function qrsolve! solves the system
A = rand(10, 8)
b = rand(10)
qrsolve!(A, b)Besides, rsolve! solves the system
A = rand(10, 8)
b = rand(10)
qrhat!(A)
rdiv!(A, b)There is also a function that returns the factor
A = rand(10, 8)
qrhat!(A)
get_r(A)If you think you found a bug, feel free to open an issue. Focused suggestions and requests can also be opened as issues. Before opening a pull request, start an issue or a discussion on the topic, please.
If you want to ask a question not suited for a bug report, feel free to start a discussion here. This forum is for general discussion about this repository and the JuliaSmoothOptimizers organization, so questions about any of our packages are welcome.