babbush / HistoricalFermiLib

This is repo where we developed FermiLib, which then became OpenFermion
Apache License 2.0
1 stars 0 forks source link

Naming #71

Closed damiansteiger closed 7 years ago

damiansteiger commented 7 years ago

Thomas and I are currently busy with starting to integrate QubitTerm and QubitOperator into ProjectQ.

There are two annoying names which we want to fix before that: 1) The base classes LocalTerm and LocalOperator 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 to BasicTerm or BaseTerm (and similar for Operator) as these are anyway only base classes

2) The attribute self.operators in QubitTerm is counter intuitive as we have call a QubitOperator a sum of QubitTerm. Any suggestions? If we don't use a base class for Qubit and Fermion stuff, the naming would be easy to something like self.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

damiansteiger commented 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

babbush commented 7 years ago

I actually think this is a really good suggestion. Go ahead with it.

damiansteiger commented 7 years ago

We now changed to having one class only so naming is different.