LibraryLink`
LibraryLink`

MTensor_setComplex

sets a single element of an MTensor of complex type.

Details and OptionsDetails
  • Used in C/C++ code in a library function called from Mathematica.
  • Uses the same numbering scheme as Mathematica parts, i.e. the first element is 1.
  • The array is assumed to have length at least equal to the rank of .
  • Will cause an error to be launched if the element does not exist, or if the tensor is not a complex MTensor.
  • Examples

    Basic Examples  (1)

    This sets the element in a complex-valued matrix at position (1,1) to be I:

    MTensor T0;
    mint lens[2];
    mcomplex z = {0.,1.};
    int err;
    ...
    lens[0] = 1;
    lens[1] = 1;
    err = libData->MTensor_setComplex( T0, lens, z);

    See Also

    MTensor_getComplex  MTensor_getComplexData

    Tutorials