[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Get pointer to data in Matrix classes [possible solution]
From: |
Jaroslav Hajek |
Subject: |
Re: Get pointer to data in Matrix classes [possible solution] |
Date: |
Thu, 12 Mar 2009 11:24:14 +0100 |
On Thu, Mar 12, 2009 at 11:17 AM, José Luis García Pallero
<address@hidden> wrote:
> Hi,
> Thanks for your answer. Sorry, I didn't know the fortran_vec() method. It
> not appears in liboctave.pdf.
The liboctave reference is far from complete and also somewhat
outdated, because liboctave is changing constantly.
Help would be appreciated.
> I don't understand exactly your words in "This
> will also correctly make a copy of the matrix if it is aliased". What is the
> meaning? Make a copy of the matrix or gets the pointer?
>
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.
> 2009/3/12 Jaroslav Hajek <address@hidden>
>>
>> The standard method for getting writable data pointer is (somewhat
>> unfortunately) called fortran_vec.
>> This will also correctly make a copy of the matrix if it is aliased.
>> Const-casting data () will work in your case (you've just created the
>> matrix, so you know that it's unaliased, but never do it on matrices
>> passed from outside).
>>
>> regards
>>
>> --
>> RNDr. Jaroslav Hajek
>> computing expert & GNU Octave developer
>> Aeronautical Research and Test Institute (VZLU)
>> Prague, Czech Republic
>> url: www.highegg.matfyz.cz
>
>
>
> --
> *****************************************
> José Luis García Pallero
> address@hidden
> (o<
> / / \
> V_/_
> Use Debian GNU/Linux and enjoy!
> *****************************************
>
--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
- Get pointer to data in Matrix classes [possible solution], José Luis García Pallero, 2009/03/12
- Re: Get pointer to data in Matrix classes [possible solution], Jaroslav Hajek, 2009/03/12
- Re: Get pointer to data in Matrix classes [possible solution], José Luis García Pallero, 2009/03/12
- Re: Get pointer to data in Matrix classes [possible solution],
Jaroslav Hajek <=
- Re: Get pointer to data in Matrix classes [possible solution], José Luis García Pallero, 2009/03/12
- Re: Get pointer to data in Matrix classes [possible solution], Søren Hauberg, 2009/03/12
- Re: Get pointer to data in Matrix classes [possible solution], Jaroslav Hajek, 2009/03/12
- Re: Get pointer to data in Matrix classes [possible solution], José Luis García Pallero, 2009/03/12
- Re: Get pointer to data in Matrix classes [possible solution], Jaroslav Hajek, 2009/03/12
- Re: Get pointer to data in Matrix classes [possible solution], José Luis García Pallero, 2009/03/12