help-octave
[Top][All Lists]
Advanced

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

Re: Casting a Matrix object as a single dimensional array


From: David Grundberg
Subject: Re: Casting a Matrix object as a single dimensional array
Date: Mon, 07 Jun 2010 13:08:11 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4

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


reply via email to

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