cirq.linalg.transformations.factor_density_matrix

Factors a density matrix into two independent density matrices.

This function should only be called on density matrices that are known to be separable, such as immediately after a measurement or reset operation. It does not verify that the provided density matrix is indeed separable, and will return nonsense results for matrices representing entangled states.

t The density matrix to factor.
axes The axes to factor out. Only the left axes should be provided. For example, to extract [C,A] from density matrix of shape [A,B,C,D,A,B,C,D], axes should be [2,0], and the return value will be two density matrices ([C,A,C,A], [B,D,B,D]).
validate Perform a validation that the density matrix factors cleanly.
atol The absolute tolerance for the validation.

A tuple with the (extracted, remainder) density matrices, where extracted means the sub-matrix which corresponds to the axes requested, and with the axes in the requested order, and where remainder means the sub-matrix on the remaining axes, in the same order as the original density matrix.