Skip to content

Commit

Permalink
Just a minor modification
Browse files Browse the repository at this point in the history
  • Loading branch information
bonevbs committed Apr 29, 2021
1 parent f525365 commit 392b40d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/blockmatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,13 @@ end
size(F::BlockFactorization) = size(F.B)
size(F::BlockFactorization, dim::Int) = size(F.B, dim)

# ompute block factorization
# compute block factorization
function blockfactor(A::BlockMatrix, opts::SolverOptions=SolverOptions(); args...)
size(A.A11,1) == size(A.A11,2) || throw(DimensionMismatch("First block of A is not square."))
size(A.A22,1) == size(A.A22,2) || throw(DimensionMismatch("Second block of A is not square."))
S22 = A.A22 .- A.A21*(A.A11\convert(Matrix, A.A12))
return BlockFactorization(BlockMatrix(A.A11, A.A12, A.A21, S22))
end

function blockfactor(A::BlockMatrix{T, HT, HT, HT, HT}, opts::SolverOptions=SolverOptions(); args...) where HT<:HssMatrix{T} where T
opts = copy(opts; args...)
chkopts!(opts)
Expand Down
4 changes: 2 additions & 2 deletions src/factorization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function _factor_branch(A::AbstractMatrix{T}, Fl::FactorNode{T}, Fr::FactorNode{

# make sure clusters are matching
if ishss(Fl.S) && ishss(Fr.S)
S1, S2 = _equilibrate_clusters(Fl.S, Fr.S)
S1, S2 = _equilibrate_clusters(Fl.S, Fr.S; verbose)
else
S1, S2 = Fl.S, Fr.S
end
Expand Down Expand Up @@ -140,7 +140,7 @@ function _assemble_blocks(A::AbstractMatrix{T}, S1::HssMatrix{T}, S2::HssMatrix{
end

# make sure HSS structures among Schur complements is matching
function _equilibrate_clusters(S1::HssMatrix, S2::HssMatrix)
function _equilibrate_clusters(S1::HssMatrix, S2::HssMatrix; verbose=false)
rcl1, ccl1 = cluster(S1.A11); rcl2, ccl2 = cluster(S2.A11)
if !compatible(rcl1, rcl2)
while !compatible(rcl1, rcl2)
Expand Down
7 changes: 4 additions & 3 deletions test/rungmres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ using HssMatrices
include("../util/read_problem.jl")
#A, b, nd = read_problem("./test/test.mat")
#A, b, nd = read_problem("./test/poisson2d_p1_h64.mat")
A, b, nd = read_problem("./test/poisson2d_p1_h512.mat")
A, b, nd = read_problem("./test/poisson3d_p1_h16_nmax10.mat")
nd, nd_loc = symfact!(nd)
perm = postorder(nd)
A = permute(A, perm, perm)
nd = permuted!(nd, invperm(perm))

bsz = 60
pdeg=1
bsz = 60*(pdeg+1)*(pdeg+2)*(pdeg+3)

println("Problem parameters:")
println(" $(size(A)) matrix")
Expand All @@ -36,7 +37,7 @@ println("took ", ta, " seconds")
#println("rel. error without compression ", norm(A*xa-b)/norm(A\b))

println("Computing factorization with compression...")
Fc, tc = @timed factor(A, nd, nd_loc; swlevel = -6, swsize=4*bsz, atol=1e-6, rtol=1e-6, kest=40, stepsize=10, leafsize=bsz, verbose=false)
Fc, tc = @timed factor(A, nd, nd_loc; swlevel = -2, swsize=4*bsz, atol=1e-3, rtol=1e-3, kest=200, stepsize=100, leafsize=bsz, verbose=true)
println("took ", tc, " seconds")
#println("Computing approximate solution...")
#xc = ldiv!(Fc, copy(b));
Expand Down

0 comments on commit 392b40d

Please sign in to comment.