5.23.8. utils.handle_spin¶
- eminus.utils.handle_spin(func)[source]¶
Handle spin calculating the function for each channel separately.
This can only be applied if the only spin-dependent indexing is the wave function W.
Implementing the explicit handling of spin adds an extra layer of complexity where one has to loop over the spin states in many places. We can hide this complexity using this decorator while still supporting many use cases, e.g., the operators previously act on arrays containing wave functions of all states and of one state only. This decorator maintains this functionality and adds the option to act on arrays containing wave functions of all spins and all states as well.
- Parameters:
func – Function that acts on spin-states.
- Returns:
Decorator.