Skip to content

Request: Return in-memory outputs by default for in-memory inputs #544

@briochemc

Description

@briochemc

How can I apply a function to in-memory inputs and return in-memory outputs? Currently it seems I have to work a lot to make sure I get in-memory outputs...

MWE:

a = YAXArray(rand(10, 20, 5)) # in memory
b = YAXArray(rand(10, 20))    # in memory

2a                       # works (lazy) but...
2a |> readcubedata       # ... throws when read! (InexactError)
2.0a |> readcubedata     # in memory (but complicated syntax)
map(x->2x, a)            # in memory (but complicated syntax)

a .+ b                   # lazy (but simple syntax)
a .+ b |> readcubedata   # in memory (but complicated syntax)
xmap(+, a, b)            # lazy
map(+, a, b)             # throws! (ERROR: chunk sizes...)

I'd like to be able to do simple in-memory broadcasts like I can with standard Julia Arrays while keeping Julia's nice syntax, e.g., for 2a and a .+ b above to return in-memory YAXArrays.

(Note that the InexactError thrown by 2a is not really the concern here: I'd be happy with 2.0a giving me an in-memory array!)


EDIT: I may be missing some motivation behind the current behavior but getting in-memory outputs when all inputs are in-memory seems like a reasonable default to me.

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