Skip to content

Support more of abstract array interface #462

Open
@MilesCranmer

Description

@MilesCranmer

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions