qubiter.HadamardTransform module

class qubiter.HadamardTransform.HadamardTransform[source]

Bases: object

This class contains only static methods and no constructor. Its functions are related to the Hadamard Transform.

static hadamard_mat(num_bits, is_quantum=True)[source]

This function return a numpy array with the num_bits-fold tensor product of the 2 dim Hadamard matrix H. If is_quantum=True (False, resp.), it returns a complex (real, resp.) array.

Parameters:
  • num_bits (int) –
  • is_quantum (bool) –
static ht(num_bits, in_arr)[source]

This function calculates the Hadamard transform of in_arr. Let H be the 2 dimensional Hadamard matrix and let ht be the num_bit-fold tensor product of H. Then this function returns the matrix product ht*in_arr = out_arr. in_arr and out_arr both have the same shape ( 2^num_bits,).

Parameters:
  • num_bits (int) – The number of bits. The dimension of the Hadamard tranform is 2^num_bits
  • in_arr (np.ndarray) – Input array.
Returns:

Return type:

np.ndarray