help-octave
[Top][All Lists]
Advanced

[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 12:00:06 +0100

On Fri, Mar 6, 2009 at 11:39 AM, Jaroslav Hajek <address@hidden> wrote:
> On Fri, Mar 6, 2009 at 11:30 AM, José Luis García Pallero
> <address@hidden> wrote:
>> Your method:
>>
>> const octave_diag_matrix& dmref = dynamic_cast<const octave_diag_matrix&>
>> (args(0).get_rep ());
>> DiagMatrix a = dmref.diag_matrix_value ();
>>
>> fails at compile time. The error is:
>>
>> error: expected initializer before ‘&’ token
>> error: ‘dmref’ was not declared in this scope
>>
>
> You need to #include the proper header, of course. In this case,
> "ov-re-diag.h". But I'm just adding the diagonal query methods, so
> stay tuned.
>
>> I can work with a trick. I can pass a column vector to my function instead a
>> diagonal matrix and initialize the DiagMatrix in the oct function:
>>
>> DiagMatrix a(args(0).column_vector_value());
>>
>> Can I think that this method produces a waste of memory because the original
>> array is duplicated?
>
> No. A shallow copy will be used.  But it won't work for a rectangular
> diagonal matrix.
>
>> I suppose that diag_matrix_value_method() must be added, as matrix_value(),
>> column_vector_value(), etc. They can return an error in situatios of
>> conflict, like Matrix a=args(0).colum_vector_value(), for example.
>>
>> Thanks
>>
>
> Agreed. I'll add them.
>

I've pushed the changes to savannah.

Just out of curiosity, what's the application? Why do you want to
treat diagonal matrices specially in the oct file?

-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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