diff --git a/matrices/laplacian/julia-laplaciano.jl b/matrices/laplacian/julia-laplaciano.jl index f38becc..0e87c4d 100644 --- a/matrices/laplacian/julia-laplaciano.jl +++ b/matrices/laplacian/julia-laplaciano.jl @@ -1,13 +1,23 @@ using SparseArrays using MAT -# 11 x 16 -nx = 11 - 1 -ny = 16 - 1 +# 20 x 20 x 20 grid +nx = 20 - 1 +ny = 20 - 1 +nz = 20 - 1 + ex = fill(1, nx) ey = fill(1, ny) +ez = fill(1, nz) + Dxx = spdiagm(-1 => ex, 0 => -2 * ex, +1 => ex) Dyy = spdiagm(-1 => ey, 0 => -2 * ey, +1 => ey) -L = kron(Dyy, spdiagm(0 => [ex; 1])) + kron(spdiagm(0 => [ey; 1]), Dxx); +Dzz = spdiagm(-1 => ez, 0 => -2 * ez, +1 => ez) + +Ix = spdiagm(0 => [ex; 1]) +Iy = spdiagm(0 => [ey; 1]) +Iz = spdiagm(0 => [ez; 1]) + +L = kron(Dxx, Iy, Iz) + kron(Ix, Dyy, Iz) + kron(Ix, Iy, Dzz) matwrite("laplacian-discretization-3d.mat", Dict("A" => L)) diff --git a/matrices/laplacian/laplacian-discretization-3d.mat b/matrices/laplacian/laplacian-discretization-3d.mat index bad09f4..f1743f6 100644 Binary files a/matrices/laplacian/laplacian-discretization-3d.mat and b/matrices/laplacian/laplacian-discretization-3d.mat differ