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

Support more of abstract array interface #462

Open
MilesCranmer opened this issue Feb 13, 2024 · 0 comments
Open

Support more of abstract array interface #462

MilesCranmer opened this issue Feb 13, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@MilesCranmer
Copy link
Contributor

Currently similar will return an array of a different type:

from juliacall import Main as jl
import numpy as np

x = np.random.randn(5)
y = jl.similar(x)

print(jl.typeof(x))
# PyArray{Float64, 1, true, true, Float64}
print(jl.typeof(y))
# Vector{Float64}

This can introduce some type instabilities in libraries due to the assumption that container type is preserved by similar.

I guess we just need the "optional methods" from here: https://docs.julialang.org/en/v1/manual/interfaces/#man-interface-array

@MilesCranmer MilesCranmer added the enhancement New feature or request label Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant