TensorKit.jl icon indicating copy to clipboard operation
TensorKit.jl copied to clipboard

reading/writing tensors in the document

Open tangwei94 opened this issue 3 years ago • 0 comments

I add an alternative instruction in the document on how to read/write TensorMaps into a file, without converting them into Dicts first (it's in docs/src/man/tensors.md). This is based on the method provided by the package JLD2.jl.

An annoying thing is that, in the original way, if we use convert(Dict, t) to generate a Dict first, the generated Dict use Symbols as keys, which is not compatible with the methods save/load provided by JLD2.jl, as the latter requires that the keys of the Dict must be strings. On the other hand, the more adaptive method like jldsave @save provided by JLD2.jl can accept quite general variables, i.e. one can directly read/write TensorMaps without going through the Dict conversion process.

tangwei94 avatar May 11 '22 16:05 tangwei94