tensorcircuit.templates.graphs#

Some common graphs and lattices

tensorcircuit.templates.graphs.Even1D(n: int, s: int = 0) Any[源代码]#
class tensorcircuit.templates.graphs.Grid2DCoord(n: int, m: int)[源代码]#

基类:object

Two-dimensional grid lattice

__init__(n: int, m: int)[源代码]#
参数
  • n (int) -- number of rows

  • m (int) -- number of cols

all_cols(pbc: bool = False) Sequence[Tuple[int, int]][源代码]#

return all col edge with 1d index encoding

参数

pbc (bool, optional) -- whether to include pbc edges (periodic boundary condition), defaults to False

返回

list of col edge

返回类型

Sequence[Tuple[int, int]]

all_rows(pbc: bool = False) Sequence[Tuple[int, int]][源代码]#

return all row edge with 1d index encoding

参数

pbc (bool, optional) -- whether to include pbc edges (periodic boundary condition), defaults to False

返回

list of row edge

返回类型

Sequence[Tuple[int, int]]

lattice_graph(pbc: bool = True) Any[源代码]#

Get the 2D grid lattice in nx.Graph format

参数

pbc (bool, optional) -- whether to include pbc edges (periodic boundary condition), defaults to True

返回

_description_

返回类型

Graph

one2two(i: int) Tuple[int, int][源代码]#
two2one(x: int, y: int) int[源代码]#
tensorcircuit.templates.graphs.Line1D(n: int, node_weight: Optional[Sequence[float]] = None, edge_weight: Optional[Sequence[float]] = None, pbc: bool = True) Any[源代码]#

1D chain with n sites

参数
  • n (int) -- [description]

  • pbc (bool, optional) -- [description], defaults to True

返回

[description]

返回类型

Graph

tensorcircuit.templates.graphs.Odd1D(n: int, *, s: int = 1) Any#