[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mkoctfile questions
From: |
John W. Eaton |
Subject: |
mkoctfile questions |
Date: |
Sun, 23 Jan 2005 22:30:17 -0500 |
On 23-Jan-2005, Brian Blais <address@hidden> wrote:
| I have a few questions about making dynamically linked functions, and
| the libOctave.
|
| 1) are the any example files for doing simple things with the Matrix
| class? There is the Octave dynamically linked cookbook, which I find
| very useful, but is there anything else? a directory with some toy
| examples would be the easiest to make, and for me the most useful.
The Octave sources themselves provide a number of examples.
| 2) how do you extract elements from a multi-dimensional matrix?
The best method depends on precisely what you want to do.
| 3) how do you work with uint8 matrices?
Take a look at ov.h. You can do things like:
uint8NDArray x = val.uint8NDArray_value ();
Elements of x are of type octave_uint8.
| is there a way to tell whether a matrix passed into a dld is uint8?
Not currently. It is generally better to use something like
uint8NDArray x = val.uint8NDArray_value ();
if (! error_state)
{
// Do something with x.
}
else
// Handle error.
instead of
if (val.is_the_type_i_want ())
{
// extract value, etc.
}
because then you can take advanage of any automatic type conversions
that may exist.
If you really need functions like is_uint8_scalar(),
is_uint8_matrix(), etc., then perhaps the best way to get them into
Octave is to write the code and submit a patch.
jwe
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------