Repository: hyrodium/BasicBSpline.jl (julia)

Issue:
missing constructor `BSplineSpace`
```julia
julia> using BasicBSpline

julia> BSplineSpace{3}(knotvector"111111111111")
BSplineSpace{3, Int64, KnotVector{Int64}}(KnotVector([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]))

julia> BSplineSpace{3, Int64, KnotVector{Int64}}(KnotVector([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]))
ERROR: MethodError: no method matching BSplineSpace{3, Int64, KnotVector{Int64}}(::KnotVector{Int64})

Closest candidates are:
  BSplineSpace{p, T, K}(::BSplineSpace{p, T} where T<:Real) where {p, T, K}
```

Pull request description:
This PR fixes https://github.com/hyrodium/BasicBSpline.jl/issues/335.

Patch:
diff --git a/src/_BSplineSpace.jl b/src/_BSplineSpace.jl
index cbb5c20ba..08aff29f9 100644
--- a/src/_BSplineSpace.jl
+++ b/src/_BSplineSpace.jl
@@ -54,6 +54,9 @@ end
 function BSplineSpace{p,T,K}(P::BSplineSpace{p}) where {p,T,K}
     return BSplineSpace{p,T}(K(knotvector(P)))
 end
+function BSplineSpace{p,T,K}(k::AbstractKnotVector) where {p,T,K}
+    return BSplineSpace{p,T}(K(k))
+end
 
 # Broadcast like a scalar
 Base.Broadcast.broadcastable(P::BSplineSpace) = Ref(P)


Test patch:
diff --git a/test/test_BSplineSpace.jl b/test/test_BSplineSpace.jl
index 2402a0b4e..aec0451c6 100644
--- a/test/test_BSplineSpace.jl
+++ b/test/test_BSplineSpace.jl
@@ -6,9 +6,10 @@
         P4 = BSplineSpace{2,Real}(P1)
         P5 = BSplineSpace{2,Float64}(P1)
         P6 = BSplineSpace{2,Float64}(KnotVector(1:8))
+        P7 = BSplineSpace{2,Float64,KnotVector{Float64}}(KnotVector(1:8))
         @test P1 == P2 == P3 == P4 == P5 == bsplinespace(P1) == bsplinespace(P2) == bsplinespace(P3) == bsplinespace(P4) == bsplinespace(P5)
-        @test P5 == P6
-        @test typeof(P5) === typeof(P6)
+        @test P5 == P6 == P7
+        @test typeof(P5) === typeof(P6) === typeof(P7)
         @test P1 isa BSplineSpace{2,Int}
         @test P2 isa BSplineSpace{2,Int}
         @test P3 isa BSplineSpace{2,Int}