ApproxFun.jl icon indicating copy to clipboard operation
ApproxFun.jl copied to clipboard

Diagonal Laplacians not identified

Open MikaelSlevinsky opened this issue 7 years ago • 6 comments

The Fourier Laplacians could be simplified:

julia> L = Laplacian(SinSpace()^2)
LaplacianWrapper:SinSpace(【0.0,6.283185307179586❫)⊗SinSpace(【0.0,6.283185307179586❫)→SinSpace(【0.0,6.283185307179586❫)⊗SinSpace(【0.0,6.283185307179586❫)
 -2.0   0.0   0.0    0.0   0.0    0.0    0.0    0.0    0.0    0.0  ⋯
  0.0  -5.0   0.0    0.0   0.0    0.0    0.0    0.0    0.0    0.0  ⋱
  0.0   0.0  -5.0    0.0   0.0    0.0    0.0    0.0    0.0    0.0  ⋱
  0.0   0.0   0.0  -10.0   0.0    0.0    0.0    0.0    0.0    0.0  ⋱
  0.0   0.0   0.0    0.0  -8.0    0.0    0.0    0.0    0.0    0.0  ⋱
  0.0   0.0   0.0    0.0   0.0  -10.0    0.0    0.0    0.0    0.0  ⋱
  0.0   0.0   0.0    0.0   0.0    0.0  -17.0    0.0    0.0    0.0  ⋱
  0.0   0.0   0.0    0.0   0.0    0.0    0.0  -13.0    0.0    0.0  ⋱
  0.0   0.0   0.0    0.0   0.0    0.0    0.0    0.0  -13.0    0.0  ⋱
  0.0   0.0   0.0    0.0   0.0    0.0    0.0    0.0    0.0  -17.0  ⋱
   ⋮     ⋱     ⋱      ⋱     ⋱      ⋱      ⋱      ⋱      ⋱      ⋱   ⋱

julia> isdiag(L)
false

julia> bandwidths(L)
(∞, ∞)

MikaelSlevinsky avatar Oct 16 '18 16:10 MikaelSlevinsky

I think we need a notion of a diagonal operator. Then kronecker products of diagonal operators would be diagonal.

dlfivefifty avatar Oct 16 '18 16:10 dlfivefifty

It also creates a RaggedMatrix instead of a Diagonal or BandedMatrix.

And some Fourier-based spaces (e.g. SinSpace()) don't need wrappers for Derivative, so the Laplacian shouldn't be a wrapper either.

MikaelSlevinsky avatar Oct 16 '18 16:10 MikaelSlevinsky

If you do L[Block.(1:N), Block.(1:N)] it will create a BandedBlockBandedMatrix, with diagonal bandwidths.

dlfivefifty avatar Oct 16 '18 16:10 dlfivefifty

Whether L[1:n, 1:n] should also return a BandedBlockBandedMatrix needs some thought, see https://github.com/JuliaArrays/BlockArrays.jl/issues/55

dlfivefifty avatar Oct 16 '18 16:10 dlfivefifty

Yes, the notion of a diagonal operator would be good: some integral operators are diagonal but not a finite sum of Kronecker products.

Cheers,

Mikael

On Oct 16, 2018, at 11:28 AM, Sheehan Olver <[email protected]mailto:[email protected]> wrote:

Whether L[1:n, 1:n] should also return a BandedBlockBandedMatrix needs some thought, see JuliaArrays/BlockArrays.jl#55https://github.com/JuliaArrays/BlockArrays.jl/issues/55

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/JuliaApproximation/ApproxFun.jl/issues/625#issuecomment-430304865, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHzBpc9RlO80bMhGI_hpIHFRkvlhlkYbks5ulgkYgaJpZM4Xesbk.

MikaelSlevinsky avatar Oct 18 '18 04:10 MikaelSlevinsky

I think it’ll have to wait until everything is moved to InfiniteArrays.jl, which already supports diagonal: Diagonal(1:∞).

dlfivefifty avatar Oct 18 '18 07:10 dlfivefifty

This is fixed now

julia> L = Laplacian(SinSpace()^2)
LaplacianWrapper : SinSpace(【0.0,6.283185307179586❫) ⊗ SinSpace(【0.0,6.283185307179586❫) → SinSpace(【0.0,6.283185307179586❫) ⊗ SinSpace(【0.0,6.283185307179586❫)
 -2.0    ⋅     ⋅      ⋅     ⋅      ⋅      ⋅      ⋅      ⋅      ⋅   ⋅
   ⋅   -5.0    ⋅      ⋅     ⋅      ⋅      ⋅      ⋅      ⋅      ⋅   ⋅
   ⋅     ⋅   -5.0     ⋅     ⋅      ⋅      ⋅      ⋅      ⋅      ⋅   ⋅
   ⋅     ⋅     ⋅   -10.0    ⋅      ⋅      ⋅      ⋅      ⋅      ⋅   ⋅
   ⋅     ⋅     ⋅      ⋅   -8.0     ⋅      ⋅      ⋅      ⋅      ⋅   ⋅
   ⋅     ⋅     ⋅      ⋅     ⋅   -10.0     ⋅      ⋅      ⋅      ⋅   ⋅
   ⋅     ⋅     ⋅      ⋅     ⋅      ⋅   -17.0     ⋅      ⋅      ⋅   ⋅
   ⋅     ⋅     ⋅      ⋅     ⋅      ⋅      ⋅   -13.0     ⋅      ⋅   ⋅
   ⋅     ⋅     ⋅      ⋅     ⋅      ⋅      ⋅      ⋅   -13.0     ⋅   ⋅
   ⋅     ⋅     ⋅      ⋅     ⋅      ⋅      ⋅      ⋅      ⋅   -17.0  ⋅
   ⋅     ⋅     ⋅      ⋅     ⋅      ⋅      ⋅      ⋅      ⋅      ⋅   ⋱

julia> isdiag(L)
true

julia> bandwidths(L)
(0, 0)

jishnub avatar Apr 03 '23 13:04 jishnub