@@ -11,31 +11,29 @@ derivative of a function.
1111using SciMLOperators
1212using LinearAlgebra, FFTW
1313
14- L = 2π
15- n = 256
14+ n = 256
15+ L = 2π
16+
1617dx = L / n
1718x = range(start=-L/2, stop=L/2-dx, length=n) |> Array
18-
1919u = @. sin(5x)cos(7x);
2020du = @. 5cos(5x)cos(7x) - 7sin(5x)sin(7x);
2121
22- transform = plan_rfft(x)
23- k = Array(rfftfreq(n, 2π*n/L))
22+ k = rfftfreq(n, 2π*n/L) |> Array
23+ m = length(k)
24+ tr = plan_rfft(x)
2425
25- op_transform = FunctionOperator(
26- (du,u,p,t) -> mul!(du, transform, u);
27- isinplace=true,
28- T=ComplexF64,
29- size=(length(k),n),
30-
31- input_prototype=x,
32- output_prototype=im*k,
26+ L = FunctionOperator((du,u,p,t) -> mul!(du, tr, u), x, im*k;
27+ isinplace=true,
28+ T=ComplexF64,
3329
34- op_inverse = (du,u,p,t) -> ldiv!(du, transform, u)
35- )
30+ op_adjoint = (du,u,p,t) -> ldiv!(du, tr, u),
31+ op_inverse = (du,u,p,t) -> ldiv!(du, tr, u),
32+ op_adjoint_inverse = (du,u,p,t) -> ldiv!(du, tr, u),
33+ )
3634
3735ik = im * DiagonalOperator(k)
38- Dx = op_transform \ ik * op_transform
36+ Dx = L \ ik * L
3937
4038Dx = cache_operator(Dx, x)
4139
0 commit comments