Skip to main contentIBM Quantum Documentation Mirror

QkVF2LayoutResult

typedef struct QkVF2LayoutResult QkVF2LayoutResult

When running the qk_transpiler_pass_standalone_vf2_layout() function it returns its analysis result as a QkVF2LayoutResult object. This object contains the outcome of the transpiler pass, whether the pass was able to find a layout or not, and what the layout selected by the pass was.


Functions

qk_vf2_layout_result_has_match

bool qk_vf2_layout_result_has_match(const QkVF2LayoutResult *layout)

Check whether a result was found.

Safety

Behavior is undefined if layout is not a valid, non-null pointer to a QkVF2LayoutResult.

Parameters

layout – a pointer to the layout

Returns

true if the qk_transpiler_pass_standalone_vf2_layout() run found a layout

qk_vf2_layout_result_num_qubits

uint32_t qk_vf2_layout_result_num_qubits(const QkVF2LayoutResult *layout)

Get the number of virtual qubits in the layout.

Safety

Behavior is undefined if layout is not a valid, non-null pointer to a QkVF2LayoutResult. The result must have a layout found.

Parameters

layout – a pointer to the layout

Returns

The number of virtual qubits in the layout

qk_vf2_layout_result_map_virtual_qubit

uint32_t qk_vf2_layout_result_map_virtual_qubit(const QkVF2LayoutResult *layout, uint32_t qubit)

Get the physical qubit for a given virtual qubit

Safety

Behavior is undefined if layout is not a valid, non-null pointer to a QkVF2LayoutResult. Also qubit must be a valid qubit for the circuit and there must be a result found.

Parameters

  • layout – a pointer to the layout
  • qubit – the virtual qubit to get the physical qubit of

Returns

The physical qubit mapped to by the specified virtual qubit

qk_vf2_layout_result_free

void qk_vf2_layout_result_free(QkVF2LayoutResult *layout)

Free a QkVF2LayoutResult object

Example

QkCircuit *qc = qk_circuit_new(1, 0);

Safety

Behavior is undefined if layout is not a valid, non-null pointer to a QkVF2Layout.

Parameters

layout – a pointer to the layout to free