help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using mex and boost libs


From: David Bateman
Subject: Re: using mex and boost libs
Date: Thu, 13 Sep 2007 09:58:37 +0200
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

address@hidden wrote:
>
> Dear,
>
> I have a question concerning your webpage
> http://www.gnu.org/software/octave/doc/interpreter/Sparse-Matrices-with-Mex_002dFiles.html
> I'm trying to construct a sparse matrix using the boost ublas
> libraries. My problem is that I cannot return the sparse matrix to mex
> and octave/matlab. In you webpage is explained how to pass a sparse
> matrix to c, but can you help me to pass a sparse matrix from c to
> octave/matlab?

Kris,

The page you mention also shows hoe to pass a sparse matrix from c to
Octave. Consider the call

           v = mxCreateSparse (m, n, nz, mxCOMPLEX);
           pr2 = mxGetPr (v);
           pi2 = mxGetPi (v);
           ir2 = mxGetIr (v);
           jc2 = mxGetJc (v);


This creates a complex sparse matrix with nz non-zero values, and the
pointers to the real and imaginary parts, as well as the row (ir2) and
column vectors of the compress column sparse format used in
matlab/octave. You'll just have to copy the data from boost into a
matrix created in this manner..

Regards
David

-- 
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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]