scaluq

Subpackages

Classes

ClassicalRegister

Classical register.

ClassicalRegisterBatched

Batched classical register.

GateType

Enum of Gate Type.

ParamGateType

Enum of ParamGate Type.

Functions

initialize()

Initialize the Kokkos execution environment.

finalize()

Terminate the Kokkos execution environment. Release the resources.

is_initialized()

Return true if initialize() is already called.

is_finalized()

Return true if finalize() is already called.

synchronize()

Synchronize the device if the execution space is not host.

get_default_execution_space()

Get the default execution space.

precision_available(arg, /)

Return the precision is supported.

Package Contents

scaluq.initialize()

Initialize the Kokkos execution environment.

Notes

This is automatically called when the program starts. You do not have to call this manually unless you have called finalize before.

Return type:

None

scaluq.finalize()

Terminate the Kokkos execution environment. Release the resources.

Notes

Finalization fails if there exists StateVector allocated. You must use StateVector only inside inner scopes than the usage of finalize or delete all of existing StateVector.

This is automatically called when the program exits. If you call this manually, you cannot use most of scaluq’s functions until the program exits.

Return type:

None

scaluq.is_initialized()

Return true if initialize() is already called.

Return type:

bool

scaluq.is_finalized()

Return true if finalize() is already called.

Return type:

bool

scaluq.synchronize()

Synchronize the device if the execution space is not host.

Notes

This function is required to ensure that all operations on device are finished when you measure the elapsed time of some operations on device.

Return type:

None

class scaluq.ClassicalRegister(register_size)

Classical register.

Parameters:

register_size (int)

register_size()

Get register size.

Return type:

int

reset()

Reset all bits to False.

Return type:

None

class scaluq.ClassicalRegisterBatched(register_size, batch_size)

Batched classical register.

Parameters:
  • register_size (int)

  • batch_size (int)

register_size()

Get register size.

Return type:

int

batch_size()

Get batch size.

Return type:

int

reset()

Reset all bits to False.

Return type:

None

class scaluq.GateType(*args, **kwds)

Bases: enum.Enum

Enum of Gate Type.

I = 1
GlobalPhase = 2
X = 3
Y = 4
Z = 5
H = 6
S = 7
Sdag = 8
T = 9
Tdag = 10
SqrtX = 11
SqrtXdag = 12
SqrtY = 13
SqrtYdag = 14
P0 = 15
P1 = 16
Measurement = 17
RX = 18
RY = 19
RZ = 20
U1 = 21
U2 = 22
U3 = 23
Swap = 24
Ecr = 25
Pauli = 26
PauliRotation = 27
SparseMatrix = 28
DenseMatrix = 29
Probabilistic = 30
class scaluq.ParamGateType(*args, **kwds)

Bases: enum.Enum

Enum of ParamGate Type.

ParamRX = 1
ParamRY = 2
ParamRZ = 3
ParamPauliRotation = 4
scaluq.get_default_execution_space()

Get the default execution space.

Returns:

the default execution space, cuda or host

Return type:

str

Examples

>>> get_default_execution_space() 
'cuda'
scaluq.precision_available(arg, /)

Return the precision is supported.

Parameters:
  • precision (str) –

    precision name

    This must be one of f16 f32 f64 bf16.

  • arg (str)

Returns:

the precision is supported

Return type:

bool

Examples

>>> precision_available('f64') 
True
>>> precision_available('bf16') 
False