IcebergOpsExtension

class guppyft.extensions.iceberg.IcebergOpsExtension[source]

Extension providing the Iceberg logical operations.

__call__() → Extension[source]

Returns the Iceberg ops extension.

all_but_one_x(k: int) → ExtOp[source]

Apply an X gate to all but one qubit.

Parameters:

k – The number of logical qubits encoded in the block.

property all_but_one_x_def: OpDef

Apply an X gate to all but one qubit.

This is the generic operation definition. For the instantiated operation, see all_but_one_x.

all_but_one_z(k: int) → ExtOp[source]

Apply a Z gate to all but one qubit.

Parameters:

k – The number of logical qubits encoded in the block.

property all_but_one_z_def: OpDef

Apply a Z gate to all but one qubit.

This is the generic operation definition. For the instantiated operation, see all_but_one_z.

all_h(k: int) → ExtOp[source]

Apply an H gate to all qubits.

Parameters:

k – The number of logical qubits encoded in the block.

property all_h_def: OpDef

Apply an H gate to all qubits.

This is the generic operation definition. For the instantiated operation, see all_h.

all_x(k: int) → ExtOp[source]

Apply an X gate to all qubits.

Parameters:

k – The number of logical qubits encoded in the block.

property all_x_def: OpDef

Apply an X gate to all qubits.

This is the generic operation definition. For the instantiated operation, see all_x.

all_y(k: int) → ExtOp[source]

Apply a Y gate to all qubits.

Parameters:

k – The number of logical qubits encoded in the block.

property all_y_def: OpDef

Apply a Y gate to all qubits.

This is the generic operation definition. For the instantiated operation, see all_y.

all_z(k: int) → ExtOp[source]

Apply a Z gate to all qubits.

Parameters:

k – The number of logical qubits encoded in the block.

property all_z_def: OpDef

Apply a Z gate to all qubits.

This is the generic operation definition. For the instantiated operation, see all_z.

property alloc_dynq: ExtOp

Allocate a dynamic logical qubit in the zero state.

property alloc_dynq_def: OpDef

Allocate a dynamic logical qubit in the zero state.

This is the generic operation definition. For the instantiated operation, see alloc_dynq.

alloc_zero(k: int) → ExtOp[source]

Allocate a block in the all-zero state.

Parameters:

k – The number of logical qubits encoded in the block.

property alloc_zero_def: OpDef

Allocate a block in the all-zero state.

This is the generic operation definition. For the instantiated operation, see alloc_zero.

borrow(k: int, m: int) → ExtOp[source]

Extraction of dynamic logical qubits from a block.

Parameters:
  • k – The number of logical qubits encoded in the block.

  • m – The number of logical qubits to borrow.

property borrow_def: OpDef

Extraction of dynamic logical qubits from a block.

This is the generic operation definition. For the instantiated operation, see borrow.

borrow_more(k: int, m: int) → ExtOp[source]

Extraction of dynamic logical qubits from an already-borrowed block.

Parameters:
  • k – The number of logical qubits encoded in the block.

  • m – The number of logical qubits to borrow.

property borrow_more_def: OpDef

Extraction of dynamic logical qubits from an already-borrowed block.

This is the generic operation definition. For the instantiated operation, see borrow_more.

check_pre_block(k: int) → ExtOp[source]

Check if a PreBlock is in a valid logical state.

Parameters:

k – The number of logical qubits encoded in the block.

property check_pre_block_def: OpDef

Check if a PreBlock is in a valid logical state.

This is the generic operation definition. For the instantiated operation, see check.

cx(k: int) → ExtOp[source]

Apply a CX gate to two qubits within a block.

Parameters:

k – The number of logical qubits encoded in the block.

cx_between_blocks(k: int) → ExtOp[source]

Apply a CX gate to two qubits on different blocks of the same size with dynamic indices.

Parameters:

k – The number of logical qubits encoded in the blocks.

property cx_between_blocks_def: OpDef

Apply a CX gate to two qubits on different blocks of the same size with dynamic indices.

This is the generic operation definition. For the instantiated operation, see cx_between_blocks.

property cx_def: OpDef

Apply a CX gate to two qubits within a block.

This is the generic operation definition. For the instantiated operation, see cx.

property cx_dynq: ExtOp

CX gate on two dynamic logical qubits.

property cx_dynq_def: OpDef

CX gate on two dynamic logical qubits.

This is the generic operation definition. For the instantiated operation, see cx_dynq.

cx_transversal(k: int) → ExtOp[source]

Apply a CX gate transversally over two blocks of the same size.

