help-octave
[Top][All Lists]
Advanced

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

Creating an Octave Matrix by reference


From: Jan Albersmeyer
Subject: Creating an Octave Matrix by reference
Date: Tue, 24 Mar 2009 16:37:50 +0100
User-agent: Thunderbird 2.0.0.21 (X11/20090302)

Hi !

I use Octave in connection with my own C++ codes, usually by wrapping my
objects in corresponding new Octave types and supplying interfaces for
interaction by overloading subsref / subsagn of the new type. When I
want to get matrix type data out of my C++ code, I usually create an
Octave Matrix, copy the data from my data structs to the Matrix an
return it to Octave.

Now I asked myself if it would be possible ( without adapting the Octave
core Matrix class ) also to create an Octave Matrix by referencing my
existing data structs ( which are also col-major stored matrices ),
without copying it.  This would also imply that Octave would not try to
manage the memory of this matrix.
Browsing the sources, I just saw that the Matrix ( dataPointer, nRows,
nCols ) constructor is private, and something like a Matrix (
dataPointer, nRows, leadingDimension, nCols ) constructor does not seem
to exist.

Does anybody know if it is possible to achieve this behaviour ?

Thanks in advance,

Jan


P.S.: It would not matter if it is only possible with a more general
array class instead of a Matrix.


reply via email to

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