def METHOD_NAME(backend):
    nqubits = 2
    initial_rho = random_density_matrix(2**nqubits, backend=backend)
    gate = gates.H(1)
    final_rho = apply_gates(backend, [gate], 2, initial_rho)
    matrix = np.array([[1, 1], [1, -1]]) / np.sqrt(2)
    matrix = np.kron(np.eye(2), matrix)
    matrix = backend.cast(matrix, dtype=matrix.dtype)
    target_rho = np.dot(np.dot(matrix, initial_rho), matrix)
    backend.assert_allclose(final_rho, target_rho)