Skip to content

Implement pointer and resize! for VectorOfArray #300

Closed
@ranocha

Description

@ranocha

This came up in https://github.com/SciML/OrdinaryDiffEq.jl/pull/2087/files and the related PR SciML/SciMLBase.jl#561. It would be great if the following operations were allowed:

julia> using Pkg; Pkg.activate(temp = true); Pkg.add(["StaticArrays", "RecursiveArrayTools"])
[...]
  [731186ca] + RecursiveArrayTools v3.0.0
  [90137ffa] + StaticArrays v1.7.0
[...]

julia> using StaticArrays, RecursiveArrayTools

julia> u = VectorOfArray(ones(SVector{2, Float64}))
VectorOfArray{Float64,1}:
2-element SVector{2, Float64} with indices SOneTo(2):
 1.0
 1.0

julia> resize!(u, 5)
ERROR: MethodError: no method matching resize!(::VectorOfArray{Float64, 1, SVector{2, Float64}}, ::Int64)
[...]

julia> pointer(u)
ERROR: MethodError: no method matching pointer(::VectorOfArray{Float64, 1, SVector{2, Float64}})
[...]

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