symmray.networks¶
Functions to create full tensor networks backed by symmray.
Attributes¶
Functions¶
|
Given a list of edges, return a dictionary of site information, each |
|
Build a random abelian symmetric quimb.tensor amplitude or PEPS from |
|
Create a random fermionic tensor network from edges. This is a wrapper |
|
Create a random MPS with abelian symmetry. |
|
Create a random 2D PEPS with abelian symmetry. |
|
Create a random 3D PEPS with abelian symmetry. |
|
Create a random fermionic MPS. This is a wrapper around |
|
Create a random 2D fermionic PEPS. This is a wrapper around |
|
Create a random 3D fermionic PEPS. This is a wrapper around |
Module Contents¶
- symmray.networks.parse_edges_to_site_info(edges, bond_dim, phys_dim=2, site_ind_id='k{}', bond_ind_id='b{}-{}', site_tag_id='I{}')[source]¶
Given a list of edges, return a dictionary of site information, each specifying the local shape, index identifiers, index dualnesses, and tags. The dualnesses of the bonds are set in a canonical order corresponding to sorting all the sites and the edges.
- Parameters:
edges (Sequence[Tuple[hashable, hashable]]) – The edges of the graph.
bond_dim (int) – The internal bond dimension.
phys_dim (int, optional) – The physical dimension of the sites.
site_ind_id (str, optional) – The identifier for the site indices.
bond_ind_id (str, optional) – The identifier for the bond indices.
site_tag_id (str, optional) – The identifier for the site tags.
- Return type:
Dict[hashable, Dict[str, Any]]
- symmray.networks._DEFAULT_PHYS_CHARGEMAPS¶
- symmray.networks.TN_abelian_from_edges_rand(symmetry, edges, bond_dim, phys_dim=None, seed=None, dtype='float64', site_tag_id='I{}', site_ind_id='k{}', fermionic=False, flat=False, site_charge=None, subsizes='maximal', **kwargs)[source]¶
Build a random abelian symmetric quimb.tensor amplitude or PEPS from edges.
- Parameters:
symmetry ({"Z2", "U1", "Z2Z2", "U1U1", ZN}) – The symmetry of the PEPS. Currently only “Z2” and “U1” are supported.
edges (list of tuples) – The edges of the PEPS. Each edge is a tuple of the form (cooa, coob) where cooa and coob are hashable labels of the two sites.
bond_dim (int or dict) – The total (sum of charge sizes) bond dimension of the PEPS. You can also provide an explicit map of bond charges to sizes.
phys_dim (None, int or dict, optional) – The physical dimension of each site. If None, no physical sites are included. If an integer, all sites have the same dimension. If a dictionary, a custom map of physical charges to sizes.
seed (None, int or np.random.Generator, optional) – The random seed or generator to use.
dtype (str, optional) – The data type of the tensors.
site_tag_id (str, optional) – The tag format for each site tensor.
site_ind_id (str, optional) – The index format for each site tensor, if physical sites are included.
fermionic (bool, optional) – Whether to generate fermionic tensors.
flat (bool, optional) – Whether to generate ‘flat’ backend arrays (True) or the default block-sparse backend arrays (False).
site_charge (callable, optional) – A function that takes a site index and returns the charge of that site. By default it will create all even parity tensors if Z2=0 or it will alternate between 0 and 1 for U1.
subsizes ({"maximal", "equal"}, optional) – The sizes of the charge sectors. If None, the sizes are randomly determined. If “equal”, the sizes are equal (up to remainders). If “maximal”, as many charges as possible will be chosen.
kwargs – Additional arguments to pass to
symmray.utils.get_rand().
- Return type:
quimb.tensor.TensorNetworkGen or quimb.tensor.TensorNetworkGenVector
- symmray.networks.TN_fermionic_from_edges_rand(symmetry, edges, bond_dim, phys_dim=None, seed=None, dtype='float64', site_tag_id='I{}', site_ind_id='k{}', site_charge=None, subsizes='maximal', **kwargs)[source]¶
Create a random fermionic tensor network from edges. This is a wrapper around
TN_abelian_from_edges_rand()with fermionic=True.- Parameters:
symmetry ({"Z2", "U1", "Z2Z2", "U1U1", ZN}) – The symmetry of the PEPS. Currently only “Z2” and “U1” are supported.
edges (list of tuples) – The edges of the PEPS. Each edge is a tuple of the form (cooa, coob) where cooa and coob are hashable labels of the two sites.
bond_dim (int or dict) – The total (sum of charge sizes) bond dimension of the PEPS. You can also provide an explicit map of bond charges to sizes.
phys_dim (None, int or dict, optional) – The physical dimension of each site. If None, no physical sites are included. If an integer, all sites have the same dimension. If a dictionary, a custom map of physical charges to sizes.
seed (None, int or np.random.Generator, optional) – The random seed or generator to use.
dtype (str, optional) – The data type of the tensors.
site_tag_id (str, optional) – The tag format for each site tensor.
site_ind_id (str, optional) – The index format for each site tensor, if physical sites are included.
site_charge (callable, optional) – A function that takes a site index and returns the charge of that site. By default it will create all even parity tensors if Z2=0 or it will alernate between 0 and 1 for U1.
subsizes ({"maximal", "equal"}, optional) – The sizes of the charge sectors. If None, the sizes are randomly determined. If “equal”, the sizes are equal (up to remainders). If “maximal”, as many charges as possible will be chosen.
kwargs – Additional arguments to pass to
symmray.utils.get_rand().
- Return type:
quimb.tensor.TensorNetworkGen or quimb.tensor.TensorNetworkGenVector
- symmray.networks.MPS_abelian_rand(symmetry, L, bond_dim, phys_dim=2, cyclic=False, seed=None, dtype='float64', site_tag_id='I{}', site_ind_id='k{}', fermionic=False, flat=False, site_charge=None, subsizes='maximal', **kwargs)[source]¶
Create a random MPS with abelian symmetry.
- Parameters:
L (int) – The number of sites.
bond_dim (int or dict) – The total (sum of charge sizes) bond dimension of the MPS. You can also provide an explicit map of bond charges to sizes.
phys_dim (int or dict, optional) – The physical dimension of each site. If None, no physical sites are included. If an integer, a default charge distribution is chosen. If a dictionary, a custom map of physical charges to sizes.
cyclic (bool, optional) – Whether the MPS is cyclic.
seed (None, int or np.random.Generator, optional) – The random seed or generator to use.
dtype (str, optional) – The data type of the tensors.
site_tag_id (str, optional) – The tag format for each site tensor.
site_ind_id (str, optional) – The index format for each site tensor, if physical sites are included.
fermionic (bool, optional) – Whether to generate fermionic tensors.
flat (bool, optional) – Whether to generate ‘flat’ backend arrays (True) or the default block-sparse backend arrays (False).
site_charge (callable, optional) – A function that takes a site index and returns the charge of that site. By default it will create all even parity tensors if Z2=0 or it will alernate between 0 and 1 for U1.
subsizes ({"maximal", "equal"}, optional) – The sizes of the charge sectors. If None, the sizes are randomly determined. If “equal”, the sizes are equal (up to remainders). If “maximal”, as many charges as possible will be chosen.
kwargs – Additional arguments to pass to
symmray.utils.get_rand().
- Return type:
quimb.tensor.MatrixProductState
- symmray.networks.PEPS_abelian_rand(symmetry, Lx, Ly, bond_dim, phys_dim=2, cyclic=False, seed=None, dtype='float64', site_tag_id='I{},{}', site_ind_id='k{},{}', x_tag_id='X{}', y_tag_id='Y{}', fermionic=False, flat=False, site_charge=None, subsizes='maximal', **kwargs)[source]¶
Create a random 2D PEPS with abelian symmetry.
- Parameters:
Lx (int) – The number of rows.
Ly (int) – The number of columns.
bond_dim (int or dict) – The total (sum of charge sizes) bond dimension of the PEPS. You can also provide an explicit map of bond charges to sizes.
phys_dim (int or dict, optional) – The physical dimension of each site. If None, no physical sites are included. If an integer, a default charge distribution is chosen. If a dictionary, a custom map of physical charges to sizes.
cyclic (bool, optional) – Whether the PEPS is cyclic in the x-direction.
seed (None, int or np.random.Generator, optional) – The random seed or generator to use.
dtype (str, optional) – The data type of the tensors.
site_tag_id (str, optional) – The tag format for each site tensor.
site_ind_id (str, optional) – The index format for each site tensor, if physical sites are included.
fermionic (bool, optional) – Whether to generate fermionic tensors.
flat (bool, optional) – Whether to generate ‘flat’ backend arrays (True) or the default block-sparse backend arrays (False).
site_charge (callable, optional) – A function that takes a site index and returns the charge of that site. By default it will create all even parity tensors if Z2=0 or it will alernate between 0 and 1 for U1.
subsizes ({"maximal", "equal"}, optional) – The sizes of the charge sectors. If None, the sizes are randomly determined. If “equal”, the sizes are equal (up to remainders). If “maximal”, as many charges as possible will be chosen.
kwargs – Additional arguments to pass to
symmray.utils.get_rand().
- Return type:
quimb.tensor.PEPS
- symmray.networks.PEPS3D_abelian_rand(symmetry, Lx, Ly, Lz, bond_dim, phys_dim=2, cyclic=False, seed=None, dtype='float64', site_tag_id='I{},{},{}', site_ind_id='k{},{},{}', x_tag_id='X{}', y_tag_id='Y{}', z_tag_id='Z{}', fermionic=False, site_charge=None, subsizes='maximal', **kwargs)[source]¶
Create a random 3D PEPS with abelian symmetry.
- Parameters:
Lx (int) – Length of the PEPS in the x-direction.
Ly (int) – Length of the PEPS in the y-direction.
Lz (int) – Length of the PEPS in the z-direction.
bond_dim (int or dict) – The total (sum of charge sizes) bond dimension of the PEPS. You can also provide an explicit map of bond charges to sizes.
phys_dim (int or dict, optional) – The physical dimension of each site. If None, no physical sites are included. If an integer, a default charge distribution is chosen. If a dictionary, a custom map of physical charges to sizes.
cyclic (bool, optional) – Whether the PEPS is cyclic in the x-direction.
seed (None, int or np.random.Generator, optional) – The random seed or generator to use.
dtype (str, optional) – The data type of the tensors.
site_tag_id (str, optional) – The tag format for each site tensor.
site_ind_id (str, optional) – The index format for each site tensor, if physical sites are included.
fermionic (bool, optional) – Whether to generate fermionic tensors.
site_charge (callable, optional) – A function that takes a site index and returns the charge of that site. By default it will create all even parity tensors if Z2=0 or it will alernate between 0 and 1 for U1.
subsizes ({"maximal", "equal"}, optional) – The sizes of the charge sectors. If None, the sizes are randomly determined. If “equal”, the sizes are equal (up to remainders). If “maximal”, as many charges as possible will be chosen.
kwargs – Additional arguments to pass to
symmray.utils.get_rand().
- Return type:
quimb.tensor.PEPS3D
- symmray.networks.MPS_fermionic_rand(symmetry, L, bond_dim, phys_dim=2, cyclic=False, seed=None, dtype='float64', site_tag_id='I{}', site_ind_id='k{}', site_charge=None, subsizes='maximal', **kwargs)[source]¶
Create a random fermionic MPS. This is a wrapper around
MPS_abelian_rand()with fermionic=True.- Parameters:
L (int) – The number of sites.
bond_dim (int or dict) – The total (sum of charge sizes) bond dimension of the MPS. You can also provide an explicit map of bond charges to sizes.
phys_dim (int or dict, optional) – The physical dimension of each site. If None, no physical sites are included. If an integer, a default charge distribution is chosen. If a dictionary, a custom map of physical charges to sizes.
cyclic (bool, optional) – Whether the MPS is cyclic.
seed (None, int or np.random.Generator, optional) – The random seed or generator to use.
dtype (str, optional) – The data type of the tensors.
site_tag_id (str, optional) – The tag format for each site tensor.
site_ind_id (str, optional) – The index format for each site tensor, if physical sites are included.
site_charge (callable, optional) – A function that takes a site index and returns the charge of that site. By default it will create all even parity tensors if Z2=0 or it will alernate between 0 and 1 for U1.
subsizes ({"maximal", "equal"}, optional) – The sizes of the charge sectors. If None, the sizes are randomly determined. If “equal”, the sizes are equal (up to remainders). If “maximal”, as many charges as possible will be chosen.
kwargs – Additional arguments to pass to
symmray.utils.get_rand().
- Return type:
quimb.tensor.MatrixProductState
- symmray.networks.PEPS_fermionic_rand(symmetry, Lx, Ly, bond_dim, phys_dim=2, cyclic=False, seed=None, dtype='float64', site_tag_id='I{},{}', site_ind_id='k{},{}', x_tag_id='X{}', y_tag_id='Y{}', site_charge=None, subsizes='maximal', **kwargs)[source]¶
Create a random 2D fermionic PEPS. This is a wrapper around
PEPS_abelian_rand()with fermionic=True.- Parameters:
Lx (int) – The number of rows.
Ly (int) – The number of columns.
bond_dim (int or dict) – The total (sum of charge sizes) bond dimension of the PEPS. You can also provide an explicit map of bond charges to sizes.
phys_dim (int or dict, optional) – The physical dimension of each site. If None, no physical sites are included. If an integer, a default charge distribution is chosen. If a dictionary, a custom map of physical charges to sizes.
cyclic (bool, optional) – Whether the PEPS is cyclic in the x-direction.
seed (None, int or np.random.Generator, optional) – The random seed or generator to use.
dtype (str, optional) – The data type of the tensors.
site_tag_id (str, optional) – The tag format for each site tensor.
site_ind_id (str, optional) – The index format for each site tensor, if physical sites are included.
site_charge (callable, optional) – A function that takes a site index and returns the charge of that site. By default it will create all even parity tensors if Z2=0 or it will alernate between 0 and 1 for U1.
subsizes ({"maximal", "equal"}, optional) – The sizes of the charge sectors. If None, the sizes are randomly determined. If “equal”, the sizes are equal (up to remainders). If “maximal”, as many charges as possible will be chosen.
kwargs – Additional arguments to pass to
symmray.utils.get_rand().
- Return type:
quimb.tensor.PEPS
- symmray.networks.PEPS3D_fermionic_rand(symmetry, Lx, Ly, Lz, bond_dim, phys_dim=2, cyclic=False, seed=None, dtype='float64', site_tag_id='I{},{},{}', site_ind_id='k{},{},{}', x_tag_id='X{}', y_tag_id='Y{}', z_tag_id='Z{}', site_charge=None, subsizes='maximal', **kwargs)[source]¶
Create a random 3D fermionic PEPS. This is a wrapper around
PEPS3D_abelian_rand()with fermionic=True.- Parameters:
Lx (int) – Length of the PEPS in the x-direction.
Ly (int) – Length of the PEPS in the y-direction.
Lz (int) – Length of the PEPS in the z-direction.
bond_dim (int or dict) – The total (sum of charge sizes) bond dimension of the PEPS. You can also provide an explicit map of bond charges to sizes.
phys_dim (int or dict, optional) – The physical dimension of each site. If None, no physical sites are included. If an integer, a default charge distribution is chosen. If a dictionary, a custom map of physical charges to sizes.
cyclic (bool, optional) – Whether the PEPS is cyclic in the x-direction.
seed (None, int or np.random.Generator, optional) – The random seed or generator to use.
dtype (str, optional) – The data type of the tensors.
site_tag_id (str, optional) – The tag format for each site tensor.
site_ind_id (str, optional) – The index format for each site tensor, if physical sites are included.
site_charge (callable, optional) – A function that takes a site index and returns the charge of that site. By default it will create all even parity tensors if Z2=0 or it will alernate between 0 and 1 for U1.
subsizes ({"maximal", "equal"}, optional) – The sizes of the charge sectors. If None, the sizes are randomly determined. If “equal”, the sizes are equal (up to remainders). If “maximal”, as many charges as possible will be chosen.
kwargs – Additional arguments to pass to
symmray.utils.get_rand().
- Return type:
quimb.tensor.PEPS3D