isqham package

Subpackages

Submodules

isqham.deployHamiltonian module

class Deployer(circuit)

Bases: object

expHt(h, t, N)
Parameters:

N (int)

expHtau(h, tau)
expPPP(P, r)
expZZZ(Zindex, r)
class TmpCircuit(fwcircuit)

Bases: object

CX(i, j)
RZ(i, theta)
X2M(i)
X2P(i)
Y2M(i)
Y2P(i)

isqham.diag module

class PauliHamiltonianSolver

Bases: object

classmethod getEigen(h)

return E[*],V[,] The i-th eigenvalue is E[i] with V[:,i]

Parameters:

h (_type_) – _description_

classmethod get_HInFullSpace(h)

isqham.paili_measure module

class PauliMeasure(hamiltonian, qc)

Bases: object

eigh()
get_expectation_eigh()
get_measure_result(array=False, **kw)
Parameters:

array (bool)

isqham.pauliHamiltonian module

class PauliHamiltonian(nq)

Bases: object

add_dH(dH)
copy()
static from_dict(pauli_ditc, nq=None, dH=None)
Parameters:
  • pauli_ditc (dict[str, float])

  • nq (int | None)

  • dH (float | None)

getNq()
get_factor()
get_pauliOperators()
getdH()
setOneTerm(xi, p)
setOneTerm_byXYZ(xi, I=None, X=None, Y=None, Z=None)
simplify()

isqham.pauliOperator module

class PauliGroupElement1(Type)

Bases: object

element in G1 support multiplexing with +1,-1,+1j,-1j and other G1

Parameters:

Type (int) – 0,1,2,3 for I,X,Y,Z respectivily

copy()
getTN()
getType()
getmatrix()
class PauliGroupElementn(elements)

Bases: object

PauliGroun for n qubits, G(n)

Parameters:
  • elements (tuple) – (k,i), where

  • qubit (i represents index of)

:param : :param k can be int in [0: :type k can be int in [0: 1 :param 1: :type 1: 1 :param 2: :type 2: 1 :param 3] to represent [I: :type 3] to represent [I: 1 :param X: :type X: 1 :param Y: :type Y: 1 :param Z] or G: :type Z] or G: 1

copy()
getTN()
getmatrix(nq=None)
Parameters:

nq (int | None)

classmethod intbyCoreValue(Type, n1j)
class pauliOperator(elements)

Bases: object

_summary_

Parameters:

elements (tuple) – (P,f) where P is Gn and f is a number

addConstant(val)
copy()
dagger()
exportPauliHamiltonian()
classmethod get0()

return a empty container

classmethod get1()
getmatrix(nq=None)
Parameters:

nq (int | None)

classmethod intbyCoreValue(data)
simplify()

One can call it when needed. Scan internal data to check if it can be simplified

Return type:

self

isqham.qubitEncoding module

class BravyiKitaev

Bases: FermionEncoding

classmethod c(i, nqMax=10)
classmethod cd(i, nqMax=10)
exception EncodingError

Bases: Exception

class FermionEncoding

Bases: ABC

费米算符编码的基类

abstractmethod c()
abstractmethod cd()
classmethod chainZ(i, j)

Z_{i} Z_{i+1} … Z_{j-1}

Parameters:
  • i (int) – site index

  • j (int) – site index

Returns:

_description_

Return type:

pauliOperator

classmethod get0()
classmethod get1()
classmethod sigma_pm(i, pm)

1/2 * (X +- i * Y)

Parameters:
  • i (int) – site index

  • pm (str) – ‘+’ or ‘-’

Returns:

_description_

Return type:

_type_

class JordanWignerEncoding

Bases: FermionEncoding

classmethod c(i)
classmethod cd(i)
class Parity

Bases: FermionEncoding

classmethod c(i, nqMax=10)
classmethod cd(i, nqMax=10)

Module contents