Parameters:

k – The number of logical qubits encoded in the blocks.

property cx_transversal_def: OpDef

Apply a CX gate transversally over two blocks of the same size.

This is the generic operation definition. For the instantiated operation, see cx_transversal.

fan_in(k: int) → ExtOp[source]

Fan in to one qubit from the rest.

Parameters:

k – The number of logical qubits encoded in the block.

property fan_in_def: OpDef

Fan in to one qubit from the rest.

This is the generic operation definition. For the instantiated operation, see fan_in.

fan_out(k: int) → ExtOp[source]

Fan out from one qubit to the rest.

Parameters:

k – The number of logical qubits encoded in the block.

property fan_out_def: OpDef

Fan out from one qubit to the rest.

This is the generic operation definition. For the instantiated operation, see fan_out.

free(k: int) → ExtOp[source]

Free a block.

Parameters:

k – The number of logical qubits encoded in the block.

property free_def: OpDef

Free a block.

This is the generic operation definition. For the instantiated operation, see free.

property free_dynq: ExtOp

Discard a dynamic logical qubit.

property free_dynq_def: OpDef

Discard a dynamic logical qubit.

This is the generic operation definition. For the instantiated operation, see free_dynq.

measure_all(k: int) → ExtOp[source]

Destructively measure all qubits in the Z basis.

Parameters:

k – The number of logical qubits encoded in the block.

property measure_all_def: OpDef

Destructively measure all qubits in the Z basis.

This is the generic operation definition. For the instantiated operation, see measure_all.

measure_syndrome(k: int) → ExtOp[source]

Perform a syndrome measurement, producing (X,Z) error indicators.

Parameters:

k – The number of logical qubits encoded in the block.

property measure_syndrome_def: OpDef

Perform a syndrome measurement, producing (X,Z) error indicators.

This is the generic operation definition. For the instantiated operation, see measure_syndrome.

pauli_exp_all_x(k: int) → ExtOp[source]

Apply the logical all-X Pauli exponential.

\[\exp(-i \theta X^{\otimes k} / 2)\]

The operation’s angle \(\theta\) is in radians and \(k\) is the number of logical qubits in the block.

Parameters:

k – The number of logical qubits encoded in the block.

property pauli_exp_all_x_def: OpDef

Apply the logical all-X Pauli exponential.

\[\exp(-i \theta X^{\otimes k} / 2)\]

The operation’s angle \(\theta\) is in radians and \(k\) is the number of logical qubits in the block.

This is the generic operation definition. For the instantiated operation, see pauli_exp_all_x.

pauli_exp_all_x_except_at(k: int) → ExtOp[source]

Apply the Pauli exponential with I at i and X elsewhere.

\[\exp(-i \theta ( X^{\otimes i} \otimes I \otimes X^{\otimes(k-i-1)} ) / 2)\]

The operation’s angle \(\theta\) is in radians and \(k\) is the number of logical qubits in the block.

Parameters:

k – The number of logical qubits encoded in the block.

property pauli_exp_all_x_except_at_def: OpDef

Apply the Pauli exponential with I at i and X elsewhere.

\[\exp(-i \theta ( X^{\otimes i} \otimes I \otimes X^{\otimes(k-i-1)} ) / 2)\]

The operation’s angle \(\theta\) is in radians and \(k\) is the number of logical qubits in the block.

This is the generic operation definition. For the instantiated operation, see pauli_exp_all_x_except_at.

pauli_exp_all_x_except_z_at(k: int) → ExtOp[source]

Apply the Pauli exponential with Z at i and X elsewhere.

\[\exp(-i \theta ( X^{\otimes i} \otimes Z \otimes X^{\otimes(k-i-1)} ) / 2)\]

The operation’s angle \(\theta\) is in radians and \(k\) is the number of logical qubits in the block.

Parameters:

k – The number of logical qubits encoded in the block.

property pauli_exp_all_x_except_z_at_def: OpDef

Apply the Pauli exponential with Z at i and X elsewhere.

\[\exp(-i \theta ( X^{\otimes i} \otimes Z \otimes X^{\otimes(k-i-1)} ) / 2)\]

The operation’s angle \(\theta\) is in radians and \(k\) is the number of logical qubits in the block.

This is the generic operation definition. For the instantiated operation, see pauli_exp_all_x_except_z_at.

pauli_exp_all_y(k: int) → ExtOp[source]

Apply the logical all-Y Pauli exponential.

\[\exp(-i \theta Y^{\otimes k} / 2)\]

