mindquantum.dtype

mindquantum.dtype#

Data type module for MindQuantum.

Supported data type#

The data type below is supported by MindQuantum when doing simulation.

mindquantum.float32

single precision real number type

mindquantum.float64

double precision real number type

mindquantum.complex64

single precision complex number type

mindquantum.complex128

double precision complex number type

Memory consuming#

The memory usage for full state vector increased with qubit number is shown as below:

qubit number

complex128

complex64

6

1kB

0.5kB

16

1MB

0.5MB

26

1GB

0.5GB

30

16GB

8GB

36

1TB

0.5TB

40

16TB

8TB

46

1PB

0.5PB

Function#

API Name

Description

is_double_precision(dtype)

Check whether a type is double precision or not.

is_single_precision(dtype)

Check whether a type is single precision or not.

is_same_precision(dtype1, ...)

Check whether two type is same precision or not.

precision_str(dtype)

Get precision string.

to_real_type(dtype)

Convert type to real type while keeping precision.

to_complex_type(dtype)

Convert type to complex type while keeping precision.

to_single_precision(dtype)

Convert type to single precision.

to_double_precision(dtype)

Convert type to double precision.

to_precision_like(...)

Convert dtype_src to same precision as dtype_des.

to_mq_type(dtype)

Convert type to mindquantum type.

to_np_type(dtype)

Convert type to numpy data type.