waves_static
¶
WaveContainer (qurry.qurrium.container.waves_static
)
- class qurry.qurrium.container.waves_static.WaveContainer(*args, **kwargs)[source]¶
WaveContainer is a customized dictionary for storing waves.
- add(wave: QuantumCircuit, key: Hashable | None = None, replace: Literal[True, False, 'duplicate'] = True) Hashable [source]¶
Add wave to container.
- Parameters:
wave (QuantumCircuit) – The wave circuit.
key (Optional[Hashable], optional) – The key of wave in ‘fict’ .waves. Defaults to None.
replace (Literal[True, False, "duplicate"], optional) – Replace the wave with same key or not. Defaults to True.
- Returns:
The key of wave in ‘dict’ .waves.
- Return type:
Hashable
- Raises:
KeyError – If the wave with same key exists and replace==False.
- call(wave: list[Hashable]) list[QuantumCircuit] [source]¶
- call(wave: Hashable) QuantumCircuit
Export wave function as QuantumCircuit.
- copy_circuit(wave: list[Hashable] | Hashable) list[QuantumCircuit] | QuantumCircuit [source]¶
Export a copy of wave function as QuantumCircuit.
- get_wave(wave: list[Hashable], run_by: Literal['gate']) list[Gate] [source]¶
- get_wave(wave: list[Hashable], run_by: Literal['operator']) list[Operator]
- get_wave(wave: list[Hashable], run_by: Literal['instruction']) list[Instruction]
- get_wave(wave: list[Hashable], run_by: Literal['copy', 'call'] | None) list[QuantumCircuit]
- get_wave(wave: Hashable, run_by: Literal['gate']) Gate
- get_wave(wave: Hashable, run_by: Literal['operator']) Operator
- get_wave(wave: Hashable, run_by: Literal['instruction']) Instruction
- get_wave(wave: Hashable, run_by: Literal['copy', 'call'] | None) QuantumCircuit
Parse wave Circuit into Instruction as Gate or Operator on QuantumCircuit.
- Parameters:
wave (Optional[Hashable], optional) – The key of wave in ‘fict’ .waves. Defaults to None.
run_by (Optional[str], optional) – Export as Gate, Operator, Instruction or a copy when input is None. Defaults to None.
- Raises:
ValueError – If wave is None.
KeyError – If wave not in self.
- Returns:
- Union[
list[Union[Gate, Operator, Instruction, QuantumCircuit]], Union[Gate, Operator, Instruction, QuantumCircuit]
]: The result of the wave as Gate or Operator.
- has(wavename: Hashable) bool [source]¶
Is there a wave with specific name.
- Parameters:
wavename (Hashable) – Name of wave which is used in .waves
- Returns:
Exist or not.
- Return type:
- instruction(wave: list[Hashable] | Hashable) list[Instruction] | Instruction [source]¶
Export wave function as Instruction.
- operator(wave: list[Hashable] | Hashable) list[Operator] | Operator [source]¶
Export wave function as Operator.
- process(circuits: list[QuantumCircuit | Hashable]) list[tuple[Hashable, QuantumCircuit]] [source]¶
Process the circuits in container.