Skip to content

Commit

Permalink
Merge pull request #40 from amontoison/master
Browse files Browse the repository at this point in the history
Improve LinearAlgebra docstrings
  • Loading branch information
mtanneau authored Feb 28, 2020
2 parents 820213e + 574fb86 commit 99fdc5a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions docs/src/manual/linear_systems.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ Here is a list of currently supported linear solvers:
| Linear solver type | `Tv` | System | `LSBackend` | Method |
|:-------------------|:----:|:------:|:-------:|:-------|
| [`DenseLinearSolver`](@ref) | `Real` | `NormalEquations` | `Lapack` | Cholesky
| [`SparseIndefLinearSolver`](@ref) | `Float64` | `AugmentedSystem` | `Cholmod` | LDL
| [`SparseIndefLinearSolver`](@ref) | `Float64` | `AugmentedSystem` | `Cholmod` | LDLᵀ
| [`SparsePosDefLinearSolver`](@ref) | `Float64` | `NormalEquations` | `Cholmod` | Cholesky
| [`LDLFLinearSolver`](@ref) | `Real` | `AugmentedSystem` | `LDLFact` | LDL
| [`LDLFLinearSolver`](@ref) | `Real` | `AugmentedSystem` | `LDLFact` | LDLᵀ

### Default options
If no option is specified, then the linear solver is chosen as follows:
Expand Down
14 changes: 7 additions & 7 deletions src/LinearAlgebra/LinearSolvers/LinearSolvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Abstract container for solving an augmented system
```
[-(Θ^{-1} + Rp) A'] [dx] = [ξd]
[ A Rd] [dy] = [ξp]
[-(Θ⁻¹ + Rp) Aᵀ] [dx] = [ξd]
[ A Rd] [dy] [ξp]
```
where `ξd` and `ξp` are given right-hand side.
"""
Expand Down Expand Up @@ -68,8 +68,8 @@ Update internal data, and re-compute factorization/pre-conditioner.
After this call, `ls` can be used to solve the augmented system
```
[-(Θ^{-1} + Rp) A'] [dx] = [ξd]
[ A Rd] [dy] = [ξp]
[-(Θ⁻¹ + Rp) Aᵀ] [dx] = [ξd]
[ A Rd] [dy] [ξp]
```
for given right-hand sides `ξd` and `ξp`.
"""
Expand All @@ -81,8 +81,8 @@ function update_linear_solver! end
Solve the symmetric quasi-definite augmented system
```
[-(Θ^{-1} + Rp) A'] [dx] = [ξd]
[ A Rd] [dy] = [ξp]
[-(Θ⁻¹ + Rp) Aᵀ] [dx] = [ξd]
[ A Rd] [dy] [ξp]
```
and over-write `dx`, `dy` with the result.
Expand Down Expand Up @@ -118,4 +118,4 @@ AbstractLinearSolver(
::DefaultBackend,
::DefaultSystem,
A::AbstractMatrix{Tv}
) where{Tv<:Real} = AbstractLinearSolver(LDLFact(), AugmentedSystem(), A)
) where{Tv<:Real} = AbstractLinearSolver(LDLFact(), AugmentedSystem(), A)
18 changes: 9 additions & 9 deletions src/LinearAlgebra/LinearSolvers/cholmod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Use CHOLMOD backend.
Options available:
* `Float64` only
* Augmented system with LDL factorization
* Augmented system with LDLᵀ factorization
* Normal equations with Cholesky factorization
"""
struct Cholmod <: LSBackend end
Expand All @@ -22,7 +22,7 @@ struct Cholmod <: LSBackend end
Linear solver for the 2x2 augmented system with ``A`` sparse.
Uses an LDLt factorization of the quasi-definite augmented system.
Uses an LDLᵀ factorization of the quasi-definite augmented system.
"""
mutable struct SparseIndefLinearSolver <: AbstractLinearSolver{Float64}
m::Int # Number of rows
Expand Down Expand Up @@ -84,7 +84,7 @@ linear_system(::SparseIndefLinearSolver) = "Augmented system"
"""
update_linear_solver!(ls, θ, regP, regD)
Update LDLt factorization of the augmented system.
Update LDLᵀ factorization of the augmented system.
Update diagonal scaling ``\\theta``, primal-dual regularizations, and re-compute
the factorization.
Expand Down Expand Up @@ -179,16 +179,16 @@ end
SparsePosDefLinearSolver
Linear solver for the 2x2 augmented system
```math
[-(Θ^{-1} + Rp) A'] [dx] = [xi_d]
[ A Rd] [dy] = [xi_p]
```
[-(Θ⁻¹ + Rp) Aᵀ] [dx] = [xi_d]
[ A Rd] [dy] [xi_p]
```
with ``A`` sparse.
Uses a Cholesky factorization of the positive definite normal equations system
```
(A*(Θ^{-1} + Rp)^{-1}*A' + Rd) dy = xi_p + A*(Θ^{-1} + Rp)^{-1}*xi_d
dx = (Θ^{-1} + Rp)^{-1} * (A' dy - xi_d)
(A * ((Θ⁻¹ + Rp)⁻¹ * Aᵀ + Rd) dy = xi_p + A * (θ⁻¹ + Rp)⁻¹ * xi_d
dx = (Θ⁻¹ + Rp)⁻¹ * (Aᵀ * dy - xi_d)
```
"""
mutable struct SparsePosDefLinearSolver <: AbstractLinearSolver{Float64}
Expand Down Expand Up @@ -307,4 +307,4 @@ function solve_augmented_system!(


return nothing
end
end
6 changes: 3 additions & 3 deletions src/LinearAlgebra/LinearSolvers/lapack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ struct Lapack <: LSBackend end
Linear solver for the 2x2 augmented system
```
[-(Θ^{-1} + Rp) A'] [dx] = [xi_d]
[ A Rd] [dy] = [xi_p]
[-(Θ⁻¹ + Rp) Aᵀ] [dx] = [xi_d]
[ A Rd] [dy] [xi_p]
```
with ``A`` dense.
Expand Down Expand Up @@ -214,4 +214,4 @@ function solve_augmented_system!(

# TODO: Iterative refinement
return nothing
end
end
6 changes: 3 additions & 3 deletions src/LinearAlgebra/LinearSolvers/ldlfact.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Use LDLFactorizations backend.
Options available:
* Any numerical type `T`
* Augmented system with LDL factorization
* Augmented system with LDLᵀ factorization
"""
struct LDLFact <: LSBackend end

Expand All @@ -22,7 +22,7 @@ struct LDLFact <: LSBackend end
Linear solver for the 2x2 augmented system with ``A`` sparse.
Uses LDLFactorizations.jl to compute an LDLt factorization of the quasi-definite augmented system.
Uses LDLFactorizations.jl to compute an LDLᵀ factorization of the quasi-definite augmented system.
"""
mutable struct LDLFLinearSolver{Tv<:Real} <: AbstractLinearSolver{Tv}
m::Int # Number of rows
Expand Down Expand Up @@ -69,7 +69,7 @@ linear_system(::LDLFLinearSolver) = "Augmented system"
"""
update_linear_solver!(ls, θ, regP, regD)
Update LDLt factorization of the augmented system.
Update LDLᵀ factorization of the augmented system.
Update diagonal scaling ``\\theta``, primal-dual regularizations, and re-compute
the factorization.
Expand Down
10 changes: 5 additions & 5 deletions src/LinearAlgebra/unitBlockAngular.jl
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ end
"""
mul!(y, A, x)
In-place computation of `y = A*x`
In-place computation of `y = A * x`
"""
function mul!(
y::Vector,
Expand All @@ -386,9 +386,9 @@ function mul!(
end

"""
mul!(x, At, y)
mul!(x, Aᵀ, y)
Compute Matrix-vector product `A'*y` and overwrites the result in `x`.
Compute Matrix-vector product `Aᵀ * y` and overwrites the result in `x`.
"""
function mul!(
x::Vector,
Expand Down Expand Up @@ -520,7 +520,7 @@ end
"""
factor_normaleq(A, θ)
Compute Cholesky factorization of `A*Θ*A'`, where `Θ = Diag(θ)`.
Compute Cholesky factorization of `A*Θ*Aᵀ`, where `Θ = Diag(θ)`.
"""
function factor_normaleq(A::UnitBlockAngular{Tv}, θ::Vector{Tv}) where Tv<:Real

Expand Down Expand Up @@ -556,7 +556,7 @@ end
"""
factor_normaleq!(F, A, θ)
In-place computation of Cholesky factorization of `A*Θ*A'`, where `Θ = Diag(θ)`.
In-place computation of Cholesky factorization of `A*Θ*Aᵀ`, where `Θ = Diag(θ)`.
"""
function factor_normaleq!(
A::UnitBlockAngular{Tv},
Expand Down

0 comments on commit 99fdc5a

Please sign in to comment.