Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
BasisSplines.jl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Juan Ignacio Polanco
BasisSplines.jl
Commits
294b3be6
Commit
294b3be6
authored
Apr 13, 2020
by
Juan Ignacio Polanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define BSpline type (similar to Spline)
parent
d1fe6ded
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
2 deletions
+41
-2
src/BasisSplines.jl
src/BasisSplines.jl
+1
-1
src/basis.jl
src/basis.jl
+39
-0
src/spline.jl
src/spline.jl
+1
-1
No files found.
src/BasisSplines.jl
View file @
294b3be6
...
...
@@ -15,7 +15,7 @@ module BasisSplines
export
Collocation
export
BSplineBasis
,
Spline
export
BSplineBasis
,
Spline
,
BSpline
export
knots
,
order
,
coefficients
export
augment_knots
export
evaluate_bspline
,
evaluate_bspline!
...
...
src/basis.jl
View file @
294b3be6
...
...
@@ -60,6 +60,45 @@ Returns order of B-splines.
order
(
::
Type
{
<:
BSplineBasis
{
k
}})
where
{
k
}
=
k
order
(
b
::
BSplineBasis
)
=
order
(
typeof
(
b
))
"""
BSpline{B <: BSplineBasis}
Describes a single B-spline in the given basis.
---
BSpline(basis::BSplineBasis, i::Int, [T = Float64])
Construct i-th B-spline in the given basis.
The constructed BSpline can be evaluated as `b(x)`, returning a value of type
`T`.
"""
struct
BSpline
{
Basis
<:
BSplineBasis
,
T
}
basis
::
Basis
i
::
Int
function
BSpline
(
b
::
BSplineBasis
,
i
,
::
Type
{
T
}
=
Float64
)
where
{
T
}
Basis
=
typeof
(
b
)
new
{
Basis
,
T
}(
b
,
i
)
end
end
basis
(
b
::
BSpline
)
=
b
.
basis
knots
(
b
::
BSpline
)
=
knots
(
basis
(
b
))
order
(
b
::
BSpline
)
=
order
(
basis
(
b
))
Base
.
eltype
(
::
Type
{
BSpline
{
B
,
T
}})
where
{
B
,
T
}
=
T
"""
(b::BSpline)(x, [Ndiff = Val(0)])
Evaluate B-spline at coordinate `x`.
To evaluate a derivative, pass the `Ndiff` parameter with the wanted
differentiation order.
"""
(
b
::
BSpline
)(
x
,
Ndiff
=
Val
(
0
))
=
evaluate_bspline
(
basis
(
b
),
b
.
i
,
x
,
eltype
(
b
),
Ndiff
=
Ndiff
)
"""
evaluate_bspline(
B::BSplineBasis, i::Integer, x, [T=Float64];
...
...
src/spline.jl
View file @
294b3be6
...
...
@@ -11,7 +11,7 @@ Construct a spline from a B-spline basis and a vector of B-spline coefficients.
"""
struct
Spline
{
k
,
# B-spline order
Basis
<:
BSplineBasis
,
T
<:
AbstractFloat
,
T
,
# type of coefficient (e.g. Float64, ComplexF64)
CoefVector
<:
AbstractVector
{
T
}}
basis
::
Basis
coefs
::
CoefVector
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment