Skip to content

Commit 163e9e4

Browse files
Merge branches 'master' and 'master' of github.com:madsjulia/GeostatInversion.jl
2 parents e44601a + 0958f7c commit 163e9e4

File tree

8 files changed

+119
-38
lines changed

8 files changed

+119
-38
lines changed

.github/workflows/CompatHelper.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CompatHelper
2+
on:
3+
schedule:
4+
- cron: 0 0 * * *
5+
workflow_dispatch:
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
jobs:
10+
CompatHelper:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check if Julia is already available in the PATH
14+
id: julia_in_path
15+
run: which julia
16+
continue-on-error: true
17+
- name: Install Julia, but only if it is not already available in the PATH
18+
uses: julia-actions/setup-julia@v1
19+
with:
20+
version: '1'
21+
# arch: ${{ runner.arch }}
22+
if: steps.julia_in_path.outcome != 'success'
23+
- name: "Add the General registry via Git"
24+
run: |
25+
import Pkg
26+
ENV["JULIA_PKG_SERVER"] = ""
27+
Pkg.Registry.add("General")
28+
shell: julia --color=yes {0}
29+
- name: "Install CompatHelper"
30+
run: |
31+
import Pkg
32+
name = "CompatHelper"
33+
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7"
34+
version = "3"
35+
Pkg.add(; name, uuid, version)
36+
shell: julia --color=yes {0}
37+
- name: "Run CompatHelper"
38+
run: |
39+
import CompatHelper
40+
CompatHelper.main()
41+
shell: julia --color=yes {0}
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
45+
# COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }}

.github/workflows/TagBot.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: TagBot
2+
on:
3+
issue_comment:
4+
types:
5+
- created
6+
workflow_dispatch:
7+
inputs:
8+
lookback:
9+
default: 3
10+
permissions:
11+
actions: read
12+
checks: read
13+
contents: write
14+
deployments: read
15+
issues: read
16+
discussions: read
17+
packages: read
18+
pages: read
19+
pull-requests: read
20+
repository-projects: read
21+
security-events: read
22+
statuses: read
23+
jobs:
24+
TagBot:
25+
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: JuliaRegistries/TagBot@v1
29+
with:
30+
token: ${{ secrets.GITHUB_TOKEN }}
31+
# Edit the following line to reflect the actual name of the GitHub Secret containing your private key
32+
ssh: ${{ secrets.DOCUMENTER_KEY }}
33+
# ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }}

Project.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "GeostatInversion"
22
uuid = "acd30bff-8734-59b1-86d1-c3ef2efb63d6"
33
authors = ["Daniel O'Malley <[email protected]>", "Velimir V Vesselinov <[email protected]>"]
4-
version = "1.0.0"
4+
version = "1.2.0"
55

66
[deps]
77
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
@@ -15,10 +15,11 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1515

1616
[compat]
1717
FFTW = "1"
18-
IterativeSolvers = "0.8, 0.9"
19-
Interpolations = "0.12, 0.13, 0.14, 0.15"
18+
IterativeSolvers = "0.9"
19+
Interpolations = "0.14, 0.15"
2020
RobustPmap = "1"
21-
julia = "1.5"
21+
Statistics = "1"
22+
julia = "1.11"
2223

2324
[extras]
2425
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Randomized Geostatistical Approach (RGA) references:
2020
Two versions of PCGA are implemented in this package
2121

2222
- `pcgadirect`, which uses full matrices and direct solvers during iterations
23-
- `pcgalsqr`, which uses low rank representations of the matrices combined with iterative solvers during iterations
23+
- `pcgalsqr`, which uses low-rank representations of the matrices combined with iterative solvers during iterations
2424

2525
The RGA method, `rga`, can use either of these approaches using the keyword argument. That is, by doing `rga(...; pcgafunc=GeostatInversion.pcgadirect)` or `rga(...; pcgafunc=GeostatInversion.pcgalsqr)`.
2626

