# Cirq - Measure Density Matrix Function Getting First Element

Hello I am using measure density matrix function like that:

for i in range (10):
measurement_result = cirq.measure_density_matrix(state,indices=[0, 1, 2])
print("measurement",measurement_result)


And my results are like that:

As you can see, I have ([0, 0, 0], array([[0.36107099-0.36107099j, 0. +0.j , and I want to extract first part [0, 0, 0] (the qubit part) and then I will count how many [0, 0, 0] , [0, 0, 1] [0, 1, 0] … But I could not extract the first part of array. How can I get the first part [0, 0, 0] ? Thanks ...

This is more of a basic python usage question. You want

first_part = measurement_result[0] or first_part, second_part = measurement_result.

• Can I ask one more question to you regarding the mostly python part? cirq.kron(cirq.unitary(cirq.rz(a)),cirq.unitary(cirq.rz(b)),cirq.unitary(cirq.rz(a)))I have this line and I also write this line for all possible combination of a and b. I mean I have to write also cirq.kron(cirq.unitary(cirq.rz(a)),cirq.unitary(cirq.rz(a)),cirq.unitary(cirq.rz(a))) and also cirq.kron(cirq.unitary(cirq.rz(b)),cirq.unitary(cirq.rz(b)),cirq.unitary(cirq.rz(b))) and also cirq.kron(cirq.unitary(cirq.rz(a)),cirq.unitary(cirq.rz(b)),cirq.unitary(cirq.rz(b))) … all possible combination for a b. @Craig Gidney Nov 2 '20 at 18:46
• Do you have an idea for that @craig-gidney Nov 4 '20 at 22:30