Skip to content

Commit 5eaf71c

Browse files
committed
little bit of cleanup
1 parent e56b92f commit 5eaf71c

File tree

3 files changed

+14
-29
lines changed

3 files changed

+14
-29
lines changed

src/tensors/factorizations/factorizations.jl

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export leftorth, leftorth!, rightorth, rightorth!
99
export leftnull, leftnull!, rightnull, rightnull!
1010
export copy_oftype, permutedcopy_oftype, one!
1111
export TruncationScheme, notrunc, truncbelow, truncerr, truncdim, truncspace, PolarViaSVD
12-
#export LAPACK_HouseholderQR, LAPACK_HouseholderLQ
1312

1413
using ..TensorKit
1514
using ..TensorKit: AdjointTensorMap, SectorDict, OFA, blocktype, foreachblock, one!
@@ -60,30 +59,17 @@ end
6059
const RealOrComplexFloat = Union{AbstractFloat,Complex{<:AbstractFloat}}
6160

6261
#------------------------------#
63-
# Singular value decomposition #
62+
# LinearAlgebra overloads
6463
#------------------------------#
65-
function LinearAlgebra.svdvals!(t::TensorMap{<:RealOrComplexFloat})
66-
return SectorDict(c => LinearAlgebra.svdvals!(b) for (c, b) in blocks(t))
67-
end
68-
LinearAlgebra.svdvals!(t::AdjointTensorMap) = svdvals!(adjoint(t))
69-
70-
#--------------------------#
71-
# Eigenvalue decomposition #
72-
#--------------------------#
73-
74-
function LinearAlgebra.eigvals!(t::TensorMap{<:RealOrComplexFloat}; kwargs...)
75-
return SectorDict(c => complex(LinearAlgebra.eigvals!(b; kwargs...))
76-
for (c, b) in blocks(t))
77-
end
78-
function LinearAlgebra.eigvals!(t::AdjointTensorMap{<:RealOrComplexFloat}; kwargs...)
79-
return SectorDict(c => conj!(complex(LinearAlgebra.eigvals!(b; kwargs...)))
80-
for (c, b) in blocks(t))
81-
end
64+
LinearAlgebra.svdvals(t::AbstractTensorMap) = diagview(svd_vals(t))
65+
LinearAlgebra.svdvals!(t::AbstractTensorMap) = diagview(svd_vals!(t))
66+
LinearAlgebra.eigvals(t::AbstractTensorMap) = diagview(eigvals(t))
67+
LinearAlgebra.eigvals!(t::AbstractTensorMap) = diagview(eigvals!(t))
8268

8369
#--------------------------------------------------#
8470
# Checks for hermiticity and positive definiteness #
8571
#--------------------------------------------------#
86-
function LinearAlgebra.ishermitian(t::TensorMap)
72+
function LinearAlgebra.ishermitian(t::AbstractTensorMap)
8773
domain(t) == codomain(t) || return false
8874
InnerProductStyle(t) === EuclideanInnerProduct() || return false # hermiticity only defined for euclidean
8975
for (c, b) in blocks(t)
@@ -92,7 +78,7 @@ function LinearAlgebra.ishermitian(t::TensorMap)
9278
return true
9379
end
9480

95-
function LinearAlgebra.isposdef!(t::TensorMap)
81+
function LinearAlgebra.isposdef!(t::AbstractTensorMap)
9682
domain(t) == codomain(t) ||
9783
throw(SpaceMismatch("`isposdef` requires domain and codomain to be the same"))
9884
InnerProductStyle(spacetype(t)) === EuclideanInnerProduct() || return false

src/tensors/linalg.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ end
179179

180180
# Diagonal tensors
181181
# ----------------
182-
# TODO: consider adding a specialised DiagonalTensorMap type
183182
function LinearAlgebra.diag(t::AbstractTensorMap)
184183
return SectorDict(c => LinearAlgebra.diag(b) for (c, b) in blocks(t))
185184
end

test/runtests.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,16 @@ VSU₂U₁ = (Vect[SU2Irrep ⊠ U1Irrep]((0, 0) => 1, (1 // 2, -1) => 1),
113113
# ℂ[SU3Irrep]((0, 0, 0) => 1, (1, 0, 0) => 1, (1, 1, 0) => 1)')
114114

115115
Ti = time()
116-
#include("fusiontrees.jl")
117-
#include("spaces.jl")
118-
#include("tensors.jl")
116+
include("fusiontrees.jl")
117+
include("spaces.jl")
118+
include("tensors.jl")
119119
include("factorizations.jl")
120-
#include("diagonal.jl")
121-
#include("planar.jl")
120+
include("diagonal.jl")
121+
include("planar.jl")
122122
# TODO: remove once we know AD is slow on macOS CI
123-
#=if !(Sys.isapple() && get(ENV, "CI", "false") == "true") && isempty(VERSION.prerelease)
123+
if !(Sys.isapple() && get(ENV, "CI", "false") == "true") && isempty(VERSION.prerelease)
124124
include("ad.jl")
125-
end=#
125+
end
126126
include("bugfixes.jl")
127127
Tf = time()
128128
printstyled("Finished all tests in ",

0 commit comments

Comments
 (0)