[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 11:30:38 +0200 |
User-agent: |
Mozilla Thunderbird 1.0.6-7.6.20060mdk (X11/20050322) |
Fredrik Lingvall wrote:
>Hi all,
>
>I want to get a pointer to an input parameter (a large matrix) in an octave
>DLD-function (oct file) without making a copy of the input data. In a
>Matlab
>mex-file I would do,
>
>A_M = mxGetM(prhs[0]);
>A_N = mxGetN(prhs[0]);
>A = mxGetPr(prhs[0]);
>
>to get the matrix size and a pointer to the data. For octave, I have tried
>
>A_M = args(0).matrix_value().rows();
>A_N = args(0).matrix_value().cols();
>A = args(0).matrix_value().fortran_vec();
>
>A_M and A_N get the correct values but the pointer A do not seem to
>point to the data.
>What am I doing wrong here?
>
>
Try
const Matrix Am = args(0).matrix_value();
const double *A = Am.fortran_vec();
octave_idx_type A_M = A.rows();
octave_idx_type A_N = A.cols();
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 <=
- 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, 2006/06/09
- 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