-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
It would be nice to have a convenience function to remove any column/slice from the last dimension of an ElasticArray
. An implementation that currently only works for an ElasticMatrix
could look like this.
function Base.deleteat!(A::ElasticArray{T,N}, at::Union{UnitRange{I}, I}) where {T,N,I <: Integer}
idx = LinearIndices(A)[:, at]
deleteat!(A.data, idx)
return A
end
u = ElasticArray{Float64}([0.0 1.0 2.0; 0.0 1.0 2.0; 0.0 1.0 2.0])
#3×3 ElasticMatrix{Float64, Vector{Float64}}:
#0.0 1.0 2.0
#0.0 1.0 2.0
#0.0 1.0 2.0
deleteat!(u, 2:3)
#3×1 ElasticMatrix{Float64, Vector{Float64}}:
#0.0
#0.0
#0.0
Do you think this would make sense? Is there an easy equivalent way to do the same already?
Metadata
Metadata
Assignees
Labels
No labels