Skip to content

Embrace view for subspaces #21

Closed
Closed
@dlfivefifty

Description

@dlfivefifty

At the moment the following makes a lazy *, but I think it should be left as a view:

julia> S = LinearSpline{Float64}(0.0:3);

julia> S[:,2:end-1] # Lazy S * Project
QuasiArrays.ApplyQuasiArray{Float64,2,typeof(*),Tuple{Spline{1,Float64},BandedMatrices.BandedMatrix{Int64,FillArrays.Ones{Int64,2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}},Base.OneTo{Int64}}}}(*, (Spline{1,Float64}([0.0, 1.0, 2.0, 3.0]), [0 0; 1 0; 0 1; 0 0]))

julia> view(S,:,2:size(S,2)-1) # proposal: returns this
QuasiArrays.SubQuasiArray{Float64,2,Spline{1,Float64},Tuple{Inclusion{Float64,IntervalSets.Interval{:closed,:closed,Float64}},UnitRange{Int64}},false}(Spline{1,Float64}([0.0, 1.0, 2.0, 3.0]), (Inclusion(0.0..3.0), 2:3), 0, 0)

I believe this is what you were asking for @jagot.

The steps to make it work are

  • Support lazy multiplication with views
  • Fix getindex for lazy multiplication of views
  • Lower D*view(S,:,kr) to view(D*S,:,kr)

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