.. index:: pair: class; QPanda::FermionOp .. _doxid-class_q_panda_1_1_fermion_op: template class QPanda::FermionOp ================================ .. toctree:: :hidden: Overview ~~~~~~~~ Fermion operator class. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include template class FermionOp { public: // typedefs typedef std::pair<:ref:`FermionPair`, :ref:`T`> :target:`FermionItem`; typedef std::vector<:ref:`FermionItem`> :target:`FermionData`; typedef std::map`> :target:`FermionMap`; // construction :ref:`FermionOp`(); :target:`FermionOp`(double value); :target:`FermionOp`(const :ref:`T`& value); :target:`FermionOp`( const std::string& key, const :ref:`T`& value ); :target:`FermionOp`(const :ref:`FermionMap`& map); :target:`FermionOp`(:ref:`FermionData`&& fermion_data); :target:`FermionOp`(const :ref:`FermionData`& fermion_data); :target:`FermionOp`(FermionOp&& op); :target:`FermionOp`(const FermionOp& op); // methods FermionOp& :target:`operator =` (const FermionOp& op); FermionOp& :target:`operator =` (FermionOp&& op); FermionOp :ref:`normal_ordered`(); size_t :ref:`getMaxIndex`() const; bool :ref:`isEmpty`(); std::string :ref:`toString`() const; void :ref:`setErrorThreshold`(double threshold); double :ref:`error_threshold`() const; :ref:`FermionData` :ref:`data`() const; FermionOp :ref:`operator +` (const FermionOp& rhs) const; FermionOp :ref:`operator -` (const FermionOp& rhs) const; FermionOp :ref:`operator *` (const FermionOp& rhs) const; FermionOp& :ref:`operator +=` (const FermionOp& rhs); FermionOp& :ref:`operator -=` (const FermionOp& rhs); FermionOp& :ref:`operator *=` (const FermionOp& rhs); }; .. _details-class_q_panda_1_1_fermion_op: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Fermion operator class. Construction ------------ .. index:: pair: function; FermionOp .. _doxid-class_q_panda_1_1_fermion_op_1ae4710e465b52a1b56b1d0c97bd56929a: .. ref-code-block:: cpp :class: doxyrest-title-code-block FermionOp() Constructor of :ref:`FermionOp ` class. Methods ------- .. index:: pair: function; normal_ordered .. _doxid-class_q_panda_1_1_fermion_op_1ad16f02b9ddbc3466c220fb7fd18ae7e5: .. ref-code-block:: cpp :class: doxyrest-title-code-block FermionOp normal_ordered() Compute and return the normal ordered form of a FermionOperator. In our convention, normal ordering implies terms are ordered from highest tensor factor (on left) to lowest (on right). In addition: a^\dagger comes before a .. rubric:: Returns: :ref:`FermionOp ` the normal ordered form of a FermionOperator .. index:: pair: function; getMaxIndex .. _doxid-class_q_panda_1_1_fermion_op_1aa467d13b89d78fd50fba699143e9a5c3: .. ref-code-block:: cpp :class: doxyrest-title-code-block size_t getMaxIndex() const get the max index .. rubric:: Returns: size_t the max index .. index:: pair: function; isEmpty .. _doxid-class_q_panda_1_1_fermion_op_1aa846e43fb4bee4baba398e094ee7539b: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool isEmpty() Judge whether it is empty. .. rubric:: Returns: bool if data is empty, return true, or else return false .. index:: pair: function; toString .. _doxid-class_q_panda_1_1_fermion_op_1a11876f5e825a2b80d2c24f5a195c2198: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string toString() const data to string .. rubric:: Returns: std::string convert data val to string .. index:: pair: function; setErrorThreshold .. _doxid-class_q_panda_1_1_fermion_op_1a093667b5c05e17c4ed7e5bf812b0c6ef: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setErrorThreshold(double threshold) set error threshold .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - double - threshold val .. index:: pair: function; error_threshold .. _doxid-class_q_panda_1_1_fermion_op_1a49b43264ad39bc65662a5fe815c51004: .. ref-code-block:: cpp :class: doxyrest-title-code-block double error_threshold() const get error threshold .. rubric:: Returns: double return the error threshold val .. index:: pair: function; data .. _doxid-class_q_panda_1_1_fermion_op_1a0bcbe2d74af638c4de3cafaed6dcf9ec: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`FermionData` data() const get data .. rubric:: Returns: FermionData return fermion data .. index:: pair: function; operator+ .. _doxid-class_q_panda_1_1_fermion_op_1a69938656824ec1eb840d3aaee7e1e4bf: .. ref-code-block:: cpp :class: doxyrest-title-code-block FermionOp operator + (const FermionOp& rhs) const overload + .. rubric:: Returns: :ref:`FermionOp ` return (FermionOp_1 + FermionOp_2) .. index:: pair: function; operator- .. _doxid-class_q_panda_1_1_fermion_op_1a64adcaf3a76d825a658c48b86394b235: .. ref-code-block:: cpp :class: doxyrest-title-code-block FermionOp operator - (const FermionOp& rhs) const overload - .. rubric:: Returns: :ref:`FermionOp ` return (FermionOp_1 - FermionOp_2) .. index:: pair: function; operator* .. _doxid-class_q_panda_1_1_fermion_op_1a42f03d0bc79b2a79670e5cf5541936cf: .. ref-code-block:: cpp :class: doxyrest-title-code-block FermionOp operator * (const FermionOp& rhs) const overload \* .. rubric:: Returns: :ref:`FermionOp ` return (FermionOp_1 \* FermionOp_2) .. index:: pair: function; operator+= .. _doxid-class_q_panda_1_1_fermion_op_1af780055e063f8990f534d50339125200: .. ref-code-block:: cpp :class: doxyrest-title-code-block FermionOp& operator += (const FermionOp& rhs) overload += .. rubric:: Returns: :ref:`FermionOp ` & return (FermionOp_1 += FermionOp_2) .. index:: pair: function; operator-= .. _doxid-class_q_panda_1_1_fermion_op_1ad7e0dcdcf370dc4678dac2ba25d79108: .. ref-code-block:: cpp :class: doxyrest-title-code-block FermionOp& operator -= (const FermionOp& rhs) overload -= .. rubric:: Returns: :ref:`FermionOp ` & return (FermionOp_1 -= FermionOp_2) .. index:: pair: function; operator*= .. _doxid-class_q_panda_1_1_fermion_op_1a6249d01799e8d3d24777f0c2954b2bf3: .. ref-code-block:: cpp :class: doxyrest-title-code-block FermionOp& operator *= (const FermionOp& rhs) overload \*= .. rubric:: Returns: :ref:`FermionOp ` & return (FermionOp_1 \*= FermionOp_2)