help-octave
[Top][All Lists]
Advanced

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

Oct-file version of x>0


From: Keith Goodman
Subject: Oct-file version of x>0
Date: Tue, 23 May 2006 18:02:10 -0700

While porting a m-file to an oct-file I got stuck on the line

y = x'*(x > 0);

where x is Nx1.

How do I port x>0?

I figured out how not to do it all by myself:

#include <oct.h>
DEFUN_DLD(abc, args, nargout,"y = x'*(x > 0) where x is Nx1")
{
 octave_value retval;
 Matrix x = args(0).matrix_value();
 retval = x.transpose() * (x > 0);
 return retval;
}

$ mkoctfile abc.cc
abc.cc: In function 'octave_value_list Fabc(const octave_value_list&, int)':
abc.cc:6: error: ambiguous overload for 'operator>' in 'x > 0'



reply via email to

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