Knot vector
Definition
A finite sequence
\[k = (k_1, \dots, k_l)\]
is called knot vector if the sequence is broad monotonic increase, i.e. $k_{i} \le k_{i+1}$.
[TODO: fig]
BasicBSpline.KnotVector
— TypeConstruct knot vector from given array.
\[k=(k_1,\dots,k_l)\]
Examples
julia> k = KnotVector([1,2,3])
KnotVector([1, 2, 3])
julia> k = KnotVector(1:3)
KnotVector([1, 2, 3])
BasicBSpline.UniformKnotVector
— TypeConstruct uniform knot vector from given range.
\[k=(k_1,\dots,k_l)\]
Examples
julia> k = UniformKnotVector(1:8)
UniformKnotVector(1:8)
julia> UniformKnotVector(8:-1:3)
UniformKnotVector(3:1:8)
BasicBSpline.EmptyKnotVector
— TypeKnot vector with zero-element.
\[k=()\]
This struct is intended for internal use.
Examples
julia> EmptyKnotVector()
EmptyKnotVector{Bool}()
julia> EmptyKnotVector{Float64}()
EmptyKnotVector{Float64}()
Operations for knot vectors
Base.length
— MethodLength of knot vector
\[\begin{aligned} \#{k} &=(\text{number of knot elements of} \ k) \\ \end{aligned}\]
For example, $\#{(1,2,2,3)}=4$.
Examples
julia> k = KnotVector([1,2,2,3]);
julia> length(k)
4
Although a knot vector is not a vector in linear algebra, but we introduce additional operator $+$.
Base.:+
— MethodSum of knot vectors
\[\begin{aligned} k^{(1)}+k^{(2)} &=(k^{(1)}_1, \dots, k^{(1)}_{l^{(1)}}) + (k^{(2)}_1, \dots, k^{(2)}_{l^{(2)}}) \\ &=(\text{sort of union of} \ k^{(1)} \ \text{and} \ k^{(2)} \text{)} \end{aligned}\]
For example, $(1,2,3,5)+(4,5,8)=(1,2,3,4,5,5,8)$.
Examples
julia> k1 = KnotVector([1,2,3,5]);
julia> k2 = KnotVector([4,5,8]);
julia> k1 + k2
KnotVector([1, 2, 3, 4, 5, 5, 8])
Note that the operator +(::KnotVector, ::KnotVector)
is commutative. This is why we choose the $+$ sign. We also introduce product operator $\cdot$ for knot vector.
Base.:*
— MethodProduct of integer and knot vector
\[\begin{aligned} m\cdot k&=\underbrace{k+\cdots+k}_{m} \end{aligned}\]
For example, $2\cdot (1,2,2,5)=(1,1,2,2,2,2,5,5)$.
Examples
julia> k = KnotVector([1,2,2,5]);
julia> 2 * k
KnotVector([1, 1, 2, 2, 2, 2, 5, 5])
Inclusive relationship between knot vectors.
Base.issubset
— MethodCheck a inclusive relationship $k\subseteq k'$, for example:
\[\begin{aligned} (1,2) &\subseteq (1,2,3) \\ (1,2,2) &\not\subseteq (1,2,3) \\ (1,2,3) &\subseteq (1,2,3) \\ \end{aligned}\]
Examples
julia> KnotVector([1,2]) ⊆ KnotVector([1,2,3])
true
julia> KnotVector([1,2,2]) ⊆ KnotVector([1,2,3])
false
julia> KnotVector([1,2,3]) ⊆ KnotVector([1,2,3])
true
Base.unique
— MethodUnique elements of knot vector.
\[\begin{aligned} \widehat{k} &=(\text{unique knot elements of} \ k) \\ \end{aligned}\]
For example, $\widehat{(1,2,2,3)}=(1,2,3)$.
Examples
julia> k = KnotVector([1,2,2,3]);
julia> unique(k)
KnotVector([1, 2, 3])
BasicBSpline.countknots
— MethodFor given knot vector $k$, the following function $\mathfrak{n}_k:\mathbb{R}\to\mathbb{Z}$ represents the number of knots that duplicate the knot vector $k$.
\[\mathfrak{n}_k(t) = \#\{i \mid k_i=t \}\]
For example, if $k=(1,2,2,3)$, then $\mathfrak{n}_k(0.3)=0$, $\mathfrak{n}_k(1)=1$, $\mathfrak{n}_k(2)=2$.
julia> k = KnotVector([1,2,2,3]);
julia> countknots(k,0.3)
0
julia> countknots(k,1.0)
1
julia> countknots(k,2.0)
2