def measure_partial(qubit, bits, format='sympy', normalize=True):
 m = qubit_to_matrix(qubit, format)
 if isinstance(bits, (int, Integer)):
  bits = (int(bits),)
 if (format == 'sympy'):
  if normalize:
   m = m.normalized()
  possible_outcomes = _get_possible_outcomes(m, bits)
  output = []
  for outcome in possible_outcomes:
   prob_of_outcome = 0
   prob_of_outcome += (outcome.H * outcome)[0]
   if (prob_of_outcome != 0):
    if normalize:
     next_matrix = matrix_to_qubit(outcome.normalized())
    else:
     next_matrix = matrix_to_qubit(outcome)
    output.append((next_matrix, prob_of_outcome))
  return output
 else:
  raise NotImplementedError("This function can't handle non-sympy matrix formats yet")

def measure_partial ( qubit , bits , format = 'sympy' , normalize = True ) : m = qubit_to_matrix ( qubit , format ) if isinstance ( bits , ( int , Integer ) ) : bits = ( int ( bits ) , ) if ( format == 'sympy' ) : if normalize : m = m . normalized ( ) possible_outcomes = _get_possible_outcomes ( m , bits ) output = [ ] for outcome in possible_outcomes : prob_of_outcome = 0 prob_of_outcome += ( outcome . H * outcome ) [ 0 ] if ( prob_of_outcome != 0 ) : if normalize : next_matrix = matrix_to_qubit ( outcome . normalized ( ) ) else : next_matrix = matrix_to_qubit ( outcome ) output . append ( ( next_matrix , prob_of_outcome ) ) return output else : raise NotImplementedError ( "This function can't handle non-sympy matrix formats yet" )
perform a partial ensemble measure on the specifed qubits .