scaluq ====== .. py:module:: scaluq Subpackages ----------- .. toctree:: :maxdepth: 1 /autoapi/scaluq/default/index /autoapi/scaluq/host/index Classes ------- .. autoapisummary:: scaluq.ClassicalRegister scaluq.ClassicalRegisterBatched scaluq.GateType scaluq.ParamGateType Functions --------- .. autoapisummary:: scaluq.initialize scaluq.finalize scaluq.is_initialized scaluq.is_finalized scaluq.synchronize scaluq.get_default_execution_space scaluq.precision_available Package Contents ---------------- .. py:function:: initialize() Initialize the Kokkos execution environment. .. rubric:: Notes This is automatically called when the program starts. You do not have to call this manually unless you have called `finalize` before. .. py:function:: finalize() Terminate the Kokkos execution environment. Release the resources. .. rubric:: 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. .. py:function:: is_initialized() Return true if :func:`~scaluq.initialize()` is already called. .. py:function:: is_finalized() Return true if :func:`~scaluq.finalize()` is already called. .. py:function:: synchronize() Synchronize the device if the execution space is not host. .. rubric:: 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. .. py:class:: ClassicalRegister(register_size) Classical register. .. py:method:: register_size() Get register size. .. py:method:: reset() Reset all bits to `False`. .. py:class:: ClassicalRegisterBatched(register_size, batch_size) Batched classical register. .. py:method:: register_size() Get register size. .. py:method:: batch_size() Get batch size. .. py:method:: reset() Reset all bits to `False`. .. py:class:: GateType(*args, **kwds) Bases: :py:obj:`enum.Enum` Enum of Gate Type. .. py:attribute:: I :value: 1 .. py:attribute:: GlobalPhase :value: 2 .. py:attribute:: X :value: 3 .. py:attribute:: Y :value: 4 .. py:attribute:: Z :value: 5 .. py:attribute:: H :value: 6 .. py:attribute:: S :value: 7 .. py:attribute:: Sdag :value: 8 .. py:attribute:: T :value: 9 .. py:attribute:: Tdag :value: 10 .. py:attribute:: SqrtX :value: 11 .. py:attribute:: SqrtXdag :value: 12 .. py:attribute:: SqrtY :value: 13 .. py:attribute:: SqrtYdag :value: 14 .. py:attribute:: P0 :value: 15 .. py:attribute:: P1 :value: 16 .. py:attribute:: Measurement :value: 17 .. py:attribute:: RX :value: 18 .. py:attribute:: RY :value: 19 .. py:attribute:: RZ :value: 20 .. py:attribute:: U1 :value: 21 .. py:attribute:: U2 :value: 22 .. py:attribute:: U3 :value: 23 .. py:attribute:: Swap :value: 24 .. py:attribute:: Ecr :value: 25 .. py:attribute:: Pauli :value: 26 .. py:attribute:: PauliRotation :value: 27 .. py:attribute:: SparseMatrix :value: 28 .. py:attribute:: DenseMatrix :value: 29 .. py:attribute:: Probabilistic :value: 30 .. py:class:: ParamGateType(*args, **kwds) Bases: :py:obj:`enum.Enum` Enum of ParamGate Type. .. py:attribute:: ParamRX :value: 1 .. py:attribute:: ParamRY :value: 2 .. py:attribute:: ParamRZ :value: 3 .. py:attribute:: ParamPauliRotation :value: 4 .. py:function:: get_default_execution_space() Get the default execution space. :returns: the default execution space, `cuda` or `host` :rtype: str .. rubric:: Examples >>> get_default_execution_space() # doctest: +SKIP 'cuda' .. py:function:: precision_available(arg, /) Return the precision is supported. :param precision: precision name This must be one of `f16` `f32` `f64` `bf16`. :type precision: str :returns: the precision is supported :rtype: bool .. rubric:: Examples >>> precision_available('f64') # doctest: +SKIP True >>> precision_available('bf16') # doctest: +SKIP False