def measure_all(qubit, format='sympy', normalize=True):
 m = qubit_to_matrix(qubit, format)
 if (format == 'sympy'):
  results = []
  if normalize:
   m = m.normalized()
  size = max(m.shape)
  nqubits = int((math.log(size) / math.log(2)))
  for i in range(size):
   if (m[i] != 0.0):
    results.append((Qubit(IntQubit(i, nqubits)), (m[i] * conjugate(m[i]))))
  return results
 else:
  raise NotImplementedError("This function can't handle non-sympy matrix formats yet")

def measure_all ( qubit , format = 'sympy' , normalize = True ) : m = qubit_to_matrix ( qubit , format ) if ( format == 'sympy' ) : results = [ ] if normalize : m = m . normalized ( ) size = max ( m . shape ) nqubits = int ( ( math . log ( size ) / math . log ( 2 ) ) ) for i in range ( size ) : if ( m [ i ] != 0.0 ) : results . append ( ( Qubit ( IntQubit ( i , nqubits ) ) , ( m [ i ] * conjugate ( m [ i ] ) ) ) ) return results else : raise NotImplementedError ( "This function can't handle non-sympy matrix formats yet" )
perform an ensemble measurement of all qubits .