[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: Passing diagonal matrix to an *.oct function

**From**: |
Jaroslav Hajek |

**Subject**: |
Re: Passing diagonal matrix to an *.oct function |

**Date**: |
Fri, 6 Mar 2009 11:10:32 +0100 |

On Fri, Mar 6, 2009 at 10:48 AM, José Luis García Pallero
<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*
>
Since the support is still kind of experimental, there's no such
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

**Passing diagonal matrix to an *.oct function**, *José Luis García Pallero*, `2009/03/06`
**Re: Passing diagonal matrix to an *.oct function**,
*Jaroslav Hajek* **<=**
**Re: Passing diagonal matrix to an *.oct function**, *José Luis García Pallero*, `2009/03/06`
**Re: Passing diagonal matrix to an *.oct function**, *Jaroslav Hajek*, `2009/03/06`
**Re: Passing diagonal matrix to an *.oct function**, *Jaroslav Hajek*, `2009/03/06`
**Re: Passing diagonal matrix to an *.oct function**, *José Luis García Pallero*, `2009/03/06`
**Re: Passing diagonal matrix to an *.oct function**, *Jaroslav Hajek*, `2009/03/06`
**Re: Passing diagonal matrix to an *.oct function**, *José Luis García Pallero*, `2009/03/06`