qiskit_optimization/problems/quadratic_program.py
def from_ising(
        self,
        qubit_op: Union[OperatorBase, PauliSumOp],
        offset: float = 0.0,
        linear: bool = False,
    ) -> None:
        r"""Create a quadratic program from a qubit operator and a shift value.

        Variables are mapped to qubits in the same order, i.e.,
        i-th variable is mapped to i-th qubit.
        See https://github.com/Qiskit/qiskit-terra/issues/1148 for details.

        Args:
            qubit_op: The qubit operator of the problem.
            offset: The constant value in the Ising Hamiltonian.
            linear: If linear is True, :math:`x^2` is treated as a linear term
                since :math:`x^2 = x` for :math:`x \in \{0,1\}`.
                Else, :math:`x^2` is treated as a quadratic term.
                The default value is False.

        Raises:
            QiskitOptimizationError: If there are Pauli Xs in any Pauli term
            QiskitOptimizationError: If there are more than 2 Pauli Zs in any Pauli term
            NotImplementedError: If the input operator is a ListOp
        """
        # pylint: disable=cyclic-import
        from ..translators.ising import from_ising

        other = from_ising(qubit_op, offset, linear)
        self._copy_from(other, include_name=False)
r"""Create a quadratic program from a qubit operator and a shift value.

        Variables are mapped to qubits in the same order, i.e.,
        i-th variable is mapped to i-th qubit.
        See https://github.com/Qiskit/qiskit-terra/issues/1148 for details.

        Args:
            qubit_op: The qubit operator of the problem.
            offset: The constant value in the Ising Hamiltonian.
            linear: If linear is True, :math:`x^2` is treated as a linear term
                since :math:`x^2 = x` for :math:`x \in \{0,1\}`.
                Else, :math:`x^2` is treated as a quadratic term.
                The default value is False.

        Raises:
            QiskitOptimizationError: If there are Pauli Xs in any Pauli term
            QiskitOptimizationError: If there are more than 2 Pauli Zs in any Pauli term
            NotImplementedError: If the input operator is a ListOp
        
r"""Create a quadratic program from a qubit operator and a shift value.
Variables are mapped to qubits in the same order, i.e.,
i-th variable is mapped to i-th qubit.
r " " " Create a quadratic program from a qubit operator and a shift value . Variables are mapped to qubits in the same order i . e . i - th variable is mapped to i - th qubit .
def from_ising(
        self,
        qubit_op: Union[OperatorBase, PauliSumOp],
        offset: float = 0.0,
        linear: bool = False,
    ) -> None:
        from ..translators.ising import from_ising
        other = from_ising(qubit_op, offset, linear)
        self._copy_from(other, include_name=False)
def from_ising ( self , qubit_op : Union [ OperatorBase , PauliSumOp ] , offset : float = 0.0 , linear : bool = False , ) -> None : from . . translators . ising import from_ising other = from_ising ( qubit_op , offset , linear ) self . _copy_from ( other , include_name = False )
r"""Create a quadratic program from a qubit operator and a shift value.
r " " " Create a quadratic program from a qubit operator and a shift value .
r"""Create a quadratic program from a qubit operator and a shift value.

        Variables are mapped to qubits in the same order, i.e.,
        i-th variable is mapped to i-th qubit.
        See https://github.com/Qiskit/qiskit-terra/issues/1148 for details.

        Args:
            qubit_op: The qubit operator of the problem.
            offset: The constant value in the Ising Hamiltonian.
            linear: If linear is True, :math:`x^2` is treated as a linear term
                since :math:`x^2 = x` for :math:`x \in \{0,1\}`.
                Else, :math:`x^2` is treated as a quadratic term.
                The default value is False.

        Raises:
            QiskitOptimizationError: If there are Pauli Xs in any Pauli term
            QiskitOptimizationError: If there are more than 2 Pauli Zs in any Pauli term
            NotImplementedError: If the input operator is a ListOp
        """ # pylint: disable=cyclic-import
If there are Pauli Xs in any Pauli term
If there are Pauli Xs in any Pauli term
QiskitOptimizationError
If there are more than 2 Pauli Zs in any Pauli term
If there are more than 2 Pauli Zs in any Pauli term
QiskitOptimizationError
If the input operator is a ListOp
If the input operator is a ListOp
NotImplementedError
self
qubit_op
Union[OperatorBase, PauliSumOp]
The qubit operator of the problem.
The qubit operator of the problem .
offset
float
The constant value in the Ising Hamiltonian.
The constant value in the Ising Hamiltonian .
linear
bool
If linear is True, :math:`x^2` is treated as a linear term
since :math:`x^2 = x` for :math:`x \in \{0,1\}`.
Else, :math:`x^2` is treated as a quadratic term.
The default value is False.
If linear is True : math : ` x^2 ` is treated as a linear term since : math : ` x^2 = x ` for : math : ` x \ in \ { 0 1 \ } ` . Else : math : ` x^2 ` is treated as a quadratic term . The default value is False .