WSPutReal64Array (C Function)

int WSPutReal64Array(WSLINK link,const double *a,const int *dims,const char **heads,int d)

puts an array of double-precision floating-point numbers to the WSTP connection specified by link to form a depth-d array with dimensions dims.

Details

  • The array a must be laid out in memory like a C array declared explicitly as .
  • If heads is given as NULL, the array will be assumed to have head List at every level.
  • The length of the array at level i is taken to be .
  • WSPutReal64Array() returns 0 in the event of an error, and a nonzero value otherwise.
  • Use WSError() to retrieve the error code if WSPutReal64Array() fails.
  • WSPutReal64Array() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

/* put an array of double-precision floating-point numbers to a link */

void f(WSLINK lp)
{
    double array[2][10][2];
    int dims[3];
    int i;

    for(i = 0; i < 40; i++)
        *((double *)array + i) = i + .1;

    dims[0] = 2;
    dims[1] = 10;
    dims[2] = 2;

    if(! WSPutReal64Array(lp, (double *)array, (int *)dims, (char **)0, 3))
        { /* unable to send the double array to lp */ }
}