Gate class and its methods:

class tqix.pis.gates.Gates

Class contains gate operations of tqix.pis

When adding noise to state after applying a gate operation, an additional argument need to be added when calling gate methods:

noise (float): noise ratio.

The gate methods can have the additional argument include: RX, RY, RZ, OAT, TAT, TNT, RX2, RY2, RZ2, R_plus, R_minus, GMS, RN

tqix.pis.gates.Gates.RX(self, theta=None, *args, **kwargs)

\(R_x(\theta) = e^{-i\theta J_x}\)

Parameters:

theta (float, optional) – angle, defaults to None

Returns:

new state after being acted upon by RX

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.RY(self, theta=None, *args, **kwargs)

\(R_y(\theta) = e^{-i\theta J_y}\)

Parameters:

theta (float, optional) – angle, defaults to None

Returns:

new state after being acted upon by RY

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.RZ(self, theta=None, *args, **kwargs)

\(R_z(\theta) = e^{-i\theta J_z}\)

Parameters:

theta (float, optional) – angle, defaults to None

Returns:

new state after being acted upon by RZ

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.OAT(self, theta, gate_type, *args, **kwargs)

\(U_{OAT} = e^{-it\chi J_\alpha^2}\)

Parameters:
  • theta (float) – angle

  • gate_type (str) – type of gate

Returns:

new state after being acted upon by OAT

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.TAT(self, theta, gate_type, *args, **kwargs)

\(U_{TAT} = e^{-it\chi (J_\alpha^2 - J_\beta^2)}\)

Parameters:
  • theta (float) – angle

  • gate_type (str) – type of gate

Returns:

new state after being acted upon by TAT

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.TNT(self, theta, gate_type, omega, *args, **kwargs)

\(U_{TNT} = e^{-it(\chi J_\alpha^2-\Omega J_\beta)}\)

Parameters:
  • theta (float) – angle

  • gate_type (str) – type of gate

Returns:

new state after being acted upon by TNT

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.RX2(self, theta=None, *args, **kwargs)

\(R_{x^2}(\theta) = e^{-i\theta J_x^2}\)

Parameters:

theta (float, optional) – angle, defaults to None

Returns:

new state after being acted upon by RX2

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.RY2(self, theta=None, *args, **kwargs)

\(R_{y^2}(\theta) = e^{-i\theta J_y^2}\)

Parameters:

theta (float, optional) – angle, defaults to None

Returns:

new state after being acted upon by RY2

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.RZ2(self, theta=None, *args, **kwargs)

\(R_{z^2}(\theta) = e^{-i\theta J_z^2}\)

Parameters:

theta (float, optional) – angle, defaults to None

Returns:

new state after being acted upon by RZ2

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.R_plus(self, theta=None, *args, **kwargs)

\(R_+(\theta) = e^{-i\theta J_+}\)

Parameters:

theta (float, optional) – angle, defaults to None

Returns:

new state after being acted upon by R_plus

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.R_minus(self, theta=None, *args, **kwargs)

\(R_-(\theta) = e^{-i\theta J_-}\)

Parameters:

theta (float, optional) – angle, defaults to None

Returns:

new state after being acted upon by R_minus

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.GMS(self, theta, phi, *args, **kwargs)

\(U_{GMS} = e^{-i\theta (J_x\cos\phi + J_y\sin\phi)^2}\)

Parameters:
  • theta (float) – theta angle

  • phi (float) – phi angle

Returns:

new state after being acted upon by GMS

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.RN(self, theta, phi, *args, **kwargs)

\(R_{n}(\theta,\phi)= e^{-i\theta J_{n}}={exp}[i\theta (J_x\sin\phi - J_y\cos\phi)]\)

Parameters:
  • theta (float) – theta angle

  • phi (float) – phi angle

Returns:

new state after being acted upon by RN

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.check_input_param(self, params)
Parameters:

params (dict) – parameters to check

Raises:

ValueError – the parameter is None

tqix.pis.gates.Gates.get_N_d_d_dicked(self, state)
Parameters:

state (ndarray, tensor, sparse) – state of qubits

Returns:

d_in

Return type:

int

Returns:

N_in

Return type:

int

Returns:

d_dicke

Return type:

int

tqix.pis.gates.Gates.get_N_d_d_dicked(self, state)
Parameters:

state (ndarray, tensor, sparse) – state of qubits

Returns:

d_in

Return type:

int

Returns:

N_in

Return type:

int

Returns:

d_dicke

Return type:

int

tqix.pis.gates.Gates.get_J(self, N_in, d_in, d_dicke, type)
Parameters:
  • N_in (int) – number of qubits

  • d_in (int) – dimension of state

  • d_dicke (int) – dimension of dicke basis

  • type (str) – type of J operator

Returns:

operator matrix representation

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.Jx(self)
Returns:

Jx

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.Jy(self)
Returns:

Jy

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.Jz(self)
Returns:

Jz

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.J_plus(self)
Returns:

J_plus

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.var(self, type='', *args, **kwargs)
Parameters:

type (str, optional) – type of variance, defaults to “”

Returns:

variance of state

Return type:

complex

tqix.pis.gates.Gates.expval(self, type='', *args, **kwargs)
Parameters:

type (str, optional) – type of expectation, defaults to “”

Returns:

expected value of state

Return type:

complex

tqix.pis.gates.Gates.gates(self, type='', *args, **kwargs)
Parameters:

type (str, optional) – type of gate, defaults to “”

Returns:

new state after being acted upon by gate operation

Return type:

ndarray, tensor, sparse

tqix.pis.gates.Gates.measure(self, num_shots=None)
Parameters:

num_shots (int, optional) – number of shots for measurement, defaults to None

Returns:

resulted measurement

Return type:

ndarray, tensor, sparse