Skip to main content

Qbit

Overloads

NameDescription
Qbit(integer num_sites) -> QbitConstructs a qubit product state of size num_sites with every qubit set to 00.
Qbit(const string bitstring) -> QbitConstructs a qubit product state from a string of consecutive characters "00" and "11".
Qbit(integer num_sites, complex coefficient) -> QbitConstructs a qubit product state of the specified size with every qubit set to 00 with a specified complex multiplicative coefficient.
Qbit(integer num_sites, bool coefficient) -> QbitConstructs a qubit product state of the specified size with every qubit set to 00 with a specified bool (converted to complex) multiplicative coefficient.
Qbit(const string bitstring, real coefficient) -> QbitConstructs a qubit product state from a string of "00" and "11" with a specified real (converted to complex) multiplicative coefficient.
Qbit(const string bitstring, bool coefficient) -> QbitConstructs a qubit product state from a string of "00" and "11" with a specified bool (converted to complex) multiplicative coefficient.
Qbit(const string bitstring, complex coefficient) -> QbitConstructs a qubit product state from a string of "00" and "11" with a specified complex multiplicative coefficient.
Qbit(integer num_sites, real coefficient) -> QbitConstructs a qubit product state of the specified size with every qubit set to 00 with a specified real (converted to complex) multiplicative coefficient.
Qbit(const string bitstring, integer coefficient) -> QbitConstructs a qubit product state from a string of "00" and "11" with a specified integer (converted to complex) multiplicative coefficient.
Qbit(integer num_sites, integer coefficient) -> QbitConstructs a qubit product state of the specified size with every qubit set to 00 with a specified integer (converted to complex) multiplicative coefficient.

Qbit(integer num_sites) -> Qbit

Constructs a qubit product state of size num_sites with every qubit set to 00.

Parameters

  • num_sites: The number of qubits in the product state in a one to one correspondence with the sites.

Example

Qbit(4) // Returns (1 + 0i)|0000>

Qbit(const string bitstring) -> Qbit

Constructs a qubit product state from a string of consecutive characters "00" and "11".

Parameters

  • bitstring: A string representing the states of the qubits in the product state.

Example

Qbit("00110") // Returns (1 + 0i)|00110>

Qbit(integer num_sites, complex coefficient) -> Qbit

Constructs a qubit product state of the specified size with every qubit set to 00 with a specified complex multiplicative coefficient.

Parameters

  • num_sites: The number of qubits in the product state in a one to one correspondence with the sites.
  • coefficient: The coefficient that multiplies the qubit product state.

Example

Qbit(4, 2.0 + 5.0i) // Returns (2 + 5i)|0000>

Qbit(integer num_sites, bool coefficient) -> Qbit

Constructs a qubit product state of the specified size with every qubit set to 00 with a specified bool (converted to complex) multiplicative coefficient.

Parameters

  • num_sites: The number of qubits in the product state in a one to one correspondence with the sites.
  • coefficient: The coefficient that multiplies the qubit product state.

Example

Qbit(4, true) // Returns (1 + 0i)|0000>

Qbit(const string bitstring, real coefficient) -> Qbit

Constructs a qubit product state from a string of "00" and "11" with a specified real (converted to complex) multiplicative coefficient.

Parameters

  • bitstring: A string representing the states of the qubits in the product state.
  • coefficient: The coefficient that multiplies the qubit product state.

Example

Qbit("00110", 2.0) // Returns (2 + 0i)|00110>

Qbit(const string bitstring, bool coefficient) -> Qbit

Constructs a qubit product state from a string of "00" and "11" with a specified bool (converted to complex) multiplicative coefficient.

Parameters

  • bitstring: A string representing the states of the qubits in the product state.
  • coefficient: The coefficient that multiplies the qubit product state.

Example

Qbit("00110", true) // Returns (1 + 0i)|00110>

Qbit(const string bitstring, complex coefficient) -> Qbit

Constructs a qubit product state from a string of "00" and "11" with a specified complex multiplicative coefficient.

Parameters

  • bitstring: A string representing the states of the qubits in the product state.
  • coefficient: The coefficient that multiplies the qubit product state.

Example

Qbit("00110", 2.0 + 5.0i) // Returns (2 + 5i)|00110>

Qbit(integer num_sites, real coefficient) -> Qbit

Constructs a qubit product state of the specified size with every qubit set to 00 with a specified real (converted to complex) multiplicative coefficient.

Parameters

  • num_sites: The number of qubits in the product state in a one to one correspondence with the sites.
  • coefficient: The coefficient that multiplies the qubit product state.

Example

Qbit(4, 2.0) // Returns (2 + 0i)|0000>

Qbit(const string bitstring, integer coefficient) -> Qbit

Constructs a qubit product state from a string of "00" and "11" with a specified integer (converted to complex) multiplicative coefficient.

Parameters

  • bitstring: A string representing the states of the qubits in the product state.
  • coefficient: The coefficient that multiplies the qubit product state.

Example

Qbit("00110", 3) // Returns (3 + 0i)|00110>

Qbit(integer num_sites, integer coefficient) -> Qbit

Constructs a qubit product state of the specified size with every qubit set to 00 with a specified integer (converted to complex) multiplicative coefficient.

Parameters

  • num_sites: The number of qubits in the product state in a one to one correspondence with the sites.
  • coefficient: The coefficient that multiplies the qubit product state.

Example

Qbit(4, 3) // Returns (3 + 0i)|0000>