Skip to content

Commit

Permalink
Add Backbone view method
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonOresten committed Dec 28, 2023
1 parent 344b4e3 commit ab24913
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/backbone.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ end

@inline Base.getindex(backbone::Backbone, i::Integer) = backbone.coords[:, i]
@inline Base.getindex(backbone::Backbone, r::AbstractVector{<:Integer}) = Backbone(backbone.coords[:, r])
@inline Base.view(backbone::Backbone, r::AbstractVector{<:Integer}) = Backbone(view(backbone.coords, :, r))

@inline Base.setindex!(backbone::Backbone, coords::AbstractVector, i::Integer) = (backbone[i] .= coords)
@inline Base.setindex!(backbone::Backbone, coords::AbstractMatrix, r::AbstractVector{<:Integer}) = (backbone[r].coords .= coords)
@inline Base.setindex!(backbone::Backbone, coords::AbstractMatrix, r::AbstractVector{<:Integer}) = (backbone[r].coords .= coords)

0 comments on commit ab24913

Please sign in to comment.