|
| 1 | +SH = SphericalHarmonics() |
| 2 | +Spl = BSplines(0.0:0.01:1) |
| 3 | +S = SH ⊗ Spl |
| 4 | + |
| 5 | +λ = @. -(1:∞)*((1:∞) +1) |
| 6 | +L = BlockDiagonal(Diagonal.(Fill.(λ,1:2:∞))) # create a Block matrix with growing block sizes |
| 7 | +Δ_s = Mul(SH, L, inv(SH)) # the Laplace–Boltrami operator |
| 8 | +D_r = Mul(Spl, SymTridiagonal(...), inv(Spl)) |
| 9 | +R = Mul(Spl, Diagonal(Spl.points), inv(Spl)) |
| 10 | + |
| 11 | +Δ = I ⊗ (D_r*R^2*D_r) + Δ_s ⊗ I # creates Laplacian as a Mul(S, ..., inv(S)) operator |
| 12 | + |
| 13 | +# finite_dimensional case |
| 14 | +N = 100 |
| 15 | +S_N = Spl * SH[:, Block.(1:N)] # take only first N degree spherical harmonics |
| 16 | + |
| 17 | +Δ_N = Δ*S_N # Knows that inv(S)*S_N === inv(S_N) |
| 18 | + |
| 19 | +# R²Δ_N is a lazy BandedBlockBandedMatrix, with diagonal blockbandwidths |
| 20 | +backend = BandedBlockBandedMatrix{Float64,MPIMatrix{Float64}}(undef, size(R²Δ_N), (0,0), bandwidths(D_r); |
| 21 | + workers = ...) # distribute different blocks based on workers |
| 22 | + |
| 23 | +MPI_Δ_N = Mul(S_N, backend, inv(S_N)) |
| 24 | + |
| 25 | +MPI_Δ_N .= Δ_N # populates MPI array, generating data on workers remotely |
| 26 | + |
| 27 | + |
| 28 | +f = LazyFun((x,y,z) -> cos(x*y)+z, S_N) # not sure how constructors fit in yet... |
| 29 | +MPI_f = Mul(S_N, BlockVector{Float64,MPIVector{Float64}}(undef, blocklengths(backend, 2)) |
| 30 | + |
| 31 | +MPI_f .= f # automatically generates data remotely, via MPI version of FastTransforms |
| 32 | + |
| 33 | +MPI_v = similar(MPI_f) |
| 34 | +MPI_v .= Mul(MPI_Δ_N, MPI_f) # applies the Laplacian and fills in missing information. |
0 commit comments