The operation’s angle \(\theta\) is in radians and \(k\) is the number of logical qubits in the block.

Parameters:

k – The number of logical qubits encoded in the block.

property pauli_exp_all_y_def: OpDef

Apply the logical all-Y Pauli exponential.

\[\exp(-i \theta Y^{\otimes k} / 2)\]

The operation’s angle \(\theta\) is in radians and \(k\) is the number of logical qubits in the block.

This is the generic operation definition. For the instantiated operation, see pauli_exp_all_y.

pauli_exp_all_z(k: int) → ExtOp[source]

Apply the logical all-Z Pauli exponential.

\[\exp(-i \theta Z^{\otimes k} / 2)\]

The operation’s angle \(\theta\) is in radians and \(k\) is the number of logical qubits in the block.

Parameters:

k – The number of logical qubits encoded in the block.

property pauli_exp_all_z_def: OpDef

Apply the logical all-Z Pauli exponential.

\[\exp(-i \theta Z^{\otimes k} / 2)\]

The operation’s angle \(\theta\) is in radians and \(k\) is the number of logical qubits in the block.

This is the generic operation definition. For the instantiated operation, see pauli_exp_all_z.

pauli_exp_all_z_except_at(k: int) → ExtOp[source]

Apply the Pauli exponential with I at i and Z elsewhere.

\[\exp(-i \theta ( Z^{\otimes i} \otimes I \otimes Z^{\otimes(k-i-1)} ) / 2)\]

The operation’s angle \(\theta\) is in radians and \(k\) is the number of logical qubits in the block.

Parameters:

k – The number of logical qubits encoded in the block.

property pauli_exp_all_z_except_at_def: OpDef

Apply the Pauli exponential with I at i and Z elsewhere.

\[\exp(-i \theta ( Z^{\otimes i} \otimes I \otimes Z^{\otimes(k-i-1)} ) / 2)\]

The operation’s angle \(\theta\) is in radians and \(k\) is the number of logical qubits in the block.

This is the generic operation definition. For the instantiated operation, see pauli_exp_all_z_except_at.

pauli_exp_all_z_except_x_at(k: int) → ExtOp[source]

Apply the Pauli exponential with X at i and Z elsewhere.

\[\exp(-i \theta ( Z^{\otimes i} \otimes X \otimes Z^{\otimes(k-i-1)} ) / 2)\]

The operation’s angle \(\theta\) is in radians and \(k\) is the number of logical qubits in the block.

Parameters:

k – The number of logical qubits encoded in the block.

property pauli_exp_all_z_except_x_at_def: OpDef

Apply the Pauli exponential with X at i and Z elsewhere.

\[\exp(-i \theta ( Z^{\otimes i} \otimes X \otimes Z^{\otimes(k-i-1)} ) / 2)\]

The operation’s angle \(\theta\) is in radians and \(k\) is the number of logical qubits in the block.

This is the generic operation definition. For the instantiated operation, see pauli_exp_all_z_except_x_at.

restore(k: int, m: int) → ExtOp[source]

Restoration of all dynamic logical qubits to their originating block.

Parameters:
  • k – The number of logical qubits encoded in the block.

  • m – The number of logical qubits to restore.

property restore_def: OpDef

Restoration of all dynamic logical qubits to their originating block.

This is the generic operation definition. For the instantiated operation, see restore.

restore_some(k: int, m: int) → ExtOp[source]

Restoration of some dynamic logical qubits to their originating block.

Parameters:
  • k – The number of logical qubits encoded in the block.

  • m – The number of logical qubits to restore.

property restore_some_def: OpDef

Restoration of some dynamic logical qubits to their originating block.

This is the generic operation definition. For the instantiated operation, see restore_some.

rx(k: int) → ExtOp[source]

Apply an Rx gate to one qubit.

Parameters:

k – The number of logical qubits encoded in the block.

property rx_def: OpDef

Apply an Rx gate to one qubit.

This is the generic operation definition. For the instantiated operation, see rx.

property rx_dynq: ExtOp

Rx gate on a dynamic logical qubit.

property rx_dynq_def: OpDef

Rx gate on a dynamic logical qubit.

This is the generic operation definition. For the instantiated operation, see rx_dynq.

rz(k: int) → ExtOp[source]

Apply an Rz gate to one qubit.

Parameters:

k – The number of logical qubits encoded in the block.

property rz_def: OpDef

Apply an Rz gate to one qubit.

This is the generic operation definition. For the instantiated operation, see rz.

property rz_dynq: ExtOp

Rz gate on a dynamic logical qubit.

