magnet_squareยถ

MagnetSquare - Magnetization Square on Specific Direction (qurry.qurries.magnet_square)

Formerly known as qurmagsq

argumentsยถ

MagnetSquare - Arguments (qurry.qurries.magnet_square.arguments)

class qurry.qurries.magnet_square.arguments.MagnetSquareAnalyzeArgs[source]ยถ

The input of the analyze method.

class qurry.qurries.magnet_square.arguments.MagnetSquareArguments(exp_name: str = 'exps', num_qubits: int = 0, unitary_operator: Operator | Gate | Literal['x', 'y', 'z'] = 'z')[source]ยถ

Arguments for the experiment.

exp_name: str = 'exps'ยถ

The name of the experiment. Naming this experiment to recognize it when the jobs are pending to IBMQ Service. This name is also used for creating a folder to store the exports. Defaults to โ€˜experimentโ€™.

num_qubits: int = 0ยถ

The number of qubits.

unitary_operator: Operator | Gate | Literal['x', 'y', 'z'] = 'z'ยถ

The unitary operator to apply. It can be a qiskit.quantum_info.Operator, a qiskit.circuit.Gate, or a string representing the axis of rotation (โ€˜xโ€™, โ€˜yโ€™, or โ€˜zโ€™). Defaults to โ€˜zโ€™.

class qurry.qurries.magnet_square.arguments.MagnetSquareMeasureArgs[source]ยถ

Output arguments for output().

unitary_operator: Operator | Gate | Literal['x', 'y', 'z']ยถ

The unitary operator to apply. It can be a qiskit.quantum_info.Operator, a qiskit.circuit.Gate, or a string representing the axis of rotation (โ€˜xโ€™, โ€˜yโ€™, or โ€˜zโ€™). Defaults to โ€˜zโ€™.

wave: QuantumCircuit | Hashable | Noneยถ

The key or the circuit to execute.

class qurry.qurries.magnet_square.arguments.MagnetSquareOutputArgs[source]ยถ

Output arguments for output().

unitary_operator: Operator | Gate | Literal['x', 'y', 'z']ยถ

The unitary operator to apply. It can be a qiskit.quantum_info.Operator, a qiskit.circuit.Gate, or a string representing the axis of rotation (โ€˜xโ€™, โ€˜yโ€™, or โ€˜zโ€™). Defaults to โ€˜zโ€™.

analysisยถ

MagnetSquare - Analysis (qurry.qurries.magnet_square.analysis)

class qurry.qurries.magnet_square.analysis.MSAnalysisContent(magnet_square: float | float64, num_qubits: int, shots: int, unitary_operator: str | ndarray[tuple[int, ...], dtype[float64]] | ndarray[tuple[int, ...], dtype[complex128]], magnet_square_cells: dict[int, float64], taking_time: float | None = None)[source]ยถ

The content of the analysis.

magnet_square: float | float64ยถ

Magnetic Square.

magnet_square_cells: dict[int, float64]ยถ

Magnetic Square cells.

num_qubits: intยถ

The number of qubits.

shots: intยถ

The number of shots.

taking_time: float | Noneยถ

Taking time.

unitary_operator: str | ndarray[tuple[int, ...], dtype[float64]] | ndarray[tuple[int, ...], dtype[complex128]]ยถ

The numpy array of the unitary operator or a string representing the axis of rotation.

class qurry.qurries.magnet_square.analysis.MSAnalysisInput[source]ยถ

To set the analysis.

class qurry.qurries.magnet_square.analysis.MagnetSquareAnalysis(*, serial: int, log: dict[str, Any] | None = None, datatime: str | None = None, **other_kwargs)[source]ยถ

The container for the analysis of :cls:`MagnetSquareExperiment`.

classmethod content_type() Type[MSAnalysisContent][source]ยถ

The content instance type.

classmethod input_type() Type[MSAnalysisInput][source]ยถ

The input instance type.

property side_product_fields: Iterable[str]ยถ

The fields that will be stored as side product.

utilsยถ

Magnetic Square - Utility (qurry.qurries.magnet_square.utils)

qurry.qurries.magnet_square.utils.circuit_method(idx: int, target_circuit: QuantumCircuit, target_key: str, exp_name: str, unitary_operator: Operator | Gate | Literal['x', 'y', 'z'], i: int, j: int) QuantumCircuit[source]ยถ

Build the circuit for the experiment.

Parameters:
  • idx (int) โ€“ Index of the quantum circuit.

  • target_circuit (QuantumCircuit) โ€“ Target circuit.

  • target_key (Hashable) โ€“ Target key.

  • exp_name (str) โ€“ Experiment name.

  • unitary_operator (Union[Operator, Gate, Literal["x", "y", "z"]]) โ€“ The unitary operator to apply. It can be a qiskit.quantum_info.Operator, a qiskit.circuit.Gate, or a string representing the axis of rotation (โ€˜xโ€™, โ€˜yโ€™, or โ€˜zโ€™).

  • i (int) โ€“ The index of the target qubit.

  • j (int) โ€“ The index of the target qubit.

