I'm not sure why I hadn't thought of this before, but we could overload Julia's array constructors for Index inputs to define short-hands for constructing ITensors. For example:
I think this is pretty natural, considering we already have specialized constructors like delta(::Index...) and combiner(::Index...).
It would also be useful for making a generic constructor for ITensorNetworks.ITensorNetwork, where I am planning on defining a constructor that accepts a function that generates the tensors in the network given the vertex and the specified indices of the network. For example:
using ITensors
using ITensorNetworks
using NamedGraphs
s = siteinds("S=1/2", named_grid((3, 3)))
tn = ITensorNetwork((v, inds...) -> rand(inds...), s; link_space=3)
@JoeyT1994 this is related to some of the constructors you wrote for specialized tensor networks.
For creating ITensors on GPU, we could then use the shorthands CUDA.zeros, CUDA.ones, CUDA.rand, CUDA.randn, etc. defined in CUDA.jl (e.g. https://cuda.juliagpu.org/stable/usage/array/#Random-numbers). @kmp5VT that would be related to what you're working on making ITensor constructors more generic for GPU data storage.
I'm not sure why I hadn't thought of this before, but we could overload Julia's array constructors for
Index
inputs to define short-hands for constructing ITensors. For example:I think this is pretty natural, considering we already have specialized constructors like
delta(::Index...)
andcombiner(::Index...)
.It would also be useful for making a generic constructor for
ITensorNetworks.ITensorNetwork
, where I am planning on defining a constructor that accepts a function that generates the tensors in the network given the vertex and the specified indices of the network. For example:@JoeyT1994 this is related to some of the constructors you wrote for specialized tensor networks.
For creating ITensors on GPU, we could then use the shorthands
CUDA.zeros
,CUDA.ones
,CUDA.rand
,CUDA.randn
, etc. defined inCUDA.jl
(e.g. https://cuda.juliagpu.org/stable/usage/array/#Random-numbers). @kmp5VT that would be related to what you're working on making ITensor constructors more generic for GPU data storage.