Open ghost opened 1 year ago
We could, but I don't really see a use for it. If you just want to dispatch on this in a script, you can also do something like
const ParticleBasis = Union{<:MomentumBasis,<:PositionBasis}
function f(b::ParticleBasis)
# do stuff
end
What do you want to achieve here?
I want to define many functions that work the same for both momentum and position basis. Stuff like
create(b::ParticuleBasis) = (position(b) + im * momentum(b)) / sqrt(2)
destroy(...) = ...
displace(...) = ...
squeeze(...) = ...
...
I also want to define some operators on a composite particule and spin basis.
I know the difference in runtime between the union and abstract type version is marginal, but I find the abstract type version cleaner.
Hello, I was wondering if you could add a
ParticuleBasis
abstract type such that