comparison liboctave/dMatrix.cc @ 4431:c4bde1d5eb98

[project @ 2003-06-18 15:47:09 by jwe]
author jwe
date Wed, 18 Jun 2003 15:47:10 +0000
parents f1fcc371e5ef
children 53ee020af847
comparison
equal deleted inserted replaced
4430:1541c3ed2c93 4431:c4bde1d5eb98
1982 1982
1983 return *this; 1983 return *this;
1984 } 1984 }
1985 1985
1986 bool 1986 bool
1987 Matrix::any_element_is_negative (void) const 1987 Matrix::any_element_is_negative (bool neg_zero) const
1988 { 1988 {
1989 int nr = rows (); 1989 int nr = rows ();
1990 int nc = cols (); 1990 int nc = cols ();
1991 1991
1992 for (int j = 0; j < nc; j++) 1992 if (neg_zero)
1993 for (int i = 0; i < nr; i++) 1993 {
1994 if (elem (i, j) < 0.0) 1994 for (int j = 0; j < nc; j++)
1995 return true; 1995 for (int i = 0; i < nr; i++)
1996 if (lo_ieee_signbit (elem (i, j)))
1997 return true;
1998 }
1999 else
2000 {
2001 for (int j = 0; j < nc; j++)
2002 for (int i = 0; i < nr; i++)
2003 if (elem (i, j) < 0)
2004 return true;
2005 }
1996 2006
1997 return false; 2007 return false;
1998 } 2008 }
1999 2009
2000 2010