help-octave
[Top][All Lists]
Advanced

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

Re: Get pointer to data in Matrix classes [possible solution]


From: José Luis García Pallero
Subject: Re: Get pointer to data in Matrix classes [possible solution]
Date: Thu, 12 Mar 2009 12:03:57 +0100

The liboctave reference is far from complete and also somewhat
outdated, because liboctave is changing constantly.
Help would be appreciated.

One possibility is to generate the documentation of liboctave via doxygen and put a link in "Docs" section of www.octave.org. Though the functions don't have documentation, we could see the class diagrams and the declaration of the methods.

The Matrix class may share all or part of its data with another Matrix
(or NDArray or ColumnVector etc). When you want to write to the
Matrix, you first need to ensure this is not true, making copy if
needed.

Ok. For example:

1. I create a matrix -> a=[1 2 3;4 5 6];
2. I pass the matrix to an *.oct function
3. In oct function I get the pointer to the data -> double* data=""> 4. Do something...

Is the correct working way with normal matrices?

And, for example, imagine that I'm working with a diagonal matrix, like an a priori weighting matrix:

a=diag([1 2 3 4 5]);

and I pass it to my oct function for solve a least squares proble, for example. I want that the a posteriori covariance matrix has the data in the same space of memory of a, for saving resources, but the a posteriori matrix will be full, not diagonal. The original a=diag([1 2 3 4 5]); sentence in octave creates a diagonal matrix. Are correct the syntax Matrix a=arg(0).matrix_value(); in an oct file for get the a matrix from octave? Is full this Matrix a in memory file? Can I use double* b=a.fortran_vec()? Are the data duplicated?

Thanks and sorry for this long list of questions

--
*****************************************
José Luis García Pallero
address@hidden
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************

reply via email to

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