def state_to_operators(state, **options):
 if (not (isinstance(state, StateBase) or issubclass(state, StateBase))):
  raise NotImplementedError('Argument is not a state!')
 if (state in state_mapping):
  state_inst = _make_default(state)
  try:
   ret = _get_ops(state_inst, _make_set(state_mapping[state]), **options)
  except (NotImplementedError, TypeError):
   ret = state_mapping[state]
 elif (type(state) in state_mapping):
  ret = _get_ops(state, _make_set(state_mapping[type(state)]), **options)
 elif (isinstance(state, BraBase) and (state.dual_class() in state_mapping)):
  ret = _get_ops(state, _make_set(state_mapping[state.dual_class()]))
 elif (issubclass(state, BraBase) and (state.dual_class() in state_mapping)):
  state_inst = _make_default(state)
  try:
   ret = _get_ops(state_inst, _make_set(state_mapping[state.dual_class()]))
  except (NotImplementedError, TypeError):
   ret = state_mapping[state.dual_class()]
 else:
  ret = None
 return _make_set(ret)

def state_to_operators ( state , ** options ) : if ( not ( isinstance ( state , StateBase ) or issubclass ( state , StateBase ) ) ) : raise NotImplementedError ( 'Argument is not a state!' ) if ( state in state_mapping ) : state_inst = _make_default ( state ) try : ret = _get_ops ( state_inst , _make_set ( state_mapping [ state ] ) , ** options ) except ( NotImplementedError , TypeError ) : ret = state_mapping [ state ] elif ( type ( state ) in state_mapping ) : ret = _get_ops ( state , _make_set ( state_mapping [ type ( state ) ] ) , ** options ) elif ( isinstance ( state , BraBase ) and ( state . dual_class ( ) in state_mapping ) ) : ret = _get_ops ( state , _make_set ( state_mapping [ state . dual_class ( ) ] ) ) elif ( issubclass ( state , BraBase ) and ( state . dual_class ( ) in state_mapping ) ) : state_inst = _make_default ( state ) try : ret = _get_ops ( state_inst , _make_set ( state_mapping [ state . dual_class ( ) ] ) ) except ( NotImplementedError , TypeError ) : ret = state_mapping [ state . dual_class ( ) ] else : ret = None return _make_set ( ret )
returns the operator or set of operators corresponding to the given eigenstate a global function for mapping state classes to their associated operators or sets of operators .