Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can restrict be generalized to n-fold? #30

Open
johnnychen94 opened this issue Oct 30, 2021 · 1 comment
Open

Can restrict be generalized to n-fold? #30

johnnychen94 opened this issue Oct 30, 2021 · 1 comment

Comments

@johnnychen94
Copy link
Member

johnnychen94 commented Oct 30, 2021

I'm not sure if this is possible, but I'm imagining a more efficient version of imresize(img; ratio=1//n)

@timholy
Copy link
Member

timholy commented Oct 30, 2021

In principle, yes. You'll like this, I think: restriction is the adjoint of prolongation, and prolongation is just interpolation. (https://zingale.github.io/comp_astro_tutorial/elliptic_multigrid/multigrid/multigrid-restrict-prolong.html seems vaguely useful.) So write out the prolongation as an operator and then take the adjoint.

Example:

ϕₕ(1) = ϕ[1]         # note: "indexing" with (x) is meant to convey physical coordinates different from array indexes
ϕₕ(1.5) = (ϕ[1] + ϕ[2])/2
ϕₕ(2) = ϕ[2]

so

ϕₕ = P * ϕ

where

P = [1 0; 0.5 0.5; 0 1]

Now for restriction, just take the adjoint of P:

ϕᵣ = P'*ϕₕ

so that

ϕᵣ[1] = ϕₕ[1] + ϕₕ[2]/2
ϕᵣ[2] = ϕₕ[2]/2 + ϕₕ[3]

Note that

julia> P'*P
2×2 Matrix{Float64}:
 1.25  0.25
 0.25  1.25

which, up to a scalar multiple (divide by 1.5), is "close to" the identity matrix. (Kind of a blurred version of it.)

For n-fold prolongation, we could just linearly interpolate at ϕₕ(1+1/n), ϕₕ(1+2/n), etc. Its adjoint is (up to a scalar multiple) how one should define n-fold restriction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants