[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Casting a Matrix object as a single dimensional array
From: |
Chidambaram Annamalai |
Subject: |
Re: Casting a Matrix object as a single dimensional array |
Date: |
Tue, 8 Jun 2010 17:46:33 +0530 |
I still don't see how I can access the internal double* pointer. Could
you please elaborate? (That is, show a simple example?)
Thanks,
Chillu
On 6/7/10, David Grundberg <address@hidden> wrote:
> On 06/07/2010 12:54 PM, Chidambaram Annamalai wrote:
>> I am writing C++ code to manipulate Matrix objects using the octave
>> headers. I want to copy it to the GPU, for which I require a pointer
>> to the underlying chunk of memory the Matrix object stores its data
>> in. Is there a way to do this?
>>
>> If I cannot get the pointer (due to private visibility mode etc. or
>> otherwise) what's the most efficient (in terms of least amount of
>> memory copies) way to do this?
>>
>> I hope there's a better way than creating my own vanilla array and
>> copying the elements of the matrix because the matrices are very large
>> in size.
>>
>> Thanks,
>> Chillu
>
> These functions are part of the Array<T> class:
>
> const T * data (void) const
> const T * fortran_vec (void) const
> T * fortran_vec (void)
>
> And Matrix inherits from Array<double> (via MArray<double>).
>
> David
>