Returns:

The circuit for the experiment.

Return type:

QuantumCircuit

experimentยถ

MagnetSquare - Experiment (qurry.qurries.magnet_square.experiment)

class qurry.qurries.magnet_square.experiment.MagnetSquareExperiment(arguments: _A | dict[str, Any], commonparams: Commonparams | dict[str, Any], outfields: dict[str, Any], beforewards: Before | None = None, afterwards: After | None = None, reports: AnalysesContainer | None = None)[source]ยถ

The instance of experiment.

property analysis_instance: Type[MagnetSquareAnalysis]ยถ

The analysis instance for this experiment.

analyze(pbar: tqdm | None = None) MagnetSquareAnalysis[source]ยถ

Calculate magnet square with more information combined.

Parameters:

pbar (Optional[tqdm.tqdm], optional) โ€“ The progress bar. Defaults to None.

Returns:

The result of the analysis.

Return type:

MagnetSquareAnalysis

property arguments_instance: Type[MagnetSquareArguments]ยถ

The arguments instance for this experiment.

classmethod method(targets: list[tuple[Hashable, QuantumCircuit]], arguments: MagnetSquareArguments, pbar: tqdm | None = None, multiprocess: bool = True) tuple[list[QuantumCircuit], dict[str, Any]][source]ยถ

The method to construct circuit.

Parameters:
  • targets (list[tuple[Hashable, QuantumCircuit]]) โ€“ The circuits of the experiment.

  • arguments (MagnetSquareArguments) โ€“ The arguments of the experiment.

  • pbar (Optional[tqdm.tqdm], optional) โ€“ The progress bar for showing the progress of the experiment. Defaults to None.

  • multiprocess (bool, optional) โ€“ Whether to use multiprocessing. Defaults to True.

Returns:

The circuits of the experiment and the side products.

Return type:

tuple[list[QuantumCircuit], dict[str, Any]]

classmethod params_control(targets: list[tuple[Hashable, QuantumCircuit]], exp_name: str = 'exps', unitary_operator: Operator | Gate | Literal['x', 'y', 'z'] = 'z', **custom_kwargs: Any) tuple[MagnetSquareArguments, Commonparams, dict[str, Any]][source]ยถ

Handling all arguments and initializing a single experiment.

Parameters:
  • targets (list[tuple[Hashable, QuantumCircuit]]) โ€“ The circuits of the experiment.

  • unitary_operator (Union[Operator, Gate, Literal["x", "y", "z"]]) โ€“ The unitary operator to apply. It can be a qiskit.quantum_info.Operator, a qiskit.circuit.Gate, or a string representing the axis of rotation (โ€˜xโ€™, โ€˜yโ€™, or โ€˜zโ€™).

  • exp_name (str, optional) โ€“ The name of the experiment. Naming this experiment to recognize it when the jobs are pending to IBMQ Service. This name is also used for creating a folder to store the exports. Defaults to โ€˜expsโ€™.

  • custom_kwargs (Any) โ€“ The custom parameters.

Returns:

The arguments of the experiment, the common parameters, and the custom parameters.

Return type:

tuple[MagnetSquareArguments, Commonparams, dict[str, Any]]

classmethod quantities(shots: int | None = None, counts: list[dict[str, int]] | None = None, num_qubits: int | None = None, unitary_operator: str | ndarray[tuple[int, ...], dtype[float64]] | ndarray[tuple[int, ...], dtype[complex128]] | None = None, backend: Literal['Cython', 'Rust', 'Python'] | str = 'Rust', pbar: tqdm | None = None) MagnetSquare[source]ยถ

Calculate magnet square with more information combined.

Parameters:
  • shots (int) โ€“ The number of shots.

  • counts (list[dict[str, int]]) โ€“ The counts of the experiment.

  • num_qubits (int) โ€“ The number of qubits.

  • unitary_operator (Union[str, npt.NDArray[np.float64], npt.NDArray[np.complex128]]) โ€“ The numpy array of the unitary operator or a string representing the axis of rotation.

  • backend (PostProcessingBackendLabel, optional) โ€“ The backend label. Defaults to DEFAULT_PROCESS_BACKEND.

  • pbar (Optional[tqdm.tqdm], optional) โ€“ The progress bar. Defaults to None.

Returns:

The result of the magnet square.

Return type:

MagnetSquare

qurryยถ

MagnetSquare - Qurrium (qurry.qurries.magnet_square.qurry)

class qurry.qurries.magnet_square.qurry.MagnetSquare[source]ยถ

Magnetization Square Qurry.

property experiment_instance: Type[MagnetSquareExperiment]ยถ

The container class responding to this Qurrium class.

