Util

squidasm.util.util.create_complete_graph_network(node_names, link_typ, link_cfg, clink_typ='instant', clink_cfg=None, qdevice_typ='generic', qdevice_cfg=None)

Create a complete graph network configuration. The network generated will connect each node to each other node directly using the link and clink models provided.

Parameters:
  • node_names (List[str]) – List of str with the names of the nodes. The amount of names will determine the amount of nodes.

  • link_typ (str) – str specification of the link model to use for quantum links.

  • link_cfg (IQLinkConfig) – Configuration of the link model.

  • clink_typ (str) – str specification of the clink model to use for classical communication.

  • clink_cfg (Optional[ICLinkConfig]) – Configuration of the clink model.

  • qdevice_typ (str) – str specification of the qdevice model to use for quantum devices.

  • qdevice_cfg (Optional[IQDeviceConfig]) – Configuration of qdevice.

Return type:

StackNetworkConfig

Returns:

StackNetworkConfig object with a network.

squidasm.util.util.create_two_node_network(node_names=None, link_noise=0, qdevice_noise=0, clink_delay=0.0, link_delay=0.0)

Create a network configuration with two nodes, with simple noise models.

Parameters:
  • node_names (Optional[List[str]]) – List of str with the names of the two nodes

  • link_noise (float) – A number between 0 and 1 that indicates how noisy the generated EPR pairs are.

  • qdevice_noise (float) – A number between 0 and 1 that indicates how noisy the qubit operations on the nodes are.

  • clink_delay (float) – The time, in nanoseconds, it takes for the classical message to arrive.

  • link_delay (float) – The time, in nanoseconds, it takes for an EPR pair to be generated.

Return type:

StackNetworkConfig

Returns:

StackNetworkConfig object with a two node network

squidasm.util.util.get_qubit_state(q, node_name, full_state=False)

Retrieves the underlying quantum state from a qubit in density matrix formalism. This is only possible in simulation.

Note

The function gets the current qubit. So make sure the subroutine is flushed before calling the method.

Parameters:
  • q (Qubit) – The qubit to get the state of or list of qubits.

  • node_name – Node name of current node. Requirement for this parameter is due to software limitation, can be made unnecessary in future version of SquidASM.

  • full_state – Flag to retrieve the full underlying entangled state and not only this qubit subspace.

Return type:

ndarray

Returns:

An array that is the density matrix description of the quantum state

squidasm.util.util.get_reference_state(phi, theta)

Gives the reference quantum state for a qubit in density matrix formalism, that is in a pure state matching a state on the Bloch sphere described by the angles phi and theta.

Parameters:
  • phi (float) – Angle on Bloch sphere between state and x-axis

  • theta (float) – Angle on Bloch sphere between state and z-axis

Return type:

ndarray

Returns:

An array that is the density matrix description of the quantum state