help-octave
[Top][All Lists]
Advanced

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

Re: Dynamic c++ question: operators


From: Paul Kienzle
Subject: Re: Dynamic c++ question: operators
Date: Tue, 12 Jun 2001 11:43:00 +0100
User-agent: Mutt/1.2.5i

Have you tried it?  It might already work.  

If it doesn't, then from what I can read from the tangle of preprocessor
macros in liboctave/mx-op-defs.h and src/ops.h, the following should work:

        boolMatrix c(mx_el_lt(a,b));
or
        bool mx_el_lt(a,b).any();
or
        bool mx_el_lt(a,b).all();

You could easily define:

        boolMatrix operater < (const Matrix& a, const Matrix& b)
        {
           return mx_el_lt(a,b);
        } 

Similarly for gt, ge, le, and, or

Paul Kienzle
address@hidden

On Tue, Jun 12, 2001 at 10:35:31AM +0200, Douglas Eck wrote:
> Consider this octave code:
> 
> a=rand(5,5);
> b=rand(5,5);
> 
> Can I do the following test directly in liboctave somehow?
>   c=a<b;
> 
> What about this?
>   c=(a<0)&(b>=0);
> 
> I believe I need to use for-loops but I'd love to
> know that I can do it without for-loops.
> 
> Cheers,
> Doug
> 
> 
> 
> -- 
> Dr. Douglas Eck, http://www.idsia.ch/~doug
> Istituto Dalle Molle di Studi sull'Intelligenza Artificiale (IDSIA)
> Neural Networks, Rhythm Perception and Production, Dynamical Systems
> 
> 
> 
> -------------------------------------------------------------
> 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
> -------------------------------------------------------------
> 
> 



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