ncdl.LatticeTensor
- class ncdl.LatticeTensor(lt: LatticeTensor | None = None, alt_cosets: List[torch.Tensor] | None = None, parent: Lattice | None = None, alt_offsets: List[array] | None = None)
A LatticeTensor container is the base data structure for processing data on non-Cartesian lattices. It extends the concept of the tensor to non-square grids. Note that this is a base class, it need not inherent form any PyTorch base clasee.
- __init__(lt: LatticeTensor | None = None, alt_cosets: List[torch.Tensor] | None = None, parent: Lattice | None = None, alt_offsets: List[array] | None = None)
Generally, an end-user should not be using this constructor. This constructor is meant to be used by by the Lattice factory.
Note that this constructor is VERY bare-bones. It doesn’t enforce the ordering principle mentioned in the paper (the Lattice factory does that).
- Parameters:
lt – An input “protoypical” lattice tensor. If all other params are None this will constructor will simply clone this data. Otherwise, this forms the base for the region (and therefore coset vectors) of the lattice tensor.
alt_cosets – When alt_cosets is specified, lt must be specified. this will clone the structure of lt, but directly use the data in the tensors specified in alt_cosets.
parent – When parent is specified, then this simply sets the parent of the resultant lattice tensor to the appropriate Lattice factory. If lt is specified, we will also check against that lattice tensor’s parent
alt_offsets –
Methods
__init__
([lt, alt_cosets, parent, alt_offsets])Generally, an end-user should not be using this constructor.
clone
()Analog of tensor.clone(), returns a new LatticeTensor copy that is still part of the computational graph.
coset
(coset)Returns the underlying tensor for a given coset index.
detach
()Analog of tensor.detach(), returns a new LatticeTensor that is the same as the input, but detached from the computational graph.
is_tensor
()Returns true if the current lattice tensor is a Cartesian lattice tensor.
lattice_bounds
()Returns the inclusive boundary of the lattice tensor.
on_lattice
(p)Tests if a point, represented as an integer numpy array is on the given lattice.
raw_coset_point_info
(lattice_site)shift_constants
(i, j[, deconv])This is the analogue of delta(i,j) in the paper.
to
(device)Moves the lattice tensor to an appropriate device.
Attributes
coset_vectors
A list of all the coset vectors for this lattice tensor.
device
Returns the current device that the lattice tensor resides on.