QPanda3
0.1.0
Supported by OriginQ
|
Public Member Functions | |
None | __init__ (self) |
init(*args, **kwargs) Overloaded function. | |
None | __init__ (self, PauliOperator pauli_operator) |
init(*args, **kwargs) Overloaded function. | |
None | __init__ (self, str pauli) |
init(*args, **kwargs) Overloaded function. | |
None | __init__ (self, dict[str, complex] pauli_with_coef_s) |
init(*args, **kwargs) Overloaded function. | |
None | __init__ (self, list[str] paulis, list[complex] coefs) |
init(*args, **kwargs) Overloaded function. | |
None | __init__ (self, list[str] paulis, list[complex] coefs, bool AB_is_A1_B0) |
init(*args, **kwargs) Overloaded function. | |
None | __init__ (self, list[tuple[str, list[int], complex]] paulis_qbits_coef__s) |
init(*args, **kwargs) Overloaded function. | |
str | str_no_I (self) |
str_no_I(self: hamiltonian.PauliOperator) -> str | |
str | str_with_I (self, bool AB_is_A1_B0=...) |
str_with_I(self: hamiltonian.PauliOperator, AB_is_A1_B0: bool = True) -> str | |
str | str_withou_I (self) |
str_withou_I(self: hamiltonian.PauliOperator) -> str | |
PauliOperator | tensor (self, PauliOperator other) |
tensor(*args, **kwargs) Overloaded function. | |
PauliOperator | tensor (self, int n) |
tensor(*args, **kwargs) Overloaded function. | |
PauliOperator | __add__ (self, PauliOperator other) |
add(self: hamiltonian.PauliOperator, other: hamiltonian.PauliOperator) -> hamiltonian.PauliOperator | |
bool | __eq__ (self, PauliOperator other) |
eq(self: hamiltonian.PauliOperator, other: hamiltonian.PauliOperator) -> bool | |
PauliOperator | __iadd__ (self, PauliOperator other) |
iadd(self: hamiltonian.PauliOperator, other: hamiltonian.PauliOperator) -> hamiltonian.PauliOperator | |
PauliOperator | __imul__ (self, PauliOperator other) |
imul(self: hamiltonian.PauliOperator, other: hamiltonian.PauliOperator) -> hamiltonian.PauliOperator | |
PauliOperator | __isub__ (self, PauliOperator other) |
isub(self: hamiltonian.PauliOperator, other: hamiltonian.PauliOperator) -> hamiltonian.PauliOperator | |
PauliOperator | __matmul__ (self, PauliOperator other) |
matmul(self: hamiltonian.PauliOperator, other: hamiltonian.PauliOperator) -> hamiltonian.PauliOperator | |
PauliOperator | __mul__ (self, PauliOperator other) |
mul(*args, **kwargs) Overloaded function. | |
PauliOperator | __mul__ (self, complex scalar) |
mul(*args, **kwargs) Overloaded function. | |
PauliOperator | __rmul__ (self, complex scalar) |
rmul(self: hamiltonian.PauliOperator, scalar: complex) -> hamiltonian.PauliOperator | |
PauliOperator | __sub__ (self, PauliOperator other) |
sub(self: hamiltonian.PauliOperator, other: hamiltonian.PauliOperator) -> hamiltonian.PauliOperator | |
None pyqpanda3.hamiltonian.PauliOperator.__init__ | ( | self | ) |
init(*args, **kwargs) Overloaded function.
Constructs a default PauliOperator object.
This constructor initializes a new PauliOperator object with default values. The default behavior may include setting the operator to an identity or null state, depending on the implementation details.
Copy constructor for PauliOperator.
This constructor creates a new PauliOperator object that is a copy of an existing PauliOperator object. It initializes the new object with the same state and values as the provided other
object.
other | The PauliOperator object to copy from. |
Constructs a PauliOperator from a string representation.
This constructor initializes a new PauliOperator object based on a given string a_pauli
that represents a Pauli operator. The specific format and interpretation of the string are defined by the implementation.
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from a string representation.
This constructor initializes a new PauliOperator object based on a given string a_pauli
that represents a Pauli operator. The specific format and interpretation of the string are defined by the implementation. input like: {\"X0 Z1\\":1.1,\\"Y2 I1\\":2.1+0.j}
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from vectors of operations and coefficients.
This constructor initializes a new PauliOperator object based on two given vectors: ops
containing string representations of Pauli operator symbols, and coef_s
containing the corresponding std::complex<double> coefficients. The length of both vectors should be the same, and each pair of elements (one from ops
and one from coef_s
) represents a term in the Pauli operator. input like: [\"X0 Z1\\",\\"Y2 I1\\"],[1.1+0.j,2.1+0.j]
ops | The vector of Pauli operator symbols. |
coef_s | The vector of corresponding coefficients. |
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from vectors of operations, coefficients, and an additional boolean flag.
This constructor initializes a new PauliOperator object based on two given vectors: ops
containing string representations of Pauli operator symbols, and coef_s
containing the corresponding std::complex<double> coefficients. Additionally, it takes a boolean flag A
which may affect the initialization process or the behavior of the constructed PauliOperator object. The length of both vectors ops
and coef_s
should be the same, and each pair of elements (one from ops
and one from coef_s
) represents a term in the Pauli operator. input like: [\"XZI\\",\\"IZX\\"],[1.1+0.j,2.1+0.j],true
ops | The vector of Pauli operator symbols. |
coef_s | The vector of corresponding coefficients. |
A | The boolean flag that may affect the initialization or behavior. |
Constructs a PauliOperator from a vector of tuples.
This constructor initializes a new PauliOperator object based on a given vector of tuples ops
. Each tuple contains three elements: a string representing a Pauli operator symbol, a vector of size_t indices, and a std::complex<double> coefficient. The vector of tuples represents a collection of terms in the Pauli operator, where each term is specified by its operator symbol, indices (if applicable), and coefficient. input like: [(\"XZ\\",[0,4],1.1+0.j),(\\"YX\\",[1,2],2.1+0.j)]
ops | The vector of tuples containing Pauli operator symbols, indices, and coefficients. |
None pyqpanda3.hamiltonian.PauliOperator.__init__ | ( | self, | |
PauliOperator | pauli_operator ) |
init(*args, **kwargs) Overloaded function.
Constructs a default PauliOperator object.
This constructor initializes a new PauliOperator object with default values. The default behavior may include setting the operator to an identity or null state, depending on the implementation details.
Copy constructor for PauliOperator.
This constructor creates a new PauliOperator object that is a copy of an existing PauliOperator object. It initializes the new object with the same state and values as the provided other
object.
other | The PauliOperator object to copy from. |
Constructs a PauliOperator from a string representation.
This constructor initializes a new PauliOperator object based on a given string a_pauli
that represents a Pauli operator. The specific format and interpretation of the string are defined by the implementation.
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from a string representation.
This constructor initializes a new PauliOperator object based on a given string a_pauli
that represents a Pauli operator. The specific format and interpretation of the string are defined by the implementation. input like: {\"X0 Z1\\":1.1,\\"Y2 I1\\":2.1+0.j}
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from vectors of operations and coefficients.
This constructor initializes a new PauliOperator object based on two given vectors: ops
containing string representations of Pauli operator symbols, and coef_s
containing the corresponding std::complex<double> coefficients. The length of both vectors should be the same, and each pair of elements (one from ops
and one from coef_s
) represents a term in the Pauli operator. input like: [\"X0 Z1\\",\\"Y2 I1\\"],[1.1+0.j,2.1+0.j]
ops | The vector of Pauli operator symbols. |
coef_s | The vector of corresponding coefficients. |
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from vectors of operations, coefficients, and an additional boolean flag.
This constructor initializes a new PauliOperator object based on two given vectors: ops
containing string representations of Pauli operator symbols, and coef_s
containing the corresponding std::complex<double> coefficients. Additionally, it takes a boolean flag A
which may affect the initialization process or the behavior of the constructed PauliOperator object. The length of both vectors ops
and coef_s
should be the same, and each pair of elements (one from ops
and one from coef_s
) represents a term in the Pauli operator. input like: [\"XZI\\",\\"IZX\\"],[1.1+0.j,2.1+0.j],true
ops | The vector of Pauli operator symbols. |
coef_s | The vector of corresponding coefficients. |
A | The boolean flag that may affect the initialization or behavior. |
Constructs a PauliOperator from a vector of tuples.
This constructor initializes a new PauliOperator object based on a given vector of tuples ops
. Each tuple contains three elements: a string representing a Pauli operator symbol, a vector of size_t indices, and a std::complex<double> coefficient. The vector of tuples represents a collection of terms in the Pauli operator, where each term is specified by its operator symbol, indices (if applicable), and coefficient. input like: [(\"XZ\\",[0,4],1.1+0.j),(\\"YX\\",[1,2],2.1+0.j)]
ops | The vector of tuples containing Pauli operator symbols, indices, and coefficients. |
None pyqpanda3.hamiltonian.PauliOperator.__init__ | ( | self, | |
str | pauli ) |
init(*args, **kwargs) Overloaded function.
Constructs a default PauliOperator object.
This constructor initializes a new PauliOperator object with default values. The default behavior may include setting the operator to an identity or null state, depending on the implementation details.
Copy constructor for PauliOperator.
This constructor creates a new PauliOperator object that is a copy of an existing PauliOperator object. It initializes the new object with the same state and values as the provided other
object.
other | The PauliOperator object to copy from. |
Constructs a PauliOperator from a string representation.
This constructor initializes a new PauliOperator object based on a given string a_pauli
that represents a Pauli operator. The specific format and interpretation of the string are defined by the implementation.
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from a string representation.
This constructor initializes a new PauliOperator object based on a given string a_pauli
that represents a Pauli operator. The specific format and interpretation of the string are defined by the implementation. input like: {\"X0 Z1\\":1.1,\\"Y2 I1\\":2.1+0.j}
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from vectors of operations and coefficients.
This constructor initializes a new PauliOperator object based on two given vectors: ops
containing string representations of Pauli operator symbols, and coef_s
containing the corresponding std::complex<double> coefficients. The length of both vectors should be the same, and each pair of elements (one from ops
and one from coef_s
) represents a term in the Pauli operator. input like: [\"X0 Z1\\",\\"Y2 I1\\"],[1.1+0.j,2.1+0.j]
ops | The vector of Pauli operator symbols. |
coef_s | The vector of corresponding coefficients. |
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from vectors of operations, coefficients, and an additional boolean flag.
This constructor initializes a new PauliOperator object based on two given vectors: ops
containing string representations of Pauli operator symbols, and coef_s
containing the corresponding std::complex<double> coefficients. Additionally, it takes a boolean flag A
which may affect the initialization process or the behavior of the constructed PauliOperator object. The length of both vectors ops
and coef_s
should be the same, and each pair of elements (one from ops
and one from coef_s
) represents a term in the Pauli operator. input like: [\"XZI\\",\\"IZX\\"],[1.1+0.j,2.1+0.j],true
ops | The vector of Pauli operator symbols. |
coef_s | The vector of corresponding coefficients. |
A | The boolean flag that may affect the initialization or behavior. |
Constructs a PauliOperator from a vector of tuples.
This constructor initializes a new PauliOperator object based on a given vector of tuples ops
. Each tuple contains three elements: a string representing a Pauli operator symbol, a vector of size_t indices, and a std::complex<double> coefficient. The vector of tuples represents a collection of terms in the Pauli operator, where each term is specified by its operator symbol, indices (if applicable), and coefficient. input like: [(\"XZ\\",[0,4],1.1+0.j),(\\"YX\\",[1,2],2.1+0.j)]
ops | The vector of tuples containing Pauli operator symbols, indices, and coefficients. |
None pyqpanda3.hamiltonian.PauliOperator.__init__ | ( | self, | |
dict[str, complex] | pauli_with_coef_s ) |
init(*args, **kwargs) Overloaded function.
Constructs a default PauliOperator object.
This constructor initializes a new PauliOperator object with default values. The default behavior may include setting the operator to an identity or null state, depending on the implementation details.
Copy constructor for PauliOperator.
This constructor creates a new PauliOperator object that is a copy of an existing PauliOperator object. It initializes the new object with the same state and values as the provided other
object.
other | The PauliOperator object to copy from. |
Constructs a PauliOperator from a string representation.
This constructor initializes a new PauliOperator object based on a given string a_pauli
that represents a Pauli operator. The specific format and interpretation of the string are defined by the implementation.
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from a string representation.
This constructor initializes a new PauliOperator object based on a given string a_pauli
that represents a Pauli operator. The specific format and interpretation of the string are defined by the implementation. input like: {\"X0 Z1\\":1.1,\\"Y2 I1\\":2.1+0.j}
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from vectors of operations and coefficients.
This constructor initializes a new PauliOperator object based on two given vectors: ops
containing string representations of Pauli operator symbols, and coef_s
containing the corresponding std::complex<double> coefficients. The length of both vectors should be the same, and each pair of elements (one from ops
and one from coef_s
) represents a term in the Pauli operator. input like: [\"X0 Z1\\",\\"Y2 I1\\"],[1.1+0.j,2.1+0.j]
ops | The vector of Pauli operator symbols. |
coef_s | The vector of corresponding coefficients. |
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from vectors of operations, coefficients, and an additional boolean flag.
This constructor initializes a new PauliOperator object based on two given vectors: ops
containing string representations of Pauli operator symbols, and coef_s
containing the corresponding std::complex<double> coefficients. Additionally, it takes a boolean flag A
which may affect the initialization process or the behavior of the constructed PauliOperator object. The length of both vectors ops
and coef_s
should be the same, and each pair of elements (one from ops
and one from coef_s
) represents a term in the Pauli operator. input like: [\"XZI\\",\\"IZX\\"],[1.1+0.j,2.1+0.j],true
ops | The vector of Pauli operator symbols. |
coef_s | The vector of corresponding coefficients. |
A | The boolean flag that may affect the initialization or behavior. |
Constructs a PauliOperator from a vector of tuples.
This constructor initializes a new PauliOperator object based on a given vector of tuples ops
. Each tuple contains three elements: a string representing a Pauli operator symbol, a vector of size_t indices, and a std::complex<double> coefficient. The vector of tuples represents a collection of terms in the Pauli operator, where each term is specified by its operator symbol, indices (if applicable), and coefficient. input like: [(\"XZ\\",[0,4],1.1+0.j),(\\"YX\\",[1,2],2.1+0.j)]
ops | The vector of tuples containing Pauli operator symbols, indices, and coefficients. |
None pyqpanda3.hamiltonian.PauliOperator.__init__ | ( | self, | |
list[str] | paulis, | ||
list[complex] | coefs ) |
init(*args, **kwargs) Overloaded function.
Constructs a default PauliOperator object.
This constructor initializes a new PauliOperator object with default values. The default behavior may include setting the operator to an identity or null state, depending on the implementation details.
Copy constructor for PauliOperator.
This constructor creates a new PauliOperator object that is a copy of an existing PauliOperator object. It initializes the new object with the same state and values as the provided other
object.
other | The PauliOperator object to copy from. |
Constructs a PauliOperator from a string representation.
This constructor initializes a new PauliOperator object based on a given string a_pauli
that represents a Pauli operator. The specific format and interpretation of the string are defined by the implementation.
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from a string representation.
This constructor initializes a new PauliOperator object based on a given string a_pauli
that represents a Pauli operator. The specific format and interpretation of the string are defined by the implementation. input like: {\"X0 Z1\\":1.1,\\"Y2 I1\\":2.1+0.j}
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from vectors of operations and coefficients.
This constructor initializes a new PauliOperator object based on two given vectors: ops
containing string representations of Pauli operator symbols, and coef_s
containing the corresponding std::complex<double> coefficients. The length of both vectors should be the same, and each pair of elements (one from ops
and one from coef_s
) represents a term in the Pauli operator. input like: [\"X0 Z1\\",\\"Y2 I1\\"],[1.1+0.j,2.1+0.j]
ops | The vector of Pauli operator symbols. |
coef_s | The vector of corresponding coefficients. |
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from vectors of operations, coefficients, and an additional boolean flag.
This constructor initializes a new PauliOperator object based on two given vectors: ops
containing string representations of Pauli operator symbols, and coef_s
containing the corresponding std::complex<double> coefficients. Additionally, it takes a boolean flag A
which may affect the initialization process or the behavior of the constructed PauliOperator object. The length of both vectors ops
and coef_s
should be the same, and each pair of elements (one from ops
and one from coef_s
) represents a term in the Pauli operator. input like: [\"XZI\\",\\"IZX\\"],[1.1+0.j,2.1+0.j],true
ops | The vector of Pauli operator symbols. |
coef_s | The vector of corresponding coefficients. |
A | The boolean flag that may affect the initialization or behavior. |
Constructs a PauliOperator from a vector of tuples.
This constructor initializes a new PauliOperator object based on a given vector of tuples ops
. Each tuple contains three elements: a string representing a Pauli operator symbol, a vector of size_t indices, and a std::complex<double> coefficient. The vector of tuples represents a collection of terms in the Pauli operator, where each term is specified by its operator symbol, indices (if applicable), and coefficient. input like: [(\"XZ\\",[0,4],1.1+0.j),(\\"YX\\",[1,2],2.1+0.j)]
ops | The vector of tuples containing Pauli operator symbols, indices, and coefficients. |
None pyqpanda3.hamiltonian.PauliOperator.__init__ | ( | self, | |
list[str] | paulis, | ||
list[complex] | coefs, | ||
bool | AB_is_A1_B0 ) |
init(*args, **kwargs) Overloaded function.
Constructs a default PauliOperator object.
This constructor initializes a new PauliOperator object with default values. The default behavior may include setting the operator to an identity or null state, depending on the implementation details.
Copy constructor for PauliOperator.
This constructor creates a new PauliOperator object that is a copy of an existing PauliOperator object. It initializes the new object with the same state and values as the provided other
object.
other | The PauliOperator object to copy from. |
Constructs a PauliOperator from a string representation.
This constructor initializes a new PauliOperator object based on a given string a_pauli
that represents a Pauli operator. The specific format and interpretation of the string are defined by the implementation.
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from a string representation.
This constructor initializes a new PauliOperator object based on a given string a_pauli
that represents a Pauli operator. The specific format and interpretation of the string are defined by the implementation. input like: {\"X0 Z1\\":1.1,\\"Y2 I1\\":2.1+0.j}
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from vectors of operations and coefficients.
This constructor initializes a new PauliOperator object based on two given vectors: ops
containing string representations of Pauli operator symbols, and coef_s
containing the corresponding std::complex<double> coefficients. The length of both vectors should be the same, and each pair of elements (one from ops
and one from coef_s
) represents a term in the Pauli operator. input like: [\"X0 Z1\\",\\"Y2 I1\\"],[1.1+0.j,2.1+0.j]
ops | The vector of Pauli operator symbols. |
coef_s | The vector of corresponding coefficients. |
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from vectors of operations, coefficients, and an additional boolean flag.
This constructor initializes a new PauliOperator object based on two given vectors: ops
containing string representations of Pauli operator symbols, and coef_s
containing the corresponding std::complex<double> coefficients. Additionally, it takes a boolean flag A
which may affect the initialization process or the behavior of the constructed PauliOperator object. The length of both vectors ops
and coef_s
should be the same, and each pair of elements (one from ops
and one from coef_s
) represents a term in the Pauli operator. input like: [\"XZI\\",\\"IZX\\"],[1.1+0.j,2.1+0.j],true
ops | The vector of Pauli operator symbols. |
coef_s | The vector of corresponding coefficients. |
A | The boolean flag that may affect the initialization or behavior. |
Constructs a PauliOperator from a vector of tuples.
This constructor initializes a new PauliOperator object based on a given vector of tuples ops
. Each tuple contains three elements: a string representing a Pauli operator symbol, a vector of size_t indices, and a std::complex<double> coefficient. The vector of tuples represents a collection of terms in the Pauli operator, where each term is specified by its operator symbol, indices (if applicable), and coefficient. input like: [(\"XZ\\",[0,4],1.1+0.j),(\\"YX\\",[1,2],2.1+0.j)]
ops | The vector of tuples containing Pauli operator symbols, indices, and coefficients. |
None pyqpanda3.hamiltonian.PauliOperator.__init__ | ( | self, | |
list[tuple[str, list[int], complex]] | paulis_qbits_coef__s ) |
init(*args, **kwargs) Overloaded function.
Constructs a default PauliOperator object.
This constructor initializes a new PauliOperator object with default values. The default behavior may include setting the operator to an identity or null state, depending on the implementation details.
Copy constructor for PauliOperator.
This constructor creates a new PauliOperator object that is a copy of an existing PauliOperator object. It initializes the new object with the same state and values as the provided other
object.
other | The PauliOperator object to copy from. |
Constructs a PauliOperator from a string representation.
This constructor initializes a new PauliOperator object based on a given string a_pauli
that represents a Pauli operator. The specific format and interpretation of the string are defined by the implementation.
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from a string representation.
This constructor initializes a new PauliOperator object based on a given string a_pauli
that represents a Pauli operator. The specific format and interpretation of the string are defined by the implementation. input like: {\"X0 Z1\\":1.1,\\"Y2 I1\\":2.1+0.j}
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from vectors of operations and coefficients.
This constructor initializes a new PauliOperator object based on two given vectors: ops
containing string representations of Pauli operator symbols, and coef_s
containing the corresponding std::complex<double> coefficients. The length of both vectors should be the same, and each pair of elements (one from ops
and one from coef_s
) represents a term in the Pauli operator. input like: [\"X0 Z1\\",\\"Y2 I1\\"],[1.1+0.j,2.1+0.j]
ops | The vector of Pauli operator symbols. |
coef_s | The vector of corresponding coefficients. |
a_pauli | The string representation of the Pauli operator. |
Constructs a PauliOperator from vectors of operations, coefficients, and an additional boolean flag.
This constructor initializes a new PauliOperator object based on two given vectors: ops
containing string representations of Pauli operator symbols, and coef_s
containing the corresponding std::complex<double> coefficients. Additionally, it takes a boolean flag A
which may affect the initialization process or the behavior of the constructed PauliOperator object. The length of both vectors ops
and coef_s
should be the same, and each pair of elements (one from ops
and one from coef_s
) represents a term in the Pauli operator. input like: [\"XZI\\",\\"IZX\\"],[1.1+0.j,2.1+0.j],true
ops | The vector of Pauli operator symbols. |
coef_s | The vector of corresponding coefficients. |
A | The boolean flag that may affect the initialization or behavior. |
Constructs a PauliOperator from a vector of tuples.
This constructor initializes a new PauliOperator object based on a given vector of tuples ops
. Each tuple contains three elements: a string representing a Pauli operator symbol, a vector of size_t indices, and a std::complex<double> coefficient. The vector of tuples represents a collection of terms in the Pauli operator, where each term is specified by its operator symbol, indices (if applicable), and coefficient. input like: [(\"XZ\\",[0,4],1.1+0.j),(\\"YX\\",[1,2],2.1+0.j)]
ops | The vector of tuples containing Pauli operator symbols, indices, and coefficients. |
PauliOperator pyqpanda3.hamiltonian.PauliOperator.__add__ | ( | self, | |
PauliOperator | other ) |
add(self: hamiltonian.PauliOperator, other: hamiltonian.PauliOperator) -> hamiltonian.PauliOperator
Overload of the +
operator for adding two PauliOperators.
This method allows for the addition of two PauliOperators, resulting in a new PauliOperator that represents the sum of the two input PauliOperators.
pauli_op | The PauliOperator to add to the current PauliOperator. |
bool pyqpanda3.hamiltonian.PauliOperator.__eq__ | ( | self, | |
PauliOperator | other ) |
eq(self: hamiltonian.PauliOperator, other: hamiltonian.PauliOperator) -> bool
Checks if the current PauliOperator is equal to another PauliOperator.
This method compares the current PauliOperator with another PauliOperator to determine if they are equal. Two PauliOperators are considered equal if they have the same terms and coefficients.
other | The PauliOperator to compare with the current PauliOperator. |
PauliOperator pyqpanda3.hamiltonian.PauliOperator.__iadd__ | ( | self, | |
PauliOperator | other ) |
iadd(self: hamiltonian.PauliOperator, other: hamiltonian.PauliOperator) -> hamiltonian.PauliOperator
Overload of the +=
operator for adding two PauliOperators.
This method allows for the addition of two PauliOperators. The current PauliOperator is updated to be the sum of the current PauliOperator and the input PauliOperator.
other | The PauliOperator to add to the current PauliOperator. |
PauliOperator pyqpanda3.hamiltonian.PauliOperator.__imul__ | ( | self, | |
PauliOperator | other ) |
imul(self: hamiltonian.PauliOperator, other: hamiltonian.PauliOperator) -> hamiltonian.PauliOperator
Overload of the =
operator for multiplying two PauliOperators.
This method allows for the multiplication of two PauliOperators. The current PauliOperator is updated to be the product of the current PauliOperator and the input PauliOperator. Note: The multiplication of PauliOperators typically follows the rules of tensor products and may result in a new PauliOperator with combined terms and coefficients.
other | The PauliOperator to multiply with the current PauliOperator. |
PauliOperator pyqpanda3.hamiltonian.PauliOperator.__isub__ | ( | self, | |
PauliOperator | other ) |
isub(self: hamiltonian.PauliOperator, other: hamiltonian.PauliOperator) -> hamiltonian.PauliOperator
Overload of the -=
operator for subtracting two PauliOperators.
This method allows for the subtraction of two PauliOperators. The current PauliOperator is updated to be the difference of the current PauliOperator and the input PauliOperator.
other | The PauliOperator to subtract from the current PauliOperator. |
PauliOperator pyqpanda3.hamiltonian.PauliOperator.__matmul__ | ( | self, | |
PauliOperator | other ) |
matmul(self: hamiltonian.PauliOperator, other: hamiltonian.PauliOperator) -> hamiltonian.PauliOperator
Overload of the `` operator for multiplying two PauliOperators.
This method allows for the multiplication of two PauliOperators, resulting in a new PauliOperator that represents the product of the two input PauliOperators. (1)If two terms are identical except for their coefficients, then a new term is generated with a coefficient that is the difference between the original coefficients (left operand minus right operand), and the part of the new term other than the coefficient is the same as the original two terms. (2)If two terms are different (excluding coefficients), then two new terms are generated. One of the new terms corresponds to the left operand and is exactly the same as the left operand. The other new term corresponds to the right operand and is the result of multiplying the coefficient of the right operand by -1.
other | The PauliOperator to multiply with the current PauliOperator. |
PauliOperator pyqpanda3.hamiltonian.PauliOperator.__mul__ | ( | self, | |
complex | scalar ) |
mul(*args, **kwargs) Overloaded function.
Overload of the `` operator for multiplying two PauliOperators.
This method allows for the multiplication of two PauliOperators, resulting in a new PauliOperator that represents the product of the two input PauliOperators. (1)If two terms are identical except for their coefficients, then a new term is generated with a coefficient that is the difference between the original coefficients (left operand minus right operand), and the part of the new term other than the coefficient is the same as the original two terms. (2)If two terms are different (excluding coefficients), then two new terms are generated. One of the new terms corresponds to the left operand and is exactly the same as the left operand. The other new term corresponds to the right operand and is the result of multiplying the coefficient of the right operand by -1.
other | The PauliOperator to multiply with the current PauliOperator. |
Overload of the `` operator for multiplying a PauliOperator by a scalar.
This method allows for the multiplication of a PauliOperator by a scalar value, resulting in a new PauliOperator that represents the scaled version of the original PauliOperator.
scalar | The scalar value to multiply the PauliOperator by. |
PauliOperator pyqpanda3.hamiltonian.PauliOperator.__mul__ | ( | self, | |
PauliOperator | other ) |
mul(*args, **kwargs) Overloaded function.
Overload of the `` operator for multiplying two PauliOperators.
This method allows for the multiplication of two PauliOperators, resulting in a new PauliOperator that represents the product of the two input PauliOperators. (1)If two terms are identical except for their coefficients, then a new term is generated with a coefficient that is the difference between the original coefficients (left operand minus right operand), and the part of the new term other than the coefficient is the same as the original two terms. (2)If two terms are different (excluding coefficients), then two new terms are generated. One of the new terms corresponds to the left operand and is exactly the same as the left operand. The other new term corresponds to the right operand and is the result of multiplying the coefficient of the right operand by -1.
other | The PauliOperator to multiply with the current PauliOperator. |
Overload of the `` operator for multiplying a PauliOperator by a scalar.
This method allows for the multiplication of a PauliOperator by a scalar value, resulting in a new PauliOperator that represents the scaled version of the original PauliOperator.
scalar | The scalar value to multiply the PauliOperator by. |
PauliOperator pyqpanda3.hamiltonian.PauliOperator.__rmul__ | ( | self, | |
complex | scalar ) |
rmul(self: hamiltonian.PauliOperator, scalar: complex) -> hamiltonian.PauliOperator
Overload of the `` operator for multiplying a PauliOperator by a scalar.
This method allows for the multiplication of a PauliOperator by a scalar value, resulting in a new PauliOperator that represents the scaled version of the original PauliOperator.
scalar | The scalar value to multiply the PauliOperator by. |
PauliOperator pyqpanda3.hamiltonian.PauliOperator.__sub__ | ( | self, | |
PauliOperator | other ) |
sub(self: hamiltonian.PauliOperator, other: hamiltonian.PauliOperator) -> hamiltonian.PauliOperator
Overload of the -
operator for subtracting two PauliOperators.
This method allows for the subtraction of one PauliOperator from another, resulting in a new PauliOperator that represents the difference between the two input PauliOperators. (1)If two terms are identical except for their coefficients, a new term is generated with a coefficient that is the sum of the original coefficients, and the part of the new term other than the coefficient is the same as the original two terms. (2)If two terms are different (excluding coefficients), then two new terms are generated, which are identical to the original two terms respectively.
pauli_op | The PauliOperator to subtract from the current PauliOperator. |
str pyqpanda3.hamiltonian.PauliOperator.str_no_I | ( | self | ) |
str_no_I(self: hamiltonian.PauliOperator) -> str
Converts the PauliOperator to a string representation without the \'I\' (identity) term.
This method generates a string that represents the PauliOperator, excluding the \'I\' term. The string consists of characters \'X\', \'Y\', \'Z\', and digits, where "X#", "Y#", and "Z#" represent Pauli operators X, Y, and Z acting on qubits with index #, respectively. The AB_is_A1_B0
parameter specifies the order of the character substrings representing the Pauli operators on different qubits in the resulting string. If AB_is_A1_B0
is true, the substring corresponding to the qubit with the larger index appears first in the string. If false, the substring with the smaller index appears first.
AB_is_A1_B0 | If true, the substring for the qubit with the larger index appears first in the string. If false, the substring for the qubit with the smaller index appears first. |
str pyqpanda3.hamiltonian.PauliOperator.str_with_I | ( | self, | |
bool | AB_is_A1_B0 = ... ) |
str_with_I(self: hamiltonian.PauliOperator, AB_is_A1_B0: bool = True) -> str
Converts the PauliOperator to a string representation with Pauli matrices.
This method converts the current PauliOperator
object to a string representation where the Pauli matrices are represented by the characters 'X', 'Y', 'Z', and 'I'. The parameter AB_is_A1_B0
indicates the relationship between the order of the characters in the string and the qubit indices. If AB_is_A1_B0
is true, then the characters with smaller indices in the string correspond to larger qubit indices. Otherwise, the characters with smaller indices in the string correspond to smaller qubit indices.
AB_is_A1_B0 | A boolean value that specifies the character order in relation to qubit indices. |
PauliOperator
object with Pauli matrices represented by 'X', 'Y', 'Z', and 'I'. str pyqpanda3.hamiltonian.PauliOperator.str_withou_I | ( | self | ) |
str_withou_I(self: hamiltonian.PauliOperator) -> str
Converts the PauliOperator to a string representation without the \'I\' (identity) term.
This method generates a string that represents the PauliOperator, excluding the \'I\' term. The string consists of characters \'X\', \'Y\', \'Z\', and digits, where "X#", "Y#", and "Z#" represent Pauli operators X, Y, and Z acting on qubits with index #, respectively. The AB_is_A1_B0
parameter specifies the order of the character substrings representing the Pauli operators on different qubits in the resulting string. If AB_is_A1_B0
is true, the substring corresponding to the qubit with the larger index appears first in the string. If false, the substring with the smaller index appears first.
AB_is_A1_B0 | If true, the substring for the qubit with the larger index appears first in the string. If false, the substring for the qubit with the smaller index appears first. |
PauliOperator pyqpanda3.hamiltonian.PauliOperator.tensor | ( | self, | |
int | n ) |
tensor(*args, **kwargs) Overloaded function.
Overload of the ^
operator for performing the tensor product of two PauliOperators.
This method computes the tensor product (Kronecker product) of the current PauliOperator with another PauliOperator, resulting in a new PauliOperator that represents the combined system of the two input PauliOperators.
other | The PauliOperator to compute the tensor product with. |
Overload of the ^
operator for performing the tensor product operation n-1 times.
This method allows for the computation of the tensor product of the current PauliOperator with itself n-1
times, resulting in a new PauliOperator that represents this repeated tensor product.
n | The number of times to perform the tensor product operation (i.e., n-1 tensor products). |
n-1
times. PauliOperator pyqpanda3.hamiltonian.PauliOperator.tensor | ( | self, | |
PauliOperator | other ) |
tensor(*args, **kwargs) Overloaded function.
Overload of the ^
operator for performing the tensor product of two PauliOperators.
This method computes the tensor product (Kronecker product) of the current PauliOperator with another PauliOperator, resulting in a new PauliOperator that represents the combined system of the two input PauliOperators.
other | The PauliOperator to compute the tensor product with. |
Overload of the ^
operator for performing the tensor product operation n-1 times.
This method allows for the computation of the tensor product of the current PauliOperator with itself n-1
times, resulting in a new PauliOperator that represents this repeated tensor product.
n | The number of times to perform the tensor product operation (i.e., n-1 tensor products). |
n-1
times.