LibraryLink`
LibraryLink`

MTensor_setMTensor (C 函数)

sets a subtensor element in an MTensor.

更多信息

  • Used in C/C++ code in a library function called from the Wolfram Language.
  • Uses the same numbering scheme as the Wolfram Language parts, i.e. the first element is 1.
  • The array is assumed to have length at least equal to .
  • A nonzero error code value will be returned if the element does not exist, if the rank of is not equal to plus the rank of , if the types of and are not the same, or if the dimensions are inconsistent.

范例

基本范例  (1)

This sets the parts of T0 at position 1,1 to the tensor T1:

MTensor T0, T1;
mint lens[2];
int err;
...
lens[0] = 1;
lens[1] = 1;
err = libData->MTensor_setMTensor( T0, T1, lens, 2);