def __init__(self, state): self.__id = State.__ID State.__ID += 1 print('id:', self.__id) self.state = state self.__byte_array = flat_list(self.state) # self.__string = ''.join(map(str, self.__byte_array)) self.__string = State.string_notation(self.state) self.__braket = State.flat_list2(self.state) self.connections = []
def __init__(self, cavity_chain): self.set_id() self.__cavity_chain = copy.deepcopy(cavity_chain) self.__capacity = self.__cavity_chain.capacity() self.__cavities = self.__cavity_chain.cavities() self.__n_cavities = len(self.__cavities) self.__state = cavity_chain.get_state() self.__array = flat_list(self.__state) # self.__string = ''.join(map(str, self.__array)) self.__string = State.string_notation(self.__state) self.__braket = State.flat_list2(self.__state) self.__jumps = [] self.__amplitudes = {}
def update_notation(self): self.__state = self.__cavity_chain.get_state() self.__array = flat_list(self.__state) self.__string = State.string_notation(self.__state) self.__braket = State.flat_list2(self.__state)
def array_notation(raw_notation): return flat_list(raw_notation)
from utils.flat_list import flat_list s = [{'0<->1': 0}, [0], ['+', '0']] print(flat_list(s))