diff src/DLD-FUNCTIONS/dasrt.cc @ 4140:303b28a7a7e4

[project @ 2002-11-01 02:53:13 by jwe]
author jwe
date Fri, 01 Nov 2002 02:53:14 +0000
parents 19a1626b8d57
children c0121a3b9cbe
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/dasrt.cc	Fri Nov 01 00:49:13 2002 +0000
+++ b/src/DLD-FUNCTIONS/dasrt.cc	Fri Nov 01 02:53:14 2002 +0000
@@ -48,6 +48,11 @@
 static octave_function *dasrt_j;
 static octave_function *dasrt_cf;
 
+// Have we warned about imaginary values returned from user function?
+static bool warned_fcn_imaginary = false;
+static bool warned_jac_imaginary = false;
+static bool warned_cf_imaginary = false;
+
 // Is this a recursive call?
 static int call_depth = 0;
 
@@ -91,6 +96,12 @@
 
       if (tmp.length () > 0 && tmp(0).is_defined ())
 	{
+	  if (! warned_fcn_imaginary && tmp(0).is_complex_type ())
+	    {
+	      warning ("dasrt: ignoring imaginary part returned from user-supplied function");
+	      warned_fcn_imaginary = true;
+	    }
+
 	  retval = ColumnVector (tmp(0).vector_value ());
 
 	  if (error_state || retval.length () == 0)
@@ -133,6 +144,12 @@
 
       if (tmp.length () > 0 && tmp(0).is_defined ())
 	{
+	  if (! warned_cf_imaginary && tmp(0).is_complex_type ())
+	    {
+	      warning ("dasrt: ignoring imaginary part returned from user-supplied constraint function");
+	      warned_cf_imaginary = true;
+	    }
+
 	  retval = ColumnVector (tmp(0).vector_value ());
 
 	  if (error_state || retval.length () == 0)
@@ -197,6 +214,12 @@
       int tlen = tmp.length ();
       if (tlen > 0 && tmp(0).is_defined ())
 	{
+	  if (! warned_jac_imaginary && tmp(0).is_complex_type ())
+	    {
+	      warning ("dasrt: ignoring imaginary part returned from user-supplied jacobian function");
+	      warned_jac_imaginary = true;
+	    }
+
 	  retval = tmp(0).matrix_value ();
 
 	  if (error_state || retval.length () == 0)
@@ -366,6 +389,10 @@
 {
   octave_value_list retval;
 
+  warned_fcn_imaginary = false;
+  warned_jac_imaginary = false;
+  warned_cf_imaginary = false;
+
   unwind_protect::begin_frame ("Fdasrt");
 
   unwind_protect_int (call_depth);