[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Octave equivalent to A = mxGetPr(prhs[0]);
From: |
David Bateman |
Subject: |
Re: Octave equivalent to A = mxGetPr(prhs[0]); |
Date: |
Fri, 09 Jun 2006 14:46:57 +0200 |
User-agent: |
Mozilla Thunderbird 1.0.6-7.6.20060mdk (X11/20050322) |
Fredrik Lingvall wrote:
> David Bateman wrote:
>
>>
>>> const Matrix tmp = args(0).matrix_value();
>>> //A_M = mxGetM(prhs[0]);
>>> A_M = tmp.rows();
>>> //A_N = mxGetN(prhs[0]);
>>> A_N = tmp.cols();
>>> //A = mxGetPr(prhs[0]);
>>> A = (double*) tmp.fortran_vec();
>>>
>>>Solved my problem.
>>>
>>>
>>
>>Yes, but the last line probably made a copy of the data with this last
>>line with the cast to (double *)!! Try adding A.print_info() after and
>>see what value rep->count has... If it is "1" you've made a copy..
>>
>>D.
>>
>>
>>
> I did a A[0] = 0.0; and the 1st element of the input parameter was
> changed to 0 after I
> called my oct-file so I think that it worked. But anyway, how do you
> suggest that I should
> write the code?
>
> Fredrik
Ok, but it goes against the conventions of octave/matlab in that all
arguments are considered as pass by value. So use at your own risk...
D.
--
David Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
- Octave equivalent to A = mxGetPr(prhs[0]);, Fredrik Lingvall, 2006/06/09
- Re: Octave equivalent to A = mxGetPr(prhs[0]);, David Bateman, 2006/06/09
- Re: Octave equivalent to A = mxGetPr(prhs[0]);, Fredrik Lingvall, 2006/06/09
- Re: Octave equivalent to A = mxGetPr(prhs[0]);, David Bateman, 2006/06/09
- Re: Octave equivalent to A = mxGetPr(prhs[0]);, Fredrik Lingvall, 2006/06/09
- Re: Octave equivalent to A = mxGetPr(prhs[0]);, David Bateman, 2006/06/09
- Re: Octave equivalent to A = mxGetPr(prhs[0]);, Fredrik Lingvall, 2006/06/09
- Re: Octave equivalent to A = mxGetPr(prhs[0]);,
David Bateman <=
- Re: Octave equivalent to A = mxGetPr(prhs[0]);, Fredrik Lingvall, 2006/06/09
- Re: Octave equivalent to A = mxGetPr(prhs[0]);, John W. Eaton, 2006/06/09
- Re: Octave equivalent to A = mxGetPr(prhs[0]);, Paul Kienzle, 2006/06/09