Function setDensityAmps

Source
pub unsafe extern "C" fn setDensityAmps(
    qureg: Qureg,
    startRow: c_longlong,
    startCol: c_longlong,
    reals: *mut f64,
    imags: *mut f64,
    numAmps: c_longlong,
)
Expand description

Overwrites a contiguous subset of the amplitudes in density-matrix \p qureg, with those passed in \p reals and \p imags, intrepreted column-wise.

Only the first \p numAmp amplitudes starting from row-column index (\p startRow, \p startCol), and proceeding down the column (wrapping around between rows) will be modified. The resulting \p qureg may not necessarily be a valid density matrix normalisation.

In distributed mode, this function assumes the subset \p reals and \p imags exist (at least) on the node(s) containing the ultimately updated elements.\n

@see

  • setAmps()
  • initStateFromAmps()

@ingroup init @param[in,out] qureg the density-matrix to modify @param[in] startRow the row-index of the first amplitude in \p qureg to modify @param[in] startCol the column-index of the first amplitude in \p qureg to modify @param[in] reals array of the real components of the new amplitudes @param[in] imags array of the imaginary components of the new amplitudes @param[in] numAmps the length of each of the reals and imags arrays @throws invalidQuESTInputError()

  • if \p qureg is not a density matrix (i.e. is a state-vector)
  • if \p startRow is outside [0, 1 << qureg.numQubitsRepresented]
  • if \p startCol is outside [0, 1 << qureg.numQubitsRepresented]
  • if \p numAmps is outside [0, qureg.numAmpsTotal]
  • if \p numAmps is larger than the remaining number of amplitudes from (startRow, startCol), column-wise @author Tyson Jones