Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add copy(::SubKnotVector) #341

Merged
merged 3 commits into from
Nov 11, 2023
Merged

Add copy(::SubKnotVector) #341

merged 3 commits into from
Nov 11, 2023

Conversation

hyrodium
Copy link
Owner

Before this PR

julia> using BasicBSpline

julia> k = KnotVector(1:8)
KnotVector([1, 2, 3, 4, 5, 6, 7, 8])

julia> view(k, 1:3)
SubKnotVector([1, 2, 3])

julia> copy(view(k, 1:3))
ERROR: MethodError: no method matching copy(::SubKnotVector{Int64, SubArray{Int64, 1, Vector{Int64}, Tuple{UnitRange{Int64}}, true}})

Closest candidates are:
  copy(::Base.ReshapedArray{<:Any, 2, <:SparseArrays.AbstractSparseMatrixCSC})
   @ SparseArrays ~/.julia/juliaup/julia-1.9.3+0.x64.linux.gnu/share/julia/stdlib/v1.9/SparseArrays/src/sparsematrix.jl:508
  copy(::Base.IdSet)
   @ Base idset.jl:16
  copy(::LinearAlgebra.Tridiagonal)
   @ LinearAlgebra ~/.julia/juliaup/julia-1.9.3+0.x64.linux.gnu/share/julia/stdlib/v1.9/LinearAlgebra/src/tridiag.jl:613
  ...

After this PR

julia> using BasicBSpline

julia> k = KnotVector(1:8)
KnotVector([1, 2, 3, 4, 5, 6, 7, 8])

julia> view(k, 1:3)
SubKnotVector([1, 2, 3])

julia> copy(view(k, 1:3))
KnotVector([1, 2, 3])

Copy link

codecov bot commented Nov 11, 2023

Codecov Report

Merging #341 (c7918bf) into main (4259f0c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #341   +/-   ##
=======================================
  Coverage   97.02%   97.02%           
=======================================
  Files          14       14           
  Lines        1546     1547    +1     
=======================================
+ Hits         1500     1501    +1     
  Misses         46       46           
Files Coverage Δ
src/_KnotVector.jl 95.45% <100.00%> (+0.02%) ⬆️

@hyrodium hyrodium merged commit 474e85d into main Nov 11, 2023
13 checks passed
@hyrodium hyrodium deleted the feature/copy_SubKnotVector branch November 12, 2023 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant