rydiqule.sensor_utils.convert_to_full_dm¶
- rydiqule.sensor_utils.convert_to_full_dm(dm: ndarray) ndarray[source]¶
Converts density matrices from rydiqule’s computational basis (real, with state 0 removed) to the full, real basis (ie with state 0 population inserted).
Solutions computed using one of rydiqule’s built in solvers will always output solutions in the real computational basis which is intended as the input for this function.
- 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 real basis with state 0 present. Will have shape
(..., b**2).- 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_to_full_dm(sols.rho)) [9.993359e-01 1.31399e-03 2.55811e-02 6.64016e-04]