property rz_dynq_def: OpDef

Rz gate on a dynamic logical qubit.

This is the generic operation definition. For the instantiated operation, see rz_dynq.

swap(k: int) → ExtOp[source]

Apply a SWAP gate to two qubits within a block.

Parameters:

k – The number of logical qubits encoded in the block.

property swap_def: OpDef

Apply a SWAP gate to two qubits within a block.

This is the generic operation definition. For the instantiated operation, see swap.

property try_alloc_dynq: ExtOp

Try to allocate a dynamic logical qubit in the zero state.

property try_alloc_dynq_def: OpDef

Try to allocate a dynamic logical qubit in the zero state.

This is the generic operation definition. For the instantiated operation, see try_alloc_dynq.

try_alloc_zero(k: int) → ExtOp[source]

Allocate a PreBlock in the all-zero state.

Parameters:

k – The number of logical qubits encoded in the block.

property try_alloc_zero_def: OpDef

Allocate a PreBlock in the all-zero state.

This is the generic operation definition. For the instantiated operation, see alloc_zero.

try_measure_one_x(k: int) → ExtOp[source]

Non-destructively measure one qubit in the X basis.

This operation is fallible and produces a future optional bool. A “none” value indicates a probable single-qubit error; QED may then be used to detect whether this was just a measurement error or whether it affected the data qubits.

Parameters:

k – The number of logical qubits encoded in the block.

property try_measure_one_x_def: OpDef

Non-destructively measure one qubit in the X basis.

This operation is fallible and produces a future optional bool. A “none” value indicates a probable single-qubit error; QED may then be used to detect whether this was just a measurement error or whether it affected the data qubits.

This is the generic operation definition. For the instantiated operation, see try_measure_one_x.

try_measure_one_z(k: int) → ExtOp[source]

Non-destructively measure one qubit in the Z basis.

This operation is fallible and produces a future optional bool. A “none” value indicates a probable single-qubit error; QED may then be used to detect whether this was just a measurement error or whether it affected the data qubits.

Parameters:

k – The number of logical qubits encoded in the block.

property try_measure_one_z_def: OpDef

Non-destructively measure one qubit in the Z basis.

This operation is fallible and produces a future optional bool. A “none” value indicates a probable single-qubit error; QED may then be used to detect whether this was just a measurement error or whether it affected the data qubits.

This is the generic operation definition. For the instantiated operation, see try_measure_one_z.

property try_measure_x_dynq: ExtOp

Fallible non-destructive measurement of a dynamic logical qubit in the X basis.

property try_measure_x_dynq_def: OpDef

Fallible non-destructive measurement of a dynamic logical qubit in the X basis.

This is the generic operation definition. For the instantiated operation, see try_measure_x_dynq.

property try_measure_z_dynq: ExtOp

Fallible non-destructive measurement of a dynamic logical qubit in the Z basis.

property try_measure_z_dynq_def: OpDef

Fallible non-destructive measurement of a dynamic logical qubit in the Z basis.

This is the generic operation definition. For the instantiated operation, see try_measure_z_dynq.

x(k: int) → ExtOp[source]

Apply an X gate to one qubit.

Parameters:

k – The number of logical qubits encoded in the block.

property x_def: OpDef

Apply an X gate to one qubit.

This is the generic operation definition. For the instantiated operation, see x.

property x_dynq: ExtOp

X gate on a dynamic logical qubit.

property x_dynq_def: OpDef

X gate on a dynamic logical qubit.

This is the generic operation definition. For the instantiated operation, see x_dynq.

x_with_all_but_one_z(k: int) → ExtOp[source]

Apply an X gate to one qubit and a Z to the rest.

Parameters:

k – The number of logical qubits encoded in the block.

property x_with_all_but_one_z_def: OpDef

Apply an X gate to one qubit and a Z to the rest.

This is the generic operation definition. For the instantiated operation, see x_with_all_but_one_z.

xx(k: int) → ExtOp[source]

Apply an X gate to two qubits.

Parameters:

k – The number of logical qubits encoded in the block.

property xx_def: OpDef

Apply an X gate to two qubits.

This is the generic operation definition. For the instantiated operation, see xx.

xx_phase(k: int) → ExtOp[source]

Apply an XXPhase gate to two qubits within a block.

Parameters:

k – The number of logical qubits encoded in the block.

xx_phase_between_blocks(k: int) → ExtOp[source]

Apply an XXPhase gate to two qubits on different blocks of the same size with dynamic indices.

Parameters:

k – The number of logical qubits encoded in the blocks.

