-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0be5550
commit 3220c16
Showing
19 changed files
with
728 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
```@example usymlqr | ||
using Krylov, LinearOperators, LDLFactorizations | ||
using LinearAlgebra, Printf, SparseArrays | ||
# Identity matrix. | ||
eye(n::Int) = sparse(1.0 * I, n, n) | ||
# Saddle-point systems | ||
n = m = 5 | ||
A = [2^(i/j)*j + (-1)^(i-j) * n*(i-1) for i = 1:n, j = 1:n] | ||
b = ones(n) | ||
D = diagm(0 => [2.0 * i for i = 1:n]) | ||
m, n = size(A) | ||
c = -b | ||
# [D A] [x] = [b] | ||
# [Aᴴ 0] [y] [c] | ||
llt_D = cholesky(D) | ||
opD⁻¹ = LinearOperator(Float64, 5, 5, true, true, (y, v) -> ldiv!(y, llt_D, v)) | ||
opH⁻¹ = BlockDiagonalOperator(opD⁻¹, eye(n)) | ||
(x, y, stats) = usymlqr(A, b, c, M=opD⁻¹, sp=true) | ||
K = [D A; A' zeros(n,n)] | ||
B = [b; c] | ||
r = B - K * [x; y] | ||
resid = sqrt(dot(r, opH⁻¹ * r)) | ||
@printf("USYMLQR: Relative residual: %8.1e\n", resid) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,10 @@ tricg! | |
trimr | ||
trimr! | ||
``` | ||
|
||
## USYMLQR | ||
|
||
```@docs | ||
usymlqr! | ||
usymlqr | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.