Closed damiansteiger closed 7 years ago
I would suggest the following name:
QubitOperator
for objects like 0.5 * X0Y1 + 0.6 * Z2Z4 + ...
= a sum of QubitTerm
objects
QubitTerm
for objects like 0.5 * X0Y1
= a tensor product of local_terms
QubitTerm 0.5 * X0Y1
has two attributes self.coefficient = 0.5
and self.local_terms = [(0, 'X'), (1,'Y')]
, hence (0,X)
(= X0) is what I call a local_term
as it acts locally on only one qubit.
And I would rename the base classes to BasicTerm
and BasicOperator
A similar naming scheme can be applied to Fermions:
FermionOperator
for objects like 0.5 * a_1^dagger a_2 + ...
= a sum of FermionTerm
objects
FermionTerm
for objects like 0.5 * a_1^dagger a_2
= a tensor product of local_terms
FermionTerm 0.5 * a_1^dagger a_2
has two attributes self.coefficient = 0.5
and self.local_terms = [(1, 1), (2, 0)]
, hence (1,1)
(= a_1^dagger) is what I call a local_term
as it acts locally on only one spin orbital
I actually think this is a really good suggestion. Go ahead with it.
We now changed to having one class only so naming is different.
Thomas and I are currently busy with starting to integrate
QubitTerm
andQubitOperator
into ProjectQ.There are two annoying names which we want to fix before that: 1) The base classes
LocalTerm
andLocalOperator
should have a different name as there is nothing "local" about a term acting on qubit 0 and qubit 87. We therefore propose to rename them toBasicTerm
orBaseTerm
(and similar for Operator) as these are anyway only base classes2) The attribute
self.operators
inQubitTerm
is counter intuitive as we have call aQubitOperator
a sum ofQubitTerm
. Any suggestions? If we don't use a base class for Qubit and Fermion stuff, the naming would be easy to something likeself.pauli_operator
or similar. But I am open to suggestions for a better name which would fit both Fermions and Qubits and therefore keep the base class