JoeyT1994 / ITensorNumericalAnalysis.jl

MIT License
3 stars 0 forks source link

Bit map refactor #20

Closed JoeyT1994 closed 3 months ago

JoeyT1994 commented 3 months ago

This PR changes BitMap (which originally kept a dictionary mapping vertices to a digit and a dimension) to an IndexMap which maps indices (of the form ITensor.Index) to a digit and dimension).

This more directly reflects the fact that the physical indices encode the digits and not the vertices, meaning you could have multiple digits on a given vertex of an ITensorNetworkFunction.

A new type is introduced IndsNetworkMap which wraps an IndexMap and an IndsNetwork. ITensorNetworkFunction then wraps IndsNetworkMap and an ITensorNetwork.

Sweeping changes throughout in order to reflect this.

emstoudenmire commented 3 months ago

One minor stylistic thing I noticed in a lot of the code here is that many types are constrained to be 64 bit. I.e. Int64, Float64. I doubt this will change performance but it could hinder the code from being more generic (e.g. what if we wanted to use Float32 mode to run some of it on GPUs later?). So I would recommend using either no type constraints in many places, or just using Integer, Number, etc. say when constraining function arguments.

JoeyT1994 commented 3 months ago

@emstoudenmire good point, there is no real need for that restriction within the code.

I will lessen those constraints in the code for function arguments.