measure(wave: QuantumCircuit | Hashable | None = None, unitary_operator: Operator | Gate | Literal['x', 'y', 'z'] | None = None, shots: int = 1024, backend: Backend | None = None, exp_name: str = 'experiment', run_args: BaseRunArgs | dict[str, Any] | None = None, transpile_args: TranspileArgs | None = None, passmanager: str | PassManager | tuple[str, PassManager] | None = None, tags: tuple[str, ...] | None = None, qasm_version: Literal['qasm2', 'qasm3'] = 'qasm3', export: bool = False, save_location: Path | str | None = None, pbar: tqdm | None = None) str[source]ยถ

Execute the experiment.

Parameters:
  • wave (Union[QuantumCircuit, Hashable]) โ€“ The key or the circuit to execute.

  • unitary_operator (Union[Operator, Gate, Literal["x", "y", "z"]]) โ€“ The unitary operator to apply. It can be a qiskit.quantum_info.Operator, a qiskit.circuit.Gate, or a string representing the axis of rotation (โ€˜xโ€™, โ€˜yโ€™, or โ€˜zโ€™).

  • shots (int, optional) โ€“ Shots of the job. Defaults to 1024.

  • backend (Optional[Backend], optional) โ€“ The quantum backend. Defaults to None.

  • exp_name (str, optional) โ€“ The name of the experiment. Naming this experiment to recognize it when the jobs are pending to IBMQ Service. This name is also used for creating a folder to store the exports. Defaults to โ€˜expsโ€™.

  • run_args (RunArgsType, optional) โ€“ Arguments for Backend.run(). Defaults to None.

  • transpile_args (Optional[TranspileArgs], optional) โ€“ Arguments of transpile() from qiskit.compiler.transpiler. Defaults to None.

  • passmanager (Optional[Union[str, PassManager, tuple[str, PassManager]], optional) โ€“ The passmanager. Defaults to None.

  • tags (Optional[tuple[str, ...]], optional) โ€“ The tags of the experiment. Defaults to None.

  • qasm_version (Literal["qasm2", "qasm3"], optional) โ€“ The version of OpenQASM. Defaults to โ€œqasm3โ€.

  • export (bool, optional) โ€“ Whether to export the experiment. Defaults to False.

  • save_location (Optional[Union[Path, str]], optional) โ€“ The location to save the experiment. Defaults to None.

  • pbar (Optional[tqdm.tqdm], optional) โ€“ The progress bar for showing the progress of the experiment. Defaults to None.

Returns:

The ID of the experiment

Return type:

str

measure_to_output(wave: QuantumCircuit | Hashable | None = None, unitary_operator: Operator | Gate | Literal['x', 'y', 'z'] | None = None, shots: int = 1024, backend: Backend | None = None, exp_name: str = 'experiment', run_args: BaseRunArgs | dict[str, Any] | None = None, transpile_args: TranspileArgs | None = None, passmanager: str | PassManager | tuple[str, PassManager] | None = None, tags: tuple[str, ...] | None = None, qasm_version: Literal['qasm2', 'qasm3'] = 'qasm3', export: bool = False, save_location: Path | str | None = None, pbar: tqdm | None = None) MagnetSquareOutputArgs[source]ยถ

Trasnform measure() arguments form into output() form.

Parameters:
  • wave (Union[QuantumCircuit, Hashable]) โ€“ The key or the circuit to execute.

  • unitary_operator (Union[Operator, Gate, Literal["x", "y", "z"]]) โ€“ The unitary operator to apply. It can be a qiskit.quantum_info.Operator, a qiskit.circuit.Gate, or a string representing the axis of rotation (โ€˜xโ€™, โ€˜yโ€™, or โ€˜zโ€™).

  • shots (int, optional) โ€“ Shots of the job. Defaults to 1024.

  • backend (Optional[Backend], optional) โ€“ The quantum backend. Defaults to None.

  • exp_name (str, optional) โ€“ The name of the experiment. Naming this experiment to recognize it when the jobs are pending to IBMQ Service. This name is also used for creating a folder to store the exports. Defaults to โ€˜expsโ€™.

  • run_args (RunArgsType, optional) โ€“ Arguments for Backend.run(). Defaults to None.

  • transpile_args (Optional[TranspileArgs], optional) โ€“ Arguments of transpile() from qiskit.compiler.transpiler. Defaults to None.

  • passmanager (Optional[Union[str, PassManager, tuple[str, PassManager]], optional) โ€“ The passmanager. Defaults to None.

  • tags (Optional[tuple[str, ...]], optional) โ€“ The tags of the experiment. Defaults to None.

  • qasm_version (Literal["qasm2", "qasm3"], optional) โ€“ The version of OpenQASM. Defaults to โ€œqasm3โ€.

  • export (bool, optional) โ€“ Whether to export the experiment. Defaults to False.

  • save_location (Optional[Union[Path, str]], optional) โ€“ The location to save the experiment. Defaults to None.

  • pbar (Optional[tqdm.tqdm], optional) โ€“ The progress bar for showing the progress of the experiment. Defaults to None.

Returns:

The output arguments.

Return type:

MagnetSquareOutputArgs

short_name = 'qurmagsq_magnet_square'ยถ

The short name of Qurrium.