Repository: hyrodium/BasicBSpline.jl
Pull request #114 (2021-12-26 16:54:12)

Rename `bplineunity` to `domain`, etc.


Patch:
diff --git a/src/BasicBSpline.jl b/src/BasicBSpline.jl
index 676d2a59..6393bbb8 100644
--- a/src/BasicBSpline.jl
+++ b/src/BasicBSpline.jl
@@ -9,7 +9,7 @@ export BSplineDerivativeSpace
 export BSplineManifold, CustomBSplineManifold
 export bsplinebasis₊₀, bsplinebasis₋₀, bsplinebasis
 export bsplinebasis′₊₀, bsplinebasis′₋₀, bsplinebasis′
-export bsplinesupport, bsplineunity, changebasis
+export bsplinesupport, domain, changebasis
 export bsplinebasisall, intervalindex
 export refinement, bsplinespaces, controlpoints
 export isproper, properdim
diff --git a/src/_BSplineSpace.jl b/src/_BSplineSpace.jl
index c5b1737c..3f67ee7c 100644
--- a/src/_BSplineSpace.jl
+++ b/src/_BSplineSpace.jl
@@ -34,7 +34,7 @@ end
     return P.knots
 end
 
-function bsplineunity(P::AbstractBSplineSpace)
+function domain(P::AbstractBSplineSpace)
     p = degree(P)
     k = knots(P)
     return k[1+p]..k[end-p]
@@ -84,7 +84,7 @@ function issqsubset(P::AbstractBSplineSpace{p}, P′::AbstractBSplineSpace{p′}
 
     if p₊ < 0
         return false
-    elseif bsplineunity(P) ≠ bsplineunity(P′)
+    elseif domain(P) ≠ domain(P′)
         return false
     end
 
diff --git a/src/_ChangeBasis.jl b/src/_ChangeBasis.jl
index 535756d1..434438d4 100644
--- a/src/_ChangeBasis.jl
+++ b/src/_ChangeBasis.jl
@@ -135,7 +135,7 @@ Assumption:
 * ``P ⊑ P′``
 """
 function _changebasis_I(P::BSplineSpace{p,T}, P′::BSplineSpace{p′,T})::Matrix{T} where {p, p′, T}
-    I = bsplineunity(P)
+    I = domain(P)
     k = knots(P)
     k′ = knots(P′)
     p₊ = p′ - p
diff --git a/src/_Derivative.jl b/src/_Derivative.jl
index 124ca562..7e6aba42 100644
--- a/src/_Derivative.jl
+++ b/src/_Derivative.jl
@@ -10,8 +10,10 @@ end
 bsplinespace(dP::BSplineDerivativeSpace) = dP.bsplinespace
 knots(dP::BSplineDerivativeSpace) = knots(bsplinespace(dP))
 degree(dP::BSplineDerivativeSpace{r,<:AbstractBSplineSpace{p}}) where {r,p} = p - r
-dim(dP::BSplineDerivativeSpace{r,<:AbstractBSplineSpace{p}}) where {r,p} = dim(bsplinespace(dP)) - r
+dim(dP::BSplineDerivativeSpace{r,<:AbstractBSplineSpace{p}}) where {r,p} = dim(bsplinespace(dP))
+properdim(dP::BSplineDerivativeSpace{r,<:AbstractBSplineSpace{p}}) where {r,p} = properdim(bsplinespace(dP)) - r
 intervalindex(dP::BSplineDerivativeSpace,t::Real) = intervalindex(bsplinespace(dP),t)
+domain(dP::BSplineDerivativeSpace) = domain(bsplinespace(dP))
 _lower(dP::BSplineDerivativeSpace{r}) where r = BSplineDerivativeSpace{r-1}(_lower(bsplinespace(dP)))
 
 @generated function bsplinebasis₊₀(P::BSplineDerivativeSpace{r,BSplineSpace{p,T}}, i::Integer, t::Real) where {r, p, T}
@@ -193,4 +195,3 @@ function bsplinebasisall(dP::BSplineDerivativeSpace{0,BSplineSpace{p,T}}, i::Int
 end
 
 # TODO: Add issubset(::BSplineDerivativeSpace, i, t)
-# TODO: Add bsplineunity(::BSplineDerivativeSpace)


Test patch:
diff --git a/test/test_Derivative.jl b/test/test_Derivative.jl
index d3c6770b..73964747 100644
--- a/test/test_Derivative.jl
+++ b/test/test_Derivative.jl
@@ -47,7 +47,9 @@
             Pa = BSplineDerivativeSpace{r}(P)
             Pb = BSplineDerivativeSpace{r-1}(P)
             @test degree(Pa) == p-r
-            @test dim(Pa) == dim(P)-r
+            @test dim(Pa) == dim(P)
+            @test properdim(Pa) == properdim(P)-r
+            @test domain(P) == domain(Pa) == domain(Pb)
             for t in ts, i in 1:dim(P)
                 d1 = bsplinebasis(Pa,i,t)
                 d2 = (bsplinebasis(Pb,i,t+dt) - bsplinebasis(Pb,i,t-dt))/2dt