-
Notifications
You must be signed in to change notification settings - Fork 70
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
Implementing a convolution operator #940
Comments
This code is quite old, but in case it's helpful to you https://github.com/JuliaApproximation/SingularIntegralEquations.jl/blob/master/src/Operators/Convolution.jl |
Thank you, that's indeed what I was looking for. I tried to use the package, but already the ConvolutionHelmholtz.jl example did not work. Is the SingularIntegralEquations repository discontinued? I managed to include the Convolution.jl file into my own project. However, I had to change spaces slightly, for instance Btw fyi, after testing the code I realized the following: On a domain Anyway, I think I will be able to implement what I need using Convolution.jl as a template. So thank you very much. Just for curiosity: Is there a way of mapping a function on a domain to a canonical domain? What I have in mind is to implement the convolution operator on the canonical domain and then use this to generalize to other domains. |
Hi @Jilhg, sorry for the slow reply! It isn't being actively maintained, but it wouldn't take much to get the code to work again. That code was quite experimental, so it's indeed possible that not all mapped domains are covered and all Fourier/Laurent variants. I think the ApproxFun functions |
Hi @MikaelSlevinsky, no problem, you have been a great help already. Thank you again! I checked the two functions Btw, in case you decide to revive SingularIntegralEquations.jl, I would be happy to contribute my code: I defined the convolution operator for PeriodicSegment of any real interval for both Laurent and Fourier spaces; however, only for the usual line integral, not for the singular integral (not sure what that even does). In case you don't want to revive SingularIntegralEquations.jl, but you or the community thinks having convolution operators implemented in ApproxFun would be a useful addition to the project in general, I could also try to make a pull request to implement a convolution operator in one of the maintained repositories (I guess ApproxFunFourier.jl would be natural candidate here). I have the code and it’s short and it works well, so I am quite confident that I could do that. However, just to warn you, it would be my first time contributing to such a big project. If you prefer not to include convolution operators or have doubts for any reason, I fully respect that. I just want to offer :) What do you think? |
Hi @Jilhg, did you post your code somewhere? I'm currently in the need of a convolution operator myself and have tried to combine the code from @MikaelSlevinsky and your comments into some working code, unfortunately the type signatures are throwing me for a loop. I've managed to implement a
I'm assuming this might be because I don't quite understand why |
I have used the following preliminary code so far. I checked that it works for both Laurent and Fourier spaces. I am planning on cleaning it up a bit and creating a PR in the next couple of weeks. Any feedback is welcome :)
Just copy this code into any file
which you can apply to a function normally. |
Hi @Jilhg, thank you for the swift reply! comparing to your code, it turns out I forgot to import |
Given a (periodic) function$f$ I would like to implement its convolution operator $C_f$ , i.e. an operator that I can later apply on a function to give $C_f g = \int dy f(x-y)g(y)$ .
After doing some search through the code, I don't think a convolution operator has been implemented in ApproxFun, though as a complete newbie, tbh, I am quite lost in the code. I could imagine a convolution was implemented as least implicitly, because I guess it is used for multiplying two functions over any Fourier space.
I managed to implement and explicit convolution for two functions on a Laurent() space. This is convenient, as the convolution basically just amounts to multiplying the coefficients of both functions:
It works, but it is of course not very flexible code (Note the extra phase has to be added in case the interval starts at$x_0 \neq 0$ ).
The reason I need to implement the convolution operator is that I would like to solve some linear equation that contains a convolution operator. So the above explicit implementation is not enough for me, I need to implement an operator that I can add and multiply to other operators.
From what I understand about the functionality of ApproxFun.jl I think a good implementation would look something like this:
I have the feeling all of these steps could be very easy to implement, but I am lacking the detailed understanding of how ApproxFun.jl works in the background. I would be great if someone could help me with that: How do I implement a custom operator in general? How do I take care of the conversion properly?
PS: In case others agree I would be great to add convolution operators to the general functionality of ApproxFun in the future. At least for me convolution operators appear frequently in scientific computing.
The text was updated successfully, but these errors were encountered: