class_docstr: Estimate the number of non-Clifford gates and logical qubits for a quantum phase estimation
  algorithm in first quantization using a plane-wave basis.
  
  To estimate the gate and qubit costs for implementing this method, the number of plane waves,
  the number of electrons and the lattice vectors need to be defined. The costs can then be
  computed using the functions :func:`~.pennylane.resource.FirstQuantization.gate_cost` and
  :func:`~.pennylane.resource.FirstQuantization.qubit_cost` with a target error that has the default
  value of 0.0016 Ha (chemical accuracy). Atomic units are used throughout the class.
  
  Args:
      n (int): number of plane waves
      eta (int): number of electrons
      omega (float): unit cell volume
      error (float): target error in the algorithm
      charge (int): total electric charge of the system
      br (int): number of bits for ancilla qubit rotation
      vectors (array[float]): lattice vectors
  
  **Example**
  
  >>> n = 100000
  >>> eta = 156
  >>> vectors = np.array([[10.46219511,  0.00000000,  0.00000000],
  ...                     [ 0.00000000, 10.46219511,  0.00000000],
  ...                     [ 0.00000000,  0.00000000, 10.46219511]])
  >>> algo = FirstQuantization(n, eta, vectors=vectors)
  >>> print(algo.lamb,  # the 1-Norm of the Hamiltonian
  >>>       algo.gates, # estimated number of non-Clifford gates
  >>>       algo.qubits # estimated number of logical qubits
  >>>       )
  649912.4804278888 1.1e+13 4416
  
  .. details::
      :title: Theory
  
      Following `PRX Quantum 2, 040332 (2021) <https://link.aps.org/doi/10.1103/PRXQuantum.2.040332>`_
      , the target algorithm error, :math:`\epsilon`, is distributed among four different sources
      of error using Eq. (131)
  
      .. math::
          \epsilon^2 \geq \epsilon_{qpe}^2 + (\epsilon_{\mathcal{M}} + \epsilon_R + \epsilon_T)^2,
  
      where :math:`\epsilon_{qpe}` is the quantum phase estimation error and
      :math:`\epsilon_{\mathcal{M}}`, :math:`\epsilon_R`, and :math:`\epsilon_T` are defined in
      Eqs. (132-134).
  
      Here, we fix :math:`\epsilon_{\mathcal{M}} = \epsilon_R = \epsilon_T = \alpha \epsilon` with
      a default value of :math:`\alpha = 0.01` and obtain
  
      .. math::
          \epsilon_{qpe} = \sqrt{\epsilon^2 [1 - (3 \alpha)^2]}.
  
      Note that the user only needs to define the target algorithm error :math:`\epsilon`. The
      error distribution takes place inside the functions.
class_docstr_tok: ["Estimate","the","number","of","non-Clifford","gates","and","logical","qubits","for","a","quantum","phase","estimation","algorithm","in","first","quantization","using","a","plane-wave","basis",".","To","estimate","the","gate","and","qubit","costs","for","implementing","this","method",",","the","number","of","plane","waves",",","the","number","of","electrons","and","the","lattice","vectors","need","to","be","defined",".","The","costs","can","then","be","computed","using","the","functions",":","func",":","`","~.pennylane.resource.FirstQuantization.gate_cost","`","and",":","func",":","`","~.pennylane.resource.FirstQuantization.qubit_cost","`","with","a","target","error","that","has","the","default","value","of","0.0016","Ha","(","chemical","accuracy",")",".","Atomic","units","are","used","throughout","the","class",".","Args",":","n","(","int",")",":","number","of","plane","waves","eta","(","int",")",":","number","of","electrons","omega","(","float",")",":","unit","cell","volume","error","(","float",")",":","target","error","in","the","algorithm","charge","(","int",")",":","total","electric","charge","of","the","system","br","(","int",")",":","number","of","bits","for","ancilla","qubit","rotation","vectors","(","array","[","float","]",")",":","lattice","vectors","*","*","Example","*","*",">",">",">","n","=","100000",">",">",">","eta","=","156",">",">",">","vectors","=","np.array","(","[","[","10.46219511",",","0.00000000",",","0.00000000","]",",","...","[","0.00000000",",","10.46219511",",","0.00000000","]",",","...","[","0.00000000",",","0.00000000",",","10.46219511","]","]",")",">",">",">","algo","=","FirstQuantization","(","n",",","eta",",","vectors=vectors",")",">",">",">","print","(","algo.lamb",",","#","the","1-Norm","of","the","Hamiltonian",">",">",">","algo.gates",",","#","estimated","number","of","non-Clifford","gates",">",">",">","algo.qubits","#","estimated","number","of","logical","qubits",">",">",">",")","649912.4804278888","1.1e+13","4416","..","details",":",":",":","title",":","Theory","Following","`","PRX","Quantum","2",",","040332","(","2021",")","<","https",":","\/\/link.aps.org\/doi\/10.1103\/PRXQuantum.2.040332",">","`","_",",","the","target","algorithm","error",",",":","math",":","`","\\epsilon","`",",","is","distributed","among","four","different","sources","of","error","using","Eq",".","(","131",")","..","math",":",":","\\epsilon^2","\\geq","\\epsilon_","{","qpe","}","^2","+","(","\\epsilon_","{","\\mathcal","{","M","}","}","+","\\epsilon_R","+","\\epsilon_T",")","^2",",","where",":","math",":","`","\\epsilon_","{","qpe","}","`","is","the","quantum","phase","estimation","error","and",":","math",":","`","\\epsilon_","{","\\mathcal","{","M","}","}","`",",",":","math",":","`","\\epsilon_R","`",",","and",":","math",":","`","\\epsilon_T","`","are","defined","in","Eqs",".","(","132-134",")",".","Here",",","we","fix",":","math",":","`","\\epsilon_","{","\\mathcal","{","M","}","}","=","\\epsilon_R","=","\\epsilon_T","=","\\alpha","\\epsilon","`","with","a","default","value","of",":","math",":","`","\\alpha","=","0.01","`","and","obtain","..","math",":",":","\\epsilon_","{","qpe","}","=","\\sqrt","{","\\epsilon^2","[","1","-","(","3","\\alpha",")","^2","]","}",".","Note","that","the","user","only","needs","to","define","the","target","algorithm","error",":","math",":","`","\\epsilon","`",".","The","error","distribution","takes","place","inside","the","functions","."]
docstr: Return the 1-norm of a first-quantized Hamiltonian in the plane-wave basis.
  
  The expressions needed for computing the norm are taken from
  [`PRX Quantum 2, 040332 (2021) <https://link.aps.org/doi/10.1103/PRXQuantum.2.040332>`_].
  The norm is computed assuming that amplitude ampliﬁcation is performed.
  
  Args:
      n (int): number of plane waves
      eta (int): number of electrons
      omega (float): unit cell volume
      error (float): target error in the algorithm
      br (int): number of bits for ancilla qubit rotation
      charge (int): total electric charge of the system
      cubic (bool): True if the unit cell is cubic
      vectors (array[float]): lattice vectors
  
  Returns:
      float: 1-norm of a first-quantized Hamiltonian in the plane-wave basis
  
  **Example**
  
  >>> n = 10000
  >>> eta = 156
  >>> omega = 1145.166
  >>> error = 0.001
  >>> norm(n, eta, omega, error)
  281053.75612801575
  
  .. details::
      :title: Theory
  
      To compute the norm, for numerical convenience, we use the following modified
      expressions to obtain parameters that contain a sum over
      :math:`\frac{1}{\left \| \nu \right \|^k}` where :math:`\nu` denotes an element of the
      set of reciprocal lattice vectors, :math:`G_0`, and
      :math:`k \in \left \{ 1, 2 \right \}`.
  
      For :math:`\lambda_{\nu}` defined in Eq. (25) of
      `PRX Quantum 2, 040332 (2021) <https://link.aps.org/doi/10.1103/PRXQuantum.2.040332>`_
      as
  
      .. math::
  
          \lambda_{\nu} = \sum_{\nu \in G_0} \frac{1}{\left \| \nu \right \|^2},
  
      we follow Eq. (F6) of
      `PRX 8, 011044 (2018) <https://journals.aps.org/prx/abstract/10.1103/PhysRevX.8.011044>`_
      and use
  
      .. math::
  
          \lambda_{\nu} = 4\pi \left ( \frac{\sqrt{3}}{2} N^{1/3} - 1 \right) + 3 - \frac{3}{N^{1/3}}
          + 3 \int_{x=1}^{N^{1/3}} \int_{y=1}^{N^{1/3}} \frac{1}{x^2 + y^2} dydx.
  
      We also need to compute :math:`\lambda^{\alpha}_{\nu}` defined in Eq. (123) of
      `PRX Quantum 2, 040332 (2021) <https://link.aps.org/doi/10.1103/PRXQuantum.2.040332>`_
  
      .. math::
  
          \lambda^{\alpha}_{\nu} = \alpha \sum_{\nu \in G_0} \frac{\left \lceil
          \mathcal{M}(2^{\mu - 2}) / \left \| \nu \right \|^2 \right \rceil}{\mathcal{M}
          2^{2\mu - 4}},
  
      which we compute here, for :math:`\alpha = 1`, as
  
      .. math::
  
          \lambda^{1}_{\nu} = \lambda_{\nu} + \epsilon_l,
  
      where :math:`\epsilon_l` is simply defined as the difference of
      :math:`\lambda^{1}_{\nu}` and :math:`\lambda_{\nu}`. We follow Eq. (113) of
      `PRX Quantum 2, 040332 (2021) <https://link.aps.org/doi/10.1103/PRXQuantum.2.040332>`_
      to derive an upper bound for its absolute value:
  
      .. math::
  
          |\epsilon_l| \le \frac{4}{2^{n_m}} (7 \times 2^{n_p + 1} + 9 n_p - 11 - 3 \times 2^{-n_p}),
  
      where :math:`\mathcal{M} = 2^{n_m}` and :math:`n_m` is defined in Eq. (132) of
      `PRX Quantum 2, 040332 (2021) <https://link.aps.org/doi/10.1103/PRXQuantum.2.040332>`_.
      Finally, for :math:`p_{\nu}` defined in Eq. (128) of
      `PRX Quantum 2, 040332 (2021) <https://link.aps.org/doi/10.1103/PRXQuantum.2.040332>`_
  
      .. math::
  
          p_{\nu} = \sum_{\mu = 2}^{n_p + 1} \sum_{\nu \in B_{\mu}} \frac{\left \lceil M(2^{\mu-2}
          / \left \| \nu \right \|)^2 \right \rceil}{M 2^{2\mu} 2^{n_{\mu} + 1}},
  
      we use the upper bound from Eq. (29) in
      `arXiv:1807.09802v2 <https://arxiv.org/abs/1807.09802v2>`_ which gives
      :math:`p_{\nu} = 0.2398`.
