[X] Search the issue tracker to check if your feature has already been mentioned or rejected in other issues.
Describe the feature
Currently, a spin_op is initialized as an identity so that when you use an increment operator to add more terms, it adds identity by default (see snippet below). This makes it a little inconvenient to use when building a Hamiltonian with large number of terms because we need to initialize correctly before using the increment operator.
While the current version is useful, it might be better to initialize it as null by default or at least have the option to initialize it as null.
from cudaq import spin
hamiltonian = cudaq.SpinOperator()
hamiltonian += spin.z(0)
print(hamiltonian) # This is I + Z currently
Required prerequisites
Describe the feature
Currently, a spin_op is initialized as an identity so that when you use an increment operator to add more terms, it adds identity by default (see snippet below). This makes it a little inconvenient to use when building a Hamiltonian with large number of terms because we need to initialize correctly before using the increment operator.
While the current version is useful, it might be better to initialize it as null by default or at least have the option to initialize it as null.