rydiqule.sensor_utils.convert_dm_to_complex¶
- rydiqule.sensor_utils.convert_dm_to_complex(dm: ndarray) ndarray [source]¶
Converts density matrices from rydiqule’s computational basis (real, with state 0 removed) to a standard complex basis with all states present.
Solutions computed using one of rydiqule’s built in solvers will always output solutions in the real, 1-dimensional computational basis which is intended as the input for this function. Note that while a full complex density matrix can be useful to view solutions, performing calculations with the full complex density matrix can often add considerable unwanted rounding errors.
- Parameters:
dm (numpy.ndarray) – Density matrices in rydiqule’s computational basis (real, with state 0 removed). Has shape
(..., b**2-1)
whereb
is the number of states in the basis.- Returns:
Density matrices in the complex basis with state 0 present. Will have shape
(..., b, b)
.- Return type:
- Raises:
RydiquleError – If final dimension is of invalid size (i.e. does not correspond to b**2-1, where b is an integer)
Examples
>>> [g, e] = rq.D2_states('Rb85') >>> c = rq.Cell('Rb85', [g, e], cell_length = 0.00001) >>> c.add_coupling(states=(g, e), rabi_frequency=1, detuning=1) >>> sols = rq.solve_steady_state(c) >>> print(sols.rho) [0.001371 0.02613 0.000686] >>> print(rq.sensor_utils.convert_dm_to_complex(sols.rho)) [[9.993144e-01+0.j 1.371166e-03+0.02613j] [1.371166e-03-0.02613j 6.855828e-04+0.j ]]