QSharpCallable Class

Inheritance
builtins.object
QSharpCallable

Constructor

QSharpCallable(callable_name: str, source: str)

Parameters

callable_name
source

Methods

as_qir

Returns the QIR representation of the callable, assuming the callable is an entry point.

This method uses %qir magic command, which accepts the following (optional) kwargs parameters:

  • target: The intended execution target for the compiled entrypoint.

    Defaults to the active Azure Quantum target (which can be set with %azure.target). Otherwise, defaults to a generic target, which may not work when running on a specific target.

  • target_capability: The capability of the intended execution target.

    If target is specified or there is an active Azure Quantum target, defaults to the target's maximum capability. Otherwise, defaults to FullComputation, which may not be supported when running on a specific target.

  • output_format: the QIR output format. Defaults to IR. Possible options are:

    • IR: Human-readable Intermediate Representation in plain-text

    • Bitcode: LLVM bitcode (only when writing to a output file)

    • BitcodeBase64: LLVM bitcode encoded as Base64

  • output_file: The file path for where to save the output QIR.

simulate

Executes this function or operation on the QuantumSimulator target machine, returning its output as a Python object.

simulate_noise

Executes this function or operation on the open systems simulator, using the currently set noise model and returning its output as a Python object.

simulate_sparse

Executes this function or operation on the sparse simulator, returning its output as a Python object.

toffoli_simulate

Executes this function or operation on the ToffoliSimulator target machine, returning its output as a Python object.

trace

Returns a structure representing the set of gates and qubits used to execute this operation.

as_qir

Returns the QIR representation of the callable, assuming the callable is an entry point.

This method uses %qir magic command, which accepts the following (optional) kwargs parameters:

  • target: The intended execution target for the compiled entrypoint.

    Defaults to the active Azure Quantum target (which can be set with %azure.target). Otherwise, defaults to a generic target, which may not work when running on a specific target.

  • target_capability: The capability of the intended execution target.

    If target is specified or there is an active Azure Quantum target, defaults to the target's maximum capability. Otherwise, defaults to FullComputation, which may not be supported when running on a specific target.

  • output_format: the QIR output format. Defaults to IR. Possible options are:

    • IR: Human-readable Intermediate Representation in plain-text

    • Bitcode: LLVM bitcode (only when writing to a output file)

    • BitcodeBase64: LLVM bitcode encoded as Base64

  • output_file: The file path for where to save the output QIR.

as_qir(**kwargs) -> str

Return type

simulate

Executes this function or operation on the QuantumSimulator target machine, returning its output as a Python object.

simulate(**kwargs) -> Any

simulate_noise

Executes this function or operation on the open systems simulator, using the currently set noise model and returning its output as a Python object.

simulate_noise(**kwargs) -> Any

simulate_sparse

Executes this function or operation on the sparse simulator, returning its output as a Python object.

simulate_sparse(**kwargs) -> Any

toffoli_simulate

Executes this function or operation on the ToffoliSimulator target machine, returning its output as a Python object.

toffoli_simulate(**kwargs) -> Any

trace

Returns a structure representing the set of gates and qubits used to execute this operation.

trace(**kwargs) -> Any