-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constructors from Kronecker Products? #62
Comments
What's using LazyBandedMatrices, BandedMatrices, BlockBandedMatrices, FillArrays, LazyArrays
N = 2
Ix = Iy = BandedMatrix(Eye(N,N))
julia> BandedBlockBandedMatrix(Kron(Ix,Iy))
2×2-blocked 4×4 BandedBlockBandedMatrix{Float64,BlockArrays.PseudoBlockArray{Float64,2,Array{Float64,2},Tuple{BlockArrays.BlockedUnitRange{Array{Int64,1}},BlockArrays.BlockedUnitRange{Array{Int64,1}}}},BlockArrays.BlockedUnitRange{Array{Int64,1}}}:
1.0 ⋅ │ ⋅ ⋅
⋅ 1.0 │ ⋅ ⋅
──────────┼──────────
⋅ ⋅ │ 1.0 ⋅
⋅ ⋅ │ ⋅ 1.0 |
const Mx = Tridiagonal([1.0 for i in 1:N-1],[-2.0 for i in 1:N],[1.0 for i in 1:N-1])
const My = copy(Mx)
Mx[2,1] = 2.0
Mx[end-1,end] = 2.0
My[1,2] = 2.0
My[end,end-1] = 2.0 |
Seems like there's some missing methods: using LinearAlgebra, LazyBandedMatrices, BandedMatrices, BlockBandedMatrices, FillArrays, LazyArrays
N = 32
Mx = Tridiagonal([1.0 for i in 1:N-1],[-2.0 for i in 1:N],[1.0 for i in 1:N-1])
My = copy(Mx)
Mx[2,1] = 2.0
Mx[end-1,end] = 2.0
My[1,2] = 2.0
My[end,end-1] = 2.0
Ix = BandedMatrix(Eye(N,N))
Iy = BandedMatrix(Eye(N,N))
Ix = SparseMatrixCSC(I,N,N)
fJ = ones(3,3)
Dz = [1 0 0
0 0 0
0 0 0]
A = BlockBandedMatrix(Kron(Dz,Iy,sparse(Mx))) +
BlockBandedMatrix(Kron(Dz,sparse(My),Ix)) +
BlockBandedMatrix(Kron(fJ,Iy,Ix))
|
This example is trying to do SciML/SciMLBenchmarks.jl#91 but create a BandedBlockBandedMatrix, instead of doing a flat sparse matrix from SparsityDetection.jl |
You don’t want dense arguments (e.g. Also, is a triple kron correspondent to a 3D PDE? That would require a more sophisticated data structure... |
It's a system of 3 2D PDEs. |
It's essentially
The dense matrix is then the sparsity pattern of |
Yes that still requires a more sophisticated data structure: I believe if we interlace the rows one gets a banded-block-banded structure, which is what ApproxFun does but with a hacky implementation ( |
Got it. I thought it ended up as a block banded matrix in the end (but not banded block banded). It should be blocks of the block banded matrix of the 2D Laplacian operator. |
Usually these types of matrices from from PDEs where they can be constructed from the Kronecker product of the actions along each dimension, like:
Could there be a way like that last statement to directly form a BlockBandedMatrix or BandedBlockBandedMatrix?
The text was updated successfully, but these errors were encountered: