diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml new file mode 100644 index 0000000..7ddad2a --- /dev/null +++ b/.github/workflows/CompatHelper.yml @@ -0,0 +1,45 @@ +name: CompatHelper +on: + schedule: + - cron: 0 0 * * * + workflow_dispatch: +permissions: + contents: write + pull-requests: write +jobs: + CompatHelper: + runs-on: ubuntu-latest + steps: + - name: Check if Julia is already available in the PATH + id: julia_in_path + run: which julia + continue-on-error: true + - name: Install Julia, but only if it is not already available in the PATH + uses: julia-actions/setup-julia@v1 + with: + version: '1' + # arch: ${{ runner.arch }} + if: steps.julia_in_path.outcome != 'success' + - name: "Add the General registry via Git" + run: | + import Pkg + ENV["JULIA_PKG_SERVER"] = "" + Pkg.Registry.add("General") + shell: julia --color=yes {0} + - name: "Install CompatHelper" + run: | + import Pkg + name = "CompatHelper" + uuid = "aa819f21-2bde-4658-8897-bab36330d9b7" + version = "3" + Pkg.add(; name, uuid, version) + shell: julia --color=yes {0} + - name: "Run CompatHelper" + run: | + import CompatHelper + CompatHelper.main() + shell: julia --color=yes {0} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} + # COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }} diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml new file mode 100644 index 0000000..90dc100 --- /dev/null +++ b/.github/workflows/TagBot.yml @@ -0,0 +1,33 @@ +name: TagBot +on: + issue_comment: + types: + - created + workflow_dispatch: + inputs: + lookback: + default: 3 +permissions: + actions: read + checks: read + contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read +jobs: + TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' + runs-on: ubuntu-latest + steps: + - uses: JuliaRegistries/TagBot@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + # Edit the following line to reflect the actual name of the GitHub Secret containing your private key + ssh: ${{ secrets.DOCUMENTER_KEY }} + # ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }} diff --git a/Project.toml b/Project.toml index 1c23ee0..4586c47 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "GeostatInversion" uuid = "acd30bff-8734-59b1-86d1-c3ef2efb63d6" authors = ["Daniel O'Malley ", "Velimir V Vesselinov "] -version = "1.0.0" +version = "1.2.0" [deps] Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" @@ -15,10 +15,11 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [compat] FFTW = "1" -IterativeSolvers = "0.8, 0.9" -Interpolations = "0.12, 0.13, 0.14, 0.15" +IterativeSolvers = "0.9" +Interpolations = "0.14, 0.15" RobustPmap = "1" -julia = "1.5" +Statistics = "1" +julia = "1.11" [extras] Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" diff --git a/README.md b/README.md index 7f2b98b..7487db6 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Randomized Geostatistical Approach (RGA) references: Two versions of PCGA are implemented in this package - `pcgadirect`, which uses full matrices and direct solvers during iterations -- `pcgalsqr`, which uses low rank representations of the matrices combined with iterative solvers during iterations +- `pcgalsqr`, which uses low-rank representations of the matrices combined with iterative solvers during iterations 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)`. @@ -54,9 +54,9 @@ MADS can execute a wide range of data- and model-based analyses: * Machine Learning and Blind Source Separation * Decision Analysis and Support -MADS has been tested to perform HPC simulations on a wide-range multi-processor clusters and parallel environments (Moab, Slurm, etc.). +MADS has been tested to perform HPC simulations on a wide-range of multi-processor clusters and parallel environments (Moab, Slurm, etc.). MADS utilizes adaptive rules and techniques which allows the analyses to be performed with a minimum user input. -The code provides a series of alternative algorithms to execute each type of data- and model-based analyses. +The code provides a series of alternative algorithms to execute each type of data- and model-based analysis. Documentation ============= @@ -73,7 +73,7 @@ Pkg.add("GeostatInversion") Installation behind a firewall ------------------------------ -Julia uses git for the package management. +Julia uses git for package management. To install Julia packages behind a firewall, add the following lines in the `.gitconfig` file in your home directory: ```git diff --git a/test/testfd.jl b/test/testfd.jl index c7d3f96..2257df8 100644 --- a/test/testfd.jl +++ b/test/testfd.jl @@ -11,14 +11,14 @@ import Random end testjacobianf = GeostatInversion.FDDerivatives.makejacobian(f) x = [1., 2.] - @Test.test isapprox(jacobianf(x), testjacobianf(x), atol=1e-4) + Test.@test isapprox(jacobianf(x), testjacobianf(x), atol=1e-4) for i = 1:10000 x = 10 * randn(2) - @Test.test isapprox(jacobianf(x), testjacobianf(x), atol=1e-4) + Test.@test isapprox(jacobianf(x), testjacobianf(x), atol=1e-4) end end Random.seed!(2017) -@Test.testset "Basic" begin +Test.@testset "Basic" begin basictest() end diff --git a/test/testfftrf.jl b/test/testfftrf.jl index f3db42d..272f860 100644 --- a/test/testfftrf.jl +++ b/test/testfftrf.jl @@ -9,9 +9,9 @@ import Statistics dk = rand() beta = -2 - rand() k = GeostatInversion.FFTRF.powerlaw_structuredgrid(Ns, k0, dk, beta) - @Test.test Statistics.mean(k) ≈ k0 - @Test.test Statistics.std(k) ≈ dk - @Test.test collect(size(k)) == Ns + Test.@test Statistics.mean(k) ≈ k0 + Test.@test Statistics.std(k) ≈ dk + Test.@test collect(size(k)) == Ns end @stderrcapture function testunstructured(N) @@ -21,11 +21,11 @@ end dk = rand() beta = -2 - rand() k = GeostatInversion.FFTRF.powerlaw_unstructuredgrid(points, Ns, k0, dk, beta) - @Test.test length(k) == size(points, 2) + Test.@test length(k) == size(points, 2) end Random.seed!(2017) -@Test.testset "FTRF" begin +Test.@testset "FTRF" begin for i = 1:10 testunstructured(2) testunstructured(3) diff --git a/test/testrmf.jl b/test/testrmf.jl index 735fbb0..5c485c7 100644 --- a/test/testrmf.jl +++ b/test/testrmf.jl @@ -11,11 +11,11 @@ end @stderrcapture function test_rangefinder(n, m) A = makeA(n, m) Q = GeostatInversion.RandMatFact.rangefinder(A) - @Test.test isapprox(m, size(Q, 2), atol=1) - @Test.test isapprox(LinearAlgebra.norm(A - Q * Q' * A), 0., atol=1e-8) + Test.@test isapprox(m, size(Q, 2), atol=1) + Test.@test isapprox(LinearAlgebra.norm(A - Q * Q' * A), 0., atol=1e-8) Q = GeostatInversion.RandMatFact.rangefinder(A, m, 2) - @Test.test isapprox(m, size(Q, 2), atol=1) - @Test.test isapprox(LinearAlgebra.norm(A - Q * Q' * A), 0., atol=1e-8) + Test.@test isapprox(m, size(Q, 2), atol=1) + Test.@test isapprox(LinearAlgebra.norm(A - Q * Q' * A), 0., atol=1e-8) end @stderrcapture function test_eig_nystrom() @@ -25,10 +25,10 @@ end Sigma = LinearAlgebra.Diagonal(Sigmavec) Lambda = Sigma * Sigma eigvals, eigvecs = LinearAlgebra.eigen(A) - @Test.test isapprox(LinearAlgebra.norm(sort(eigvals, rev=true) - LinearAlgebra.diag(Lambda)), 0., atol=1e-8) + Test.@test isapprox(LinearAlgebra.norm(sort(eigvals, rev=true) - LinearAlgebra.diag(Lambda)), 0., atol=1e-8) end -@Test.testset "RMF" begin +Test.@testset "RMF" begin test_rangefinder(10, 2) test_rangefinder(10, 5) test_rangefinder(100, 5) diff --git a/test/testrpcga.jl b/test/testrpcga.jl index ce0cd73..f28af38 100644 --- a/test/testrpcga.jl +++ b/test/testrpcga.jl @@ -1,9 +1,9 @@ import GeostatInversion +import Random import RobustPmap import Test import SparseArrays import LinearAlgebra -import Random using Distributed using SparseArrays @@ -12,7 +12,7 @@ using SparseArrays HX = rand(10) R = spzeros(10, 10) A = GeostatInversion.PCGALowRankMatrix(etas, HX, R) - @Test.test size(A) == (size(A, 1), size(A, 2)) + Test.@test size(A) == (size(A, 1), size(A, 2)) end @stderrcapture function simplepcgalowranktest(numetas=10, numobs=20) @@ -36,7 +36,7 @@ end for i = 1:numobs + 1 x = zeros(numobs + 1) x[i] = 1. - @Test.test isapprox(bigA * x, lrbigA * x) + Test.@test isapprox(bigA * x, lrbigA * x) end end end @@ -47,13 +47,13 @@ end samples = Array{Float64, 1}[[-.5, 0., .5], [1., -1., 0.], [-.5, 1., -.5]] lrcm = GeostatInversion.LowRankCovMatrix(samples) fullcm = LinearAlgebra.Matrix{Float64}(LinearAlgebra.I, 3, 3) * lrcm - @Test.test isapprox(fullcm, lrcm * LinearAlgebra.Matrix{Float64}(LinearAlgebra.I, 3, 3)) - @Test.test isapprox(sum(map(x->x * x', samples)) / (length(samples) - 1), fullcm) - @Test.test isapprox(sum(map(x->x * x', samples)) / (length(samples) - 1), fullcm) + Test.@test isapprox(fullcm, lrcm * LinearAlgebra.Matrix{Float64}(LinearAlgebra.I, 3, 3)) + Test.@test isapprox(sum(map(x->x * x', samples)) / (length(samples) - 1), fullcm) + Test.@test isapprox(sum(map(x->x * x', samples)) / (length(samples) - 1), fullcm) for i = 1:100 x = randn(3, 3) - @Test.test isapprox(fullcm * x, lrcm * x) - @Test.test isapprox(fullcm' * x, lrcm' * x) + Test.@test isapprox(fullcm * x, lrcm * x) + Test.@test isapprox(fullcm' * x, lrcm' * x) end end @@ -73,9 +73,10 @@ end lrcm = GeostatInversion.LowRankCovMatrix(samples) lrcmfull = lrcm * LinearAlgebra.Matrix{Float64}(LinearAlgebra.I, M, M) @Test.test isapprox(LinearAlgebra.norm(lrcmfull - covmatrix, 2), 0.; atol=M ^ 2 / sqrt(N) + 10) + # Test.@test isapprox(LinearAlgebra.norm(lrcmfull - covmatrix, 2), 0.; atol=M ^ 2 / sqrt(N)) for i = 1:100 x = randn(M) - @Test.test isapprox(lrcm * x, lrcmfull * x) + Test.@test isapprox(lrcm * x, lrcmfull * x) end end @@ -96,7 +97,7 @@ end we get from the full matrix. =# #This test is also tricky because the randsvd's in the two getxis calls need to be generating the same random numbers - @Test.test isapprox(0., min(LinearAlgebra.norm(fullxis[i] - lrcmxis[i]), LinearAlgebra.norm(fullxis[i] + lrcmxis[i])), atol=1e-6) + Test.@test isapprox(0., min(LinearAlgebra.norm(fullxis[i] - lrcmxis[i]), LinearAlgebra.norm(fullxis[i] + lrcmxis[i])), atol=1e-6) end end @@ -122,10 +123,10 @@ end @stderrcapture function simpletestpcga(M::Int, N::Int, mu::Float64=0.) forward, p0, X, xis, R, yobs, truep = setupsimpletest(M, N, mu) popt = GeostatInversion.pcgadirect(forward, p0, X, xis, R, yobs) - @Test.test isapprox(LinearAlgebra.norm(popt - truep) / LinearAlgebra.norm(truep), 0., atol=2e-2) + Test.@test isapprox(LinearAlgebra.norm(popt - truep) / LinearAlgebra.norm(truep), 0., atol=2e-2) if M < N / 6 popt = GeostatInversion.pcgalsqr(forward, p0, X, xis, R, yobs) - @Test.test isapprox(LinearAlgebra.norm(popt - truep) / LinearAlgebra.norm(truep), 0., atol=2e-2) + Test.@test isapprox(LinearAlgebra.norm(popt - truep) / LinearAlgebra.norm(truep), 0., atol=2e-2) end end @@ -133,18 +134,19 @@ end forward, p0, X, xis, R, yobs, truep = setupsimpletest(M, N, mu) S = randn(Nreduced, N) * (1 / sqrt(N)) popt = GeostatInversion.rga(forward, p0, X, xis, R, yobs, S) - @Test.test isapprox(LinearAlgebra.norm(popt - truep) / LinearAlgebra.norm(truep), 0., atol=2e-2) + Test.@test isapprox(LinearAlgebra.norm(popt - truep) / LinearAlgebra.norm(truep), 0., atol=2e-2) end #= function simpletestpcgalm(M, N, mu=0.) forward, p0, X, xis, R, yobs, truep = setupsimpletest(M, N, mu) popt = GeostatInversion.pcgalm(forward, p0, X, xis, diag(R), yobs) - @Test.test_approx_eq_eps LinearAlgebra.norm(popt - truep) / LinearAlgebra.norm(truep) 0. 2e-2 + Test.@test_approx_eq_eps LinearAlgebra.norm(popt - truep) / LinearAlgebra.norm(truep) 0. 2e-2 end =# -@Test.testset "RPSGA" begin +Test.@testset "RPSGA" begin + @everywhere import Random @everywhere Random.seed!(2017) pcgalowranksize() simplepcgalowranktest() @@ -168,4 +170,4 @@ end end end end -:passed +:passed \ No newline at end of file