[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Convert double to octave_value for assignment to column vector
From: |
David Grundberg |
Subject: |
Re: Convert double to octave_value for assignment to column vector |
Date: |
Mon, 07 Jun 2010 11:05:17 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 |
On 06/07/2010 10:15 AM, babelproofreader wrote:
Can you attach the file instead of inserting it?
File attached below.
http://octave.1599824.n4.nabble.com/file/n2245642/rep_median_compile.cc
rep_median_compile.cc
As Jaroslav points out, there is an error on this line:
median_calc_return = feval ( "median", octave_value (i_slopes));
This calls octave_value with a double*, which compiles. But this is
likely a fluke. (Pointers are usually followed with how many elements
one are supposed to read from the pointer. This how I can tell.)
You can change "median" to "disp" to see that there is something wrong
there.
If I were you, I would declare i_slopes and friends as a ColumnVector
(as opposed to a OCTAVE_LOCAL_BUFFER'd double*).
- OCTAVE_LOCAL_BUFFER (double, i_slopes, args(0).length ()-1 );
- OCTAVE_LOCAL_BUFFER (double, i_intercepts, args(0).length ()-1 );
- OCTAVE_LOCAL_BUFFER (double, slope_medians, args(0).length () );
- OCTAVE_LOCAL_BUFFER (double, intercept_medians, args(0).length ());
+ ColumnVector i_slopes (args(0).length ()-1);
+ ColumnVector i_intercepts (args(0).length ()-1);
+ ColumnVector slope_medians (args(0).length ());
+ ColumnVector intercept_medians (args(0).length ());
And you will need to change the relevant []-operations to ().
David
- Convert double to octave_value for assignment to column vector, babelproofreader, 2010/06/01
- Re: Convert double to octave_value for assignment to column vector, David Grundberg, 2010/06/02
- Re: Convert double to octave_value for assignment to column vector, babelproofreader, 2010/06/04
- Re: Convert double to octave_value for assignment to column vector, David Grundberg, 2010/06/04
- Re: Convert double to octave_value for assignment to column vector, David Grundberg, 2010/06/04
- Re: Convert double to octave_value for assignment to column vector, babelproofreader, 2010/06/06
- Re: Convert double to octave_value for assignment to column vector, David Grundberg, 2010/06/07
- Re: Convert double to octave_value for assignment to column vector, babelproofreader, 2010/06/07
- Re: Convert double to octave_value for assignment to column vector, Jaroslav Hajek, 2010/06/07
- Re: Convert double to octave_value for assignment to column vector,
David Grundberg <=
- Re: Convert double to octave_value for assignment to column vector, babelproofreader, 2010/06/07
- Re: Convert double to octave_value for assignment to column vector, Jaroslav Hajek, 2010/06/08
- Re: Convert double to octave_value for assignment to column vector, babelproofreader, 2010/06/08
- Re: Convert double to octave_value for assignment to column vector, babelproofreader, 2010/06/09
- Re: Convert double to octave_value for assignment to column vector, David Grundberg, 2010/06/10
- Re: Convert double to octave_value for assignment to column vector, babelproofreader, 2010/06/10
- Re: Convert double to octave_value for assignment to column vector, babelproofreader, 2010/06/10