MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

MathLink MLGetRealArray

  • To: mathgroup at smc.vnet.net
  • Subject: [mg21954] MathLink MLGetRealArray
  • From: "Johannes Ludsteck" <ludsteck at zew.de>
  • Date: Sat, 5 Feb 2000 22:22:21 -0500 (EST)
  • Organization: Zentr. f. Europ. Wirtschaftsforsch
  • Sender: owner-wri-mathgroup at wolfram.com

Dear Group Members,
I am trying to get a matrix from Mathematica into a c program via 
MathLink. When I compile the code below (with Borland C++ 5.0), I 
get an Warning message Suspicious pointer conversion in line..., 
which relates to depthx. However, the variable depthx works fine.

The problem is with the array x. If I try to access the elements in x,
for example
temp = x[0][0]; temp = temp * temp;

then the program crashes.
Any suggestions. It would help me too if someone could provide  C 
program, written in connection with mathlink.

Thank you,
	Johannes Ludsteck

void kerndens(void)
{
   double **x, temp;
   long *dimsx, depthx;
   char **headsx;

   MLGetRealArray(stdlink, &x, &dimsx, &headsx, &depthx);

   MLPutReal(stdlink, x[0][0]);

   MLDisownRealArray(stdlink, x, dimsx, headsx, depthx);
}

The template file has the following form:
:Begin:
:Function:	 	kerndens
:Pattern:		kerndens[y_List,x_?MatrixQ,kernelWidth_Real]
:Arguments:		{y,x,kernelWidth}
:ArgumentTypes:		{Manual}
:ReturnType:		Manual
:End:


Johannes Ludsteck
Centre for European Economic Research (ZEW)
Department of Labour Economics,
Human Resources and Social Policy
Phone (+49)(0)621/1235-157
Fax (+49)(0)621/1235-225

P.O.Box 103443
D-68034 Mannheim
GERMANY

Email: ludsteck at zew.de


  • Prev by Date: simplifying an ugly expression
  • Next by Date: Re: Not drawing lines at polygon edges, in ParametricPlot3D
  • Previous by thread: simplifying an ugly expression
  • Next by thread: Re: MathLink MLGetRealArray