diff --git a/.dev/Project.toml b/.dev/Project.toml index d86279d..71708c8 100644 --- a/.dev/Project.toml +++ b/.dev/Project.toml @@ -2,4 +2,4 @@ JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899" [compat] -JuliaFormatter = "0.3" +JuliaFormatter = "1" diff --git a/.github/workflows/Docs.yml b/.github/workflows/Docs.yml index 56c5acc..22e9ab2 100644 --- a/.github/workflows/Docs.yml +++ b/.github/workflows/Docs.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@latest with: - version: 1.7 + version: 1.9 - name: Install dependencies run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' - name: Build and deploy diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7de7555..49a43da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: version: - - '1.7.0' + - '1.9' os: - ubuntu-latest - macOS-latest diff --git a/.github/workflows/julia_formatter.yml b/.github/workflows/julia_formatter.yml index d11ea03..60194aa 100644 --- a/.github/workflows/julia_formatter.yml +++ b/.github/workflows/julia_formatter.yml @@ -31,7 +31,7 @@ jobs: - uses: julia-actions/setup-julia@latest if: steps.filter.outputs.julia_file_change == 'true' with: - version: 1.7.0 + version: 1.9 - name: Apply JuliaFormatter if: steps.filter.outputs.julia_file_change == 'true' diff --git a/Project.toml b/Project.toml index d788f4b..c3fd80a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "OperatorFlux" uuid = "47cfafe2-3833-4da3-8183-ce14c2b92cbd" authors = ["CliMA Contributors "] -version = "0.1.2" +version = "0.1.3" [deps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" @@ -18,7 +18,7 @@ ChainRulesCore = "1" ChainRulesTestUtils = "1" Distributions = "0.25" FFTW = "1" -Flux = "0.13" +Flux = "0.13, 0.14" GaussQuadrature = "0.5" Tullio = "0.3" julia = "1.7" diff --git a/bors.toml b/bors.toml index e14b110..93dec5c 100644 --- a/bors.toml +++ b/bors.toml @@ -1,7 +1,7 @@ status = [ - "ci 1.7.0 - ubuntu-latest", - "ci 1.7.0 - windows-latest", - "ci 1.7.0 - macOS-latest", + "ci 1.9 - ubuntu-latest", + "ci 1.9 - windows-latest", + "ci 1.9 - macOS-latest", "format", "docbuild" ] diff --git a/docs/make.jl b/docs/make.jl index d21ee59..7aa04cc 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -8,6 +8,7 @@ makedocs( modules = [OperatorFlux], sitename = "OperatorFlux.jl", authors = "CliMA", + warnonly = true, format = Documenter.HTML( prettyurls = !isempty(get(ENV, "CI", "")), collapselevel = 1, diff --git a/src/transform_fourier.jl b/src/transform_fourier.jl index 65898e2..62c3e4b 100644 --- a/src/transform_fourier.jl +++ b/src/transform_fourier.jl @@ -36,8 +36,8 @@ function truncate_modes(tr::FourierTransform{N}, coeff) where {N} # indices for the spectral coefficients that we need to retain inds = [ - vcat(collect(1:(m)), collect((s - m + 1):s)) - for (s, m) in zip(size(coeff)[2:(end - 1)], tr.modes) + vcat(collect(1:(m)), collect((s - m + 1):s)) for + (s, m) in zip(size(coeff)[2:(end - 1)], tr.modes) ] # we need to handle the first dimension of the real Fourier transform @@ -63,8 +63,8 @@ function pad_modes( size_padded = (size(coeff)[1], size_pad..., size(coeff)[end]) coeff_padded = zeros(eltype(coeff), size_padded) inds = [ - vcat(collect(1:(div(m, 2) + 1)), collect((s - div(m, 2) + 2):s)) - for (s, m) in zip(size_pad, size(coeff)[2:(end - 1)]) + vcat(collect(1:(div(m, 2) + 1)), collect((s - div(m, 2) + 2):s)) for + (s, m) in zip(size_pad, size(coeff)[2:(end - 1)]) ] # we need to handle the first dimension of the real Fourier transform diff --git a/src/utils.jl b/src/utils.jl index ee56dad..3543479 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -3,11 +3,8 @@ mview(c, inds, ::Val{2}) = view(c, :, inds[1], inds[2], :) mview(c, inds, ::Val{3}) = view(c, :, inds[1], inds[2], inds[3], :) mview(c, inds, ::Val{4}) = view(c, :, inds[1], inds[2], inds[3], inds[4], :) -tensor_contraction( - A, - B, - ::Val{1}, -) = @tullio C[o, a, b] := A[i, a, o] * B[i, a, b] +tensor_contraction(A, B, ::Val{1}) = + @tullio C[o, a, b] := A[i, a, o] * B[i, a, b] tensor_contraction(A, B, ::Val{2}) = @tullio C[o, a₁, a₂, b] := A[i, a₁, a₂, o] * B[i, a₁, a₂, b] tensor_contraction(A, B, ::Val{3}) = @@ -16,21 +13,15 @@ tensor_contraction(A, B, ::Val{4}) = @tullio C[o, a₁, a₂, a₃, a₄, b] := A[i, a₁, a₂, a₃, a₄, o] * B[i, a₁, a₂, a₃, a₄, b] sparse_mean(w, c, ::Val{1}) = @tullio μ[o, a, b] := w[i, o] * c[i, a, b] -sparse_mean( - w, - c, - ::Val{2}, -) = @tullio μ[o, a₁, a₂, b] := w[i, o] * c[i, a₁, a₂, b] +sparse_mean(w, c, ::Val{2}) = + @tullio μ[o, a₁, a₂, b] := w[i, o] * c[i, a₁, a₂, b] sparse_mean(w, c, ::Val{3}) = @tullio μ[o, a₁, a₂, a₃, b] := w[i, o] * c[i, a₁, a₂, a₃, b] sparse_mean(w, c, ::Val{4}) = @tullio μ[o, a₁, a₂, a₃, a₄, b] := w[i, o] * c[i, a₁, a₂, a₃, a₄, b] -sparse_covariance( - w, - c, - ::Val{1}, -) = @tullio μ[o, a, r, b] := w[i, r, o] * c[i, a, b] +sparse_covariance(w, c, ::Val{1}) = + @tullio μ[o, a, r, b] := w[i, r, o] * c[i, a, b] sparse_covariance(w, c, ::Val{2}) = @tullio μ[o, a₁, a₂, r, b] := w[i, r, o] * c[i, a₁, a₂, b] sparse_covariance(w, c, ::Val{3}) = diff --git a/test/transform_fourier.jl b/test/transform_fourier.jl index feedf9c..17ec04d 100644 --- a/test/transform_fourier.jl +++ b/test/transform_fourier.jl @@ -42,8 +42,8 @@ using LinearAlgebra trafo = FourierTransform(modes = (12, 5)) c = rand(27, 16, 14, 1) inds = [ - [(1:(div(m, 2) + 1))..., ((s - div(m, 2) + 2):s)...] - for (s, m) in zip((M, 14), size(c)[2:(end - 1)]) + [(1:(div(m, 2) + 1))..., ((s - div(m, 2) + 2):s)...] for + (s, m) in zip((M, 14), size(c)[2:(end - 1)]) ] inds[1] = collect(1:16) @test all(OperatorFlux.pad_modes(trafo, c, (32, 14))[:, inds..., :] .== c)