|
32 | 32 | array::AbstractArray{Tel,N}, |
33 | 33 | interpolationType::DimSpec{<:Gridded}) |
34 | 34 |
|
35 | | - Construct a GriddedInterpolation for generic knots from an AbstractArray |
| 35 | +Construct a GriddedInterpolation for generic knots from an AbstractArray |
36 | 36 | """ |
37 | 37 | function GriddedInterpolation(::Type{TWeights}, knots::NTuple{N,GridIndex}, A::AbstractArray{Tel,N}, it::IT) where {N,Tel,TWeights<:Real,IT<:DimSpec{Gridded}} |
38 | 38 | isconcretetype(IT) || error("The b-spline type must be a leaf type (was $IT)") |
|
53 | 53 | array::AbstractArray{TCoefs,N}, |
54 | 54 | interpolationType::DimSpec{<:Gridded}) |
55 | 55 |
|
56 | | - Construct a GriddedInterpolation for generic knots from an AbstractUnitRange. |
| 56 | +Construct a GriddedInterpolation for generic knots from an AbstractUnitRange. |
57 | 57 |
|
58 | | - AbstractUnitRanges are collected to an Array to not confuse bound calculations (See Issue #398) |
| 58 | +AbstractUnitRanges are collected to an Array to not confuse bound calculations (See Issue #398) |
59 | 59 | """ |
60 | 60 | function GriddedInterpolation(tw::Type{TWeights}, knots::NTuple{N,AbstractUnitRange}, A::AbstractArray{TCoefs,N}, it::IT) where {N,TCoefs,TWeights<:Real,IT<:DimSpec{Gridded}} |
61 | 61 | # Fix Issue 398: Ensure that gridded_*bounds is used by converting |
@@ -88,35 +88,35 @@ degree(flag::Gridded) = flag.degree |
88 | 88 | """ |
89 | 89 | Interpolations.deduplicate_knots!(knots; move_knots = false) |
90 | 90 |
|
91 | | - Makes knots unique by incrementing repeated but otherwise sorted knots using `nextfloat`. |
92 | | - If keyword `move_knots` is true, then `nextfloat` will be applied successively until knots |
93 | | - are unique. Otherwise, a warning will be issued. |
94 | | -
|
95 | | - # Example |
96 | | -
|
97 | | - ```jldoctest |
98 | | - julia> knots = [-8.0, 0.0, 20.0, 20.0] |
99 | | - 4-element Vector{Float64}: |
100 | | - -8.0 |
101 | | - 0.0 |
102 | | - 20.0 |
103 | | - 20.0 |
104 | | -
|
105 | | - julia> Interpolations.deduplicate_knots!(knots) |
106 | | - 4-element Vector{Float64}: |
107 | | - -8.0 |
108 | | - 0.0 |
109 | | - 20.0 |
110 | | - 20.000000000000004 |
111 | | -
|
112 | | - julia> Interpolations.deduplicate_knots!([1.0, 1.0, 1.0, nextfloat(1.0), nextfloat(1.0)]; move_knots = true) |
113 | | - 5-element Vector{Float64}: |
114 | | - 1.0 |
115 | | - 1.0000000000000002 |
116 | | - 1.0000000000000004 |
117 | | - 1.0000000000000007 |
118 | | - 1.0000000000000009 |
119 | | - ``` |
| 91 | +Makes knots unique by incrementing repeated but otherwise sorted knots using `nextfloat`. |
| 92 | +If keyword `move_knots` is true, then `nextfloat` will be applied successively until knots |
| 93 | +are unique. Otherwise, a warning will be issued. |
| 94 | +
|
| 95 | +# Example |
| 96 | +
|
| 97 | +```jldoctest |
| 98 | +julia> knots = [-8.0, 0.0, 20.0, 20.0] |
| 99 | +4-element Vector{Float64}: |
| 100 | +-8.0 |
| 101 | +0.0 |
| 102 | +20.0 |
| 103 | +20.0 |
| 104 | +
|
| 105 | +julia> Interpolations.deduplicate_knots!(knots) |
| 106 | +4-element Vector{Float64}: |
| 107 | +-8.0 |
| 108 | +0.0 |
| 109 | +20.0 |
| 110 | +20.000000000000004 |
| 111 | +
|
| 112 | +julia> Interpolations.deduplicate_knots!([1.0, 1.0, 1.0, nextfloat(1.0), nextfloat(1.0)]; move_knots = true) |
| 113 | +5-element Vector{Float64}: |
| 114 | +1.0 |
| 115 | +1.0000000000000002 |
| 116 | +1.0000000000000004 |
| 117 | +1.0000000000000007 |
| 118 | +1.0000000000000009 |
| 119 | +``` |
120 | 120 | """ |
121 | 121 | function deduplicate_knots!(knots; move_knots::Bool = false) |
122 | 122 | last_knot = first(knots) |
|
0 commit comments