property xx_phase_between_blocks_def: OpDef

Apply an XXPhase gate to two qubits on different blocks of the same size with dynamic indices.

This is the generic operation definition. For the instantiated operation, see xx_phase_between_blocks.

property xx_phase_def: OpDef

Apply an XXPhase gate to two qubits within a block.

This is the generic operation definition. For the instantiated operation, see xx_phase.

property xx_phase_dynq: ExtOp

XXPhase gate on two dynamic logical qubits.

property xx_phase_dynq_def: OpDef

XXPhase gate on two dynamic logical qubits.

This is the generic operation definition. For the instantiated operation, see xx_phase_dynq.

y(k: int) → ExtOp[source]

Apply a Y gate to one qubit.

Parameters:

k – The number of logical qubits encoded in the block.

property y_def: OpDef

Apply a Y gate to one qubit.

This is the generic operation definition. For the instantiated operation, see y.

property y_dynq: ExtOp

Y gate on a dynamic logical qubit.

property y_dynq_def: OpDef

Y gate on a dynamic logical qubit.

This is the generic operation definition. For the instantiated operation, see y_dynq.

yy(k: int) → ExtOp[source]

Apply a Y gate to two qubits.

Parameters:

k – The number of logical qubits encoded in the block.

property yy_def: OpDef

Apply a Y gate to two qubits.

This is the generic operation definition. For the instantiated operation, see yy.

yy_phase(k: int) → ExtOp[source]

Apply a YYPhase gate to two qubits within a block.

Parameters:

k – The number of logical qubits encoded in the block.

yy_phase_between_blocks(k: int) → ExtOp[source]

Apply a YYPhase gate to two qubits on different blocks of the same size with dynamic indices.

Parameters:

k – The number of logical qubits encoded in the blocks.

property yy_phase_between_blocks_def: OpDef

Apply a YYPhase gate to two qubits on different blocks of the same size with dynamic indices.

This is the generic operation definition. For the instantiated operation, see yy_phase_between_blocks.

property yy_phase_def: OpDef

Apply a YYPhase gate to two qubits within a block.

This is the generic operation definition. For the instantiated operation, see yy_phase.

property yy_phase_dynq: ExtOp

YYPhase gate on two dynamic logical qubits.

property yy_phase_dynq_def: OpDef

YYPhase gate on two dynamic logical qubits.

This is the generic operation definition. For the instantiated operation, see yy_phase_dynq.

z(k: int) → ExtOp[source]

Apply a Z gate to one qubit.

Parameters:

k – The number of logical qubits encoded in the block.

property z_def: OpDef

Apply a Z gate to one qubit.

This is the generic operation definition. For the instantiated operation, see z.

property z_dynq: ExtOp

Z gate on a dynamic logical qubit.

property z_dynq_def: OpDef

Z gate on a dynamic logical qubit.

This is the generic operation definition. For the instantiated operation, see z_dynq.

z_with_all_but_one_x(k: int) → ExtOp[source]

Apply a Z gate to one qubit and an X to the rest.

Parameters:

k – The number of logical qubits encoded in the block.

property z_with_all_but_one_x_def: OpDef

Apply a Z gate to one qubit and an X to the rest.

This is the generic operation definition. For the instantiated operation, see z_with_all_but_one_x.

zz(k: int) → ExtOp[source]

Apply a Z gate to two qubits.

Parameters:

k – The number of logical qubits encoded in the block.

property zz_def: OpDef

Apply a Z gate to two qubits.

This is the generic operation definition. For the instantiated operation, see zz.

zz_phase(k: int) → ExtOp[source]

Apply a ZZPhase gate to two qubits within a block.

Parameters:

k – The number of logical qubits encoded in the block.

zz_phase_between_blocks(k: int) → ExtOp[source]

Apply a ZZPhase gate to two qubits on different blocks of the same size with dynamic indices.

Parameters:

k – The number of logical qubits encoded in the blocks.

property zz_phase_between_blocks_def: OpDef

Apply a ZZPhase gate to two qubits on different blocks of the same size with dynamic indices.

This is the generic operation definition. For the instantiated operation, see zz_phase_between_blocks.

property zz_phase_def: OpDef

Apply a ZZPhase gate to two qubits within a block.

This is the generic operation definition. For the instantiated operation, see zz_phase.

property zz_phase_dynq: ExtOp

ZZPhase gate on two dynamic logical qubits.

property zz_phase_dynq_def: OpDef

ZZPhase gate on two dynamic logical qubits.

This is the generic operation definition. For the instantiated operation, see zz_phase_dynq.