LIBRARY LINK 符号

MTensor_getComplexData


gets an array of the data elements of an MTensor of complex type.

更多信息更多信息

  • Used in C/C++ code in a library function called from Mathematica.
  • The array has a length equal to the flattened length.
  • An error will occur if the tensor is not a complex MTensor.

范例范例打开所有单元关闭所有单元

基本范例 (1)基本范例 (1)

This iterates over the data elements of an MTensor to do an in-place conjugation:

MTensor T0;
mcomplex* z;
mint i, len;
...
len = libData->MTensor_getFlattenedLength( T0);
data = libData->MTensor_getRealData( T0);
for (i = 0; i < len; i++) {
mcimag(z[i]) = -mcimag(z[i]);
}
New to Mathematica? Find your learning path »
Have a question? Ask support »