@@ -54,9 +54,9 @@ MADS can execute a wide range of data- and model-based analyses:
5454
* Machine Learning and Blind Source Separation
5555
* Decision Analysis and Support
5656

57-
MADS has been tested to perform HPC simulations on a wide-range multi-processor clusters and parallel environments (Moab, Slurm, etc.).
57+
MADS has been tested to perform HPC simulations on a wide-range of multi-processor clusters and parallel environments (Moab, Slurm, etc.).
5858
MADS utilizes adaptive rules and techniques which allows the analyses to be performed with a minimum user input.
59-
The code provides a series of alternative algorithms to execute each type of data- and model-based analyses.
59+
The code provides a series of alternative algorithms to execute each type of data- and model-based analysis.
6060

6161
Documentation
6262
=============
@@ -73,7 +73,7 @@ Pkg.add("GeostatInversion")
7373
Installation behind a firewall
7474
------------------------------
7575

76-
Julia uses git for the package management.
76+
Julia uses git for package management.
7777
To install Julia packages behind a firewall, add the following lines in the `.gitconfig` file in your home directory:
7878

7979
```git

test/testfd.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ import Random
1111
end
1212
testjacobianf = GeostatInversion.FDDerivatives.makejacobian(f)
1313
x = [1., 2.]
14-
@Test.test isapprox(jacobianf(x), testjacobianf(x), atol=1e-4)
14+
Test.@test isapprox(jacobianf(x), testjacobianf(x), atol=1e-4)
1515
for i = 1:10000
1616
x = 10 * randn(2)
17-
@Test.test isapprox(jacobianf(x), testjacobianf(x), atol=1e-4)
17+
Test.@test isapprox(jacobianf(x), testjacobianf(x), atol=1e-4)
1818
end
1919
end
2020

2121
Random.seed!(2017)
22-
@Test.testset "Basic" begin
22+
Test.@testset "Basic" begin
2323
basictest()
2424
end

test/testfftrf.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import Statistics
99
dk = rand()
1010
beta = -2 - rand()
1111
k = GeostatInversion.FFTRF.powerlaw_structuredgrid(Ns, k0, dk, beta)
12-
@Test.test Statistics.mean(k) k0
13-
@Test.test Statistics.std(k) dk
14-
@Test.test collect(size(k)) == Ns
12+
Test.@test Statistics.mean(k) k0
13+
Test.@test Statistics.std(k) dk
14+
Test.@test collect(size(k)) == Ns
1515
end
1616

1717
@stderrcapture function testunstructured(N)
@@ -21,11 +21,11 @@ end
2121
dk = rand()
2222
beta = -2 - rand()
2323
k = GeostatInversion.FFTRF.powerlaw_unstructuredgrid(points, Ns, k0, dk, beta)
24-
@Test.test length(k) == size(points, 2)
24+
Test.@test length(k) == size(points, 2)
2525
end
2626

2727
Random.seed!(2017)
28-
@Test.testset "FTRF" begin
28+
Test.@testset "FTRF" begin
2929
for i = 1:10
3030
testunstructured(2)
3131
testunstructured(3)

test/testrmf.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ end
1111
@stderrcapture function test_rangefinder(n, m)
1212
A = makeA(n, m)
1313
Q = GeostatInversion.RandMatFact.rangefinder(A)
14-
@Test.test isapprox(m, size(Q, 2), atol=1)
15-
@Test.test isapprox(LinearAlgebra.norm(A - Q * Q' * A), 0., atol=1e-8)
14+
Test.@test isapprox(m, size(Q, 2), atol=1)
15+
Test.@test isapprox(LinearAlgebra.norm(A - Q * Q' * A), 0., atol=1e-8)
1616
Q = GeostatInversion.RandMatFact.rangefinder(A, m, 2)
17-
@Test.test isapprox(m, size(Q, 2), atol=1)
18-
@Test.test isapprox(LinearAlgebra.norm(A - Q * Q' * A), 0., atol=1e-8)
17+
Test.@test isapprox(m, size(Q, 2), atol=1)
18+
Test.@test isapprox(LinearAlgebra.norm(A - Q * Q' * A), 0., atol=1e-8)
1919
end
2020

2121
@stderrcapture function test_eig_nystrom()
@@ -25,10 +25,10 @@ end
2525
Sigma = LinearAlgebra.Diagonal(Sigmavec)
2626
Lambda = Sigma * Sigma
2727
eigvals, eigvecs = LinearAlgebra.eigen(A)
28-
@Test.test isapprox(LinearAlgebra.norm(sort(eigvals, rev=true) - LinearAlgebra.diag(Lambda)), 0., atol=1e-8)
28+
Test.@test isapprox(LinearAlgebra.norm(sort(eigvals, rev=true) - LinearAlgebra.diag(Lambda)), 0., atol=1e-8)
2929
end
3030

31-
@Test.testset "RMF" begin
31+
Test.@testset "RMF" begin
3232
test_rangefinder(10, 2)
3333
test_rangefinder(10, 5)
3434
test_rangefinder(100, 5)

test/testrpcga.jl

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import GeostatInversion
2+
import Random
23
import RobustPmap
34
import Test
45
import SparseArrays
56
import LinearAlgebra
6-
import Random
77
using Distributed
88
using SparseArrays
99

@@ -12,7 +12,7 @@ using SparseArrays
1212
HX = rand(10)
1313
R = spzeros(10, 10)
1414
A = GeostatInversion.PCGALowRankMatrix(etas, HX, R)
15-
@Test.test size(A) == (size(A, 1), size(A, 2))
15+
Test.@test size(A) == (size(A, 1), size(A, 2))
1616
end
1717

1818
@stderrcapture function simplepcgalowranktest(numetas=10, numobs=20)
@@ -36,7 +36,7 @@ end
3636
for i = 1:numobs + 1
3737
x = zeros(numobs + 1)
3838
x[i] = 1.
39-
@Test.test isapprox(bigA * x, lrbigA * x)
39+
Test.@test isapprox(bigA * x, lrbigA * x)
4040
end
4141
end
4242
end
@@ -47,13 +47,13 @@ end
4747
samples = Array{Float64, 1}[[-.5, 0., .5], [1., -1., 0.], [-.5, 1., -.5]]
4848
lrcm = GeostatInversion.LowRankCovMatrix(samples)
4949
fullcm = LinearAlgebra.Matrix{Float64}(LinearAlgebra.I, 3, 3) * lrcm
50-
@Test.test isapprox(fullcm, lrcm * LinearAlgebra.Matrix{Float64}(LinearAlgebra.I, 3, 3))
51-
@Test.test isapprox(sum(map(x->x * x', samples)) / (length(samples) - 1), fullcm)
52-
@Test.test isapprox(sum(map(x->x * x', samples)) / (length(samples) - 1), fullcm)
50+
Test.@test isapprox(fullcm, lrcm * LinearAlgebra.Matrix{Float64}(LinearAlgebra.I, 3, 3))
51+
Test.@test isapprox(sum(map(x->x * x', samples)) / (length(samples) - 1), fullcm)
52+
Test.@test isapprox(sum(map(x->x * x', samples)) / (length(samples) - 1), fullcm)
5353
for i = 1:100
5454
x = randn(3, 3)
55-
@Test.test isapprox(fullcm * x, lrcm * x)
56-
@Test.test isapprox(fullcm' * x, lrcm' * x)
55+
Test.@test isapprox(fullcm * x, lrcm * x)
56+
Test.@test isapprox(fullcm' * x, lrcm' * x)
5757
end
5858
end
5959

@@ -73,9 +73,10 @@ end
7373
lrcm = GeostatInversion.LowRankCovMatrix(samples)
7474
lrcmfull = lrcm * LinearAlgebra.Matrix{Float64}(LinearAlgebra.I, M, M)
7575
@Test.test isapprox(LinearAlgebra.norm(lrcmfull - covmatrix, 2), 0.; atol=M ^ 2 / sqrt(N) + 10)
76+
# Test.@test isapprox(LinearAlgebra.norm(lrcmfull - covmatrix, 2), 0.; atol=M ^ 2 / sqrt(N))
7677
for i = 1:100
7778
x = randn(M)
78-
@Test.test isapprox(lrcm * x, lrcmfull * x)
79+
Test.@test isapprox(lrcm * x, lrcmfull * x)
7980
end
8081
end
8182

@@ -96,7 +97,7 @@ end
9697
we get from the full matrix.
9798
=#
9899
#This test is also tricky because the randsvd's in the two getxis calls need to be generating the same random numbers
99-
@Test.test isapprox(0., min(LinearAlgebra.norm(fullxis[i] - lrcmxis[i]), LinearAlgebra.norm(fullxis[i] + lrcmxis[i])), atol=1e-6)
100+
Test.@test isapprox(0., min(LinearAlgebra.norm(fullxis[i] - lrcmxis[i]), LinearAlgebra.norm(fullxis[i] + lrcmxis[i])), atol=1e-6)
100101
end
101102
end
102103

@@ -122,29 +123,30 @@ end
122123
@stderrcapture function simpletestpcga(M::Int, N::Int, mu::Float64=0.)
123124
forward, p0, X, xis, R, yobs, truep = setupsimpletest(M, N, mu)
124125
popt = GeostatInversion.pcgadirect(forward, p0, X, xis, R, yobs)
125-
@Test.test isapprox(LinearAlgebra.norm(popt - truep) / LinearAlgebra.norm(truep), 0., atol=2e-2)
126+
Test.@test isapprox(LinearAlgebra.norm(popt - truep) / LinearAlgebra.norm(truep), 0., atol=2e-2)
126127
if M < N / 6
127128
popt = GeostatInversion.pcgalsqr(forward, p0, X, xis, R, yobs)
128-
@Test.test isapprox(LinearAlgebra.norm(popt - truep) / LinearAlgebra.norm(truep), 0., atol=2e-2)
129+
Test.@test isapprox(LinearAlgebra.norm(popt - truep) / LinearAlgebra.norm(truep), 0., atol=2e-2)
129130
end
130131
end
131132

132133
@stderrcapture function simpletestrga(M::Int, N::Int, Nreduced::Int, mu::Float64=0.)
133134
forward, p0, X, xis, R, yobs, truep = setupsimpletest(M, N, mu)
134135
S = randn(Nreduced, N) * (1 / sqrt(N))
135136
popt = GeostatInversion.rga(forward, p0, X, xis, R, yobs, S)
136-
@Test.test isapprox(LinearAlgebra.norm(popt - truep) / LinearAlgebra.norm(truep), 0., atol=2e-2)
137+
Test.@test isapprox(LinearAlgebra.norm(popt - truep) / LinearAlgebra.norm(truep), 0., atol=2e-2)
137138
end
138139

139140
#=
140141
function simpletestpcgalm(M, N, mu=0.)
141142
forward, p0, X, xis, R, yobs, truep = setupsimpletest(M, N, mu)
142143
popt = GeostatInversion.pcgalm(forward, p0, X, xis, diag(R), yobs)
143-
@Test.test_approx_eq_eps LinearAlgebra.norm(popt - truep) / LinearAlgebra.norm(truep) 0. 2e-2
144+
Test.@test_approx_eq_eps LinearAlgebra.norm(popt - truep) / LinearAlgebra.norm(truep) 0. 2e-2
144145
end
145146
=#
146147

147-
@Test.testset "RPSGA" begin
148+
Test.@testset "RPSGA" begin
149+
@everywhere import Random
148150
@everywhere Random.seed!(2017)
149151
pcgalowranksize()
150152
simplepcgalowranktest()
@@ -168,4 +170,4 @@ end
168170
end
169171
end
170172
end
171-
:passed
173+
:passed

0 commit comments

Comments
 (0)