Skip to content

Commit b7e44c7

Browse files
authored
Restore README.md 2
1 parent c74a1f7 commit b7e44c7

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ data there in a format that is explicit about how tensor data is associated with
9494
structural part of the tensor, i.e. the splitting and fusion tree pairs. Therefore, on the
9595
older version of TensorKit.jl, use the following code to save the data
9696

97-
```julia
98-
using JLD2
99-
filename = "choose_some_filename.jld2"
100-
t_dict = Dict(:space => space(t), :data => Dict((f₁, f₂) => t[f₁, f₂] for (f₁, f₂) in fusiontrees(t)))
101-
jldsave(filename; t_dict)
102-
```
97+
```julia
98+
using JLD2
99+
filename = "choose_some_filename.jld2"
100+
t_dict = Dict(:space => space(t), :data => Dict((f₁, f₂) => t[f₁, f₂] for (f₁, f₂) in fusiontrees(t)))
101+
jldsave(filename; t_dict)
102+
```
103103

104104
If you have already upgraded to TensorKit.jl v0.13, you can still install the old version in
105105
a separate environment, for example a temporary environment. To do this, run
@@ -123,7 +123,12 @@ data and reconstruct the tensor as follows:
123123
```julia
124124
using JLD2
125125
filename = "choose_some_filename.jld2"
126-
t = convert(TensorMap, load_object(filename))
126+
t_dict = jldload(filename)
127+
T = eltype(valtype(t_dict[:data]))
128+
t = TensorMap{T}(undef, t_dict[:space])
129+
for ((f₁, f₂), val) in t_dict[:data]
130+
t[f₁, f₂] .= val
131+
end
127132
```
128133

129134
## Overview

0 commit comments

Comments
 (0)