|
74 | 74 | function MAK.initialize_output(::typeof(svd_compact!), t::AbstractTensorMap, ::AbstractAlgorithm) |
75 | 75 | V_cod = V_dom = infimum(fuse(codomain(t)), fuse(domain(t))) |
76 | 76 | U = similar(t, codomain(t) ← V_cod) |
77 | | - S = DiagonalTensorMap{real(scalartype(t))}(undef, V_cod) |
| 77 | + S = similar_diagonal(t, real(scalartype(t)), V_cod) |
78 | 78 | Vᴴ = similar(t, V_dom ← domain(t)) |
79 | 79 | return U, S, Vᴴ |
80 | 80 | end |
81 | 81 |
|
82 | 82 | function MAK.initialize_output(::typeof(svd_vals!), t::AbstractTensorMap, alg::AbstractAlgorithm) |
83 | 83 | V_cod = infimum(fuse(codomain(t)), fuse(domain(t))) |
84 | 84 | 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) |
86 | 87 | end |
87 | 88 |
|
88 | 89 | # Eigenvalue decomposition |
89 | 90 | # ------------------------ |
90 | 91 | function MAK.initialize_output(::typeof(eigh_full!), t::AbstractTensorMap, ::AbstractAlgorithm) |
91 | 92 | V_D = fuse(domain(t)) |
92 | | - T = real(scalartype(t)) |
93 | | - D = DiagonalTensorMap{T}(undef, V_D) |
| 93 | + D = similar_diagonal(t, real(scalartype(t)), V_D) |
94 | 94 | V = similar(t, codomain(t) ← V_D) |
95 | 95 | return D, V |
96 | 96 | end |
97 | 97 |
|
98 | 98 | function MAK.initialize_output(::typeof(eig_full!), t::AbstractTensorMap, ::AbstractAlgorithm) |
99 | 99 | V_D = fuse(domain(t)) |
100 | 100 | Tc = complex(scalartype(t)) |
101 | | - D = DiagonalTensorMap{Tc}(undef, V_D) |
| 101 | + D = similar_diagonal(t, Tc, V_D) |
102 | 102 | V = similar(t, Tc, codomain(t) ← V_D) |
103 | 103 | return D, V |
104 | 104 | end |
105 | 105 |
|
106 | 106 | function MAK.initialize_output(::typeof(eigh_vals!), t::AbstractTensorMap, alg::AbstractAlgorithm) |
107 | 107 | V_D = fuse(domain(t)) |
108 | 108 | T = real(scalartype(t)) |
109 | | - return SectorVector{T}(undef, V_D) |
| 109 | + A = similarstoragetype(t, T) |
| 110 | + return SectorVector{T, sectortype(t), A}(undef, V_D) |
110 | 111 | end |
111 | 112 |
|
112 | 113 | function MAK.initialize_output(::typeof(eig_vals!), t::AbstractTensorMap, alg::AbstractAlgorithm) |
113 | 114 | V_D = fuse(domain(t)) |
114 | 115 | Tc = complex(scalartype(t)) |
115 | | - return SectorVector{Tc}(undef, V_D) |
| 116 | + A = similarstoragetype(t, Tc) |
| 117 | + return SectorVector{Tc, sectortype(t), A}(undef, V_D) |
116 | 118 | end |
117 | 119 |
|
118 | 120 | # QR decomposition |
|
0 commit comments