Skip to content

Commit 5905279

Browse files
authored
Merge pull request #116 from vpuri3/doc-fftw
update FFTW example in doc
2 parents d519b2f + 2c30d6f commit 5905279

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

docs/src/tutorials/fftw.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,29 @@ derivative of a function.
1111
using SciMLOperators
1212
using LinearAlgebra, FFTW
1313
14-
L = 2π
15-
n = 256
14+
n = 256
15+
L = 2π
16+
1617
dx = L / n
1718
x = range(start=-L/2, stop=L/2-dx, length=n) |> Array
18-
1919
u = @. sin(5x)cos(7x);
2020
du = @. 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
3735
ik = im * DiagonalOperator(k)
38-
Dx = op_transform \ ik * op_transform
36+
Dx = L \ ik * L
3937
4038
Dx = cache_operator(Dx, x)
4139

0 commit comments

Comments
 (0)