Skip to content

Bug: State.add_state incompatible when State contains multiple modes #18

@olgasolodovnikova

Description

@olgasolodovnikova

ValueError Traceback (most recent call last)
Cell In[102], line 1
----> 1 state = multi_breed_state(state_cat, 3, out =True)
2 state.post_select_homodyne(0, np.pi[/2]
3 fig, axes = plt.subplots(2,2, figsize = (6,6))

in multi_breed_state(input_state, num, out, MP, bs_thetas, rot)
71 print('Input data shape', multistate.means.shape, multistate.covs.shape, multistate.weights.shape)
73 for i in range(1,num):
---> 74 multistate.add_state(input_state, MP=MP)
75 if rot == True:
76 R = xxpp_to_xpxp(expand(rotation(np.pi),1,2)) #Rotate the 2nd mode by 180 degrees

in State.add_state(self, state, MP)
406 new_weights = np.prod(np.array(list(it.product(weights1, weights2))),axis=1)
408 K = len(new_weights)
--> 409 new_means = np.array(list(it.product(means1,means2))).reshape((K,2*(N+M)))
411 data_new = new_means, new_cov, new_weights
413 self.update_data(data_new)

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (64, 2) + inhomogeneous part.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions