From ab249137d2c9337ea1a2885684aa76ea7d972726 Mon Sep 17 00:00:00 2001 From: anton083 Date: Thu, 28 Dec 2023 21:38:33 +0100 Subject: [PATCH] Add Backbone view method --- src/backbone.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backbone.jl b/src/backbone.jl index b8066d5..5140b99 100644 --- a/src/backbone.jl +++ b/src/backbone.jl @@ -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) \ No newline at end of file +@inline Base.setindex!(backbone::Backbone, coords::AbstractMatrix, r::AbstractVector{<:Integer}) = (backbone[r].coords .= coords)