SquareLattice#
- class SquareLattice(rows, cols, edge_parameter=1.0, onsite_parameter=0.0, boundary_condition=BoundaryCondition.OPEN)[fuente]#
Bases:
HyperCubicLattice
Square lattice.
- Parámetros:
rows (int) – Length of the x direction.
cols (int) – Length of the y direction.
edge_parameter (complex | Tuple[complex, complex]) – Weights on the edges in x and y direction. When it is a single value, it is interpreted as a tuple of length 2 consisting of the same values. Defaults to 1.0.
onsite_parameter (complex) – Weight on the self-loops, which are edges connecting a node to itself. Defaults to 0.0.
boundary_condition (BoundaryCondition | Tuple[BoundaryCondition, BoundaryCondition]) – Boundary condition for each direction. The available boundary conditions are:
BoundaryCondition.OPEN
,BoundaryCondition.PERIODIC
. When it is a single value, it is interpreted as a tuple of length 2 consisting of the same values. Defaults toBoundaryCondition.OPEN
.
Attributes
- boundary_condition#
Boundary condition for each dimension.
- Devuelve:
the boundary condition.
- cols#
Length of the y direction
- Devuelve:
the length
- dim#
Dimensions of the hyper cubic lattice.
- Devuelve:
the dimension.
- edge_parameter#
Weights on the edges in each direction.
- Devuelve:
the parameter for the edges.
- graph#
Return a copy of the input graph.
- node_indexes#
Return the node indexes.
- num_nodes#
Return the number of nodes.
- onsite_parameter#
Weight on the self-loops
- Devuelve:
the parameter for the self-loops.
- rows#
Length of the x direction
- Devuelve:
the length
- size#
Lengths of each dimension.
- Devuelve:
the size.
- weighted_edge_list#
Return a list of weighted edges.
Methods
- draw(*, self_loop=False, style=None)#
Draw the lattice.
- Parámetros:
self_loop (bool) – Draw self-loops in the lattice. Defaults to False.
style (LatticeDrawStyle | None) – Styles for rustworkx.visualization.mpl_draw. Please see https://qiskit.org/documentation/rustworkx/stubs/rustworkx.visualization.mpl_draw.html#rustworkx.visualization.mpl_draw for details.
- draw_without_boundary(*, self_loop=False, style=None)#
Draw the lattice with no edges between the boundaries.
- Parámetros:
self_loop (bool) – Draw self-loops in the lattice. Defaults to False.
style (LatticeDrawStyle | None) – Styles for rustworkx.visualization.mpl_draw. Please see https://qiskit.org/documentation/rustworkx/stubs/rustworkx.visualization.mpl_draw.html#rustworkx.visualization.mpl_draw for details.
- classmethod from_adjacency_matrix(interaction_matrix)#
Constructs a new lattice from a 2-dimensional adjacency matrix.
This method is equivalent to
PyGraph.from_adjacency_matrix()
or its complex counterpart when given a complex-valued matrix.- Parámetros:
interaction_matrix (ndarray) – the adjacency matrix from which to build out the lattice.
- Muestra:
ValueError – if the provided adjacency matrix is not a 2-D square matrix.
- Devuelve:
A new lattice based on the provided adjacency matrix.
- Tipo del valor devuelto:
- classmethod from_nodes_and_edges(num_nodes, weighted_edges)#
Return an instance of Lattice from the number of nodes and the list of edges.
- to_adjacency_matrix(weighted=False)#
Return its adjacency matrix from weighted edges. The weighted edge list is interpreted as the upper triangular matrix. Defaults to False.
- uniform_parameters(uniform_interaction, uniform_onsite_potential)#
Returns a new lattice with uniform parameters but otherwise identical structure.