Skip to content

Support for lazily sized maps?  #118

Open
@marius311

Description

@marius311

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,

A = LinearMap(fft, 4, 4, ismutating=false)
A * rand(4)

if I do

A * rand(5)

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), like

LinearMap(fft, :, :, ismutating=false)

and then the dimension check code could be:

A.N === (:) || length(x) == A.N || throw(DimensionMismatch())

This would clearly only be possible for ismutating=false maps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions