[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pb with oct file, return a matrix
From: 
John W. Eaton 
Subject: 
Re: pb with oct file, return a matrix 
Date: 
Wed, 22 Apr 2009 12:40:23 0400 
On 22Apr2009, Alain Baeckeroot wrote:
 Le 22/04/2009 à 17:50, John W. Eaton écrit :
 >
 ....
 >
 > Does it work if you simplify your function to be just the following:
 >
 > DEFUN_DLD( boucle_cc, args, nargout, "usage : rMat = boucle_cc(..)\n") {
 > int NDATA=10000;
 > Matrix rMat(NDATA, 22, 0.0); // results
 > octave_value_list retval; // list of return values
 > retval(0) = rMat;
 > return retval;
 > }

 yes it works.

 > ? If so, then I'd guess that you have some problem in the
 >
 >  ...compute and put everything in rMat...
 >
 > part. Given the error message you see, I'd guess that you are writing
 > outside the bounds of the rMat array. But that's just a guess.

 i'm digging this way.
If you use the C++ Array indexing operators to access the elements of
rMat, then you can try
mkoctfile DBOUNDS_CHECKING=1 ...
and you should see an error message when you run your code if you
attempt to access an element of rMat that is out of bounds.
If you access the elements with
double *ptr = rMat.fortran_vec ();
then you are on your own...
jwe
 pb with oct file, return a matrix, Alain Baeckeroot, 2009/04/22
 pb with oct file, return a matrix, John W. Eaton, 2009/04/22
 Re: pb with oct file, return a matrix, Alain Baeckeroot, 2009/04/22
 Re: pb with oct file, return a matrix,
John W. Eaton <=
 Re: pb with oct file, return a matrix, Alain Baeckeroot, 2009/04/23
 Re: pb with oct file, return a matrix, Jaroslav Hajek, 2009/04/23
 Input redirection (was: Re: pb with oct file, return a matrix), Søren Hauberg, 2009/04/23
 Re: pb with oct file, return a matrix, Alain Baeckeroot, 2009/04/24