Function initDiagonalOp

Source
pub unsafe extern "C" fn initDiagonalOp(
    op: DiagonalOp,
    real: *mut f64,
    imag: *mut f64,
)
Expand description

Overwrites the entire ::DiagonalOp \p op with the given \p real and \p imag complex elements.

Both \p real and \p imag must have length equal to pow(2, op.numQubits).

In GPU mode, this updates both the RAM (\p op.real and \p op.imag) and persistent GPU memory; there is no need to call syncDiagonalOp() afterward.

In distributed mode, this function assumes \p real and \p imag exist fully on every node. For ::DiagonalOp which are too large to fit into a single node, use setDiagonalOpElems() or syncDiagonalOp().

@see

  • setDiagonalOpElems()
  • initDiagonalOpFromPauliHamil()

@ingroup type @param[in,out] op the diagonal operator to modify @param[in] real the real components of the full set of new elements @param[in] imag the imaginary components of the full set of new elements @throws invalidQuESTInputError()

  • if \p op was not created @throws segmentation-fault
  • if either \p real or \p imag have length smaller than pow(2, op.numQubits) @author Tyson Jones