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

changebasis sometimes returns incorrect nonzero element #177

Closed
hyrodium opened this issue Mar 24, 2022 · 2 comments · Fixed by #260, #261, #306 or #323
Closed

changebasis sometimes returns incorrect nonzero element #177

hyrodium opened this issue Mar 24, 2022 · 2 comments · Fixed by #260, #261, #306 or #323

Comments

@hyrodium
Copy link
Owner

julia> using BasicBSpline

julia> p = 3
3

julia> P1 = BSplineSpace{p}(KnotVector(1:8))
BSplineSpace{3, Float64}(KnotVector([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]))

julia> P2 = BSplineSpace{p}(KnotVector(2,3,3,4,5,6,7,8))
BSplineSpace{3, Float64}(KnotVector([2.0, 3.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]))

julia> changebasis(P1,P2)
4×4 Matrix{Float64}:
  0.666667      2.04041e-16  -1.41585e-16  3.30839e-16
  0.333333      1.0          -1.18601e-15  5.25506e-15
 -1.73591e-15   9.12098e-16   1.0          4.36688e-15
  9.68114e-16  -3.80046e-16   3.74332e-16  1.0
@hyrodium hyrodium changed the title changebasis sometimes return nonzero value for zero changebasis sometimes returns invalid nonzero element Mar 24, 2022
@hyrodium hyrodium changed the title changebasis sometimes returns invalid nonzero element changebasis sometimes returns incorrect nonzero element Mar 24, 2022
@hyrodium hyrodium reopened this Aug 27, 2022
@hyrodium
Copy link
Owner Author

Note that there still be some incorrect non-zero with changebasis function.

julia> using BasicBSpline

julia> p = 3
3

julia> P1 = BSplineSpace{p}(KnotVector(1:8))
BSplineSpace{3, Int64}(KnotVector([1, 2, 3, 4, 5, 6, 7, 8]))

julia> P2 = BSplineSpace{p}(KnotVector(2,3,3,4,5,6,7,8))
BSplineSpace{3, Int64}(KnotVector([2, 3, 3, 4, 5, 6, 7, 8]))

julia> BasicBSpline._changebasis_sim(P1,P2)
4×4 Matrix{Float64}:
 0.666667  0.0  0.0  0.0
 0.333333  1.0  0.0  0.0
 0.0       0.0  1.0  0.0
 0.0       0.0  0.0  1.0

julia> changebasis(P1,P2)
4×4 Matrix{Float64}:
 0.666667     0.0  0.0   0.0
 0.333333     1.0  0.0  -5.55112e-17
 3.70074e-17  0.0  1.0  -2.22045e-16
 0.0          0.0  0.0   1.0

@hyrodium hyrodium reopened this Aug 27, 2022
@hyrodium
Copy link
Owner Author

hyrodium commented Mar 2, 2023

Here's another case:

julia> p = 3
3

julia> P = BSplineSpace{p}(KnotVector(1:10))
BSplineSpace{3, Int64, KnotVector{Int64}}(KnotVector([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))

julia> P′ = BSplineSpace{p}(KnotVector([1,2,3,4,4.5,5,6,7,8.1,9.1,10.5]))
BSplineSpace{3, Float64, KnotVector{Float64}}(KnotVector([1.0, 2.0, 3.0, 4.0, 4.5, 5.0, 6.0, 7.0, 8.1, 9.1, 10.5]))

julia> changebasis(P,P′)
6×7 Matrix{Float64}:
  1.0           0.166667     0.0          0.0       0.0           0.0           0.0
  8.88178e-16   0.833333     0.5          0.0       0.0           0.0           0.0
  1.33227e-15  -5.55112e-17  0.5          0.833333  5.55112e-17   5.55112e-17  -3.05866e-16
 -5.82867e-16   4.16334e-17  4.16334e-17  0.166667  1.0          -0.0333333     0.0183333
  0.0           0.0          0.0          0.0       0.0           1.03333      -0.103333
  0.0           0.0          0.0          0.0       0.0           0.0           1.085

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment