cuquantum.cutensornet.state_apply_controlled_tensor_operator

cuquantum.cutensornet.state_apply_controlled_tensor_operator(intptr_t handle, intptr_t tensor_network_state, int32_t num_control_modes, state_control_modes, state_control_values, int32_t num_target_modes, state_target_modes, intptr_t tensor_data, tensor_mode_strides, int32_t immutable, int32_t adjoint, int32_t unitary) int64_t[source]

Applies a controlled tensor operator to the tensor network state.

Parameters
  • handle (intptr_t) – cuTensorNet library handle.

  • tensor_network_state (intptr_t) – Tensor network state.

  • num_control_modes (int32_t) – Number of control state modes used by the tensor operator.

  • state_control_modes (object) –

    Controlling state modes used by the tensor operator. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of int32_t.

  • state_control_values (object) –

    Control values for the controlling state modes. A control value is the sequential integer id of the qudit basis component which activates the action of the target tensor operator. If NULL, all control values are assumed to be set to the max id (last qudit basis component), which will be 1 for qubits. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of int64_t.

  • num_target_modes (int32_t) – Number of target state modes acted on by the tensor operator.

  • state_target_modes (object) –

    Target state modes acted on by the tensor operator. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of int32_t.

  • tensor_data (intptr_t) – Elements of the target tensor of the controlled tensor operator (must be of the same data type as the elements of the state tensor).

  • tensor_mode_strides (object) –

    Strides of the tensor operator data layout (note that the tensor operator has twice more modes than the number of the target state modes it acts on). Passing NULL will assume the default generalized columnwise layout. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of int64_t.

  • immutable (int32_t) – Whether or not the tensor operator data may change during the lifetime of the tensor network state. Any data change must be registered via a call to cutensornetStateUpdateTensorOperator.

  • adjoint (int32_t) – Whether or not the tensor operator is applied as an adjoint (ket and bra modes reversed, with all tensor elements complex conjugated).

  • unitary (int32_t) – Whether or not the controlled tensor operator is unitary with respect to the first and second halves of its modes.

Returns

Unique integer id (for later identification of the tensor operator).

Return type

int64_t