pub unsafe extern "C" fn cutensorCreateContraction(
handle: cutensorHandle_t,
desc: *mut cutensorOperationDescriptor_t,
descA: cutensorTensorDescriptor_t,
modeA: *const i32,
opA: cutensorOperator_t,
descB: cutensorTensorDescriptor_t,
modeB: *const i32,
opB: cutensorOperator_t,
descC: cutensorTensorDescriptor_t,
modeC: *const i32,
opC: cutensorOperator_t,
descD: cutensorTensorDescriptor_t,
modeD: *const i32,
descCompute: cutensorComputeDescriptor_t,
) -> cutensorStatus_tExpand description
This function allocates a cutensorOperationDescriptor_t object that encodes a tensor contraction of the form $D = \alpha \mathcal{A} \mathcal{B} + \beta \mathcal{C}$.
Allocates data for desc to be used to perform a tensor contraction of the form:
$$ \mathcal{D}{{modes}\mathcal{D}} \gets \alpha op_\mathcal{A}(\mathcal{A}{{modes}\mathcal{A}}) op_\mathcal{B}(B_{{modes}\mathcal{B}}) + \beta op\mathcal{C}(\mathcal{C}{{modes}\mathcal{C}}). $$ See cutensorCreatePlan (or cutensorCreatePlanAutotuned) to create the plan (i.e., to select the kernel) followed by a call to cutensorContract to perform the actual contraction.
The user is responsible for calling cutensorDestroyOperationDescriptor to free the resources associated with the descriptor.
Supported data-type combinations are:
§Parameters
handle: Opaque handle holding cuTENSOR’s library context.desc: This opaque struct gets allocated and filled with the information that encodes the tensor contraction operation.descA: The descriptor that holds the information about the data type, modes and strides of A.modeA: Array with ‘nmodeA’ entries that represent the modes of A. The modeA[i] corresponds to extent[i] and stride[i] w.r.t. the arguments provided to cutensorInitTensorDescriptor.opA: Unary operator that will be applied to each element of A before it is further processed. The original data of this tensor remains unchanged.descB: The descriptor that holds information about the data type, modes, and strides of B.modeB: Array with ‘nmodeB’ entries that represent the modes of B. The modeB[i] corresponds to extent[i] and stride[i] w.r.t. the arguments provided to cutensorInitTensorDescriptor.opB: Unary operator that will be applied to each element of B before it is further processed. The original data of this tensor remains unchanged.descC: The escriptor that holds information about the data type, modes, and strides of C.modeC: Array with ‘nmodeC’ entries that represent the modes of C. The modeC[i] corresponds to extent[i] and stride[i] w.r.t. the arguments provided to cutensorInitTensorDescriptor.opC: Unary operator that will be applied to each element of C before it is further processed. The original data of this tensor remains unchanged.descD: The descriptor that holds information about the data type, modes, and strides of D (must be identical todescCfor now).modeD: Array with ‘nmodeD’ entries that represent the modes of D (must be identical to modeC for now). The modeD[i] corresponds to extent[i] and stride[i] w.r.t. the arguments provided to cutensorInitTensorDescriptor.descCompute: Determines the precision in which this operations is performed.
§Return value
cutensorStatus_t::CUTENSOR_STATUS_INVALID_VALUE: if tensor dimensions or modes have an illegal value.cutensorStatus_t::CUTENSOR_STATUS_NOT_INITIALIZED: if the handle is not initialized.cutensorStatus_t::CUTENSOR_STATUS_NOT_SUPPORTED: if the combination of data types or operations is not supported.cutensorStatus_t::CUTENSOR_STATUS_SUCCESS: The operation completed successfully without error.