Skip to content

Commit 32571c8

Browse files
committed
also update sectorvector
1 parent 69e6055 commit 32571c8

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/factorizations/matrixalgebrakit.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ end
8282
function MAK.initialize_output(::typeof(svd_vals!), t::AbstractTensorMap, alg::AbstractAlgorithm)
8383
V_cod = infimum(fuse(codomain(t)), fuse(domain(t)))
8484
T = real(scalartype(t))
85-
return SectorVector{T}(undef, V_cod)
85+
A = similarstoragetype(t, T)
86+
return SectorVector{T, sectortype(t), A}(undef, V_cod)
8687
end
8788

8889
# Eigenvalue decomposition
@@ -105,13 +106,15 @@ end
105106
function MAK.initialize_output(::typeof(eigh_vals!), t::AbstractTensorMap, alg::AbstractAlgorithm)
106107
V_D = fuse(domain(t))
107108
T = real(scalartype(t))
108-
return SectorVector{T}(undef, V_D)
109+
A = similarstoragetype(t, T)
110+
return SectorVector{T, sectortype(t), A}(undef, V_D)
109111
end
110112

111113
function MAK.initialize_output(::typeof(eig_vals!), t::AbstractTensorMap, alg::AbstractAlgorithm)
112114
V_D = fuse(domain(t))
113115
Tc = complex(scalartype(t))
114-
return SectorVector{Tc}(undef, V_D)
116+
A = similarstoragetype(t, Tc)
117+
return SectorVector{Tc, sectortype(t), A}(undef, V_D)
115118
end
116119

117120
# QR decomposition

src/tensors/sectorvector.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ function SectorVector{T}(::UndefInitializer, V::ElementarySpace) where {T}
1616
structure = diagonalblockstructure(V V)
1717
return SectorVector(data, structure)
1818
end
19+
function SectorVector{T, I, A}(::UndefInitializer, V::ElementarySpace) where {T, I, A}
20+
data = A(undef, reduceddim(V))
21+
structure = diagonalblockstructure(V V)
22+
return SectorVector{T, I, A}(data, structure)
23+
end
1924

2025
Base.parent(v::SectorVector) = v.data
2126

0 commit comments

Comments
 (0)