quairkit.core.base

The basic function of the QuAIRKit.

class quairkit.core.base.Backend(value)

Backend classifier in the QuAIRKit.

quairkit.core.base.set_device(device)

Set the 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_backend(backend)

Set the backend implementation of QuAIRKit.

Parameters:
backend : str | Backend

The name of the backend.

quairkit.core.base.get_backend()

Get the current backend of QuAIRKit.

Returns:

The name of currently used backend.

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

class quairkit.core.base.Operator(backend=None, dtype=None)

The basic class to implement the operation in QuAIRKit.

Parameters:
backend : Backend | None

The backend implementation of the operator. Defaults to None, which means to use the default backend implementation.

dtype : str | None

The data type of the operator. Defaults to None, which means to use the default data type.