QuantumChar#

class QuantumChar(qs=None, name=None, nisq_char=True)[source]#

A QuantumVariable which represents characters. By default, the QuantumChar is initialized in NISQ mode, meaning that instead of 256 characters it can only hold 32, saving almost 40% in qubit cost.

>>> from qrisp import QuantumChar
>>> q_ch = QuantumChar(nisq_char = True)

The chars which can be represented in nisq mode are

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

q

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

r

s

t

u

v

w

x

y

z

.

!

?

:

,

If nisq_mode is set to False, the encoder uses the Python-inbuild chr function.