changeset 1873:dc859604b19b

[project @ 1996-02-04 13:07:46 by jwe]
author jwe
date Sun, 04 Feb 1996 13:12:50 +0000
parents d5ba1bd06584
children 7fc99ae70891
files liboctave/NPSOL.cc liboctave/NPSOL.h liboctave/QPSOL.cc liboctave/Quad.h src/dynamic-ld.cc src/quad.cc
diffstat 6 files changed, 17 insertions(+), 112 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/NPSOL.cc
+++ b/liboctave/NPSOL.cc
@@ -334,7 +334,7 @@
 }
 
 void
-NPSOL_options::copy (const NPSOL_options& opt)
+NPSOL_options::set_options (const NPSOL_options& opt)
 {
   x_central_difference_interval = opt.x_central_difference_interval;
   x_crash_tolerance = opt.x_crash_tolerance;
--- a/liboctave/NPSOL.h
+++ b/liboctave/NPSOL.h
@@ -42,12 +42,12 @@
 
   NPSOL_options (void) { init (); }
 
-  NPSOL_options (const NPSOL_options& opt) { copy (opt); }
+  NPSOL_options (const NPSOL_options& opt) { set_options (opt); }
 
   NPSOL_options& operator = (const NPSOL_options& opt)
     {
       if (this != &opt)
-	copy (opt);
+	set_options (opt);
 
       return *this;
     }
@@ -56,9 +56,9 @@
 
   void init (void);
 
-  void copy (const NPSOL_options& opt);
+  void set_default_options (void) { init (); }
 
-  void set_default_options (void) { init (); }
+  void set_options (const NPSOL_options& opt);
 
 // XXX FIXME XXX -- is this a good idea?
 
--- a/liboctave/QPSOL.cc
+++ b/liboctave/QPSOL.cc
@@ -170,101 +170,6 @@
   return x;
 }
 
-QPSOL_options::QPSOL_options (void)
-{
-  init ();
-}
-
-QPSOL_options::QPSOL_options (const QPSOL_options& opt)
-{
-  copy (opt);
-}
-
-QPSOL_options&
-QPSOL_options::operator = (const QPSOL_options& opt)
-{
-  if (this != &opt)
-    copy (opt);
-
-  return *this;
-}
-
-QPSOL_options::~QPSOL_options (void)
-{
-}
-
-void
-QPSOL_options::init (void)
-{
-  x_feasibility_tolerance = sqrt (DBL_EPSILON);
-  x_infinite_bound = 1.0e+30;
-  x_iteration_limit = -1;
-  x_print_level = 0;
-}
-
-void
-QPSOL_options::copy (const QPSOL_options& opt)
-{
-  x_feasibility_tolerance = opt.x_feasibility_tolerance;
-  x_infinite_bound = opt.x_infinite_bound;
-  x_iteration_limit = opt.x_iteration_limit;
-  x_print_level = opt.x_print_level;
-}
-
-void
-QPSOL_options::set_default_options (void)
-{
-  init ();
-}
-
-void
-QPSOL_options::set_feasibility_tolerance (double val)
-{
-  x_feasibility_tolerance = (val > 0.0) ? val : sqrt (DBL_EPSILON);
-}
-
-void
-QPSOL_options::set_infinite_bound (double val)
-{
-  x_infinite_bound = (val > 0.0) ? val : 1.0e+30;
-}
-
-void
-QPSOL_options::set_iteration_limit (int val)
-{
-  x_iteration_limit = (val > 0) ? val : -1;
-}
-
-void
-QPSOL_options::set_print_level (int val)
-{
-  x_print_level = (val >= 0) ? val : 0;
-}
-
-double
-QPSOL_options::feasibility_tolerance (void)
-{
-  return x_feasibility_tolerance;
-}
-
-double
-QPSOL_options::infinite_bound (void)
-{
-  return x_infinite_bound;
-}
-
-int
-QPSOL_options::iteration_limit (void)
-{
-  return x_iteration_limit;
-}
-
-int
-QPSOL_options::print_level (void)
-{
-  return x_print_level;
-}
-
 #endif
 
 /*
--- a/liboctave/Quad.h
+++ b/liboctave/Quad.h
@@ -64,10 +64,8 @@
   Quad_options& operator = (const Quad_options& opt)
     {
       if (this != &opt)
-	{
-	  x_absolute_tolerance = opt.x_absolute_tolerance;
-	  x_relative_tolerance = opt.x_relative_tolerance;
-	}
+	set_options (opt);
+
       return *this;
     }
 
@@ -83,6 +81,12 @@
 
   void set_default_options (void) { init (); }
 
+  void set_options (const Quad_options& opt)
+    {
+      x_absolute_tolerance = opt.x_absolute_tolerance;
+      x_relative_tolerance = opt.x_relative_tolerance;
+    }
+
   // XXX FIXME XXX -- check for invalid values?
   void set_absolute_tolerance (double val) { x_absolute_tolerance = val; }
   void set_relative_tolerance (double val) { x_relative_tolerance = val; }
--- a/src/dynamic-ld.cc
+++ b/src/dynamic-ld.cc
@@ -188,8 +188,6 @@
 
   retval = (Octave_builtin_fcn) resolve_octave_reference (mangled_name);
 
-  delete [] mangled_name;
-
 #endif
 
   return retval;
@@ -204,7 +202,7 @@
 
   string oct_file = oct_file_in_path (name);
 
-  if (oct_file)
+  if (oct_file.empty ())
     {
       string mangled_name = mangle_octave_oct_file_name (name);
 
@@ -222,8 +220,6 @@
 	      retval = 1;
 	    }
 	}
-
-      delete [] oct_file;
     }
 
 #else
--- a/src/quad.cc
+++ b/src/quad.cc
@@ -212,7 +212,7 @@
       if (indefinite)
 	{
 	  IndefQuad iq (quad_user_function, bound, indef_type, abstol, reltol);
-	  iq.copy (quad_opts);
+	  iq.set_options (quad_opts);
 	  val = iq.integrate (ier, nfun, abserr);
 	}
       else
@@ -220,13 +220,13 @@
 	  if (have_sing)
 	    {
 	      DefQuad dq (quad_user_function, a, b, sing, abstol, reltol);
-	      dq.copy (quad_opts);
+	      dq.set_options (quad_opts);
 	      val = dq.integrate (ier, nfun, abserr);
 	    }
 	  else
 	    {
 	      DefQuad dq (quad_user_function, a, b, abstol, reltol);
-	      dq.copy (quad_opts);
+	      dq.set_options (quad_opts);
 	      val = dq.integrate (ier, nfun, abserr);
 	    }
 	}