|
3 | 3 | # Generic approximation |
4 | 4 | ######################## |
5 | 5 |
|
| 6 | +const ANYFUNCTION = Union{Function,Expansion,TypedFunction} |
| 7 | + |
6 | 8 | """ |
7 | 9 | The `approximation` function returns an operator that can be used to approximate |
8 | 10 | a function in the function set. This operator maps a grid to a set of coefficients. |
|
23 | 25 | continuous_approximation(Φ::Dictionary; options...) = inv(gram(Φ; options...)) |
24 | 26 |
|
25 | 27 | # Automatically sample a function if an operator is applied to it |
26 | | -(*)(op::DictionaryOperator, f::Function) = op * project(src(op), f) |
27 | | -Base.:\(op::DictionaryOperator, f::Function) = op \ project(dest(op), f) |
| 28 | +(*)(op::DictionaryOperator, f::ANYFUNCTION) = op * project(src(op), f) |
| 29 | +Base.:\(op::DictionaryOperator, f::ANYFUNCTION) = op \ project(dest(op), f) |
28 | 30 |
|
29 | | -project(Φ::GridBasis, f::Function; options...) = sample(Φ, f) |
| 31 | +project(Φ::GridBasis, f::ANYFUNCTION; options...) = sample(Φ, f) |
30 | 32 |
|
31 | 33 | approximate(Φ::Dictionary, f::Function; options...) = |
32 | 34 | Expansion(Φ, approximation(Φ; options...) * f) |
33 | 35 |
|
34 | | -""" |
35 | | -The 2-argument approximation exists to allow you to transform any |
36 | | -Dictionary coefficients to any other Dictionary coefficients, including |
37 | | -Discrete Grid Spaces. |
38 | | -If a transform exists, the transform is used. |
39 | | -""" |
40 | | -function approximation(A::Dictionary, B::Dictionary, options...) |
41 | | - if hastransform(A, B) |
42 | | - return transform(A, B; options...) |
43 | | - else |
44 | | - error("Don't know a transform from ", A, " to ", B) |
45 | | - end |
46 | | -end |
47 | 36 |
|
48 | 37 |
|
49 | 38 | ################# |
@@ -78,7 +67,7 @@ default_interpolation(Φ::Dictionary, gb::GridBasis; options...) = |
78 | 67 | default_interpolation(::Type{T}, Φ::Dictionary, gb::GridBasis; options...) where {T} = |
79 | 68 | QR_solver(evaluation(T, Φ, grid(gb))) |
80 | 69 |
|
81 | | -interpolate(Φ::Dictionary, pts, f, T=coefficienttype(s)) = Expansion(interpolation(T, Φ, pts) * f) |
| 70 | +interpolate(Φ::Dictionary, pts, f, T=coefficienttype(Φ)) = Expansion(Φ,interpolation(T, Φ, pts) * f) |
82 | 71 |
|
83 | 72 | """ |
84 | 73 | Compute the weights of an interpolatory quadrature rule. |
|
0 commit comments