-
Notifications
You must be signed in to change notification settings - Fork 42
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
Support for lazily sized maps? #118
Comments
The original motivation for this package was that If really all you have is a function that you would like to use in a Krylov algorithm, you could try KrylovKit.jl, which even doesn't care about the size of the vectors that you combine it with. |
My use-case isn't so much that I already have a function, but that its really convenient to use this package's composition to build one, before feeding it into various algorithms, including Kyrlov ones. As an example, say I want to Wiener filter some data where my signal is diagonal in Fourier space. I'm envisioning doing something like: signal_spectrum = ... # some vector
noise_variance = ... # some vector
S = LinearMap(Diagonal(signal_spectrum))
N = LinearMap(Diagonal(noise_variance))
F = LinearMap(fft, ifft, :, :, ismutating=false)
(F' * S * F) * conjugate_gradient(F' * S * F + N, data) # compute Wiener filter and it would be really nice not to have to specify the size of Anyway, just want to give a flavor of what I'm doing, I can understand if ultimately you don't think its a good fit for this package. |
So do the vectors
Furthermore, in the case 2, I don't see why not just defining |
Yea, its exactly case 2, and the answer to your quesion is what I was referring to with
Some other examples of operators I have that are lazily sized are a spatial gradient operator (bound to Maybe I fork this and play around with it for a while, and come back if I have a more definite proposal. I'm not super familiar with this code but on quick glance it kind of seems like loosening |
My own work is typically in 2D and 3D so |
Also, operations like up-sampling are non-square so I think there would need to be a way to describe the "aspect ratio" for this to all work with other operations like |
My work is indeed 2D (maps of the Cosmic Microwave Background). I had seen LinearMapsAA but missed the arrays to arrays part. In what I do, I handle this with a custom array type which is pretty similar to ComponentArrays, in that it splays out a Matrix into a Vector representation. The example from you link is one I should have mentioned here too, lazily sized maps is exactly what |
I've been toying with replacing some of my hand-written LinearMap-like code with this package, which is much nicer than what I have. But one roadblock is that to be really useful, I'd need support for "lazily sized" or "unsized" function maps. Basically, a map which can implicilty take on any size it needs to depending on the vector its being applied to. The FFT is one example. While I can write,
if I do
its a dimension error, even though the code would work if it just didn't do the dimension check
I'm curious whether there's any interest in adding something to let this work? Quite possibly it breaks some other more complex things LinearMaps does? One interface which seems reasonable to me would be to let the user pass
:
for the dimension (Any
might be another option), likeand then the dimension check code could be:
This would clearly only be possible for
ismutating=false
maps.The text was updated successfully, but these errors were encountered: