Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
ranjanan authored Oct 12, 2018
2 parents a1a82cc + 4a4372e commit 35ef05d
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 32 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Algebraic Multigrid (AMG)

[![Build Status](https://travis-ci.org/ranjanan/AlgebraicMultigrid.jl.svg?branch=master)](https://travis-ci.org/ranjanan/AlgebraicMultigrid.jl)
[![Coverage Status](https://coveralls.io/repos/ranjanan/AlgebraicMultigrid.jl/badge.svg?branch=master&service=github)](https://coveralls.io/github/ranjanan/AlgebraicMultigrid.jl?branch=master)
[![codecov.io](http://codecov.io/github/ranjanan/AlgebraicMultigrid.jl/coverage.svg?branch=master)](http://codecov.io/github/ranjanan/AlgebraicMultigrid.jl?branch=master)
[![Build Status](https://travis-ci.org/JuliaLinearAlgebra/AlgebraicMultigrid.jl.svg?branch=master)](https://travis-ci.org/JuliaLinearAlgebra/AlgebraicMultigrid.jl)
[![Coverage Status](https://coveralls.io/repos/JuliaLinearAlgebra/AlgebraicMultigrid.jl/badge.svg?branch=master&service=github)](https://coveralls.io/github/JuliaLinearAlgebra/AlgebraicMultigrid.jl?branch=master)
[![codecov.io](http://codecov.io/github/JuliaLinearAlgebra/AlgebraicMultigrid.jl/coverage.svg?branch=master)](http://codecov.io/github/JuliaLinearAlgebra/AlgebraicMultigrid.jl?branch=master)
[![Build status](https://ci.appveyor.com/api/projects/status/0wnj4lhk1rvl5pjp?svg=true)](https://ci.appveyor.com/project/ranjanan/algebraicmultigrid-jl)

This package lets you solve sparse linear systems using Algebraic Multigrid (AMG). This works especially well for symmetric positive definite matrices.

Expand Down
43 changes: 16 additions & 27 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
- julia_version: 1
- julia_version: 0.6

## uncomment the following lines to allow failures on nightly julia
## (tests will run but not make your overall status red)
#matrix:
# allow_failures:
# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
platform:
- x86 # 32-bit
- x64 # 64-bit

# # Uncomment the following lines to allow failures on nightly julia
# # (tests will run but not make your overall status red)
# matrix:
# allow_failures:
# - julia_version: latest

branches:
only:
Expand All @@ -24,24 +25,12 @@ notifications:
on_build_status_changed: false

install:
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
# If there's a newer build queued for the same PR, cancel this one
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
# Download most recent Julia Windows binary
- ps: (new-object net.webclient).DownloadFile(
$env:JULIA_URL,
"C:\projects\julia-binary.exe")
# Run installer silently, output to C:\projects\julia
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))

build_script:
# Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo();
Pkg.clone(pwd(), \"AMG\"); Pkg.build(\"AMG\")"
- echo "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"

test_script:
- C:\projects\julia\bin\julia -e "Pkg.test(\"AMG\")"
- echo "%JL_TEST_SCRIPT%"
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"
3 changes: 2 additions & 1 deletion src/aggregation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ function smoothed_aggregation(A::TA,
end
bsr_flag = false
w = MultiLevelWorkspace(Val{bs}, eltype(A))
residual!(w, size(A, 1))

while length(levels) + 1 < max_levels && size(A, 1) > max_coarse
residual!(w, size(A, 1))
A, B, bsr_flag = extend_hierarchy!(levels, strength, aggregate, smooth,
improve_candidates, diagonal_dominance,
keep, A, B, symmetry, bsr_flag)
Expand All @@ -46,6 +46,7 @@ function smoothed_aggregation(A::TA,
#=if size(A, 1) <= max_coarse
break
end=#
residual!(w, size(A, 1))
end
#=A, B = extend_hierarchy!(levels, strength, aggregate, smooth,
improve_candidates, diagonal_dominance,
Expand Down
3 changes: 2 additions & 1 deletion src/classical.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ function ruge_stuben(_A::Union{TA, Symmetric{Ti, TA}, Hermitian{Ti, TA}},
end
end
w = MultiLevelWorkspace(Val{bs}, eltype(A))
residual!(w, size(A, 1))

while length(levels) + 1 < max_levels && size(A, 1) > max_coarse
residual!(w, size(A, 1))
A = extend_heirarchy!(levels, strength, CF, A, symmetric)
coarse_x!(w, size(A, 1))
coarse_b!(w, size(A, 1))
residual!(w, size(A, 1))
end

MultiLevel(levels, A, coarse_solver(A), presmoother, postsmoother, w)
Expand Down
2 changes: 2 additions & 0 deletions test/REQUIRE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
JLD2
FileIO
Binary file added test/bug.jld2
Binary file not shown.
16 changes: 16 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ using Compat, Compat.Test, Compat.LinearAlgebra
using Compat.SparseArrays, Compat.DelimitedFiles, Compat.Random
using IterativeSolvers, AlgebraicMultigrid
import AlgebraicMultigrid: Pinv, Classical
using JLD2
using FileIO

if VERSION < v"0.7-"
const seed! = srand
Expand Down Expand Up @@ -304,4 +306,18 @@ for sz in [10, 5, 2]
@test AlgebraicMultigrid.grid_complexity(ml) == 1
end

# Issue #46
for f in (smoothed_aggregation, ruge_stuben)

a = load("bug.jld2")["G"]
ml = f(a)
p = aspreconditioner(ml)
b = zeros(size(a,1))
b[1] = 1
b[2] = -1
@test sum(abs2, a * solve(ml, b) - b) < 1e-10
@test sum(abs2, a * cg(a, b, Pl = p, maxiter = 1000) - b) < 1e-10

end

end

0 comments on commit 35ef05d

Please sign in to comment.