Classical Register Class

class c_register.ClassicalRegister(num_bits: int = 1)

Bases: object

A class representing a classical register for quantum computation.

change_number_of_bits(num_bits: int) None

Changes the number of bits in the classical register and resets its values to zero.

Parameters:

num_bits (int) – The new number of bits for the classical register.

get_bits_num() int

Returns number of classical bit in the classical register.

Returns:

The number of bits in the classical register

Return type:

int

print_c_reg() None

Prints the current state of the classical register.

This method displays the register’s array of bits to the console.