docstr_tok: ["Return","the","1-norm","of","a","first-quantized","Hamiltonian","in","the","plane-wave","basis",".","The","expressions","needed","for","computing","the","norm","are","taken","from","[","`","PRX","Quantum","2",",","040332","(","2021",")","<","https",":","\/\/link.aps.org\/doi\/10.1103\/PRXQuantum.2.040332",">","`","_","]",".","The","norm","is","computed","assuming","that","amplitude","ampli\ufb01cation","is","performed",".","Args",":","n","(","int",")",":","number","of","plane","waves","eta","(","int",")",":","number","of","electrons","omega","(","float",")",":","unit","cell","volume","error","(","float",")",":","target","error","in","the","algorithm","br","(","int",")",":","number","of","bits","for","ancilla","qubit","rotation","charge","(","int",")",":","total","electric","charge","of","the","system","cubic","(","bool",")",":","True","if","the","unit","cell","is","cubic","vectors","(","array","[","float","]",")",":","lattice","vectors","Returns",":","float",":","1-norm","of","a","first-quantized","Hamiltonian","in","the","plane-wave","basis","*","*","Example","*","*",">",">",">","n","=","10000",">",">",">","eta","=","156",">",">",">","omega","=","1145.166",">",">",">","error","=","0.001",">",">",">","norm","(","n",",","eta",",","omega",",","error",")","281053.75612801575","..","details",":",":",":","title",":","Theory","To","compute","the","norm",",","for","numerical","convenience",",","we","use","the","following","modified","expressions","to","obtain","parameters","that","contain","a","sum","over",":","math",":","`","\\frac","{","1","}","{","\\left","\\|","\\nu","\\right","\\|^k","}","`","where",":","math",":","`","\\nu","`","denotes","an","element","of","the","set","of","reciprocal","lattice","vectors",",",":","math",":","`","G_0","`",",","and",":","math",":","`","k","\\in","\\left","\\","{","1",",","2","\\right","\\","}","`",".","For",":","math",":","`","\\lambda_","{","\\nu","}","`","defined","in","Eq",".","(","25",")","of","`","PRX","Quantum","2",",","040332","(","2021",")","<","https",":","\/\/link.aps.org\/doi\/10.1103\/PRXQuantum.2.040332",">","`","_","as","..","math",":",":","\\lambda_","{","\\nu","}","=","\\sum_","{","\\nu","\\in","G_0","}","\\frac","{","1","}","{","\\left","\\|","\\nu","\\right","\\|^2","}",",","we","follow","Eq",".","(","F6",")","of","`","PRX","8",",","011044","(","2018",")","<","https",":","\/\/journals.aps.org\/prx\/abstract\/10.1103\/PhysRevX.8.011044",">","`","_","and","use","..","math",":",":","\\lambda_","{","\\nu","}","=","4\\pi","\\left","(","\\frac","{","\\sqrt","{","3","}","}","{","2","}","N^","{","1\/3","}","-","1","\\right",")","+","3","-","\\frac","{","3","}","{","N^","{","1\/3","}","}","+","3","\\int_","{","x=1","}","^","{","N^","{","1\/3","}","}","\\int_","{","y=1","}","^","{","N^","{","1\/3","}","}","\\frac","{","1","}","{","x^2","+","y^2","}","dydx",".","We","also","need","to","compute",":","math",":","`","\\lambda^","{","\\alpha","}","_","{","\\nu","}","`","defined","in","Eq",".","(","123",")","of","`","PRX","Quantum","2",",","040332","(","2021",")","<","https",":","\/\/link.aps.org\/doi\/10.1103\/PRXQuantum.2.040332",">","`","_","..","math",":",":","\\lambda^","{","\\alpha","}","_","{","\\nu","}","=","\\alpha","\\sum_","{","\\nu","\\in","G_0","}","\\frac","{","\\left","\\lceil","\\mathcal","{","M","}","(","2^","{","\\mu","-","2","}",")","\/","\\left","\\|","\\nu","\\right","\\|^2","\\right","\\rceil","}","{","\\mathcal","{","M","}","2^","{","2\\mu","-","4","}","}",",","which","we","compute","here",",","for",":","math",":","`","\\alpha","=","1","`",",","as","..","math",":",":","\\lambda^","{","1","}","_","{","\\nu","}","=","\\lambda_","{","\\nu","}","+","\\epsilon_l",",","where",":","math",":","`","\\epsilon_l","`","is","simply","defined","as","the","difference","of",":","math",":","`","\\lambda^","{","1","}","_","{","\\nu","}","`","and",":","math",":","`","\\lambda_","{","\\nu","}","`",".","We","follow","Eq",".","(","113",")","of","`","PRX","Quantum","2",",","040332","(","2021",")","<","https",":","\/\/link.aps.org\/doi\/10.1103\/PRXQuantum.2.040332",">","`","_","to","derive","an","upper","bound","for","its","absolute","value",":","..","math",":",":","|\\epsilon_l|","\\le","\\frac","{","4","}","{","2^","{","n_m","}","}","(","7","\\times","2^","{","n_p","+","1","}","+","9","n_p","-","11","-","3","\\times","2^","{","-n_p","}",")",",","where",":","math",":","`","\\mathcal","{","M","}","=","2^","{","n_m","}","`","and",":","math",":","`","n_m","`","is","defined","in","Eq",".","(","132",")","of","`","PRX","Quantum","2",",","040332","(","2021",")","<","https",":","\/\/link.aps.org\/doi\/10.1103\/PRXQuantum.2.040332",">","`","_",".","Finally",",","for",":","math",":","`","p_","{","\\nu","}","`","defined","in","Eq",".","(","128",")","of","`","PRX","Quantum","2",",","040332","(","2021",")","<","https",":","\/\/link.aps.org\/doi\/10.1103\/PRXQuantum.2.040332",">","`","_","..","math",":",":","p_","{","\\nu","}","=","\\sum_","{","\\mu","=","2","}","^","{","n_p","+","1","}","\\sum_","{","\\nu","\\in","B_","{","\\mu","}","}","\\frac","{","\\left","\\lceil","M","(","2^","{","\\mu-2","}","\/","\\left","\\|","\\nu","\\right","\\|",")","^2","\\right","\\rceil","}","{","M","2^","{","2\\mu","}","2^","{","n_","{","\\mu","}","+","1","}","}",",","we","use","the","upper","bound","from","Eq",".","(","29",")","in","`","arXiv:1807.09802v2","<","https",":","\/\/arxiv.org\/abs\/1807.09802v2",">","`","_","which","gives",":","math",":","`","p_","{","\\nu","}","=","0.2398","`","."]
code: def norm(
      n, eta, omega, error, br=7, charge=0, cubic=True, vectors=None
  ):
      r"""Return the 1-norm of a first-quantized Hamiltonian in the plane-wave basis.
  
      The expressions needed for computing the norm are taken from
      [`PRX Quantum 2, 040332 (2021) <https://link.aps.org/doi/10.1103/PRXQuantum.2.040332>`_].
      The norm is computed assuming that amplitude ampliﬁcation is performed.
  
      Args:
          n (int): number of plane waves
          eta (int): number of electrons
          omega (float): unit cell volume
          error (float): target error in the algorithm
          br (int): number of bits for ancilla qubit rotation
          charge (int): total electric charge of the system
          cubic (bool): True if the unit cell is cubic
          vectors (array[float]): lattice vectors
  
      Returns:
          float: 1-norm of a first-quantized Hamiltonian in the plane-wave basis
  
      **Example**
  
      >>> n = 10000
      >>> eta = 156
      >>> omega = 1145.166
      >>> error = 0.001
      >>> norm(n, eta, omega, error)
      281053.75612801575
  
      .. details::
          :title: Theory
  
          To compute the norm, for numerical convenience, we use the following modified
          expressions to obtain parameters that contain a sum over
          :math:`\frac{1}{\left \| \nu \right \|^k}` where :math:`\nu` denotes an element of the
          set of reciprocal lattice vectors, :math:`G_0`, and
          :math:`k \in \left \{ 1, 2 \right \}`.
  
          For :math:`\lambda_{\nu}` defined in Eq. (25) of
          `PRX Quantum 2, 040332 (2021) <https://link.aps.org/doi/10.1103/PRXQuantum.2.040332>`_
          as
  
          .. math::
  
              \lambda_{\nu} = \sum_{\nu \in G_0} \frac{1}{\left \| \nu \right \|^2},
  
          we follow Eq. (F6) of
          `PRX 8, 011044 (2018) <https://journals.aps.org/prx/abstract/10.1103/PhysRevX.8.011044>`_
          and use
  
          .. math::
  
              \lambda_{\nu} = 4\pi \left ( \frac{\sqrt{3}}{2} N^{1/3} - 1 \right) + 3 - \frac{3}{N^{1/3}}
              + 3 \int_{x=1}^{N^{1/3}} \int_{y=1}^{N^{1/3}} \frac{1}{x^2 + y^2} dydx.
  
          We also need to compute :math:`\lambda^{\alpha}_{\nu}` defined in Eq. (123) of
          `PRX Quantum 2, 040332 (2021) <https://link.aps.org/doi/10.1103/PRXQuantum.2.040332>`_
  
          .. math::
  
              \lambda^{\alpha}_{\nu} = \alpha \sum_{\nu \in G_0} \frac{\left \lceil
              \mathcal{M}(2^{\mu - 2}) / \left \| \nu \right \|^2 \right \rceil}{\mathcal{M}
              2^{2\mu - 4}},
  
          which we compute here, for :math:`\alpha = 1`, as
  
          .. math::
  
              \lambda^{1}_{\nu} = \lambda_{\nu} + \epsilon_l,
  
          where :math:`\epsilon_l` is simply defined as the difference of
          :math:`\lambda^{1}_{\nu}` and :math:`\lambda_{\nu}`. We follow Eq. (113) of
          `PRX Quantum 2, 040332 (2021) <https://link.aps.org/doi/10.1103/PRXQuantum.2.040332>`_
          to derive an upper bound for its absolute value:
  
          .. math::
  
              |\epsilon_l| \le \frac{4}{2^{n_m}} (7 \times 2^{n_p + 1} + 9 n_p - 11 - 3 \times 2^{-n_p}),
  
          where :math:`\mathcal{M} = 2^{n_m}` and :math:`n_m` is defined in Eq. (132) of
          `PRX Quantum 2, 040332 (2021) <https://link.aps.org/doi/10.1103/PRXQuantum.2.040332>`_.
          Finally, for :math:`p_{\nu}` defined in Eq. (128) of
          `PRX Quantum 2, 040332 (2021) <https://link.aps.org/doi/10.1103/PRXQuantum.2.040332>`_
  
          .. math::
  
              p_{\nu} = \sum_{\mu = 2}^{n_p + 1} \sum_{\nu \in B_{\mu}} \frac{\left \lceil M(2^{\mu-2}
              / \left \| \nu \right \|)^2 \right \rceil}{M 2^{2\mu} 2^{n_{\mu} + 1}},
  
          we use the upper bound from Eq. (29) in
          `arXiv:1807.09802v2 <https://arxiv.org/abs/1807.09802v2>`_ which gives
          :math:`p_{\nu} = 0.2398`.
      """
      if n <= 0:
          raise ValueError(
              "The number of plane waves must be a positive number."
          )
  
      if eta <= 0 or not isinstance(eta, (int, np.integer)):
          raise ValueError(
              "The number of electrons must be a positive integer."
          )
  
      if omega <= 0:
          raise ValueError(
              "The unit cell volume must be a positive number."
          )
  
      if error <= 0.0:
          raise ValueError(
              "The target error must be greater than zero."
          )
  
      if br <= 0 or not isinstance(br, int):
          raise ValueError("br must be a positive integer.")
  
      if not isinstance(charge, int):
          raise ValueError("system charge must be an integer.")
  
      if not cubic:
          return FirstQuantization._norm_noncubic(
              n, eta, error, br, charge, vectors
          )[0]
  
      l_z = eta + charge
  
      # target error in the qubitization of U+V which we set to be 0.01 of the algorithm error
      error_uv = 0.01 * error
  
      # taken from Eq. (22) of PRX Quantum 2, 040332 (2021)
      n_p = int(np.ceil(np.log2(n ** (1 / 3) + 1)))
  
      n0 = n ** (1 / 3)
      lambda_nu = (  # expression is taken from Eq. (F6) of PRX 8, 011044 (2018)
          4 * np.pi * (np.sqrt(3) * n ** (1 / 3) / 2 - 1)
          + 3
          - 3 / n ** (1 / 3)
          + 3
          * integrate.nquad(
              lambda x, y: 1 / (x**2 + y**2), [[1, n0], [1, n0]]
          )[0]
      )
      n_m = int(
          np.log2(  # taken from Eq. (132) of PRX Quantum 2, 040332 (2021)
              (2 * eta)
              / (error_uv * np.pi * omega ** (1 / 3))
              * (eta - 1 + 2 * l_z)
              * (
                  7 * 2 ** (n_p + 1)
                  - 9 * n_p
                  - 11
                  - 3 * 2 ** (-1 * n_p)
              )
          )
      )
      # computed using Eq. (113) of PRX Quantum 2, 040332 (2021)
      lambda_nu_1 = lambda_nu + 4 / 2**n_m * (
          7 * 2 ** (n_p + 1) - 9 * n_p - 11 - 3 * 2 ** (-1 * n_p)
      )
  
      p_nu = 0.2398  # approximation from Eq. (29) in arxiv:1807.09802
      p_nu_amp = (
          np.sin(3 * np.arcsin(np.sqrt(p_nu))) ** 2
      )  # Eq. (129), PRX Quantum 2, 040332 (2021)
  
      # lambda_u and lambda_v are taken from Eq. (25) of PRX Quantum 2, 040332 (2021)
      lambda_u = eta * l_z * lambda_nu / (np.pi * omega ** (1 / 3))
      lambda_v = (
          eta * (eta - 1) * lambda_nu / (2 * np.pi * omega ** (1 / 3))
      )
  
      # taken from Eq. (71) of PRX Quantum 2, 040332 (2021)
      lambda_t_p = (
          6 * eta * np.pi**2 / omega ** (2 / 3) * 2 ** (2 * n_p - 2)
      )
  
      # lambda_u_1 and lambda_v_1 are taken from Eq. (124) of PRX Quantum 2, 040332 (2021)
      lambda_u_1 = lambda_u * lambda_nu_1 / lambda_nu
      lambda_v_1 = lambda_v * lambda_nu_1 / lambda_nu
  
      # taken from Eq. (63) of PRX Quantum 2, 040332 (2021)
      p_eq = (
          FirstQuantization.success_prob(3, 8)
          * FirstQuantization.success_prob(3 * eta + 2 * charge, br)
          * FirstQuantization.success_prob(eta, br) ** 2
      )
  
      # final lambda value is computed from Eq. (126) of PRX Quantum 2, 040332 (2021)
      lambda_a = lambda_t_p + lambda_u_1 + lambda_v_1
      lambda_b = (lambda_u_1 + lambda_v_1 / (1 - 1 / eta)) / p_nu_amp
  
      return np.maximum(lambda_a, lambda_b) / p_eq
  
file_path: pennylane/pennylane/resource/first_quantization.py
imports: import numpy
  from scipy import integrate
  from pennylane.operation import AnyWires, Operation
label_desc: Use image node_id 5 for calling the FirstQuantization obj's underlying member method code with example usage: obj.norm(n, eta, omega, error, br, charge, cubic, vectors) and returns: unknown, FirstQuantization