Noises
- class braket.circuits.noises.BitFlip(probability)[source]
Bases:
SingleProbabilisticNoiseBit flip noise channel which transforms a density matrix \(\\rho\) according to:
\[\begin{split}\\rho \\Rightarrow (1-p) \\rho + p X \\rho X^{\\dagger}\end{split}\]where
\[ \begin{align}\begin{aligned}\begin{split}I = \\left( \\begin{matrix} 1 & 0 \\\\ 0 & 1 \\end{matrix} \\right)\end{split}\\\begin{split}X = \\left( \\begin{matrix} 0 & 1 \\\\ 1 & 0 \\end{matrix} \\right)\end{split}\\\begin{split}p = \\text{probability}\end{split}\end{aligned}\end{align} \]This noise channel is shown as
BFin circuit diagrams.- Parameters:
probability (
float|FreeParameterExpression)
Initializes a
SingleProbabilisticNoise.- Parameters:
probability (float | FreeParameterExpression) – The probability that the noise occurs.
qubit_count (int | None) – The number of qubits to apply noise.
ascii_symbols (Sequence[str]) – ASCII string symbols for the noise. These are used when printing a diagram of a circuit. The length must be the same as
qubit_count, and index ordering is expected to correlate with the target ordering on the instruction.max_probability (float) – Maximum allowed probability of the noise channel. Default: 0.5
- Raises:
ValueError – If the
qubit_countis less than 1,ascii_symbolsareNone, orascii_symbolslength !=qubit_count,probabilityis notfloatorFreeParameterExpression,probability> 1/2, orprobability< 0
- to_matrix()[source]
Returns a matrix representation of this noise.
- Return type:
Iterable[ndarray]- Returns:
Iterable[ndarray] – A list of matrix representations of this noise.
- static fixed_qubit_count()[source]
Returns the number of qubits this quantum operator acts on, if instances are guaranteed to act on the same number of qubits.
If different instances can act on a different number of qubits, this method returns
NotImplemented.- Return type:
int- Returns:
int – The number of qubits this quantum operator acts on.
- static bit_flip(target, probability)[source]
Registers this function into the circuit class.
- Parameters:
target (QubitSetInput) – Target qubit(s)
probability (float) – Probability of bit flipping.
- Return type:
Iterable[Instruction]- Returns:
Iterable[Instruction] –
Iterableof BitFlip instructions.
Examples
>>> circ = Circuit().bit_flip(0, probability=0.1)
- bind_values(**kwargs)[source]
Takes in parameters and attempts to assign them to values.
- Parameters:
**kwargs (FreeParameter | str) – Arbitrary keyword arguments.
- Return type:
- Returns:
Noise – A new Noise object of the same type with the requested parameters bound.
- class braket.circuits.noises.PhaseFlip(probability)[source]
Bases:
SingleProbabilisticNoisePhase flip noise channel which transforms a density matrix \(\\rho\) according to:
\[\begin{split}\\rho \\Rightarrow (1-p) \\rho + p X \\rho X^{\\dagger}\end{split}\]where
\[ \begin{align}\begin{aligned}\begin{split}I = \\left( \\begin{matrix} 1 & 0 \\\\ 0 & 1 \\end{matrix} \\right)\end{split}\\\begin{split}Z = \\left( \\begin{matrix} 1 & 0 \\\\ 0 & -1 \\end{matrix} \\right)\end{split}\\\begin{split}p = \\text{probability}\end{split}\end{aligned}\end{align} \]This noise channel is shown as
PFin circuit diagrams.- Parameters:
probability (
float|FreeParameterExpression)
Initializes a
SingleProbabilisticNoise.- Parameters:
probability (float | FreeParameterExpression) – The probability that the noise occurs.
qubit_count (int | None) – The number of qubits to apply noise.
ascii_symbols (Sequence[str]) – ASCII string symbols for the noise. These are used when printing a diagram of a circuit. The length must be the same as
qubit_count, and index ordering is expected to correlate with the target ordering on the instruction.max_probability (float) – Maximum allowed probability of the noise channel. Default: 0.5
- Raises:
ValueError – If the
qubit_countis less than 1,ascii_symbolsareNone, orascii_symbolslength !=qubit_count,probabilityis notfloatorFreeParameterExpression,probability> 1/2, orprobability< 0
- to_matrix()[source]
Returns a matrix representation of this noise.
- Return type:
Iterable[ndarray]- Returns:
Iterable[ndarray] – A list of matrix representations of this noise.
- static fixed_qubit_count()[source]
Returns the number of qubits this quantum operator acts on, if instances are guaranteed to act on the same number of qubits.
If different instances can act on a different number of qubits, this method returns
NotImplemented.- Return type:
int- Returns:
int – The number of qubits this quantum operator acts on.
- static phase_flip(target, probability)[source]
Registers this function into the circuit class.
- Parameters:
target (QubitSetInput) – Target qubit(s)
probability (float) – Probability of phase flipping.
- Return type:
Iterable[Instruction]- Returns:
Iterable[Instruction] –
Iterableof PhaseFlip instructions.
Examples
>>> circ = Circuit().phase_flip(0, probability=0.1)
- bind_values(**kwargs)[source]
Takes in parameters and attempts to assign them to values.
- Parameters:
**kwargs (FreeParameter | str) – Arbitrary keyword arguments.
- Return type:
- Returns:
Noise – A new Noise object of the same type with the requested parameters bound.
- class braket.circuits.noises.PauliChannel(probX, probY, probZ)[source]
Bases:
PauliNoisePauli noise channel which transforms a density matrix \(\\rho\) according to:
\[\begin{split}\\rho \\Rightarrow (1-probX-probY-probZ) \\rho + probX X \\rho X^{\\dagger} + probY Y \\rho Y^{\\dagger} + probZ Z \\rho Z^{\\dagger}\end{split}\]where
\[ \begin{align}\begin{aligned}\begin{split}I = \\left( \\begin{matrix} 1 & 0 \\\\ 0 & 1 \\end{matrix} \\right)\end{split}\\\begin{split}X = \\left( \\begin{matrix} 0 & 1 \\\\ 1 & 0 \\end{matrix} \\right)\end{split}\\\begin{split}Y = \\left( \\begin{matrix} 0 & -i \\\\ i & 0 \\end{matrix} \\right)\end{split}\\\begin{split}Z = \\left( \\begin{matrix} 1 & 0 \\\\ 0 & -1 \\end{matrix} \\right)\end{split}\end{aligned}\end{align} \]This noise channel is shown as
PCin circuit diagrams.- Parameters:
probX (
float|FreeParameterExpression)probY (
float|FreeParameterExpression)probZ (
float|FreeParameterExpression)
Creates PauliChannel noise.
- Parameters:
probX (float | FreeParameterExpression) – X rotation probability.
probY (float | FreeParameterExpression) – Y rotation probability.
probZ (float | FreeParameterExpression) – Z rotation probability.
- to_matrix()[source]
Returns a matrix representation of this noise.
- Return type:
Iterable[ndarray]- Returns:
Iterable[ndarray] – A list of matrix representations of this noise.
- static fixed_qubit_count()[source]
Returns the number of qubits this quantum operator acts on, if instances are guaranteed to act on the same number of qubits.
If different instances can act on a different number of qubits, this method returns
NotImplemented.- Return type:
int- Returns:
int – The number of qubits this quantum operator acts on.
- static pauli_channel(target, probX, probY, probZ)[source]
Registers this function into the circuit class.
- Parameters:
target (QubitSetInput) – Target qubit(s) probability list[float]: Probabilities for the Pauli X, Y and Z noise happening in the Kraus channel.
probX (float) – X rotation probability.
probY (float) – Y rotation probability.
probZ (float) – Z rotation probability.
- Return type:
Iterable[Instruction]- Returns:
Iterable[Instruction] –
Iterableof PauliChannel instructions.
Examples
>>> circ = Circuit().pauli_channel(0, probX=0.1, probY=0.2, probZ=0.3)
- class braket.circuits.noises.Depolarizing(probability)[source]
Bases:
SingleProbabilisticNoise_34Depolarizing noise channel which transforms a density matrix \(\\rho\) according to:
\[\begin{split}\\rho \\Rightarrow (1-p) \\rho + p/3 X \\rho X^{\\dagger} + p/3 Y \\rho Y^{\\dagger} + p/3 Z \\rho Z^{\\dagger}\end{split}\]where
\[ \begin{align}\begin{aligned}\begin{split}I = \\left( \\begin{matrix} 1 & 0 \\\\ 0 & 1 \\end{matrix} \\right)\end{split}\\\begin{split}X = \\left( \\begin{matrix} 0 & 1 \\\\ 1 & 0 \\end{matrix} \\right)\end{split}\\\begin{split}Y = \\left( \\begin{matrix} 0 & -i \\\\ i & 0 \\end{matrix} \\right)\end{split}\\\begin{split}Z = \\left( \\begin{matrix} 1 & 0 \\\\ 0 & -1 \\end{matrix} \\right)\end{split}\\\begin{split}p = \\text{probability}\end{split}\end{aligned}\end{align} \]This noise channel is shown as
DEPOin circuit diagrams.- Parameters:
probability (
float|FreeParameterExpression)
Initializes a
SingleProbabilisticNoise_34.- Parameters:
probability (float | FreeParameterExpression) – The probability that the noise occurs.
qubit_count (int | None) – The number of qubits to apply noise.
ascii_symbols (Sequence[str]) – ASCII string symbols for the noise. These are used when printing a diagram of a circuit. The length must be the same as
qubit_count, and index ordering is expected to correlate with the target ordering on the instruction.
- Raises:
ValueError – If the
qubit_countis less than 1,ascii_symbolsareNone, orascii_symbolslength !=qubit_count,probabilityis notfloatorFreeParameterExpression,probability> 3/4, orprobability< 0
- to_matrix()[source]
Returns a matrix representation of this noise.
- Return type:
Iterable[ndarray]- Returns:
Iterable[ndarray] – A list of matrix representations of this noise.
- static fixed_qubit_count()[source]
Returns the number of qubits this quantum operator acts on, if instances are guaranteed to act on the same number of qubits.
If different instances can act on a different number of qubits, this method returns
NotImplemented.- Return type:
int- Returns:
int – The number of qubits this quantum operator acts on.
- static depolarizing(target, probability)[source]
Registers this function into the circuit class.
- Parameters:
target (QubitSetInput) – Target qubit(s)
probability (float) – Probability of depolarizing.
- Return type:
Iterable[Instruction]- Returns:
Iterable[Instruction] –
Iterableof Depolarizing instructions.
Examples
>>> circ = Circuit().depolarizing(0, probability=0.1)
- class braket.circuits.noises.TwoQubitDepolarizing(probability)[source]
Bases:
SingleProbabilisticNoise_1516- Two-Qubit Depolarizing noise channel which transforms a
density matrix \(\\rho\) according to:
\[\begin{split}\\rho \\Rightarrow (1-p) \\rho + p/15 ( IX \\rho IX^{\\dagger} + IY \\rho IY^{\\dagger} + IZ \\rho IZ^{\\dagger} + XI \\rho XI^{\\dagger} + XX \\rho XX^{\\dagger} + XY \\rho XY^{\\dagger} + XZ \\rho XZ^{\\dagger} + YI \\rho YI^{\\dagger} + YX \\rho YX^{\\dagger} + YY \\rho YY^{\\dagger} + YZ \\rho YZ^{\\dagger} + ZI \\rho ZI^{\\dagger} + ZX \\rho ZX^{\\dagger} + ZY \\rho ZY^{\\dagger} + ZZ \\rho ZZ^{\\dagger})\end{split}\]where
\[ \begin{align}\begin{aligned}\begin{split}I = \\left( \\begin{matrix} 1 & 0 \\\\ 0 & 1 \\end{matrix} \\right)\end{split}\\\begin{split}X = \\left( \\begin{matrix} 0 & 1 \\\\ 1 & 0 \\end{matrix} \\right)\end{split}\\\begin{split}Y = \\left( \\begin{matrix} 0 & -i \\\\ i & 0 \\end{matrix} \\right)\end{split}\\\begin{split}Z = \\left( \\begin{matrix} 1 & 0 \\\\ 0 & -1 \\end{matrix} \\right)\end{split}\\\begin{split}p = \\text{probability}\end{split}\end{aligned}\end{align} \]This noise channel is shown as
DEPOin circuit diagrams.- Parameters:
probability (
float|FreeParameterExpression)
Initializes a
SingleProbabilisticNoise_1516.- Parameters:
probability (float | FreeParameterExpression) – The probability that the noise occurs.
qubit_count (int | None) – The number of qubits to apply noise.
ascii_symbols (Sequence[str]) – ASCII string symbols for the noise. These are used when printing a diagram of a circuit. The length must be the same as
qubit_count, and index ordering is expected to correlate with the target ordering on the instruction.
- Raises:
ValueError – If the
qubit_countis less than 1,ascii_symbolsareNone, orascii_symbolslength !=qubit_count,probabilityis notfloatorFreeParameterExpression,probability> 15/16, orprobability< 0
- to_matrix()[source]
Returns a matrix representation of this noise.
- Return type:
Iterable[ndarray]- Returns:
Iterable[ndarray] – A list of matrix representations of this noise.
- static fixed_qubit_count()[source]
Returns the number of qubits this quantum operator acts on, if instances are guaranteed to act on the same number of qubits.
If different instances can act on a different number of qubits, this method returns
NotImplemented.- Return type:
int- Returns:
int – The number of qubits this quantum operator acts on.
- static two_qubit_depolarizing(target1, target2, probability)[source]
Registers this function into the circuit class.
- Parameters:
target1 (QubitInput) – Target qubit 1.
target2 (QubitInput) – Target qubit 2.
probability (float) – Probability of two-qubit depolarizing.
- Return type:
Iterable[Instruction]- Returns:
Iterable[Instruction] –
Iterableof Depolarizing instructions.
Examples
>>> circ = Circuit().two_qubit_depolarizing(0, 1, probability=0.1)
- class braket.circuits.noises.TwoQubitDephasing(probability)[source]
Bases:
SingleProbabilisticNoise_34- Two-Qubit Dephasing noise channel which transforms a
density matrix \(\\rho\) according to:
\[\begin{split}\\rho \\Rightarrow (1-p) \\rho + p/3 ( IZ \\rho IZ^{\\dagger} + ZI \\rho ZI^{\\dagger} + ZZ \\rho ZZ^{\\dagger})\end{split}\]where
\[ \begin{align}\begin{aligned}\begin{split}I = \\left( \\begin{matrix} 1 & 0 \\\\ 0 & 1 \\end{matrix} \\right)\end{split}\\\begin{split}Z = \\left( \\begin{matrix} 1 & 0 \\\\ 0 & -1 \\end{matrix} \\right)\end{split}\\\begin{split}p = \\text{probability}\end{split}\end{aligned}\end{align} \]This noise channel is shown as
DEPHin circuit diagrams.- Parameters:
probability (
float|FreeParameterExpression)
Initializes a
SingleProbabilisticNoise_34.- Parameters:
probability (float | FreeParameterExpression) – The probability that the noise occurs.
qubit_count (int | None) – The number of qubits to apply noise.
ascii_symbols (Sequence[str]) – ASCII string symbols for the noise. These are used when printing a diagram of a circuit. The length must be the same as
qubit_count, and index ordering is expected to correlate with the target ordering on the instruction.
- Raises:
ValueError – If the
qubit_countis less than 1,ascii_symbolsareNone, orascii_symbolslength !=qubit_count,probabilityis notfloatorFreeParameterExpression,probability> 3/4, orprobability< 0
- to_matrix()[source]
Returns a matrix representation of this noise.
- Return type:
Iterable[ndarray]- Returns:
Iterable[ndarray] – A list of matrix representations of this noise.
- static fixed_qubit_count()[source]
Returns the number of qubits this quantum operator acts on, if instances are guaranteed to act on the same number of qubits.
If different instances can act on a different number of qubits, this method returns
NotImplemented.- Return type:
int- Returns:
int – The number of qubits this quantum operator acts on.
- static two_qubit_dephasing(target1, target2, probability)[source]
Registers this function into the circuit class.
- Parameters:
target1 (QubitInput) – Target qubit 1.
target2 (QubitInput) – Target qubit 2.
probability (float) – Probability of two-qubit dephasing.
- Return type:
Iterable[Instruction]- Returns:
Iterable[Instruction] –
Iterableof Dephasing instructions.
Examples
>>> circ = Circuit().two_qubit_dephasing(0, 1, probability=0.1)
- class braket.circuits.noises.TwoQubitPauliChannel(probabilities)[source]
Bases:
MultiQubitPauliNoise- Two-Qubit Pauli noise channel which transforms a
density matrix \(\\rho\) according to:
\[\begin{split}\\rho \\Rightarrow (1-p) \\rho + p_{IX} IX \\rho IX^{\\dagger} + p_{IY} IY \\rho IY^{\\dagger} + p_{IZ} IZ \\rho IZ^{\\dagger} + p_{XI} XI \\rho XI^{\\dagger} + p_{XX} XX \\rho XX^{\\dagger} + p_{XY} XY \\rho XY^{\\dagger} + p_{XZ} XZ \\rho XZ^{\\dagger} + p_{YI} YI \\rho YI^{\\dagger} + p_{YX} YX \\rho YX^{\\dagger} + p_{YY} YY \\rho YY^{\\dagger} + p_{YZ} YZ \\rho YZ^{\\dagger} + p_{ZI} ZI \\rho ZI^{\\dagger} + p_{ZX} ZX \\rho ZX^{\\dagger} + p_{ZY} ZY \\rho ZY^{\\dagger} + p_{ZZ} ZZ \\rho ZZ^{\\dagger})\end{split}\]where
\[ \begin{align}\begin{aligned}\begin{split}I = \\left( \\begin{matrix} 1 & 0 \\\\ 0 & 1 \\end{matrix} \\right)\end{split}\\\begin{split}X = \\left( \\begin{matrix} 0 & 1 \\\\ 1 & 0 \\end{matrix} \\right)\end{split}\\\begin{split}Y = \\left( \\begin{matrix} 0 & -i \\\\ i & 0 \\end{matrix} \\right)\end{split}\\\begin{split}Z = \\left( \\begin{matrix} 1 & 0 \\\\ 0 & -1 \\end{matrix} \\right)\end{split}\\\begin{split}p = \\text{sum of all probabilities}\end{split}\end{aligned}\end{align} \]This noise channel is shown as
PC_2({"pauli_string": probability})in circuit diagrams.- Parameters:
probabilities (
dict[str,float])
[summary]
- Parameters:
probabilities (dict[str, float | FreeParameterExpression]) – A dictionary with Pauli strings as keys and the probabilities as values, i.e. {“XX”: 0.1. “IZ”: 0.2}.
qubit_count (int | None) – The number of qubits the Pauli noise acts on.
ascii_symbols (Sequence[str]) – ASCII string symbols for the noise. These are used when printing a diagram of a circuit. The length must be the same as
qubit_count, and index ordering is expected to correlate with the target ordering on the instruction.
- Raises:
ValueError – If
qubit_count< 1,ascii_symbolsisNone,ascii_symbolslength !=qubit_count,probabilitiesare notfloat`s or FreeParameterExpressions, any of `probabilities> 1 orprobabilities< 0, the sum of all probabilities is > 1, if “II” is specified as a Pauli string, if any Pauli string contains invalid strings, or if the length of probabilities is greater than 4**qubit_count.TypeError – If the type of the dictionary keys are not strings. If the probabilities are not floats.
- to_matrix()[source]
Returns a matrix representation of this noise.
- Return type:
Iterable[ndarray]- Returns:
Iterable[ndarray] – A list of matrix representations of this noise.
- static fixed_qubit_count()[source]
Returns the number of qubits this quantum operator acts on, if instances are guaranteed to act on the same number of qubits.
If different instances can act on a different number of qubits, this method returns
NotImplemented.- Return type:
int- Returns:
int – The number of qubits this quantum operator acts on.
- static two_qubit_pauli_channel(target1, target2, probabilities)[source]
Registers this function into the circuit class.
- Parameters:
target1 (QubitInput) – Target qubit 1.
target2 (QubitInput) – Target qubit 2.
probabilities (dict[str, float]) – Probability of two-qubit Pauli channel.
- Return type:
Iterable[Instruction]- Returns:
Iterable[Instruction] –
Iterableof Depolarizing instructions.
Examples
>>> circ = Circuit().two_qubit_pauli_channel(0, 1, {"XX": 0.1})
- class braket.circuits.noises.AmplitudeDamping(gamma)[source]
Bases:
DampingNoiseAmplitudeDamping noise channel which transforms a density matrix \(\\rho\) according to:
\[\begin{split}\\rho \\Rightarrow E_0 \\rho E_0^{\\dagger} + E_1 \\rho E_1^{\\dagger}\end{split}\]where
\[ \begin{align}\begin{aligned}\begin{split}E_0 = \\left( \\begin{matrix} 1 & 0 \\\\ 0 & \\sqrt{1-\\gamma} \\end{matrix} \\right)\end{split}\\\begin{split}E_1 = \\left( \\begin{matrix} 0 & \\sqrt{\\gamma} \\\\ 0 & 0 \\end{matrix} \\right)\end{split}\end{aligned}\end{align} \]This noise channel is shown as
ADin circuit diagrams.- Parameters:
gamma (
float|FreeParameterExpression)
Initializes a
DampingNoise.- Parameters:
gamma (float | FreeParameterExpression) – Probability of damping.
qubit_count (int | None) – The number of qubits to apply noise.
ascii_symbols (Sequence[str]) – ASCII string symbols for the noise. These are used when printing a diagram of a circuit. The length must be the same as
qubit_count, and index ordering is expected to correlate with the target ordering on the instruction.
- Raises:
ValueError – If
qubit_count< 1,ascii_symbolsisNone,len(ascii_symbols)!=qubit_count,gammais notfloatorFreeParameterExpression, orgamma> 1.0 orgamma< 0.0.
- to_matrix()[source]
Returns a matrix representation of this noise.
- Return type:
Iterable[ndarray]- Returns:
Iterable[ndarray] – A list of matrix representations of this noise.
- static fixed_qubit_count()[source]
Returns the number of qubits this quantum operator acts on, if instances are guaranteed to act on the same number of qubits.
If different instances can act on a different number of qubits, this method returns
NotImplemented.- Return type:
int- Returns:
int – The number of qubits this quantum operator acts on.
- static amplitude_damping(target, gamma)[source]
Registers this function into the circuit class.
- Parameters:
target (QubitSetInput) – Target qubit(s).
gamma (float) – decaying rate of the amplitude damping channel.
- Return type:
Iterable[Instruction]- Returns:
Iterable[Instruction] –
Iterableof AmplitudeDamping instructions.
Examples
>>> circ = Circuit().amplitude_damping(0, gamma=0.1)
- class braket.circuits.noises.GeneralizedAmplitudeDamping(gamma, probability)[source]
Bases:
GeneralizedAmplitudeDampingNoise- Generalized AmplitudeDamping noise channel which transforms a
density matrix \(\\rho\) according to:
\[\begin{split}\\rho \\Rightarrow E_0 \\rho E_0^{\\dagger} + E_1 \\rho E_1^{\\dagger} + E_2 \\rho E_2^{\\dagger} + E_3 \\rho E_3^{\\dagger}\end{split}\]where
\[ \begin{align}\begin{aligned}\begin{split}E_0 = \\sqrt(probability)\\left( \\begin{matrix} 1 & 0 \\\\ 0 & \\sqrt{1-\\gamma} \\end{matrix} \\right)\end{split}\\\begin{split}E_1 = \\sqrt(probability)\\left( \\begin{matrix} 0 & \\sqrt{\\gamma} \\\\ 0 & 0 \\end{matrix} \\right) E_2 = \\sqrt(1-probability)\\left( \\begin{matrix} \\sqrt{1-\\gamma} & 0 \\\\ 0 & 1 \\end{matrix} \\right) E_3 = \\sqrt(1-probability)\\left( \\begin{matrix} 0 & 0 \\\\ \\sqrt{\\gamma} & 0 \\end{matrix} \\right)\end{split}\end{aligned}\end{align} \]This noise channel is shown as
GADin circuit diagrams.- Parameters:
gamma (
float|FreeParameterExpression)probability (
float|FreeParameterExpression)
Inits a
GeneralizedAmplitudeDampingNoise.- Parameters:
gamma (float | FreeParameterExpression) – Probability of damping.
probability (float | FreeParameterExpression) – Probability of the system being excited by the environment.
qubit_count (int | None) – The number of qubits to apply noise.
ascii_symbols (Sequence[str]) – ASCII string symbols for the noise. These are used when printing a diagram of a circuit. The length must be the same as
qubit_count, and index ordering is expected to correlate with the target ordering on the instruction.
- Raises:
ValueError – If
qubit_count< 1,ascii_symbolsisNone,len(ascii_symbols)!=qubit_count,probabilityorgammais notfloatorFreeParameterExpression,probability> 1.0 orprobability< 0.0, orgamma> 1.0 orgamma< 0.0.
- to_matrix()[source]
Returns a matrix representation of this noise.
- Return type:
Iterable[ndarray]- Returns:
Iterable[ndarray] – A list of matrix representations of this noise.
- static fixed_qubit_count()[source]
Returns the number of qubits this quantum operator acts on, if instances are guaranteed to act on the same number of qubits.
If different instances can act on a different number of qubits, this method returns
NotImplemented.- Return type:
int- Returns:
int – The number of qubits this quantum operator acts on.
- static generalized_amplitude_damping(target, gamma, probability)[source]
Registers this function into the circuit class.
- Parameters:
target (QubitSetInput) – Target qubit(s).
gamma (float) – The damping rate of the amplitude damping channel.
probability (float) – Probability of the system being excited by the environment.
- Return type:
Iterable[Instruction]- Returns:
Iterable[Instruction] –
Iterableof GeneralizedAmplitudeDamping instructions.
Examples
>>> circ = Circuit().generalized_amplitude_damping(0, gamma=0.1, probability=0.9)
- class braket.circuits.noises.PhaseDamping(gamma)[source]
Bases:
DampingNoisePhase damping noise channel which transforms a density matrix \(\\rho\) according to:
\[\begin{split}\\rho \\Rightarrow E_0 \\rho E_0^{\\dagger} + E_1 \\rho E_1^{\\dagger}\end{split}\]where
\[ \begin{align}\begin{aligned}\begin{split}E_0 = \\left( \\begin{matrix} 1 & 0 \\\\ 0 & \\sqrt{1-gamma} \\end{matrix} \\right)\end{split}\\\begin{split}E_1 = \\left( \\begin{matrix} 0 & 0 \\\\ 0 & \\sqrt{gamma} \\end{matrix} \\right)\end{split}\\\begin{split}p = \\text{probability}\end{split}\end{aligned}\end{align} \]This noise channel is shown as
PDin circuit diagrams.- Parameters:
gamma (
float|FreeParameterExpression)
Initializes a
DampingNoise.- Parameters:
gamma (float | FreeParameterExpression) – Probability of damping.
qubit_count (int | None) – The number of qubits to apply noise.
ascii_symbols (Sequence[str]) – ASCII string symbols for the noise. These are used when printing a diagram of a circuit. The length must be the same as
qubit_count, and index ordering is expected to correlate with the target ordering on the instruction.
- Raises:
ValueError – If
qubit_count< 1,ascii_symbolsisNone,len(ascii_symbols)!=qubit_count,gammais notfloatorFreeParameterExpression, orgamma> 1.0 orgamma< 0.0.
- to_matrix()[source]
Returns a matrix representation of this noise.
- Return type:
Iterable[ndarray]- Returns:
Iterable[ndarray] – A list of matrix representations of this noise.
- static fixed_qubit_count()[source]
Returns the number of qubits this quantum operator acts on, if instances are guaranteed to act on the same number of qubits.
If different instances can act on a different number of qubits, this method returns
NotImplemented.- Return type:
int- Returns:
int – The number of qubits this quantum operator acts on.
- static phase_damping(target, gamma)[source]
Registers this function into the circuit class.
- Parameters:
target (QubitSetInput) – Target qubit(s)
gamma (float) – Probability of phase damping.
- Return type:
Iterable[Instruction]- Returns:
Iterable[Instruction] –
Iterableof PhaseDamping instructions.
Examples
>>> circ = Circuit().phase_damping(0, gamma=0.1)
- class braket.circuits.noises.Kraus(matrices, display_name='KR')[source]
Bases:
NoiseUser-defined noise channel that uses the provided matrices as Kraus operators This noise channel is shown as
NKin circuit diagrams.- Parameters:
matrices (
Iterable[ndarray])display_name (
str)
Inits
Kraus.- Parameters:
matrices (Iterable[ndarray]) – A list of matrices that define a noise channel. These matrices need to satisfy the requirement of CPTP map.
display_name (str) – Name to be used for an instance of this general noise channel for circuit diagrams. Defaults to
KR.
- Raises:
ValueError – If any matrix in
matricesis not a two-dimensional square matrix, or has a dimension length which is not a positive exponent of 2, or thematricesdo not satisfy CPTP condition.
- to_matrix()[source]
Returns a matrix representation of this noise.
- Return type:
Iterable[ndarray]- Returns:
Iterable[ndarray] – A list of matrix representations of this noise.
- static kraus(targets, matrices, display_name='KR')[source]
Registers this function into the circuit class.
- Parameters:
targets (QubitSetInput) – Target qubit(s)
matrices (Iterable[array]) – Matrices that define a general noise channel.
display_name (str) – The display name.
- Return type:
Iterable[Instruction]- Returns:
Iterable[Instruction] –
Iterableof Kraus instructions.
Examples
>>> K0 = np.eye(4) * np.sqrt(0.9) >>> K1 = np.kron([[1.0, 0.0], [0.0, 1.0]], [[0.0, 1.0], [1.0, 0.0]]) * np.sqrt(0.1) >>> circ = Circuit().kraus([1, 0], matrices=[K0, K1])