Skip to content

Commit

Permalink
Changes suggested by Iakov
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloAndresCQ committed Nov 14, 2023
1 parent 9d0a284 commit 9308bfe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pytket/extensions/cutensornet/tnstate/mps_mpo.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def update_sweep_cache(pos: int, direction: DirMPS) -> None:
T = cq.contract(
*interleaved_rep,
options={"handle": self._lib.handle, "device_id": self._lib.device_id},
optimize={"samples": 1},
optimize={"samples": 0},
)
if direction == DirMPS.LEFT:
r_cached_tensors.append(T)
Expand Down Expand Up @@ -450,7 +450,7 @@ def update_variational_tensor(
F = cq.contract(
*interleaved_rep,
options={"handle": self._lib.handle, "device_id": self._lib.device_id},
optimize={"samples": 1},
optimize={"samples": 0},
)

# Get the fidelity
Expand Down
8 changes: 4 additions & 4 deletions pytket/extensions/cutensornet/tnstate/ttn.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ def vdot(self, other: TTN) -> complex: # type: ignore
result = cq.contract(
*interleaved_rep,
options={"handle": self._lib.handle, "device_id": self._lib.device_id},
optimize={"samples": 1}, # There is little to no optimisation to be done
optimize={"samples": 0}, # There is little to no optimisation to be done
)

self._logger.debug(f"Result from vdot={result}")
Expand Down Expand Up @@ -672,7 +672,7 @@ def get_statevector(self) -> np.ndarray:
result_tensor = cq.contract(
*interleaved_rep,
options={"handle": self._lib.handle, "device_id": self._lib.device_id},
optimize={"samples": 1}, # There is little to no optimisation to be done
optimize={"samples": 0}, # There is little to no optimisation to be done
)

# Convert to numpy vector and flatten
Expand Down Expand Up @@ -712,7 +712,7 @@ def get_amplitude(self, state: int) -> complex:
result = cq.contract(
*interleaved_rep,
options={"handle": self._lib.handle, "device_id": self._lib.device_id},
optimize={"samples": 1}, # There is little to no optimisation to be done
optimize={"samples": 0}, # There is little to no optimisation to be done
)

self._logger.debug(f"Amplitude of state {state} is {result}.")
Expand Down Expand Up @@ -773,7 +773,7 @@ def get_dimension(self, path: RootPath, direction: DirTTN) -> int:
direction: The direction of the bond.
Returns:
The dimension of the bond between the node and its parent.
The dimension of the specified bond.
Raises:
ValueError: If ``path`` is not in the TTN.
Expand Down
6 changes: 3 additions & 3 deletions pytket/extensions/cutensornet/tnstate/ttn_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _apply_1q_gate(self, qubit: Qubit, gate: Op) -> TTNxGate:
def _apply_2q_gate(self, q0: Qubit, q1: Qubit, gate: Op) -> TTNxGate:
"""Applies the 2-qubit gate to the TTN.
Truncation is automatically applied according to the paremeters
Truncation is automatically applied according to the parameters
in the ``Config`` object passed to this ``TTN``.
The TTN is converted to canonical form before truncating.
Expand Down Expand Up @@ -130,7 +130,7 @@ def _apply_2q_gate(self, q0: Qubit, q1: Qubit, gate: Op) -> TTNxGate:
node_bonds = aux_bonds.copy()
node_bonds[bond_q0] = "i0"
node_bonds[bond_q1] = "i1"
result_bonds = aux_bonds.copy()
result_bonds = aux_bonds
result_bonds[bond_q0] = "o0"
result_bonds[bond_q1] = "o1"

Expand Down Expand Up @@ -237,7 +237,7 @@ def _apply_2q_gate(self, q0: Qubit, q1: Qubit, gate: Op) -> TTNxGate:
aux_bonds = [f"q{x}" for x in range(n_qbonds)] + ["p"]
node_bonds = aux_bonds.copy()
node_bonds[bond] = "a"
result_bonds = aux_bonds.copy()
result_bonds = aux_bonds
result_bonds[bond] = "b"
result_bonds[-1] = "f"

Expand Down

0 comments on commit 9308bfe

Please sign in to comment.