LibraryLink`
LibraryLink`

MNumericArray_new (C Function)

is a library callback function that creates a new MNumericArray.

Details

  • Used in C/C++ code in a library function called from the Wolfram Language.
  • A nonzero error code value will be returned if type, rank or dims arguments are incorrect or if there is not sufficient memory.
  • Possible settings for type include:
  • MNumericArray_Type_Bit8"Integer8"signed 8-bit integers from through
    MNumericArray_Type_UBit8"UnsignedInteger8"integers 0 through 255
    MNumericArray_Type_Bit16"Integer16"signed 16-bit integers from through
    MNumericArray_Type_UBit16"UnsignedInteger16"integers 0 through 65535
    MNumericArray_Type_Bit32"Integer32"signed 32-bit integers from through
    MNumericArray_Type_UBit32"UnsignedInteger32"integers 0 through 2^(32)-1
    MNumericArray_Type_Bit64"Integer64"signed 64-bit integers from through
    MNumericArray_Type_UBit64"UnsignedInteger64"integers 0 through 2^(64)-1
    MNumericArray_Type_Real32"Real32"single-precision reals (32-bit)
    MNumericArray_Type_Real64"Real64"double-precision reals (64-bit)
    MNumericArray_Type_Complex_Real32"ComplexReal32"single-precision complex numbers
    MNumericArray_Type_Complex_Real64"ComplexReal64"double-precision complex numbers

Examples

Basic Examples  (1)

This creates a 5×5 MNumericArray of doubles:

MNumericArray A0;
numericarray_data_t type = MNumericArray_Type_Real64;
mint dims[2];
mint rank = 2;
errcode_t err;
...
dims[0] = 5;
dims[1] = 5;
err = libData->numericarrayLibraryFunctions->MNumericArray_new(type, rank, dims, &A0);