frontend.tensor package

class frontend.tensor.TensorAdiabaticProgram(H_init: csc_matrix, H_final: csc_matrix, total_time: float, time_steps: int, num_all: int)

Bases: AdiabaticProgram

compile() tuple[csc_matrix, csc_matrix]

Compile the language expression of the Hamiltonians.

Returns:

The compiled Hamiltonians.

Return type:

tuple[sp.spmatrix, sp.spmatrix]

class frontend.tensor.TensorFrontend(eps: float)

Bases: Frontend

Implement clock translation from Section 2 from this paper: https://arxiv.org/abs/2309.16475.

Parameters:

eps (float) – The noise of this translation.

encode_U(U: spmatrix, is_boundary: bool) csc_matrix

Encoding unitary with the gate teleportation.

Parameters:
  • U (sp.spmatrix) – The unitary.

  • is_boundary (bool) – Speical case for boudary, which is the last unitary.

gen_H_in(n: int, D: int) csc_matrix

H_in, at the bottom of page 6, as the first term of H_parent. Penalize non-input state.

Parameters:
  • n (int) – Number of qubit system of input circuit.

  • D (int) – Depth of the input circuit.

gen_H_out(n: int, D: int) csc_matrix

H_out, at the bottom of page 6. Used to check the output column.

Parameters:
  • n (int) – Number of qubit system of input circuit.

  • D (int) – Depth of the input circuit.

gen_H_prop(n: int, D: int, Us: list[spmatrix]) csc_matrix

H_prop, at the bottom of page 6, as the second term of H_parent. Encode the unitary into the injective map within the tensor network.

Parameters:
  • n (int) – Number of qubit system of input circuit.

  • D (int) – Depth of the input circuit.

  • Us (list[sp.spmatrix]) – List of unitaries.

lamb_n(n: int) csc_matrix

Kronecker product of the injective map, denoted as Λ (lambda).

Parameters:

n (int) – Number of qubit system of input circuit.

project(arr) csc_matrix

The projector, is computed as |x><x|.

Parameters:

arr (list) – 1d-array representation of the quantum state.

unitaries_to_program(Us: list[spmatrix], num_qubits: int, depth: int) TensorAdiabaticProgram

Translate a list of unitaries into an adiabatic program.

Parameters:

Us (list[sp.spmatrix]) – list of unitaries.

Returns:

The adiabatic program.

Return type:

AdiabaticProgram