help-octave
[Top][All Lists]
Advanced

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

Re: Accessing passed parameters in an oct file


From: Michael Pender
Subject: Re: Accessing passed parameters in an oct file
Date: Sun, 5 Jan 2014 23:28:24 -0500

Thanks Carlo,

I found part of what I needed when I found Christoph L/ Spiel's "Da Coda Al Fine" at http://octave.sourceforge.net/coda/index.html.

For the sake of others who struggle with the same problem, I settled on declaring variables and const int values and used the following:

const int parm1 = args(0).int_value();
const int parm2 = args(1).int_value();

Matrix tmp1 (parm1, parm2);
set_global_value ("P1", tmp1);
set_global_value ("P2", tmp2);

This solved the problem of extracting the scalar integer values, but is actually a very poor implementation for my purposes.  The Matrix constructor creates arrays of doubles and for my purposes I could get by with single precision floats or even integers.  In addition to using several times as much memory as needed, using double precision values is much slower on CUDA than single precision.  However, implementation of single precision floating point operations is far from complete in Octave.  It is something I'm considering trying to add to enhance the capability with CUDA.

As a first step I tried to reserve the necessary memory manually using OCTAVE_LOCAL_BUFFER, but it did not work as I expected.  I've trying to locate some examples of how to use it to reserve space for an array of single precision or integer variables.

- Mike





On Wed, Jan 1, 2014 at 6:30 PM, c. <address@hidden> wrote:

On 1 Jan 2014, at 22:38, mpender <address@hidden> wrote:

> I think the parameters are actually passed as doubles or arrays of doubles
> and I can't find the right member function to just extract the values as
> scalar integers. I want integers so I can use the numbers as array indices,

then you probably want to use this method:
http://octave.sourceforge.net/doxygen/html/d3/d35/classoctave__value.html#a8f6e56e3742aa5597f972ad36f964724

In general you can look here for doxygen generated documentation of Octave's source code:
http://octave.sourceforge.net/doxygen

HTH,
c.


reply via email to

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