-
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.
- Loading branch information
Showing
3 changed files
with
20 additions
and
1 deletion.
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
18 changes: 18 additions & 0 deletions
18
NDTensors/src/lib/BlockSparseArrays/src/abstractblocksparsearray/linearalgebra.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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using LinearAlgebra: Adjoint, Transpose | ||
|
||
# Like: https://github.com/JuliaLang/julia/blob/v1.11.1/stdlib/LinearAlgebra/src/transpose.jl#L184 | ||
# but also takes the dual of the axes. | ||
# Fixes an issue raised in: | ||
# https://github.com/ITensor/ITensors.jl/issues/1336#issuecomment-2353434147 | ||
function Base.copy(a::Adjoint{T,<:AbstractBlockSparseMatrix{T}}) where {T} | ||
a_dest = similar(parent(a), axes(a)) | ||
a_dest .= a | ||
return a_dest | ||
end | ||
|
||
# More efficient than the generic `LinearAlgebra` version. | ||
function Base.copy(a::Transpose{T,<:AbstractBlockSparseMatrix{T}}) where {T} | ||
a_dest = similar(parent(a), axes(a)) | ||
a_dest .= a | ||
return a_dest | ||
end |