LibraryLink`
LibraryLink`

MTensor_new (C Function)

is a library callback function that creates a new MTensor.

Details

  • Used in C/C++ code in a library function called from the Wolfram Language.
  • A nonzero error code value will be returned if the dimensions are negative or there is not sufficient memory.

Examples

Basic Examples  (1)

This creates a 5×5 MTensor of doubles:

MTensor T0;
mint type = MType_Real;
mint dims[2];
mint rank = 2;
int err;
...
dims[0] = 5;
dims[1] = 5;
err = libData->MTensor_new( type, rank, dims, &T0);