quairkit.core.base

The basic function of the QuAIRKit.

quairkit.core.base.set_device(device)

Set the classical device to save the tensor.

Parameters:
device : str

The name of the device.

quairkit.core.base.get_device()

Get the current device to save the tensor.

Returns:

The name of the current device.

Return type:

str

quairkit.core.base.set_seed(seed)

Set the global seed of QuAIRKit.

Parameters:
seed : int

the random seed used in QuAIRKit.

Note

The seed is set for the following modules: torch, torch.cuda, numpy, random

quairkit.core.base.get_seed()

Get the currently used seed of QuAIRKit.

Returns:

The Currently used seed.

Return type:

None

quairkit.core.base.set_dtype(dtype)

Set the data type .

Parameters:
dtype : str

The dtype can be complex64 and complex128.

Raises:

ValueError – The dtype should be complex64 or complex128.

quairkit.core.base.get_dtype()

Return currently used data type.

Returns:

Currently used data type.

Return type:

dtype

quairkit.core.base.get_float_dtype()

Return currently used float data type.

Returns:

Currently used data type.

Return type:

dtype