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)wherebis 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.001313 0.02558 0.000664] >>> print(rq.sensor_utils.convert_dm_to_complex(sols.rho)) [[9.993359e-01+0.j 1.31399e-03+0.025581j] [1.313990e-03-0.025581j 6.64016e-04+0.j ]]