def join_densities(*densities: Density) -> Density:
    """Join two mixed states into a larger qubit state"""
    vectors = [rho.vec for rho in densities]
    vec = reduce(outer_product, vectors)

    memory = dict(ChainMap(*[rho.memory for rho in densities]))  # TESTME
    return Density(vec.tensor, vec.qubits, memory)
def join_densities ( * densities : Density ) -> Density : vectors = [ rho . vec for rho in densities ] vec = reduce ( outer_product , vectors ) memory = dict ( ChainMap ( * [ rho . memory for rho in densities ] ) ) return Density ( vec . tensor , vec . qubits , memory )
Join two mixed states into a larger qubit state