-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial progress on Hermitian eigendecomposition
- Loading branch information
Showing
12 changed files
with
200 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# TODO: This needs to be done more carefully by | ||
# grabbing upper or lower triangles of the parent matrix. | ||
nonzero_keys(a::Hermitian) = nonzero_keys(parent(a)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function nonzero_keys(a::Transpose) | ||
return ( | ||
CartesianIndex(reverse(Tuple(parent_index))) for | ||
parent_index in nonzero_keys(parent(a)) | ||
) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 13 additions & 4 deletions
17
NDTensors/src/arraystorage/blocksparsearray/storage/eigen.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
function LinearAlgebra.eigen(a::BlockSparseArray; kwargs...) | ||
function LinearAlgebra.eigen(a::BlockSparseArray) | ||
return error("Not implemented") | ||
end | ||
|
||
# TODO: Maybe make `Hermitian` partially eager for `BlockSparseArray`? | ||
function LinearAlgebra.eigen( | ||
a::Union{Hermitian{<:Real,<:BlockSparseArray},Hermitian{<:Complex,<:BlockSparseArray}}; | ||
kwargs..., | ||
a::Union{Hermitian{<:Real,<:BlockSparseArray},Hermitian{<:Complex,<:BlockSparseArray}} | ||
) | ||
return error("Not implemented") | ||
# TODO: Test `a` is block diagonal. | ||
# @assert is_block_diagonal(a) | ||
d = BlockSparseArray{real(eltype(a))}(axes(a, 1)) | ||
u = BlockSparseArray{eltype(a)}(axes(a)) | ||
for b in nonzero_blockkeys(a) | ||
d_b, u_b = eigen(@view a[b]) | ||
d[BlockArrays.Block(b.n[1])] = d_b | ||
u[b] = u_b | ||
end | ||
return d, u | ||
end |
Oops, something went wrong.