From 7c3f8bd969b704d98d33468b836f1efcb238c35b Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 10 Apr 2026 11:53:56 -0700 Subject: [PATCH 01/26] Moved `qsharp` package to use RTS style doc strings. --- source/pip/qsharp/_native.pyi | 36 +++++--- .../pip/qsharp/interop/cirq/_neutral_atom.py | 17 ++-- .../qiskit/backends/neutral_atom_backend.py | 89 ++++++++++--------- .../interop/qiskit/backends/qsharp_backend.py | 81 +++++++++-------- .../interop/qiskit/backends/re_backend.py | 61 +++++++------ .../noisy_simulator/_noisy_simulator.pyi | 7 +- source/pip/qsharp/openqasm/_circuit.py | 23 +++-- source/pip/qsharp/openqasm/_compile.py | 35 ++++---- source/pip/qsharp/openqasm/_estimate.py | 28 +++--- source/pip/qsharp/openqasm/_import.py | 38 ++++---- source/pip/qsharp/openqasm/_run.py | 56 ++++++------ 11 files changed, 245 insertions(+), 226 deletions(-) diff --git a/source/pip/qsharp/_native.pyi b/source/pip/qsharp/_native.pyi index acb771a961..90fa08e735 100644 --- a/source/pip/qsharp/_native.pyi +++ b/source/pip/qsharp/_native.pyi @@ -713,20 +713,28 @@ def estimate_custom( """ Estimates quantum resources for a given algorithm, qubit, and code. - Args: - algorithm: Python object representing the algorithm. - qubit: The qubit properties as a dictionary. - qec: Python object representing the quantum error correction code. - factories (List): List of python objects representing factories. Default: []. - error_budget (float): The total error budget, which is uniformly distributed. Default: 0.01. - max_factories (Optional[int]): Constrains the number of factories. Default: None. - logical_depth_factor (Optional[float]): Extends algorithmic logical depth by a factor >= 1. Default: None. - max_physical_qubits (Optional[int]): Forces estimator to not exceed provided number of physical qubits, may fail. Default: None. - max_duration (Optional[int]): Allows estimator to run for given runtime in nanoseconds, may fail. Default: None. - error_budget_pruning (bool): Will try to prune the error budget to increase magic state error budget. Default: False. - - Returns: - Dict: A dictionary with resource estimation results. + :param algorithm: Python object representing the algorithm. + :param qubit: The qubit properties as a dictionary. + :param qec: Python object representing the quantum error correction code. + :param factories: List of python objects representing factories. Defaults to ``[]``. + :type factories: List + :param error_budget: The total error budget, which is uniformly distributed. Defaults to ``0.01``. + :type error_budget: float + :param max_factories: Constrains the number of factories. Defaults to ``None``. + :type max_factories: int, optional + :param logical_depth_factor: Extends algorithmic logical depth by a factor >= 1. Defaults to ``None``. + :type logical_depth_factor: float, optional + :param max_physical_qubits: Forces estimator to not exceed provided number of physical qubits, may fail. + Defaults to ``None``. + :type max_physical_qubits: int, optional + :param max_duration: Allows estimator to run for given runtime in nanoseconds, may fail. + Defaults to ``None``. + :type max_duration: int, optional + :param error_budget_pruning: Will try to prune the error budget to increase magic state error budget. + Defaults to ``False``. + :type error_budget_pruning: bool + :return: A dictionary with resource estimation results. + :rtype: Dict """ ... diff --git a/source/pip/qsharp/interop/cirq/_neutral_atom.py b/source/pip/qsharp/interop/cirq/_neutral_atom.py index be45f12caf..59a6c2841d 100644 --- a/source/pip/qsharp/interop/cirq/_neutral_atom.py +++ b/source/pip/qsharp/interop/cirq/_neutral_atom.py @@ -101,14 +101,15 @@ def run_sweep( ) -> List[NeutralAtomCirqResult]: """Run the circuit for each parameter resolver in the sweep. - Args: - program: The Cirq circuit to simulate. - params: A :class:`cirq.Sweepable` defining the parameter resolvers - to sweep over. Each resolver produces one result. - repetitions: Number of shots per parameter resolver. - - Returns: - A list of :class:`NeutralAtomCirqResult` objects, one per resolver. + :param program: The Cirq circuit to simulate. + :type program: cirq.AbstractCircuit + :param params: A :class:`cirq.Sweepable` defining the parameter resolvers + to sweep over. Each resolver produces one result. + :type params: cirq.Sweepable + :param repetitions: Number of shots per parameter resolver. + :type repetitions: int + :return: A list of :class:`NeutralAtomCirqResult` objects, one per resolver. + :rtype: List[NeutralAtomCirqResult] """ resolvers = list(cirq.to_sweep(params)) if params is not None else [cirq.ParamResolver()] return [ diff --git a/source/pip/qsharp/interop/qiskit/backends/neutral_atom_backend.py b/source/pip/qsharp/interop/qiskit/backends/neutral_atom_backend.py index 6e176b7f0e..e61c6a55eb 100644 --- a/source/pip/qsharp/interop/qiskit/backends/neutral_atom_backend.py +++ b/source/pip/qsharp/interop/qiskit/backends/neutral_atom_backend.py @@ -79,37 +79,38 @@ def __init__( transpile_options: Optional[Dict[str, Any]] = None, qasm_export_options: Optional[Dict[str, Any]] = None, skip_transpilation: bool = False, - **fields, + **options, ): """ - Parameters: - device (NeutralAtomDevice, optional): The NeutralAtomDevice instance to use - for compilation and simulation. A default-configured device is created - automatically if not provided. Pass a custom device to control the - qubit layout (column count, zone dimensions, etc.). - target (Target): Qiskit transpiler target. Defaults to the - NeutralAtomDevice native gate set ``{rz, sx, cz, measure, reset}``. - Override only if you need a custom decomposition strategy. - qiskit_pass_options (Dict): Options forwarded to Qiskit pre-transpilation - passes. - transpile_options (Dict): Options forwarded to ``qiskit.transpile()``. - qasm_export_options (Dict): Options forwarded to the Qiskit QASM3 exporter. - skip_transpilation (bool): Skip Qiskit transpilation. Useful when the - circuit is already expressed in terms of the target gate set. - **fields: Additional backend options. Common options: - - - ``name`` (str): Backend name for job metadata. Defaults to the circuit - name. - - ``shots`` (int): Number of shots. Defaults to 1024. - - ``seed`` (int): Random seed for reproducibility. Defaults to None. - - ``noise`` (NoiseConfig): Optional per-gate noise model. Defaults to - None (noiseless). - - ``simulator_type`` (str): Simulator to use — ``"clifford"`` (Clifford - only), ``"cpu"`` (CPU full-state), ``"gpu"`` (GPU full-state), or - None to auto-select (GPU if available, CPU otherwise). - - ``output_semantics`` (OutputSemantics): QIR output encoding. Defaults - to ``Qiskit``. - - ``executor``: Executor for async job submission. + :param device: The NeutralAtomDevice instance to use for compilation and simulation. + A default-configured device is created automatically if not provided. + Pass a custom device to control the qubit layout (column count, zone dimensions, etc.). + :type device: NeutralAtomDevice, optional + :param target: Qiskit transpiler target. Defaults to the NeutralAtomDevice native + gate set ``{rz, sx, cz, measure, reset}``. Override only if you need a custom + decomposition strategy. + :type target: Target, optional + :param qiskit_pass_options: Options forwarded to Qiskit pre-transpilation passes. + :type qiskit_pass_options: Dict, optional + :param transpile_options: Options forwarded to ``qiskit.transpile()``. + :type transpile_options: Dict, optional + :param qasm_export_options: Options forwarded to the Qiskit QASM3 exporter. + :type qasm_export_options: Dict, optional + :param skip_transpilation: Skip Qiskit transpilation. Useful when the circuit is + already expressed in terms of the target gate set. + :type skip_transpilation: bool + :param **options: Default option overrides. These can also be overridden per-call via + :meth:`run`. Common options: + + - ``name`` (str): Backend name for job metadata. Defaults to the circuit name. + - ``shots`` (int): Number of shots. Defaults to ``1024``. + - ``seed`` (int): Random seed for reproducibility. Defaults to ``None``. + - ``noise`` (NoiseConfig): Optional per-gate noise model. Defaults to ``None`` (noiseless). + - ``simulator_type`` (str): Simulator to use — ``"clifford"`` (Clifford only), + ``"cpu"`` (CPU full-state), ``"gpu"`` (GPU full-state), or ``None`` to + auto-select (GPU if available, CPU otherwise). + - ``output_semantics`` (OutputSemantics): QIR output encoding. Defaults to ``OutputSemantics.Qiskit``. + - ``executor``: Executor for async job submission. """ self._device = device super().__init__( @@ -118,7 +119,7 @@ def __init__( transpile_options, qasm_export_options, skip_transpilation, - **fields, + **options, ) def _get_device(self): @@ -157,17 +158,23 @@ def run( ) -> Union[QsSimJob, QsJobSet]: """Simulate the given circuit(s) using the NeutralAtomDevice pipeline. - Args: - run_input: A single ``QuantumCircuit`` or a list of them. - **options: Per-call option overrides (``shots``, ``seed``, ``noise``, - ``simulator_type``, etc.). See class docstring for the full list. - - Returns: - QsSimJob: A job object whose ``.result()`` returns a Qiskit ``Result``. - - Raises: - ValueError: If ``run_input`` is not a ``QuantumCircuit`` or list thereof, - or if a ``target_profile`` option is provided that is not ``TargetProfile.Base``. + :param run_input: A single ``QuantumCircuit`` or a list of them. + :type run_input: QuantumCircuit or List[QuantumCircuit] + :param **options: Per-call option overrides. Common options: + + - ``name`` (str): Backend name for job metadata. Defaults to the circuit name. + - ``shots`` (int): Number of shots. Defaults to ``1024``. + - ``seed`` (int): Random seed for reproducibility. Defaults to ``None``. + - ``noise`` (NoiseConfig): Optional per-gate noise model. Defaults to ``None`` (noiseless). + - ``simulator_type`` (str): Simulator to use — ``"clifford"`` (Clifford only), + ``"cpu"`` (CPU full-state), ``"gpu"`` (GPU full-state), or ``None`` to + auto-select (GPU if available, CPU otherwise). + - ``output_semantics`` (OutputSemantics): QIR output encoding. Defaults to ``OutputSemantics.Qiskit``. + - ``executor``: Executor for async job submission. + :return: A job object whose ``.result()`` returns a Qiskit ``Result``. + :rtype: QsSimJob + :raises ValueError: If ``run_input`` is not a ``QuantumCircuit`` or list thereof, + or if a ``target_profile`` other than ``TargetProfile.Base`` is provided. """ run_input = self._validate_quantum_circuits(run_input) return self._run(run_input, **options) diff --git a/source/pip/qsharp/interop/qiskit/backends/qsharp_backend.py b/source/pip/qsharp/interop/qiskit/backends/qsharp_backend.py index 17f77b2f24..a95a838897 100644 --- a/source/pip/qsharp/interop/qiskit/backends/qsharp_backend.py +++ b/source/pip/qsharp/interop/qiskit/backends/qsharp_backend.py @@ -34,26 +34,32 @@ def __init__( transpile_options: Optional[Dict[str, Any]] = None, qasm_export_options: Optional[Dict[str, Any]] = None, skip_transpilation: bool = False, - **fields, + **options, ): """ - Parameters: - target (Target): The target to use for the backend. - qiskit_pass_options (Dict): Options for the Qiskit passes. - transpile_options (Dict): Options for the transpiler. - qasm_export_options (Dict): Options for the QASM3 exporter. - **options: Additional options for the execution. - - name (str): The name of the circuit. This is used as the entry point for the program. - The circuit name will be used if not specified. - - target_profile (TargetProfile): The target profile to use for the compilation. - - output_semantics (OutputSemantics, optional): The output semantics for the compilation. Defaults to `Qiskit`. - - shots (int): The number of shots to run the program for. Defaults to `1024`. - - seed (int): The seed to use for the random number generator. Defaults to `None`. - - search_path (str): The path to search for imports. Defaults to '.'. - - output_fn (Callable[[Output], None]): A callback function to - receive the output of the circuit. Defaults to `None`. - - executor(ThreadPoolExecutor or other Executor): - The executor to be used to submit the job. Defaults to SynchronousExecutor. + :param target: The target to use for the backend. + :type target: Target, optional + :param qiskit_pass_options: Options for the Qiskit passes. + :type qiskit_pass_options: Dict, optional + :param transpile_options: Options for the transpiler. + :type transpile_options: Dict, optional + :param qasm_export_options: Options for the QASM3 exporter. + :type qasm_export_options: Dict, optional + :param skip_transpilation: Skip Qiskit transpilation. + :type skip_transpilation: bool + :param **options: Default option overrides. These can also be overridden per-call via + :meth:`run`. Common options: + + - ``name`` (str): The name of the circuit used as the entry point. Defaults to the circuit name. + - ``target_profile`` (TargetProfile): The target profile to use for the compilation. + - ``output_semantics`` (OutputSemantics): The output semantics for the compilation. + Defaults to ``OutputSemantics.Qiskit``. + - ``shots`` (int): The number of shots to run the program for. Defaults to ``1024``. + - ``seed`` (int): The seed to use for the random number generator. Defaults to ``None``. + - ``search_path`` (str): The path to search for imports. Defaults to ``'.'``. + - ``output_fn`` (Callable): A callback function to receive the output of the circuit. + Defaults to ``None``. + - ``executor``: The executor to be used to submit the job. Defaults to ``SynchronousExecutor``. """ super().__init__( @@ -62,7 +68,7 @@ def __init__( transpile_options, qasm_export_options, skip_transpilation, - **fields, + **options, ) @classmethod @@ -87,28 +93,25 @@ def run( """ Runs the given QuantumCircuit using the Q# simulator. - Args: - run_input (QuantumCircuit): The QuantumCircuit to be executed. - **options: Additional options for the execution. Defaults to backend config values. - - name (str): The name of the circuit. This is used as the entry point for the program. - The circuit name will be used if not specified. - - params (Optional[str]): The entry expression to use for the program. Defaults to None. - - target_profile (TargetProfile): The target profile to use for the compilation. - - output_semantics (OutputSemantics, optional): The output semantics for the compilation. - - shots (int): The number of shots to run the program for. Defaults to 1024. - - seed (int): The seed to use for the random number generator. Defaults to None. - - search_path (str): The path to search for imports. Defaults to '.'. - - output_fn (Callable[[Output], None]): A callback function to - receive the output of the circuit. - - executor(ThreadPoolExecutor or other Executor): - The executor to be used to submit the job. - Returns: - QSharpJob: The simulation job - + :param run_input: The QuantumCircuit to be executed. + :type run_input: QuantumCircuit + :param **options: Per-call option overrides. Common options: + + - ``name`` (str): The name of the circuit used as the entry point. Defaults to the circuit name. + - ``target_profile`` (TargetProfile): The target profile to use for the compilation. + - ``output_semantics`` (OutputSemantics): The output semantics for the compilation. + Defaults to ``OutputSemantics.Qiskit``. + - ``shots`` (int): The number of shots to run the program for. Defaults to ``1024``. + - ``seed`` (int): The seed to use for the random number generator. Defaults to ``None``. + - ``search_path`` (str): The path to search for imports. Defaults to ``'.'``. + - ``output_fn`` (Callable): A callback function to receive the output of the circuit. + Defaults to ``None``. + - ``executor``: The executor to be used to submit the job. Defaults to ``SynchronousExecutor``. + :return: The simulation job. + :rtype: QsSimJob :raises QSharpError: If there is an error evaluating the source code. :raises QasmError: If there is an error generating, parsing, or compiling QASM. - :raises ValueError: If the run_input is not a QuantumCircuit - or List[QuantumCircuit]. + :raises ValueError: If run_input is not a QuantumCircuit or List[QuantumCircuit]. """ run_input = self._validate_quantum_circuits(run_input) diff --git a/source/pip/qsharp/interop/qiskit/backends/re_backend.py b/source/pip/qsharp/interop/qiskit/backends/re_backend.py index aad5b0b6c4..fc3166bc63 100644 --- a/source/pip/qsharp/interop/qiskit/backends/re_backend.py +++ b/source/pip/qsharp/interop/qiskit/backends/re_backend.py @@ -44,21 +44,26 @@ def __init__( transpile_options: Optional[Dict[str, Any]] = None, qasm_export_options: Optional[Dict[str, Any]] = None, skip_transpilation: bool = False, - **fields, + **options, ): """ - Parameters: - target (Target): The target to use for the backend. - qiskit_pass_options (Dict): Options for the Qiskit passes. - transpile_options (Dict): Options for the transpiler. - qasm_export_options (Dict): Options for the QASM3 exporter. - **options: Additional options for the execution. - - params (EstimatorParams): Configuration values for resource estimation. - - name (str): The name of the circuit. This is used as the entry point for the program. - The circuit name will be used if not specified. - - search_path (str): Path to search in for qasm imports. Defaults to '.'. - - executor(ThreadPoolExecutor or other Executor): - The executor to be used to submit the job. Defaults to SynchronousExecutor. + :param target: The target to use for the backend. + :type target: Target, optional + :param qiskit_pass_options: Options for the Qiskit passes. + :type qiskit_pass_options: Dict, optional + :param transpile_options: Options for the transpiler. + :type transpile_options: Dict, optional + :param qasm_export_options: Options for the QASM3 exporter. + :type qasm_export_options: Dict, optional + :param skip_transpilation: Skip Qiskit transpilation. + :type skip_transpilation: bool + :param **options: Default option overrides. These can also be overridden per-call via + :meth:`run`. Common options: + + - ``params`` (EstimatorParams): Configuration values for resource estimation. + - ``name`` (str): The name of the circuit used as the entry point. Defaults to the circuit name. + - ``search_path`` (str): Path to search in for qasm imports. Defaults to ``'.'``. + - ``executor``: The executor to be used to submit the job. Defaults to ``SynchronousExecutor``. """ super().__init__( @@ -67,7 +72,7 @@ def __init__( transpile_options, qasm_export_options, skip_transpilation, - **fields, + **options, ) @property @@ -98,22 +103,22 @@ def run( Performs resource estimation on the supplied QuantumCircuit via conversion to OpenQASM 3. - Parameters: - run_input ('QuantumCircuit'): The input Qiskit QuantumCircuit object. - params (Optional EstimatorParams): Configuration values for resource estimation. - **options: Additional options for the execution. - - name (str): The name of the circuit. This is used as the entry point for the program. - The circuit name will be used if not specified. - - search_path (str): Path to search in for qasm imports. Defaults to '.'. - - target_profile (TargetProfile): The target profile to use for the backend. - - executor(ThreadPoolExecutor or other Executor): - The executor to be used to submit the job. - Returns: - ReJob: The resource estimation job - + :param run_input: The input Qiskit QuantumCircuit object. + :type run_input: QuantumCircuit + :param params: Configuration values for resource estimation. + :type params: EstimatorParams, optional + :param **options: Per-call option overrides. Common options: + + - ``params`` (EstimatorParams): Configuration values for resource estimation. + - ``name`` (str): The name of the circuit used as the entry point. Defaults to the circuit name. + - ``search_path`` (str): Path to search in for qasm imports. Defaults to ``'.'``. + - ``target_profile`` (TargetProfile): The target profile to use for the backend. + - ``executor``: The executor to be used to submit the job. Defaults to ``SynchronousExecutor``. + :return: The resource estimation job. + :rtype: ReJob :raises QSharpError: If there is an error evaluating the source code. :raises QasmError: If there is an error generating, parsing, or compiling QASM. - :raises ValueError: If the run_input is not a QuantumCircuit. + :raises ValueError: If run_input is not a QuantumCircuit. """ if isinstance(run_input, QuantumCircuit): run_input = [run_input] diff --git a/source/pip/qsharp/noisy_simulator/_noisy_simulator.pyi b/source/pip/qsharp/noisy_simulator/_noisy_simulator.pyi index ce712aa0b0..cd740324b6 100644 --- a/source/pip/qsharp/noisy_simulator/_noisy_simulator.pyi +++ b/source/pip/qsharp/noisy_simulator/_noisy_simulator.pyi @@ -24,10 +24,11 @@ class Operation: """ Construct an operation from a list of Kraus operators. Matrices must be of dimension 2^k x 2^k, where k is an integer. - Raises a `NoisySimulatorError` if the Kraus matrices are ill formed. - Input: - kraus_operators: List[List[List[complex]]], can be a Python list or a numpy array. + :param kraus_operators: List of Kraus operators. Each operator is a 2D matrix stored as + a list of lists of complex numbers, or a numpy array. + :type kraus_operators: List[List[List[complex]]] + :raises NoisySimulatorError: If the Kraus matrices are ill formed. """ ... diff --git a/source/pip/qsharp/openqasm/_circuit.py b/source/pip/qsharp/openqasm/_circuit.py index bcd77707bf..61649048c8 100644 --- a/source/pip/qsharp/openqasm/_circuit.py +++ b/source/pip/qsharp/openqasm/_circuit.py @@ -25,20 +25,17 @@ def circuit( Synthesizes a circuit for an OpenQASM program. Either a program string or an operation must be provided. - Args: - source (str): An OpenQASM program. Alternatively, a callable can be provided, - which must be an already imported global callable. - *args: The arguments to pass to the callable, if one is provided. - **kwargs: Additional keyword arguments to pass to the execution. - - name (str): The name of the program. This is used as the entry point for the program. - - search_path (Optional[str]): The optional search path for resolving file references. - Returns: - Circuit: The synthesized circuit. + :param source: An OpenQASM program. Alternatively, a callable can be provided, + which must be an already imported global callable. + :type source: str, optional + :param **kwargs: Additional keyword arguments. Common options: - Raises: - QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. - QSharpError: If there is an error evaluating the program. - QSharpError: If there is an error synthesizing the circuit. + - ``name`` (str): The name of the program. This is used as the entry point for the program. + - ``search_path`` (str): The optional search path for resolving file references. + :return: The synthesized circuit. + :rtype: Circuit + :raises QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. + :raises QSharpError: If there is an error evaluating or synthesizing the circuit. """ ipython_helper() diff --git a/source/pip/qsharp/openqasm/_compile.py b/source/pip/qsharp/openqasm/_compile.py index 850b9621dc..9a26b31224 100644 --- a/source/pip/qsharp/openqasm/_compile.py +++ b/source/pip/qsharp/openqasm/_compile.py @@ -29,24 +29,19 @@ def compile( target as QIR (Quantum Intermediate Representation). Either a full program or a callable with arguments must be provided. - Args: - source (str): An OpenQASM program. Alternatively, a callable can be provided, - which must be an already imported global callable. - *args: The arguments to pass to the callable, if one is provided. - **kwargs: Additional keyword arguments to pass to the compilation when source program is provided. - - name (str): The name of the circuit. This is used as the entry point for the program. - - target_profile (TargetProfile): The target profile to use for code generation. - - search_path (Optional[str]): The optional search path for resolving file references. - - output_semantics (OutputSemantics, optional): The output semantics for the compilation. - - Returns: - QirInputData: The compiled program. - - Raises: - QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. - QSharpError: If there is an error compiling the program. - - To get the QIR string from the compiled program, use `str()`. + :param source: An OpenQASM program. Alternatively, a callable can be provided, + which must be an already imported global callable. + :type source: str + :param **kwargs: Additional keyword arguments for compiling the source program. Common options: + + - ``name`` (str): The name of the circuit. This is used as the entry point for the program. + - ``target_profile`` (TargetProfile): The target profile to use for code generation. + - ``search_path`` (str): The optional search path for resolving file references. + - ``output_semantics`` (OutputSemantics): The output semantics for the compilation. + :return: The compiled program. Use ``str()`` to get the QIR string. + :rtype: QirInputData + :raises QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. + :raises QSharpError: If there is an error compiling the program. Example: @@ -91,7 +86,9 @@ def compile( **kwargs, ) else: - raise ValueError("source must be a string or a callable with __global_callable attribute") + raise ValueError( + "source must be a string or a callable with __global_callable attribute" + ) res = QirInputData("main", ll_str) durationMs = (monotonic() - start) * 1000 diff --git a/source/pip/qsharp/openqasm/_estimate.py b/source/pip/qsharp/openqasm/_estimate.py index 1555e58549..270cd74c2c 100644 --- a/source/pip/qsharp/openqasm/_estimate.py +++ b/source/pip/qsharp/openqasm/_estimate.py @@ -29,22 +29,20 @@ def estimate( Estimates the resource requirements for executing OpenQASM source code. Either a full program or a callable with arguments must be provided. - Args: - source (str): An OpenQASM program. Alternatively, a callable can be provided, - which must be an already imported global callable. - params: The parameters to configure estimation. - callable: The callable to estimate resources for, if no entry expression is provided. - *args: The arguments to pass to the callable, if one is provided. - **kwargs: Additional keyword arguments to pass to the execution. - - name (str): The name of the circuit. This is used as the entry point for the program. Defaults to 'program'. - - search_path (str): The optional search path for resolving imports. + :param source: An OpenQASM program. Alternatively, a callable can be provided, + which must be an already imported global callable. + :type source: str + :param params: The parameters to configure estimation. + :type params: Dict, List, or EstimatorParams, optional + :param **kwargs: Additional keyword arguments. Common options: - Returns: - EstimatorResult: The estimated resources. - - Raises: - QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. - QSharpError: If there is an error compiling the program. + - ``name`` (str): The name of the circuit. This is used as the entry point for the program. + Defaults to ``'program'``. + - ``search_path`` (str): The optional search path for resolving imports. + :return: The estimated resources. + :rtype: EstimatorResult + :raises QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. + :raises QSharpError: If there is an error compiling the program. """ ipython_helper() diff --git a/source/pip/qsharp/openqasm/_import.py b/source/pip/qsharp/openqasm/_import.py index 1129204309..ba36aa1042 100644 --- a/source/pip/qsharp/openqasm/_import.py +++ b/source/pip/qsharp/openqasm/_import.py @@ -19,31 +19,29 @@ def import_openqasm( **kwargs: Any, ) -> Any: """ - Imports OpenQASM source code into the active QDK interpreter. By default, import uses `ProgramType.Operation` such that - the source becomes a Q# operation in the global namespace with parameters for any declared classical inputs and - paramters for each of the declared qubits, while any explicit or implicit output declarations become the return - type of the operation. - Alternatively, specifying `ProgramType.File` will treat the input source as a stand-alone program and create an - operation in the `qasm_import` namespace that only takes classical parameters, allocates the required qubits + Imports OpenQASM source code into the active QDK interpreter. By default, import uses ``ProgramType.Operation`` + such that the source becomes a Q# operation in the global namespace with parameters for any declared classical + inputs and parameters for each of the declared qubits, while any explicit or implicit output declarations become + the return type of the operation. + Alternatively, specifying ``ProgramType.File`` will treat the input source as a stand-alone program and create + an operation in the ``qasm_import`` namespace that only takes classical parameters, allocates the required qubits internally and releases them at the end of the operation. - Finally, using `ProgramType.Fragments` executes the provided source in the current interactive interpreter, + Finally, using ``ProgramType.Fragments`` executes the provided source in the current interactive interpreter, defining any declared variables or operations in the current scope and returning the value of the last statement in the source. - Args: - source (str): An OpenQASM program or fragment. - **kwargs: Additional keyword arguments to pass to the execution. - - name (str): The name of the program. This is used as the entry point for the program. - - search_path (Optional[str]): The optional search path for resolving file references. - - output_semantics (OutputSemantics, optional): The output semantics for the compilation. - - program_type (ProgramType, optional): The type of program compilation to perform. Defaults to `ProgramType.Operation`. + :param source: An OpenQASM program or fragment. + :type source: str + :param **kwargs: Additional keyword arguments. Common options: - Returns: - value: The value returned by the last statement in the source code. - - Raises: - QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. - QSharpError: If there is an error compiling the program. + - ``name`` (str): The name of the program. This is used as the entry point for the program. + - ``search_path`` (str): The optional search path for resolving file references. + - ``output_semantics`` (OutputSemantics): The output semantics for the compilation. + - ``program_type`` (ProgramType): The type of program compilation to perform. + Defaults to ``ProgramType.Operation``. + :return: The value returned by the last statement in the source code. + :raises QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. + :raises QSharpError: If there is an error compiling the program. """ ipython_helper() diff --git a/source/pip/qsharp/openqasm/_run.py b/source/pip/qsharp/openqasm/_run.py index e502bca7bb..b04f1be5d4 100644 --- a/source/pip/qsharp/openqasm/_run.py +++ b/source/pip/qsharp/openqasm/_run.py @@ -48,32 +48,36 @@ def run( Either a full program or a callable with arguments must be provided. Each shot uses an independent instance of the simulator. - Args: - source (str): An OpenQASM program. Alternatively, a callable can be provided, - which must be an already imported global callable. - shots: The number of shots to run, Defaults to 1024. - *args: The arguments to pass to the callable, if one is provided. - on_result: A callback function that will be called with each result. Only used when a callable is provided. - save_events: If true, the output of each shot will be saved. If false, they will be printed. Only used when a callable is provided. - noise: The noise to use in simulation. - qubit_loss: The probability of qubit loss in simulation. - as_bitstring: If true, the result registers will be converted to bitstrings. - **kwargs: Additional keyword arguments to pass to the compilation when source program is provided. - - name (str): The name of the circuit. This is used as the entry point for the program. - - target_profile (TargetProfile): The target profile to use for code generation. - - search_path (Optional[str]): The optional search path for resolving file references. - - output_semantics (OutputSemantics, optional): The output semantics for the compilation. - - seed (int): The seed to use for the random number generator. - - Returns: - values: A list of results or runtime errors. If `save_events` is true, - a List of ShotResults is returned. - - Raises: - QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. - QSharpError: If there is an error interpreting the input. - ValueError: If the number of shots is less than 1. - ValueError: If the `on_result` and `save_events` parameters are used when running OpenQASM programs. + :param source: An OpenQASM program. Alternatively, a callable can be provided, + which must be an already imported global callable. + :type source: str + :param shots: The number of shots to run. Defaults to ``1024``. + :type shots: int + :param on_result: A callback function that will be called with each result. + Only used when a callable is provided. + :type on_result: Callable, optional + :param save_events: If true, the output of each shot will be saved. If false, they will be printed. + Only used when a callable is provided. + :type save_events: bool + :param noise: The noise to use in simulation. + :type noise: Union[Tuple[float, float, float], PauliNoise, BitFlipNoise, PhaseFlipNoise, DepolarizingNoise, NoiseConfig], optional + :param qubit_loss: The probability of qubit loss in simulation. + :type qubit_loss: float, optional + :param as_bitstring: If true, the result registers will be converted to bitstrings. + :type as_bitstring: bool + :param **kwargs: Additional keyword arguments for compiling the source program. Common options: + + - ``name`` (str): The name of the circuit. This is used as the entry point for the program. + - ``target_profile`` (TargetProfile): The target profile to use for code generation. + - ``search_path`` (str): The optional search path for resolving file references. + - ``output_semantics`` (OutputSemantics): The output semantics for the compilation. + - ``seed`` (int): The seed to use for the random number generator. + :return: A list of results or runtime errors. If ``save_events`` is true, a list of ShotResults is returned. + :rtype: List[Any] + :raises QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. + :raises QSharpError: If there is an error interpreting the input. + :raises ValueError: If the number of shots is less than 1. + :raises ValueError: If ``on_result`` or ``save_events`` are used when running OpenQASM programs. """ ipython_helper() From df6d92b94e215f5e9a253e896e6518216c43bfcf Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 10 Apr 2026 11:57:54 -0700 Subject: [PATCH 02/26] `:returns:` -> `:return:` --- source/pip/qsharp/_device/_atom/__init__.py | 2 +- source/pip/qsharp/_native.pyi | 2 +- source/pip/qsharp/_qsharp.py | 6 +++--- source/pip/qsharp/utils/_utils.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/pip/qsharp/_device/_atom/__init__.py b/source/pip/qsharp/_device/_atom/__init__.py index 6a8b0ae80c..bea15a145c 100644 --- a/source/pip/qsharp/_device/_atom/__init__.py +++ b/source/pip/qsharp/_device/_atom/__init__.py @@ -244,7 +244,7 @@ def simulate( If `None` (default), the GPU simulator will be tried first, falling back to CPU if a suitable GPU device could not be located. :param seed: An optional random seed for reproducibility. - :returns: The results of each shot of the simulation as a list. + :return: The results of each shot of the simulation as a list. """ from ._validate import ValidateNoConditionalBranches diff --git a/source/pip/qsharp/_native.pyi b/source/pip/qsharp/_native.pyi index 90fa08e735..8970f521fe 100644 --- a/source/pip/qsharp/_native.pyi +++ b/source/pip/qsharp/_native.pyi @@ -327,7 +327,7 @@ class Interpreter: """ Returns the sparse state vector of the simulator as a StateDump object. - :returns: The state of the simulator. + :return: The state of the simulator. """ ... diff --git a/source/pip/qsharp/_qsharp.py b/source/pip/qsharp/_qsharp.py index 50b0556fd6..0ab53eb274 100644 --- a/source/pip/qsharp/_qsharp.py +++ b/source/pip/qsharp/_qsharp.py @@ -342,7 +342,7 @@ def get_interpreter() -> Interpreter: """ Returns the Q# interpreter. - :returns: The Q# interpreter. + :return: The Q# interpreter. """ global _interpreter if _interpreter is None: @@ -355,7 +355,7 @@ def get_config() -> Config: """ Returns the Q# interpreter configuration. - :returns: The Q# interpreter configuration. + :return: The Q# interpreter configuration. """ global _config if _config is None: @@ -1061,7 +1061,7 @@ def dump_machine() -> StateDump: """ Returns the sparse state vector of the simulator as a StateDump object. - :returns: The state of the simulator. + :return: The state of the simulator. """ ipython_helper() return StateDump(get_interpreter().dump_machine()) diff --git a/source/pip/qsharp/utils/_utils.py b/source/pip/qsharp/utils/_utils.py index 6268c1801a..5b3236cee5 100644 --- a/source/pip/qsharp/utils/_utils.py +++ b/source/pip/qsharp/utils/_utils.py @@ -13,7 +13,7 @@ def dump_operation(operation: str, num_qubits: int) -> List[List[complex]]: :param operation: The operation to be performed, which must operate on a list of qubits. :param num_qubits: The number of qubits to be used. - :returns: The matrix representing the operation. + :return: The matrix representing the operation. """ code = f"""{{ let op = {operation}; From f4ed84e9ad884529ec7b6ca2c5ab20bab8e41de1 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 10 Apr 2026 12:00:20 -0700 Subject: [PATCH 03/26] added missing `:raises:` --- source/pip/qsharp/_native.pyi | 2 ++ source/pip/qsharp/_qsharp.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/source/pip/qsharp/_native.pyi b/source/pip/qsharp/_native.pyi index 8970f521fe..216f30ffb9 100644 --- a/source/pip/qsharp/_native.pyi +++ b/source/pip/qsharp/_native.pyi @@ -339,6 +339,8 @@ class Interpreter: in the simulator up to the current point. Requires the interpreter to be initialized with `trace_circuit=True`. + + :raises QSharpError: If the interpreter was not initialized with ``trace_circuit=True``. """ ... diff --git a/source/pip/qsharp/_qsharp.py b/source/pip/qsharp/_qsharp.py index 0ab53eb274..74349df4bb 100644 --- a/source/pip/qsharp/_qsharp.py +++ b/source/pip/qsharp/_qsharp.py @@ -1075,6 +1075,8 @@ def dump_circuit() -> Circuit: in the simulator up to the current point. Requires the interpreter to be initialized with `trace_circuit=True`. + + :raises QSharpError: If the interpreter was not initialized with ``trace_circuit=True``. """ ipython_helper() return get_interpreter().dump_circuit() From 3b70421187307b9ba85a95f78afa33a8a79b4012 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 10 Apr 2026 12:43:47 -0700 Subject: [PATCH 04/26] Added ':rtype:` tags --- source/pip/qsharp/_qsharp.py | 33 ++++++++++++++++------- source/pip/qsharp/estimator/_estimator.py | 5 ++-- source/pip/qsharp/openqasm/_import.py | 1 + source/pip/qsharp/utils/_utils.py | 1 + 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/source/pip/qsharp/_qsharp.py b/source/pip/qsharp/_qsharp.py index 74349df4bb..f77c849c62 100644 --- a/source/pip/qsharp/_qsharp.py +++ b/source/pip/qsharp/_qsharp.py @@ -263,6 +263,8 @@ def init( :param trace_circuit: Enables tracing of circuit during execution. Passing `True` is required for the `dump_circuit` function to return a circuit. The `circuit` function is *NOT* affected by this parameter will always generate a circuit. + :return: The Q# interpreter configuration. + :rtype: Config """ from ._fs import read_file, list_directory, exists, join, resolve from ._http import fetch_github @@ -343,6 +345,7 @@ def get_interpreter() -> Interpreter: Returns the Q# interpreter. :return: The Q# interpreter. + :rtype: Interpreter """ global _interpreter if _interpreter is None: @@ -356,6 +359,7 @@ def get_config() -> Config: Returns the Q# interpreter configuration. :return: The Q# interpreter configuration. + :rtype: Config """ global _config if _config is None: @@ -410,6 +414,8 @@ def check_eq( :param state: The state to check against, provided either as a dictionary of state indices to complex amplitudes, or as a list of real amplitudes. :param tolerance: The tolerance for the check. Defaults to 1e-10. + :return: ``True`` if the state dump is equal to the given state within the given tolerance, ignoring global phase. + :rtype: bool """ phase = None # Convert a dense list of real amplitudes to a dictionary of state indices to complex amplitudes @@ -436,6 +442,9 @@ def check_eq( def as_dense_state(self) -> List[complex]: """ Returns the state dump as a dense list of complex amplitudes. This will include zero amplitudes. + + :return: A dense list of complex amplitudes, one per computational basis state. + :rtype: List[complex] """ return [self.__inner.get(i, complex(0)) for i in range(2**self.qubit_count)] @@ -464,7 +473,8 @@ def eval( :param source: The Q# source code to evaluate. :param save_events: If true, all output will be saved and returned. If false, they will be printed. - :returns value: The value returned by the last statement in the source code or the saved output if `save_events` is true. + :return: The value returned by the last statement in the source code, or the saved output if ``save_events`` is true. + :rtype: Any :raises QSharpError: If there is an error evaluating the source code. """ ipython_helper() @@ -726,9 +736,8 @@ def run( :param qubit_loss: The probability of qubit loss in simulation. :param seed: The seed to use for the random number generator in simulation, if any. - :returns values: A list of results or runtime errors. If `save_events` is true, - a List of ShotResults is returned. - + :return: A list of results or runtime errors. If ``save_events`` is true, a list of ``ShotResult`` is returned. + :rtype: List[Any] :raises QSharpError: If there is an error interpreting the input. :raises ValueError: If the number of shots is less than 1. """ @@ -858,9 +867,8 @@ def compile( for the program. Alternatively, a callable can be provided, which must be a Q# callable. - :returns QirInputData: The compiled program. - - To get the QIR string from the compiled program, use `str()`. + :return: The compiled program. Use ``str()`` to get the QIR string. + :rtype: QirInputData Example: @@ -912,6 +920,8 @@ def circuit( an operation of a lambda expression. The operation must take only qubits or arrays of qubits as parameters. + :return: The synthesized circuit. + :rtype: Circuit :raises QSharpError: If there is an error synthesizing the circuit. """ ipython_helper() @@ -956,7 +966,8 @@ def estimate( which must be a Q# callable. :param params: The parameters to configure physical estimation. - :returns `EstimatorResult`: The estimated resources. + :return: The estimated resources. + :rtype: EstimatorResult """ ipython_helper() @@ -1015,7 +1026,8 @@ def logical_counts( :param entry_expr: The entry expression. Alternatively, a callable can be provided, which must be a Q# callable. - :returns `LogicalCounts`: Program resources in terms of logical gate counts. + :return: Program resources in terms of logical gate counts. + :rtype: LogicalCounts """ ipython_helper() @@ -1062,6 +1074,7 @@ def dump_machine() -> StateDump: Returns the sparse state vector of the simulator as a StateDump object. :return: The state of the simulator. + :rtype: StateDump """ ipython_helper() return StateDump(get_interpreter().dump_machine()) @@ -1076,6 +1089,8 @@ def dump_circuit() -> Circuit: Requires the interpreter to be initialized with `trace_circuit=True`. + :return: The current circuit trace. + :rtype: Circuit :raises QSharpError: If the interpreter was not initialized with ``trace_circuit=True``. """ ipython_helper() diff --git a/source/pip/qsharp/estimator/_estimator.py b/source/pip/qsharp/estimator/_estimator.py index d3d48cab6b..fea1124e84 100644 --- a/source/pip/qsharp/estimator/_estimator.py +++ b/source/pip/qsharp/estimator/_estimator.py @@ -1070,10 +1070,9 @@ def estimate( Estimates resources for the current logical counts, using the Parallel Synthesis Sequential Pauli Computation (PSSPC) layout method. - :param logical_counts: The logical counts. :param params: The parameters to configure physical estimation. - - :returns resources: The estimated resources. + :return: The estimated resources. + :rtype: EstimatorResult """ if params is None: params = [{}] diff --git a/source/pip/qsharp/openqasm/_import.py b/source/pip/qsharp/openqasm/_import.py index ba36aa1042..e616ee0d39 100644 --- a/source/pip/qsharp/openqasm/_import.py +++ b/source/pip/qsharp/openqasm/_import.py @@ -40,6 +40,7 @@ def import_openqasm( - ``program_type`` (ProgramType): The type of program compilation to perform. Defaults to ``ProgramType.Operation``. :return: The value returned by the last statement in the source code. + :rtype: Any :raises QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. :raises QSharpError: If there is an error compiling the program. """ diff --git a/source/pip/qsharp/utils/_utils.py b/source/pip/qsharp/utils/_utils.py index 5b3236cee5..26984dc4db 100644 --- a/source/pip/qsharp/utils/_utils.py +++ b/source/pip/qsharp/utils/_utils.py @@ -14,6 +14,7 @@ def dump_operation(operation: str, num_qubits: int) -> List[List[complex]]: :param num_qubits: The number of qubits to be used. :return: The matrix representing the operation. + :rtype: List[List[complex]] """ code = f"""{{ let op = {operation}; From f1b37de3ad7931ce6653dda12580aa10096d0de8 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 10 Apr 2026 12:54:04 -0700 Subject: [PATCH 05/26] Fill in missing param descriptions --- source/pip/qsharp/_qsharp.py | 22 ++++++++++++++++++++++ source/pip/qsharp/openqasm/_circuit.py | 14 ++++++++++++++ source/pip/qsharp/openqasm/_compile.py | 1 + source/pip/qsharp/openqasm/_estimate.py | 1 + source/pip/qsharp/openqasm/_run.py | 1 + 5 files changed, 39 insertions(+) diff --git a/source/pip/qsharp/_qsharp.py b/source/pip/qsharp/_qsharp.py index f77c849c62..100fca5445 100644 --- a/source/pip/qsharp/_qsharp.py +++ b/source/pip/qsharp/_qsharp.py @@ -260,6 +260,9 @@ def init( :param project_root: An optional path to a root directory with a Q# project to include. It must contain a qsharp.json project manifest. + :param language_features: An optional list of language feature flags to enable. + These correspond to experimental or preview Q# language features. + :param trace_circuit: Enables tracing of circuit during execution. Passing `True` is required for the `dump_circuit` function to return a circuit. The `circuit` function is *NOT* affected by this parameter will always generate a circuit. @@ -866,6 +869,7 @@ def compile( :param entry_expr: The Q# expression that will be used as the entrypoint for the program. Alternatively, a callable can be provided, which must be a Q# callable. + :param *args: The arguments to pass to the callable, if one is provided. :return: The compiled program. Use ``str()`` to get the QIR string. :rtype: QirInputData @@ -920,6 +924,24 @@ def circuit( an operation of a lambda expression. The operation must take only qubits or arrays of qubits as parameters. + :param generation_method: The method to use for circuit generation. + ``CircuitGenerationMethod.ClassicalEval`` evaluates classical control flow at circuit + generation time. ``CircuitGenerationMethod.Simulate`` runs a full simulation to trace + the circuit. ``CircuitGenerationMethod.Static`` uses partial evaluation and requires + a non-``Unrestricted`` target profile. Defaults to ``None`` (auto-selected). + + :param max_operations: The maximum number of operations to include in the circuit. + Defaults to ``None`` (no limit). + + :param source_locations: If ``True``, annotates each gate with its source location. + Defaults to ``False``. + + :param group_by_scope: If ``True``, groups operations by their Q# scope (e.g. operation body). + Defaults to ``True``. + + :param prune_classical_qubits: If ``True``, removes qubits that are never used in a quantum + gate (e.g. qubits only used as classical controls). Defaults to ``False``. + :return: The synthesized circuit. :rtype: Circuit :raises QSharpError: If there is an error synthesizing the circuit. diff --git a/source/pip/qsharp/openqasm/_circuit.py b/source/pip/qsharp/openqasm/_circuit.py index 61649048c8..be2342a191 100644 --- a/source/pip/qsharp/openqasm/_circuit.py +++ b/source/pip/qsharp/openqasm/_circuit.py @@ -28,6 +28,20 @@ def circuit( :param source: An OpenQASM program. Alternatively, a callable can be provided, which must be an already imported global callable. :type source: str, optional + :param *args: The arguments to pass to the callable, if one is provided. + :param generation_method: The method to use for circuit generation. + ``CircuitGenerationMethod.ClassicalEval`` evaluates classical control flow at circuit + generation time. ``CircuitGenerationMethod.Simulate`` runs a full simulation to trace + the circuit. ``CircuitGenerationMethod.Static`` uses partial evaluation and requires + a non-``Unrestricted`` target profile. Defaults to ``None`` (auto-selected). + :param max_operations: The maximum number of operations to include in the circuit. + Defaults to ``None`` (no limit). + :param source_locations: If ``True``, annotates each gate with its source location. + Defaults to ``False``. + :param group_by_scope: If ``True``, groups operations by their Q# scope. + Defaults to ``True``. + :param prune_classical_qubits: If ``True``, removes qubits that are never used in a quantum + gate. Defaults to ``False``. :param **kwargs: Additional keyword arguments. Common options: - ``name`` (str): The name of the program. This is used as the entry point for the program. diff --git a/source/pip/qsharp/openqasm/_compile.py b/source/pip/qsharp/openqasm/_compile.py index 9a26b31224..5b7877e299 100644 --- a/source/pip/qsharp/openqasm/_compile.py +++ b/source/pip/qsharp/openqasm/_compile.py @@ -32,6 +32,7 @@ def compile( :param source: An OpenQASM program. Alternatively, a callable can be provided, which must be an already imported global callable. :type source: str + :param *args: The arguments to pass to the callable, if one is provided. :param **kwargs: Additional keyword arguments for compiling the source program. Common options: - ``name`` (str): The name of the circuit. This is used as the entry point for the program. diff --git a/source/pip/qsharp/openqasm/_estimate.py b/source/pip/qsharp/openqasm/_estimate.py index 270cd74c2c..8f32306f0e 100644 --- a/source/pip/qsharp/openqasm/_estimate.py +++ b/source/pip/qsharp/openqasm/_estimate.py @@ -34,6 +34,7 @@ def estimate( :type source: str :param params: The parameters to configure estimation. :type params: Dict, List, or EstimatorParams, optional + :param *args: The arguments to pass to the callable, if one is provided. :param **kwargs: Additional keyword arguments. Common options: - ``name`` (str): The name of the circuit. This is used as the entry point for the program. diff --git a/source/pip/qsharp/openqasm/_run.py b/source/pip/qsharp/openqasm/_run.py index b04f1be5d4..a10d4b1a14 100644 --- a/source/pip/qsharp/openqasm/_run.py +++ b/source/pip/qsharp/openqasm/_run.py @@ -53,6 +53,7 @@ def run( :type source: str :param shots: The number of shots to run. Defaults to ``1024``. :type shots: int + :param *args: The arguments to pass to the callable, if one is provided. :param on_result: A callback function that will be called with each result. Only used when a callable is provided. :type on_result: Callable, optional From 9084825015429024cc0e39969fb13ef4e59c4134 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 10 Apr 2026 13:30:50 -0700 Subject: [PATCH 06/26] More conversions to RTS style over Google style docstrings --- source/pip/qsharp/_adaptive_pass.py | 14 +- source/pip/qsharp/_device/_atom/_scheduler.py | 67 +++--- source/pip/qsharp/_device/_device.py | 39 ++-- source/pip/qsharp/_fs.py | 52 ++--- source/pip/qsharp/_http.py | 20 +- source/pip/qsharp/_native.pyi | 209 +++++++++--------- source/pip/qsharp/_qsharp.py | 47 ++++ source/pip/qsharp/_simulation.py | 26 +-- source/pip/qsharp/estimator/_estimator.py | 6 +- .../pip/qsharp/interop/cirq/_neutral_atom.py | 31 ++- source/pip/qsharp/interop/cirq/_result.py | 62 +++--- .../interop/qiskit/backends/backend_base.py | 79 +++---- .../qiskit/backends/neutral_atom_target.py | 8 +- .../interop/qiskit/backends/qirtarget.py | 55 ++--- .../interop/qiskit/backends/qsharp_backend.py | 25 +-- .../pip/qsharp/interop/qiskit/jobs/qsjob.py | 44 +++- .../qsharp/interop/qiskit/jobs/qsjobset.py | 3 +- 17 files changed, 385 insertions(+), 402 deletions(-) diff --git a/source/pip/qsharp/_adaptive_pass.py b/source/pip/qsharp/_adaptive_pass.py index 81c7c4b6f6..5a7a63ba55 100644 --- a/source/pip/qsharp/_adaptive_pass.py +++ b/source/pip/qsharp/_adaptive_pass.py @@ -292,13 +292,13 @@ def run( ) -> AdaptiveProgram: """Process module and return the AdaptiveProgram. - Args: - mod: The QIR module to process. - noise: Optional NoiseConfig. When provided, noise intrinsic calls - are resolved to correlated noise ops using the intrinsics table. - noise_intrinsics: Optional dict mapping noise intrinsic callee names - to noise table IDs. Takes precedence over ``noise`` if both are - given. + :param mod: The QIR module to process. + :param noise: Optional NoiseConfig. When provided, noise intrinsic calls + are resolved to correlated noise ops using the intrinsics table. + :param noise_intrinsics: Optional dict mapping noise intrinsic callee names + to noise table IDs. Takes precedence over ``noise`` if both are given. + :return: The processed adaptive program. + :rtype: AdaptiveProgram """ if mod.get_flag("arrays"): raise ValueError("QIR arrays are not currently supported.") diff --git a/source/pip/qsharp/_device/_atom/_scheduler.py b/source/pip/qsharp/_device/_atom/_scheduler.py index 77282010fb..0b507c48f2 100644 --- a/source/pip/qsharp/_device/_atom/_scheduler.py +++ b/source/pip/qsharp/_device/_atom/_scheduler.py @@ -147,13 +147,11 @@ class MoveGroup: """ Represents a group of moves that can be done at the same time. - Attributes: - moves (set): A set of moves that can be performed in parallel. - scale_factor (Optional[tuple[Fraction, Fraction]]): A tuple of fractions - representing the scale factors in the row and col axes between - moves. `None`, if there is a single element in the move set. - ref_move (Move): A move used as a representative of the group, used - to test compatibility of other moves with the group. + ``moves`` is the set of moves that can be performed in parallel. + ``scale_factor`` is a tuple of fractions representing the scale factors in the + row and col axes between moves, or ``None`` if there is a single element in the set. + ``ref_move`` is a move used as a representative of the group to test compatibility + of other moves. """ __slots__ = ("moves", "scale_factor", "ref_move") @@ -170,8 +168,7 @@ def add(self, move: Move): """ Adds a move to this move group. - Args: - move (Move): The move to add. + :param move: The move to add. """ # A move group with a single move doesn't have an associated scale factor. @@ -193,23 +190,17 @@ class MoveGroupPool: """A data structure that takes individual moves as input and organizes them into groups of moves that can be executed in parallel. - Attributes: - moves: A set containing all the moves in the move-group pool. - move_group_candidates: A dict organizing the move-group candidates - by scale factor. - parity: The parity of source and destination columns of all the moves - in this pool. - direction: The up/down and left/right direction of all the moves - in this pool. + ``moves`` contains all moves in the pool. ``move_group_candidates`` is a dict + organizing the move-group candidates by scale factor. ``parity`` is the parity + of source and destination columns of all moves in the pool. ``direction`` is the + up/down and left/right direction of all moves in the pool. """ def __init__(self): - """Initializes a move-group pool for moves of the given `parity` and `direction`. - Args: - parity: The parity of source and destination columns of all the moves - in this pool. - direction: The up/down and left/right direction of all the moves - in this pool. + """Initializes a move-group pool for moves of the given ``parity`` and ``direction``. + + :param parity: The parity of source and destination columns of all the moves in this pool. + :param direction: The up/down and left/right direction of all the moves in this pool. """ self.moves: Optional[list[Move]] = [] self.move_group_candidates: dict[MoveGroupScaleFactor, list[MoveGroup]] = ( @@ -235,9 +226,9 @@ def largest_move_group_candidate(self) -> Optional[MoveGroup]: def add(self, move: Move): """Adds a move to the move-group pool. - Args: - move: The move to add. It must be of the same parity and direction as - the rest of the moves in this pool. + + :param move: The move to add. It must be of the same parity and direction as + the rest of the moves in this pool. """ assert self.moves is not None @@ -285,9 +276,9 @@ def add(self, move: Move): self.moves.append(move) def try_take(self, number_of_moves: int) -> list[Move]: - """Take up to `number_of_moves` from the largest move group candidate. - Args: - number_of_moves: The number of moves to take from this pool. + """Take up to ``number_of_moves`` from the largest move group candidate. + + :param number_of_moves: The number of moves to take from this pool. """ # Once we start taking moves from the MoveGroupPool, we don't need to add # new moves. So we set `self.moves` to `None` as a safety measure. @@ -352,12 +343,10 @@ class MoveScheduler: target zone and builds an iterator that returns groups of moves that can be executed in parallel. - Attributes: - device: An object containing information about the device. - zone: The zone the moves will be scheduled to. - available_dst_locations: The available destinations in the `zone`. - partial_moves: The moves that haven't been assigned a destination location. - disjoint_pools: A list containing one pool of move-groups for each parity and direction. + ``device`` contains information about the device. ``zone`` is the target zone. + ``available_dst_locations`` holds the available destinations in the zone. + ``partial_moves`` are moves not yet assigned a destination. ``disjoint_pools`` + is a list containing one pool of move-groups for each parity and direction. """ def __init__( @@ -368,10 +357,10 @@ def __init__( ): """Initializes the move scheduler from a device, a target zone, and a list of qubits to move to that target zone. - Args: - device: An object containing information about the device. - zone: The zone the moves will be scheduled to. - qubits_to_move: A list of qubits to move. + + :param device: An object containing information about the device. + :param zone: The zone the moves will be scheduled to. + :param qubits_to_move: A list of qubits to move. """ self.device = device self.zone = zone diff --git a/source/pip/qsharp/_device/_device.py b/source/pip/qsharp/_device/_device.py index 5cc091e71c..991dc46b24 100644 --- a/source/pip/qsharp/_device/_device.py +++ b/source/pip/qsharp/_device/_device.py @@ -58,11 +58,9 @@ def get_home_loc(self, qubit_id: int) -> tuple[int, int]: """ Get the home location (row, column) of the qubit with the given id. - Args: - qubit_id (int): The id of the qubit. - - Returns: - tuple[int, int]: The (row, column) location of the qubit. + :param qubit_id: The id of the qubit. + :return: The (row, column) location of the qubit. + :rtype: tuple[int, int] """ if qubit_id < 0 or qubit_id >= len(self.home_locs): raise ValueError(f"Qubit id {qubit_id} is out of range") @@ -72,11 +70,9 @@ def get_ordering(self, qubit_id: int) -> int: """ Get the ordering index of the qubit with the given id. - Args: - qubit_id (int): The id of the qubit. - - Returns: - int: The ordering index of the qubit. + :param qubit_id: The id of the qubit. + :return: The ordering index of the qubit. + :rtype: int """ if qubit_id < 0 or qubit_id >= len(self.home_locs): raise ValueError(f"Qubit id {qubit_id} is out of range") @@ -87,8 +83,8 @@ def get_register_zones(self) -> list[Zone]: """ Get the register zones in the device. - Returns: - list[Zone]: The register zones. + :return: The register zones. + :rtype: list[Zone] """ return [zone for zone in self.zones if zone.type == ZoneType.REG] @@ -96,8 +92,8 @@ def get_interaction_zones(self) -> list[Zone]: """ Get the interaction zones in the device. - Returns: - list[Zone]: The interaction zones. + :return: The interaction zones. + :rtype: list[Zone] """ return [zone for zone in self.zones if zone.type == ZoneType.INTER] @@ -105,8 +101,8 @@ def get_measurement_zones(self) -> list[Zone]: """ Get the measurement zones in the device. - Returns: - list[Zone]: The measurement zones. + :return: The measurement zones. + :rtype: list[Zone] """ return [zone for zone in self.zones if zone.type == ZoneType.MEAS] @@ -114,8 +110,7 @@ def compile(self, program: str) -> QirInputData: """ Compile the given program for the device. - Args: - program (str): The program to compile. + :param program: The program to compile. """ raise NotImplementedError("Subclasses must implement compile") @@ -123,8 +118,8 @@ def as_dict(self) -> dict: """ Get the device layout as a dictionary. - Returns: - dict: The device layout as a dictionary. + :return: The device layout as a dictionary. + :rtype: dict """ return { "cols": self.column_count, @@ -138,7 +133,7 @@ def get_layout(self) -> dict: """ Get the device layout as a dictionary. - Returns: - dict: The device layout as a dictionary. + :return: The device layout as a dictionary. + :rtype: dict """ return self.as_dict() diff --git a/source/pip/qsharp/_fs.py b/source/pip/qsharp/_fs.py index 3f14a01df3..c317007fd1 100644 --- a/source/pip/qsharp/_fs.py +++ b/source/pip/qsharp/_fs.py @@ -18,11 +18,9 @@ def read_file(path: str) -> Tuple[str, str]: """ Read the contents of a file. - Args: - path (str): The path to the file. - - Returns: - Tuple[str, str]: A tuple containing the path and the file contents. + :param path: The path to the file. + :return: A tuple containing the path and the file contents. + :rtype: Tuple[str, str] """ with open(path, mode="r", encoding="utf-8-sig") as f: return (path, f.read()) @@ -33,15 +31,13 @@ def list_directory(dir_path: str) -> List[Dict[str, str]]: Lists the contents of a directory and returns a list of dictionaries, where each dictionary represents an entry in the directory. - Args: - dir_path (str): The path of the directory to list. - - Returns: - List[Dict[str, str]]: A list of dictionaries representing the entries - in the directory. Each dictionary contains the following keys: - - "path": The full path of the entry. - - "entry_name": The name of the entry. - - "type": The type of the entry: "file", "folder", or "unknown". + :param dir_path: The path of the directory to list. + :return: A list of dictionaries representing the entries in the directory. + Each dictionary contains the following keys: + - ``"path"``: The full path of the entry. + - ``"entry_name"``: The name of the entry. + - ``"type"``: The type of the entry: ``"file"``, ``"folder"``, or ``"unknown"``. + :rtype: List[Dict[str, str]] """ def map_dir(e: str) -> Dict[str, str]: @@ -63,12 +59,10 @@ def resolve(base: str, path: str) -> str: """ Resolves a relative path with respect to a base path. - Args: - base (str): The base path. - path (str): The relative path. - - Returns: - str: The resolved path. + :param base: The base path. + :param path: The relative path. + :return: The resolved path. + :rtype: str """ return os.path.normpath(join(base, path)) @@ -77,11 +71,9 @@ def exists(path) -> bool: """ Check if a file or directory exists at the given path. - Args: - path (str): The path to the file or directory. - - Returns: - bool: True if the file or directory exists, False otherwise. + :param path: The path to the file or directory. + :return: ``True`` if the file or directory exists, ``False`` otherwise. + :rtype: bool """ return os.path.exists(path) @@ -90,11 +82,9 @@ def join(path: str, *paths) -> str: """ Joins one or more path components intelligently. - Args: - path (str): The base path. - *paths (str): Additional path components to be joined. - - Returns: - str: The concatenated path. + :param path: The base path. + :param *paths: Additional path components to be joined. + :return: The concatenated path. + :rtype: str """ return os.path.join(path, *paths) diff --git a/source/pip/qsharp/_http.py b/source/pip/qsharp/_http.py index 0969b0bb3f..240ddcc67f 100644 --- a/source/pip/qsharp/_http.py +++ b/source/pip/qsharp/_http.py @@ -13,18 +13,14 @@ def fetch_github(owner: str, repo: str, ref: str, path: str) -> str: """ Fetches the content of a file from a GitHub repository. - Args: - owner (str): The owner of the GitHub repository. - repo (str): The name of the GitHub repository. - ref (str): The reference (branch, tag, or commit) of the repository. - path (str): The path to the file within the repository. - - Returns: - str: The content of the file as a string. - - Raises: - urllib.error.HTTPError: If there is an error fetching the file from GitHub. - urllib.error.URLError: If there is an error with the URL. + :param owner: The owner of the GitHub repository. + :param repo: The name of the GitHub repository. + :param ref: The reference (branch, tag, or commit) of the repository. + :param path: The path to the file within the repository. + :return: The content of the file as a string. + :rtype: str + :raises urllib.error.HTTPError: If there is an error fetching the file from GitHub. + :raises urllib.error.URLError: If there is an error with the URL. """ import urllib.request diff --git a/source/pip/qsharp/_native.pyi b/source/pip/qsharp/_native.pyi index 216f30ffb9..0f61a621f3 100644 --- a/source/pip/qsharp/_native.pyi +++ b/source/pip/qsharp/_native.pyi @@ -357,26 +357,21 @@ class Interpreter: """ Imports OpenQASM source code into the active Q# interpreter. - Args: - source (str): An OpenQASM program or fragment. - output_fn: The function to handle the output of the execution. - read_file: A callable that reads a file and returns its content and path. - list_directory: A callable that lists the contents of a directory. - resolve_path: A callable that resolves a file path given a base path and a relative path. - fetch_github: A callable that fetches a file from GitHub. - **kwargs: Additional keyword arguments to pass to the execution. - - name (str): The name of the program. This is used as the entry point for the program. - - search_path (Optional[str]): The optional search path for resolving file references. - - output_semantics (OutputSemantics, optional): The output semantics for the compilation. - - program_type (ProgramType, optional): The type of program compilation to perform. - - Returns: - value: The value returned by the last statement in the source code. - - Raises: - QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. - QSharpError: If there is an error compiling the program. - QSharpError: If there is an error evaluating the source code. + :param source: An OpenQASM program or fragment. + :param output_fn: The function to handle the output of the execution. + :param read_file: A callable that reads a file and returns its content and path. + :param list_directory: A callable that lists the contents of a directory. + :param resolve_path: A callable that resolves a file path given a base path and a relative path. + :param fetch_github: A callable that fetches a file from GitHub. + :param **kwargs: Common options: + + - ``name`` (str): The name of the program. + - ``search_path`` (str): The optional search path for resolving file references. + - ``output_semantics`` (OutputSemantics): The output semantics for the compilation. + - ``program_type`` (ProgramType): The type of program compilation to perform. + :return: The value returned by the last statement in the source code. + :raises QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. + :raises QSharpError: If there is an error compiling or evaluating the program. """ ... @@ -511,7 +506,8 @@ def physical_estimates(logical_resources: str, params: str) -> str: :param logical_resources: The logical resources to estimate from. :param params: The parameters to configure physical estimation. - :returns resources: The estimated resources. + :return: The estimated resources. + :rtype: str """ ... @@ -526,28 +522,24 @@ def circuit_qasm_program( """ Synthesizes a circuit for an OpenQASM program. - Note: + .. note:: This call while exported is not intended to be used directly by the user. It is intended to be used by the Python wrapper which will handle the callbacks and other Python specific details. - Args: - source (str): An OpenQASM program. Alternatively, a callable can be provided, - which must be an already imported global callable. - read_file (Callable[[str], Tuple[str, str]]): A callable that reads a file and returns its content and path. - list_directory (Callable[[str], List[Dict[str, str]]]): A callable that lists the contents of a directory. - resolve_path (Callable[[str, str], str]): A callable that resolves a file path given a base path and a relative path. - fetch_github (Callable[[str, str, str, str], str]): A callable that fetches a file from GitHub. - **kwargs: Additional keyword arguments to pass to the execution. - - name (str): The name of the program. This is used as the entry point for the program. - - search_path (Optional[str]): The optional search path for resolving file references. - Returns: - Circuit: The synthesized circuit. - - Raises: - QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. - QSharpError: If there is an error evaluating the program. - QSharpError: If there is an error synthesizing the circuit. + :param source: An OpenQASM program. + :param read_file: A callable that reads a file and returns its content and path. + :param list_directory: A callable that lists the contents of a directory. + :param resolve_path: A callable that resolves a file path given a base path and a relative path. + :param fetch_github: A callable that fetches a file from GitHub. + :param **kwargs: Common options: + + - ``name`` (str): The name of the program. + - ``search_path`` (str): The optional search path for resolving file references. + :return: The synthesized circuit. + :rtype: Circuit + :raises QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. + :raises QSharpError: If there is an error evaluating or synthesizing the circuit. """ ... @@ -563,29 +555,26 @@ def compile_qasm_program_to_qir( Compiles the OpenQASM source code into a program that can be submitted to a target as QIR (Quantum Intermediate Representation). - Note: + .. note:: This call while exported is not intended to be used directly by the user. It is intended to be used by the Python wrapper which will handle the callbacks and other Python specific details. - Args: - source (str): The OpenQASM source code to estimate the resource requirements for. - read_file (Callable[[str], Tuple[str, str]]): A callable that reads a file and returns its content and path. - list_directory (Callable[[str], List[Dict[str, str]]]): A callable that lists the contents of a directory. - resolve_path (Callable[[str, str], str]): A callable that resolves a file path given a base path and a relative path. - fetch_github (Callable[[str, str, str, str], str]): A callable that fetches a file from GitHub. - **kwargs: Additional keyword arguments to pass to the compilation when source program is provided. - - name (str): The name of the circuit. This is used as the entry point for the program. - - target_profile (TargetProfile): The target profile to use for code generation. - - search_path (Optional[str]): The optional search path for resolving file references. - - output_semantics (OutputSemantics, optional): The output semantics for the compilation. - - Returns: - str: The converted QIR code as a string. - - Raises: - QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. - QSharpError: If there is an error compiling the program. + :param source: The OpenQASM source code to compile to QIR. + :param read_file: A callable that reads a file and returns its content and path. + :param list_directory: A callable that lists the contents of a directory. + :param resolve_path: A callable that resolves a file path given a base path and a relative path. + :param fetch_github: A callable that fetches a file from GitHub. + :param **kwargs: Common options: + + - ``name`` (str): The name of the circuit. + - ``target_profile`` (TargetProfile): The target profile to use for code generation. + - ``search_path`` (str): The optional search path for resolving file references. + - ``output_semantics`` (OutputSemantics): The output semantics for the compilation. + :return: The converted QIR code as a string. + :rtype: str + :raises QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. + :raises QSharpError: If there is an error compiling the program. """ ... @@ -600,23 +589,22 @@ def compile_qasm_to_qsharp( """ Converts a OpenQASM program to Q#. - Note: + .. note:: This call while exported is not intended to be used directly by the user. It is intended to be used by the Python wrapper which will handle the callbacks and other Python specific details. - Args: - source (str): The OpenQASM source code to estimate the resource requirements for. - read_file (Callable[[str], Tuple[str, str]]): A callable that reads a file and returns its content and path. - list_directory (Callable[[str], List[Dict[str, str]]]): A callable that lists the contents of a directory. - resolve_path (Callable[[str, str], str]): A callable that resolves a file path given a base path and a relative path. - fetch_github (Callable[[str, str, str, str], str]): A callable that fetches a file from GitHub. - **kwargs: Additional keyword arguments to pass to the execution. - - name (str): The name of the circuit. This is used as the entry point for the program. - - search_path (Optional[str]): The optional search path for resolving file references. + :param source: The OpenQASM source code to convert. + :param read_file: A callable that reads a file and returns its content and path. + :param list_directory: A callable that lists the contents of a directory. + :param resolve_path: A callable that resolves a file path given a base path and a relative path. + :param fetch_github: A callable that fetches a file from GitHub. + :param **kwargs: Common options: - Returns: - str: The converted Q# code as a string. + - ``name`` (str): The name of the circuit. + - ``search_path`` (str): The optional search path for resolving file references. + :return: The converted Q# code as a string. + :rtype: str """ ... @@ -632,23 +620,23 @@ def resource_estimate_qasm_program( """ Estimates the resource requirements for executing OpenQASM source code. - Note: + .. note:: This call while exported is not intended to be used directly by the user. It is intended to be used by the Python wrapper which will handle the callbacks and other Python specific details. - Args: - source (str): The OpenQASM source code to estimate the resource requirements for. - job_params (str): The parameters for the job. - read_file (Callable[[str], Tuple[str, str]]): A callable that reads a file and returns its content and path. - list_directory (Callable[[str], List[Dict[str, str]]]): A callable that lists the contents of a directory. - resolve_path (Callable[[str, str], str]): A callable that resolves a file path given a base path and a relative path. - fetch_github (Callable[[str, str, str, str], str]): A callable that fetches a file from GitHub. - **kwargs: Additional keyword arguments to pass to the execution. - - name (str): The name of the circuit. This is used as the entry point for the program. Defaults to 'program'. - - search_path (str): The optional search path for resolving imports. - Returns: - str: The estimated resource requirements for executing the OpenQASM source code. + :param source: The OpenQASM source code to estimate resource requirements for. + :param job_params: The parameters for the job as a JSON string. + :param read_file: A callable that reads a file and returns its content and path. + :param list_directory: A callable that lists the contents of a directory. + :param resolve_path: A callable that resolves a file path given a base path and a relative path. + :param fetch_github: A callable that fetches a file from GitHub. + :param **kwargs: Common options: + + - ``name`` (str): The name of the circuit. Defaults to ``'program'``. + - ``search_path`` (str): The optional search path for resolving imports. + :return: The estimated resource requirements as a JSON string. + :rtype: str """ ... @@ -668,34 +656,32 @@ def run_qasm_program( Runs the given OpenQASM program for the given number of shots. Each shot uses an independent instance of the simulator. - Note: + .. note:: This call while exported is not intended to be used directly by the user. It is intended to be used by the Python wrapper which will handle the callbacks and other Python specific details. - Args: - source (str): The OpenQASM source code to execute. - output_fn (Callable[[Output], None]): The function to handle the output of the execution. - noise: The noise to use in simulation. - qubit_loss: The probability of qubit loss in simulation. - read_file (Callable[[str], Tuple[str, str]]): The function to read a file and return its contents. - list_directory (Callable[[str], List[Dict[str, str]]]): The function to list the contents of a directory. - resolve_path (Callable[[str, str], str]): The function to resolve a path given a base path and a relative path. - fetch_github (Callable[[str, str, str, str], str]): The function to fetch a file from GitHub. - **kwargs: Additional keyword arguments to pass to the execution. - - target_profile (TargetProfile): The target profile to use for execution. - - name (str): The name of the circuit. This is used as the entry point for the program. Defaults to 'program'. - - search_path (str): The optional search path for resolving imports. - - output_semantics (OutputSemantics, optional): The output semantics for the compilation. - - shots (int): The number of shots to run the program for. Defaults to 1. - - seed (int): The seed to use for the random number generator. - - Returns: - Any: The result of the execution. - - Raises: - QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. - QSharpError: If there is an error interpreting the input. + :param source: The OpenQASM source code to execute. + :param output_fn: The function to handle the output of the execution. + :param noise_config: Optional noise configuration for noisy simulation. + :param noise: Optional Pauli noise as a tuple of ``(x, y, z)`` probabilities. + :param qubit_loss: The probability of qubit loss in simulation. + :param read_file: A callable that reads a file and returns its contents. + :param list_directory: A callable that lists the contents of a directory. + :param resolve_path: A callable that resolves a path given a base path and a relative path. + :param fetch_github: A callable that fetches a file from GitHub. + :param **kwargs: Common options: + + - ``target_profile`` (TargetProfile): The target profile to use for execution. + - ``name`` (str): The name of the circuit. Defaults to ``'program'``. + - ``search_path`` (str): The optional search path for resolving imports. + - ``output_semantics`` (OutputSemantics): The output semantics for the compilation. + - ``shots`` (int): The number of shots to run. Defaults to ``1``. + - ``seed`` (int): The seed to use for the random number generator. + :return: The result of the execution. + :rtype: Any + :raises QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. + :raises QSharpError: If there is an error interpreting the input. """ ... @@ -871,7 +857,8 @@ class NoiseTable: The correlated pauli noise to use in simulation. Setting an element that was previously set overrides that entry with the new value. - Example: + Example:: + noise_table = NoiseTable(2) noise_table.set_pauli_noise([("XI", 1e-10), ("XZ", 1e-8)]) """ @@ -882,7 +869,8 @@ class NoiseTable: The correlated pauli noise to use in simulation. Setting an element that was previously set overrides that entry with the new value. - Example: + Example:: + noise_table = NoiseTable(2) noise_table.set_pauli_noise(["XI", "XZ"], [1e-10, 3.7e-8]) """ @@ -893,7 +881,8 @@ class NoiseTable: The correlated pauli noise to use in simulation. Setting an element that was previously set overrides that entry with the new value. - Example: + Example:: + noise_table = NoiseTable(2) noise_table.set_pauli_noise("XZ", 1e-10) """ diff --git a/source/pip/qsharp/_qsharp.py b/source/pip/qsharp/_qsharp.py index 100fca5445..1b2ecdb361 100644 --- a/source/pip/qsharp/_qsharp.py +++ b/source/pip/qsharp/_qsharp.py @@ -205,6 +205,19 @@ class PauliNoise(Tuple[float, float, float]): """ def __new__(cls, x: float, y: float, z: float): + """ + Creates a new :class:`PauliNoise` instance with the given error probabilities. + + :param x: Probability of a Pauli-X (bit flip) error. Must be non-negative. + :type x: float + :param y: Probability of a Pauli-Y error. Must be non-negative. + :type y: float + :param z: Probability of a Pauli-Z (phase flip) error. Must be non-negative. + :type z: float + :return: A new :class:`PauliNoise` tuple ``(x, y, z)``. + :rtype: PauliNoise + :raises ValueError: If any probability is negative or if ``x + y + z > 1``. + """ if x < 0 or y < 0 or z < 0: raise ValueError("Pauli noise probabilities must be non-negative.") if x + y + z > 1: @@ -218,6 +231,18 @@ class DepolarizingNoise(PauliNoise): """ def __new__(cls, p: float): + """ + Creates a new :class:`DepolarizingNoise` instance. + + The depolarizing channel applies Pauli-X, Pauli-Y, or Pauli-Z errors each with + probability ``p / 3``. + + :param p: Total depolarizing error probability. Must satisfy ``0 ≤ p ≤ 1``. + :type p: float + :return: A new :class:`DepolarizingNoise` with equal X, Y, and Z error probabilities. + :rtype: DepolarizingNoise + :raises ValueError: If ``p`` is negative or ``p > 1``. + """ return super().__new__(cls, p / 3, p / 3, p / 3) @@ -227,6 +252,17 @@ class BitFlipNoise(PauliNoise): """ def __new__(cls, p: float): + """ + Creates a new :class:`BitFlipNoise` instance. + + The bit flip channel applies a Pauli-X error with probability ``p``. + + :param p: Probability of a bit flip (Pauli-X) error. Must satisfy ``0 ≤ p ≤ 1``. + :type p: float + :return: A new :class:`BitFlipNoise` with X error probability ``p``. + :rtype: BitFlipNoise + :raises ValueError: If ``p`` is negative or ``p > 1``. + """ return super().__new__(cls, p, 0, 0) @@ -236,6 +272,17 @@ class PhaseFlipNoise(PauliNoise): """ def __new__(cls, p: float): + """ + Creates a new :class:`PhaseFlipNoise` instance. + + The phase flip channel applies a Pauli-Z error with probability ``p``. + + :param p: Probability of a phase flip (Pauli-Z) error. Must satisfy ``0 ≤ p ≤ 1``. + :type p: float + :return: A new :class:`PhaseFlipNoise` with Z error probability ``p``. + :rtype: PhaseFlipNoise + :raises ValueError: If ``p`` is negative or ``p > 1``. + """ return super().__new__(cls, 0, 0, p) diff --git a/source/pip/qsharp/_simulation.py b/source/pip/qsharp/_simulation.py index 084b7ca625..c82466c88b 100644 --- a/source/pip/qsharp/_simulation.py +++ b/source/pip/qsharp/_simulation.py @@ -695,20 +695,18 @@ def run_qir( """ Simulate the given QIR source. - Args: - input: The QIR source to simulate. - type: The type of simulator to use. - Use `"clifford"` if your QIR only contains Clifford gates and measurements. - Use `"gpu"` if you have a GPU available in your system. - Use `"cpu"` as a fallback option if you don't have a GPU in your system. - If `None` (default), the GPU simulator will be tried first, falling back to - CPU if a suitable GPU device could not be located. - shots: The number of shots to run. - noise: A noise model to use in the simulation. - seed: A seed for reproducibility. - - Returns: - A list of measurement results, in the order they happened during the simulation. + :param input: The QIR source to simulate. + :param type: The type of simulator to use. + Use ``"clifford"`` if your QIR only contains Clifford gates and measurements. + Use ``"gpu"`` if you have a GPU available in your system. + Use ``"cpu"`` as a fallback option if you don't have a GPU in your system. + If ``None`` (default), the GPU simulator will be tried first, falling back to + CPU if a suitable GPU device could not be located. + :param shots: The number of shots to run. + :param noise: A noise model to use in the simulation. + :param seed: A seed for reproducibility. + :return: A list of measurement results, in the order they happened during the simulation. + :rtype: List """ if type is None: try: diff --git a/source/pip/qsharp/estimator/_estimator.py b/source/pip/qsharp/estimator/_estimator.py index fea1124e84..4eac639616 100644 --- a/source/pip/qsharp/estimator/_estimator.py +++ b/source/pip/qsharp/estimator/_estimator.py @@ -661,8 +661,10 @@ def _plot(self, **kwargs): Plots all result items in a space time plot, where the x-axis shows total runtime, and the y-axis shows total number of physical qubits. Both axes are in log-scale. - Attributes: - labels (list): List of labels for the legend. + + :param **kwargs: Common options: + + - ``labels`` (list): List of labels for the legend. Defaults to ``[]``. """ try: import matplotlib.pyplot as plt diff --git a/source/pip/qsharp/interop/cirq/_neutral_atom.py b/source/pip/qsharp/interop/cirq/_neutral_atom.py index 59a6c2841d..1120bd7dd7 100644 --- a/source/pip/qsharp/interop/cirq/_neutral_atom.py +++ b/source/pip/qsharp/interop/cirq/_neutral_atom.py @@ -29,22 +29,21 @@ class NeutralAtomSampler(cirq.Sampler): 3. QIR → ``NeutralAtomDevice.simulate()`` (decompose, schedule, simulate) 4. Raw shots → :class:`NeutralAtomCirqResult` - Args: - noise: Optional :class:`~qsharp._simulation.NoiseConfig` describing - per-gate noise. The device decomposes gates to the native set - ``{Rz, SX, CZ, MResetZ}``; configure noise on those native gates. - For example, a Cirq ``X`` gate arriving via QASM 2.0 is decomposed - to ``SX·SX``, so ``noise.sx`` is the relevant field. Defaults to - ``None`` (noiseless). - simulator_type: Force a particular simulator backend. - - ``"clifford"`` — Clifford-only, fast. Requires a Clifford circuit. - - ``"cpu"`` — Full state-vector on CPU. - - ``"gpu"`` — Full state-vector on GPU. - - ``None`` (default) — GPU if available, CPU otherwise. - seed: Optional integer seed for reproducibility. Defaults to ``None``. - device: An existing :class:`~qsharp._device._atom.NeutralAtomDevice` - instance to reuse across calls. A default-configured device is - created lazily on the first call when not provided. + :param noise: Optional :class:`~qsharp._simulation.NoiseConfig` describing + per-gate noise. The device decomposes gates to the native set + ``{Rz, SX, CZ, MResetZ}``; configure noise on those native gates. + For example, a Cirq ``X`` gate arriving via QASM 2.0 is decomposed + to ``SX·SX``, so ``noise.sx`` is the relevant field. Defaults to + ``None`` (noiseless). + :param simulator_type: Force a particular simulator backend. + ``"clifford"`` — Clifford-only, fast. Requires a Clifford circuit. + ``"cpu"`` — Full state-vector on CPU. + ``"gpu"`` — Full state-vector on GPU. + ``None`` (default) — GPU if available, CPU otherwise. + :param seed: Optional integer seed for reproducibility. Defaults to ``None``. + :param device: An existing :class:`~qsharp._device._atom.NeutralAtomDevice` + instance to reuse across calls. A default-configured device is + created lazily on the first call when not provided. Example:: diff --git a/source/pip/qsharp/interop/cirq/_result.py b/source/pip/qsharp/interop/cirq/_result.py index 6343c79f7d..d76bf8ecc3 100644 --- a/source/pip/qsharp/interop/cirq/_result.py +++ b/source/pip/qsharp/interop/cirq/_result.py @@ -26,16 +26,14 @@ class NeutralAtomCirqResult(cirq.ResultDict): which one or more qubits were lost during the simulation are excluded from ``measurements`` but are preserved in ``raw_shots``. - Attributes: - raw_shots: The full list of simulation results, one entry per shot, - in the native simulator output format (tuple, list, or scalar). - This includes shots that contain qubit-loss markers. - - Methods: - raw_measurements(): Return the full per-shot data (including loss markers) - in the same ``{key: 2D-array (shots x bits)}`` format as - ``measurements``, but with Unicode string dtype so that non-binary - markers are preserved. + The ``raw_shots`` attribute holds the full list of simulation results, one + entry per shot, in the native simulator output format (tuple, list, or + scalar). This includes shots that contain qubit-loss markers. + + Use :meth:`raw_measurements` to retrieve the full per-shot data (including + loss markers) in the same ``{key: 2D-array (shots x bits)}`` format as + ``measurements``, but with Unicode string dtype so that non-binary markers + are preserved. """ __slots__ = ("raw_shots", "_measurement_dict_data", "_raw_measurements_cache") @@ -119,12 +117,10 @@ def measurement_dict(circuit: cirq.Circuit) -> Dict[str, List[int]]: Qubit indices are determined by ``sorted(circuit.all_qubits())``, matching the ordering that Cirq's ``to_qasm()`` uses when it numbers the qubits. - Args: - circuit: The Cirq circuit to introspect. - - Returns: - An ordered dict mapping each measurement key to the list of global qubit + :param circuit: The Cirq circuit to introspect. + :return: An ordered dict mapping each measurement key to the list of global qubit indices that key covers, in the order they are measured. + :rtype: Dict[str, List[int]] """ ordered_qubits = sorted(circuit.all_qubits()) index_by_qubit = {q: i for i, q in enumerate(ordered_qubits)} @@ -188,12 +184,10 @@ def _qir_display_to_bitstring(obj: Any) -> str: def _split_registers(bitstring: str, key_lengths: List[int]) -> List[str]: """Split a flat or space-delimited bitstring into per-register chunks. - Args: - bitstring: The raw bitstring, possibly containing spaces between registers. - key_lengths: The expected width of each register, in order. - - Returns: - A list of register strings, one per key. + :param bitstring: The raw bitstring, possibly containing spaces between registers. + :param key_lengths: The expected width of each register, in order. + :return: A list of register strings, one per key. + :rtype: List[str] """ raw = str(bitstring).strip() @@ -229,13 +223,11 @@ def _shots_to_rows( Shots where any qubit returned a non-binary value (loss marker) are silently dropped. Only ``{0, 1}`` shots contribute to the returned arrays. - Args: - shots: Raw simulation output, one entry per shot. - measurement_dict_data: ``{key: [qubit_indices]}`` - the measurement - register layout. Defaults to a single key ``"m"`` with no qubits. - - Returns: - ``{key: list_of_rows}`` where each row is a list of 0/1 integers. + :param shots: Raw simulation output, one entry per shot. + :param measurement_dict_data: ``{key: [qubit_indices]}`` — the measurement + register layout. Defaults to a single key ``"m"`` with no qubits. + :return: ``{key: list_of_rows}`` where each row is a list of 0/1 integers. + :rtype: Dict[str, List[List[int]]] """ if measurement_dict_data is None: measurement_dict_data = {"m": []} @@ -286,16 +278,14 @@ def to_cirq_result( ) -> NeutralAtomCirqResult: """Build a :class:`NeutralAtomCirqResult` from raw simulation output. - Args: - raw_shots: The raw per-shot results from ``NeutralAtomDevice.simulate()``. - meas_dict: ``{key: [qubit_indices]}`` as returned by :func:`measurement_dict`. - param_resolver: Cirq parameter resolver for the circuit. Defaults to the - empty resolver. - - Returns: - A ``NeutralAtomCirqResult`` whose ``measurements`` field contains only + :param raw_shots: The raw per-shot results from ``NeutralAtomDevice.simulate()``. + :param meas_dict: ``{key: [qubit_indices]}`` as returned by :func:`measurement_dict`. + :param param_resolver: Cirq parameter resolver for the circuit. Defaults to the + empty resolver. + :return: A :class:`NeutralAtomCirqResult` whose ``measurements`` field contains only loss-free shots, and whose ``raw_shots`` / ``raw_measurements()`` retain all shots including those with loss markers. + :rtype: NeutralAtomCirqResult """ if param_resolver is None: param_resolver = cirq.ParamResolver({}) diff --git a/source/pip/qsharp/interop/qiskit/backends/backend_base.py b/source/pip/qsharp/interop/qiskit/backends/backend_base.py index a6400d73ee..d6d9e46629 100644 --- a/source/pip/qsharp/interop/qiskit/backends/backend_base.py +++ b/source/pip/qsharp/interop/qiskit/backends/backend_base.py @@ -116,13 +116,11 @@ def __init__( **fields, ): """ - Parameters: - target (Target): The target to use for the backend. - qiskit_pass_options (Dict): Options for the Qiskit passes. - transpile_options (Dict): Options for the transpiler. - qasm_export_options (Dict): Options for the QASM3 exporter. - **options: Additional keyword arguments to pass to the - execution used by subclasses. + :param target: The target to use for the backend. + :param qiskit_pass_options: Options for the Qiskit passes. + :param transpile_options: Options for the transpiler. + :param qasm_export_options: Options for the QASM3 exporter. + :param **options: Additional keyword arguments passed to subclasses. """ super().__init__( name="QSharpBackend", @@ -227,12 +225,11 @@ def max_circuits(self): def _execute(self, programs: List[Compilation], **input_params) -> Dict[str, Any]: """Execute circuits on the backend. - Parameters: - programs (List of QuantumCompilation): simulator input. - input_params (Dict): configuration for simulation/compilation. - - Returns: - dict: return a dictionary of results. + :param programs: Simulator input circuits. + :type programs: List[Compilation] + :param **input_params: Configuration for simulation/compilation. + :return: A dictionary of results. + :rtype: dict """ @abstractmethod @@ -477,18 +474,14 @@ def transpile(self, circuit: QuantumCircuit, **options) -> QuantumCircuit: def _qasm(self, circuit: QuantumCircuit, **options) -> str: """Converts a Qiskit QuantumCircuit to QASM 3 for the current backend. - Args: - circuit (QuantumCircuit): The QuantumCircuit to be executed. - **options: Additional options for the execution. - - Any options for the transpiler, exporter, or Qiskit passes - configuration. Defaults to backend config values. Common - values include: 'optimization_level', 'basis_gates', - 'includes', 'search_path'. - - Returns: - str: The converted QASM code as a string. Any supplied includes - are emitted as include statements at the top of the program. - + :param circuit: The QuantumCircuit to be executed. + :type circuit: QuantumCircuit + :param **options: Additional options for the transpiler, exporter, or Qiskit passes. + Common values include: ``optimization_level``, ``basis_gates``, ``includes``, + ``search_path``. Defaults to backend config values. + :return: The converted QASM code as a string. Any supplied includes + are emitted as ``include`` statements at the top of the program. + :rtype: str :raises QasmError: If there is an error generating or parsing QASM. """ transpiled_circuit = self.transpile(circuit, **options) @@ -513,18 +506,13 @@ def _qsharp(self, circuit: QuantumCircuit, **kwargs) -> str: The generated Q# code will not be idiomatic Q# code, but will be a direct translation of the Qiskit circuit. - Args: - circuit (QuantumCircuit): The QuantumCircuit to be executed. - **options: Additional options for the execution. Defaults to backend config values. - - Any options for the transpiler, exporter, or Qiskit passes - configuration. Defaults to backend config values. Common - values include: 'optimization_level', 'basis_gates', - 'includes', 'search_path'. - - output_semantics (OutputSemantics, optional): The output semantics for the compilation. - Returns: - str: The converted QASM code as a string. Any supplied includes - are emitted as include statements at the top of the program. - + :param circuit: The QuantumCircuit to be executed. + :type circuit: QuantumCircuit + :param **kwargs: Additional options for the transpiler, exporter, or Qiskit passes. + Common values include: ``optimization_level``, ``basis_gates``, ``includes``, + ``search_path``, ``output_semantics``. Defaults to backend config values. + :return: The converted Q# code as a string. + :rtype: str :raises QSharpError: If there is an error evaluating the source code. :raises QasmError: If there is an error generating, parsing, or compiling QASM. """ @@ -554,16 +542,15 @@ def qir( """ Converts a Qiskit QuantumCircuit to QIR (Quantum Intermediate Representation). - Args: - circuit ('QuantumCircuit'): The input Qiskit QuantumCircuit object. - **kwargs: Additional options for the execution. - - params (str, optional): The entry expression for the QIR conversion. Defaults to None. - - target_profile (TargetProfile, optional): The target profile for the backend. Defaults to backend config value. - - output_semantics (OutputSemantics, optional): The output semantics for the compilation. Defaults to backend config value. - - search_path (str, optional): The search path for the backend. Defaults to '.'. - Returns: - str: The converted QIR code as a string. + :param circuit: The input Qiskit QuantumCircuit object. + :type circuit: QuantumCircuit + :param **kwargs: Common options: + - ``target_profile`` (TargetProfile): The target profile for the backend. Defaults to backend config value. + - ``output_semantics`` (OutputSemantics): The output semantics for the compilation. Defaults to backend config value. + - ``search_path`` (str): The search path for the backend. Defaults to ``'.'``. + :return: The converted QIR code as a string. + :rtype: str :raises QSharpError: If there is an error evaluating the source code. :raises QasmError: If there is an error generating, parsing, or compiling QASM. :raises ValueError: If the backend configuration does not support QIR generation. diff --git a/source/pip/qsharp/interop/qiskit/backends/neutral_atom_target.py b/source/pip/qsharp/interop/qiskit/backends/neutral_atom_target.py index aa30a1a71b..4016f3c3a7 100644 --- a/source/pip/qsharp/interop/qiskit/backends/neutral_atom_target.py +++ b/source/pip/qsharp/interop/qiskit/backends/neutral_atom_target.py @@ -28,11 +28,9 @@ def build_target( ) -> Target: """Return a Qiskit ``Target`` with only the NeutralAtomDevice native gates. - Args: - num_qubits: Number of qubits. ``None`` means no limit (simulator). - - Returns: - A ``Target`` containing ``{rz, sx, cz, measure, reset}``. + :param num_qubits: Number of qubits. ``None`` means no limit (simulator). + :return: A ``Target`` containing ``{rz, sx, cz, measure, reset}``. + :rtype: Target """ target = Target(num_qubits=num_qubits) diff --git a/source/pip/qsharp/interop/qiskit/backends/qirtarget.py b/source/pip/qsharp/interop/qiskit/backends/qirtarget.py index 9305bc0995..d4be2c79b3 100644 --- a/source/pip/qsharp/interop/qiskit/backends/qirtarget.py +++ b/source/pip/qsharp/interop/qiskit/backends/qirtarget.py @@ -83,19 +83,10 @@ def __getattr__(self, item): It forwards the attribute lookup to the internal _target object, effectively making this class act as a proxy or wrapper around the target. - Args: - item (str): The name of the attribute being accessed. - - Returns: - Any: The value of the requested attribute from the _target object. - - Raises: - AttributeError: If the requested item is "_target" or if the attribute - does not exist on the _target object. - - Note: - The special handling of "_target" prevents infinite recursion and - maintains proper encapsulation of the internal target object. + :param item: The name of the attribute being accessed. + :return: The value of the requested attribute from the ``_target`` object. + :raises AttributeError: If the requested item is ``"_target"`` or if the attribute + does not exist on the ``_target`` object. """ if item == "_target": raise AttributeError(item) @@ -120,33 +111,17 @@ def build_target( operations and gates that can be used when compiling Q#/OpenQASM code to QIR (Quantum Intermediate Representation) format. - Args: - num_qubits (Union[int, None], optional): The number of qubits for the target. - If None, the target will support any number of qubits. Defaults to None. - target_profile (TargetProfile, optional): The target profile that determines - which control flow operations are supported. If not TargetProfile.Base, - adds control flow operations like if_else, switch_case, and while_loop. - Defaults to TargetProfile.Base. - supports_barrier (bool, optional): Whether to include barrier operations - in the target. Defaults to False. - supports_delay (bool, optional): Whether to include delay operations - in the target. Defaults to False. - - Returns: - Target: A Qiskit Target object configured with quantum gates and operations - including: - - Basic single-qubit gates (X, Y, Z, H, S, T, SX, I) - - Rotation gates (RX, RY, RZ) with parameters - - Two-qubit gates (CX, CY, CZ, SWAP, controlled rotations) - - Three-qubit gates (CCX) - - Multi-qubit rotation gates (RXX, RYY, RZZ) - - Measurement and reset operations - - Control flow operations (when target_profile != Base) - - Optional barrier and delay operations - - Note: - The target includes reset operations even for base profile since the - compiler can implement workarounds using decompositions. + :param num_qubits: The number of qubits for the target. + If ``None``, the target will support any number of qubits. Defaults to ``None``. + :param target_profile: The target profile that determines which control flow operations + are supported. If not ``TargetProfile.Base``, adds control flow operations like + ``if_else``, ``switch_case``, and ``while_loop``. Defaults to ``TargetProfile.Base``. + :param supports_barrier: Whether to include barrier operations in the target. + Defaults to ``False``. + :param supports_delay: Whether to include delay operations in the target. + Defaults to ``False``. + :return: A Qiskit ``Target`` object configured with quantum gates and operations. + :rtype: Target """ target = Target(num_qubits=num_qubits) diff --git a/source/pip/qsharp/interop/qiskit/backends/qsharp_backend.py b/source/pip/qsharp/interop/qiskit/backends/qsharp_backend.py index a95a838897..64be8d2348 100644 --- a/source/pip/qsharp/interop/qiskit/backends/qsharp_backend.py +++ b/source/pip/qsharp/interop/qiskit/backends/qsharp_backend.py @@ -175,19 +175,18 @@ def _run_qasm( Any gates, such as matrix unitaries, that are not able to be transpiled will result in an error. - Parameters: - source (str): The input OpenQASM 3 string to be processed. - **options: Additional keyword arguments to pass to the execution. Defaults to backend config values. - - target_profile (TargetProfile): The target profile to use for the compilation. - - output_semantics (OutputSemantics, optional): The output semantics for the compilation. - - name (str): The name of the circuit. This is used as the entry point for the program. Defaults to 'program'. - - search_path (str): The optional search path for resolving qasm imports. - - shots (int): The number of shots to run the program for. Defaults to 1. - - seed (int): The seed to use for the random number generator. - - output_fn (Optional[Callable[[Output], None]]): A callback function that will be called with each output. Defaults to None. - - :returns values: A result or runtime errors. - + :param source: The input OpenQASM 3 string to be processed. + :param default_options: Default backend option values. + :param **options: Common options: + + - ``target_profile`` (TargetProfile): The target profile to use for the compilation. + - ``output_semantics`` (OutputSemantics): The output semantics for the compilation. + - ``name`` (str): The name of the circuit. Defaults to ``'program'``. + - ``search_path`` (str): The optional search path for resolving qasm imports. + - ``shots`` (int): The number of shots to run the program for. + - ``seed`` (int): The seed to use for the random number generator. + - ``output_fn`` (Callable): A callback for each output. Defaults to ``None``. + :return: A list of results or runtime errors. :raises QSharpError: If there is an error evaluating the source code. :raises QasmError: If there is an error generating, parsing, or compiling QASM. """ diff --git a/source/pip/qsharp/interop/qiskit/jobs/qsjob.py b/source/pip/qsharp/interop/qiskit/jobs/qsjob.py index 6304b58905..4a9dbbb533 100644 --- a/source/pip/qsharp/interop/qiskit/jobs/qsjob.py +++ b/source/pip/qsharp/interop/qiskit/jobs/qsjob.py @@ -25,6 +25,13 @@ class QsJob(JobV1, ABC): + """ + Abstract base class for Q# Qiskit jobs. + + Manages asynchronous execution of a quantum circuit via a callable submitted + to a thread pool. Concrete subclasses must implement :meth:`result` and + :meth:`_submit_duration`. + """ def __init__( self, @@ -36,7 +43,21 @@ def __init__( executor=None, **kwargs, ) -> None: - super().__init__(backend, job_id, **kwargs) + """ + :param backend: The backend on which the job is run. + :type backend: Optional[BackendV2] + :param job_id: A unique identifier for the job. + :type job_id: str + :param job_callable: The callable that executes the circuit and returns a result. + :type job_callable: RunInputCallable + :param run_input: The quantum circuit to execute. + :type run_input: QuantumCircuit + :param input_params: Parameters forwarded to ``job_callable`` at execution time. + :type input_params: Dict[str, Any] + :param executor: Thread pool executor. Uses a default single-threaded executor if + not provided. + :param **kwargs: Additional keyword arguments passed to :class:`~qiskit.providers.JobV1`. + """ self._run_input = run_input self._input_params = input_params @@ -49,8 +70,7 @@ def __init__( def submit(self): """Submit the job to the backend for execution. - Raises: - JobError: if trying to re-submit the job. + :raises JobError: If trying to re-submit the job. """ if self._future is not None: raise JobError("Job has already been submitted.") @@ -114,6 +134,12 @@ def add_done_callback(self, fn: Callable[[Future[Result]], object]) -> None: class QsSimJob(QsJob): + """ + A Qiskit job that runs a quantum circuit on the Q# simulator. + + Submits the circuit for simulation and returns a :class:`~qiskit.result.Result` + containing shot-level measurement outcomes. + """ def result(self, timeout: Optional[float] = None) -> Result: return self._result(timeout=timeout) @@ -121,8 +147,7 @@ def result(self, timeout: Optional[float] = None) -> Result: def submit(self): """Submit the job to the backend for execution. - Raises: - JobError: if trying to re-submit the job. + :raises JobError: If trying to re-submit the job. """ shots = self._input_params.get("shots", -1) telemetry_events.on_qiskit_run(shots, 1) @@ -141,6 +166,12 @@ def _submit_duration(self, _future: Future): class ReJob(QsJob): + """ + A Qiskit job that runs the Q# Resource Estimator. + + Submits the circuit to the resource estimator and returns an + :class:`~qsharp.estimator.EstimatorResult` with the computed resource estimates. + """ def result(self, timeout: Optional[float] = None) -> EstimatorResult: return self._result(timeout=timeout) @@ -148,8 +179,7 @@ def result(self, timeout: Optional[float] = None) -> EstimatorResult: def submit(self): """Submit the job to the backend for execution. - Raises: - JobError: if trying to re-submit the job. + :raises JobError: If trying to re-submit the job. """ telemetry_events.on_qiskit_run_re() diff --git a/source/pip/qsharp/interop/qiskit/jobs/qsjobset.py b/source/pip/qsharp/interop/qiskit/jobs/qsjobset.py index ef6120af75..7542c80db3 100644 --- a/source/pip/qsharp/interop/qiskit/jobs/qsjobset.py +++ b/source/pip/qsharp/interop/qiskit/jobs/qsjobset.py @@ -49,8 +49,7 @@ def __init__( def submit(self): """Submit the job to the backend for execution. - Raises: - JobError: if trying to re-submit the job. + :raises JobError: If trying to re-submit the job. """ if len(self._jobs) > 0: raise JobError("Jobs have already been submitted.") From 65ff8b5e93624cbc66f6fc5857e83b1015abbc2b Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 10 Apr 2026 14:30:29 -0700 Subject: [PATCH 07/26] More fixups and added docstrings --- source/pip/qsharp/_native.pyi | 16 +++- source/pip/qsharp/_qsharp.py | 3 +- source/pip/qsharp/estimator/_estimator.py | 84 ++++++++++++++++++- source/pip/qsharp/interop/qiskit/__init__.py | 18 ++-- .../qsharp/interop/qiskit/jobs/qsjobset.py | 8 ++ 5 files changed, 115 insertions(+), 14 deletions(-) diff --git a/source/pip/qsharp/_native.pyi b/source/pip/qsharp/_native.pyi index 0f61a621f3..303e1224bc 100644 --- a/source/pip/qsharp/_native.pyi +++ b/source/pip/qsharp/_native.pyi @@ -429,6 +429,10 @@ class StateDumpData: def _repr_latex_(self) -> Optional[str]: ... class CircuitConfig: + """ + Configuration options for circuit generation. + """ + def __init__( self, *, @@ -439,10 +443,6 @@ class CircuitConfig: prune_classical_qubits: bool = False, ) -> None: ... - """ - Configuration options for circuit generation. - """ - max_operations: Optional[int] """ The maximum number of operations to include in the generated circuit. @@ -481,6 +481,14 @@ class CircuitGenerationMethod(Enum): """ class Circuit: + """ + A quantum circuit diagram generated from a Q# or OpenQASM program. + + Returned by :func:`qsharp.circuit` and :func:`qsharp.dump_circuit`. + Use :meth:`json` to obtain a JSON representation suitable for rendering + with the Q# circuit widget. + """ + def json(self) -> str: ... def __repr__(self) -> str: ... def __str__(self) -> str: ... diff --git a/source/pip/qsharp/_qsharp.py b/source/pip/qsharp/_qsharp.py index 1b2ecdb361..caf547d3f0 100644 --- a/source/pip/qsharp/_qsharp.py +++ b/source/pip/qsharp/_qsharp.py @@ -143,11 +143,12 @@ def ipython_helper(): class Config: - _config: Dict[str, Any] """ Configuration hints for the language service. """ + _config: Dict[str, Any] + def __init__( self, target_profile: TargetProfile, diff --git a/source/pip/qsharp/estimator/_estimator.py b/source/pip/qsharp/estimator/_estimator.py index 4eac639616..1e24231613 100644 --- a/source/pip/qsharp/estimator/_estimator.py +++ b/source/pip/qsharp/estimator/_estimator.py @@ -85,6 +85,12 @@ def validating_field(validation_func, default=None): class QubitParams: + """ + Predefined qubit model name constants for use with :class:`EstimatorQubitParams`. + + Pass one of these string constants as the ``name`` field to select a built-in + qubit model for resource estimation. + """ GATE_US_E3 = "qubit_gate_us_e3" GATE_US_E4 = "qubit_gate_us_e4" GATE_NS_E3 = "qubit_gate_ns_e3" @@ -94,6 +100,13 @@ class QubitParams: class QECScheme: + """ + Predefined quantum error correction scheme name constants for use with + :class:`EstimatorQecScheme`. + + Pass one of these string constants as the ``name`` field to select a + built-in QEC scheme for resource estimation. + """ SURFACE_CODE = "surface_code" FLOQUET_CODE = "floquet_code" @@ -128,12 +141,29 @@ def check_time(name, value): @dataclass class MeasurementErrorRate(AutoValidatingParams): + """ + Measurement error rate specified separately for process and readout errors. + + Used as the value of ``one_qubit_measurement_error_rate`` or + ``two_qubit_joint_measurement_error_rate`` in :class:`EstimatorQubitParams` + when process and readout error rates differ. + + :param process: Error rate during the measurement process. Must be in ``(0, 1)``. + :param readout: Error rate during readout. Must be in ``(0, 1)``. + """ process: float = field(metadata={"validate": _check_error_rate}) readout: float = field(metadata={"validate": _check_error_rate}) @dataclass class EstimatorQubitParams(AutoValidatingParams): + """ + Physical qubit parameters for resource estimation. + + Specify a built-in qubit model by setting ``name`` to one of the + :class:`QubitParams` constants, or fully define a custom model by setting + ``instruction_set`` and all relevant timing and error-rate fields. + """ @staticmethod def check_instruction_set(name, value): if value not in [ @@ -224,6 +254,13 @@ def as_dict(self, validate=True) -> Dict[str, Any]: @dataclass class EstimatorQecScheme(AutoValidatingParams): + """ + Quantum error correction scheme parameters for resource estimation. + + Specify a built-in scheme by setting ``name`` to one of the + :class:`QECScheme` constants, or define a custom scheme by setting + the threshold and code-distance parameters directly. + """ name: Optional[str] = None error_correction_threshold: Optional[float] = validating_field(_check_error_rate) crossing_prefactor: Optional[float] = None @@ -235,6 +272,12 @@ class EstimatorQecScheme(AutoValidatingParams): @dataclass class ProtocolSpecificDistillationUnitSpecification(AutoValidatingParams): + """ + Protocol-specific specification for a magic-state distillation unit. + + Defines the number of physical qubits and the duration (in logical cycle + time units) for one round of distillation under a specific QEC code. + """ num_unit_qubits: Optional[int] = None duration_in_qubit_cycle_time: Optional[int] = None @@ -248,6 +291,14 @@ def post_validation(self, result): @dataclass class DistillationUnitSpecification(AutoValidatingParams): + """ + Specification for a magic-state distillation unit. + + Either select a built-in unit by setting ``name``, or define a custom unit + by providing ``num_input_ts``, ``num_output_ts``, ``failure_probability_formula``, + ``output_error_rate_formula``, and optionally physical and logical qubit + specifications. + """ name: Optional[str] = None display_name: Optional[str] = None num_input_ts: Optional[int] = None @@ -356,6 +407,16 @@ def as_dict(self, validate=True) -> Dict[str, Any]: @dataclass class ErrorBudgetPartition(AutoValidatingParams): + """ + Partition of the total error budget across algorithm components. + + The three fields must sum to the overall error budget. Defaults to equal + thirds of ``0.001`` (i.e. each component gets ``~3.33e-4``). + + :param logical: Budget allocated to logical errors in the algorithm. + :param t_states: Budget allocated to T-state distillation errors. + :param rotations: Budget allocated to rotation synthesis errors. + """ logical: float = 0.001 / 3 t_states: float = 0.001 / 3 rotations: float = 0.001 / 3 @@ -363,6 +424,12 @@ class ErrorBudgetPartition(AutoValidatingParams): @dataclass class EstimatorConstraints(AutoValidatingParams): + """ + Optional runtime and resource constraints for resource estimation. + + At most one of ``max_duration`` or ``max_physical_qubits`` may be set + simultaneously. + """ @staticmethod def at_least_one(name, value): if value < 1: @@ -382,9 +449,11 @@ def post_validation(self, result): class EstimatorInputParamsItem: """ - Input params for microsoft.estimator target + Input parameters for a single resource estimation job. - :ivar error_budget Total error budget for execution of the algorithm + Contains qubit model, QEC scheme, distillation unit specifications, constraints, + and error budget settings. Used directly for single-point estimation or as a + base class for batching via :class:`EstimatorParams`. """ def __init__(self): @@ -479,6 +548,17 @@ def as_dict(self, validate=True, additional_params=None) -> Dict[str, Any]: class EstimatorParams(EstimatorInputParamsItem): + """ + Top-level input parameters for the Microsoft Resource Estimator. + + Extends :class:`EstimatorInputParamsItem` with support for batching: pass + ``num_items`` to create a batching job where each item can override the + top-level parameters. + + :param num_items: Number of batching items. If ``None``, creates a + single-point estimation job. + :type num_items: int, optional + """ MAX_NUM_ITEMS: int = 1000 def __init__(self, num_items: Optional[int] = None): diff --git a/source/pip/qsharp/interop/qiskit/__init__.py b/source/pip/qsharp/interop/qiskit/__init__.py index a74d733456..6113fcb032 100644 --- a/source/pip/qsharp/interop/qiskit/__init__.py +++ b/source/pip/qsharp/interop/qiskit/__init__.py @@ -72,15 +72,19 @@ def estimate( Estimates resources for Qiskit QuantumCircuit. :param circuit: The input Qiskit QuantumCircuit object. + :type circuit: QuantumCircuit :param params: The parameters to configure physical estimation. - :**options: Additional options for the execution. - - Any options for the transpiler, exporter, or Qiskit passes - configuration. Defaults to backend config values. Common - values include: 'optimization_level', 'basis_gates', - 'includes', 'search_path'. + :type params: EstimatorParams or dict or list, optional + :param **options: Additional options for the transpiler, exporter, or Qiskit passes + configuration. Defaults to backend config values. Common options: + + - ``optimization_level`` (int): Transpiler optimization level. + - ``basis_gates`` (list): Basis gates for transpilation. + - ``includes`` (list): Include paths for QASM resolution. + - ``search_path`` (str): Search path for resolving file references. :raises QasmError: If there is an error generating or parsing QASM. - - :returns `EstimatorResult`: The estimated resources. + :return: The estimated resources. + :rtype: EstimatorResult """ from ..._qsharp import ipython_helper diff --git a/source/pip/qsharp/interop/qiskit/jobs/qsjobset.py b/source/pip/qsharp/interop/qiskit/jobs/qsjobset.py index 7542c80db3..6e0d35d3de 100644 --- a/source/pip/qsharp/interop/qiskit/jobs/qsjobset.py +++ b/source/pip/qsharp/interop/qiskit/jobs/qsjobset.py @@ -24,6 +24,14 @@ class QsJobSet(Job): + """ + A Qiskit job set that runs multiple quantum circuits concurrently. + + Each circuit in ``run_input`` is submitted as an individual :class:`QsSimJob` + and executed in a thread pool. :meth:`result` blocks until all constituent + jobs are complete and aggregates their :class:`~qiskit.result.Result` objects + into a single combined result. + """ def __init__( self, From c5ddfce4b4621294aa67ad9990da2eeb53b039c2 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 10 Apr 2026 14:42:44 -0700 Subject: [PATCH 08/26] updates the `qdk` docstrings --- source/qdk_package/src/qdk/__init__.py | 18 +++++++++--------- source/qdk_package/src/qdk/azure/__init__.py | 5 +++-- source/qdk_package/src/qdk/azure/cirq.py | 3 ++- source/qdk_package/src/qdk/azure/qiskit.py | 3 ++- source/qdk_package/src/qdk/simulation.py | 7 +++++++ 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/source/qdk_package/src/qdk/__init__.py b/source/qdk_package/src/qdk/__init__.py index ea3a13001e..8a14c157fa 100644 --- a/source/qdk_package/src/qdk/__init__.py +++ b/source/qdk_package/src/qdk/__init__.py @@ -3,15 +3,15 @@ """qdk bundling top-level package. -Design goals: - * Provide a single import root `qdk` that exposes bundled quantum tooling as - submodules (`qdk.qsharp`, `qdk.widgets`, etc.). - -Optional extras: - azure -> installs `azure-quantum`, available as `qdk.azure`. - qiskit -> installs `qiskit`, available as `qdk.qiskit`. - cirq -> installs `cirq-core` + `cirq-ionq`, available as `qdk.cirq`. - jupyter -> installs `qsharp-widgets` + `qsharp-jupyterlab`; exposes `qdk.widgets`. +Provides a single import root ``qdk`` that exposes bundled quantum tooling as +submodules (``qdk.qsharp``, ``qdk.widgets``, etc.). + +Optional extras install additional dependencies and submodules: + +- ``azure`` — installs ``azure-quantum``, available as ``qdk.azure``. +- ``qiskit`` — installs ``qiskit``, available as ``qdk.qiskit``. +- ``cirq`` — installs ``cirq-core`` + ``cirq-ionq``, available as ``qdk.cirq``. +- ``jupyter`` — installs ``qsharp-widgets`` + ``qsharp-jupyterlab``; exposes ``qdk.widgets``. """ diff --git a/source/qdk_package/src/qdk/azure/__init__.py b/source/qdk_package/src/qdk/azure/__init__.py index 8c5ba233ca..c3bef4cd8a 100644 --- a/source/qdk_package/src/qdk/azure/__init__.py +++ b/source/qdk_package/src/qdk/azure/__init__.py @@ -3,9 +3,10 @@ """qdk.azure package: re-export of azure.quantum namespaces. -Requires optional extra installation: `pip install qdk[azure]`. +Requires optional extra installation: ``pip install qdk[azure]``. + +Usage example:: -Usage examples: from qdk import azure ws = azure.Workspace(...) # if upstream exposes Workspace at top-level diff --git a/source/qdk_package/src/qdk/azure/cirq.py b/source/qdk_package/src/qdk/azure/cirq.py index 02d2b71b78..2a7a87fd3b 100644 --- a/source/qdk_package/src/qdk/azure/cirq.py +++ b/source/qdk_package/src/qdk/azure/cirq.py @@ -5,7 +5,8 @@ Requires installation: ``pip install \"qdk[azure,cirq]\"``. -Example: +Example:: + from qdk.azure.cirq import """ diff --git a/source/qdk_package/src/qdk/azure/qiskit.py b/source/qdk_package/src/qdk/azure/qiskit.py index 9a4fa98d0f..d97ce88839 100644 --- a/source/qdk_package/src/qdk/azure/qiskit.py +++ b/source/qdk_package/src/qdk/azure/qiskit.py @@ -5,7 +5,8 @@ Requires installation: ``pip install \"qdk[azure,qiskit]\"``. -Example: +Example:: + from qdk.azure.qiskit import """ diff --git a/source/qdk_package/src/qdk/simulation.py b/source/qdk_package/src/qdk/simulation.py index 71a2acc0e1..9a804f6313 100644 --- a/source/qdk_package/src/qdk/simulation.py +++ b/source/qdk_package/src/qdk/simulation.py @@ -1,5 +1,12 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. +"""Simulation utilities for the Q# ecosystem. + +Exposes :class:`~qsharp._device._atom.NeutralAtomDevice` and +:class:`~qsharp._simulation.NoiseConfig` for configuring and running +noise-aware quantum simulations. +""" + from qsharp._device._atom import NeutralAtomDevice from qsharp._simulation import NoiseConfig From df64af7a1a3fd993e4fa1d96faa436cb5a6d8cc9 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 10 Apr 2026 14:53:18 -0700 Subject: [PATCH 09/26] fix up some docstrings in `qdk` --- source/qdk_package/src/qdk/cirq.py | 9 ++++++--- source/qdk_package/src/qdk/estimator.py | 18 +++++++++++++++++- source/qdk_package/src/qdk/openqasm.py | 16 +++++++++++++++- source/qdk_package/src/qdk/qsharp.py | 13 ++++++++++++- source/qdk_package/src/qdk/simulation.py | 12 +++++++++--- 5 files changed, 59 insertions(+), 9 deletions(-) diff --git a/source/qdk_package/src/qdk/cirq.py b/source/qdk_package/src/qdk/cirq.py index a1ae0c31be..fa4583d6ff 100644 --- a/source/qdk_package/src/qdk/cirq.py +++ b/source/qdk_package/src/qdk/cirq.py @@ -3,9 +3,12 @@ """Cirq interoperability for the Q# ecosystem. -This module provides a :class:`NeutralAtomSampler` — a standard -``cirq.Sampler`` that runs Cirq circuits on the local NeutralAtomDevice -simulator. +This module re-exports all public symbols from ``qsharp.interop.cirq``, +making them available under the ``qdk.cirq`` namespace. The primary export +is ``NeutralAtomSampler`` — a standard ``cirq.Sampler`` that runs Cirq +circuits on the local NeutralAtomDevice simulator. + +Requires the ``cirq`` extra: ``pip install qdk[cirq]``. Usage:: diff --git a/source/qdk_package/src/qdk/estimator.py b/source/qdk_package/src/qdk/estimator.py index de1899305a..6336977666 100644 --- a/source/qdk_package/src/qdk/estimator.py +++ b/source/qdk_package/src/qdk/estimator.py @@ -1,6 +1,22 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. -"""Shim exposing qsharp.estimator as qdk.estimator.""" +"""Resource estimation utilities for the Q# ecosystem. + +This module re-exports all public symbols from ``qsharp.estimator``, +making them available under the ``qdk.estimator`` namespace. It provides +classes for configuring and interpreting Microsoft Resource Estimator jobs, +including qubit parameter models, QEC schemes, distillation unit +specifications, error budgets, and the result container. + +Key exports: + +- ``EstimatorParams`` — top-level input parameters for a resource estimation job. +- ``EstimatorResult`` — result container with formatted tables and diagrams. +- ``LogicalCounts`` — pre-calculated logical resource counts for physical estimation. +- ``QubitParams``, ``QECScheme`` — predefined model name constants. +- ``EstimatorQubitParams``, ``EstimatorQecScheme`` — custom model configuration. +- ``ErrorBudgetPartition``, ``EstimatorConstraints`` — budget and constraint settings. +""" from qsharp.estimator import * # pyright: ignore[reportWildcardImportFromLibrary] diff --git a/source/qdk_package/src/qdk/openqasm.py b/source/qdk_package/src/qdk/openqasm.py index 8a8dd10a04..1696d844ed 100644 --- a/source/qdk_package/src/qdk/openqasm.py +++ b/source/qdk_package/src/qdk/openqasm.py @@ -1,6 +1,20 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. -"""Shim exposing qsharp.openqasm as qdk.openqasm.""" +"""OpenQASM interoperability for the Q# ecosystem. + +This module re-exports all public symbols from ``qsharp.openqasm``, +making them available under the ``qdk.openqasm`` namespace. It provides +functions for importing, compiling, running, and estimating resources for +OpenQASM 2.0 and 3.0 programs using the local Q# toolchain. + +Key exports: + +- ``import_openqasm`` — parse and import an OpenQASM program into the Q# interpreter. +- ``run`` — execute an OpenQASM program and return shot results. +- ``compile`` — compile an OpenQASM program to QIR. +- ``estimate`` — run the Microsoft Resource Estimator on an OpenQASM program. +- ``circuit`` — synthesize a circuit diagram from an OpenQASM program. +""" from qsharp.openqasm import * # pyright: ignore[reportWildcardImportFromLibrary] diff --git a/source/qdk_package/src/qdk/qsharp.py b/source/qdk_package/src/qdk/qsharp.py index 8412b7beab..0bef6d4893 100644 --- a/source/qdk_package/src/qdk/qsharp.py +++ b/source/qdk_package/src/qdk/qsharp.py @@ -1,7 +1,18 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. -"""Re-export of `qsharp` as `qdk.qsharp`.""" +"""Full re-export of the ``qsharp`` package as ``qdk.qsharp``. + +This module makes the entire ``qsharp`` public API available under the +``qdk.qsharp`` namespace, so code that imports from ``qdk.qsharp`` behaves +identically to importing from ``qsharp`` directly. It also pulls in +``dump_operation`` from ``qsharp.utils``. + +Key exports include ``init``, ``run``, ``eval``, ``compile``, ``circuit``, +``estimate``, ``dump_machine``, ``dump_circuit``, ``StateDump``, +``TargetProfile``, and the noise classes ``PauliNoise``, ``DepolarizingNoise``, +``BitFlipNoise``, and ``PhaseFlipNoise``. +""" from qsharp import * # pyright: ignore[reportWildcardImportFromLibrary] from qsharp.utils import dump_operation # pyright: ignore[reportUnusedImport] diff --git a/source/qdk_package/src/qdk/simulation.py b/source/qdk_package/src/qdk/simulation.py index 9a804f6313..ea01b936d3 100644 --- a/source/qdk_package/src/qdk/simulation.py +++ b/source/qdk_package/src/qdk/simulation.py @@ -3,9 +3,15 @@ """Simulation utilities for the Q# ecosystem. -Exposes :class:`~qsharp._device._atom.NeutralAtomDevice` and -:class:`~qsharp._simulation.NoiseConfig` for configuring and running -noise-aware quantum simulations. +This module exposes the core building blocks for noise-aware quantum simulation: + +- ``NeutralAtomDevice`` — models a neutral atom quantum device with configurable + zone layouts, qubit registers, and movement constraints. Used to compile + and simulate circuits on a realistic hardware topology. + +- ``NoiseConfig`` — configures per-gate Pauli noise (including qubit loss) for + use with the Q# simulator. Assign noise tables to individual gate intrinsics + to model depolarizing, bit-flip, phase-flip, or correlated noise channels. """ from qsharp._device._atom import NeutralAtomDevice From 5082e6630c0302efd3bb4a88ad4a1d7b64d42647 Mon Sep 17 00:00:00 2001 From: Kirill Komissarov Date: Fri, 10 Apr 2026 16:29:50 -0700 Subject: [PATCH 10/26] chore: temporarily changing qsharp version for doc generation --- source/qdk_package/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/qdk_package/pyproject.toml b/source/qdk_package/pyproject.toml index 958c4ad49f..e06f15c6c1 100644 --- a/source/qdk_package/pyproject.toml +++ b/source/qdk_package/pyproject.toml @@ -10,7 +10,7 @@ readme = "README.md" authors = [ { name = "Microsoft" } ] license = { file = "LICENSE.txt" } requires-python = ">=3.10" -dependencies = ["qsharp==0.0.0", "pyqir<0.12"] +dependencies = ["qsharp==1.27.0", "pyqir<0.12"] [project.optional-dependencies] jupyter = ["qsharp-widgets==0.0.0", "qsharp-jupyterlab==0.0.0"] From 03285dcf3a5efa9b0de0a00b649aec531a71fb79 Mon Sep 17 00:00:00 2001 From: Kirill Komissarov Date: Fri, 10 Apr 2026 19:32:13 -0700 Subject: [PATCH 11/26] fix: temporary --- source/qdk_package/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/qdk_package/pyproject.toml b/source/qdk_package/pyproject.toml index e06f15c6c1..00b652b5df 100644 --- a/source/qdk_package/pyproject.toml +++ b/source/qdk_package/pyproject.toml @@ -10,7 +10,7 @@ readme = "README.md" authors = [ { name = "Microsoft" } ] license = { file = "LICENSE.txt" } requires-python = ">=3.10" -dependencies = ["qsharp==1.27.0", "pyqir<0.12"] +dependencies = ["qsharp==1.27.0", "pyqir<0.11.0,>=0.10.0"] [project.optional-dependencies] jupyter = ["qsharp-widgets==0.0.0", "qsharp-jupyterlab==0.0.0"] From 0770e88af1e928ec4a65bedbab5959131fa96d1a Mon Sep 17 00:00:00 2001 From: Kirill Komissarov Date: Tue, 14 Apr 2026 18:06:49 -0700 Subject: [PATCH 12/26] fix: moving qdk from src folder --- source/qdk_package/pyproject.toml | 6 +++--- source/qdk_package/{src => }/qdk/__init__.py | 0 source/qdk_package/{src => }/qdk/azure/__init__.py | 0 source/qdk_package/{src => }/qdk/azure/argument_types.py | 0 source/qdk_package/{src => }/qdk/azure/cirq.py | 0 source/qdk_package/{src => }/qdk/azure/job.py | 0 source/qdk_package/{src => }/qdk/azure/qiskit.py | 0 source/qdk_package/{src => }/qdk/azure/target/__init__.py | 0 source/qdk_package/{src => }/qdk/azure/target/rigetti.py | 0 source/qdk_package/{src => }/qdk/cirq.py | 0 source/qdk_package/{src => }/qdk/estimator.py | 0 source/qdk_package/{src => }/qdk/openqasm.py | 0 source/qdk_package/{src => }/qdk/qiskit.py | 0 source/qdk_package/{src => }/qdk/qsharp.py | 0 source/qdk_package/{src => }/qdk/simulation.py | 0 source/qdk_package/{src => }/qdk/widgets.py | 0 16 files changed, 3 insertions(+), 3 deletions(-) rename source/qdk_package/{src => }/qdk/__init__.py (100%) rename source/qdk_package/{src => }/qdk/azure/__init__.py (100%) rename source/qdk_package/{src => }/qdk/azure/argument_types.py (100%) rename source/qdk_package/{src => }/qdk/azure/cirq.py (100%) rename source/qdk_package/{src => }/qdk/azure/job.py (100%) rename source/qdk_package/{src => }/qdk/azure/qiskit.py (100%) rename source/qdk_package/{src => }/qdk/azure/target/__init__.py (100%) rename source/qdk_package/{src => }/qdk/azure/target/rigetti.py (100%) rename source/qdk_package/{src => }/qdk/cirq.py (100%) rename source/qdk_package/{src => }/qdk/estimator.py (100%) rename source/qdk_package/{src => }/qdk/openqasm.py (100%) rename source/qdk_package/{src => }/qdk/qiskit.py (100%) rename source/qdk_package/{src => }/qdk/qsharp.py (100%) rename source/qdk_package/{src => }/qdk/simulation.py (100%) rename source/qdk_package/{src => }/qdk/widgets.py (100%) diff --git a/source/qdk_package/pyproject.toml b/source/qdk_package/pyproject.toml index 00b652b5df..a9c53fef11 100644 --- a/source/qdk_package/pyproject.toml +++ b/source/qdk_package/pyproject.toml @@ -10,7 +10,7 @@ readme = "README.md" authors = [ { name = "Microsoft" } ] license = { file = "LICENSE.txt" } requires-python = ">=3.10" -dependencies = ["qsharp==1.27.0", "pyqir<0.11.0,>=0.10.0"] +dependencies = ["qsharp==1.27.0", "pyqir<0.12"] [project.optional-dependencies] jupyter = ["qsharp-widgets==0.0.0", "qsharp-jupyterlab==0.0.0"] @@ -27,8 +27,8 @@ all = [ ] [tool.setuptools.packages.find] -where = ["src"] +where = ["qdk"] [tool.setuptools] -package-dir = {"" = "src"} +package-dir = {"" = "qdk"} diff --git a/source/qdk_package/src/qdk/__init__.py b/source/qdk_package/qdk/__init__.py similarity index 100% rename from source/qdk_package/src/qdk/__init__.py rename to source/qdk_package/qdk/__init__.py diff --git a/source/qdk_package/src/qdk/azure/__init__.py b/source/qdk_package/qdk/azure/__init__.py similarity index 100% rename from source/qdk_package/src/qdk/azure/__init__.py rename to source/qdk_package/qdk/azure/__init__.py diff --git a/source/qdk_package/src/qdk/azure/argument_types.py b/source/qdk_package/qdk/azure/argument_types.py similarity index 100% rename from source/qdk_package/src/qdk/azure/argument_types.py rename to source/qdk_package/qdk/azure/argument_types.py diff --git a/source/qdk_package/src/qdk/azure/cirq.py b/source/qdk_package/qdk/azure/cirq.py similarity index 100% rename from source/qdk_package/src/qdk/azure/cirq.py rename to source/qdk_package/qdk/azure/cirq.py diff --git a/source/qdk_package/src/qdk/azure/job.py b/source/qdk_package/qdk/azure/job.py similarity index 100% rename from source/qdk_package/src/qdk/azure/job.py rename to source/qdk_package/qdk/azure/job.py diff --git a/source/qdk_package/src/qdk/azure/qiskit.py b/source/qdk_package/qdk/azure/qiskit.py similarity index 100% rename from source/qdk_package/src/qdk/azure/qiskit.py rename to source/qdk_package/qdk/azure/qiskit.py diff --git a/source/qdk_package/src/qdk/azure/target/__init__.py b/source/qdk_package/qdk/azure/target/__init__.py similarity index 100% rename from source/qdk_package/src/qdk/azure/target/__init__.py rename to source/qdk_package/qdk/azure/target/__init__.py diff --git a/source/qdk_package/src/qdk/azure/target/rigetti.py b/source/qdk_package/qdk/azure/target/rigetti.py similarity index 100% rename from source/qdk_package/src/qdk/azure/target/rigetti.py rename to source/qdk_package/qdk/azure/target/rigetti.py diff --git a/source/qdk_package/src/qdk/cirq.py b/source/qdk_package/qdk/cirq.py similarity index 100% rename from source/qdk_package/src/qdk/cirq.py rename to source/qdk_package/qdk/cirq.py diff --git a/source/qdk_package/src/qdk/estimator.py b/source/qdk_package/qdk/estimator.py similarity index 100% rename from source/qdk_package/src/qdk/estimator.py rename to source/qdk_package/qdk/estimator.py diff --git a/source/qdk_package/src/qdk/openqasm.py b/source/qdk_package/qdk/openqasm.py similarity index 100% rename from source/qdk_package/src/qdk/openqasm.py rename to source/qdk_package/qdk/openqasm.py diff --git a/source/qdk_package/src/qdk/qiskit.py b/source/qdk_package/qdk/qiskit.py similarity index 100% rename from source/qdk_package/src/qdk/qiskit.py rename to source/qdk_package/qdk/qiskit.py diff --git a/source/qdk_package/src/qdk/qsharp.py b/source/qdk_package/qdk/qsharp.py similarity index 100% rename from source/qdk_package/src/qdk/qsharp.py rename to source/qdk_package/qdk/qsharp.py diff --git a/source/qdk_package/src/qdk/simulation.py b/source/qdk_package/qdk/simulation.py similarity index 100% rename from source/qdk_package/src/qdk/simulation.py rename to source/qdk_package/qdk/simulation.py diff --git a/source/qdk_package/src/qdk/widgets.py b/source/qdk_package/qdk/widgets.py similarity index 100% rename from source/qdk_package/src/qdk/widgets.py rename to source/qdk_package/qdk/widgets.py From c42a0d6352acaf46d6c989afdc35e0b448371f46 Mon Sep 17 00:00:00 2001 From: Kirill Komissarov Date: Tue, 14 Apr 2026 18:29:25 -0700 Subject: [PATCH 13/26] fix --- source/qdk_package/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/qdk_package/pyproject.toml b/source/qdk_package/pyproject.toml index a9c53fef11..540648acf6 100644 --- a/source/qdk_package/pyproject.toml +++ b/source/qdk_package/pyproject.toml @@ -10,7 +10,7 @@ readme = "README.md" authors = [ { name = "Microsoft" } ] license = { file = "LICENSE.txt" } requires-python = ">=3.10" -dependencies = ["qsharp==1.27.0", "pyqir<0.12"] +dependencies = ["qsharp==1.27.0", "pyqir<0.11.0,>=0.10.0"] [project.optional-dependencies] jupyter = ["qsharp-widgets==0.0.0", "qsharp-jupyterlab==0.0.0"] From 76a104011d2d0ac1b9cfeb93056d8ead034ae851 Mon Sep 17 00:00:00 2001 From: Kirill Komissarov Date: Wed, 15 Apr 2026 00:28:10 -0700 Subject: [PATCH 14/26] revering the changes --- source/qdk_package/pyproject.toml | 6 +++--- source/qdk_package/{ => src}/qdk/__init__.py | 0 source/qdk_package/{ => src}/qdk/azure/__init__.py | 0 source/qdk_package/{ => src}/qdk/azure/argument_types.py | 0 source/qdk_package/{ => src}/qdk/azure/cirq.py | 0 source/qdk_package/{ => src}/qdk/azure/job.py | 0 source/qdk_package/{ => src}/qdk/azure/qiskit.py | 0 source/qdk_package/{ => src}/qdk/azure/target/__init__.py | 0 source/qdk_package/{ => src}/qdk/azure/target/rigetti.py | 0 source/qdk_package/{ => src}/qdk/cirq.py | 0 source/qdk_package/{ => src}/qdk/estimator.py | 0 source/qdk_package/{ => src}/qdk/openqasm.py | 0 source/qdk_package/{ => src}/qdk/qiskit.py | 0 source/qdk_package/{ => src}/qdk/qsharp.py | 0 source/qdk_package/{ => src}/qdk/simulation.py | 0 source/qdk_package/{ => src}/qdk/widgets.py | 0 16 files changed, 3 insertions(+), 3 deletions(-) rename source/qdk_package/{ => src}/qdk/__init__.py (100%) rename source/qdk_package/{ => src}/qdk/azure/__init__.py (100%) rename source/qdk_package/{ => src}/qdk/azure/argument_types.py (100%) rename source/qdk_package/{ => src}/qdk/azure/cirq.py (100%) rename source/qdk_package/{ => src}/qdk/azure/job.py (100%) rename source/qdk_package/{ => src}/qdk/azure/qiskit.py (100%) rename source/qdk_package/{ => src}/qdk/azure/target/__init__.py (100%) rename source/qdk_package/{ => src}/qdk/azure/target/rigetti.py (100%) rename source/qdk_package/{ => src}/qdk/cirq.py (100%) rename source/qdk_package/{ => src}/qdk/estimator.py (100%) rename source/qdk_package/{ => src}/qdk/openqasm.py (100%) rename source/qdk_package/{ => src}/qdk/qiskit.py (100%) rename source/qdk_package/{ => src}/qdk/qsharp.py (100%) rename source/qdk_package/{ => src}/qdk/simulation.py (100%) rename source/qdk_package/{ => src}/qdk/widgets.py (100%) diff --git a/source/qdk_package/pyproject.toml b/source/qdk_package/pyproject.toml index 540648acf6..958c4ad49f 100644 --- a/source/qdk_package/pyproject.toml +++ b/source/qdk_package/pyproject.toml @@ -10,7 +10,7 @@ readme = "README.md" authors = [ { name = "Microsoft" } ] license = { file = "LICENSE.txt" } requires-python = ">=3.10" -dependencies = ["qsharp==1.27.0", "pyqir<0.11.0,>=0.10.0"] +dependencies = ["qsharp==0.0.0", "pyqir<0.12"] [project.optional-dependencies] jupyter = ["qsharp-widgets==0.0.0", "qsharp-jupyterlab==0.0.0"] @@ -27,8 +27,8 @@ all = [ ] [tool.setuptools.packages.find] -where = ["qdk"] +where = ["src"] [tool.setuptools] -package-dir = {"" = "qdk"} +package-dir = {"" = "src"} diff --git a/source/qdk_package/qdk/__init__.py b/source/qdk_package/src/qdk/__init__.py similarity index 100% rename from source/qdk_package/qdk/__init__.py rename to source/qdk_package/src/qdk/__init__.py diff --git a/source/qdk_package/qdk/azure/__init__.py b/source/qdk_package/src/qdk/azure/__init__.py similarity index 100% rename from source/qdk_package/qdk/azure/__init__.py rename to source/qdk_package/src/qdk/azure/__init__.py diff --git a/source/qdk_package/qdk/azure/argument_types.py b/source/qdk_package/src/qdk/azure/argument_types.py similarity index 100% rename from source/qdk_package/qdk/azure/argument_types.py rename to source/qdk_package/src/qdk/azure/argument_types.py diff --git a/source/qdk_package/qdk/azure/cirq.py b/source/qdk_package/src/qdk/azure/cirq.py similarity index 100% rename from source/qdk_package/qdk/azure/cirq.py rename to source/qdk_package/src/qdk/azure/cirq.py diff --git a/source/qdk_package/qdk/azure/job.py b/source/qdk_package/src/qdk/azure/job.py similarity index 100% rename from source/qdk_package/qdk/azure/job.py rename to source/qdk_package/src/qdk/azure/job.py diff --git a/source/qdk_package/qdk/azure/qiskit.py b/source/qdk_package/src/qdk/azure/qiskit.py similarity index 100% rename from source/qdk_package/qdk/azure/qiskit.py rename to source/qdk_package/src/qdk/azure/qiskit.py diff --git a/source/qdk_package/qdk/azure/target/__init__.py b/source/qdk_package/src/qdk/azure/target/__init__.py similarity index 100% rename from source/qdk_package/qdk/azure/target/__init__.py rename to source/qdk_package/src/qdk/azure/target/__init__.py diff --git a/source/qdk_package/qdk/azure/target/rigetti.py b/source/qdk_package/src/qdk/azure/target/rigetti.py similarity index 100% rename from source/qdk_package/qdk/azure/target/rigetti.py rename to source/qdk_package/src/qdk/azure/target/rigetti.py diff --git a/source/qdk_package/qdk/cirq.py b/source/qdk_package/src/qdk/cirq.py similarity index 100% rename from source/qdk_package/qdk/cirq.py rename to source/qdk_package/src/qdk/cirq.py diff --git a/source/qdk_package/qdk/estimator.py b/source/qdk_package/src/qdk/estimator.py similarity index 100% rename from source/qdk_package/qdk/estimator.py rename to source/qdk_package/src/qdk/estimator.py diff --git a/source/qdk_package/qdk/openqasm.py b/source/qdk_package/src/qdk/openqasm.py similarity index 100% rename from source/qdk_package/qdk/openqasm.py rename to source/qdk_package/src/qdk/openqasm.py diff --git a/source/qdk_package/qdk/qiskit.py b/source/qdk_package/src/qdk/qiskit.py similarity index 100% rename from source/qdk_package/qdk/qiskit.py rename to source/qdk_package/src/qdk/qiskit.py diff --git a/source/qdk_package/qdk/qsharp.py b/source/qdk_package/src/qdk/qsharp.py similarity index 100% rename from source/qdk_package/qdk/qsharp.py rename to source/qdk_package/src/qdk/qsharp.py diff --git a/source/qdk_package/qdk/simulation.py b/source/qdk_package/src/qdk/simulation.py similarity index 100% rename from source/qdk_package/qdk/simulation.py rename to source/qdk_package/src/qdk/simulation.py diff --git a/source/qdk_package/qdk/widgets.py b/source/qdk_package/src/qdk/widgets.py similarity index 100% rename from source/qdk_package/qdk/widgets.py rename to source/qdk_package/src/qdk/widgets.py From 61883fdc4e7f13cfa72f7a6a01a07c074537fb87 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Wed, 15 Apr 2026 11:54:50 -0700 Subject: [PATCH 15/26] generated `qsharp` docs --- python_doc/qsharp/qsharp.BitFlipNoise.yml | 21 + .../qsharp/qsharp.CircuitGenerationMethod.yml | 17 + .../qsharp/qsharp.DepolarizingNoise.yml | 23 ++ python_doc/qsharp/qsharp.Pauli.yml | 21 + python_doc/qsharp/qsharp.PauliNoise.yml | 29 ++ python_doc/qsharp/qsharp.PhaseFlipNoise.yml | 21 + python_doc/qsharp/qsharp.QSharpError.yml | 8 + python_doc/qsharp/qsharp.Result.yml | 18 + python_doc/qsharp/qsharp.ShotResult.yml | 24 ++ python_doc/qsharp/qsharp.StateDump.yml | 48 +++ python_doc/qsharp/qsharp.TargetProfile.yml | 41 ++ python_doc/qsharp/qsharp.code.yml | 6 + ...stimator.DistillationUnitSpecification.yml | 92 +++++ .../qsharp.estimator.ErrorBudgetPartition.yml | 34 ++ .../qsharp.estimator.EstimatorConstraints.yml | 52 +++ .../qsharp.estimator.EstimatorError.yml | 13 + ...arp.estimator.EstimatorInputParamsItem.yml | 24 ++ .../qsharp.estimator.EstimatorParams.yml | 43 ++ .../qsharp.estimator.EstimatorQecScheme.yml | 55 +++ .../qsharp.estimator.EstimatorQubitParams.yml | 113 ++++++ .../qsharp.estimator.EstimatorResult.yml | 44 ++ .../qsharp/qsharp.estimator.LogicalCounts.yml | 36 ++ .../qsharp.estimator.MeasurementErrorRate.yml | 29 ++ ...lSpecificDistillationUnitSpecification.yml | 33 ++ .../qsharp/qsharp.estimator.QECScheme.yml | 22 + .../qsharp/qsharp.estimator.QubitParams.yml | 32 ++ python_doc/qsharp/qsharp.estimator.yml | 20 + ...arp.interop.cirq.NeutralAtomCirqResult.yml | 64 +++ ...qsharp.interop.cirq.NeutralAtomSampler.yml | 115 ++++++ python_doc/qsharp/qsharp.interop.cirq.yml | 16 + python_doc/qsharp/qsharp.interop.yml | 7 + ...noisy_simulator.DensityMatrixSimulator.yml | 63 +++ .../qsharp.noisy_simulator.Instrument.yml | 10 + ...rp.noisy_simulator.NoisySimulatorError.yml | 7 + .../qsharp.noisy_simulator.Operation.yml | 23 ++ ...p.noisy_simulator.StateVectorSimulator.yml | 63 +++ python_doc/qsharp/qsharp.noisy_simulator.yml | 11 + .../qsharp.openqasm.OutputSemantics.yml | 22 + .../qsharp/qsharp.openqasm.ProgramType.yml | 18 + .../qsharp/qsharp.openqasm.QasmError.yml | 8 + python_doc/qsharp/qsharp.openqasm.yml | 306 ++++++++++++++ python_doc/qsharp/qsharp.telemetry.Metric.yml | 24 ++ .../qsharp/qsharp.telemetry.PendingMetric.yml | 30 ++ python_doc/qsharp/qsharp.telemetry.yml | 58 +++ python_doc/qsharp/qsharp.telemetry_events.yml | 232 +++++++++++ python_doc/qsharp/qsharp.utils.yml | 21 + python_doc/qsharp/qsharp.yml | 380 ++++++++++++++++++ python_doc/toc.yml | 202 ++++++++++ 48 files changed, 2599 insertions(+) create mode 100644 python_doc/qsharp/qsharp.BitFlipNoise.yml create mode 100644 python_doc/qsharp/qsharp.CircuitGenerationMethod.yml create mode 100644 python_doc/qsharp/qsharp.DepolarizingNoise.yml create mode 100644 python_doc/qsharp/qsharp.Pauli.yml create mode 100644 python_doc/qsharp/qsharp.PauliNoise.yml create mode 100644 python_doc/qsharp/qsharp.PhaseFlipNoise.yml create mode 100644 python_doc/qsharp/qsharp.QSharpError.yml create mode 100644 python_doc/qsharp/qsharp.Result.yml create mode 100644 python_doc/qsharp/qsharp.ShotResult.yml create mode 100644 python_doc/qsharp/qsharp.StateDump.yml create mode 100644 python_doc/qsharp/qsharp.TargetProfile.yml create mode 100644 python_doc/qsharp/qsharp.code.yml create mode 100644 python_doc/qsharp/qsharp.estimator.DistillationUnitSpecification.yml create mode 100644 python_doc/qsharp/qsharp.estimator.ErrorBudgetPartition.yml create mode 100644 python_doc/qsharp/qsharp.estimator.EstimatorConstraints.yml create mode 100644 python_doc/qsharp/qsharp.estimator.EstimatorError.yml create mode 100644 python_doc/qsharp/qsharp.estimator.EstimatorInputParamsItem.yml create mode 100644 python_doc/qsharp/qsharp.estimator.EstimatorParams.yml create mode 100644 python_doc/qsharp/qsharp.estimator.EstimatorQecScheme.yml create mode 100644 python_doc/qsharp/qsharp.estimator.EstimatorQubitParams.yml create mode 100644 python_doc/qsharp/qsharp.estimator.EstimatorResult.yml create mode 100644 python_doc/qsharp/qsharp.estimator.LogicalCounts.yml create mode 100644 python_doc/qsharp/qsharp.estimator.MeasurementErrorRate.yml create mode 100644 python_doc/qsharp/qsharp.estimator.ProtocolSpecificDistillationUnitSpecification.yml create mode 100644 python_doc/qsharp/qsharp.estimator.QECScheme.yml create mode 100644 python_doc/qsharp/qsharp.estimator.QubitParams.yml create mode 100644 python_doc/qsharp/qsharp.estimator.yml create mode 100644 python_doc/qsharp/qsharp.interop.cirq.NeutralAtomCirqResult.yml create mode 100644 python_doc/qsharp/qsharp.interop.cirq.NeutralAtomSampler.yml create mode 100644 python_doc/qsharp/qsharp.interop.cirq.yml create mode 100644 python_doc/qsharp/qsharp.interop.yml create mode 100644 python_doc/qsharp/qsharp.noisy_simulator.DensityMatrixSimulator.yml create mode 100644 python_doc/qsharp/qsharp.noisy_simulator.Instrument.yml create mode 100644 python_doc/qsharp/qsharp.noisy_simulator.NoisySimulatorError.yml create mode 100644 python_doc/qsharp/qsharp.noisy_simulator.Operation.yml create mode 100644 python_doc/qsharp/qsharp.noisy_simulator.StateVectorSimulator.yml create mode 100644 python_doc/qsharp/qsharp.noisy_simulator.yml create mode 100644 python_doc/qsharp/qsharp.openqasm.OutputSemantics.yml create mode 100644 python_doc/qsharp/qsharp.openqasm.ProgramType.yml create mode 100644 python_doc/qsharp/qsharp.openqasm.QasmError.yml create mode 100644 python_doc/qsharp/qsharp.openqasm.yml create mode 100644 python_doc/qsharp/qsharp.telemetry.Metric.yml create mode 100644 python_doc/qsharp/qsharp.telemetry.PendingMetric.yml create mode 100644 python_doc/qsharp/qsharp.telemetry.yml create mode 100644 python_doc/qsharp/qsharp.telemetry_events.yml create mode 100644 python_doc/qsharp/qsharp.utils.yml create mode 100644 python_doc/qsharp/qsharp.yml create mode 100644 python_doc/toc.yml diff --git a/python_doc/qsharp/qsharp.BitFlipNoise.yml b/python_doc/qsharp/qsharp.BitFlipNoise.yml new file mode 100644 index 0000000000..b2bfa67687 --- /dev/null +++ b/python_doc/qsharp/qsharp.BitFlipNoise.yml @@ -0,0 +1,21 @@ +### YamlMime:PythonClass +uid: qsharp.BitFlipNoise +name: BitFlipNoise +fullName: qsharp.BitFlipNoise +module: qsharp +summary: 'The bit flip noise to use in simulation. + + + Creates a new instance. + + + The bit flip channel applies a Pauli-X error with probability `p`.' +constructor: + syntax: 'BitFlipNoise(p: float)' + parameters: + - name: p + description: "Probability of a bit flip (Pauli-X) error. Must satisfy `0 \u2264\ + \ p \u2264 1`." + isRequired: true + types: + - diff --git a/python_doc/qsharp/qsharp.CircuitGenerationMethod.yml b/python_doc/qsharp/qsharp.CircuitGenerationMethod.yml new file mode 100644 index 0000000000..8efbbbbb25 --- /dev/null +++ b/python_doc/qsharp/qsharp.CircuitGenerationMethod.yml @@ -0,0 +1,17 @@ +### YamlMime:PythonClass +uid: qsharp.CircuitGenerationMethod +name: CircuitGenerationMethod +fullName: qsharp.CircuitGenerationMethod +module: qsharp +constructor: + syntax: CircuitGenerationMethod() +attributes: +- uid: qsharp.CircuitGenerationMethod.ClassicalEval + name: ClassicalEval + signature: ClassicalEval = CircuitGenerationMethod.ClassicalEval +- uid: qsharp.CircuitGenerationMethod.Simulate + name: Simulate + signature: Simulate = CircuitGenerationMethod.Simulate +- uid: qsharp.CircuitGenerationMethod.Static + name: Static + signature: Static = CircuitGenerationMethod.Static diff --git a/python_doc/qsharp/qsharp.DepolarizingNoise.yml b/python_doc/qsharp/qsharp.DepolarizingNoise.yml new file mode 100644 index 0000000000..aa648893ec --- /dev/null +++ b/python_doc/qsharp/qsharp.DepolarizingNoise.yml @@ -0,0 +1,23 @@ +### YamlMime:PythonClass +uid: qsharp.DepolarizingNoise +name: DepolarizingNoise +fullName: qsharp.DepolarizingNoise +module: qsharp +summary: 'The depolarizing noise to use in simulation. + + + Creates a new instance. + + + The depolarizing channel applies Pauli-X, Pauli-Y, or Pauli-Z errors each with + + probability `p / 3`.' +constructor: + syntax: 'DepolarizingNoise(p: float)' + parameters: + - name: p + description: "Total depolarizing error probability. Must satisfy `0 \u2264 p \u2264\ + \ 1`." + isRequired: true + types: + - diff --git a/python_doc/qsharp/qsharp.Pauli.yml b/python_doc/qsharp/qsharp.Pauli.yml new file mode 100644 index 0000000000..a709d13d16 --- /dev/null +++ b/python_doc/qsharp/qsharp.Pauli.yml @@ -0,0 +1,21 @@ +### YamlMime:PythonClass +uid: qsharp.Pauli +name: Pauli +fullName: qsharp.Pauli +module: qsharp +summary: A Q# Pauli operator. +constructor: + syntax: Pauli() +attributes: +- uid: qsharp.Pauli.I + name: I + signature: I = Pauli.I +- uid: qsharp.Pauli.X + name: X + signature: X = Pauli.X +- uid: qsharp.Pauli.Y + name: Y + signature: Y = Pauli.Y +- uid: qsharp.Pauli.Z + name: Z + signature: Z = Pauli.Z diff --git a/python_doc/qsharp/qsharp.PauliNoise.yml b/python_doc/qsharp/qsharp.PauliNoise.yml new file mode 100644 index 0000000000..30362a93c2 --- /dev/null +++ b/python_doc/qsharp/qsharp.PauliNoise.yml @@ -0,0 +1,29 @@ +### YamlMime:PythonClass +uid: qsharp.PauliNoise +name: PauliNoise +fullName: qsharp.PauliNoise +module: qsharp +summary: 'The Pauli noise to use in simulation represented + + as probabilities of Pauli-X, Pauli-Y, and Pauli-Z errors + + + Creates a new instance with the given error probabilities.' +constructor: + syntax: 'PauliNoise(x: float, y: float, z: float)' + parameters: + - name: x + description: Probability of a Pauli-X (bit flip) error. Must be non-negative. + isRequired: true + types: + - + - name: y + description: Probability of a Pauli-Y error. Must be non-negative. + isRequired: true + types: + - + - name: z + description: Probability of a Pauli-Z (phase flip) error. Must be non-negative. + isRequired: true + types: + - diff --git a/python_doc/qsharp/qsharp.PhaseFlipNoise.yml b/python_doc/qsharp/qsharp.PhaseFlipNoise.yml new file mode 100644 index 0000000000..800d2eaa2a --- /dev/null +++ b/python_doc/qsharp/qsharp.PhaseFlipNoise.yml @@ -0,0 +1,21 @@ +### YamlMime:PythonClass +uid: qsharp.PhaseFlipNoise +name: PhaseFlipNoise +fullName: qsharp.PhaseFlipNoise +module: qsharp +summary: 'The phase flip noise to use in simulation. + + + Creates a new instance. + + + The phase flip channel applies a Pauli-Z error with probability `p`.' +constructor: + syntax: 'PhaseFlipNoise(p: float)' + parameters: + - name: p + description: "Probability of a phase flip (Pauli-Z) error. Must satisfy `0 \u2264\ + \ p \u2264 1`." + isRequired: true + types: + - diff --git a/python_doc/qsharp/qsharp.QSharpError.yml b/python_doc/qsharp/qsharp.QSharpError.yml new file mode 100644 index 0000000000..3c3e3e3a17 --- /dev/null +++ b/python_doc/qsharp/qsharp.QSharpError.yml @@ -0,0 +1,8 @@ +### YamlMime:PythonClass +uid: qsharp.QSharpError +name: QSharpError +fullName: qsharp.QSharpError +module: qsharp +summary: An error returned from the Q# interpreter. +constructor: + syntax: QSharpError() diff --git a/python_doc/qsharp/qsharp.Result.yml b/python_doc/qsharp/qsharp.Result.yml new file mode 100644 index 0000000000..65dc89c149 --- /dev/null +++ b/python_doc/qsharp/qsharp.Result.yml @@ -0,0 +1,18 @@ +### YamlMime:PythonClass +uid: qsharp.Result +name: Result +fullName: qsharp.Result +module: qsharp +summary: A Q# measurement result. +constructor: + syntax: Result() +attributes: +- uid: qsharp.Result.Loss + name: Loss + signature: Loss = Loss +- uid: qsharp.Result.One + name: One + signature: One = One +- uid: qsharp.Result.Zero + name: Zero + signature: Zero = Zero diff --git a/python_doc/qsharp/qsharp.ShotResult.yml b/python_doc/qsharp/qsharp.ShotResult.yml new file mode 100644 index 0000000000..3371c8901f --- /dev/null +++ b/python_doc/qsharp/qsharp.ShotResult.yml @@ -0,0 +1,24 @@ +### YamlMime:PythonClass +uid: qsharp.ShotResult +name: ShotResult +fullName: qsharp.ShotResult +module: qsharp +summary: A single result of a shot. +constructor: + syntax: ShotResult() +attributes: +- uid: qsharp.ShotResult.dumps + name: dumps + signature: 'dumps: List[StateDump]' +- uid: qsharp.ShotResult.events + name: events + signature: 'events: List[Output | StateDump | str]' +- uid: qsharp.ShotResult.matrices + name: matrices + signature: 'matrices: List[Output]' +- uid: qsharp.ShotResult.messages + name: messages + signature: 'messages: List[str]' +- uid: qsharp.ShotResult.result + name: result + signature: 'result: Any' diff --git a/python_doc/qsharp/qsharp.StateDump.yml b/python_doc/qsharp/qsharp.StateDump.yml new file mode 100644 index 0000000000..c2398d3ab3 --- /dev/null +++ b/python_doc/qsharp/qsharp.StateDump.yml @@ -0,0 +1,48 @@ +### YamlMime:PythonClass +uid: qsharp.StateDump +name: StateDump +fullName: qsharp.StateDump +module: qsharp +summary: A state dump returned from the Q# interpreter. +constructor: + syntax: 'StateDump(data: StateDumpData)' + parameters: + - name: data + isRequired: true +methods: +- uid: qsharp.StateDump.as_dense_state + name: as_dense_state + summary: Returns the state dump as a dense list of complex amplitudes. This will + include zero amplitudes. + signature: as_dense_state() -> List[complex] + return: + description: A dense list of complex amplitudes, one per computational basis state. + types: + - [] +- uid: qsharp.StateDump.check_eq + name: check_eq + summary: 'Checks if the state dump is equal to the given state. This is not mathematical + equality, + + as the check ignores global phase.' + signature: 'check_eq(state: Dict[int, complex] | List[complex], tolerance: float + = 1e-10) -> bool' + parameters: + - name: state + description: 'The state to check against, provided either as a dictionary of state + indices to complex amplitudes, + + or as a list of real amplitudes.' + isRequired: true + - name: tolerance + description: The tolerance for the check. Defaults to 1e-10. + defaultValue: '1e-10' + return: + description: '`True` if the state dump is equal to the given state within the + given tolerance, ignoring global phase.' + types: + - +attributes: +- uid: qsharp.StateDump.qubit_count + name: qubit_count + signature: 'qubit_count: int' diff --git a/python_doc/qsharp/qsharp.TargetProfile.yml b/python_doc/qsharp/qsharp.TargetProfile.yml new file mode 100644 index 0000000000..0187b063ef --- /dev/null +++ b/python_doc/qsharp/qsharp.TargetProfile.yml @@ -0,0 +1,41 @@ +### YamlMime:PythonClass +uid: qsharp.TargetProfile +name: TargetProfile +fullName: qsharp.TargetProfile +module: qsharp +summary: 'A Q# target profile. + + + A target profile describes the capabilities of the hardware or simulator + + which will be used to run the Q# program.' +constructor: + syntax: TargetProfile() +methods: +- uid: qsharp.TargetProfile.from_str + name: from_str + summary: 'Creates a target profile from a string. + + :param value: The string to parse. + + :raises ValueError: If the string does not match any target profile.' + signature: from_str() + parameters: + - name: key + isRequired: true +attributes: +- uid: qsharp.TargetProfile.Adaptive_RI + name: Adaptive_RI + signature: Adaptive_RI = TargetProfile.Adaptive_RI +- uid: qsharp.TargetProfile.Adaptive_RIF + name: Adaptive_RIF + signature: Adaptive_RIF = TargetProfile.Adaptive_RIF +- uid: qsharp.TargetProfile.Adaptive_RIFLA + name: Adaptive_RIFLA + signature: Adaptive_RIFLA = TargetProfile.Adaptive_RIFLA +- uid: qsharp.TargetProfile.Base + name: Base + signature: Base = TargetProfile.Base +- uid: qsharp.TargetProfile.Unrestricted + name: Unrestricted + signature: Unrestricted = TargetProfile.Unrestricted diff --git a/python_doc/qsharp/qsharp.code.yml b/python_doc/qsharp/qsharp.code.yml new file mode 100644 index 0000000000..bc6ccedfa4 --- /dev/null +++ b/python_doc/qsharp/qsharp.code.yml @@ -0,0 +1,6 @@ +### YamlMime:PythonPackage +uid: qsharp.code +name: code +fullName: qsharp.code +summary: Code module that receives any user-defined Q# callables as Python functions. +type: import diff --git a/python_doc/qsharp/qsharp.estimator.DistillationUnitSpecification.yml b/python_doc/qsharp/qsharp.estimator.DistillationUnitSpecification.yml new file mode 100644 index 0000000000..4ac08e7de4 --- /dev/null +++ b/python_doc/qsharp/qsharp.estimator.DistillationUnitSpecification.yml @@ -0,0 +1,92 @@ +### YamlMime:PythonClass +uid: qsharp.estimator.DistillationUnitSpecification +name: DistillationUnitSpecification +fullName: qsharp.estimator.DistillationUnitSpecification +module: qsharp.estimator +summary: 'Specification for a magic-state distillation unit. + + + Either select a built-in unit by setting `name`, or define a custom unit + + by providing `num_input_ts`, `num_output_ts`, `failure_probability_formula`, + + `output_error_rate_formula`, and optionally physical and logical qubit + + specifications.' +constructor: + syntax: 'DistillationUnitSpecification(name: str | None = None, display_name: str + | None = None, num_input_ts: int | None = None, num_output_ts: int | None = None, + failure_probability_formula: str | None = None, output_error_rate_formula: str + | None = None, physical_qubit_specification: ProtocolSpecificDistillationUnitSpecification + | None = None, logical_qubit_specification: ProtocolSpecificDistillationUnitSpecification + | None = None, logical_qubit_specification_first_round_override: ProtocolSpecificDistillationUnitSpecification + | None = None)' + parameters: + - name: name + defaultValue: None + - name: display_name + defaultValue: None + - name: num_input_ts + defaultValue: None + - name: num_output_ts + defaultValue: None + - name: failure_probability_formula + defaultValue: None + - name: output_error_rate_formula + defaultValue: None + - name: physical_qubit_specification + defaultValue: None + - name: logical_qubit_specification + defaultValue: None + - name: logical_qubit_specification_first_round_override + defaultValue: None +methods: +- uid: qsharp.estimator.DistillationUnitSpecification.as_dict + name: as_dict + signature: as_dict(validate=True) -> Dict[str, Any] + parameters: + - name: validate + defaultValue: 'True' +- uid: qsharp.estimator.DistillationUnitSpecification.has_custom_specification + name: has_custom_specification + signature: has_custom_specification() +- uid: qsharp.estimator.DistillationUnitSpecification.has_predefined_name + name: has_predefined_name + signature: has_predefined_name() +- uid: qsharp.estimator.DistillationUnitSpecification.post_validation + name: post_validation + signature: post_validation(result) + parameters: + - name: result + isRequired: true +attributes: +- uid: qsharp.estimator.DistillationUnitSpecification.display_name + name: display_name + signature: 'display_name: str | None = None' +- uid: qsharp.estimator.DistillationUnitSpecification.failure_probability_formula + name: failure_probability_formula + signature: 'failure_probability_formula: str | None = None' +- uid: qsharp.estimator.DistillationUnitSpecification.logical_qubit_specification + name: logical_qubit_specification + signature: 'logical_qubit_specification: ProtocolSpecificDistillationUnitSpecification + | None = None' +- uid: qsharp.estimator.DistillationUnitSpecification.logical_qubit_specification_first_round_override + name: logical_qubit_specification_first_round_override + signature: 'logical_qubit_specification_first_round_override: ProtocolSpecificDistillationUnitSpecification + | None = None' +- uid: qsharp.estimator.DistillationUnitSpecification.name + name: name + signature: 'name: str | None = None' +- uid: qsharp.estimator.DistillationUnitSpecification.num_input_ts + name: num_input_ts + signature: 'num_input_ts: int | None = None' +- uid: qsharp.estimator.DistillationUnitSpecification.num_output_ts + name: num_output_ts + signature: 'num_output_ts: int | None = None' +- uid: qsharp.estimator.DistillationUnitSpecification.output_error_rate_formula + name: output_error_rate_formula + signature: 'output_error_rate_formula: str | None = None' +- uid: qsharp.estimator.DistillationUnitSpecification.physical_qubit_specification + name: physical_qubit_specification + signature: 'physical_qubit_specification: ProtocolSpecificDistillationUnitSpecification + | None = None' diff --git a/python_doc/qsharp/qsharp.estimator.ErrorBudgetPartition.yml b/python_doc/qsharp/qsharp.estimator.ErrorBudgetPartition.yml new file mode 100644 index 0000000000..6537f76a55 --- /dev/null +++ b/python_doc/qsharp/qsharp.estimator.ErrorBudgetPartition.yml @@ -0,0 +1,34 @@ +### YamlMime:PythonClass +uid: qsharp.estimator.ErrorBudgetPartition +name: ErrorBudgetPartition +fullName: qsharp.estimator.ErrorBudgetPartition +module: qsharp.estimator +summary: 'Partition of the total error budget across algorithm components. + + + The three fields must sum to the overall error budget. Defaults to equal + + thirds of `0.001` (i.e. each component gets `~3.33e-4`).' +constructor: + syntax: 'ErrorBudgetPartition(logical: float = 0.0003333333333333333, t_states: + float = 0.0003333333333333333, rotations: float = 0.0003333333333333333)' + parameters: + - name: logical + description: Budget allocated to logical errors in the algorithm. + defaultValue: '0.0003333333333333333' + - name: t_states + description: Budget allocated to T-state distillation errors. + defaultValue: '0.0003333333333333333' + - name: rotations + description: Budget allocated to rotation synthesis errors. + defaultValue: '0.0003333333333333333' +attributes: +- uid: qsharp.estimator.ErrorBudgetPartition.logical + name: logical + signature: 'logical: float = 0.0003333333333333333' +- uid: qsharp.estimator.ErrorBudgetPartition.rotations + name: rotations + signature: 'rotations: float = 0.0003333333333333333' +- uid: qsharp.estimator.ErrorBudgetPartition.t_states + name: t_states + signature: 't_states: float = 0.0003333333333333333' diff --git a/python_doc/qsharp/qsharp.estimator.EstimatorConstraints.yml b/python_doc/qsharp/qsharp.estimator.EstimatorConstraints.yml new file mode 100644 index 0000000000..e335cb4dd6 --- /dev/null +++ b/python_doc/qsharp/qsharp.estimator.EstimatorConstraints.yml @@ -0,0 +1,52 @@ +### YamlMime:PythonClass +uid: qsharp.estimator.EstimatorConstraints +name: EstimatorConstraints +fullName: qsharp.estimator.EstimatorConstraints +module: qsharp.estimator +summary: 'Optional runtime and resource constraints for resource estimation. + + + At most one of `max_duration` or `max_physical_qubits` may be set + + simultaneously.' +constructor: + syntax: 'EstimatorConstraints(logical_depth_factor: float | None = None, max_t_factories: + int | None = None, max_duration: int | None = None, max_physical_qubits: int | + None = None)' + parameters: + - name: logical_depth_factor + defaultValue: None + - name: max_t_factories + defaultValue: None + - name: max_duration + defaultValue: None + - name: max_physical_qubits + defaultValue: None +methods: +- uid: qsharp.estimator.EstimatorConstraints.at_least_one + name: at_least_one + signature: static at_least_one(name, value) + parameters: + - name: name + isRequired: true + - name: value + isRequired: true +- uid: qsharp.estimator.EstimatorConstraints.post_validation + name: post_validation + signature: post_validation(result) + parameters: + - name: result + isRequired: true +attributes: +- uid: qsharp.estimator.EstimatorConstraints.logical_depth_factor + name: logical_depth_factor + signature: 'logical_depth_factor: float | None = None' +- uid: qsharp.estimator.EstimatorConstraints.max_duration + name: max_duration + signature: 'max_duration: int | None = None' +- uid: qsharp.estimator.EstimatorConstraints.max_physical_qubits + name: max_physical_qubits + signature: 'max_physical_qubits: int | None = None' +- uid: qsharp.estimator.EstimatorConstraints.max_t_factories + name: max_t_factories + signature: 'max_t_factories: int | None = None' diff --git a/python_doc/qsharp/qsharp.estimator.EstimatorError.yml b/python_doc/qsharp/qsharp.estimator.EstimatorError.yml new file mode 100644 index 0000000000..7421602bbb --- /dev/null +++ b/python_doc/qsharp/qsharp.estimator.EstimatorError.yml @@ -0,0 +1,13 @@ +### YamlMime:PythonClass +uid: qsharp.estimator.EstimatorError +name: EstimatorError +fullName: qsharp.estimator.EstimatorError +module: qsharp.estimator +summary: An error returned from the resource estimation. +constructor: + syntax: 'EstimatorError(code: str, message: str)' + parameters: + - name: code + isRequired: true + - name: message + isRequired: true diff --git a/python_doc/qsharp/qsharp.estimator.EstimatorInputParamsItem.yml b/python_doc/qsharp/qsharp.estimator.EstimatorInputParamsItem.yml new file mode 100644 index 0000000000..a587086496 --- /dev/null +++ b/python_doc/qsharp/qsharp.estimator.EstimatorInputParamsItem.yml @@ -0,0 +1,24 @@ +### YamlMime:PythonClass +uid: qsharp.estimator.EstimatorInputParamsItem +name: EstimatorInputParamsItem +fullName: qsharp.estimator.EstimatorInputParamsItem +module: qsharp.estimator +summary: 'Input parameters for a single resource estimation job. + + + Contains qubit model, QEC scheme, distillation unit specifications, constraints, + + and error budget settings. Used directly for single-point estimation or as a + + base class for batching via .' +constructor: + syntax: EstimatorInputParamsItem() +methods: +- uid: qsharp.estimator.EstimatorInputParamsItem.as_dict + name: as_dict + signature: as_dict(validate=True, additional_params=None) -> Dict[str, Any] + parameters: + - name: validate + defaultValue: 'True' + - name: additional_params + defaultValue: None diff --git a/python_doc/qsharp/qsharp.estimator.EstimatorParams.yml b/python_doc/qsharp/qsharp.estimator.EstimatorParams.yml new file mode 100644 index 0000000000..b4d147928b --- /dev/null +++ b/python_doc/qsharp/qsharp.estimator.EstimatorParams.yml @@ -0,0 +1,43 @@ +### YamlMime:PythonClass +uid: qsharp.estimator.EstimatorParams +name: EstimatorParams +fullName: qsharp.estimator.EstimatorParams +module: qsharp.estimator +summary: 'Top-level input parameters for the Microsoft Resource Estimator. + + + Extends with support for batching: + pass + + `num_items` to create a batching job where each item can override the + + top-level parameters.' +constructor: + syntax: 'EstimatorParams(num_items: int | None = None)' + parameters: + - name: num_items + description: 'Number of batching items. If `None`, creates a + + single-point estimation job.' + defaultValue: None + types: + - , +methods: +- uid: qsharp.estimator.EstimatorParams.as_dict + name: as_dict + summary: 'Constructs a dictionary from the input params. + + + For batching jobs, top-level entries are merged into item entries. + + Item entries have priority in case they are specified.' + signature: as_dict(validate=True) -> Dict[str, Any] + parameters: + - name: validate + defaultValue: 'True' +attributes: +- uid: qsharp.estimator.EstimatorParams.items + name: items +- uid: qsharp.estimator.EstimatorParams.MAX_NUM_ITEMS + name: MAX_NUM_ITEMS + signature: 'MAX_NUM_ITEMS: int = 1000' diff --git a/python_doc/qsharp/qsharp.estimator.EstimatorQecScheme.yml b/python_doc/qsharp/qsharp.estimator.EstimatorQecScheme.yml new file mode 100644 index 0000000000..4b5f85267e --- /dev/null +++ b/python_doc/qsharp/qsharp.estimator.EstimatorQecScheme.yml @@ -0,0 +1,55 @@ +### YamlMime:PythonClass +uid: qsharp.estimator.EstimatorQecScheme +name: EstimatorQecScheme +fullName: qsharp.estimator.EstimatorQecScheme +module: qsharp.estimator +summary: 'Quantum error correction scheme parameters for resource estimation. + + + Specify a built-in scheme by setting `name` to one of the + + constants, or define a custom scheme by setting + + the threshold and code-distance parameters directly.' +constructor: + syntax: 'EstimatorQecScheme(name: str | None = None, error_correction_threshold: + float | None = None, crossing_prefactor: float | None = None, distance_coefficient_power: + int | None = None, logical_cycle_time: str | None = None, physical_qubits_per_logical_qubit: + str | None = None, max_code_distance: int | None = None)' + parameters: + - name: name + defaultValue: None + - name: error_correction_threshold + defaultValue: None + - name: crossing_prefactor + defaultValue: None + - name: distance_coefficient_power + defaultValue: None + - name: logical_cycle_time + defaultValue: None + - name: physical_qubits_per_logical_qubit + defaultValue: None + - name: max_code_distance + defaultValue: None +attributes: +- uid: qsharp.estimator.EstimatorQecScheme.crossing_prefactor + name: crossing_prefactor + signature: 'crossing_prefactor: float | None = None' +- uid: qsharp.estimator.EstimatorQecScheme.distance_coefficient_power + name: distance_coefficient_power + signature: 'distance_coefficient_power: int | None = None' +- uid: qsharp.estimator.EstimatorQecScheme.error_correction_threshold + name: error_correction_threshold + signature: 'error_correction_threshold: float | None = None' +- uid: qsharp.estimator.EstimatorQecScheme.logical_cycle_time + name: logical_cycle_time + signature: 'logical_cycle_time: str | None = None' +- uid: qsharp.estimator.EstimatorQecScheme.max_code_distance + name: max_code_distance + signature: 'max_code_distance: int | None = None' +- uid: qsharp.estimator.EstimatorQecScheme.name + name: name + signature: 'name: str | None = None' +- uid: qsharp.estimator.EstimatorQecScheme.physical_qubits_per_logical_qubit + name: physical_qubits_per_logical_qubit + signature: 'physical_qubits_per_logical_qubit: str | None = None' diff --git a/python_doc/qsharp/qsharp.estimator.EstimatorQubitParams.yml b/python_doc/qsharp/qsharp.estimator.EstimatorQubitParams.yml new file mode 100644 index 0000000000..4726739e3e --- /dev/null +++ b/python_doc/qsharp/qsharp.estimator.EstimatorQubitParams.yml @@ -0,0 +1,113 @@ +### YamlMime:PythonClass +uid: qsharp.estimator.EstimatorQubitParams +name: EstimatorQubitParams +fullName: qsharp.estimator.EstimatorQubitParams +module: qsharp.estimator +summary: 'Physical qubit parameters for resource estimation. + + + Specify a built-in qubit model by setting `name` to one of the + + constants, or fully define a custom model by + setting + + `instruction_set` and all relevant timing and error-rate fields.' +constructor: + syntax: 'EstimatorQubitParams(name: str | None = None, instruction_set: str | None + = None, one_qubit_measurement_time: str | None = None, two_qubit_joint_measurement_time: + str | None = None, one_qubit_gate_time: str | None = None, two_qubit_gate_time: + str | None = None, t_gate_time: str | None = None, one_qubit_measurement_error_rate: + None | float | MeasurementErrorRate = None, two_qubit_joint_measurement_error_rate: + None | float | MeasurementErrorRate = None, one_qubit_gate_error_rate: float | + None = None, two_qubit_gate_error_rate: float | None = None, t_gate_error_rate: + float | None = None, idle_error_rate: float | None = None)' + parameters: + - name: name + defaultValue: None + - name: instruction_set + defaultValue: None + - name: one_qubit_measurement_time + defaultValue: None + - name: two_qubit_joint_measurement_time + defaultValue: None + - name: one_qubit_gate_time + defaultValue: None + - name: two_qubit_gate_time + defaultValue: None + - name: t_gate_time + defaultValue: None + - name: one_qubit_measurement_error_rate + defaultValue: None + - name: two_qubit_joint_measurement_error_rate + defaultValue: None + - name: one_qubit_gate_error_rate + defaultValue: None + - name: two_qubit_gate_error_rate + defaultValue: None + - name: t_gate_error_rate + defaultValue: None + - name: idle_error_rate + defaultValue: None +methods: +- uid: qsharp.estimator.EstimatorQubitParams.as_dict + name: as_dict + signature: as_dict(validate=True) -> Dict[str, Any] + parameters: + - name: validate + defaultValue: 'True' +- uid: qsharp.estimator.EstimatorQubitParams.check_instruction_set + name: check_instruction_set + signature: static check_instruction_set(name, value) + parameters: + - name: name + isRequired: true + - name: value + isRequired: true +- uid: qsharp.estimator.EstimatorQubitParams.post_validation + name: post_validation + signature: post_validation(result) + parameters: + - name: result + isRequired: true +attributes: +- uid: qsharp.estimator.EstimatorQubitParams.idle_error_rate + name: idle_error_rate + signature: 'idle_error_rate: float | None = None' +- uid: qsharp.estimator.EstimatorQubitParams.instruction_set + name: instruction_set + signature: 'instruction_set: str | None = None' +- uid: qsharp.estimator.EstimatorQubitParams.name + name: name + signature: 'name: str | None = None' +- uid: qsharp.estimator.EstimatorQubitParams.one_qubit_gate_error_rate + name: one_qubit_gate_error_rate + signature: 'one_qubit_gate_error_rate: float | None = None' +- uid: qsharp.estimator.EstimatorQubitParams.one_qubit_gate_time + name: one_qubit_gate_time + signature: 'one_qubit_gate_time: str | None = None' +- uid: qsharp.estimator.EstimatorQubitParams.one_qubit_measurement_error_rate + name: one_qubit_measurement_error_rate + signature: 'one_qubit_measurement_error_rate: None | float | MeasurementErrorRate + = None' +- uid: qsharp.estimator.EstimatorQubitParams.one_qubit_measurement_time + name: one_qubit_measurement_time + signature: 'one_qubit_measurement_time: str | None = None' +- uid: qsharp.estimator.EstimatorQubitParams.t_gate_error_rate + name: t_gate_error_rate + signature: 't_gate_error_rate: float | None = None' +- uid: qsharp.estimator.EstimatorQubitParams.t_gate_time + name: t_gate_time + signature: 't_gate_time: str | None = None' +- uid: qsharp.estimator.EstimatorQubitParams.two_qubit_gate_error_rate + name: two_qubit_gate_error_rate + signature: 'two_qubit_gate_error_rate: float | None = None' +- uid: qsharp.estimator.EstimatorQubitParams.two_qubit_gate_time + name: two_qubit_gate_time + signature: 'two_qubit_gate_time: str | None = None' +- uid: qsharp.estimator.EstimatorQubitParams.two_qubit_joint_measurement_error_rate + name: two_qubit_joint_measurement_error_rate + signature: 'two_qubit_joint_measurement_error_rate: None | float | MeasurementErrorRate + = None' +- uid: qsharp.estimator.EstimatorQubitParams.two_qubit_joint_measurement_time + name: two_qubit_joint_measurement_time + signature: 'two_qubit_joint_measurement_time: str | None = None' diff --git a/python_doc/qsharp/qsharp.estimator.EstimatorResult.yml b/python_doc/qsharp/qsharp.estimator.EstimatorResult.yml new file mode 100644 index 0000000000..8431af3345 --- /dev/null +++ b/python_doc/qsharp/qsharp.estimator.EstimatorResult.yml @@ -0,0 +1,44 @@ +### YamlMime:PythonClass +uid: qsharp.estimator.EstimatorResult +name: EstimatorResult +fullName: qsharp.estimator.EstimatorResult +module: qsharp.estimator +summary: 'Microsoft Resource Estimator result. + + + The class represents simple resource estimation results as well as batching + + resource estimation results. The latter can be indexed by an integer index to + + access an individual result from the batching result.' +constructor: + syntax: 'EstimatorResult(data: Dict | List)' + parameters: + - name: data + isRequired: true +methods: +- uid: qsharp.estimator.EstimatorResult.data + name: data + summary: 'Returns raw data of the result object. + + + In case of a batching job, you can pass an index to access a specific + + item.' + signature: 'data(idx: int | None = None) -> Any' + parameters: + - name: idx + defaultValue: None +attributes: +- uid: qsharp.estimator.EstimatorResult.error + name: error + summary: Returns the error object if the result is an error. +- uid: qsharp.estimator.EstimatorResult.json + name: json + summary: Returns a JSON representation of the resource estimation result data. +- uid: qsharp.estimator.EstimatorResult.logical_counts + name: logical_counts + summary: Returns the logical counts of the result. +- uid: qsharp.estimator.EstimatorResult.MAX_DEFAULT_ITEMS_IN_TABLE + name: MAX_DEFAULT_ITEMS_IN_TABLE + signature: MAX_DEFAULT_ITEMS_IN_TABLE = 5 diff --git a/python_doc/qsharp/qsharp.estimator.LogicalCounts.yml b/python_doc/qsharp/qsharp.estimator.LogicalCounts.yml new file mode 100644 index 0000000000..3e9d5c186c --- /dev/null +++ b/python_doc/qsharp/qsharp.estimator.LogicalCounts.yml @@ -0,0 +1,36 @@ +### YamlMime:PythonClass +uid: qsharp.estimator.LogicalCounts +name: LogicalCounts +fullName: qsharp.estimator.LogicalCounts +module: qsharp.estimator +summary: 'Microsoft Resource Estimator Logical Counts. + + + The class represents logical counts that can be used as input to physical estimation + of resources + + in the Microsoft Resource Estimator.' +constructor: + syntax: 'LogicalCounts(data: Dict)' + parameters: + - name: data + isRequired: true +methods: +- uid: qsharp.estimator.LogicalCounts.estimate + name: estimate + summary: 'Estimates resources for the current logical counts, using the + + Parallel Synthesis Sequential Pauli Computation (PSSPC) layout method.' + signature: 'estimate(params: dict | List | EstimatorParams = None) -> EstimatorResult' + parameters: + - name: params + description: The parameters to configure physical estimation. + defaultValue: None + return: + description: The estimated resources. + types: + - +attributes: +- uid: qsharp.estimator.LogicalCounts.json + name: json + summary: Returns a JSON representation of the logical counts. diff --git a/python_doc/qsharp/qsharp.estimator.MeasurementErrorRate.yml b/python_doc/qsharp/qsharp.estimator.MeasurementErrorRate.yml new file mode 100644 index 0000000000..0ff25baf56 --- /dev/null +++ b/python_doc/qsharp/qsharp.estimator.MeasurementErrorRate.yml @@ -0,0 +1,29 @@ +### YamlMime:PythonClass +uid: qsharp.estimator.MeasurementErrorRate +name: MeasurementErrorRate +fullName: qsharp.estimator.MeasurementErrorRate +module: qsharp.estimator +summary: 'Measurement error rate specified separately for process and readout errors. + + + Used as the value of `one_qubit_measurement_error_rate` or + + `two_qubit_joint_measurement_error_rate` in + + when process and readout error rates differ.' +constructor: + syntax: 'MeasurementErrorRate(process: float, readout: float)' + parameters: + - name: process + description: Error rate during the measurement process. Must be in `(0, 1)`. + isRequired: true + - name: readout + description: Error rate during readout. Must be in `(0, 1)`. + isRequired: true +attributes: +- uid: qsharp.estimator.MeasurementErrorRate.process + name: process + signature: 'process: float' +- uid: qsharp.estimator.MeasurementErrorRate.readout + name: readout + signature: 'readout: float' diff --git a/python_doc/qsharp/qsharp.estimator.ProtocolSpecificDistillationUnitSpecification.yml b/python_doc/qsharp/qsharp.estimator.ProtocolSpecificDistillationUnitSpecification.yml new file mode 100644 index 0000000000..8f7462b961 --- /dev/null +++ b/python_doc/qsharp/qsharp.estimator.ProtocolSpecificDistillationUnitSpecification.yml @@ -0,0 +1,33 @@ +### YamlMime:PythonClass +uid: qsharp.estimator.ProtocolSpecificDistillationUnitSpecification +name: ProtocolSpecificDistillationUnitSpecification +fullName: qsharp.estimator.ProtocolSpecificDistillationUnitSpecification +module: qsharp.estimator +summary: 'Protocol-specific specification for a magic-state distillation unit. + + + Defines the number of physical qubits and the duration (in logical cycle + + time units) for one round of distillation under a specific QEC code.' +constructor: + syntax: 'ProtocolSpecificDistillationUnitSpecification(num_unit_qubits: int | None + = None, duration_in_qubit_cycle_time: int | None = None)' + parameters: + - name: num_unit_qubits + defaultValue: None + - name: duration_in_qubit_cycle_time + defaultValue: None +methods: +- uid: qsharp.estimator.ProtocolSpecificDistillationUnitSpecification.post_validation + name: post_validation + signature: post_validation(result) + parameters: + - name: result + isRequired: true +attributes: +- uid: qsharp.estimator.ProtocolSpecificDistillationUnitSpecification.duration_in_qubit_cycle_time + name: duration_in_qubit_cycle_time + signature: 'duration_in_qubit_cycle_time: int | None = None' +- uid: qsharp.estimator.ProtocolSpecificDistillationUnitSpecification.num_unit_qubits + name: num_unit_qubits + signature: 'num_unit_qubits: int | None = None' diff --git a/python_doc/qsharp/qsharp.estimator.QECScheme.yml b/python_doc/qsharp/qsharp.estimator.QECScheme.yml new file mode 100644 index 0000000000..d7e21f1fb2 --- /dev/null +++ b/python_doc/qsharp/qsharp.estimator.QECScheme.yml @@ -0,0 +1,22 @@ +### YamlMime:PythonClass +uid: qsharp.estimator.QECScheme +name: QECScheme +fullName: qsharp.estimator.QECScheme +module: qsharp.estimator +summary: 'Predefined quantum error correction scheme name constants for use with + + . + + + Pass one of these string constants as the `name` field to select a + + built-in QEC scheme for resource estimation.' +constructor: + syntax: QECScheme() +attributes: +- uid: qsharp.estimator.QECScheme.FLOQUET_CODE + name: FLOQUET_CODE + signature: FLOQUET_CODE = 'floquet_code' +- uid: qsharp.estimator.QECScheme.SURFACE_CODE + name: SURFACE_CODE + signature: SURFACE_CODE = 'surface_code' diff --git a/python_doc/qsharp/qsharp.estimator.QubitParams.yml b/python_doc/qsharp/qsharp.estimator.QubitParams.yml new file mode 100644 index 0000000000..57e3769c50 --- /dev/null +++ b/python_doc/qsharp/qsharp.estimator.QubitParams.yml @@ -0,0 +1,32 @@ +### YamlMime:PythonClass +uid: qsharp.estimator.QubitParams +name: QubitParams +fullName: qsharp.estimator.QubitParams +module: qsharp.estimator +summary: 'Predefined qubit model name constants for use with . + + + Pass one of these string constants as the `name` field to select a built-in + + qubit model for resource estimation.' +constructor: + syntax: QubitParams() +attributes: +- uid: qsharp.estimator.QubitParams.GATE_NS_E3 + name: GATE_NS_E3 + signature: GATE_NS_E3 = 'qubit_gate_ns_e3' +- uid: qsharp.estimator.QubitParams.GATE_NS_E4 + name: GATE_NS_E4 + signature: GATE_NS_E4 = 'qubit_gate_ns_e4' +- uid: qsharp.estimator.QubitParams.GATE_US_E3 + name: GATE_US_E3 + signature: GATE_US_E3 = 'qubit_gate_us_e3' +- uid: qsharp.estimator.QubitParams.GATE_US_E4 + name: GATE_US_E4 + signature: GATE_US_E4 = 'qubit_gate_us_e4' +- uid: qsharp.estimator.QubitParams.MAJ_NS_E4 + name: MAJ_NS_E4 + signature: MAJ_NS_E4 = 'qubit_maj_ns_e4' +- uid: qsharp.estimator.QubitParams.MAJ_NS_E6 + name: MAJ_NS_E6 + signature: MAJ_NS_E6 = 'qubit_maj_ns_e6' diff --git a/python_doc/qsharp/qsharp.estimator.yml b/python_doc/qsharp/qsharp.estimator.yml new file mode 100644 index 0000000000..b98ebc5f96 --- /dev/null +++ b/python_doc/qsharp/qsharp.estimator.yml @@ -0,0 +1,20 @@ +### YamlMime:PythonPackage +uid: qsharp.estimator +name: estimator +fullName: qsharp.estimator +type: import +classes: +- qsharp.estimator.DistillationUnitSpecification +- qsharp.estimator.ErrorBudgetPartition +- qsharp.estimator.EstimatorConstraints +- qsharp.estimator.EstimatorError +- qsharp.estimator.EstimatorInputParamsItem +- qsharp.estimator.EstimatorParams +- qsharp.estimator.EstimatorQecScheme +- qsharp.estimator.EstimatorQubitParams +- qsharp.estimator.EstimatorResult +- qsharp.estimator.LogicalCounts +- qsharp.estimator.MeasurementErrorRate +- qsharp.estimator.ProtocolSpecificDistillationUnitSpecification +- qsharp.estimator.QECScheme +- qsharp.estimator.QubitParams diff --git a/python_doc/qsharp/qsharp.interop.cirq.NeutralAtomCirqResult.yml b/python_doc/qsharp/qsharp.interop.cirq.NeutralAtomCirqResult.yml new file mode 100644 index 0000000000..2074b58484 --- /dev/null +++ b/python_doc/qsharp/qsharp.interop.cirq.NeutralAtomCirqResult.yml @@ -0,0 +1,64 @@ +### YamlMime:PythonClass +uid: qsharp.interop.cirq.NeutralAtomCirqResult +name: NeutralAtomCirqResult +fullName: qsharp.interop.cirq.NeutralAtomCirqResult +module: qsharp.interop.cirq +summary: 'A `cirq.ResultDict` that also carries raw (loss-inclusive) shot data. + + + The inherited `measurements` field contains only *accepted* shots - those + + where every measured qubit returned a clean `{0, 1}` outcome. Shots in + + which one or more qubits were lost during the simulation are excluded from + + `measurements` but are preserved in `raw_shots`. + + + The `raw_shots` attribute holds the full list of simulation results, one + + entry per shot, in the native simulator output format (tuple, list, or + + scalar). This includes shots that contain qubit-loss markers. + + + Use to retrieve + the full per-shot data (including + + loss markers) in the same `{key: 2D-array (shots x bits)}` format as + + `measurements`, but with Unicode string dtype so that non-binary markers + + are preserved.' +constructor: + syntax: 'NeutralAtomCirqResult(*, params: ParamResolver, measurements: Dict[str, + ndarray], raw_shots: List[Any], measurement_dict: Dict[str, Sequence[int]])' + keywordOnlyParameters: + - name: params + isRequired: true + - name: measurements + isRequired: true + - name: raw_shots + isRequired: true + - name: measurement_dict + isRequired: true +methods: +- uid: qsharp.interop.cirq.NeutralAtomCirqResult.raw_measurements + name: raw_measurements + summary: 'Return unfiltered per-shot measurement symbols including loss markers. + + + The structure mirrors `measurements`: `{key: 2D array (shots x bits)}`, + + but the array dtype is `" Dict[str, Any] +attributes: +- uid: qsharp.interop.cirq.NeutralAtomCirqResult.raw_shots + name: raw_shots diff --git a/python_doc/qsharp/qsharp.interop.cirq.NeutralAtomSampler.yml b/python_doc/qsharp/qsharp.interop.cirq.NeutralAtomSampler.yml new file mode 100644 index 0000000000..25f4f39d50 --- /dev/null +++ b/python_doc/qsharp/qsharp.interop.cirq.NeutralAtomSampler.yml @@ -0,0 +1,115 @@ +### YamlMime:PythonClass +uid: qsharp.interop.cirq.NeutralAtomSampler +name: NeutralAtomSampler +fullName: qsharp.interop.cirq.NeutralAtomSampler +module: qsharp.interop.cirq +summary: "A `cirq.Sampler` that runs Cirq circuits on the local NeutralAtomDevice\ + \ simulator.\n\nThis sampler integrates with the standard Cirq sampler protocol,\ + \ so it can\nbe used anywhere a `cirq.Sampler` is expected.\n\nPipeline for each\ + \ `run()` call:\n\n1. `cirq.Circuit.to_qasm(version=\"3.0\")` \u2192 OpenQASM 3.0\ + \ \n\n2. OpenQASM 3.0 \u2192 QIR (base profile, via the Q# compiler) \n\n3. QIR\ + \ \u2192 `NeutralAtomDevice.simulate()` (decompose, schedule, simulate) \n\n4. Raw\ + \ shots \u2192 \n\nExample:\n\n\ + \n\n````default\n\n import cirq\n from qsharp.interop.cirq\ + \ import NeutralAtomSampler\n from qsharp._simulation import NoiseConfig\n\n \ + \ q0, q1 = cirq.LineQubit.range(2)\n circuit = cirq.Circuit([\n cirq.H(q0),\n\ + \ cirq.CNOT(q0, q1),\n cirq.measure(q0, q1, key=\"m\"),\n ])\n\n \ + \ # Noiseless simulation\n sampler = NeutralAtomSampler(seed=42)\n result =\ + \ sampler.run(circuit, repetitions=1000)\n print(result.histogram(key=\"m\"))\n\ + \n # Noisy simulation \u2014 1% loss on Rz (native gate)\n noise = NoiseConfig()\n\ + \ noise.rz.loss = 0.01\n sampler = NeutralAtomSampler(noise=noise, seed=42)\n\ + \ result = sampler.run(circuit, repetitions=1000)\n print(f\"Accepted: {len(result.measurements['m'])}\ + \ / {len(result.raw_shots)}\")\n ````" +constructor: + syntax: 'NeutralAtomSampler(*, noise: ''NoiseConfig'' | None = None, simulator_type: + str | None = None, seed: int | None = None, device: ''NeutralAtomDevice'' | None + = None)' + parameters: + - name: noise + description: "Optional describing\nper-gate\ + \ noise. The device decomposes gates to the native set\n`{Rz, SX, CZ, MResetZ}`;\ + \ configure noise on those native gates.\nFor example, a Cirq `X` gate arriving\ + \ via QASM 2.0 is decomposed\nto `SX\xB7SX`, so `noise.sx` is the relevant field.\ + \ Defaults to\n`None` (noiseless)." + isRequired: true + - name: simulator_type + description: "Force a particular simulator backend.\n`\"clifford\"` \u2014 Clifford-only,\ + \ fast. Requires a Clifford circuit.\n`\"cpu\"` \u2014 Full state-vector on\ + \ CPU.\n`\"gpu\"` \u2014 Full state-vector on GPU.\n`None` (default) \u2014\ + \ GPU if available, CPU otherwise." + isRequired: true + - name: seed + description: Optional integer seed for reproducibility. Defaults to `None`. + isRequired: true + - name: device + description: 'An existing + + instance to reuse across calls. A default-configured device is + + created lazily on the first call when not provided.' + isRequired: true + keywordOnlyParameters: + - name: noise + defaultValue: None + - name: simulator_type + defaultValue: None + - name: seed + defaultValue: None + - name: device + defaultValue: None +methods: +- uid: qsharp.interop.cirq.NeutralAtomSampler.run_sweep + name: run_sweep + summary: Run the circuit for each parameter resolver in the sweep. + signature: 'run_sweep(program: AbstractCircuit, params: ParamResolver | Mapping[str + | Expr, complex | number | Expr] | None | Sweep | _Sweepable, repetitions: int + = 1) -> List[NeutralAtomCirqResult]' + parameters: + - name: program + description: The Cirq circuit to simulate. + isRequired: true + types: + - + - name: params + description: 'A defining the parameter resolvers + + to sweep over. Each resolver produces one result.' + isRequired: true + types: + - + - name: repetitions + description: Number of shots per parameter resolver. + defaultValue: '1' + types: + - + return: + description: A list of objects, + one per resolver. + types: + - [] +- uid: qsharp.interop.cirq.NeutralAtomSampler.run_sweep_async + name: run_sweep_async + summary: 'Asynchronously samples from the given Circuit. + + + By default, this method invokes *run_sweep* synchronously and simply + + exposes its result is an awaitable. Child classes that are capable of + + true asynchronous sampling should override it to use other strategies.' + signature: 'run_sweep_async(program: cirq.AbstractCircuit, params: cirq.Sweepable, + repetitions: int = 1) -> Sequence[cirq.Result]' + parameters: + - name: program + description: The circuit to sample from. + isRequired: true + - name: params + description: Parameters to run with the program. + isRequired: true + - name: repetitions + description: The number of times to sample. + defaultValue: '1' + return: + description: Result list for this run; one for each possible parameter resolver. diff --git a/python_doc/qsharp/qsharp.interop.cirq.yml b/python_doc/qsharp/qsharp.interop.cirq.yml new file mode 100644 index 0000000000..e670224945 --- /dev/null +++ b/python_doc/qsharp/qsharp.interop.cirq.yml @@ -0,0 +1,16 @@ +### YamlMime:PythonPackage +uid: qsharp.interop.cirq +name: cirq +fullName: qsharp.interop.cirq +summary: "Cirq interoperability for the Q# ecosystem.\n\n\nThis module provides a\ + \ \u2014 a standard\n``cirq.Sampler`` that runs Cirq circuits\ + \ on the local NeutralAtomDevice\nsimulator.\n\n\nUsage::\n\n\n import cirq\n\ + \ from qsharp.interop.cirq import NeutralAtomSampler\n\n\n q0, q1 = cirq.LineQubit.range(2)\n\ + \ circuit = cirq.Circuit([\n cirq.H(q0),\n cirq.CNOT(q0, q1),\n\ + \ cirq.measure(q0, q1, key=\"m\"),\n ])\n\n\n sampler = NeutralAtomSampler(seed=42)\n\ + \ result = sampler.run(circuit, repetitions=1000)\n print(result.histogram(key=\"\ + m\"))" +type: import +classes: +- qsharp.interop.cirq.NeutralAtomCirqResult +- qsharp.interop.cirq.NeutralAtomSampler diff --git a/python_doc/qsharp/qsharp.interop.yml b/python_doc/qsharp/qsharp.interop.yml new file mode 100644 index 0000000000..dced329699 --- /dev/null +++ b/python_doc/qsharp/qsharp.interop.yml @@ -0,0 +1,7 @@ +### YamlMime:PythonPackage +uid: qsharp.interop +name: interop +fullName: qsharp.interop +type: import +packages: +- qsharp.interop.cirq diff --git a/python_doc/qsharp/qsharp.noisy_simulator.DensityMatrixSimulator.yml b/python_doc/qsharp/qsharp.noisy_simulator.DensityMatrixSimulator.yml new file mode 100644 index 0000000000..f84ef041d7 --- /dev/null +++ b/python_doc/qsharp/qsharp.noisy_simulator.DensityMatrixSimulator.yml @@ -0,0 +1,63 @@ +### YamlMime:PythonClass +uid: qsharp.noisy_simulator.DensityMatrixSimulator +name: DensityMatrixSimulator +fullName: qsharp.noisy_simulator.DensityMatrixSimulator +module: qsharp.noisy_simulator +constructor: + syntax: DensityMatrixSimulator(number_of_qubits, seed=None) + parameters: + - name: number_of_qubits + isRequired: true + - name: seed + defaultValue: None +methods: +- uid: qsharp.noisy_simulator.DensityMatrixSimulator.apply_instrument + name: apply_instrument + summary: Apply non selective evolution. + signature: apply_instrument(instrument, qubits) + parameters: + - name: instrument + isRequired: true + - name: qubits + isRequired: true +- uid: qsharp.noisy_simulator.DensityMatrixSimulator.apply_operation + name: apply_operation + summary: Apply an arbitrary operation to given qubit ids. + signature: apply_operation(operation, qubits) + parameters: + - name: operation + isRequired: true + - name: qubits + isRequired: true +- uid: qsharp.noisy_simulator.DensityMatrixSimulator.get_state + name: get_state + summary: Returns the *DensityMatrix* if the simulator is in a valid state. + signature: get_state() +- uid: qsharp.noisy_simulator.DensityMatrixSimulator.sample_instrument + name: sample_instrument + summary: 'Performs selective evolution under the given instrument. + + Returns the index of the observed outcome. + + + Use this method to perform measurements on the quantum system.' + signature: sample_instrument(instrument, qubits) + parameters: + - name: instrument + isRequired: true + - name: qubits + isRequired: true +- uid: qsharp.noisy_simulator.DensityMatrixSimulator.set_state + name: set_state + summary: Set state of the quantum system. + signature: set_state(state) + parameters: + - name: state + isRequired: true +- uid: qsharp.noisy_simulator.DensityMatrixSimulator.set_trace + name: set_trace + summary: Set the trace of the quantum system. + signature: set_trace(trace) + parameters: + - name: trace + isRequired: true diff --git a/python_doc/qsharp/qsharp.noisy_simulator.Instrument.yml b/python_doc/qsharp/qsharp.noisy_simulator.Instrument.yml new file mode 100644 index 0000000000..0e910a4c99 --- /dev/null +++ b/python_doc/qsharp/qsharp.noisy_simulator.Instrument.yml @@ -0,0 +1,10 @@ +### YamlMime:PythonClass +uid: qsharp.noisy_simulator.Instrument +name: Instrument +fullName: qsharp.noisy_simulator.Instrument +module: qsharp.noisy_simulator +constructor: + syntax: Instrument(operations) + parameters: + - name: operations + isRequired: true diff --git a/python_doc/qsharp/qsharp.noisy_simulator.NoisySimulatorError.yml b/python_doc/qsharp/qsharp.noisy_simulator.NoisySimulatorError.yml new file mode 100644 index 0000000000..54718226d1 --- /dev/null +++ b/python_doc/qsharp/qsharp.noisy_simulator.NoisySimulatorError.yml @@ -0,0 +1,7 @@ +### YamlMime:PythonClass +uid: qsharp.noisy_simulator.NoisySimulatorError +name: NoisySimulatorError +fullName: qsharp.noisy_simulator.NoisySimulatorError +module: qsharp.noisy_simulator +constructor: + syntax: NoisySimulatorError() diff --git a/python_doc/qsharp/qsharp.noisy_simulator.Operation.yml b/python_doc/qsharp/qsharp.noisy_simulator.Operation.yml new file mode 100644 index 0000000000..8e946f336c --- /dev/null +++ b/python_doc/qsharp/qsharp.noisy_simulator.Operation.yml @@ -0,0 +1,23 @@ +### YamlMime:PythonClass +uid: qsharp.noisy_simulator.Operation +name: Operation +fullName: qsharp.noisy_simulator.Operation +module: qsharp.noisy_simulator +constructor: + syntax: Operation(kraus_operators) + parameters: + - name: kraus_operators + isRequired: true +methods: +- uid: qsharp.noisy_simulator.Operation.get_effect_matrix + name: get_effect_matrix + signature: get_effect_matrix() +- uid: qsharp.noisy_simulator.Operation.get_kraus_operators + name: get_kraus_operators + signature: get_kraus_operators() +- uid: qsharp.noisy_simulator.Operation.get_number_of_qubits + name: get_number_of_qubits + signature: get_number_of_qubits() +- uid: qsharp.noisy_simulator.Operation.get_operation_matrix + name: get_operation_matrix + signature: get_operation_matrix() diff --git a/python_doc/qsharp/qsharp.noisy_simulator.StateVectorSimulator.yml b/python_doc/qsharp/qsharp.noisy_simulator.StateVectorSimulator.yml new file mode 100644 index 0000000000..0671ac35b0 --- /dev/null +++ b/python_doc/qsharp/qsharp.noisy_simulator.StateVectorSimulator.yml @@ -0,0 +1,63 @@ +### YamlMime:PythonClass +uid: qsharp.noisy_simulator.StateVectorSimulator +name: StateVectorSimulator +fullName: qsharp.noisy_simulator.StateVectorSimulator +module: qsharp.noisy_simulator +constructor: + syntax: StateVectorSimulator(number_of_qubits, seed=None) + parameters: + - name: number_of_qubits + isRequired: true + - name: seed + defaultValue: None +methods: +- uid: qsharp.noisy_simulator.StateVectorSimulator.apply_instrument + name: apply_instrument + summary: Apply non selective evolution. + signature: apply_instrument(instrument, qubits) + parameters: + - name: instrument + isRequired: true + - name: qubits + isRequired: true +- uid: qsharp.noisy_simulator.StateVectorSimulator.apply_operation + name: apply_operation + summary: Apply an arbitrary operation to given qubit ids. + signature: apply_operation(operation, qubits) + parameters: + - name: operation + isRequired: true + - name: qubits + isRequired: true +- uid: qsharp.noisy_simulator.StateVectorSimulator.get_state + name: get_state + summary: Returns the *StateVector* if the simulator is in a valid state. + signature: get_state() +- uid: qsharp.noisy_simulator.StateVectorSimulator.sample_instrument + name: sample_instrument + summary: 'Performs selective evolution under the given instrument. + + Returns the index of the observed outcome. + + + Use this method to perform measurements on the quantum system.' + signature: sample_instrument(instrument, qubits) + parameters: + - name: instrument + isRequired: true + - name: qubits + isRequired: true +- uid: qsharp.noisy_simulator.StateVectorSimulator.set_state + name: set_state + summary: Set state of the quantum system. + signature: set_state(state) + parameters: + - name: state + isRequired: true +- uid: qsharp.noisy_simulator.StateVectorSimulator.set_trace + name: set_trace + summary: Set the trace of the quantum system. + signature: set_trace(trace) + parameters: + - name: trace + isRequired: true diff --git a/python_doc/qsharp/qsharp.noisy_simulator.yml b/python_doc/qsharp/qsharp.noisy_simulator.yml new file mode 100644 index 0000000000..b87bf0c12a --- /dev/null +++ b/python_doc/qsharp/qsharp.noisy_simulator.yml @@ -0,0 +1,11 @@ +### YamlMime:PythonPackage +uid: qsharp.noisy_simulator +name: noisy_simulator +fullName: qsharp.noisy_simulator +type: import +classes: +- qsharp.noisy_simulator.DensityMatrixSimulator +- qsharp.noisy_simulator.Instrument +- qsharp.noisy_simulator.NoisySimulatorError +- qsharp.noisy_simulator.Operation +- qsharp.noisy_simulator.StateVectorSimulator diff --git a/python_doc/qsharp/qsharp.openqasm.OutputSemantics.yml b/python_doc/qsharp/qsharp.openqasm.OutputSemantics.yml new file mode 100644 index 0000000000..3fee1c5398 --- /dev/null +++ b/python_doc/qsharp/qsharp.openqasm.OutputSemantics.yml @@ -0,0 +1,22 @@ +### YamlMime:PythonClass +uid: qsharp.openqasm.OutputSemantics +name: OutputSemantics +fullName: qsharp.openqasm.OutputSemantics +module: qsharp.openqasm +summary: 'Represents the output semantics for OpenQASM 3 compilation. + + Each has implications on the output of the compilation + + and the semantic checks that are performed.' +constructor: + syntax: OutputSemantics() +attributes: +- uid: qsharp.openqasm.OutputSemantics.OpenQasm + name: OpenQasm + signature: OpenQasm = OutputSemantics.OpenQasm +- uid: qsharp.openqasm.OutputSemantics.Qiskit + name: Qiskit + signature: Qiskit = OutputSemantics.Qiskit +- uid: qsharp.openqasm.OutputSemantics.ResourceEstimation + name: ResourceEstimation + signature: ResourceEstimation = OutputSemantics.ResourceEstimation diff --git a/python_doc/qsharp/qsharp.openqasm.ProgramType.yml b/python_doc/qsharp/qsharp.openqasm.ProgramType.yml new file mode 100644 index 0000000000..0a2ab7c23c --- /dev/null +++ b/python_doc/qsharp/qsharp.openqasm.ProgramType.yml @@ -0,0 +1,18 @@ +### YamlMime:PythonClass +uid: qsharp.openqasm.ProgramType +name: ProgramType +fullName: qsharp.openqasm.ProgramType +module: qsharp.openqasm +summary: Represents the type of compilation output to create +constructor: + syntax: ProgramType() +attributes: +- uid: qsharp.openqasm.ProgramType.File + name: File + signature: File = ProgramType.File +- uid: qsharp.openqasm.ProgramType.Fragments + name: Fragments + signature: Fragments = ProgramType.Fragments +- uid: qsharp.openqasm.ProgramType.Operation + name: Operation + signature: Operation = ProgramType.Operation diff --git a/python_doc/qsharp/qsharp.openqasm.QasmError.yml b/python_doc/qsharp/qsharp.openqasm.QasmError.yml new file mode 100644 index 0000000000..6fe0e33c36 --- /dev/null +++ b/python_doc/qsharp/qsharp.openqasm.QasmError.yml @@ -0,0 +1,8 @@ +### YamlMime:PythonClass +uid: qsharp.openqasm.QasmError +name: QasmError +fullName: qsharp.openqasm.QasmError +module: qsharp.openqasm +summary: An error returned from the OpenQASM parser. +constructor: + syntax: QasmError() diff --git a/python_doc/qsharp/qsharp.openqasm.yml b/python_doc/qsharp/qsharp.openqasm.yml new file mode 100644 index 0000000000..63dfb2f414 --- /dev/null +++ b/python_doc/qsharp/qsharp.openqasm.yml @@ -0,0 +1,306 @@ +### YamlMime:PythonPackage +uid: qsharp.openqasm +name: openqasm +fullName: qsharp.openqasm +type: import +functions: +- uid: qsharp.openqasm.circuit + name: circuit + summary: 'Synthesizes a circuit for an OpenQASM program. Either a program string + or + + an operation must be provided.' + signature: 'circuit(source: str | Callable | None = None, *args, **kwargs: Any) + -> Circuit' + parameters: + - name: source + description: 'An OpenQASM program. Alternatively, a callable can be provided, + + which must be an already imported global callable.' + defaultValue: None + types: + - , + - name: '*args' + description: The arguments to pass to the callable, if one is provided. + isRequired: true + - name: generation_method + description: 'The method to use for circuit generation. + + `CircuitGenerationMethod.ClassicalEval` evaluates classical control flow at + circuit + + generation time. `CircuitGenerationMethod.Simulate` runs a full simulation to + trace + + the circuit. `CircuitGenerationMethod.Static` uses partial evaluation and requires + + a non-`Unrestricted` target profile. Defaults to `None` (auto-selected).' + isRequired: true + - name: max_operations + description: 'The maximum number of operations to include in the circuit. + + Defaults to `None` (no limit).' + isRequired: true + - name: source_locations + description: 'If `True`, annotates each gate with its source location. + + Defaults to `False`.' + isRequired: true + - name: group_by_scope + description: 'If `True`, groups operations by their Q# scope. + + Defaults to `True`.' + isRequired: true + - name: prune_classical_qubits + description: 'If `True`, removes qubits that are never used in a quantum + + gate. Defaults to `False`.' + isRequired: true + - name: '**kwargs' + description: "Additional keyword arguments. Common options:\n\n* `name` (str):\ + \ The name of the program. This is used as the entry point for the program.\ + \ \n\n* `search_path` (str): The optional search path for resolving file references." + isRequired: true + return: + description: The synthesized circuit. + types: + - + exceptions: + - type: qsharp.openqasm.QasmError + description: If there is an error generating, parsing, or analyzing the OpenQASM + source. + - type: qsharp.QSharpError + description: If there is an error evaluating or synthesizing the circuit. +- uid: qsharp.openqasm.compile + name: compile + summary: 'Compiles the OpenQASM source code into a program that can be submitted + to a + + target as QIR (Quantum Intermediate Representation). + + Either a full program or a callable with arguments must be provided. + + + Example:' + signature: 'compile(source: str | Callable, *args: Any, **kwargs: Any) -> QirInputData' + parameters: + - name: source + description: 'An OpenQASM program. Alternatively, a callable can be provided, + + which must be an already imported global callable.' + isRequired: true + types: + - + - name: '*args' + description: The arguments to pass to the callable, if one is provided. + isRequired: true + - name: '**kwargs' + description: "Additional keyword arguments for compiling the source program. Common\ + \ options:\n\n* `name` (str): The name of the circuit. This is used as the entry\ + \ point for the program. \n\n* `target_profile` (TargetProfile): The target\ + \ profile to use for code generation. \n\n* `search_path` (str): The optional\ + \ search path for resolving file references. \n\n* `output_semantics` (OutputSemantics):\ + \ The output semantics for the compilation." + isRequired: true + return: + description: The compiled program. Use `str()` to get the QIR string. + types: + - + exceptions: + - type: qsharp.openqasm.QasmError + description: If there is an error generating, parsing, or analyzing the OpenQASM + source. + - type: qsharp.QSharpError + description: If there is an error compiling the program. +- uid: qsharp.openqasm.estimate + name: estimate + summary: 'Estimates the resource requirements for executing OpenQASM source code. + + Either a full program or a callable with arguments must be provided.' + signature: 'estimate(source: str | Callable, params: Dict[str, Any] | List | EstimatorParams + | None = None, *args: Any, **kwargs: Any) -> EstimatorResult' + parameters: + - name: source + description: 'An OpenQASM program. Alternatively, a callable can be provided, + + which must be an already imported global callable.' + isRequired: true + types: + - + - name: params + description: The parameters to configure estimation. + defaultValue: None + types: + - , + - , + - name: '*args' + description: The arguments to pass to the callable, if one is provided. + isRequired: true + - name: '**kwargs' + description: "Additional keyword arguments. Common options:\n\n* `name` (str):\ + \ The name of the circuit. This is used as the entry point for the program.\ + \ Defaults to `'program'`. \n\n* `search_path` (str): The optional search path\ + \ for resolving imports." + isRequired: true + return: + description: The estimated resources. + types: + - + exceptions: + - type: qsharp.openqasm.QasmError + description: If there is an error generating, parsing, or analyzing the OpenQASM + source. + - type: qsharp.QSharpError + description: If there is an error compiling the program. +- uid: qsharp.openqasm.import_openqasm + name: import_openqasm + summary: 'Imports OpenQASM source code into the active QDK interpreter. By default, + import uses `ProgramType.Operation` + + such that the source becomes a Q# operation in the global namespace with parameters + for any declared classical + + inputs and parameters for each of the declared qubits, while any explicit or implicit + output declarations become + + the return type of the operation. + + Alternatively, specifying `ProgramType.File` will treat the input source as a + stand-alone program and create + + an operation in the `qasm_import` namespace that only takes classical parameters, + allocates the required qubits + + internally and releases them at the end of the operation. + + Finally, using `ProgramType.Fragments` executes the provided source in the current + interactive interpreter, + + defining any declared variables or operations in the current scope and returning + the value of the last statement + + in the source.' + signature: 'import_openqasm(source: str, **kwargs: Any) -> Any' + parameters: + - name: source + description: An OpenQASM program or fragment. + isRequired: true + types: + - + - name: '**kwargs' + description: "Additional keyword arguments. Common options:\n\n* `name` (str):\ + \ The name of the program. This is used as the entry point for the program.\ + \ \n\n* `search_path` (str): The optional search path for resolving file references.\ + \ \n\n* `output_semantics` (OutputSemantics): The output semantics for the compilation.\ + \ \n\n* `program_type` (ProgramType): The type of program compilation to perform.\ + \ Defaults to `ProgramType.Operation`." + isRequired: true + return: + description: The value returned by the last statement in the source code. + types: + - + exceptions: + - type: qsharp.openqasm.QasmError + description: If there is an error generating, parsing, or analyzing the OpenQASM + source. + - type: qsharp.QSharpError + description: If there is an error compiling the program. +- uid: qsharp.openqasm.run + name: run + summary: 'Runs the given OpenQASM program for the given number of shots. + + Either a full program or a callable with arguments must be provided. + + Each shot uses an independent instance of the simulator.' + signature: 'run(source: str | Callable, shots: int = 1024, *args: Any, on_result: + Callable[[ShotResult], None] | None = None, save_events: bool = False, noise: + Tuple[float, float, float] | PauliNoise | BitFlipNoise | PhaseFlipNoise | DepolarizingNoise + | NoiseConfig | None = None, qubit_loss: float | None = None, as_bitstring: bool + = False, **kwargs: Any) -> List[Any]' + parameters: + - name: source + description: 'An OpenQASM program. Alternatively, a callable can be provided, + + which must be an already imported global callable.' + isRequired: true + types: + - + - name: shots + description: The number of shots to run. Defaults to `1024`. + defaultValue: '1024' + types: + - + - name: '*args' + description: The arguments to pass to the callable, if one is provided. + isRequired: true + - name: on_result + description: 'A callback function that will be called with each result. + + Only used when a callable is provided.' + isRequired: true + types: + - , + - name: save_events + description: 'If true, the output of each shot will be saved. If false, they will + be printed. + + Only used when a callable is provided.' + isRequired: true + types: + - + - name: noise + description: The noise to use in simulation. + isRequired: true + types: + - [[, , ], + , , , + , ], + - name: qubit_loss + description: The probability of qubit loss in simulation. + isRequired: true + types: + - , + - name: as_bitstring + description: If true, the result registers will be converted to bitstrings. + isRequired: true + types: + - + - name: '**kwargs' + description: "Additional keyword arguments for compiling the source program. Common\ + \ options:\n\n* `name` (str): The name of the circuit. This is used as the entry\ + \ point for the program. \n\n* `target_profile` (TargetProfile): The target\ + \ profile to use for code generation. \n\n* `search_path` (str): The optional\ + \ search path for resolving file references. \n\n* `output_semantics` (OutputSemantics):\ + \ The output semantics for the compilation. \n\n* `seed` (int): The seed to\ + \ use for the random number generator." + isRequired: true + keywordOnlyParameters: + - name: on_result + defaultValue: None + - name: save_events + defaultValue: 'False' + - name: noise + defaultValue: None + - name: qubit_loss + defaultValue: None + - name: as_bitstring + defaultValue: 'False' + return: + description: A list of results or runtime errors. If `save_events` is true, a + list of ShotResults is returned. + types: + - [] + exceptions: + - type: qsharp.openqasm.QasmError + description: If there is an error generating, parsing, or analyzing the OpenQASM + source. + - type: qsharp.QSharpError + description: If there is an error interpreting the input. + - type: ValueError + description: If the number of shots is less than 1. + - type: ValueError + description: If `on_result` or `save_events` are used when running OpenQASM programs. +classes: +- qsharp.openqasm.OutputSemantics +- qsharp.openqasm.ProgramType +- qsharp.openqasm.QasmError diff --git a/python_doc/qsharp/qsharp.telemetry.Metric.yml b/python_doc/qsharp/qsharp.telemetry.Metric.yml new file mode 100644 index 0000000000..b2e8267d6c --- /dev/null +++ b/python_doc/qsharp/qsharp.telemetry.Metric.yml @@ -0,0 +1,24 @@ +### YamlMime:PythonClass +uid: qsharp.telemetry.Metric +name: Metric +fullName: qsharp.telemetry.Metric +module: qsharp.telemetry +summary: Used internally for objects in the telemetry queue +constructor: + syntax: Metric() +attributes: +- uid: qsharp.telemetry.Metric.count + name: count + signature: 'count: int' +- uid: qsharp.telemetry.Metric.name + name: name + signature: 'name: str' +- uid: qsharp.telemetry.Metric.properties + name: properties + signature: 'properties: Dict[str, Any]' +- uid: qsharp.telemetry.Metric.type + name: type + signature: 'type: str' +- uid: qsharp.telemetry.Metric.value + name: value + signature: 'value: float' diff --git a/python_doc/qsharp/qsharp.telemetry.PendingMetric.yml b/python_doc/qsharp/qsharp.telemetry.PendingMetric.yml new file mode 100644 index 0000000000..e48be37456 --- /dev/null +++ b/python_doc/qsharp/qsharp.telemetry.PendingMetric.yml @@ -0,0 +1,30 @@ +### YamlMime:PythonClass +uid: qsharp.telemetry.PendingMetric +name: PendingMetric +fullName: qsharp.telemetry.PendingMetric +module: qsharp.telemetry +summary: Used internally to aggregate metrics before sending +constructor: + syntax: PendingMetric() +attributes: +- uid: qsharp.telemetry.PendingMetric.count + name: count + signature: 'count: int' +- uid: qsharp.telemetry.PendingMetric.max + name: max + signature: 'max: float' +- uid: qsharp.telemetry.PendingMetric.min + name: min + signature: 'min: float' +- uid: qsharp.telemetry.PendingMetric.name + name: name + signature: 'name: str' +- uid: qsharp.telemetry.PendingMetric.properties + name: properties + signature: 'properties: Dict[str, Any]' +- uid: qsharp.telemetry.PendingMetric.type + name: type + signature: 'type: str' +- uid: qsharp.telemetry.PendingMetric.value + name: value + signature: 'value: float' diff --git a/python_doc/qsharp/qsharp.telemetry.yml b/python_doc/qsharp/qsharp.telemetry.yml new file mode 100644 index 0000000000..89467bb887 --- /dev/null +++ b/python_doc/qsharp/qsharp.telemetry.yml @@ -0,0 +1,58 @@ +### YamlMime:PythonModule +uid: qsharp.telemetry +name: telemetry +fullName: qsharp.telemetry +summary: 'This module sends telemetry directly to Azure Monitor using a similar mechanism + and + + format to the Azure Monitor OpenTelemetry Python SDK. It only supports custom metrics + of + + type "counter" and "histogram" for now. It''s goal is to be minimal in size and + dependencies, + + and easy to read to understand exactly what data is being sent. + + + + To use this API, simply call `log_telemetry` with the metric name, value, and any + other + + optional properties. The telemetry will be batched and sent at a regular intervals + (60 sec), + + and when the process is about to exit. + + + + Disable qsharp Python telemetry by setting the environment variable `QSHARP_PYTHON_TELEMETRY=none`.' +functions: +- uid: qsharp.telemetry.log_telemetry + name: log_telemetry + summary: "Logs a custom metric with the name provided. Properties are optional and\ + \ can be used to\ncapture additional context about the metric (but should be a\ + \ relatively static set of values, as\neach unique set of properties will be sent\ + \ as a separate metric and creates a separate 'dimension'\nin the backend telemetry\ + \ store).\n\nThe type can be either 'counter' or 'histogram'. A 'counter' is a\ + \ simple value that is summed\nover time, such as how many times an event occurs,\ + \ while a 'histogram' is used to track 'quantative'\nvalues, such as the distribution\ + \ of values over time, e.g., the duration of an operation.\n\nExample usage for\ + \ a counter:\n\n log_telemetry(\"qir_generated\", 1, properties={\"profile\"\ + : \"base\", \"qsharp.version\": \"1.9.0\"})\n\nExample usage for a histogram:\n\ + \n log_telemetry(\"simulation_duration\", 123.45, type=\"histogram\")" + signature: 'log_telemetry(name: str, value: float, count: int = 1, properties: Dict[str, + Any] = {}, type: Literal[''counter'', ''histogram''] = ''counter'') -> None' + parameters: + - name: name + isRequired: true + - name: value + isRequired: true + - name: count + defaultValue: '1' + - name: properties + defaultValue: '{}' + - name: type + defaultValue: counter +classes: +- qsharp.telemetry.Metric +- qsharp.telemetry.PendingMetric diff --git a/python_doc/qsharp/qsharp.telemetry_events.yml b/python_doc/qsharp/qsharp.telemetry_events.yml new file mode 100644 index 0000000000..c253c38d41 --- /dev/null +++ b/python_doc/qsharp/qsharp.telemetry_events.yml @@ -0,0 +1,232 @@ +### YamlMime:PythonModule +uid: qsharp.telemetry_events +name: telemetry_events +fullName: qsharp.telemetry_events +functions: +- uid: qsharp.telemetry_events.get_next_power_of_ten_bucket + name: get_next_power_of_ten_bucket + signature: 'get_next_power_of_ten_bucket(value: int) -> int' + parameters: + - name: value + isRequired: true +- uid: qsharp.telemetry_events.get_qubits_bucket + name: get_qubits_bucket + signature: 'get_qubits_bucket(qubits: str | int) -> str' + parameters: + - name: qubits + isRequired: true +- uid: qsharp.telemetry_events.on_circuit + name: on_circuit + signature: on_circuit() -> None +- uid: qsharp.telemetry_events.on_circuit_end + name: on_circuit_end + signature: 'on_circuit_end(durationMs: float) -> None' + parameters: + - name: durationMs + isRequired: true +- uid: qsharp.telemetry_events.on_circuit_qasm + name: on_circuit_qasm + signature: on_circuit_qasm() -> None +- uid: qsharp.telemetry_events.on_circuit_qasm_end + name: on_circuit_qasm_end + signature: 'on_circuit_qasm_end(durationMs: float) -> None' + parameters: + - name: durationMs + isRequired: true +- uid: qsharp.telemetry_events.on_compile + name: on_compile + signature: 'on_compile(profile: str) -> None' + parameters: + - name: profile + isRequired: true +- uid: qsharp.telemetry_events.on_compile_end + name: on_compile_end + signature: 'on_compile_end(durationMs: float, profile: str) -> None' + parameters: + - name: durationMs + isRequired: true + - name: profile + isRequired: true +- uid: qsharp.telemetry_events.on_compile_qasm + name: on_compile_qasm + signature: 'on_compile_qasm(profile: str) -> None' + parameters: + - name: profile + isRequired: true +- uid: qsharp.telemetry_events.on_compile_qasm_end + name: on_compile_qasm_end + signature: 'on_compile_qasm_end(durationMs: float, profile: str) -> None' + parameters: + - name: durationMs + isRequired: true + - name: profile + isRequired: true +- uid: qsharp.telemetry_events.on_estimate + name: on_estimate + signature: on_estimate() -> None +- uid: qsharp.telemetry_events.on_estimate_end + name: on_estimate_end + signature: 'on_estimate_end(durationMs: float, qubits: str | int) -> None' + parameters: + - name: durationMs + isRequired: true + - name: qubits + isRequired: true +- uid: qsharp.telemetry_events.on_estimate_qasm + name: on_estimate_qasm + signature: on_estimate_qasm() -> None +- uid: qsharp.telemetry_events.on_estimate_qasm_end + name: on_estimate_qasm_end + signature: 'on_estimate_qasm_end(durationMs: float, qubits: str | int) -> None' + parameters: + - name: durationMs + isRequired: true + - name: qubits + isRequired: true +- uid: qsharp.telemetry_events.on_eval + name: on_eval + signature: on_eval() -> None +- uid: qsharp.telemetry_events.on_eval_end + name: on_eval_end + signature: 'on_eval_end(durationMs: float) -> None' + parameters: + - name: durationMs + isRequired: true +- uid: qsharp.telemetry_events.on_import + name: on_import + signature: on_import() -> None +- uid: qsharp.telemetry_events.on_import_qasm + name: on_import_qasm + signature: on_import_qasm() -> None +- uid: qsharp.telemetry_events.on_import_qasm_end + name: on_import_qasm_end + signature: 'on_import_qasm_end(durationMs: float) -> None' + parameters: + - name: durationMs + isRequired: true +- uid: qsharp.telemetry_events.on_neutral_atom_compile + name: on_neutral_atom_compile + signature: on_neutral_atom_compile() -> None +- uid: qsharp.telemetry_events.on_neutral_atom_compile_end + name: on_neutral_atom_compile_end + signature: 'on_neutral_atom_compile_end(duration_ms: float) -> None' + parameters: + - name: duration_ms + isRequired: true +- uid: qsharp.telemetry_events.on_neutral_atom_cpu_fallback + name: on_neutral_atom_cpu_fallback + signature: on_neutral_atom_cpu_fallback() -> None +- uid: qsharp.telemetry_events.on_neutral_atom_init + name: on_neutral_atom_init + signature: 'on_neutral_atom_init(default_layout: bool) -> None' + parameters: + - name: default_layout + isRequired: true +- uid: qsharp.telemetry_events.on_neutral_atom_simulate + name: on_neutral_atom_simulate + signature: 'on_neutral_atom_simulate(shots: int, noise: bool, type: str) -> None' + parameters: + - name: shots + isRequired: true + - name: noise + isRequired: true + - name: type + isRequired: true +- uid: qsharp.telemetry_events.on_neutral_atom_simulate_end + name: on_neutral_atom_simulate_end + signature: 'on_neutral_atom_simulate_end(duration_ms: float, shots: int, noise: + bool, type: str) -> None' + parameters: + - name: duration_ms + isRequired: true + - name: shots + isRequired: true + - name: noise + isRequired: true + - name: type + isRequired: true +- uid: qsharp.telemetry_events.on_neutral_atom_trace + name: on_neutral_atom_trace + signature: on_neutral_atom_trace() -> None +- uid: qsharp.telemetry_events.on_neutral_atom_trace_end + name: on_neutral_atom_trace_end + signature: 'on_neutral_atom_trace_end(duration_ms: float) -> None' + parameters: + - name: duration_ms + isRequired: true +- uid: qsharp.telemetry_events.on_qdk_import + name: on_qdk_import + signature: on_qdk_import() -> None +- uid: qsharp.telemetry_events.on_qiskit_run + name: on_qiskit_run + signature: 'on_qiskit_run(shots: int, num_circuits: int) -> None' + parameters: + - name: shots + isRequired: true + - name: num_circuits + isRequired: true +- uid: qsharp.telemetry_events.on_qiskit_run_end + name: on_qiskit_run_end + signature: 'on_qiskit_run_end(shots: int, num_circuits: int, duration_ms: float) + -> None' + parameters: + - name: shots + isRequired: true + - name: num_circuits + isRequired: true + - name: duration_ms + isRequired: true +- uid: qsharp.telemetry_events.on_qiskit_run_re + name: on_qiskit_run_re + signature: on_qiskit_run_re() -> None +- uid: qsharp.telemetry_events.on_qiskit_run_re_end + name: on_qiskit_run_re_end + signature: 'on_qiskit_run_re_end(duration_ms: float) -> None' + parameters: + - name: duration_ms + isRequired: true +- uid: qsharp.telemetry_events.on_run + name: on_run + signature: 'on_run(shots: int, noise: bool, qubit_loss: bool) -> None' + parameters: + - name: shots + isRequired: true + - name: noise + isRequired: true + - name: qubit_loss + isRequired: true +- uid: qsharp.telemetry_events.on_run_cell + name: on_run_cell + signature: on_run_cell() -> None +- uid: qsharp.telemetry_events.on_run_cell_end + name: on_run_cell_end + signature: 'on_run_cell_end(durationMs: float) -> None' + parameters: + - name: durationMs + isRequired: true +- uid: qsharp.telemetry_events.on_run_end + name: on_run_end + signature: 'on_run_end(durationMs: float, shots: int) -> None' + parameters: + - name: durationMs + isRequired: true + - name: shots + isRequired: true +- uid: qsharp.telemetry_events.on_run_qasm + name: on_run_qasm + signature: 'on_run_qasm(shots: int, noise: bool, qubit_loss: bool) -> None' + parameters: + - name: shots + isRequired: true + - name: noise + isRequired: true + - name: qubit_loss + isRequired: true +- uid: qsharp.telemetry_events.on_run_qasm_end + name: on_run_qasm_end + signature: 'on_run_qasm_end(durationMs: float, shots: int) -> None' + parameters: + - name: durationMs + isRequired: true + - name: shots + isRequired: true diff --git a/python_doc/qsharp/qsharp.utils.yml b/python_doc/qsharp/qsharp.utils.yml new file mode 100644 index 0000000000..bc1ba2ad1c --- /dev/null +++ b/python_doc/qsharp/qsharp.utils.yml @@ -0,0 +1,21 @@ +### YamlMime:PythonPackage +uid: qsharp.utils +name: utils +fullName: qsharp.utils +type: import +functions: +- uid: qsharp.utils.dump_operation + name: dump_operation + summary: Returns a square matrix of complex numbers representing the operation performed. + signature: 'dump_operation(operation: str, num_qubits: int) -> List[List[complex]]' + parameters: + - name: operation + description: The operation to be performed, which must operate on a list of qubits. + isRequired: true + - name: num_qubits + description: The number of qubits to be used. + isRequired: true + return: + description: The matrix representing the operation. + types: + - [[]] diff --git a/python_doc/qsharp/qsharp.yml b/python_doc/qsharp/qsharp.yml new file mode 100644 index 0000000000..dac3fd8cd5 --- /dev/null +++ b/python_doc/qsharp/qsharp.yml @@ -0,0 +1,380 @@ +### YamlMime:PythonPackage +uid: qsharp +name: qsharp +fullName: qsharp +type: rootImport +functions: +- uid: qsharp.circuit + name: circuit + summary: 'Synthesizes a circuit for a Q# program. Either an entry + + expression or an operation must be provided. + + + an operation of a lambda expression. The operation must take only + + qubits or arrays of qubits as parameters.' + signature: 'circuit(entry_expr: str | Callable | GlobalCallable | Closure | None + = None, *args, operation: str | None = None, generation_method: CircuitGenerationMethod + | None = None, max_operations: int | None = None, source_locations: bool = False, + group_by_scope: bool = True, prune_classical_qubits: bool = False) -> Circuit' + parameters: + - name: generation_method + description: 'The method to use for circuit generation. + + `CircuitGenerationMethod.ClassicalEval` evaluates classical control flow at + circuit + + generation time. `CircuitGenerationMethod.Simulate` runs a full simulation to + trace + + the circuit. `CircuitGenerationMethod.Static` uses partial evaluation and requires + + a non-`Unrestricted` target profile. Defaults to `None` (auto-selected).' + isRequired: true + - name: max_operations + description: 'The maximum number of operations to include in the circuit. + + Defaults to `None` (no limit).' + isRequired: true + - name: source_locations + description: 'If `True`, annotates each gate with its source location. + + Defaults to `False`.' + isRequired: true + - name: group_by_scope + description: 'If `True`, groups operations by their Q# scope (e.g. operation body). + + Defaults to `True`.' + isRequired: true + - name: prune_classical_qubits + description: 'If `True`, removes qubits that are never used in a quantum + + gate (e.g. qubits only used as classical controls). Defaults to `False`.' + isRequired: true + - name: entry_expr + defaultValue: None + keywordOnlyParameters: + - name: operation + defaultValue: None + - name: generation_method + defaultValue: None + - name: max_operations + defaultValue: None + - name: source_locations + defaultValue: 'False' + - name: group_by_scope + defaultValue: 'True' + - name: prune_classical_qubits + defaultValue: 'False' + return: + description: The synthesized circuit. + types: + - + exceptions: + - type: qsharp.QSharpError + description: If there is an error synthesizing the circuit. +- uid: qsharp.compile + name: compile + summary: 'Compiles the Q# source code into a program that can be submitted to a + target. + + Either an entry expression or a callable with arguments must be provided. + + + Example:' + signature: 'compile(entry_expr: str | Callable | GlobalCallable | Closure, *args) + -> QirInputData' + parameters: + - name: entry_expr + description: 'The Q# expression that will be used as the entrypoint + + for the program. Alternatively, a callable can be provided, which must + + be a Q# callable.' + isRequired: true + - name: '*args' + description: The arguments to pass to the callable, if one is provided. + isRequired: true + return: + description: The compiled program. Use `str()` to get the QIR string. + types: + - +- uid: qsharp.dump_circuit + name: dump_circuit + summary: 'Dumps a circuit showing the current state of the simulator. + + + This circuit will contain the gates that have been applied + + in the simulator up to the current point. + + + Requires the interpreter to be initialized with *trace_circuit=True*.' + signature: dump_circuit() -> Circuit + return: + description: The current circuit trace. + types: + - + exceptions: + - type: qsharp.QSharpError + description: If the interpreter was not initialized with `trace_circuit=True` +- uid: qsharp.dump_machine + name: dump_machine + summary: Returns the sparse state vector of the simulator as a StateDump object. + signature: dump_machine() -> StateDump + return: + description: The state of the simulator. + types: + - +- uid: qsharp.estimate + name: estimate + summary: 'Estimates resources for Q# source code. + + Either an entry expression or a callable with arguments must be provided.' + signature: 'estimate(entry_expr: str | Callable | GlobalCallable | Closure, params: + Dict[str, Any] | List | EstimatorParams | None = None, *args) -> EstimatorResult' + parameters: + - name: entry_expr + description: 'The entry expression. Alternatively, a callable can be provided, + + which must be a Q# callable.' + isRequired: true + - name: params + description: The parameters to configure physical estimation. + defaultValue: None + return: + description: The estimated resources. + types: + - +- uid: qsharp.estimate_custom + name: estimate_custom + signature: estimate_custom(algorithm, qubit, qec, factories=Ellipsis, *, error_budget=0.01, + max_factories=None, logical_depth_factor=None, max_physical_qubits=None, max_duration=None, + error_budget_pruning=False) + parameters: + - name: algorithm + isRequired: true + - name: qubit + isRequired: true + - name: qec + isRequired: true + - name: factories + defaultValue: Ellipsis + keywordOnlyParameters: + - name: error_budget + defaultValue: '0.01' + - name: max_factories + defaultValue: None + - name: logical_depth_factor + defaultValue: None + - name: max_physical_qubits + defaultValue: None + - name: max_duration + defaultValue: None + - name: error_budget_pruning + defaultValue: 'False' +- uid: qsharp.eval + name: eval + summary: 'Evaluates Q# source code. + + + Output is printed to console.' + signature: 'eval(source: str, *, save_events: bool = False) -> Any' + parameters: + - name: source + description: The Q# source code to evaluate. + isRequired: true + - name: save_events + description: If true, all output will be saved and returned. If false, they will + be printed. + isRequired: true + keywordOnlyParameters: + - name: save_events + defaultValue: 'False' + return: + description: The value returned by the last statement in the source code, or the + saved output if `save_events` is true. + types: + - + exceptions: + - type: qsharp.QSharpError + description: If there is an error evaluating the source code. +- uid: qsharp.init + name: init + summary: Initializes the Q# interpreter. + signature: 'init(*, target_profile: TargetProfile = TargetProfile.Unrestricted, + target_name: str | None = None, project_root: str | None = None, language_features: + List[str] | None = None, trace_circuit: bool | None = None) -> Config' + parameters: + - name: target_profile + description: 'Setting the target profile allows the Q# + + interpreter to generate programs that are compatible + + with a specific target. See :py:class: *qsharp.TargetProfile*.' + isRequired: true + - name: target_name + description: 'An optional name of the target machine to use for inferring the + compatible + + target_profile setting.' + isRequired: true + - name: project_root + description: 'An optional path to a root directory with a Q# project to include. + + It must contain a qsharp.json project manifest.' + isRequired: true + - name: language_features + description: 'An optional list of language feature flags to enable. + + These correspond to experimental or preview Q# language features.' + isRequired: true + - name: trace_circuit + description: 'Enables tracing of circuit during execution. + + Passing *True* is required for the *dump_circuit* function to return a circuit. + + The *circuit* function is *NOT* affected by this parameter will always generate + a circuit.' + isRequired: true + keywordOnlyParameters: + - name: target_profile + defaultValue: Unrestricted + - name: target_name + defaultValue: None + - name: project_root + defaultValue: None + - name: language_features + defaultValue: None + - name: trace_circuit + defaultValue: None + return: + description: The Q# interpreter configuration. + types: + - +- uid: qsharp.logical_counts + name: logical_counts + summary: 'Extracts logical resource counts from Q# source code. + + Either an entry expression or a callable with arguments must be provided.' + signature: 'logical_counts(entry_expr: str | Callable | GlobalCallable | Closure, + *args) -> LogicalCounts' + parameters: + - name: entry_expr + description: 'The entry expression. Alternatively, a callable can be provided, + + which must be a Q# callable.' + isRequired: true + return: + description: Program resources in terms of logical gate counts. + types: + - +- uid: qsharp.run + name: run + summary: 'Runs the given Q# expression for the given number of shots. + + Each shot uses an independent instance of the simulator.' + signature: 'run(entry_expr: str | Callable | GlobalCallable | Closure, shots: int, + *args, on_result: Callable[[ShotResult], None] | None = None, save_events: bool + = False, noise: Tuple[float, float, float] | PauliNoise | BitFlipNoise | PhaseFlipNoise + | DepolarizingNoise | NoiseConfig | None = None, qubit_loss: float | None = None, + seed: int | None = None) -> List[Any]' + parameters: + - name: entry_expr + description: 'The entry expression. Alternatively, a callable can be provided, + + which must be a Q# callable.' + isRequired: true + - name: shots + description: The number of shots to run. + isRequired: true + - name: '*args' + description: The arguments to pass to the callable, if one is provided. + isRequired: true + - name: on_result + description: A callback function that will be called with each result. + isRequired: true + - name: save_events + description: If true, the output of each shot will be saved. If false, they will + be printed. + isRequired: true + - name: noise + description: The noise to use in simulation. + isRequired: true + - name: qubit_loss + description: The probability of qubit loss in simulation. + isRequired: true + - name: seed + description: The seed to use for the random number generator in simulation, if + any. + isRequired: true + keywordOnlyParameters: + - name: on_result + defaultValue: None + - name: save_events + defaultValue: 'False' + - name: noise + defaultValue: None + - name: qubit_loss + defaultValue: None + - name: seed + defaultValue: None + return: + description: A list of results or runtime errors. If `save_events` is true, a + list of `ShotResult` is returned. + types: + - [] + exceptions: + - type: qsharp.QSharpError + description: If there is an error interpreting the input. + - type: ValueError + description: If the number of shots is less than 1. +- uid: qsharp.set_classical_seed + name: set_classical_seed + summary: 'Sets the seed for the random number generator used for standard + + library classical random number operations. + + This applies to all Q# code executed, compiled, or estimated.' + signature: 'set_classical_seed(seed: int | None) -> None' + parameters: + - name: seed + description: 'The seed to use for the classical random number generator. + + If None, the seed will be generated from entropy.' + isRequired: true +- uid: qsharp.set_quantum_seed + name: set_quantum_seed + summary: 'Sets the seed for the random number generator used for quantum measurements. + + This applies to all Q# code executed, compiled, or estimated.' + signature: 'set_quantum_seed(seed: int | None) -> None' + parameters: + - name: seed + description: 'The seed to use for the quantum random number generator. + + If None, the seed will be generated from entropy.' + isRequired: true +classes: +- qsharp.BitFlipNoise +- qsharp.CircuitGenerationMethod +- qsharp.DepolarizingNoise +- qsharp.Pauli +- qsharp.PauliNoise +- qsharp.PhaseFlipNoise +- qsharp.QSharpError +- qsharp.Result +- qsharp.ShotResult +- qsharp.StateDump +- qsharp.TargetProfile +packages: +- qsharp.code +- qsharp.estimator +- qsharp.interop +- qsharp.noisy_simulator +- qsharp.openqasm +- qsharp.utils +modules: +- qsharp.telemetry +- qsharp.telemetry_events diff --git a/python_doc/toc.yml b/python_doc/toc.yml new file mode 100644 index 0000000000..13d23dd492 --- /dev/null +++ b/python_doc/toc.yml @@ -0,0 +1,202 @@ +- items: + - name: Overview + uid: qsharp + - name: code + no-loc: + - code + uid: qsharp.code + - items: + - name: Overview + uid: qsharp.estimator + - name: DistillationUnitSpecification + no-loc: + - DistillationUnitSpecification + uid: qsharp.estimator.DistillationUnitSpecification + - name: ErrorBudgetPartition + no-loc: + - ErrorBudgetPartition + uid: qsharp.estimator.ErrorBudgetPartition + - name: EstimatorConstraints + no-loc: + - EstimatorConstraints + uid: qsharp.estimator.EstimatorConstraints + - name: EstimatorError + no-loc: + - EstimatorError + uid: qsharp.estimator.EstimatorError + - name: EstimatorInputParamsItem + no-loc: + - EstimatorInputParamsItem + uid: qsharp.estimator.EstimatorInputParamsItem + - name: EstimatorParams + no-loc: + - EstimatorParams + uid: qsharp.estimator.EstimatorParams + - name: EstimatorQecScheme + no-loc: + - EstimatorQecScheme + uid: qsharp.estimator.EstimatorQecScheme + - name: EstimatorQubitParams + no-loc: + - EstimatorQubitParams + uid: qsharp.estimator.EstimatorQubitParams + - name: EstimatorResult + no-loc: + - EstimatorResult + uid: qsharp.estimator.EstimatorResult + - name: LogicalCounts + no-loc: + - LogicalCounts + uid: qsharp.estimator.LogicalCounts + - name: MeasurementErrorRate + no-loc: + - MeasurementErrorRate + uid: qsharp.estimator.MeasurementErrorRate + - name: ProtocolSpecificDistillationUnitSpecification + no-loc: + - ProtocolSpecificDistillationUnitSpecification + uid: qsharp.estimator.ProtocolSpecificDistillationUnitSpecification + - name: QECScheme + no-loc: + - QECScheme + uid: qsharp.estimator.QECScheme + - name: QubitParams + no-loc: + - QubitParams + uid: qsharp.estimator.QubitParams + name: estimator + no-loc: + - estimator + - items: + - name: Overview + uid: qsharp.interop + - items: + - name: Overview + uid: qsharp.interop.cirq + - name: NeutralAtomCirqResult + no-loc: + - NeutralAtomCirqResult + uid: qsharp.interop.cirq.NeutralAtomCirqResult + - name: NeutralAtomSampler + no-loc: + - NeutralAtomSampler + uid: qsharp.interop.cirq.NeutralAtomSampler + name: cirq + no-loc: + - cirq + name: interop + no-loc: + - interop + - items: + - name: Overview + uid: qsharp.noisy_simulator + - name: DensityMatrixSimulator + no-loc: + - DensityMatrixSimulator + uid: qsharp.noisy_simulator.DensityMatrixSimulator + - name: Instrument + no-loc: + - Instrument + uid: qsharp.noisy_simulator.Instrument + - name: NoisySimulatorError + no-loc: + - NoisySimulatorError + uid: qsharp.noisy_simulator.NoisySimulatorError + - name: Operation + no-loc: + - Operation + uid: qsharp.noisy_simulator.Operation + - name: StateVectorSimulator + no-loc: + - StateVectorSimulator + uid: qsharp.noisy_simulator.StateVectorSimulator + name: noisy_simulator + no-loc: + - noisy_simulator + - items: + - name: Overview + uid: qsharp.openqasm + - name: OutputSemantics + no-loc: + - OutputSemantics + uid: qsharp.openqasm.OutputSemantics + - name: ProgramType + no-loc: + - ProgramType + uid: qsharp.openqasm.ProgramType + - name: QasmError + no-loc: + - QasmError + uid: qsharp.openqasm.QasmError + name: openqasm + no-loc: + - openqasm + - name: utils + no-loc: + - utils + uid: qsharp.utils + - items: + - name: Overview + uid: qsharp.telemetry + - name: Metric + no-loc: + - Metric + uid: qsharp.telemetry.Metric + - name: PendingMetric + no-loc: + - PendingMetric + uid: qsharp.telemetry.PendingMetric + name: telemetry + no-loc: + - telemetry + - name: telemetry_events + no-loc: + - telemetry_events + uid: qsharp.telemetry_events + - name: BitFlipNoise + no-loc: + - BitFlipNoise + uid: qsharp.BitFlipNoise + - name: CircuitGenerationMethod + no-loc: + - CircuitGenerationMethod + uid: qsharp.CircuitGenerationMethod + - name: DepolarizingNoise + no-loc: + - DepolarizingNoise + uid: qsharp.DepolarizingNoise + - name: Pauli + no-loc: + - Pauli + uid: qsharp.Pauli + - name: PauliNoise + no-loc: + - PauliNoise + uid: qsharp.PauliNoise + - name: PhaseFlipNoise + no-loc: + - PhaseFlipNoise + uid: qsharp.PhaseFlipNoise + - name: QSharpError + no-loc: + - QSharpError + uid: qsharp.QSharpError + - name: Result + no-loc: + - Result + uid: qsharp.Result + - name: ShotResult + no-loc: + - ShotResult + uid: qsharp.ShotResult + - name: StateDump + no-loc: + - StateDump + uid: qsharp.StateDump + - name: TargetProfile + no-loc: + - TargetProfile + uid: qsharp.TargetProfile + name: qsharp + no-loc: + - qsharp From 0ec2c05ea64aca41cd922ceeecac15a0f6561db5 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Thu, 16 Apr 2026 11:20:18 -0700 Subject: [PATCH 16/26] The generated docs should not be in the git --- .gitignore | 2 + python_doc/qsharp/qsharp.BitFlipNoise.yml | 21 - .../qsharp/qsharp.CircuitGenerationMethod.yml | 17 - .../qsharp/qsharp.DepolarizingNoise.yml | 23 -- python_doc/qsharp/qsharp.Pauli.yml | 21 - python_doc/qsharp/qsharp.PauliNoise.yml | 29 -- python_doc/qsharp/qsharp.PhaseFlipNoise.yml | 21 - python_doc/qsharp/qsharp.QSharpError.yml | 8 - python_doc/qsharp/qsharp.Result.yml | 18 - python_doc/qsharp/qsharp.ShotResult.yml | 24 -- python_doc/qsharp/qsharp.StateDump.yml | 48 --- python_doc/qsharp/qsharp.TargetProfile.yml | 41 -- python_doc/qsharp/qsharp.code.yml | 6 - ...stimator.DistillationUnitSpecification.yml | 92 ----- .../qsharp.estimator.ErrorBudgetPartition.yml | 34 -- .../qsharp.estimator.EstimatorConstraints.yml | 52 --- .../qsharp.estimator.EstimatorError.yml | 13 - ...arp.estimator.EstimatorInputParamsItem.yml | 24 -- .../qsharp.estimator.EstimatorParams.yml | 43 -- .../qsharp.estimator.EstimatorQecScheme.yml | 55 --- .../qsharp.estimator.EstimatorQubitParams.yml | 113 ------ .../qsharp.estimator.EstimatorResult.yml | 44 -- .../qsharp/qsharp.estimator.LogicalCounts.yml | 36 -- .../qsharp.estimator.MeasurementErrorRate.yml | 29 -- ...lSpecificDistillationUnitSpecification.yml | 33 -- .../qsharp/qsharp.estimator.QECScheme.yml | 22 - .../qsharp/qsharp.estimator.QubitParams.yml | 32 -- python_doc/qsharp/qsharp.estimator.yml | 20 - ...arp.interop.cirq.NeutralAtomCirqResult.yml | 64 --- ...qsharp.interop.cirq.NeutralAtomSampler.yml | 115 ------ python_doc/qsharp/qsharp.interop.cirq.yml | 16 - python_doc/qsharp/qsharp.interop.yml | 7 - ...noisy_simulator.DensityMatrixSimulator.yml | 63 --- .../qsharp.noisy_simulator.Instrument.yml | 10 - ...rp.noisy_simulator.NoisySimulatorError.yml | 7 - .../qsharp.noisy_simulator.Operation.yml | 23 -- ...p.noisy_simulator.StateVectorSimulator.yml | 63 --- python_doc/qsharp/qsharp.noisy_simulator.yml | 11 - .../qsharp.openqasm.OutputSemantics.yml | 22 - .../qsharp/qsharp.openqasm.ProgramType.yml | 18 - .../qsharp/qsharp.openqasm.QasmError.yml | 8 - python_doc/qsharp/qsharp.openqasm.yml | 306 -------------- python_doc/qsharp/qsharp.telemetry.Metric.yml | 24 -- .../qsharp/qsharp.telemetry.PendingMetric.yml | 30 -- python_doc/qsharp/qsharp.telemetry.yml | 58 --- python_doc/qsharp/qsharp.telemetry_events.yml | 232 ----------- python_doc/qsharp/qsharp.utils.yml | 21 - python_doc/qsharp/qsharp.yml | 380 ------------------ python_doc/toc.yml | 202 ---------- 49 files changed, 2 insertions(+), 2599 deletions(-) delete mode 100644 python_doc/qsharp/qsharp.BitFlipNoise.yml delete mode 100644 python_doc/qsharp/qsharp.CircuitGenerationMethod.yml delete mode 100644 python_doc/qsharp/qsharp.DepolarizingNoise.yml delete mode 100644 python_doc/qsharp/qsharp.Pauli.yml delete mode 100644 python_doc/qsharp/qsharp.PauliNoise.yml delete mode 100644 python_doc/qsharp/qsharp.PhaseFlipNoise.yml delete mode 100644 python_doc/qsharp/qsharp.QSharpError.yml delete mode 100644 python_doc/qsharp/qsharp.Result.yml delete mode 100644 python_doc/qsharp/qsharp.ShotResult.yml delete mode 100644 python_doc/qsharp/qsharp.StateDump.yml delete mode 100644 python_doc/qsharp/qsharp.TargetProfile.yml delete mode 100644 python_doc/qsharp/qsharp.code.yml delete mode 100644 python_doc/qsharp/qsharp.estimator.DistillationUnitSpecification.yml delete mode 100644 python_doc/qsharp/qsharp.estimator.ErrorBudgetPartition.yml delete mode 100644 python_doc/qsharp/qsharp.estimator.EstimatorConstraints.yml delete mode 100644 python_doc/qsharp/qsharp.estimator.EstimatorError.yml delete mode 100644 python_doc/qsharp/qsharp.estimator.EstimatorInputParamsItem.yml delete mode 100644 python_doc/qsharp/qsharp.estimator.EstimatorParams.yml delete mode 100644 python_doc/qsharp/qsharp.estimator.EstimatorQecScheme.yml delete mode 100644 python_doc/qsharp/qsharp.estimator.EstimatorQubitParams.yml delete mode 100644 python_doc/qsharp/qsharp.estimator.EstimatorResult.yml delete mode 100644 python_doc/qsharp/qsharp.estimator.LogicalCounts.yml delete mode 100644 python_doc/qsharp/qsharp.estimator.MeasurementErrorRate.yml delete mode 100644 python_doc/qsharp/qsharp.estimator.ProtocolSpecificDistillationUnitSpecification.yml delete mode 100644 python_doc/qsharp/qsharp.estimator.QECScheme.yml delete mode 100644 python_doc/qsharp/qsharp.estimator.QubitParams.yml delete mode 100644 python_doc/qsharp/qsharp.estimator.yml delete mode 100644 python_doc/qsharp/qsharp.interop.cirq.NeutralAtomCirqResult.yml delete mode 100644 python_doc/qsharp/qsharp.interop.cirq.NeutralAtomSampler.yml delete mode 100644 python_doc/qsharp/qsharp.interop.cirq.yml delete mode 100644 python_doc/qsharp/qsharp.interop.yml delete mode 100644 python_doc/qsharp/qsharp.noisy_simulator.DensityMatrixSimulator.yml delete mode 100644 python_doc/qsharp/qsharp.noisy_simulator.Instrument.yml delete mode 100644 python_doc/qsharp/qsharp.noisy_simulator.NoisySimulatorError.yml delete mode 100644 python_doc/qsharp/qsharp.noisy_simulator.Operation.yml delete mode 100644 python_doc/qsharp/qsharp.noisy_simulator.StateVectorSimulator.yml delete mode 100644 python_doc/qsharp/qsharp.noisy_simulator.yml delete mode 100644 python_doc/qsharp/qsharp.openqasm.OutputSemantics.yml delete mode 100644 python_doc/qsharp/qsharp.openqasm.ProgramType.yml delete mode 100644 python_doc/qsharp/qsharp.openqasm.QasmError.yml delete mode 100644 python_doc/qsharp/qsharp.openqasm.yml delete mode 100644 python_doc/qsharp/qsharp.telemetry.Metric.yml delete mode 100644 python_doc/qsharp/qsharp.telemetry.PendingMetric.yml delete mode 100644 python_doc/qsharp/qsharp.telemetry.yml delete mode 100644 python_doc/qsharp/qsharp.telemetry_events.yml delete mode 100644 python_doc/qsharp/qsharp.utils.yml delete mode 100644 python_doc/qsharp/qsharp.yml delete mode 100644 python_doc/toc.yml diff --git a/.gitignore b/.gitignore index f1899e4400..25e5e9fa19 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ __pycache__/ /source/fuzz/artifacts /source/fuzz/coverage /source/fuzz/Cargo.lock +/source/pip/doc /source/samples_test/src/tests/*_generated.rs .mypy_cache/ .pytest_cache/ @@ -22,3 +23,4 @@ __pycache__/ *.so samples/scratch/ *.pyd +/python_doc/ diff --git a/python_doc/qsharp/qsharp.BitFlipNoise.yml b/python_doc/qsharp/qsharp.BitFlipNoise.yml deleted file mode 100644 index b2bfa67687..0000000000 --- a/python_doc/qsharp/qsharp.BitFlipNoise.yml +++ /dev/null @@ -1,21 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.BitFlipNoise -name: BitFlipNoise -fullName: qsharp.BitFlipNoise -module: qsharp -summary: 'The bit flip noise to use in simulation. - - - Creates a new instance. - - - The bit flip channel applies a Pauli-X error with probability `p`.' -constructor: - syntax: 'BitFlipNoise(p: float)' - parameters: - - name: p - description: "Probability of a bit flip (Pauli-X) error. Must satisfy `0 \u2264\ - \ p \u2264 1`." - isRequired: true - types: - - diff --git a/python_doc/qsharp/qsharp.CircuitGenerationMethod.yml b/python_doc/qsharp/qsharp.CircuitGenerationMethod.yml deleted file mode 100644 index 8efbbbbb25..0000000000 --- a/python_doc/qsharp/qsharp.CircuitGenerationMethod.yml +++ /dev/null @@ -1,17 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.CircuitGenerationMethod -name: CircuitGenerationMethod -fullName: qsharp.CircuitGenerationMethod -module: qsharp -constructor: - syntax: CircuitGenerationMethod() -attributes: -- uid: qsharp.CircuitGenerationMethod.ClassicalEval - name: ClassicalEval - signature: ClassicalEval = CircuitGenerationMethod.ClassicalEval -- uid: qsharp.CircuitGenerationMethod.Simulate - name: Simulate - signature: Simulate = CircuitGenerationMethod.Simulate -- uid: qsharp.CircuitGenerationMethod.Static - name: Static - signature: Static = CircuitGenerationMethod.Static diff --git a/python_doc/qsharp/qsharp.DepolarizingNoise.yml b/python_doc/qsharp/qsharp.DepolarizingNoise.yml deleted file mode 100644 index aa648893ec..0000000000 --- a/python_doc/qsharp/qsharp.DepolarizingNoise.yml +++ /dev/null @@ -1,23 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.DepolarizingNoise -name: DepolarizingNoise -fullName: qsharp.DepolarizingNoise -module: qsharp -summary: 'The depolarizing noise to use in simulation. - - - Creates a new instance. - - - The depolarizing channel applies Pauli-X, Pauli-Y, or Pauli-Z errors each with - - probability `p / 3`.' -constructor: - syntax: 'DepolarizingNoise(p: float)' - parameters: - - name: p - description: "Total depolarizing error probability. Must satisfy `0 \u2264 p \u2264\ - \ 1`." - isRequired: true - types: - - diff --git a/python_doc/qsharp/qsharp.Pauli.yml b/python_doc/qsharp/qsharp.Pauli.yml deleted file mode 100644 index a709d13d16..0000000000 --- a/python_doc/qsharp/qsharp.Pauli.yml +++ /dev/null @@ -1,21 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.Pauli -name: Pauli -fullName: qsharp.Pauli -module: qsharp -summary: A Q# Pauli operator. -constructor: - syntax: Pauli() -attributes: -- uid: qsharp.Pauli.I - name: I - signature: I = Pauli.I -- uid: qsharp.Pauli.X - name: X - signature: X = Pauli.X -- uid: qsharp.Pauli.Y - name: Y - signature: Y = Pauli.Y -- uid: qsharp.Pauli.Z - name: Z - signature: Z = Pauli.Z diff --git a/python_doc/qsharp/qsharp.PauliNoise.yml b/python_doc/qsharp/qsharp.PauliNoise.yml deleted file mode 100644 index 30362a93c2..0000000000 --- a/python_doc/qsharp/qsharp.PauliNoise.yml +++ /dev/null @@ -1,29 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.PauliNoise -name: PauliNoise -fullName: qsharp.PauliNoise -module: qsharp -summary: 'The Pauli noise to use in simulation represented - - as probabilities of Pauli-X, Pauli-Y, and Pauli-Z errors - - - Creates a new instance with the given error probabilities.' -constructor: - syntax: 'PauliNoise(x: float, y: float, z: float)' - parameters: - - name: x - description: Probability of a Pauli-X (bit flip) error. Must be non-negative. - isRequired: true - types: - - - - name: y - description: Probability of a Pauli-Y error. Must be non-negative. - isRequired: true - types: - - - - name: z - description: Probability of a Pauli-Z (phase flip) error. Must be non-negative. - isRequired: true - types: - - diff --git a/python_doc/qsharp/qsharp.PhaseFlipNoise.yml b/python_doc/qsharp/qsharp.PhaseFlipNoise.yml deleted file mode 100644 index 800d2eaa2a..0000000000 --- a/python_doc/qsharp/qsharp.PhaseFlipNoise.yml +++ /dev/null @@ -1,21 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.PhaseFlipNoise -name: PhaseFlipNoise -fullName: qsharp.PhaseFlipNoise -module: qsharp -summary: 'The phase flip noise to use in simulation. - - - Creates a new instance. - - - The phase flip channel applies a Pauli-Z error with probability `p`.' -constructor: - syntax: 'PhaseFlipNoise(p: float)' - parameters: - - name: p - description: "Probability of a phase flip (Pauli-Z) error. Must satisfy `0 \u2264\ - \ p \u2264 1`." - isRequired: true - types: - - diff --git a/python_doc/qsharp/qsharp.QSharpError.yml b/python_doc/qsharp/qsharp.QSharpError.yml deleted file mode 100644 index 3c3e3e3a17..0000000000 --- a/python_doc/qsharp/qsharp.QSharpError.yml +++ /dev/null @@ -1,8 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.QSharpError -name: QSharpError -fullName: qsharp.QSharpError -module: qsharp -summary: An error returned from the Q# interpreter. -constructor: - syntax: QSharpError() diff --git a/python_doc/qsharp/qsharp.Result.yml b/python_doc/qsharp/qsharp.Result.yml deleted file mode 100644 index 65dc89c149..0000000000 --- a/python_doc/qsharp/qsharp.Result.yml +++ /dev/null @@ -1,18 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.Result -name: Result -fullName: qsharp.Result -module: qsharp -summary: A Q# measurement result. -constructor: - syntax: Result() -attributes: -- uid: qsharp.Result.Loss - name: Loss - signature: Loss = Loss -- uid: qsharp.Result.One - name: One - signature: One = One -- uid: qsharp.Result.Zero - name: Zero - signature: Zero = Zero diff --git a/python_doc/qsharp/qsharp.ShotResult.yml b/python_doc/qsharp/qsharp.ShotResult.yml deleted file mode 100644 index 3371c8901f..0000000000 --- a/python_doc/qsharp/qsharp.ShotResult.yml +++ /dev/null @@ -1,24 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.ShotResult -name: ShotResult -fullName: qsharp.ShotResult -module: qsharp -summary: A single result of a shot. -constructor: - syntax: ShotResult() -attributes: -- uid: qsharp.ShotResult.dumps - name: dumps - signature: 'dumps: List[StateDump]' -- uid: qsharp.ShotResult.events - name: events - signature: 'events: List[Output | StateDump | str]' -- uid: qsharp.ShotResult.matrices - name: matrices - signature: 'matrices: List[Output]' -- uid: qsharp.ShotResult.messages - name: messages - signature: 'messages: List[str]' -- uid: qsharp.ShotResult.result - name: result - signature: 'result: Any' diff --git a/python_doc/qsharp/qsharp.StateDump.yml b/python_doc/qsharp/qsharp.StateDump.yml deleted file mode 100644 index c2398d3ab3..0000000000 --- a/python_doc/qsharp/qsharp.StateDump.yml +++ /dev/null @@ -1,48 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.StateDump -name: StateDump -fullName: qsharp.StateDump -module: qsharp -summary: A state dump returned from the Q# interpreter. -constructor: - syntax: 'StateDump(data: StateDumpData)' - parameters: - - name: data - isRequired: true -methods: -- uid: qsharp.StateDump.as_dense_state - name: as_dense_state - summary: Returns the state dump as a dense list of complex amplitudes. This will - include zero amplitudes. - signature: as_dense_state() -> List[complex] - return: - description: A dense list of complex amplitudes, one per computational basis state. - types: - - [] -- uid: qsharp.StateDump.check_eq - name: check_eq - summary: 'Checks if the state dump is equal to the given state. This is not mathematical - equality, - - as the check ignores global phase.' - signature: 'check_eq(state: Dict[int, complex] | List[complex], tolerance: float - = 1e-10) -> bool' - parameters: - - name: state - description: 'The state to check against, provided either as a dictionary of state - indices to complex amplitudes, - - or as a list of real amplitudes.' - isRequired: true - - name: tolerance - description: The tolerance for the check. Defaults to 1e-10. - defaultValue: '1e-10' - return: - description: '`True` if the state dump is equal to the given state within the - given tolerance, ignoring global phase.' - types: - - -attributes: -- uid: qsharp.StateDump.qubit_count - name: qubit_count - signature: 'qubit_count: int' diff --git a/python_doc/qsharp/qsharp.TargetProfile.yml b/python_doc/qsharp/qsharp.TargetProfile.yml deleted file mode 100644 index 0187b063ef..0000000000 --- a/python_doc/qsharp/qsharp.TargetProfile.yml +++ /dev/null @@ -1,41 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.TargetProfile -name: TargetProfile -fullName: qsharp.TargetProfile -module: qsharp -summary: 'A Q# target profile. - - - A target profile describes the capabilities of the hardware or simulator - - which will be used to run the Q# program.' -constructor: - syntax: TargetProfile() -methods: -- uid: qsharp.TargetProfile.from_str - name: from_str - summary: 'Creates a target profile from a string. - - :param value: The string to parse. - - :raises ValueError: If the string does not match any target profile.' - signature: from_str() - parameters: - - name: key - isRequired: true -attributes: -- uid: qsharp.TargetProfile.Adaptive_RI - name: Adaptive_RI - signature: Adaptive_RI = TargetProfile.Adaptive_RI -- uid: qsharp.TargetProfile.Adaptive_RIF - name: Adaptive_RIF - signature: Adaptive_RIF = TargetProfile.Adaptive_RIF -- uid: qsharp.TargetProfile.Adaptive_RIFLA - name: Adaptive_RIFLA - signature: Adaptive_RIFLA = TargetProfile.Adaptive_RIFLA -- uid: qsharp.TargetProfile.Base - name: Base - signature: Base = TargetProfile.Base -- uid: qsharp.TargetProfile.Unrestricted - name: Unrestricted - signature: Unrestricted = TargetProfile.Unrestricted diff --git a/python_doc/qsharp/qsharp.code.yml b/python_doc/qsharp/qsharp.code.yml deleted file mode 100644 index bc6ccedfa4..0000000000 --- a/python_doc/qsharp/qsharp.code.yml +++ /dev/null @@ -1,6 +0,0 @@ -### YamlMime:PythonPackage -uid: qsharp.code -name: code -fullName: qsharp.code -summary: Code module that receives any user-defined Q# callables as Python functions. -type: import diff --git a/python_doc/qsharp/qsharp.estimator.DistillationUnitSpecification.yml b/python_doc/qsharp/qsharp.estimator.DistillationUnitSpecification.yml deleted file mode 100644 index 4ac08e7de4..0000000000 --- a/python_doc/qsharp/qsharp.estimator.DistillationUnitSpecification.yml +++ /dev/null @@ -1,92 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.estimator.DistillationUnitSpecification -name: DistillationUnitSpecification -fullName: qsharp.estimator.DistillationUnitSpecification -module: qsharp.estimator -summary: 'Specification for a magic-state distillation unit. - - - Either select a built-in unit by setting `name`, or define a custom unit - - by providing `num_input_ts`, `num_output_ts`, `failure_probability_formula`, - - `output_error_rate_formula`, and optionally physical and logical qubit - - specifications.' -constructor: - syntax: 'DistillationUnitSpecification(name: str | None = None, display_name: str - | None = None, num_input_ts: int | None = None, num_output_ts: int | None = None, - failure_probability_formula: str | None = None, output_error_rate_formula: str - | None = None, physical_qubit_specification: ProtocolSpecificDistillationUnitSpecification - | None = None, logical_qubit_specification: ProtocolSpecificDistillationUnitSpecification - | None = None, logical_qubit_specification_first_round_override: ProtocolSpecificDistillationUnitSpecification - | None = None)' - parameters: - - name: name - defaultValue: None - - name: display_name - defaultValue: None - - name: num_input_ts - defaultValue: None - - name: num_output_ts - defaultValue: None - - name: failure_probability_formula - defaultValue: None - - name: output_error_rate_formula - defaultValue: None - - name: physical_qubit_specification - defaultValue: None - - name: logical_qubit_specification - defaultValue: None - - name: logical_qubit_specification_first_round_override - defaultValue: None -methods: -- uid: qsharp.estimator.DistillationUnitSpecification.as_dict - name: as_dict - signature: as_dict(validate=True) -> Dict[str, Any] - parameters: - - name: validate - defaultValue: 'True' -- uid: qsharp.estimator.DistillationUnitSpecification.has_custom_specification - name: has_custom_specification - signature: has_custom_specification() -- uid: qsharp.estimator.DistillationUnitSpecification.has_predefined_name - name: has_predefined_name - signature: has_predefined_name() -- uid: qsharp.estimator.DistillationUnitSpecification.post_validation - name: post_validation - signature: post_validation(result) - parameters: - - name: result - isRequired: true -attributes: -- uid: qsharp.estimator.DistillationUnitSpecification.display_name - name: display_name - signature: 'display_name: str | None = None' -- uid: qsharp.estimator.DistillationUnitSpecification.failure_probability_formula - name: failure_probability_formula - signature: 'failure_probability_formula: str | None = None' -- uid: qsharp.estimator.DistillationUnitSpecification.logical_qubit_specification - name: logical_qubit_specification - signature: 'logical_qubit_specification: ProtocolSpecificDistillationUnitSpecification - | None = None' -- uid: qsharp.estimator.DistillationUnitSpecification.logical_qubit_specification_first_round_override - name: logical_qubit_specification_first_round_override - signature: 'logical_qubit_specification_first_round_override: ProtocolSpecificDistillationUnitSpecification - | None = None' -- uid: qsharp.estimator.DistillationUnitSpecification.name - name: name - signature: 'name: str | None = None' -- uid: qsharp.estimator.DistillationUnitSpecification.num_input_ts - name: num_input_ts - signature: 'num_input_ts: int | None = None' -- uid: qsharp.estimator.DistillationUnitSpecification.num_output_ts - name: num_output_ts - signature: 'num_output_ts: int | None = None' -- uid: qsharp.estimator.DistillationUnitSpecification.output_error_rate_formula - name: output_error_rate_formula - signature: 'output_error_rate_formula: str | None = None' -- uid: qsharp.estimator.DistillationUnitSpecification.physical_qubit_specification - name: physical_qubit_specification - signature: 'physical_qubit_specification: ProtocolSpecificDistillationUnitSpecification - | None = None' diff --git a/python_doc/qsharp/qsharp.estimator.ErrorBudgetPartition.yml b/python_doc/qsharp/qsharp.estimator.ErrorBudgetPartition.yml deleted file mode 100644 index 6537f76a55..0000000000 --- a/python_doc/qsharp/qsharp.estimator.ErrorBudgetPartition.yml +++ /dev/null @@ -1,34 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.estimator.ErrorBudgetPartition -name: ErrorBudgetPartition -fullName: qsharp.estimator.ErrorBudgetPartition -module: qsharp.estimator -summary: 'Partition of the total error budget across algorithm components. - - - The three fields must sum to the overall error budget. Defaults to equal - - thirds of `0.001` (i.e. each component gets `~3.33e-4`).' -constructor: - syntax: 'ErrorBudgetPartition(logical: float = 0.0003333333333333333, t_states: - float = 0.0003333333333333333, rotations: float = 0.0003333333333333333)' - parameters: - - name: logical - description: Budget allocated to logical errors in the algorithm. - defaultValue: '0.0003333333333333333' - - name: t_states - description: Budget allocated to T-state distillation errors. - defaultValue: '0.0003333333333333333' - - name: rotations - description: Budget allocated to rotation synthesis errors. - defaultValue: '0.0003333333333333333' -attributes: -- uid: qsharp.estimator.ErrorBudgetPartition.logical - name: logical - signature: 'logical: float = 0.0003333333333333333' -- uid: qsharp.estimator.ErrorBudgetPartition.rotations - name: rotations - signature: 'rotations: float = 0.0003333333333333333' -- uid: qsharp.estimator.ErrorBudgetPartition.t_states - name: t_states - signature: 't_states: float = 0.0003333333333333333' diff --git a/python_doc/qsharp/qsharp.estimator.EstimatorConstraints.yml b/python_doc/qsharp/qsharp.estimator.EstimatorConstraints.yml deleted file mode 100644 index e335cb4dd6..0000000000 --- a/python_doc/qsharp/qsharp.estimator.EstimatorConstraints.yml +++ /dev/null @@ -1,52 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.estimator.EstimatorConstraints -name: EstimatorConstraints -fullName: qsharp.estimator.EstimatorConstraints -module: qsharp.estimator -summary: 'Optional runtime and resource constraints for resource estimation. - - - At most one of `max_duration` or `max_physical_qubits` may be set - - simultaneously.' -constructor: - syntax: 'EstimatorConstraints(logical_depth_factor: float | None = None, max_t_factories: - int | None = None, max_duration: int | None = None, max_physical_qubits: int | - None = None)' - parameters: - - name: logical_depth_factor - defaultValue: None - - name: max_t_factories - defaultValue: None - - name: max_duration - defaultValue: None - - name: max_physical_qubits - defaultValue: None -methods: -- uid: qsharp.estimator.EstimatorConstraints.at_least_one - name: at_least_one - signature: static at_least_one(name, value) - parameters: - - name: name - isRequired: true - - name: value - isRequired: true -- uid: qsharp.estimator.EstimatorConstraints.post_validation - name: post_validation - signature: post_validation(result) - parameters: - - name: result - isRequired: true -attributes: -- uid: qsharp.estimator.EstimatorConstraints.logical_depth_factor - name: logical_depth_factor - signature: 'logical_depth_factor: float | None = None' -- uid: qsharp.estimator.EstimatorConstraints.max_duration - name: max_duration - signature: 'max_duration: int | None = None' -- uid: qsharp.estimator.EstimatorConstraints.max_physical_qubits - name: max_physical_qubits - signature: 'max_physical_qubits: int | None = None' -- uid: qsharp.estimator.EstimatorConstraints.max_t_factories - name: max_t_factories - signature: 'max_t_factories: int | None = None' diff --git a/python_doc/qsharp/qsharp.estimator.EstimatorError.yml b/python_doc/qsharp/qsharp.estimator.EstimatorError.yml deleted file mode 100644 index 7421602bbb..0000000000 --- a/python_doc/qsharp/qsharp.estimator.EstimatorError.yml +++ /dev/null @@ -1,13 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.estimator.EstimatorError -name: EstimatorError -fullName: qsharp.estimator.EstimatorError -module: qsharp.estimator -summary: An error returned from the resource estimation. -constructor: - syntax: 'EstimatorError(code: str, message: str)' - parameters: - - name: code - isRequired: true - - name: message - isRequired: true diff --git a/python_doc/qsharp/qsharp.estimator.EstimatorInputParamsItem.yml b/python_doc/qsharp/qsharp.estimator.EstimatorInputParamsItem.yml deleted file mode 100644 index a587086496..0000000000 --- a/python_doc/qsharp/qsharp.estimator.EstimatorInputParamsItem.yml +++ /dev/null @@ -1,24 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.estimator.EstimatorInputParamsItem -name: EstimatorInputParamsItem -fullName: qsharp.estimator.EstimatorInputParamsItem -module: qsharp.estimator -summary: 'Input parameters for a single resource estimation job. - - - Contains qubit model, QEC scheme, distillation unit specifications, constraints, - - and error budget settings. Used directly for single-point estimation or as a - - base class for batching via .' -constructor: - syntax: EstimatorInputParamsItem() -methods: -- uid: qsharp.estimator.EstimatorInputParamsItem.as_dict - name: as_dict - signature: as_dict(validate=True, additional_params=None) -> Dict[str, Any] - parameters: - - name: validate - defaultValue: 'True' - - name: additional_params - defaultValue: None diff --git a/python_doc/qsharp/qsharp.estimator.EstimatorParams.yml b/python_doc/qsharp/qsharp.estimator.EstimatorParams.yml deleted file mode 100644 index b4d147928b..0000000000 --- a/python_doc/qsharp/qsharp.estimator.EstimatorParams.yml +++ /dev/null @@ -1,43 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.estimator.EstimatorParams -name: EstimatorParams -fullName: qsharp.estimator.EstimatorParams -module: qsharp.estimator -summary: 'Top-level input parameters for the Microsoft Resource Estimator. - - - Extends with support for batching: - pass - - `num_items` to create a batching job where each item can override the - - top-level parameters.' -constructor: - syntax: 'EstimatorParams(num_items: int | None = None)' - parameters: - - name: num_items - description: 'Number of batching items. If `None`, creates a - - single-point estimation job.' - defaultValue: None - types: - - , -methods: -- uid: qsharp.estimator.EstimatorParams.as_dict - name: as_dict - summary: 'Constructs a dictionary from the input params. - - - For batching jobs, top-level entries are merged into item entries. - - Item entries have priority in case they are specified.' - signature: as_dict(validate=True) -> Dict[str, Any] - parameters: - - name: validate - defaultValue: 'True' -attributes: -- uid: qsharp.estimator.EstimatorParams.items - name: items -- uid: qsharp.estimator.EstimatorParams.MAX_NUM_ITEMS - name: MAX_NUM_ITEMS - signature: 'MAX_NUM_ITEMS: int = 1000' diff --git a/python_doc/qsharp/qsharp.estimator.EstimatorQecScheme.yml b/python_doc/qsharp/qsharp.estimator.EstimatorQecScheme.yml deleted file mode 100644 index 4b5f85267e..0000000000 --- a/python_doc/qsharp/qsharp.estimator.EstimatorQecScheme.yml +++ /dev/null @@ -1,55 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.estimator.EstimatorQecScheme -name: EstimatorQecScheme -fullName: qsharp.estimator.EstimatorQecScheme -module: qsharp.estimator -summary: 'Quantum error correction scheme parameters for resource estimation. - - - Specify a built-in scheme by setting `name` to one of the - - constants, or define a custom scheme by setting - - the threshold and code-distance parameters directly.' -constructor: - syntax: 'EstimatorQecScheme(name: str | None = None, error_correction_threshold: - float | None = None, crossing_prefactor: float | None = None, distance_coefficient_power: - int | None = None, logical_cycle_time: str | None = None, physical_qubits_per_logical_qubit: - str | None = None, max_code_distance: int | None = None)' - parameters: - - name: name - defaultValue: None - - name: error_correction_threshold - defaultValue: None - - name: crossing_prefactor - defaultValue: None - - name: distance_coefficient_power - defaultValue: None - - name: logical_cycle_time - defaultValue: None - - name: physical_qubits_per_logical_qubit - defaultValue: None - - name: max_code_distance - defaultValue: None -attributes: -- uid: qsharp.estimator.EstimatorQecScheme.crossing_prefactor - name: crossing_prefactor - signature: 'crossing_prefactor: float | None = None' -- uid: qsharp.estimator.EstimatorQecScheme.distance_coefficient_power - name: distance_coefficient_power - signature: 'distance_coefficient_power: int | None = None' -- uid: qsharp.estimator.EstimatorQecScheme.error_correction_threshold - name: error_correction_threshold - signature: 'error_correction_threshold: float | None = None' -- uid: qsharp.estimator.EstimatorQecScheme.logical_cycle_time - name: logical_cycle_time - signature: 'logical_cycle_time: str | None = None' -- uid: qsharp.estimator.EstimatorQecScheme.max_code_distance - name: max_code_distance - signature: 'max_code_distance: int | None = None' -- uid: qsharp.estimator.EstimatorQecScheme.name - name: name - signature: 'name: str | None = None' -- uid: qsharp.estimator.EstimatorQecScheme.physical_qubits_per_logical_qubit - name: physical_qubits_per_logical_qubit - signature: 'physical_qubits_per_logical_qubit: str | None = None' diff --git a/python_doc/qsharp/qsharp.estimator.EstimatorQubitParams.yml b/python_doc/qsharp/qsharp.estimator.EstimatorQubitParams.yml deleted file mode 100644 index 4726739e3e..0000000000 --- a/python_doc/qsharp/qsharp.estimator.EstimatorQubitParams.yml +++ /dev/null @@ -1,113 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.estimator.EstimatorQubitParams -name: EstimatorQubitParams -fullName: qsharp.estimator.EstimatorQubitParams -module: qsharp.estimator -summary: 'Physical qubit parameters for resource estimation. - - - Specify a built-in qubit model by setting `name` to one of the - - constants, or fully define a custom model by - setting - - `instruction_set` and all relevant timing and error-rate fields.' -constructor: - syntax: 'EstimatorQubitParams(name: str | None = None, instruction_set: str | None - = None, one_qubit_measurement_time: str | None = None, two_qubit_joint_measurement_time: - str | None = None, one_qubit_gate_time: str | None = None, two_qubit_gate_time: - str | None = None, t_gate_time: str | None = None, one_qubit_measurement_error_rate: - None | float | MeasurementErrorRate = None, two_qubit_joint_measurement_error_rate: - None | float | MeasurementErrorRate = None, one_qubit_gate_error_rate: float | - None = None, two_qubit_gate_error_rate: float | None = None, t_gate_error_rate: - float | None = None, idle_error_rate: float | None = None)' - parameters: - - name: name - defaultValue: None - - name: instruction_set - defaultValue: None - - name: one_qubit_measurement_time - defaultValue: None - - name: two_qubit_joint_measurement_time - defaultValue: None - - name: one_qubit_gate_time - defaultValue: None - - name: two_qubit_gate_time - defaultValue: None - - name: t_gate_time - defaultValue: None - - name: one_qubit_measurement_error_rate - defaultValue: None - - name: two_qubit_joint_measurement_error_rate - defaultValue: None - - name: one_qubit_gate_error_rate - defaultValue: None - - name: two_qubit_gate_error_rate - defaultValue: None - - name: t_gate_error_rate - defaultValue: None - - name: idle_error_rate - defaultValue: None -methods: -- uid: qsharp.estimator.EstimatorQubitParams.as_dict - name: as_dict - signature: as_dict(validate=True) -> Dict[str, Any] - parameters: - - name: validate - defaultValue: 'True' -- uid: qsharp.estimator.EstimatorQubitParams.check_instruction_set - name: check_instruction_set - signature: static check_instruction_set(name, value) - parameters: - - name: name - isRequired: true - - name: value - isRequired: true -- uid: qsharp.estimator.EstimatorQubitParams.post_validation - name: post_validation - signature: post_validation(result) - parameters: - - name: result - isRequired: true -attributes: -- uid: qsharp.estimator.EstimatorQubitParams.idle_error_rate - name: idle_error_rate - signature: 'idle_error_rate: float | None = None' -- uid: qsharp.estimator.EstimatorQubitParams.instruction_set - name: instruction_set - signature: 'instruction_set: str | None = None' -- uid: qsharp.estimator.EstimatorQubitParams.name - name: name - signature: 'name: str | None = None' -- uid: qsharp.estimator.EstimatorQubitParams.one_qubit_gate_error_rate - name: one_qubit_gate_error_rate - signature: 'one_qubit_gate_error_rate: float | None = None' -- uid: qsharp.estimator.EstimatorQubitParams.one_qubit_gate_time - name: one_qubit_gate_time - signature: 'one_qubit_gate_time: str | None = None' -- uid: qsharp.estimator.EstimatorQubitParams.one_qubit_measurement_error_rate - name: one_qubit_measurement_error_rate - signature: 'one_qubit_measurement_error_rate: None | float | MeasurementErrorRate - = None' -- uid: qsharp.estimator.EstimatorQubitParams.one_qubit_measurement_time - name: one_qubit_measurement_time - signature: 'one_qubit_measurement_time: str | None = None' -- uid: qsharp.estimator.EstimatorQubitParams.t_gate_error_rate - name: t_gate_error_rate - signature: 't_gate_error_rate: float | None = None' -- uid: qsharp.estimator.EstimatorQubitParams.t_gate_time - name: t_gate_time - signature: 't_gate_time: str | None = None' -- uid: qsharp.estimator.EstimatorQubitParams.two_qubit_gate_error_rate - name: two_qubit_gate_error_rate - signature: 'two_qubit_gate_error_rate: float | None = None' -- uid: qsharp.estimator.EstimatorQubitParams.two_qubit_gate_time - name: two_qubit_gate_time - signature: 'two_qubit_gate_time: str | None = None' -- uid: qsharp.estimator.EstimatorQubitParams.two_qubit_joint_measurement_error_rate - name: two_qubit_joint_measurement_error_rate - signature: 'two_qubit_joint_measurement_error_rate: None | float | MeasurementErrorRate - = None' -- uid: qsharp.estimator.EstimatorQubitParams.two_qubit_joint_measurement_time - name: two_qubit_joint_measurement_time - signature: 'two_qubit_joint_measurement_time: str | None = None' diff --git a/python_doc/qsharp/qsharp.estimator.EstimatorResult.yml b/python_doc/qsharp/qsharp.estimator.EstimatorResult.yml deleted file mode 100644 index 8431af3345..0000000000 --- a/python_doc/qsharp/qsharp.estimator.EstimatorResult.yml +++ /dev/null @@ -1,44 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.estimator.EstimatorResult -name: EstimatorResult -fullName: qsharp.estimator.EstimatorResult -module: qsharp.estimator -summary: 'Microsoft Resource Estimator result. - - - The class represents simple resource estimation results as well as batching - - resource estimation results. The latter can be indexed by an integer index to - - access an individual result from the batching result.' -constructor: - syntax: 'EstimatorResult(data: Dict | List)' - parameters: - - name: data - isRequired: true -methods: -- uid: qsharp.estimator.EstimatorResult.data - name: data - summary: 'Returns raw data of the result object. - - - In case of a batching job, you can pass an index to access a specific - - item.' - signature: 'data(idx: int | None = None) -> Any' - parameters: - - name: idx - defaultValue: None -attributes: -- uid: qsharp.estimator.EstimatorResult.error - name: error - summary: Returns the error object if the result is an error. -- uid: qsharp.estimator.EstimatorResult.json - name: json - summary: Returns a JSON representation of the resource estimation result data. -- uid: qsharp.estimator.EstimatorResult.logical_counts - name: logical_counts - summary: Returns the logical counts of the result. -- uid: qsharp.estimator.EstimatorResult.MAX_DEFAULT_ITEMS_IN_TABLE - name: MAX_DEFAULT_ITEMS_IN_TABLE - signature: MAX_DEFAULT_ITEMS_IN_TABLE = 5 diff --git a/python_doc/qsharp/qsharp.estimator.LogicalCounts.yml b/python_doc/qsharp/qsharp.estimator.LogicalCounts.yml deleted file mode 100644 index 3e9d5c186c..0000000000 --- a/python_doc/qsharp/qsharp.estimator.LogicalCounts.yml +++ /dev/null @@ -1,36 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.estimator.LogicalCounts -name: LogicalCounts -fullName: qsharp.estimator.LogicalCounts -module: qsharp.estimator -summary: 'Microsoft Resource Estimator Logical Counts. - - - The class represents logical counts that can be used as input to physical estimation - of resources - - in the Microsoft Resource Estimator.' -constructor: - syntax: 'LogicalCounts(data: Dict)' - parameters: - - name: data - isRequired: true -methods: -- uid: qsharp.estimator.LogicalCounts.estimate - name: estimate - summary: 'Estimates resources for the current logical counts, using the - - Parallel Synthesis Sequential Pauli Computation (PSSPC) layout method.' - signature: 'estimate(params: dict | List | EstimatorParams = None) -> EstimatorResult' - parameters: - - name: params - description: The parameters to configure physical estimation. - defaultValue: None - return: - description: The estimated resources. - types: - - -attributes: -- uid: qsharp.estimator.LogicalCounts.json - name: json - summary: Returns a JSON representation of the logical counts. diff --git a/python_doc/qsharp/qsharp.estimator.MeasurementErrorRate.yml b/python_doc/qsharp/qsharp.estimator.MeasurementErrorRate.yml deleted file mode 100644 index 0ff25baf56..0000000000 --- a/python_doc/qsharp/qsharp.estimator.MeasurementErrorRate.yml +++ /dev/null @@ -1,29 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.estimator.MeasurementErrorRate -name: MeasurementErrorRate -fullName: qsharp.estimator.MeasurementErrorRate -module: qsharp.estimator -summary: 'Measurement error rate specified separately for process and readout errors. - - - Used as the value of `one_qubit_measurement_error_rate` or - - `two_qubit_joint_measurement_error_rate` in - - when process and readout error rates differ.' -constructor: - syntax: 'MeasurementErrorRate(process: float, readout: float)' - parameters: - - name: process - description: Error rate during the measurement process. Must be in `(0, 1)`. - isRequired: true - - name: readout - description: Error rate during readout. Must be in `(0, 1)`. - isRequired: true -attributes: -- uid: qsharp.estimator.MeasurementErrorRate.process - name: process - signature: 'process: float' -- uid: qsharp.estimator.MeasurementErrorRate.readout - name: readout - signature: 'readout: float' diff --git a/python_doc/qsharp/qsharp.estimator.ProtocolSpecificDistillationUnitSpecification.yml b/python_doc/qsharp/qsharp.estimator.ProtocolSpecificDistillationUnitSpecification.yml deleted file mode 100644 index 8f7462b961..0000000000 --- a/python_doc/qsharp/qsharp.estimator.ProtocolSpecificDistillationUnitSpecification.yml +++ /dev/null @@ -1,33 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.estimator.ProtocolSpecificDistillationUnitSpecification -name: ProtocolSpecificDistillationUnitSpecification -fullName: qsharp.estimator.ProtocolSpecificDistillationUnitSpecification -module: qsharp.estimator -summary: 'Protocol-specific specification for a magic-state distillation unit. - - - Defines the number of physical qubits and the duration (in logical cycle - - time units) for one round of distillation under a specific QEC code.' -constructor: - syntax: 'ProtocolSpecificDistillationUnitSpecification(num_unit_qubits: int | None - = None, duration_in_qubit_cycle_time: int | None = None)' - parameters: - - name: num_unit_qubits - defaultValue: None - - name: duration_in_qubit_cycle_time - defaultValue: None -methods: -- uid: qsharp.estimator.ProtocolSpecificDistillationUnitSpecification.post_validation - name: post_validation - signature: post_validation(result) - parameters: - - name: result - isRequired: true -attributes: -- uid: qsharp.estimator.ProtocolSpecificDistillationUnitSpecification.duration_in_qubit_cycle_time - name: duration_in_qubit_cycle_time - signature: 'duration_in_qubit_cycle_time: int | None = None' -- uid: qsharp.estimator.ProtocolSpecificDistillationUnitSpecification.num_unit_qubits - name: num_unit_qubits - signature: 'num_unit_qubits: int | None = None' diff --git a/python_doc/qsharp/qsharp.estimator.QECScheme.yml b/python_doc/qsharp/qsharp.estimator.QECScheme.yml deleted file mode 100644 index d7e21f1fb2..0000000000 --- a/python_doc/qsharp/qsharp.estimator.QECScheme.yml +++ /dev/null @@ -1,22 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.estimator.QECScheme -name: QECScheme -fullName: qsharp.estimator.QECScheme -module: qsharp.estimator -summary: 'Predefined quantum error correction scheme name constants for use with - - . - - - Pass one of these string constants as the `name` field to select a - - built-in QEC scheme for resource estimation.' -constructor: - syntax: QECScheme() -attributes: -- uid: qsharp.estimator.QECScheme.FLOQUET_CODE - name: FLOQUET_CODE - signature: FLOQUET_CODE = 'floquet_code' -- uid: qsharp.estimator.QECScheme.SURFACE_CODE - name: SURFACE_CODE - signature: SURFACE_CODE = 'surface_code' diff --git a/python_doc/qsharp/qsharp.estimator.QubitParams.yml b/python_doc/qsharp/qsharp.estimator.QubitParams.yml deleted file mode 100644 index 57e3769c50..0000000000 --- a/python_doc/qsharp/qsharp.estimator.QubitParams.yml +++ /dev/null @@ -1,32 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.estimator.QubitParams -name: QubitParams -fullName: qsharp.estimator.QubitParams -module: qsharp.estimator -summary: 'Predefined qubit model name constants for use with . - - - Pass one of these string constants as the `name` field to select a built-in - - qubit model for resource estimation.' -constructor: - syntax: QubitParams() -attributes: -- uid: qsharp.estimator.QubitParams.GATE_NS_E3 - name: GATE_NS_E3 - signature: GATE_NS_E3 = 'qubit_gate_ns_e3' -- uid: qsharp.estimator.QubitParams.GATE_NS_E4 - name: GATE_NS_E4 - signature: GATE_NS_E4 = 'qubit_gate_ns_e4' -- uid: qsharp.estimator.QubitParams.GATE_US_E3 - name: GATE_US_E3 - signature: GATE_US_E3 = 'qubit_gate_us_e3' -- uid: qsharp.estimator.QubitParams.GATE_US_E4 - name: GATE_US_E4 - signature: GATE_US_E4 = 'qubit_gate_us_e4' -- uid: qsharp.estimator.QubitParams.MAJ_NS_E4 - name: MAJ_NS_E4 - signature: MAJ_NS_E4 = 'qubit_maj_ns_e4' -- uid: qsharp.estimator.QubitParams.MAJ_NS_E6 - name: MAJ_NS_E6 - signature: MAJ_NS_E6 = 'qubit_maj_ns_e6' diff --git a/python_doc/qsharp/qsharp.estimator.yml b/python_doc/qsharp/qsharp.estimator.yml deleted file mode 100644 index b98ebc5f96..0000000000 --- a/python_doc/qsharp/qsharp.estimator.yml +++ /dev/null @@ -1,20 +0,0 @@ -### YamlMime:PythonPackage -uid: qsharp.estimator -name: estimator -fullName: qsharp.estimator -type: import -classes: -- qsharp.estimator.DistillationUnitSpecification -- qsharp.estimator.ErrorBudgetPartition -- qsharp.estimator.EstimatorConstraints -- qsharp.estimator.EstimatorError -- qsharp.estimator.EstimatorInputParamsItem -- qsharp.estimator.EstimatorParams -- qsharp.estimator.EstimatorQecScheme -- qsharp.estimator.EstimatorQubitParams -- qsharp.estimator.EstimatorResult -- qsharp.estimator.LogicalCounts -- qsharp.estimator.MeasurementErrorRate -- qsharp.estimator.ProtocolSpecificDistillationUnitSpecification -- qsharp.estimator.QECScheme -- qsharp.estimator.QubitParams diff --git a/python_doc/qsharp/qsharp.interop.cirq.NeutralAtomCirqResult.yml b/python_doc/qsharp/qsharp.interop.cirq.NeutralAtomCirqResult.yml deleted file mode 100644 index 2074b58484..0000000000 --- a/python_doc/qsharp/qsharp.interop.cirq.NeutralAtomCirqResult.yml +++ /dev/null @@ -1,64 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.interop.cirq.NeutralAtomCirqResult -name: NeutralAtomCirqResult -fullName: qsharp.interop.cirq.NeutralAtomCirqResult -module: qsharp.interop.cirq -summary: 'A `cirq.ResultDict` that also carries raw (loss-inclusive) shot data. - - - The inherited `measurements` field contains only *accepted* shots - those - - where every measured qubit returned a clean `{0, 1}` outcome. Shots in - - which one or more qubits were lost during the simulation are excluded from - - `measurements` but are preserved in `raw_shots`. - - - The `raw_shots` attribute holds the full list of simulation results, one - - entry per shot, in the native simulator output format (tuple, list, or - - scalar). This includes shots that contain qubit-loss markers. - - - Use to retrieve - the full per-shot data (including - - loss markers) in the same `{key: 2D-array (shots x bits)}` format as - - `measurements`, but with Unicode string dtype so that non-binary markers - - are preserved.' -constructor: - syntax: 'NeutralAtomCirqResult(*, params: ParamResolver, measurements: Dict[str, - ndarray], raw_shots: List[Any], measurement_dict: Dict[str, Sequence[int]])' - keywordOnlyParameters: - - name: params - isRequired: true - - name: measurements - isRequired: true - - name: raw_shots - isRequired: true - - name: measurement_dict - isRequired: true -methods: -- uid: qsharp.interop.cirq.NeutralAtomCirqResult.raw_measurements - name: raw_measurements - summary: 'Return unfiltered per-shot measurement symbols including loss markers. - - - The structure mirrors `measurements`: `{key: 2D array (shots x bits)}`, - - but the array dtype is `" Dict[str, Any] -attributes: -- uid: qsharp.interop.cirq.NeutralAtomCirqResult.raw_shots - name: raw_shots diff --git a/python_doc/qsharp/qsharp.interop.cirq.NeutralAtomSampler.yml b/python_doc/qsharp/qsharp.interop.cirq.NeutralAtomSampler.yml deleted file mode 100644 index 25f4f39d50..0000000000 --- a/python_doc/qsharp/qsharp.interop.cirq.NeutralAtomSampler.yml +++ /dev/null @@ -1,115 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.interop.cirq.NeutralAtomSampler -name: NeutralAtomSampler -fullName: qsharp.interop.cirq.NeutralAtomSampler -module: qsharp.interop.cirq -summary: "A `cirq.Sampler` that runs Cirq circuits on the local NeutralAtomDevice\ - \ simulator.\n\nThis sampler integrates with the standard Cirq sampler protocol,\ - \ so it can\nbe used anywhere a `cirq.Sampler` is expected.\n\nPipeline for each\ - \ `run()` call:\n\n1. `cirq.Circuit.to_qasm(version=\"3.0\")` \u2192 OpenQASM 3.0\ - \ \n\n2. OpenQASM 3.0 \u2192 QIR (base profile, via the Q# compiler) \n\n3. QIR\ - \ \u2192 `NeutralAtomDevice.simulate()` (decompose, schedule, simulate) \n\n4. Raw\ - \ shots \u2192 \n\nExample:\n\n\ - \n\n````default\n\n import cirq\n from qsharp.interop.cirq\ - \ import NeutralAtomSampler\n from qsharp._simulation import NoiseConfig\n\n \ - \ q0, q1 = cirq.LineQubit.range(2)\n circuit = cirq.Circuit([\n cirq.H(q0),\n\ - \ cirq.CNOT(q0, q1),\n cirq.measure(q0, q1, key=\"m\"),\n ])\n\n \ - \ # Noiseless simulation\n sampler = NeutralAtomSampler(seed=42)\n result =\ - \ sampler.run(circuit, repetitions=1000)\n print(result.histogram(key=\"m\"))\n\ - \n # Noisy simulation \u2014 1% loss on Rz (native gate)\n noise = NoiseConfig()\n\ - \ noise.rz.loss = 0.01\n sampler = NeutralAtomSampler(noise=noise, seed=42)\n\ - \ result = sampler.run(circuit, repetitions=1000)\n print(f\"Accepted: {len(result.measurements['m'])}\ - \ / {len(result.raw_shots)}\")\n ````" -constructor: - syntax: 'NeutralAtomSampler(*, noise: ''NoiseConfig'' | None = None, simulator_type: - str | None = None, seed: int | None = None, device: ''NeutralAtomDevice'' | None - = None)' - parameters: - - name: noise - description: "Optional describing\nper-gate\ - \ noise. The device decomposes gates to the native set\n`{Rz, SX, CZ, MResetZ}`;\ - \ configure noise on those native gates.\nFor example, a Cirq `X` gate arriving\ - \ via QASM 2.0 is decomposed\nto `SX\xB7SX`, so `noise.sx` is the relevant field.\ - \ Defaults to\n`None` (noiseless)." - isRequired: true - - name: simulator_type - description: "Force a particular simulator backend.\n`\"clifford\"` \u2014 Clifford-only,\ - \ fast. Requires a Clifford circuit.\n`\"cpu\"` \u2014 Full state-vector on\ - \ CPU.\n`\"gpu\"` \u2014 Full state-vector on GPU.\n`None` (default) \u2014\ - \ GPU if available, CPU otherwise." - isRequired: true - - name: seed - description: Optional integer seed for reproducibility. Defaults to `None`. - isRequired: true - - name: device - description: 'An existing - - instance to reuse across calls. A default-configured device is - - created lazily on the first call when not provided.' - isRequired: true - keywordOnlyParameters: - - name: noise - defaultValue: None - - name: simulator_type - defaultValue: None - - name: seed - defaultValue: None - - name: device - defaultValue: None -methods: -- uid: qsharp.interop.cirq.NeutralAtomSampler.run_sweep - name: run_sweep - summary: Run the circuit for each parameter resolver in the sweep. - signature: 'run_sweep(program: AbstractCircuit, params: ParamResolver | Mapping[str - | Expr, complex | number | Expr] | None | Sweep | _Sweepable, repetitions: int - = 1) -> List[NeutralAtomCirqResult]' - parameters: - - name: program - description: The Cirq circuit to simulate. - isRequired: true - types: - - - - name: params - description: 'A defining the parameter resolvers - - to sweep over. Each resolver produces one result.' - isRequired: true - types: - - - - name: repetitions - description: Number of shots per parameter resolver. - defaultValue: '1' - types: - - - return: - description: A list of objects, - one per resolver. - types: - - [] -- uid: qsharp.interop.cirq.NeutralAtomSampler.run_sweep_async - name: run_sweep_async - summary: 'Asynchronously samples from the given Circuit. - - - By default, this method invokes *run_sweep* synchronously and simply - - exposes its result is an awaitable. Child classes that are capable of - - true asynchronous sampling should override it to use other strategies.' - signature: 'run_sweep_async(program: cirq.AbstractCircuit, params: cirq.Sweepable, - repetitions: int = 1) -> Sequence[cirq.Result]' - parameters: - - name: program - description: The circuit to sample from. - isRequired: true - - name: params - description: Parameters to run with the program. - isRequired: true - - name: repetitions - description: The number of times to sample. - defaultValue: '1' - return: - description: Result list for this run; one for each possible parameter resolver. diff --git a/python_doc/qsharp/qsharp.interop.cirq.yml b/python_doc/qsharp/qsharp.interop.cirq.yml deleted file mode 100644 index e670224945..0000000000 --- a/python_doc/qsharp/qsharp.interop.cirq.yml +++ /dev/null @@ -1,16 +0,0 @@ -### YamlMime:PythonPackage -uid: qsharp.interop.cirq -name: cirq -fullName: qsharp.interop.cirq -summary: "Cirq interoperability for the Q# ecosystem.\n\n\nThis module provides a\ - \ \u2014 a standard\n``cirq.Sampler`` that runs Cirq circuits\ - \ on the local NeutralAtomDevice\nsimulator.\n\n\nUsage::\n\n\n import cirq\n\ - \ from qsharp.interop.cirq import NeutralAtomSampler\n\n\n q0, q1 = cirq.LineQubit.range(2)\n\ - \ circuit = cirq.Circuit([\n cirq.H(q0),\n cirq.CNOT(q0, q1),\n\ - \ cirq.measure(q0, q1, key=\"m\"),\n ])\n\n\n sampler = NeutralAtomSampler(seed=42)\n\ - \ result = sampler.run(circuit, repetitions=1000)\n print(result.histogram(key=\"\ - m\"))" -type: import -classes: -- qsharp.interop.cirq.NeutralAtomCirqResult -- qsharp.interop.cirq.NeutralAtomSampler diff --git a/python_doc/qsharp/qsharp.interop.yml b/python_doc/qsharp/qsharp.interop.yml deleted file mode 100644 index dced329699..0000000000 --- a/python_doc/qsharp/qsharp.interop.yml +++ /dev/null @@ -1,7 +0,0 @@ -### YamlMime:PythonPackage -uid: qsharp.interop -name: interop -fullName: qsharp.interop -type: import -packages: -- qsharp.interop.cirq diff --git a/python_doc/qsharp/qsharp.noisy_simulator.DensityMatrixSimulator.yml b/python_doc/qsharp/qsharp.noisy_simulator.DensityMatrixSimulator.yml deleted file mode 100644 index f84ef041d7..0000000000 --- a/python_doc/qsharp/qsharp.noisy_simulator.DensityMatrixSimulator.yml +++ /dev/null @@ -1,63 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.noisy_simulator.DensityMatrixSimulator -name: DensityMatrixSimulator -fullName: qsharp.noisy_simulator.DensityMatrixSimulator -module: qsharp.noisy_simulator -constructor: - syntax: DensityMatrixSimulator(number_of_qubits, seed=None) - parameters: - - name: number_of_qubits - isRequired: true - - name: seed - defaultValue: None -methods: -- uid: qsharp.noisy_simulator.DensityMatrixSimulator.apply_instrument - name: apply_instrument - summary: Apply non selective evolution. - signature: apply_instrument(instrument, qubits) - parameters: - - name: instrument - isRequired: true - - name: qubits - isRequired: true -- uid: qsharp.noisy_simulator.DensityMatrixSimulator.apply_operation - name: apply_operation - summary: Apply an arbitrary operation to given qubit ids. - signature: apply_operation(operation, qubits) - parameters: - - name: operation - isRequired: true - - name: qubits - isRequired: true -- uid: qsharp.noisy_simulator.DensityMatrixSimulator.get_state - name: get_state - summary: Returns the *DensityMatrix* if the simulator is in a valid state. - signature: get_state() -- uid: qsharp.noisy_simulator.DensityMatrixSimulator.sample_instrument - name: sample_instrument - summary: 'Performs selective evolution under the given instrument. - - Returns the index of the observed outcome. - - - Use this method to perform measurements on the quantum system.' - signature: sample_instrument(instrument, qubits) - parameters: - - name: instrument - isRequired: true - - name: qubits - isRequired: true -- uid: qsharp.noisy_simulator.DensityMatrixSimulator.set_state - name: set_state - summary: Set state of the quantum system. - signature: set_state(state) - parameters: - - name: state - isRequired: true -- uid: qsharp.noisy_simulator.DensityMatrixSimulator.set_trace - name: set_trace - summary: Set the trace of the quantum system. - signature: set_trace(trace) - parameters: - - name: trace - isRequired: true diff --git a/python_doc/qsharp/qsharp.noisy_simulator.Instrument.yml b/python_doc/qsharp/qsharp.noisy_simulator.Instrument.yml deleted file mode 100644 index 0e910a4c99..0000000000 --- a/python_doc/qsharp/qsharp.noisy_simulator.Instrument.yml +++ /dev/null @@ -1,10 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.noisy_simulator.Instrument -name: Instrument -fullName: qsharp.noisy_simulator.Instrument -module: qsharp.noisy_simulator -constructor: - syntax: Instrument(operations) - parameters: - - name: operations - isRequired: true diff --git a/python_doc/qsharp/qsharp.noisy_simulator.NoisySimulatorError.yml b/python_doc/qsharp/qsharp.noisy_simulator.NoisySimulatorError.yml deleted file mode 100644 index 54718226d1..0000000000 --- a/python_doc/qsharp/qsharp.noisy_simulator.NoisySimulatorError.yml +++ /dev/null @@ -1,7 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.noisy_simulator.NoisySimulatorError -name: NoisySimulatorError -fullName: qsharp.noisy_simulator.NoisySimulatorError -module: qsharp.noisy_simulator -constructor: - syntax: NoisySimulatorError() diff --git a/python_doc/qsharp/qsharp.noisy_simulator.Operation.yml b/python_doc/qsharp/qsharp.noisy_simulator.Operation.yml deleted file mode 100644 index 8e946f336c..0000000000 --- a/python_doc/qsharp/qsharp.noisy_simulator.Operation.yml +++ /dev/null @@ -1,23 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.noisy_simulator.Operation -name: Operation -fullName: qsharp.noisy_simulator.Operation -module: qsharp.noisy_simulator -constructor: - syntax: Operation(kraus_operators) - parameters: - - name: kraus_operators - isRequired: true -methods: -- uid: qsharp.noisy_simulator.Operation.get_effect_matrix - name: get_effect_matrix - signature: get_effect_matrix() -- uid: qsharp.noisy_simulator.Operation.get_kraus_operators - name: get_kraus_operators - signature: get_kraus_operators() -- uid: qsharp.noisy_simulator.Operation.get_number_of_qubits - name: get_number_of_qubits - signature: get_number_of_qubits() -- uid: qsharp.noisy_simulator.Operation.get_operation_matrix - name: get_operation_matrix - signature: get_operation_matrix() diff --git a/python_doc/qsharp/qsharp.noisy_simulator.StateVectorSimulator.yml b/python_doc/qsharp/qsharp.noisy_simulator.StateVectorSimulator.yml deleted file mode 100644 index 0671ac35b0..0000000000 --- a/python_doc/qsharp/qsharp.noisy_simulator.StateVectorSimulator.yml +++ /dev/null @@ -1,63 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.noisy_simulator.StateVectorSimulator -name: StateVectorSimulator -fullName: qsharp.noisy_simulator.StateVectorSimulator -module: qsharp.noisy_simulator -constructor: - syntax: StateVectorSimulator(number_of_qubits, seed=None) - parameters: - - name: number_of_qubits - isRequired: true - - name: seed - defaultValue: None -methods: -- uid: qsharp.noisy_simulator.StateVectorSimulator.apply_instrument - name: apply_instrument - summary: Apply non selective evolution. - signature: apply_instrument(instrument, qubits) - parameters: - - name: instrument - isRequired: true - - name: qubits - isRequired: true -- uid: qsharp.noisy_simulator.StateVectorSimulator.apply_operation - name: apply_operation - summary: Apply an arbitrary operation to given qubit ids. - signature: apply_operation(operation, qubits) - parameters: - - name: operation - isRequired: true - - name: qubits - isRequired: true -- uid: qsharp.noisy_simulator.StateVectorSimulator.get_state - name: get_state - summary: Returns the *StateVector* if the simulator is in a valid state. - signature: get_state() -- uid: qsharp.noisy_simulator.StateVectorSimulator.sample_instrument - name: sample_instrument - summary: 'Performs selective evolution under the given instrument. - - Returns the index of the observed outcome. - - - Use this method to perform measurements on the quantum system.' - signature: sample_instrument(instrument, qubits) - parameters: - - name: instrument - isRequired: true - - name: qubits - isRequired: true -- uid: qsharp.noisy_simulator.StateVectorSimulator.set_state - name: set_state - summary: Set state of the quantum system. - signature: set_state(state) - parameters: - - name: state - isRequired: true -- uid: qsharp.noisy_simulator.StateVectorSimulator.set_trace - name: set_trace - summary: Set the trace of the quantum system. - signature: set_trace(trace) - parameters: - - name: trace - isRequired: true diff --git a/python_doc/qsharp/qsharp.noisy_simulator.yml b/python_doc/qsharp/qsharp.noisy_simulator.yml deleted file mode 100644 index b87bf0c12a..0000000000 --- a/python_doc/qsharp/qsharp.noisy_simulator.yml +++ /dev/null @@ -1,11 +0,0 @@ -### YamlMime:PythonPackage -uid: qsharp.noisy_simulator -name: noisy_simulator -fullName: qsharp.noisy_simulator -type: import -classes: -- qsharp.noisy_simulator.DensityMatrixSimulator -- qsharp.noisy_simulator.Instrument -- qsharp.noisy_simulator.NoisySimulatorError -- qsharp.noisy_simulator.Operation -- qsharp.noisy_simulator.StateVectorSimulator diff --git a/python_doc/qsharp/qsharp.openqasm.OutputSemantics.yml b/python_doc/qsharp/qsharp.openqasm.OutputSemantics.yml deleted file mode 100644 index 3fee1c5398..0000000000 --- a/python_doc/qsharp/qsharp.openqasm.OutputSemantics.yml +++ /dev/null @@ -1,22 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.openqasm.OutputSemantics -name: OutputSemantics -fullName: qsharp.openqasm.OutputSemantics -module: qsharp.openqasm -summary: 'Represents the output semantics for OpenQASM 3 compilation. - - Each has implications on the output of the compilation - - and the semantic checks that are performed.' -constructor: - syntax: OutputSemantics() -attributes: -- uid: qsharp.openqasm.OutputSemantics.OpenQasm - name: OpenQasm - signature: OpenQasm = OutputSemantics.OpenQasm -- uid: qsharp.openqasm.OutputSemantics.Qiskit - name: Qiskit - signature: Qiskit = OutputSemantics.Qiskit -- uid: qsharp.openqasm.OutputSemantics.ResourceEstimation - name: ResourceEstimation - signature: ResourceEstimation = OutputSemantics.ResourceEstimation diff --git a/python_doc/qsharp/qsharp.openqasm.ProgramType.yml b/python_doc/qsharp/qsharp.openqasm.ProgramType.yml deleted file mode 100644 index 0a2ab7c23c..0000000000 --- a/python_doc/qsharp/qsharp.openqasm.ProgramType.yml +++ /dev/null @@ -1,18 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.openqasm.ProgramType -name: ProgramType -fullName: qsharp.openqasm.ProgramType -module: qsharp.openqasm -summary: Represents the type of compilation output to create -constructor: - syntax: ProgramType() -attributes: -- uid: qsharp.openqasm.ProgramType.File - name: File - signature: File = ProgramType.File -- uid: qsharp.openqasm.ProgramType.Fragments - name: Fragments - signature: Fragments = ProgramType.Fragments -- uid: qsharp.openqasm.ProgramType.Operation - name: Operation - signature: Operation = ProgramType.Operation diff --git a/python_doc/qsharp/qsharp.openqasm.QasmError.yml b/python_doc/qsharp/qsharp.openqasm.QasmError.yml deleted file mode 100644 index 6fe0e33c36..0000000000 --- a/python_doc/qsharp/qsharp.openqasm.QasmError.yml +++ /dev/null @@ -1,8 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.openqasm.QasmError -name: QasmError -fullName: qsharp.openqasm.QasmError -module: qsharp.openqasm -summary: An error returned from the OpenQASM parser. -constructor: - syntax: QasmError() diff --git a/python_doc/qsharp/qsharp.openqasm.yml b/python_doc/qsharp/qsharp.openqasm.yml deleted file mode 100644 index 63dfb2f414..0000000000 --- a/python_doc/qsharp/qsharp.openqasm.yml +++ /dev/null @@ -1,306 +0,0 @@ -### YamlMime:PythonPackage -uid: qsharp.openqasm -name: openqasm -fullName: qsharp.openqasm -type: import -functions: -- uid: qsharp.openqasm.circuit - name: circuit - summary: 'Synthesizes a circuit for an OpenQASM program. Either a program string - or - - an operation must be provided.' - signature: 'circuit(source: str | Callable | None = None, *args, **kwargs: Any) - -> Circuit' - parameters: - - name: source - description: 'An OpenQASM program. Alternatively, a callable can be provided, - - which must be an already imported global callable.' - defaultValue: None - types: - - , - - name: '*args' - description: The arguments to pass to the callable, if one is provided. - isRequired: true - - name: generation_method - description: 'The method to use for circuit generation. - - `CircuitGenerationMethod.ClassicalEval` evaluates classical control flow at - circuit - - generation time. `CircuitGenerationMethod.Simulate` runs a full simulation to - trace - - the circuit. `CircuitGenerationMethod.Static` uses partial evaluation and requires - - a non-`Unrestricted` target profile. Defaults to `None` (auto-selected).' - isRequired: true - - name: max_operations - description: 'The maximum number of operations to include in the circuit. - - Defaults to `None` (no limit).' - isRequired: true - - name: source_locations - description: 'If `True`, annotates each gate with its source location. - - Defaults to `False`.' - isRequired: true - - name: group_by_scope - description: 'If `True`, groups operations by their Q# scope. - - Defaults to `True`.' - isRequired: true - - name: prune_classical_qubits - description: 'If `True`, removes qubits that are never used in a quantum - - gate. Defaults to `False`.' - isRequired: true - - name: '**kwargs' - description: "Additional keyword arguments. Common options:\n\n* `name` (str):\ - \ The name of the program. This is used as the entry point for the program.\ - \ \n\n* `search_path` (str): The optional search path for resolving file references." - isRequired: true - return: - description: The synthesized circuit. - types: - - - exceptions: - - type: qsharp.openqasm.QasmError - description: If there is an error generating, parsing, or analyzing the OpenQASM - source. - - type: qsharp.QSharpError - description: If there is an error evaluating or synthesizing the circuit. -- uid: qsharp.openqasm.compile - name: compile - summary: 'Compiles the OpenQASM source code into a program that can be submitted - to a - - target as QIR (Quantum Intermediate Representation). - - Either a full program or a callable with arguments must be provided. - - - Example:' - signature: 'compile(source: str | Callable, *args: Any, **kwargs: Any) -> QirInputData' - parameters: - - name: source - description: 'An OpenQASM program. Alternatively, a callable can be provided, - - which must be an already imported global callable.' - isRequired: true - types: - - - - name: '*args' - description: The arguments to pass to the callable, if one is provided. - isRequired: true - - name: '**kwargs' - description: "Additional keyword arguments for compiling the source program. Common\ - \ options:\n\n* `name` (str): The name of the circuit. This is used as the entry\ - \ point for the program. \n\n* `target_profile` (TargetProfile): The target\ - \ profile to use for code generation. \n\n* `search_path` (str): The optional\ - \ search path for resolving file references. \n\n* `output_semantics` (OutputSemantics):\ - \ The output semantics for the compilation." - isRequired: true - return: - description: The compiled program. Use `str()` to get the QIR string. - types: - - - exceptions: - - type: qsharp.openqasm.QasmError - description: If there is an error generating, parsing, or analyzing the OpenQASM - source. - - type: qsharp.QSharpError - description: If there is an error compiling the program. -- uid: qsharp.openqasm.estimate - name: estimate - summary: 'Estimates the resource requirements for executing OpenQASM source code. - - Either a full program or a callable with arguments must be provided.' - signature: 'estimate(source: str | Callable, params: Dict[str, Any] | List | EstimatorParams - | None = None, *args: Any, **kwargs: Any) -> EstimatorResult' - parameters: - - name: source - description: 'An OpenQASM program. Alternatively, a callable can be provided, - - which must be an already imported global callable.' - isRequired: true - types: - - - - name: params - description: The parameters to configure estimation. - defaultValue: None - types: - - , - - , - - name: '*args' - description: The arguments to pass to the callable, if one is provided. - isRequired: true - - name: '**kwargs' - description: "Additional keyword arguments. Common options:\n\n* `name` (str):\ - \ The name of the circuit. This is used as the entry point for the program.\ - \ Defaults to `'program'`. \n\n* `search_path` (str): The optional search path\ - \ for resolving imports." - isRequired: true - return: - description: The estimated resources. - types: - - - exceptions: - - type: qsharp.openqasm.QasmError - description: If there is an error generating, parsing, or analyzing the OpenQASM - source. - - type: qsharp.QSharpError - description: If there is an error compiling the program. -- uid: qsharp.openqasm.import_openqasm - name: import_openqasm - summary: 'Imports OpenQASM source code into the active QDK interpreter. By default, - import uses `ProgramType.Operation` - - such that the source becomes a Q# operation in the global namespace with parameters - for any declared classical - - inputs and parameters for each of the declared qubits, while any explicit or implicit - output declarations become - - the return type of the operation. - - Alternatively, specifying `ProgramType.File` will treat the input source as a - stand-alone program and create - - an operation in the `qasm_import` namespace that only takes classical parameters, - allocates the required qubits - - internally and releases them at the end of the operation. - - Finally, using `ProgramType.Fragments` executes the provided source in the current - interactive interpreter, - - defining any declared variables or operations in the current scope and returning - the value of the last statement - - in the source.' - signature: 'import_openqasm(source: str, **kwargs: Any) -> Any' - parameters: - - name: source - description: An OpenQASM program or fragment. - isRequired: true - types: - - - - name: '**kwargs' - description: "Additional keyword arguments. Common options:\n\n* `name` (str):\ - \ The name of the program. This is used as the entry point for the program.\ - \ \n\n* `search_path` (str): The optional search path for resolving file references.\ - \ \n\n* `output_semantics` (OutputSemantics): The output semantics for the compilation.\ - \ \n\n* `program_type` (ProgramType): The type of program compilation to perform.\ - \ Defaults to `ProgramType.Operation`." - isRequired: true - return: - description: The value returned by the last statement in the source code. - types: - - - exceptions: - - type: qsharp.openqasm.QasmError - description: If there is an error generating, parsing, or analyzing the OpenQASM - source. - - type: qsharp.QSharpError - description: If there is an error compiling the program. -- uid: qsharp.openqasm.run - name: run - summary: 'Runs the given OpenQASM program for the given number of shots. - - Either a full program or a callable with arguments must be provided. - - Each shot uses an independent instance of the simulator.' - signature: 'run(source: str | Callable, shots: int = 1024, *args: Any, on_result: - Callable[[ShotResult], None] | None = None, save_events: bool = False, noise: - Tuple[float, float, float] | PauliNoise | BitFlipNoise | PhaseFlipNoise | DepolarizingNoise - | NoiseConfig | None = None, qubit_loss: float | None = None, as_bitstring: bool - = False, **kwargs: Any) -> List[Any]' - parameters: - - name: source - description: 'An OpenQASM program. Alternatively, a callable can be provided, - - which must be an already imported global callable.' - isRequired: true - types: - - - - name: shots - description: The number of shots to run. Defaults to `1024`. - defaultValue: '1024' - types: - - - - name: '*args' - description: The arguments to pass to the callable, if one is provided. - isRequired: true - - name: on_result - description: 'A callback function that will be called with each result. - - Only used when a callable is provided.' - isRequired: true - types: - - , - - name: save_events - description: 'If true, the output of each shot will be saved. If false, they will - be printed. - - Only used when a callable is provided.' - isRequired: true - types: - - - - name: noise - description: The noise to use in simulation. - isRequired: true - types: - - [[, , ], - , , , - , ], - - name: qubit_loss - description: The probability of qubit loss in simulation. - isRequired: true - types: - - , - - name: as_bitstring - description: If true, the result registers will be converted to bitstrings. - isRequired: true - types: - - - - name: '**kwargs' - description: "Additional keyword arguments for compiling the source program. Common\ - \ options:\n\n* `name` (str): The name of the circuit. This is used as the entry\ - \ point for the program. \n\n* `target_profile` (TargetProfile): The target\ - \ profile to use for code generation. \n\n* `search_path` (str): The optional\ - \ search path for resolving file references. \n\n* `output_semantics` (OutputSemantics):\ - \ The output semantics for the compilation. \n\n* `seed` (int): The seed to\ - \ use for the random number generator." - isRequired: true - keywordOnlyParameters: - - name: on_result - defaultValue: None - - name: save_events - defaultValue: 'False' - - name: noise - defaultValue: None - - name: qubit_loss - defaultValue: None - - name: as_bitstring - defaultValue: 'False' - return: - description: A list of results or runtime errors. If `save_events` is true, a - list of ShotResults is returned. - types: - - [] - exceptions: - - type: qsharp.openqasm.QasmError - description: If there is an error generating, parsing, or analyzing the OpenQASM - source. - - type: qsharp.QSharpError - description: If there is an error interpreting the input. - - type: ValueError - description: If the number of shots is less than 1. - - type: ValueError - description: If `on_result` or `save_events` are used when running OpenQASM programs. -classes: -- qsharp.openqasm.OutputSemantics -- qsharp.openqasm.ProgramType -- qsharp.openqasm.QasmError diff --git a/python_doc/qsharp/qsharp.telemetry.Metric.yml b/python_doc/qsharp/qsharp.telemetry.Metric.yml deleted file mode 100644 index b2e8267d6c..0000000000 --- a/python_doc/qsharp/qsharp.telemetry.Metric.yml +++ /dev/null @@ -1,24 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.telemetry.Metric -name: Metric -fullName: qsharp.telemetry.Metric -module: qsharp.telemetry -summary: Used internally for objects in the telemetry queue -constructor: - syntax: Metric() -attributes: -- uid: qsharp.telemetry.Metric.count - name: count - signature: 'count: int' -- uid: qsharp.telemetry.Metric.name - name: name - signature: 'name: str' -- uid: qsharp.telemetry.Metric.properties - name: properties - signature: 'properties: Dict[str, Any]' -- uid: qsharp.telemetry.Metric.type - name: type - signature: 'type: str' -- uid: qsharp.telemetry.Metric.value - name: value - signature: 'value: float' diff --git a/python_doc/qsharp/qsharp.telemetry.PendingMetric.yml b/python_doc/qsharp/qsharp.telemetry.PendingMetric.yml deleted file mode 100644 index e48be37456..0000000000 --- a/python_doc/qsharp/qsharp.telemetry.PendingMetric.yml +++ /dev/null @@ -1,30 +0,0 @@ -### YamlMime:PythonClass -uid: qsharp.telemetry.PendingMetric -name: PendingMetric -fullName: qsharp.telemetry.PendingMetric -module: qsharp.telemetry -summary: Used internally to aggregate metrics before sending -constructor: - syntax: PendingMetric() -attributes: -- uid: qsharp.telemetry.PendingMetric.count - name: count - signature: 'count: int' -- uid: qsharp.telemetry.PendingMetric.max - name: max - signature: 'max: float' -- uid: qsharp.telemetry.PendingMetric.min - name: min - signature: 'min: float' -- uid: qsharp.telemetry.PendingMetric.name - name: name - signature: 'name: str' -- uid: qsharp.telemetry.PendingMetric.properties - name: properties - signature: 'properties: Dict[str, Any]' -- uid: qsharp.telemetry.PendingMetric.type - name: type - signature: 'type: str' -- uid: qsharp.telemetry.PendingMetric.value - name: value - signature: 'value: float' diff --git a/python_doc/qsharp/qsharp.telemetry.yml b/python_doc/qsharp/qsharp.telemetry.yml deleted file mode 100644 index 89467bb887..0000000000 --- a/python_doc/qsharp/qsharp.telemetry.yml +++ /dev/null @@ -1,58 +0,0 @@ -### YamlMime:PythonModule -uid: qsharp.telemetry -name: telemetry -fullName: qsharp.telemetry -summary: 'This module sends telemetry directly to Azure Monitor using a similar mechanism - and - - format to the Azure Monitor OpenTelemetry Python SDK. It only supports custom metrics - of - - type "counter" and "histogram" for now. It''s goal is to be minimal in size and - dependencies, - - and easy to read to understand exactly what data is being sent. - - - - To use this API, simply call `log_telemetry` with the metric name, value, and any - other - - optional properties. The telemetry will be batched and sent at a regular intervals - (60 sec), - - and when the process is about to exit. - - - - Disable qsharp Python telemetry by setting the environment variable `QSHARP_PYTHON_TELEMETRY=none`.' -functions: -- uid: qsharp.telemetry.log_telemetry - name: log_telemetry - summary: "Logs a custom metric with the name provided. Properties are optional and\ - \ can be used to\ncapture additional context about the metric (but should be a\ - \ relatively static set of values, as\neach unique set of properties will be sent\ - \ as a separate metric and creates a separate 'dimension'\nin the backend telemetry\ - \ store).\n\nThe type can be either 'counter' or 'histogram'. A 'counter' is a\ - \ simple value that is summed\nover time, such as how many times an event occurs,\ - \ while a 'histogram' is used to track 'quantative'\nvalues, such as the distribution\ - \ of values over time, e.g., the duration of an operation.\n\nExample usage for\ - \ a counter:\n\n log_telemetry(\"qir_generated\", 1, properties={\"profile\"\ - : \"base\", \"qsharp.version\": \"1.9.0\"})\n\nExample usage for a histogram:\n\ - \n log_telemetry(\"simulation_duration\", 123.45, type=\"histogram\")" - signature: 'log_telemetry(name: str, value: float, count: int = 1, properties: Dict[str, - Any] = {}, type: Literal[''counter'', ''histogram''] = ''counter'') -> None' - parameters: - - name: name - isRequired: true - - name: value - isRequired: true - - name: count - defaultValue: '1' - - name: properties - defaultValue: '{}' - - name: type - defaultValue: counter -classes: -- qsharp.telemetry.Metric -- qsharp.telemetry.PendingMetric diff --git a/python_doc/qsharp/qsharp.telemetry_events.yml b/python_doc/qsharp/qsharp.telemetry_events.yml deleted file mode 100644 index c253c38d41..0000000000 --- a/python_doc/qsharp/qsharp.telemetry_events.yml +++ /dev/null @@ -1,232 +0,0 @@ -### YamlMime:PythonModule -uid: qsharp.telemetry_events -name: telemetry_events -fullName: qsharp.telemetry_events -functions: -- uid: qsharp.telemetry_events.get_next_power_of_ten_bucket - name: get_next_power_of_ten_bucket - signature: 'get_next_power_of_ten_bucket(value: int) -> int' - parameters: - - name: value - isRequired: true -- uid: qsharp.telemetry_events.get_qubits_bucket - name: get_qubits_bucket - signature: 'get_qubits_bucket(qubits: str | int) -> str' - parameters: - - name: qubits - isRequired: true -- uid: qsharp.telemetry_events.on_circuit - name: on_circuit - signature: on_circuit() -> None -- uid: qsharp.telemetry_events.on_circuit_end - name: on_circuit_end - signature: 'on_circuit_end(durationMs: float) -> None' - parameters: - - name: durationMs - isRequired: true -- uid: qsharp.telemetry_events.on_circuit_qasm - name: on_circuit_qasm - signature: on_circuit_qasm() -> None -- uid: qsharp.telemetry_events.on_circuit_qasm_end - name: on_circuit_qasm_end - signature: 'on_circuit_qasm_end(durationMs: float) -> None' - parameters: - - name: durationMs - isRequired: true -- uid: qsharp.telemetry_events.on_compile - name: on_compile - signature: 'on_compile(profile: str) -> None' - parameters: - - name: profile - isRequired: true -- uid: qsharp.telemetry_events.on_compile_end - name: on_compile_end - signature: 'on_compile_end(durationMs: float, profile: str) -> None' - parameters: - - name: durationMs - isRequired: true - - name: profile - isRequired: true -- uid: qsharp.telemetry_events.on_compile_qasm - name: on_compile_qasm - signature: 'on_compile_qasm(profile: str) -> None' - parameters: - - name: profile - isRequired: true -- uid: qsharp.telemetry_events.on_compile_qasm_end - name: on_compile_qasm_end - signature: 'on_compile_qasm_end(durationMs: float, profile: str) -> None' - parameters: - - name: durationMs - isRequired: true - - name: profile - isRequired: true -- uid: qsharp.telemetry_events.on_estimate - name: on_estimate - signature: on_estimate() -> None -- uid: qsharp.telemetry_events.on_estimate_end - name: on_estimate_end - signature: 'on_estimate_end(durationMs: float, qubits: str | int) -> None' - parameters: - - name: durationMs - isRequired: true - - name: qubits - isRequired: true -- uid: qsharp.telemetry_events.on_estimate_qasm - name: on_estimate_qasm - signature: on_estimate_qasm() -> None -- uid: qsharp.telemetry_events.on_estimate_qasm_end - name: on_estimate_qasm_end - signature: 'on_estimate_qasm_end(durationMs: float, qubits: str | int) -> None' - parameters: - - name: durationMs - isRequired: true - - name: qubits - isRequired: true -- uid: qsharp.telemetry_events.on_eval - name: on_eval - signature: on_eval() -> None -- uid: qsharp.telemetry_events.on_eval_end - name: on_eval_end - signature: 'on_eval_end(durationMs: float) -> None' - parameters: - - name: durationMs - isRequired: true -- uid: qsharp.telemetry_events.on_import - name: on_import - signature: on_import() -> None -- uid: qsharp.telemetry_events.on_import_qasm - name: on_import_qasm - signature: on_import_qasm() -> None -- uid: qsharp.telemetry_events.on_import_qasm_end - name: on_import_qasm_end - signature: 'on_import_qasm_end(durationMs: float) -> None' - parameters: - - name: durationMs - isRequired: true -- uid: qsharp.telemetry_events.on_neutral_atom_compile - name: on_neutral_atom_compile - signature: on_neutral_atom_compile() -> None -- uid: qsharp.telemetry_events.on_neutral_atom_compile_end - name: on_neutral_atom_compile_end - signature: 'on_neutral_atom_compile_end(duration_ms: float) -> None' - parameters: - - name: duration_ms - isRequired: true -- uid: qsharp.telemetry_events.on_neutral_atom_cpu_fallback - name: on_neutral_atom_cpu_fallback - signature: on_neutral_atom_cpu_fallback() -> None -- uid: qsharp.telemetry_events.on_neutral_atom_init - name: on_neutral_atom_init - signature: 'on_neutral_atom_init(default_layout: bool) -> None' - parameters: - - name: default_layout - isRequired: true -- uid: qsharp.telemetry_events.on_neutral_atom_simulate - name: on_neutral_atom_simulate - signature: 'on_neutral_atom_simulate(shots: int, noise: bool, type: str) -> None' - parameters: - - name: shots - isRequired: true - - name: noise - isRequired: true - - name: type - isRequired: true -- uid: qsharp.telemetry_events.on_neutral_atom_simulate_end - name: on_neutral_atom_simulate_end - signature: 'on_neutral_atom_simulate_end(duration_ms: float, shots: int, noise: - bool, type: str) -> None' - parameters: - - name: duration_ms - isRequired: true - - name: shots - isRequired: true - - name: noise - isRequired: true - - name: type - isRequired: true -- uid: qsharp.telemetry_events.on_neutral_atom_trace - name: on_neutral_atom_trace - signature: on_neutral_atom_trace() -> None -- uid: qsharp.telemetry_events.on_neutral_atom_trace_end - name: on_neutral_atom_trace_end - signature: 'on_neutral_atom_trace_end(duration_ms: float) -> None' - parameters: - - name: duration_ms - isRequired: true -- uid: qsharp.telemetry_events.on_qdk_import - name: on_qdk_import - signature: on_qdk_import() -> None -- uid: qsharp.telemetry_events.on_qiskit_run - name: on_qiskit_run - signature: 'on_qiskit_run(shots: int, num_circuits: int) -> None' - parameters: - - name: shots - isRequired: true - - name: num_circuits - isRequired: true -- uid: qsharp.telemetry_events.on_qiskit_run_end - name: on_qiskit_run_end - signature: 'on_qiskit_run_end(shots: int, num_circuits: int, duration_ms: float) - -> None' - parameters: - - name: shots - isRequired: true - - name: num_circuits - isRequired: true - - name: duration_ms - isRequired: true -- uid: qsharp.telemetry_events.on_qiskit_run_re - name: on_qiskit_run_re - signature: on_qiskit_run_re() -> None -- uid: qsharp.telemetry_events.on_qiskit_run_re_end - name: on_qiskit_run_re_end - signature: 'on_qiskit_run_re_end(duration_ms: float) -> None' - parameters: - - name: duration_ms - isRequired: true -- uid: qsharp.telemetry_events.on_run - name: on_run - signature: 'on_run(shots: int, noise: bool, qubit_loss: bool) -> None' - parameters: - - name: shots - isRequired: true - - name: noise - isRequired: true - - name: qubit_loss - isRequired: true -- uid: qsharp.telemetry_events.on_run_cell - name: on_run_cell - signature: on_run_cell() -> None -- uid: qsharp.telemetry_events.on_run_cell_end - name: on_run_cell_end - signature: 'on_run_cell_end(durationMs: float) -> None' - parameters: - - name: durationMs - isRequired: true -- uid: qsharp.telemetry_events.on_run_end - name: on_run_end - signature: 'on_run_end(durationMs: float, shots: int) -> None' - parameters: - - name: durationMs - isRequired: true - - name: shots - isRequired: true -- uid: qsharp.telemetry_events.on_run_qasm - name: on_run_qasm - signature: 'on_run_qasm(shots: int, noise: bool, qubit_loss: bool) -> None' - parameters: - - name: shots - isRequired: true - - name: noise - isRequired: true - - name: qubit_loss - isRequired: true -- uid: qsharp.telemetry_events.on_run_qasm_end - name: on_run_qasm_end - signature: 'on_run_qasm_end(durationMs: float, shots: int) -> None' - parameters: - - name: durationMs - isRequired: true - - name: shots - isRequired: true diff --git a/python_doc/qsharp/qsharp.utils.yml b/python_doc/qsharp/qsharp.utils.yml deleted file mode 100644 index bc1ba2ad1c..0000000000 --- a/python_doc/qsharp/qsharp.utils.yml +++ /dev/null @@ -1,21 +0,0 @@ -### YamlMime:PythonPackage -uid: qsharp.utils -name: utils -fullName: qsharp.utils -type: import -functions: -- uid: qsharp.utils.dump_operation - name: dump_operation - summary: Returns a square matrix of complex numbers representing the operation performed. - signature: 'dump_operation(operation: str, num_qubits: int) -> List[List[complex]]' - parameters: - - name: operation - description: The operation to be performed, which must operate on a list of qubits. - isRequired: true - - name: num_qubits - description: The number of qubits to be used. - isRequired: true - return: - description: The matrix representing the operation. - types: - - [[]] diff --git a/python_doc/qsharp/qsharp.yml b/python_doc/qsharp/qsharp.yml deleted file mode 100644 index dac3fd8cd5..0000000000 --- a/python_doc/qsharp/qsharp.yml +++ /dev/null @@ -1,380 +0,0 @@ -### YamlMime:PythonPackage -uid: qsharp -name: qsharp -fullName: qsharp -type: rootImport -functions: -- uid: qsharp.circuit - name: circuit - summary: 'Synthesizes a circuit for a Q# program. Either an entry - - expression or an operation must be provided. - - - an operation of a lambda expression. The operation must take only - - qubits or arrays of qubits as parameters.' - signature: 'circuit(entry_expr: str | Callable | GlobalCallable | Closure | None - = None, *args, operation: str | None = None, generation_method: CircuitGenerationMethod - | None = None, max_operations: int | None = None, source_locations: bool = False, - group_by_scope: bool = True, prune_classical_qubits: bool = False) -> Circuit' - parameters: - - name: generation_method - description: 'The method to use for circuit generation. - - `CircuitGenerationMethod.ClassicalEval` evaluates classical control flow at - circuit - - generation time. `CircuitGenerationMethod.Simulate` runs a full simulation to - trace - - the circuit. `CircuitGenerationMethod.Static` uses partial evaluation and requires - - a non-`Unrestricted` target profile. Defaults to `None` (auto-selected).' - isRequired: true - - name: max_operations - description: 'The maximum number of operations to include in the circuit. - - Defaults to `None` (no limit).' - isRequired: true - - name: source_locations - description: 'If `True`, annotates each gate with its source location. - - Defaults to `False`.' - isRequired: true - - name: group_by_scope - description: 'If `True`, groups operations by their Q# scope (e.g. operation body). - - Defaults to `True`.' - isRequired: true - - name: prune_classical_qubits - description: 'If `True`, removes qubits that are never used in a quantum - - gate (e.g. qubits only used as classical controls). Defaults to `False`.' - isRequired: true - - name: entry_expr - defaultValue: None - keywordOnlyParameters: - - name: operation - defaultValue: None - - name: generation_method - defaultValue: None - - name: max_operations - defaultValue: None - - name: source_locations - defaultValue: 'False' - - name: group_by_scope - defaultValue: 'True' - - name: prune_classical_qubits - defaultValue: 'False' - return: - description: The synthesized circuit. - types: - - - exceptions: - - type: qsharp.QSharpError - description: If there is an error synthesizing the circuit. -- uid: qsharp.compile - name: compile - summary: 'Compiles the Q# source code into a program that can be submitted to a - target. - - Either an entry expression or a callable with arguments must be provided. - - - Example:' - signature: 'compile(entry_expr: str | Callable | GlobalCallable | Closure, *args) - -> QirInputData' - parameters: - - name: entry_expr - description: 'The Q# expression that will be used as the entrypoint - - for the program. Alternatively, a callable can be provided, which must - - be a Q# callable.' - isRequired: true - - name: '*args' - description: The arguments to pass to the callable, if one is provided. - isRequired: true - return: - description: The compiled program. Use `str()` to get the QIR string. - types: - - -- uid: qsharp.dump_circuit - name: dump_circuit - summary: 'Dumps a circuit showing the current state of the simulator. - - - This circuit will contain the gates that have been applied - - in the simulator up to the current point. - - - Requires the interpreter to be initialized with *trace_circuit=True*.' - signature: dump_circuit() -> Circuit - return: - description: The current circuit trace. - types: - - - exceptions: - - type: qsharp.QSharpError - description: If the interpreter was not initialized with `trace_circuit=True` -- uid: qsharp.dump_machine - name: dump_machine - summary: Returns the sparse state vector of the simulator as a StateDump object. - signature: dump_machine() -> StateDump - return: - description: The state of the simulator. - types: - - -- uid: qsharp.estimate - name: estimate - summary: 'Estimates resources for Q# source code. - - Either an entry expression or a callable with arguments must be provided.' - signature: 'estimate(entry_expr: str | Callable | GlobalCallable | Closure, params: - Dict[str, Any] | List | EstimatorParams | None = None, *args) -> EstimatorResult' - parameters: - - name: entry_expr - description: 'The entry expression. Alternatively, a callable can be provided, - - which must be a Q# callable.' - isRequired: true - - name: params - description: The parameters to configure physical estimation. - defaultValue: None - return: - description: The estimated resources. - types: - - -- uid: qsharp.estimate_custom - name: estimate_custom - signature: estimate_custom(algorithm, qubit, qec, factories=Ellipsis, *, error_budget=0.01, - max_factories=None, logical_depth_factor=None, max_physical_qubits=None, max_duration=None, - error_budget_pruning=False) - parameters: - - name: algorithm - isRequired: true - - name: qubit - isRequired: true - - name: qec - isRequired: true - - name: factories - defaultValue: Ellipsis - keywordOnlyParameters: - - name: error_budget - defaultValue: '0.01' - - name: max_factories - defaultValue: None - - name: logical_depth_factor - defaultValue: None - - name: max_physical_qubits - defaultValue: None - - name: max_duration - defaultValue: None - - name: error_budget_pruning - defaultValue: 'False' -- uid: qsharp.eval - name: eval - summary: 'Evaluates Q# source code. - - - Output is printed to console.' - signature: 'eval(source: str, *, save_events: bool = False) -> Any' - parameters: - - name: source - description: The Q# source code to evaluate. - isRequired: true - - name: save_events - description: If true, all output will be saved and returned. If false, they will - be printed. - isRequired: true - keywordOnlyParameters: - - name: save_events - defaultValue: 'False' - return: - description: The value returned by the last statement in the source code, or the - saved output if `save_events` is true. - types: - - - exceptions: - - type: qsharp.QSharpError - description: If there is an error evaluating the source code. -- uid: qsharp.init - name: init - summary: Initializes the Q# interpreter. - signature: 'init(*, target_profile: TargetProfile = TargetProfile.Unrestricted, - target_name: str | None = None, project_root: str | None = None, language_features: - List[str] | None = None, trace_circuit: bool | None = None) -> Config' - parameters: - - name: target_profile - description: 'Setting the target profile allows the Q# - - interpreter to generate programs that are compatible - - with a specific target. See :py:class: *qsharp.TargetProfile*.' - isRequired: true - - name: target_name - description: 'An optional name of the target machine to use for inferring the - compatible - - target_profile setting.' - isRequired: true - - name: project_root - description: 'An optional path to a root directory with a Q# project to include. - - It must contain a qsharp.json project manifest.' - isRequired: true - - name: language_features - description: 'An optional list of language feature flags to enable. - - These correspond to experimental or preview Q# language features.' - isRequired: true - - name: trace_circuit - description: 'Enables tracing of circuit during execution. - - Passing *True* is required for the *dump_circuit* function to return a circuit. - - The *circuit* function is *NOT* affected by this parameter will always generate - a circuit.' - isRequired: true - keywordOnlyParameters: - - name: target_profile - defaultValue: Unrestricted - - name: target_name - defaultValue: None - - name: project_root - defaultValue: None - - name: language_features - defaultValue: None - - name: trace_circuit - defaultValue: None - return: - description: The Q# interpreter configuration. - types: - - -- uid: qsharp.logical_counts - name: logical_counts - summary: 'Extracts logical resource counts from Q# source code. - - Either an entry expression or a callable with arguments must be provided.' - signature: 'logical_counts(entry_expr: str | Callable | GlobalCallable | Closure, - *args) -> LogicalCounts' - parameters: - - name: entry_expr - description: 'The entry expression. Alternatively, a callable can be provided, - - which must be a Q# callable.' - isRequired: true - return: - description: Program resources in terms of logical gate counts. - types: - - -- uid: qsharp.run - name: run - summary: 'Runs the given Q# expression for the given number of shots. - - Each shot uses an independent instance of the simulator.' - signature: 'run(entry_expr: str | Callable | GlobalCallable | Closure, shots: int, - *args, on_result: Callable[[ShotResult], None] | None = None, save_events: bool - = False, noise: Tuple[float, float, float] | PauliNoise | BitFlipNoise | PhaseFlipNoise - | DepolarizingNoise | NoiseConfig | None = None, qubit_loss: float | None = None, - seed: int | None = None) -> List[Any]' - parameters: - - name: entry_expr - description: 'The entry expression. Alternatively, a callable can be provided, - - which must be a Q# callable.' - isRequired: true - - name: shots - description: The number of shots to run. - isRequired: true - - name: '*args' - description: The arguments to pass to the callable, if one is provided. - isRequired: true - - name: on_result - description: A callback function that will be called with each result. - isRequired: true - - name: save_events - description: If true, the output of each shot will be saved. If false, they will - be printed. - isRequired: true - - name: noise - description: The noise to use in simulation. - isRequired: true - - name: qubit_loss - description: The probability of qubit loss in simulation. - isRequired: true - - name: seed - description: The seed to use for the random number generator in simulation, if - any. - isRequired: true - keywordOnlyParameters: - - name: on_result - defaultValue: None - - name: save_events - defaultValue: 'False' - - name: noise - defaultValue: None - - name: qubit_loss - defaultValue: None - - name: seed - defaultValue: None - return: - description: A list of results or runtime errors. If `save_events` is true, a - list of `ShotResult` is returned. - types: - - [] - exceptions: - - type: qsharp.QSharpError - description: If there is an error interpreting the input. - - type: ValueError - description: If the number of shots is less than 1. -- uid: qsharp.set_classical_seed - name: set_classical_seed - summary: 'Sets the seed for the random number generator used for standard - - library classical random number operations. - - This applies to all Q# code executed, compiled, or estimated.' - signature: 'set_classical_seed(seed: int | None) -> None' - parameters: - - name: seed - description: 'The seed to use for the classical random number generator. - - If None, the seed will be generated from entropy.' - isRequired: true -- uid: qsharp.set_quantum_seed - name: set_quantum_seed - summary: 'Sets the seed for the random number generator used for quantum measurements. - - This applies to all Q# code executed, compiled, or estimated.' - signature: 'set_quantum_seed(seed: int | None) -> None' - parameters: - - name: seed - description: 'The seed to use for the quantum random number generator. - - If None, the seed will be generated from entropy.' - isRequired: true -classes: -- qsharp.BitFlipNoise -- qsharp.CircuitGenerationMethod -- qsharp.DepolarizingNoise -- qsharp.Pauli -- qsharp.PauliNoise -- qsharp.PhaseFlipNoise -- qsharp.QSharpError -- qsharp.Result -- qsharp.ShotResult -- qsharp.StateDump -- qsharp.TargetProfile -packages: -- qsharp.code -- qsharp.estimator -- qsharp.interop -- qsharp.noisy_simulator -- qsharp.openqasm -- qsharp.utils -modules: -- qsharp.telemetry -- qsharp.telemetry_events diff --git a/python_doc/toc.yml b/python_doc/toc.yml deleted file mode 100644 index 13d23dd492..0000000000 --- a/python_doc/toc.yml +++ /dev/null @@ -1,202 +0,0 @@ -- items: - - name: Overview - uid: qsharp - - name: code - no-loc: - - code - uid: qsharp.code - - items: - - name: Overview - uid: qsharp.estimator - - name: DistillationUnitSpecification - no-loc: - - DistillationUnitSpecification - uid: qsharp.estimator.DistillationUnitSpecification - - name: ErrorBudgetPartition - no-loc: - - ErrorBudgetPartition - uid: qsharp.estimator.ErrorBudgetPartition - - name: EstimatorConstraints - no-loc: - - EstimatorConstraints - uid: qsharp.estimator.EstimatorConstraints - - name: EstimatorError - no-loc: - - EstimatorError - uid: qsharp.estimator.EstimatorError - - name: EstimatorInputParamsItem - no-loc: - - EstimatorInputParamsItem - uid: qsharp.estimator.EstimatorInputParamsItem - - name: EstimatorParams - no-loc: - - EstimatorParams - uid: qsharp.estimator.EstimatorParams - - name: EstimatorQecScheme - no-loc: - - EstimatorQecScheme - uid: qsharp.estimator.EstimatorQecScheme - - name: EstimatorQubitParams - no-loc: - - EstimatorQubitParams - uid: qsharp.estimator.EstimatorQubitParams - - name: EstimatorResult - no-loc: - - EstimatorResult - uid: qsharp.estimator.EstimatorResult - - name: LogicalCounts - no-loc: - - LogicalCounts - uid: qsharp.estimator.LogicalCounts - - name: MeasurementErrorRate - no-loc: - - MeasurementErrorRate - uid: qsharp.estimator.MeasurementErrorRate - - name: ProtocolSpecificDistillationUnitSpecification - no-loc: - - ProtocolSpecificDistillationUnitSpecification - uid: qsharp.estimator.ProtocolSpecificDistillationUnitSpecification - - name: QECScheme - no-loc: - - QECScheme - uid: qsharp.estimator.QECScheme - - name: QubitParams - no-loc: - - QubitParams - uid: qsharp.estimator.QubitParams - name: estimator - no-loc: - - estimator - - items: - - name: Overview - uid: qsharp.interop - - items: - - name: Overview - uid: qsharp.interop.cirq - - name: NeutralAtomCirqResult - no-loc: - - NeutralAtomCirqResult - uid: qsharp.interop.cirq.NeutralAtomCirqResult - - name: NeutralAtomSampler - no-loc: - - NeutralAtomSampler - uid: qsharp.interop.cirq.NeutralAtomSampler - name: cirq - no-loc: - - cirq - name: interop - no-loc: - - interop - - items: - - name: Overview - uid: qsharp.noisy_simulator - - name: DensityMatrixSimulator - no-loc: - - DensityMatrixSimulator - uid: qsharp.noisy_simulator.DensityMatrixSimulator - - name: Instrument - no-loc: - - Instrument - uid: qsharp.noisy_simulator.Instrument - - name: NoisySimulatorError - no-loc: - - NoisySimulatorError - uid: qsharp.noisy_simulator.NoisySimulatorError - - name: Operation - no-loc: - - Operation - uid: qsharp.noisy_simulator.Operation - - name: StateVectorSimulator - no-loc: - - StateVectorSimulator - uid: qsharp.noisy_simulator.StateVectorSimulator - name: noisy_simulator - no-loc: - - noisy_simulator - - items: - - name: Overview - uid: qsharp.openqasm - - name: OutputSemantics - no-loc: - - OutputSemantics - uid: qsharp.openqasm.OutputSemantics - - name: ProgramType - no-loc: - - ProgramType - uid: qsharp.openqasm.ProgramType - - name: QasmError - no-loc: - - QasmError - uid: qsharp.openqasm.QasmError - name: openqasm - no-loc: - - openqasm - - name: utils - no-loc: - - utils - uid: qsharp.utils - - items: - - name: Overview - uid: qsharp.telemetry - - name: Metric - no-loc: - - Metric - uid: qsharp.telemetry.Metric - - name: PendingMetric - no-loc: - - PendingMetric - uid: qsharp.telemetry.PendingMetric - name: telemetry - no-loc: - - telemetry - - name: telemetry_events - no-loc: - - telemetry_events - uid: qsharp.telemetry_events - - name: BitFlipNoise - no-loc: - - BitFlipNoise - uid: qsharp.BitFlipNoise - - name: CircuitGenerationMethod - no-loc: - - CircuitGenerationMethod - uid: qsharp.CircuitGenerationMethod - - name: DepolarizingNoise - no-loc: - - DepolarizingNoise - uid: qsharp.DepolarizingNoise - - name: Pauli - no-loc: - - Pauli - uid: qsharp.Pauli - - name: PauliNoise - no-loc: - - PauliNoise - uid: qsharp.PauliNoise - - name: PhaseFlipNoise - no-loc: - - PhaseFlipNoise - uid: qsharp.PhaseFlipNoise - - name: QSharpError - no-loc: - - QSharpError - uid: qsharp.QSharpError - - name: Result - no-loc: - - Result - uid: qsharp.Result - - name: ShotResult - no-loc: - - ShotResult - uid: qsharp.ShotResult - - name: StateDump - no-loc: - - StateDump - uid: qsharp.StateDump - - name: TargetProfile - no-loc: - - TargetProfile - uid: qsharp.TargetProfile - name: qsharp - no-loc: - - qsharp From 0477f17c805bd411bddd7edf61bbcd0e1ced9713 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Thu, 16 Apr 2026 12:46:48 -0700 Subject: [PATCH 17/26] qiskit and cirq refs should just be in quotes, not links --- source/pip/qsharp/estimator/_estimator.py | 10 ++++ .../pip/qsharp/interop/cirq/_neutral_atom.py | 46 +++++++++++-------- source/pip/qsharp/interop/qiskit/__init__.py | 4 +- .../pip/qsharp/interop/qiskit/jobs/qsjob.py | 4 +- .../qsharp/interop/qiskit/jobs/qsjobset.py | 9 ++-- source/qdk_package/src/qdk/qiskit.py | 4 +- 6 files changed, 49 insertions(+), 28 deletions(-) diff --git a/source/pip/qsharp/estimator/_estimator.py b/source/pip/qsharp/estimator/_estimator.py index 1e24231613..7f1fdf581e 100644 --- a/source/pip/qsharp/estimator/_estimator.py +++ b/source/pip/qsharp/estimator/_estimator.py @@ -91,6 +91,7 @@ class QubitParams: Pass one of these string constants as the ``name`` field to select a built-in qubit model for resource estimation. """ + GATE_US_E3 = "qubit_gate_us_e3" GATE_US_E4 = "qubit_gate_us_e4" GATE_NS_E3 = "qubit_gate_ns_e3" @@ -107,6 +108,7 @@ class QECScheme: Pass one of these string constants as the ``name`` field to select a built-in QEC scheme for resource estimation. """ + SURFACE_CODE = "surface_code" FLOQUET_CODE = "floquet_code" @@ -151,6 +153,7 @@ class MeasurementErrorRate(AutoValidatingParams): :param process: Error rate during the measurement process. Must be in ``(0, 1)``. :param readout: Error rate during readout. Must be in ``(0, 1)``. """ + process: float = field(metadata={"validate": _check_error_rate}) readout: float = field(metadata={"validate": _check_error_rate}) @@ -164,6 +167,7 @@ class EstimatorQubitParams(AutoValidatingParams): :class:`QubitParams` constants, or fully define a custom model by setting ``instruction_set`` and all relevant timing and error-rate fields. """ + @staticmethod def check_instruction_set(name, value): if value not in [ @@ -261,6 +265,7 @@ class EstimatorQecScheme(AutoValidatingParams): :class:`QECScheme` constants, or define a custom scheme by setting the threshold and code-distance parameters directly. """ + name: Optional[str] = None error_correction_threshold: Optional[float] = validating_field(_check_error_rate) crossing_prefactor: Optional[float] = None @@ -278,6 +283,7 @@ class ProtocolSpecificDistillationUnitSpecification(AutoValidatingParams): Defines the number of physical qubits and the duration (in logical cycle time units) for one round of distillation under a specific QEC code. """ + num_unit_qubits: Optional[int] = None duration_in_qubit_cycle_time: Optional[int] = None @@ -299,6 +305,7 @@ class DistillationUnitSpecification(AutoValidatingParams): ``output_error_rate_formula``, and optionally physical and logical qubit specifications. """ + name: Optional[str] = None display_name: Optional[str] = None num_input_ts: Optional[int] = None @@ -417,6 +424,7 @@ class ErrorBudgetPartition(AutoValidatingParams): :param t_states: Budget allocated to T-state distillation errors. :param rotations: Budget allocated to rotation synthesis errors. """ + logical: float = 0.001 / 3 t_states: float = 0.001 / 3 rotations: float = 0.001 / 3 @@ -430,6 +438,7 @@ class EstimatorConstraints(AutoValidatingParams): At most one of ``max_duration`` or ``max_physical_qubits`` may be set simultaneously. """ + @staticmethod def at_least_one(name, value): if value < 1: @@ -559,6 +568,7 @@ class EstimatorParams(EstimatorInputParamsItem): single-point estimation job. :type num_items: int, optional """ + MAX_NUM_ITEMS: int = 1000 def __init__(self, num_items: Optional[int] = None): diff --git a/source/pip/qsharp/interop/cirq/_neutral_atom.py b/source/pip/qsharp/interop/cirq/_neutral_atom.py index 1120bd7dd7..d556ab3222 100644 --- a/source/pip/qsharp/interop/cirq/_neutral_atom.py +++ b/source/pip/qsharp/interop/cirq/_neutral_atom.py @@ -29,22 +29,6 @@ class NeutralAtomSampler(cirq.Sampler): 3. QIR → ``NeutralAtomDevice.simulate()`` (decompose, schedule, simulate) 4. Raw shots → :class:`NeutralAtomCirqResult` - :param noise: Optional :class:`~qsharp._simulation.NoiseConfig` describing - per-gate noise. The device decomposes gates to the native set - ``{Rz, SX, CZ, MResetZ}``; configure noise on those native gates. - For example, a Cirq ``X`` gate arriving via QASM 2.0 is decomposed - to ``SX·SX``, so ``noise.sx`` is the relevant field. Defaults to - ``None`` (noiseless). - :param simulator_type: Force a particular simulator backend. - ``"clifford"`` — Clifford-only, fast. Requires a Clifford circuit. - ``"cpu"`` — Full state-vector on CPU. - ``"gpu"`` — Full state-vector on GPU. - ``None`` (default) — GPU if available, CPU otherwise. - :param seed: Optional integer seed for reproducibility. Defaults to ``None``. - :param device: An existing :class:`~qsharp._device._atom.NeutralAtomDevice` - instance to reuse across calls. A default-configured device is - created lazily on the first call when not provided. - Example:: import cirq @@ -79,6 +63,28 @@ def __init__( seed: Optional[int] = None, device: Optional["NeutralAtomDevice"] = None, ) -> None: + """ + :param noise: Optional :class:`~qsharp._simulation.NoiseConfig` describing + per-gate noise. The device decomposes gates to the native set + ``{Rz, SX, CZ, MResetZ}``; configure noise on those native gates. + For example, a Cirq ``X`` gate arriving via QASM 2.0 is decomposed + to ``SX·SX``, so ``noise.sx`` is the relevant field. Defaults to + ``None`` (noiseless). + :type noise: NoiseConfig, optional + :param simulator_type: Force a particular simulator backend. + ``"clifford"`` — Clifford-only, fast. Requires a Clifford circuit. + ``"cpu"`` — Full state-vector on CPU. + ``"gpu"`` — Full state-vector on GPU. + ``None`` (default) — GPU if available, CPU otherwise. + :type simulator_type: str, optional + :param seed: Optional integer seed for reproducibility. Defaults to ``None``. + :type seed: int, optional + :param device: An existing :class:`~qsharp._device._atom.NeutralAtomDevice` + instance to reuse across calls. A default-configured device is + created lazily on the first call when not provided. + :type device: NeutralAtomDevice, optional + """ + self._noise = noise self._simulator_type = simulator_type self._seed = seed @@ -102,7 +108,7 @@ def run_sweep( :param program: The Cirq circuit to simulate. :type program: cirq.AbstractCircuit - :param params: A :class:`cirq.Sweepable` defining the parameter resolvers + :param params: A ``cirq.Sweepable`` defining the parameter resolvers to sweep over. Each resolver produces one result. :type params: cirq.Sweepable :param repetitions: Number of shots per parameter resolver. @@ -110,7 +116,11 @@ def run_sweep( :return: A list of :class:`NeutralAtomCirqResult` objects, one per resolver. :rtype: List[NeutralAtomCirqResult] """ - resolvers = list(cirq.to_sweep(params)) if params is not None else [cirq.ParamResolver()] + resolvers = ( + list(cirq.to_sweep(params)) + if params is not None + else [cirq.ParamResolver()] + ) return [ self._run_once(program, resolver, repetitions) for resolver in resolvers ] diff --git a/source/pip/qsharp/interop/qiskit/__init__.py b/source/pip/qsharp/interop/qiskit/__init__.py index 6113fcb032..042c6a4d61 100644 --- a/source/pip/qsharp/interop/qiskit/__init__.py +++ b/source/pip/qsharp/interop/qiskit/__init__.py @@ -25,8 +25,8 @@ :func:`estimate` Convenience function that runs resource estimation on a Qiskit circuit - and returns an `EstimatorResult` directly, without needing to - construct a backend or job manually. + and returns an :class:`EstimatorResult` directly, without + needing to construct a backend or job manually. Usage:: diff --git a/source/pip/qsharp/interop/qiskit/jobs/qsjob.py b/source/pip/qsharp/interop/qiskit/jobs/qsjob.py index 4a9dbbb533..8faeb60b40 100644 --- a/source/pip/qsharp/interop/qiskit/jobs/qsjob.py +++ b/source/pip/qsharp/interop/qiskit/jobs/qsjob.py @@ -56,7 +56,7 @@ def __init__( :type input_params: Dict[str, Any] :param executor: Thread pool executor. Uses a default single-threaded executor if not provided. - :param **kwargs: Additional keyword arguments passed to :class:`~qiskit.providers.JobV1`. + :param **kwargs: Additional keyword arguments passed to ``qiskit.providers.JobV1``. """ self._run_input = run_input @@ -137,7 +137,7 @@ class QsSimJob(QsJob): """ A Qiskit job that runs a quantum circuit on the Q# simulator. - Submits the circuit for simulation and returns a :class:`~qiskit.result.Result` + Submits the circuit for simulation and returns a ``qiskit.result.Result`` containing shot-level measurement outcomes. """ diff --git a/source/pip/qsharp/interop/qiskit/jobs/qsjobset.py b/source/pip/qsharp/interop/qiskit/jobs/qsjobset.py index 6e0d35d3de..afc73a8a4b 100644 --- a/source/pip/qsharp/interop/qiskit/jobs/qsjobset.py +++ b/source/pip/qsharp/interop/qiskit/jobs/qsjobset.py @@ -27,10 +27,11 @@ class QsJobSet(Job): """ A Qiskit job set that runs multiple quantum circuits concurrently. - Each circuit in ``run_input`` is submitted as an individual :class:`QsSimJob` - and executed in a thread pool. :meth:`result` blocks until all constituent - jobs are complete and aggregates their :class:`~qiskit.result.Result` objects - into a single combined result. + Each circuit in ``run_input`` is submitted as an individual + :class:`QsSimJob` and executed in a thread pool. + :meth:`result` blocks until all constituent + jobs are complete and aggregates their ``qiskit.result.Result`` objects into a single + combined result. """ def __init__( diff --git a/source/qdk_package/src/qdk/qiskit.py b/source/qdk_package/src/qdk/qiskit.py index aece2ce7f8..69c1b18db5 100644 --- a/source/qdk_package/src/qdk/qiskit.py +++ b/source/qdk_package/src/qdk/qiskit.py @@ -25,8 +25,8 @@ :func:`estimate` Convenience function that runs resource estimation on a Qiskit circuit - and returns an `EstimatorResult` directly, without needing to - construct a backend or job manually. + and returns an :class:`EstimatorResult` directly, without + needing to construct a backend or job manually. Usage:: From 49b030461b1b21f44e90c6aff80773a8272b9998 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Thu, 16 Apr 2026 14:34:09 -0700 Subject: [PATCH 18/26] properly tag keyword arguments --- source/pip/qsharp/_native.pyi | 30 ++++++------- source/pip/qsharp/_qsharp.py | 14 +++---- .../pip/qsharp/interop/cirq/_neutral_atom.py | 42 +++++++++---------- 3 files changed, 42 insertions(+), 44 deletions(-) diff --git a/source/pip/qsharp/_native.pyi b/source/pip/qsharp/_native.pyi index 303e1224bc..bf93f33fd0 100644 --- a/source/pip/qsharp/_native.pyi +++ b/source/pip/qsharp/_native.pyi @@ -257,13 +257,13 @@ class Interpreter: :param entry_expr: An entry expression. - :param operation: The operation to synthesize. This can be a name of + :keyword operation: The operation to synthesize. This can be a name of an operation of a lambda expression. The operation must take only qubits or arrays of qubits as parameters. - :param callable: The callable to synthesize the circuit for, if no entry expression is provided. + :keyword callable: The callable to synthesize the circuit for, if no entry expression is provided. - :param args: The arguments to pass to the callable, if any. + :keyword args: The arguments to pass to the callable, if any. :raises QSharpError: If there is an error synthesizing the circuit. """ @@ -714,21 +714,21 @@ def estimate_custom( :param qec: Python object representing the quantum error correction code. :param factories: List of python objects representing factories. Defaults to ``[]``. :type factories: List - :param error_budget: The total error budget, which is uniformly distributed. Defaults to ``0.01``. - :type error_budget: float - :param max_factories: Constrains the number of factories. Defaults to ``None``. - :type max_factories: int, optional - :param logical_depth_factor: Extends algorithmic logical depth by a factor >= 1. Defaults to ``None``. - :type logical_depth_factor: float, optional - :param max_physical_qubits: Forces estimator to not exceed provided number of physical qubits, may fail. + :keyword error_budget: The total error budget, which is uniformly distributed. Defaults to ``0.01``. + :kwtype error_budget: float + :keyword max_factories: Constrains the number of factories. Defaults to ``None``. + :kwtype max_factories: int + :keyword logical_depth_factor: Extends algorithmic logical depth by a factor >= 1. Defaults to ``None``. + :kwtype logical_depth_factor: float + :keyword max_physical_qubits: Forces estimator to not exceed provided number of physical qubits, may fail. Defaults to ``None``. - :type max_physical_qubits: int, optional - :param max_duration: Allows estimator to run for given runtime in nanoseconds, may fail. + :kwtype max_physical_qubits: int + :keyword max_duration: Allows estimator to run for given runtime in nanoseconds, may fail. Defaults to ``None``. - :type max_duration: int, optional - :param error_budget_pruning: Will try to prune the error budget to increase magic state error budget. + :kwtype max_duration: int + :keyword error_budget_pruning: Will try to prune the error budget to increase magic state error budget. Defaults to ``False``. - :type error_budget_pruning: bool + :kwtype error_budget_pruning: bool :return: A dictionary with resource estimation results. :rtype: Dict """ diff --git a/source/pip/qsharp/_qsharp.py b/source/pip/qsharp/_qsharp.py index caf547d3f0..9de02fa6b3 100644 --- a/source/pip/qsharp/_qsharp.py +++ b/source/pip/qsharp/_qsharp.py @@ -298,20 +298,20 @@ def init( """ Initializes the Q# interpreter. - :param target_profile: Setting the target profile allows the Q# + :keyword target_profile: Setting the target profile allows the Q# interpreter to generate programs that are compatible - with a specific target. See :py:class: `qsharp.TargetProfile`. + with a specific target. See :class:`TargetProfile`. - :param target_name: An optional name of the target machine to use for inferring the compatible + :keyword target_name: An optional name of the target machine to use for inferring the compatible target_profile setting. - :param project_root: An optional path to a root directory with a Q# project to include. + :keyword project_root: An optional path to a root directory with a Q# project to include. It must contain a qsharp.json project manifest. - :param language_features: An optional list of language feature flags to enable. + :keyword language_features: An optional list of language feature flags to enable. These correspond to experimental or preview Q# language features. - :param trace_circuit: Enables tracing of circuit during execution. + :keyword trace_circuit: Enables tracing of circuit during execution. Passing `True` is required for the `dump_circuit` function to return a circuit. The `circuit` function is *NOT* affected by this parameter will always generate a circuit. :return: The Q# interpreter configuration. @@ -523,7 +523,7 @@ def eval( Output is printed to console. :param source: The Q# source code to evaluate. - :param save_events: If true, all output will be saved and returned. If false, they will be printed. + :keyword save_events: If true, all output will be saved and returned. If false, they will be printed. :return: The value returned by the last statement in the source code, or the saved output if ``save_events`` is true. :rtype: Any :raises QSharpError: If there is an error evaluating the source code. diff --git a/source/pip/qsharp/interop/cirq/_neutral_atom.py b/source/pip/qsharp/interop/cirq/_neutral_atom.py index d556ab3222..415db3f753 100644 --- a/source/pip/qsharp/interop/cirq/_neutral_atom.py +++ b/source/pip/qsharp/interop/cirq/_neutral_atom.py @@ -53,6 +53,26 @@ class NeutralAtomSampler(cirq.Sampler): sampler = NeutralAtomSampler(noise=noise, seed=42) result = sampler.run(circuit, repetitions=1000) print(f"Accepted: {len(result.measurements['m'])} / {len(result.raw_shots)}") + + :keyword noise: Optional :class:`~qsharp._simulation.NoiseConfig` describing + per-gate noise. The device decomposes gates to the native set + ``{Rz, SX, CZ, MResetZ}``; configure noise on those native gates. + For example, a Cirq ``X`` gate arriving via QASM 2.0 is decomposed + to ``SX·SX``, so ``noise.sx`` is the relevant field. Defaults to + ``None`` (noiseless). + :kwtype noise: NoiseConfig + :keyword simulator_type: Force a particular simulator backend. + ``"clifford"`` — Clifford-only, fast. Requires a Clifford circuit. + ``"cpu"`` — Full state-vector on CPU. + ``"gpu"`` — Full state-vector on GPU. + ``None`` (default) — GPU if available, CPU otherwise. + :kwtype simulator_type: str + :keyword seed: Optional integer seed for reproducibility. Defaults to ``None``. + :kwtype seed: int + :keyword device: An existing :class:`~qsharp._device._atom.NeutralAtomDevice` + instance to reuse across calls. A default-configured device is + created lazily on the first call when not provided. + :kwtype device: NeutralAtomDevice """ def __init__( @@ -63,28 +83,6 @@ def __init__( seed: Optional[int] = None, device: Optional["NeutralAtomDevice"] = None, ) -> None: - """ - :param noise: Optional :class:`~qsharp._simulation.NoiseConfig` describing - per-gate noise. The device decomposes gates to the native set - ``{Rz, SX, CZ, MResetZ}``; configure noise on those native gates. - For example, a Cirq ``X`` gate arriving via QASM 2.0 is decomposed - to ``SX·SX``, so ``noise.sx`` is the relevant field. Defaults to - ``None`` (noiseless). - :type noise: NoiseConfig, optional - :param simulator_type: Force a particular simulator backend. - ``"clifford"`` — Clifford-only, fast. Requires a Clifford circuit. - ``"cpu"`` — Full state-vector on CPU. - ``"gpu"`` — Full state-vector on GPU. - ``None`` (default) — GPU if available, CPU otherwise. - :type simulator_type: str, optional - :param seed: Optional integer seed for reproducibility. Defaults to ``None``. - :type seed: int, optional - :param device: An existing :class:`~qsharp._device._atom.NeutralAtomDevice` - instance to reuse across calls. A default-configured device is - created lazily on the first call when not provided. - :type device: NeutralAtomDevice, optional - """ - self._noise = noise self._simulator_type = simulator_type self._seed = seed From 69c37be59a34235cf515e76ebf6e3a57b50ceb00 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 17 Apr 2026 13:51:52 -0700 Subject: [PATCH 19/26] Cleaned up some xrefs --- source/pip/qsharp/estimator/_estimator.py | 4 +-- source/pip/qsharp/interop/__init__.py | 11 ++++++ source/pip/qsharp/interop/cirq/__init__.py | 4 +-- .../pip/qsharp/interop/cirq/_neutral_atom.py | 2 -- source/pip/qsharp/interop/qiskit/__init__.py | 34 +++++++++++++------ .../interop/qiskit/backends/backend_base.py | 3 -- .../qiskit/backends/neutral_atom_backend.py | 10 +++--- .../qiskit/backends/neutral_atom_target.py | 1 - .../interop/qiskit/backends/qirtarget.py | 1 - .../interop/qiskit/backends/qsharp_backend.py | 8 ++--- .../interop/qiskit/backends/re_backend.py | 10 +++--- .../pip/qsharp/interop/qiskit/jobs/qsjob.py | 5 +-- .../qsharp/interop/qiskit/jobs/qsjobset.py | 2 +- source/pip/qsharp/openqasm/_circuit.py | 2 +- source/pip/qsharp/openqasm/_estimate.py | 2 +- source/pip/qsharp/openqasm/_run.py | 6 ++-- 16 files changed, 57 insertions(+), 48 deletions(-) diff --git a/source/pip/qsharp/estimator/_estimator.py b/source/pip/qsharp/estimator/_estimator.py index 7f1fdf581e..2349862420 100644 --- a/source/pip/qsharp/estimator/_estimator.py +++ b/source/pip/qsharp/estimator/_estimator.py @@ -560,13 +560,13 @@ class EstimatorParams(EstimatorInputParamsItem): """ Top-level input parameters for the Microsoft Resource Estimator. - Extends :class:`EstimatorInputParamsItem` with support for batching: pass + Extends :class:`~qsharp.estimator.EstimatorInputParamsItem` with support for batching: pass ``num_items`` to create a batching job where each item can override the top-level parameters. :param num_items: Number of batching items. If ``None``, creates a single-point estimation job. - :type num_items: int, optional + :type num_items: int """ MAX_NUM_ITEMS: int = 1000 diff --git a/source/pip/qsharp/interop/__init__.py b/source/pip/qsharp/interop/__init__.py index 59e481eb93..52be9c9134 100644 --- a/source/pip/qsharp/interop/__init__.py +++ b/source/pip/qsharp/interop/__init__.py @@ -1,2 +1,13 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. + +"""Interoperability modules for the Q# ecosystem.""" + +from . import cirq + +try: + from . import qiskit + + __all__ = ["cirq", "qiskit"] +except ImportError: + __all__ = ["cirq"] diff --git a/source/pip/qsharp/interop/cirq/__init__.py b/source/pip/qsharp/interop/cirq/__init__.py index d610e2bfd8..8a484fc8ab 100644 --- a/source/pip/qsharp/interop/cirq/__init__.py +++ b/source/pip/qsharp/interop/cirq/__init__.py @@ -3,11 +3,11 @@ """Cirq interoperability for the Q# ecosystem. -This module provides a :class:`NeutralAtomSampler` — a standard +This module provides a :class:`~qsharp.interop.cirq.NeutralAtomSampler` — a standard ``cirq.Sampler`` that runs Cirq circuits on the local NeutralAtomDevice simulator. -Usage:: +Usage: import cirq from qsharp.interop.cirq import NeutralAtomSampler diff --git a/source/pip/qsharp/interop/cirq/_neutral_atom.py b/source/pip/qsharp/interop/cirq/_neutral_atom.py index 415db3f753..8829e44b9d 100644 --- a/source/pip/qsharp/interop/cirq/_neutral_atom.py +++ b/source/pip/qsharp/interop/cirq/_neutral_atom.py @@ -105,10 +105,8 @@ def run_sweep( """Run the circuit for each parameter resolver in the sweep. :param program: The Cirq circuit to simulate. - :type program: cirq.AbstractCircuit :param params: A ``cirq.Sweepable`` defining the parameter resolvers to sweep over. Each resolver produces one result. - :type params: cirq.Sweepable :param repetitions: Number of shots per parameter resolver. :type repetitions: int :return: A list of :class:`NeutralAtomCirqResult` objects, one per resolver. diff --git a/source/pip/qsharp/interop/qiskit/__init__.py b/source/pip/qsharp/interop/qiskit/__init__.py index 042c6a4d61..9a6cd7a7c7 100644 --- a/source/pip/qsharp/interop/qiskit/__init__.py +++ b/source/pip/qsharp/interop/qiskit/__init__.py @@ -7,28 +7,28 @@ NeutralAtomDevice, allowing Qiskit circuits to be run locally without any cloud connection. -Available backends ------------------- -:class:`QSharpBackend` +Available backends: + +:class:`~qsharp.interop.qiskit.QSharpBackend` Runs any Qiskit ``QuantumCircuit`` using the Q# simulator. Supports noise-free simulation via QASM export and QIR compilation. -:class:`NeutralAtomBackend` +:class:`~qsharp.interop.qiskit.NeutralAtomBackend` Runs Qiskit circuits on the local NeutralAtomDevice simulator. Decomposes gates to the native ``{Rz, SX, CZ}`` gate set and optionally models per-gate noise (including qubit loss). Loss shots are exposed separately from accepted shots in the job result. -:class:`ResourceEstimatorBackend` +:class:`~qsharp.interop.qiskit.ResourceEstimatorBackend` Estimates quantum resources (qubits, T-gates, etc.) for a Qiskit circuit without running a full simulation. -:func:`estimate` +:func:`~qsharp.interop.qiskit.estimate` Convenience function that runs resource estimation on a Qiskit circuit - and returns an :class:`EstimatorResult` directly, without + and returns an :class:`~qsharp.estimator.EstimatorResult` directly, without needing to construct a backend or job manually. -Usage:: +Usage: from qiskit import QuantumCircuit from qsharp.interop.qiskit import NeutralAtomBackend @@ -72,9 +72,8 @@ def estimate( Estimates resources for Qiskit QuantumCircuit. :param circuit: The input Qiskit QuantumCircuit object. - :type circuit: QuantumCircuit :param params: The parameters to configure physical estimation. - :type params: EstimatorParams or dict or list, optional + :type params: EstimatorParams or dict or list :param **options: Additional options for the transpiler, exporter, or Qiskit passes configuration. Defaults to backend config values. Common options: @@ -92,3 +91,18 @@ def estimate( backend = ResourceEstimatorBackend() job = backend.run(circuit, params=params, **options) return job.result() + + +__all__ = [ + "NeutralAtomBackend", + "QSharpBackend", + "ResourceEstimatorBackend", + "QirTarget", + "QsJob", + "QsSimJob", + "ReJob", + "QsJobSet", + "estimate", + "EstimatorParams", + "EstimatorResult", +] diff --git a/source/pip/qsharp/interop/qiskit/backends/backend_base.py b/source/pip/qsharp/interop/qiskit/backends/backend_base.py index d6d9e46629..6464e1d1eb 100644 --- a/source/pip/qsharp/interop/qiskit/backends/backend_base.py +++ b/source/pip/qsharp/interop/qiskit/backends/backend_base.py @@ -475,7 +475,6 @@ def _qasm(self, circuit: QuantumCircuit, **options) -> str: """Converts a Qiskit QuantumCircuit to QASM 3 for the current backend. :param circuit: The QuantumCircuit to be executed. - :type circuit: QuantumCircuit :param **options: Additional options for the transpiler, exporter, or Qiskit passes. Common values include: ``optimization_level``, ``basis_gates``, ``includes``, ``search_path``. Defaults to backend config values. @@ -507,7 +506,6 @@ def _qsharp(self, circuit: QuantumCircuit, **kwargs) -> str: a direct translation of the Qiskit circuit. :param circuit: The QuantumCircuit to be executed. - :type circuit: QuantumCircuit :param **kwargs: Additional options for the transpiler, exporter, or Qiskit passes. Common values include: ``optimization_level``, ``basis_gates``, ``includes``, ``search_path``, ``output_semantics``. Defaults to backend config values. @@ -543,7 +541,6 @@ def qir( Converts a Qiskit QuantumCircuit to QIR (Quantum Intermediate Representation). :param circuit: The input Qiskit QuantumCircuit object. - :type circuit: QuantumCircuit :param **kwargs: Common options: - ``target_profile`` (TargetProfile): The target profile for the backend. Defaults to backend config value. diff --git a/source/pip/qsharp/interop/qiskit/backends/neutral_atom_backend.py b/source/pip/qsharp/interop/qiskit/backends/neutral_atom_backend.py index e61c6a55eb..e78ac94d46 100644 --- a/source/pip/qsharp/interop/qiskit/backends/neutral_atom_backend.py +++ b/source/pip/qsharp/interop/qiskit/backends/neutral_atom_backend.py @@ -85,17 +85,16 @@ def __init__( :param device: The NeutralAtomDevice instance to use for compilation and simulation. A default-configured device is created automatically if not provided. Pass a custom device to control the qubit layout (column count, zone dimensions, etc.). - :type device: NeutralAtomDevice, optional + :type device: NeutralAtomDevice :param target: Qiskit transpiler target. Defaults to the NeutralAtomDevice native gate set ``{rz, sx, cz, measure, reset}``. Override only if you need a custom decomposition strategy. - :type target: Target, optional :param qiskit_pass_options: Options forwarded to Qiskit pre-transpilation passes. - :type qiskit_pass_options: Dict, optional + :type qiskit_pass_options: Dict :param transpile_options: Options forwarded to ``qiskit.transpile()``. - :type transpile_options: Dict, optional + :type transpile_options: Dict :param qasm_export_options: Options forwarded to the Qiskit QASM3 exporter. - :type qasm_export_options: Dict, optional + :type qasm_export_options: Dict :param skip_transpilation: Skip Qiskit transpilation. Useful when the circuit is already expressed in terms of the target gate set. :type skip_transpilation: bool @@ -159,7 +158,6 @@ def run( """Simulate the given circuit(s) using the NeutralAtomDevice pipeline. :param run_input: A single ``QuantumCircuit`` or a list of them. - :type run_input: QuantumCircuit or List[QuantumCircuit] :param **options: Per-call option overrides. Common options: - ``name`` (str): Backend name for job metadata. Defaults to the circuit name. diff --git a/source/pip/qsharp/interop/qiskit/backends/neutral_atom_target.py b/source/pip/qsharp/interop/qiskit/backends/neutral_atom_target.py index 4016f3c3a7..3502e95562 100644 --- a/source/pip/qsharp/interop/qiskit/backends/neutral_atom_target.py +++ b/source/pip/qsharp/interop/qiskit/backends/neutral_atom_target.py @@ -30,7 +30,6 @@ def build_target( :param num_qubits: Number of qubits. ``None`` means no limit (simulator). :return: A ``Target`` containing ``{rz, sx, cz, measure, reset}``. - :rtype: Target """ target = Target(num_qubits=num_qubits) diff --git a/source/pip/qsharp/interop/qiskit/backends/qirtarget.py b/source/pip/qsharp/interop/qiskit/backends/qirtarget.py index d4be2c79b3..b88f2056a1 100644 --- a/source/pip/qsharp/interop/qiskit/backends/qirtarget.py +++ b/source/pip/qsharp/interop/qiskit/backends/qirtarget.py @@ -121,7 +121,6 @@ def build_target( :param supports_delay: Whether to include delay operations in the target. Defaults to ``False``. :return: A Qiskit ``Target`` object configured with quantum gates and operations. - :rtype: Target """ target = Target(num_qubits=num_qubits) diff --git a/source/pip/qsharp/interop/qiskit/backends/qsharp_backend.py b/source/pip/qsharp/interop/qiskit/backends/qsharp_backend.py index 64be8d2348..c23db5d849 100644 --- a/source/pip/qsharp/interop/qiskit/backends/qsharp_backend.py +++ b/source/pip/qsharp/interop/qiskit/backends/qsharp_backend.py @@ -38,13 +38,12 @@ def __init__( ): """ :param target: The target to use for the backend. - :type target: Target, optional :param qiskit_pass_options: Options for the Qiskit passes. - :type qiskit_pass_options: Dict, optional + :type qiskit_pass_options: Dict :param transpile_options: Options for the transpiler. - :type transpile_options: Dict, optional + :type transpile_options: Dict :param qasm_export_options: Options for the QASM3 exporter. - :type qasm_export_options: Dict, optional + :type qasm_export_options: Dict :param skip_transpilation: Skip Qiskit transpilation. :type skip_transpilation: bool :param **options: Default option overrides. These can also be overridden per-call via @@ -94,7 +93,6 @@ def run( Runs the given QuantumCircuit using the Q# simulator. :param run_input: The QuantumCircuit to be executed. - :type run_input: QuantumCircuit :param **options: Per-call option overrides. Common options: - ``name`` (str): The name of the circuit used as the entry point. Defaults to the circuit name. diff --git a/source/pip/qsharp/interop/qiskit/backends/re_backend.py b/source/pip/qsharp/interop/qiskit/backends/re_backend.py index fc3166bc63..9e523d2bc8 100644 --- a/source/pip/qsharp/interop/qiskit/backends/re_backend.py +++ b/source/pip/qsharp/interop/qiskit/backends/re_backend.py @@ -48,13 +48,12 @@ def __init__( ): """ :param target: The target to use for the backend. - :type target: Target, optional :param qiskit_pass_options: Options for the Qiskit passes. - :type qiskit_pass_options: Dict, optional + :type qiskit_pass_options: Dict :param transpile_options: Options for the transpiler. - :type transpile_options: Dict, optional + :type transpile_options: Dict :param qasm_export_options: Options for the QASM3 exporter. - :type qasm_export_options: Dict, optional + :type qasm_export_options: Dict :param skip_transpilation: Skip Qiskit transpilation. :type skip_transpilation: bool :param **options: Default option overrides. These can also be overridden per-call via @@ -104,9 +103,8 @@ def run( to OpenQASM 3. :param run_input: The input Qiskit QuantumCircuit object. - :type run_input: QuantumCircuit :param params: Configuration values for resource estimation. - :type params: EstimatorParams, optional + :type params: EstimatorParams :param **options: Per-call option overrides. Common options: - ``params`` (EstimatorParams): Configuration values for resource estimation. diff --git a/source/pip/qsharp/interop/qiskit/jobs/qsjob.py b/source/pip/qsharp/interop/qiskit/jobs/qsjob.py index 8faeb60b40..72ca6f8481 100644 --- a/source/pip/qsharp/interop/qiskit/jobs/qsjob.py +++ b/source/pip/qsharp/interop/qiskit/jobs/qsjob.py @@ -45,15 +45,12 @@ def __init__( ) -> None: """ :param backend: The backend on which the job is run. - :type backend: Optional[BackendV2] :param job_id: A unique identifier for the job. :type job_id: str :param job_callable: The callable that executes the circuit and returns a result. - :type job_callable: RunInputCallable :param run_input: The quantum circuit to execute. - :type run_input: QuantumCircuit :param input_params: Parameters forwarded to ``job_callable`` at execution time. - :type input_params: Dict[str, Any] + :type input_params: Dict :param executor: Thread pool executor. Uses a default single-threaded executor if not provided. :param **kwargs: Additional keyword arguments passed to ``qiskit.providers.JobV1``. diff --git a/source/pip/qsharp/interop/qiskit/jobs/qsjobset.py b/source/pip/qsharp/interop/qiskit/jobs/qsjobset.py index afc73a8a4b..0a20908079 100644 --- a/source/pip/qsharp/interop/qiskit/jobs/qsjobset.py +++ b/source/pip/qsharp/interop/qiskit/jobs/qsjobset.py @@ -28,7 +28,7 @@ class QsJobSet(Job): A Qiskit job set that runs multiple quantum circuits concurrently. Each circuit in ``run_input`` is submitted as an individual - :class:`QsSimJob` and executed in a thread pool. + :class:`~qsharp.interop.qiskit.jobs.qsjob.QsSimJob` and executed in a thread pool. :meth:`result` blocks until all constituent jobs are complete and aggregates their ``qiskit.result.Result`` objects into a single combined result. diff --git a/source/pip/qsharp/openqasm/_circuit.py b/source/pip/qsharp/openqasm/_circuit.py index be2342a191..1d8db600b5 100644 --- a/source/pip/qsharp/openqasm/_circuit.py +++ b/source/pip/qsharp/openqasm/_circuit.py @@ -27,7 +27,7 @@ def circuit( :param source: An OpenQASM program. Alternatively, a callable can be provided, which must be an already imported global callable. - :type source: str, optional + :type source: str :param *args: The arguments to pass to the callable, if one is provided. :param generation_method: The method to use for circuit generation. ``CircuitGenerationMethod.ClassicalEval`` evaluates classical control flow at circuit diff --git a/source/pip/qsharp/openqasm/_estimate.py b/source/pip/qsharp/openqasm/_estimate.py index 8f32306f0e..daf5434807 100644 --- a/source/pip/qsharp/openqasm/_estimate.py +++ b/source/pip/qsharp/openqasm/_estimate.py @@ -33,7 +33,7 @@ def estimate( which must be an already imported global callable. :type source: str :param params: The parameters to configure estimation. - :type params: Dict, List, or EstimatorParams, optional + :type params: Dict, List, or EstimatorParams :param *args: The arguments to pass to the callable, if one is provided. :param **kwargs: Additional keyword arguments. Common options: diff --git a/source/pip/qsharp/openqasm/_run.py b/source/pip/qsharp/openqasm/_run.py index a10d4b1a14..1e8bcbef95 100644 --- a/source/pip/qsharp/openqasm/_run.py +++ b/source/pip/qsharp/openqasm/_run.py @@ -56,14 +56,14 @@ def run( :param *args: The arguments to pass to the callable, if one is provided. :param on_result: A callback function that will be called with each result. Only used when a callable is provided. - :type on_result: Callable, optional + :type on_result: Callable :param save_events: If true, the output of each shot will be saved. If false, they will be printed. Only used when a callable is provided. :type save_events: bool :param noise: The noise to use in simulation. - :type noise: Union[Tuple[float, float, float], PauliNoise, BitFlipNoise, PhaseFlipNoise, DepolarizingNoise, NoiseConfig], optional + :type noise: Union[Tuple[float, float, float], PauliNoise, BitFlipNoise, PhaseFlipNoise, DepolarizingNoise, NoiseConfig] :param qubit_loss: The probability of qubit loss in simulation. - :type qubit_loss: float, optional + :type qubit_loss: float :param as_bitstring: If true, the result registers will be converted to bitstrings. :type as_bitstring: bool :param **kwargs: Additional keyword arguments for compiling the source program. Common options: From 73cf37a516f67dcd23600f3370c2c7c6e04a486a Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 17 Apr 2026 15:13:42 -0700 Subject: [PATCH 20/26] try undoing something --- source/pip/qsharp/interop/__init__.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/source/pip/qsharp/interop/__init__.py b/source/pip/qsharp/interop/__init__.py index 52be9c9134..379559deb5 100644 --- a/source/pip/qsharp/interop/__init__.py +++ b/source/pip/qsharp/interop/__init__.py @@ -2,12 +2,3 @@ # Licensed under the MIT License. """Interoperability modules for the Q# ecosystem.""" - -from . import cirq - -try: - from . import qiskit - - __all__ = ["cirq", "qiskit"] -except ImportError: - __all__ = ["cirq"] From 0bbf281863cfa73fef20fb4f1b5c7ac27447beb6 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 17 Apr 2026 15:22:14 -0700 Subject: [PATCH 21/26] try again --- source/pip/qsharp/interop/qiskit/__init__.py | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/source/pip/qsharp/interop/qiskit/__init__.py b/source/pip/qsharp/interop/qiskit/__init__.py index 9a6cd7a7c7..59de453fe1 100644 --- a/source/pip/qsharp/interop/qiskit/__init__.py +++ b/source/pip/qsharp/interop/qiskit/__init__.py @@ -93,16 +93,16 @@ def estimate( return job.result() -__all__ = [ - "NeutralAtomBackend", - "QSharpBackend", - "ResourceEstimatorBackend", - "QirTarget", - "QsJob", - "QsSimJob", - "ReJob", - "QsJobSet", - "estimate", - "EstimatorParams", - "EstimatorResult", -] +# __all__ = [ +# "NeutralAtomBackend", +# "QSharpBackend", +# "ResourceEstimatorBackend", +# "QirTarget", +# "QsJob", +# "QsSimJob", +# "ReJob", +# "QsJobSet", +# "estimate", +# "EstimatorParams", +# "EstimatorResult", +# ] From 5ee82adf621b459706c13d8ccd1fb8231c84d04a Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 17 Apr 2026 15:32:05 -0700 Subject: [PATCH 22/26] fix --- source/pip/qsharp/interop/qiskit/jobs/qsjob.py | 1 + 1 file changed, 1 insertion(+) diff --git a/source/pip/qsharp/interop/qiskit/jobs/qsjob.py b/source/pip/qsharp/interop/qiskit/jobs/qsjob.py index 72ca6f8481..23c3f27281 100644 --- a/source/pip/qsharp/interop/qiskit/jobs/qsjob.py +++ b/source/pip/qsharp/interop/qiskit/jobs/qsjob.py @@ -63,6 +63,7 @@ def __init__( self._job_callable = job_callable self._status = JobStatus.INITIALIZING self._submit_start_time: Optional[float] = None + super().__init__(backend, job_id, **kwargs) def submit(self): """Submit the job to the backend for execution. From 103409a3ee00b5662a872560efe60bc0591c7855 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 17 Apr 2026 15:59:38 -0700 Subject: [PATCH 23/26] bring it back --- source/pip/qsharp/interop/qiskit/__init__.py | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/source/pip/qsharp/interop/qiskit/__init__.py b/source/pip/qsharp/interop/qiskit/__init__.py index 59de453fe1..9a6cd7a7c7 100644 --- a/source/pip/qsharp/interop/qiskit/__init__.py +++ b/source/pip/qsharp/interop/qiskit/__init__.py @@ -93,16 +93,16 @@ def estimate( return job.result() -# __all__ = [ -# "NeutralAtomBackend", -# "QSharpBackend", -# "ResourceEstimatorBackend", -# "QirTarget", -# "QsJob", -# "QsSimJob", -# "ReJob", -# "QsJobSet", -# "estimate", -# "EstimatorParams", -# "EstimatorResult", -# ] +__all__ = [ + "NeutralAtomBackend", + "QSharpBackend", + "ResourceEstimatorBackend", + "QirTarget", + "QsJob", + "QsSimJob", + "ReJob", + "QsJobSet", + "estimate", + "EstimatorParams", + "EstimatorResult", +] From 0873bcc5d8ae0d6ab7cdd5543c0713ad6a9d5efa Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Mon, 20 Apr 2026 12:00:00 -0700 Subject: [PATCH 24/26] fixups to `circuit` function documentation. --- source/pip/qsharp/_qsharp.py | 48 ++++++++++++++++--------- source/pip/qsharp/openqasm/_circuit.py | 49 +++++++++++++++++--------- 2 files changed, 64 insertions(+), 33 deletions(-) diff --git a/source/pip/qsharp/_qsharp.py b/source/pip/qsharp/_qsharp.py index 9de02fa6b3..a1a7d1ae37 100644 --- a/source/pip/qsharp/_qsharp.py +++ b/source/pip/qsharp/_qsharp.py @@ -310,6 +310,12 @@ def init( :keyword language_features: An optional list of language feature flags to enable. These correspond to experimental or preview Q# language features. + Valid values are: + + - ``"v2-preview-syntax"``: Enables Q# v2 preview syntax. This removes support for + the scoped qubit allocation block form (``use q = Qubit() { ... }``), requiring + the statement form instead (``use q = Qubit();``). It also removes the requirement + to use the ``set`` keyword for mutable variable assignments. :keyword trace_circuit: Enables tracing of circuit during execution. Passing `True` is required for the `dump_circuit` function to return a circuit. @@ -965,33 +971,41 @@ def circuit( :param entry_expr: An entry expression. Alternatively, a callable can be provided, which must be a Q# callable. + :type entry_expr: str or Callable :param *args: The arguments to pass to the callable, if one is provided. - :param operation: The operation to synthesize. This can be a name of - an operation of a lambda expression. The operation must take only - qubits or arrays of qubits as parameters. + :keyword operation: The operation to synthesize. This can be a name of + an operation or a lambda expression. The operation must take only + qubits or arrays of qubits as parameters. + :kwtype operation: str - :param generation_method: The method to use for circuit generation. - ``CircuitGenerationMethod.ClassicalEval`` evaluates classical control flow at circuit - generation time. ``CircuitGenerationMethod.Simulate`` runs a full simulation to trace - the circuit. ``CircuitGenerationMethod.Static`` uses partial evaluation and requires - a non-``Unrestricted`` target profile. Defaults to ``None`` (auto-selected). + :keyword generation_method: The method to use for circuit generation. + :attr:`~qsharp.CircuitGenerationMethod.ClassicalEval` evaluates classical + control flow at circuit generation time. + :attr:`~qsharp.CircuitGenerationMethod.Simulate` runs a full simulation to + trace the circuit. + :attr:`~qsharp.CircuitGenerationMethod.Static` uses partial evaluation and + requires a non-``Unrestricted`` target profile. Defaults to ``None`` which + auto-selects the generation method. + :kwtype generation_method: :class:`~qsharp.CircuitGenerationMethod` - :param max_operations: The maximum number of operations to include in the circuit. - Defaults to ``None`` (no limit). + :keyword max_operations: The maximum number of operations to include in the circuit. + Defaults to ``None`` which means no limit. + :kwtype max_operations: int - :param source_locations: If ``True``, annotates each gate with its source location. - Defaults to ``False``. + :keyword source_locations: If ``True``, annotates each gate with its source location. + :kwtype source_locations: bool - :param group_by_scope: If ``True``, groups operations by their Q# scope (e.g. operation body). - Defaults to ``True``. + :keyword group_by_scope: If ``True``, groups operations by their containing scope, such as function declarations or loop blocks. + :kwtype group_by_scope: bool - :param prune_classical_qubits: If ``True``, removes qubits that are never used in a quantum - gate (e.g. qubits only used as classical controls). Defaults to ``False``. + :keyword prune_classical_qubits: If ``True``, removes qubits that are never used in a quantum + gate (e.g. qubits only used as classical controls). + :kwtype prune_classical_qubits: bool :return: The synthesized circuit. - :rtype: Circuit + :rtype: :class:`~qsharp._native.Circuit` :raises QSharpError: If there is an error synthesizing the circuit. """ ipython_helper() diff --git a/source/pip/qsharp/openqasm/_circuit.py b/source/pip/qsharp/openqasm/_circuit.py index 1d8db600b5..eaed78cba8 100644 --- a/source/pip/qsharp/openqasm/_circuit.py +++ b/source/pip/qsharp/openqasm/_circuit.py @@ -27,27 +27,44 @@ def circuit( :param source: An OpenQASM program. Alternatively, a callable can be provided, which must be an already imported global callable. - :type source: str + :type source: str or Callable + :param *args: The arguments to pass to the callable, if one is provided. - :param generation_method: The method to use for circuit generation. - ``CircuitGenerationMethod.ClassicalEval`` evaluates classical control flow at circuit - generation time. ``CircuitGenerationMethod.Simulate`` runs a full simulation to trace - the circuit. ``CircuitGenerationMethod.Static`` uses partial evaluation and requires - a non-``Unrestricted`` target profile. Defaults to ``None`` (auto-selected). - :param max_operations: The maximum number of operations to include in the circuit. - Defaults to ``None`` (no limit). - :param source_locations: If ``True``, annotates each gate with its source location. + + :keyword generation_method: The method to use for circuit generation. + :attr:`~qsharp.CircuitGenerationMethod.ClassicalEval` evaluates classical + control flow at circuit generation time. + :attr:`~qsharp.CircuitGenerationMethod.Simulate` runs a full simulation to + trace the circuit. + :attr:`~qsharp.CircuitGenerationMethod.Static` uses partial evaluation and + requires a non-``Unrestricted`` target profile. Defaults to ``None`` which + auto-selects the generation method. + :kwtype generation_method: :class:`~qsharp.CircuitGenerationMethod` + + :keyword max_operations: The maximum number of operations to include in the circuit. + Defaults to ``None`` which means no limit. + :kwtype max_operations: int + + :keyword source_locations: If ``True``, annotates each gate with its source location. Defaults to ``False``. - :param group_by_scope: If ``True``, groups operations by their Q# scope. + :kwtype source_locations: bool + + :keyword group_by_scope: If ``True``, groups operations by their containing scope, such as function declarations or loop blocks. Defaults to ``True``. - :param prune_classical_qubits: If ``True``, removes qubits that are never used in a quantum - gate. Defaults to ``False``. - :param **kwargs: Additional keyword arguments. Common options: + :kwtype group_by_scope: bool + + :keyword prune_classical_qubits: If ``True``, removes qubits that are never used in a quantum + gate (e.g. qubits only used as classical controls). Defaults to ``False``. + :kwtype prune_classical_qubits: bool + + :keyword name: The name of the program. This is used as the entry point for the program. + :kwtype name: str + + :keyword search_path: The optional search path for resolving file references. + :kwtype search_path: str - - ``name`` (str): The name of the program. This is used as the entry point for the program. - - ``search_path`` (str): The optional search path for resolving file references. :return: The synthesized circuit. - :rtype: Circuit + :rtype: :class:`~qsharp._native.Circuit` :raises QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. :raises QSharpError: If there is an error evaluating or synthesizing the circuit. """ From fcef59cb70c9a2fca2d66e6e5659b68bff41975a Mon Sep 17 00:00:00 2001 From: Scott Carda <55811729+ScottCarda-MS@users.noreply.github.com> Date: Mon, 20 Apr 2026 12:19:40 -0700 Subject: [PATCH 25/26] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- source/pip/qsharp/_native.pyi | 4 ++-- source/pip/qsharp/openqasm/_compile.py | 2 ++ source/pip/qsharp/openqasm/_estimate.py | 2 ++ source/pip/qsharp/openqasm/_run.py | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/pip/qsharp/_native.pyi b/source/pip/qsharp/_native.pyi index bf93f33fd0..62949e3c11 100644 --- a/source/pip/qsharp/_native.pyi +++ b/source/pip/qsharp/_native.pyi @@ -258,8 +258,8 @@ class Interpreter: :param entry_expr: An entry expression. :keyword operation: The operation to synthesize. This can be a name of - an operation of a lambda expression. The operation must take only - qubits or arrays of qubits as parameters. + an operation of a lambda expression. The operation must take only + qubits or arrays of qubits as parameters. :keyword callable: The callable to synthesize the circuit for, if no entry expression is provided. diff --git a/source/pip/qsharp/openqasm/_compile.py b/source/pip/qsharp/openqasm/_compile.py index 5b7877e299..6f641c8c10 100644 --- a/source/pip/qsharp/openqasm/_compile.py +++ b/source/pip/qsharp/openqasm/_compile.py @@ -41,6 +41,8 @@ def compile( - ``output_semantics`` (OutputSemantics): The output semantics for the compilation. :return: The compiled program. Use ``str()`` to get the QIR string. :rtype: QirInputData + :raises ValueError: If ``source`` is neither a string nor a callable with a + ``__global_callable`` attribute. :raises QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. :raises QSharpError: If there is an error compiling the program. diff --git a/source/pip/qsharp/openqasm/_estimate.py b/source/pip/qsharp/openqasm/_estimate.py index daf5434807..274137857c 100644 --- a/source/pip/qsharp/openqasm/_estimate.py +++ b/source/pip/qsharp/openqasm/_estimate.py @@ -42,6 +42,8 @@ def estimate( - ``search_path`` (str): The optional search path for resolving imports. :return: The estimated resources. :rtype: EstimatorResult + :raises ValueError: If ``source`` is neither a string nor a callable with a + ``__global_callable`` attribute. :raises QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. :raises QSharpError: If there is an error compiling the program. """ diff --git a/source/pip/qsharp/openqasm/_run.py b/source/pip/qsharp/openqasm/_run.py index 1e8bcbef95..1f331d040a 100644 --- a/source/pip/qsharp/openqasm/_run.py +++ b/source/pip/qsharp/openqasm/_run.py @@ -73,12 +73,12 @@ def run( - ``search_path`` (str): The optional search path for resolving file references. - ``output_semantics`` (OutputSemantics): The output semantics for the compilation. - ``seed`` (int): The seed to use for the random number generator. - :return: A list of results or runtime errors. If ``save_events`` is true, a list of ShotResults is returned. + :return: A list of results or runtime errors. If ``save_events`` is true, a list of ``ShotResult`` values is returned. :rtype: List[Any] :raises QasmError: If there is an error generating, parsing, or analyzing the OpenQASM source. :raises QSharpError: If there is an error interpreting the input. :raises ValueError: If the number of shots is less than 1. - :raises ValueError: If ``on_result`` or ``save_events`` are used when running OpenQASM programs. + :raises QasmError: If ``on_result`` or ``save_events`` are used when running OpenQASM programs. """ ipython_helper() From c09fea037b23f48d563b4dc0515cdefcb09f0fe4 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Mon, 20 Apr 2026 12:22:51 -0700 Subject: [PATCH 26/26] PR suggestions --- source/pip/qsharp/_native.pyi | 2 -- .../pip/qsharp/interop/qiskit/backends/backend_base.py | 10 +++++----- source/pip/qsharp/openqasm/_compile.py | 2 +- source/pip/qsharp/openqasm/_estimate.py | 2 +- source/pip/qsharp/openqasm/_run.py | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/source/pip/qsharp/_native.pyi b/source/pip/qsharp/_native.pyi index bf93f33fd0..d0ea7ae2e2 100644 --- a/source/pip/qsharp/_native.pyi +++ b/source/pip/qsharp/_native.pyi @@ -485,8 +485,6 @@ class Circuit: A quantum circuit diagram generated from a Q# or OpenQASM program. Returned by :func:`qsharp.circuit` and :func:`qsharp.dump_circuit`. - Use :meth:`json` to obtain a JSON representation suitable for rendering - with the Q# circuit widget. """ def json(self) -> str: ... diff --git a/source/pip/qsharp/interop/qiskit/backends/backend_base.py b/source/pip/qsharp/interop/qiskit/backends/backend_base.py index 6464e1d1eb..8d24a45499 100644 --- a/source/pip/qsharp/interop/qiskit/backends/backend_base.py +++ b/source/pip/qsharp/interop/qiskit/backends/backend_base.py @@ -113,7 +113,7 @@ def __init__( transpile_options: Optional[Dict[str, Any]] = None, qasm_export_options: Optional[Dict[str, Any]] = None, skip_transpilation: bool = False, - **fields, + **options, ): """ :param target: The target to use for the backend. @@ -128,18 +128,18 @@ def __init__( backend_version="0.0.1", ) - if fields is not None: + if options is not None: # we need to rename the seed_simulator to seed. This # is a convenience for aer users. # if the user passes in seed_simulator, we will rename it to seed # but only if the seed field is defined in the backend options. - if "seed_simulator" in fields and "seed" in self._options.data: + if "seed_simulator" in options and "seed" in self._options.data: warn("seed_simulator passed, but field is called seed.") - fields["seed"] = fields.pop("seed_simulator") + options["seed"] = options.pop("seed_simulator") # updates the options with the fields passed in, if the backend # doesn't have the field, it will raise an error. - self.set_options(**fields) + self.set_options(**options) self._qiskit_pass_options = Options( supports_barrier=False, diff --git a/source/pip/qsharp/openqasm/_compile.py b/source/pip/qsharp/openqasm/_compile.py index 5b7877e299..584c15a21d 100644 --- a/source/pip/qsharp/openqasm/_compile.py +++ b/source/pip/qsharp/openqasm/_compile.py @@ -31,7 +31,7 @@ def compile( :param source: An OpenQASM program. Alternatively, a callable can be provided, which must be an already imported global callable. - :type source: str + :type source: str or Callable :param *args: The arguments to pass to the callable, if one is provided. :param **kwargs: Additional keyword arguments for compiling the source program. Common options: diff --git a/source/pip/qsharp/openqasm/_estimate.py b/source/pip/qsharp/openqasm/_estimate.py index daf5434807..b53ffa9063 100644 --- a/source/pip/qsharp/openqasm/_estimate.py +++ b/source/pip/qsharp/openqasm/_estimate.py @@ -31,7 +31,7 @@ def estimate( :param source: An OpenQASM program. Alternatively, a callable can be provided, which must be an already imported global callable. - :type source: str + :type source: str or Callable :param params: The parameters to configure estimation. :type params: Dict, List, or EstimatorParams :param *args: The arguments to pass to the callable, if one is provided. diff --git a/source/pip/qsharp/openqasm/_run.py b/source/pip/qsharp/openqasm/_run.py index 1e8bcbef95..3841298b88 100644 --- a/source/pip/qsharp/openqasm/_run.py +++ b/source/pip/qsharp/openqasm/_run.py @@ -50,7 +50,7 @@ def run( :param source: An OpenQASM program. Alternatively, a callable can be provided, which must be an already imported global callable. - :type source: str + :type source: str or Callable :param shots: The number of shots to run. Defaults to ``1024``. :type shots: int :param *args: The arguments to pass to the callable, if one is provided.