|
From: | José Luis García Pallero |
Subject: | Re: Passing diagonal matrix to an *.oct function |
Date: | Fri, 6 Mar 2009 11:30:04 +0100 |
On Fri, Mar 6, 2009 at 10:48 AM, José Luis García PalleroSince the support is still kind of experimental, there's no such
<address@hidden> wrote:
> Hi,
> I'm trying to pass a diagonal matrix to an c++ function, but I don't know
> the method for conversion from the octave_value class. I've tried with
> DiagMatrix a=args(0).diagmatrix_value(), .diagonal_matrix_value(),
> .matrix_value(), but all fails. Wich is the correct form?
> Thanks
>
method in octave_value interface. What you need is to dynamic_cast the
reference to the proper subclass and query that:
const octave_diag_matrix& dmref = dynamic_cast<const
octave_diag_matrix&> (args(0).get_rep ());
DiagMatrix a = dmref.diag_matrix_value ();
Admittedly, it's clumsy (CAST_CONV_ARG macro helps a little). Maybe
these methods should be added? What should they return for other
values? Should they just fail?
cheers
--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
[Prev in Thread] | Current Thread | [Next in Thread] |