help-octave
[Top][All Lists]
Advanced

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

Re: new types and INSTALL_BINOP


From: adler
Subject: Re: new types and INSTALL_BINOP
Date: Fri, 2 Mar 2001 20:40:07 -0500 (EST)

On Fri, 2 Mar 2001, Francesco Potorti` wrote:
>    | I have conversion methods for this, eg:
>    |    Matrix octave_sparse::matrix_value (bool = false) const {
>    |       Matrix M= oct_sparse_to_full( X );
>    |       return M;
>    |    }
>    
>    (I'd write the body of this function as just
>    
>      return oct_sparse_to_full (X);
>    
>    since there is no need to have the declaration/initialization
>    statement here.)
> 
> Maybe  I am  completely wrong,  but why  not simply  using  a conversion
> operator?  Sorry if the syntax is  incorrect, I have not used this for a
> long time:
> 
> octave_sparse::operator Matrix() { return oct_sparse_to_full(this); }

I'm not sure what you mean. This is a conversion method, which
is the most natural syntax, it seems to me:

thus, given octave_sparse SM, you can say

   Matrix M= SM.matrix_value().transpose() + 1;

(of course, there is a transpose operator for octave_sparse,
but other more sophisticated linear algebra operations,
like SVD, don't exist ... yet)

_______________________________________
Andy Adler,                address@hidden



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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