changeset 1867:52e7bca8ce33

[project @ 1996-02-04 11:19:32 by jwe]
author jwe
date Sun, 04 Feb 1996 11:28:40 +0000
parents b6c48195b552
children 6822f1ccec47
files liboctave/DASSL.cc liboctave/EIG.h liboctave/FEGrid.h liboctave/FSQP.h liboctave/LP.h liboctave/LPsolve.h liboctave/LSODE.cc liboctave/LSODE.h
diffstat 8 files changed, 135 insertions(+), 278 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/DASSL.cc	Sun Feb 04 11:09:09 1996 +0000
+++ b/liboctave/DASSL.cc	Sun Feb 04 11:28:40 1996 +0000
@@ -448,116 +448,6 @@
   return retval;
 }
 
-DASSL_options::DASSL_options (void)
-{
-  init ();
-}
-
-DASSL_options::DASSL_options (const DASSL_options& opt)
-{
-  copy (opt);
-}
-
-DASSL_options&
-DASSL_options::operator = (const DASSL_options& opt)
-{
-  if (this != &opt)
-    copy (opt);
-
-  return *this;
-}
-
-DASSL_options::~DASSL_options (void)
-{
-}
-
-void
-DASSL_options::init (void)
-{
-  double sqrt_eps = sqrt (DBL_EPSILON);
-  x_absolute_tolerance = sqrt_eps;
-  x_initial_step_size = -1.0;
-  x_maximum_step_size = -1.0;
-  x_minimum_step_size = 0.0;
-  x_relative_tolerance = sqrt_eps;
-}
-
-void
-DASSL_options::copy (const DASSL_options& opt)
-{
-  x_absolute_tolerance = opt.x_absolute_tolerance;
-  x_initial_step_size = opt.x_initial_step_size;
-  x_maximum_step_size = opt.x_maximum_step_size;
-  x_minimum_step_size = opt.x_minimum_step_size;
-  x_relative_tolerance = opt.x_relative_tolerance;
-}
-
-void
-DASSL_options::set_default_options (void)
-{
-  init ();
-}
-
-void
-DASSL_options::set_absolute_tolerance (double val)
-{
-  x_absolute_tolerance = (val > 0.0) ? val : sqrt (DBL_EPSILON);
-}
-
-void
-DASSL_options::set_initial_step_size (double val)
-{
-  x_initial_step_size = (val >= 0.0) ? val : -1.0;
-}
-
-void
-DASSL_options::set_maximum_step_size (double val)
-{
-  x_maximum_step_size = (val >= 0.0) ? val : -1.0;
-}
-
-void
-DASSL_options::set_minimum_step_size (double val)
-{
-  x_minimum_step_size = (val >= 0.0) ? val : 0.0;
-}
-
-void
-DASSL_options::set_relative_tolerance (double val)
-{
-  x_relative_tolerance = (val > 0.0) ? val : sqrt (DBL_EPSILON);
-}
-
-double
-DASSL_options::absolute_tolerance (void)
-{
-  return x_absolute_tolerance;
-}
-
-double
-DASSL_options::initial_step_size (void)
-{
-  return x_initial_step_size;
-}
-
-double
-DASSL_options::maximum_step_size (void)
-{
-  return x_maximum_step_size;
-}
-
-double
-DASSL_options::minimum_step_size (void)
-{
-  return x_minimum_step_size;
-}
-
-double
-DASSL_options::relative_tolerance (void)
-{
-  return x_relative_tolerance;
-}
-
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***
--- a/liboctave/EIG.h	Sun Feb 04 11:09:09 1996 +0000
+++ b/liboctave/EIG.h	Sun Feb 04 11:28:40 1996 +0000
@@ -1,7 +1,7 @@
 //                                  -*- C++ -*-
 /*
 
-Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton
+Copyright (C) 1996 John W. Eaton
 
 This file is part of Octave.
 
@@ -34,32 +34,35 @@
 #include "CMatrix.h"
 #include "CColVector.h"
 
-class EIG
+class
+EIG
 {
 friend class Matrix;
 friend class ComplexMatrix;
 
 public:
 
-  EIG (void) { }
+  EIG (void)
+    : lambda (), v () { }
 
   EIG (const Matrix& a) { init (a); }
+
   EIG (const Matrix& a, int& info) { info = init (a); }
 
   EIG (const ComplexMatrix& a) { init (a); }
+
   EIG (const ComplexMatrix& a, int& info) { info = init (a); }
 
   EIG (const EIG& a)
-    {
-      lambda = a.lambda;
-      v = a.v;
-    }
+    : lambda (a.lambda), v (a.v) { }
 
   EIG& operator = (const EIG& a)
     {
-      lambda = a.lambda;
-      v = a.v;
-
+      if (this != &a)
+	{
+	  lambda = a.lambda;
+	  v = a.v;
+	}
       return *this;
     }
 
@@ -71,11 +74,11 @@
 
 private:
 
+  ComplexColumnVector lambda;
+  ComplexMatrix v;
+
   int init (const Matrix& a);
   int init (const ComplexMatrix& a);
-
-  ComplexColumnVector lambda;
-  ComplexMatrix v;
 };
 
 #endif
--- a/liboctave/FEGrid.h	Sun Feb 04 11:09:09 1996 +0000
+++ b/liboctave/FEGrid.h	Sun Feb 04 11:28:40 1996 +0000
@@ -1,7 +1,7 @@
 // FEGrid.h                                                -*- C++ -*-
 /*
 
-Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton
+Copyright (C) 1996 John W. Eaton
 
 This file is part of Octave.
 
@@ -32,25 +32,38 @@
 
 #include "dColVector.h"
 
-class FEGrid
+class
+FEGrid
 {
-private:
-
-  void error (const char* msg) const;
-  void nel_error (void) const;
-
-  void check_grid (void) const;
-
 public:
 
-  FEGrid (void) { }
-  FEGrid (const ColumnVector& elbnds) : elem (elbnds) { check_grid (); }
+  FEGrid (void)
+    : elem () { }
+
+  FEGrid (const ColumnVector& elbnds)
+    : elem (elbnds) { check_grid (); }
+
   FEGrid (int nel, double width);
+
   FEGrid (int nel, double left, double right);
 
+  FEGrid (const FEGrid& a)
+    : elem (a.elem) { }
+
+  FEGrid& operator = (const FEGrid& a)
+    {
+      if (this != &a)
+	elem = a.elem;
+
+      return *this;
+    }
+
+  ~FEGrid (void) { }
+
   int element (double x) const;
 
   double left (void) const { return elem.elem (0); }
+
   double right (void) const { return elem.elem (elem.capacity () - 1); }
 
   int in_bounds (double x) const { return (x >= left () && x <= right ()); }
@@ -62,6 +75,13 @@
 protected:
 
   ColumnVector elem;
+
+private:
+
+  void error (const char* msg) const;
+  void nel_error (void) const;
+
+  void check_grid (void) const;
 };
 
 #endif
--- a/liboctave/FSQP.h	Sun Feb 04 11:09:09 1996 +0000
+++ b/liboctave/FSQP.h	Sun Feb 04 11:28:40 1996 +0000
@@ -1,7 +1,7 @@
 // FSQP.h                                                -*- C++ -*-
 /*
 
-Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton
+Copyright (C) 1996 John W. Eaton
 
 This file is part of Octave.
 
@@ -32,7 +32,8 @@
 
 #include "NLP.h"
 
-class FSQP : public NLP
+class
+FSQP : public NLP
 {
 };
 
--- a/liboctave/LP.h	Sun Feb 04 11:09:09 1996 +0000
+++ b/liboctave/LP.h	Sun Feb 04 11:28:40 1996 +0000
@@ -31,21 +31,22 @@
 
 class LP : public base_minimizer
 {
- public:
+public:
 
-  LP (void) : base_minimizer () { }
+  LP (void)
+    : base_minimizer (), c (), bnds (), lc () { }
 
   LP (const ColumnVector& c_arg)
-    : base_minimizer (), c (c_arg) { }
+    : base_minimizer (), c (c_arg), bnds (), lc () { }
 
   LP (const ColumnVector& c_arg, const Bounds& b)
-    : base_minimizer (), c (c_arg), bnds (b) { }
+    : base_minimizer (), c (c_arg), bnds (b), lc () { }
 
   LP (const ColumnVector& c_arg, const Bounds& b, const LinConst& l)
     : base_minimizer (), c (c_arg), bnds (b), lc (l) { }
 
   LP (const ColumnVector& c_arg, const LinConst& l)
-    : base_minimizer (), c (c_arg), lc (l) { }
+    : base_minimizer (), c (c_arg), bnds (), lc (l) { }
 
   LP (const LP& a)
     : base_minimizer (a), c (a.c), bnds (a.bnds), lc (a.lc) { }
@@ -65,7 +66,13 @@
 
   ~LP (void) { }
 
- protected:
+  ColumnVector linear_obj_coeff (void) const { return c; }
+
+  Bounds bounds (void) const { return bnds; }
+
+  LinConst linear_constraints (void) const { return lc; }
+
+protected:
 
   ColumnVector c;
   Bounds bnds;
--- a/liboctave/LPsolve.h	Sun Feb 04 11:09:09 1996 +0000
+++ b/liboctave/LPsolve.h	Sun Feb 04 11:28:40 1996 +0000
@@ -32,9 +32,10 @@
 
 #include "LP.h"
 
-class LPsolve : public LP
+class
+LPsolve : public LP
 {
- public:
+public:
 
   LPsolve (void)
     : LP () { }
@@ -57,9 +58,8 @@
   LPsolve& operator = (const LPsolve& a)
     {
       if (this != &a)
-	{
-	  LP::operator = (a);
-	}
+	LP::operator = (a);
+
       return *this;
     }
 
--- a/liboctave/LSODE.cc	Sun Feb 04 11:09:09 1996 +0000
+++ b/liboctave/LSODE.cc	Sun Feb 04 11:28:40 1996 +0000
@@ -425,116 +425,6 @@
   return retval;
 }
 
-LSODE_options::LSODE_options (void)
-{
-  init ();
-}
-
-LSODE_options::LSODE_options (const LSODE_options& opt)
-{
-  copy (opt);
-}
-
-LSODE_options&
-LSODE_options::operator = (const LSODE_options& opt)
-{
-  if (this != &opt)
-    copy (opt);
-
-  return *this;
-}
-
-LSODE_options::~LSODE_options (void)
-{
-}
-
-void
-LSODE_options::init (void)
-{
-  double sqrt_eps = sqrt (DBL_EPSILON);
-  x_absolute_tolerance = sqrt_eps;
-  x_initial_step_size = -1.0;
-  x_maximum_step_size = -1.0;
-  x_minimum_step_size = 0.0;
-  x_relative_tolerance = sqrt_eps;
-}
-
-void
-LSODE_options::copy (const LSODE_options& opt)
-{
-  x_absolute_tolerance = opt.x_absolute_tolerance;
-  x_initial_step_size = opt.x_initial_step_size;
-  x_maximum_step_size = opt.x_maximum_step_size;
-  x_minimum_step_size = opt.x_minimum_step_size;
-  x_relative_tolerance = opt.x_relative_tolerance;
-}
-
-void
-LSODE_options::set_default_options (void)
-{
-  init ();
-}
-
-void
-LSODE_options::set_absolute_tolerance (double val)
-{
-  x_absolute_tolerance = (val > 0.0) ? val : sqrt (DBL_EPSILON);
-}
-
-void
-LSODE_options::set_initial_step_size (double val)
-{
-  x_initial_step_size = (val >= 0.0) ? val : -1.0;
-}
-
-void
-LSODE_options::set_maximum_step_size (double val)
-{
-  x_maximum_step_size = (val >= 0.0) ? val : -1.0;
-}
-
-void
-LSODE_options::set_minimum_step_size (double val)
-{
-  x_minimum_step_size = (val >= 0.0) ? val : 0.0;
-}
-
-void
-LSODE_options::set_relative_tolerance (double val)
-{
-  x_relative_tolerance = (val > 0.0) ? val : sqrt (DBL_EPSILON);
-}
-
-double
-LSODE_options::absolute_tolerance (void)
-{
-  return x_absolute_tolerance;
-}
-
-double
-LSODE_options::initial_step_size (void)
-{
-  return x_initial_step_size;
-}
-
-double
-LSODE_options::maximum_step_size (void)
-{
-  return x_maximum_step_size;
-}
-
-double
-LSODE_options::minimum_step_size (void)
-{
-  return x_minimum_step_size;
-}
-
-double
-LSODE_options::relative_tolerance (void)
-{
-  return x_relative_tolerance;
-}
-
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***
--- a/liboctave/LSODE.h	Sun Feb 04 11:09:09 1996 +0000
+++ b/liboctave/LSODE.h	Sun Feb 04 11:28:40 1996 +0000
@@ -32,37 +32,82 @@
 class ostream;
 #endif
 
+#include <cmath>
+
 #include "ODE.h"
 
-class LSODE_options
+class
+LSODE_options
 {
- public:
+public:
+
+  LSODE_options (void) { init (); }
 
-  LSODE_options (void);
-  LSODE_options (const LSODE_options& opt);
+  LSODE_options (const LSODE_options& opt) { copy (opt); }
+
+  LSODE_options& operator = (const LSODE_options& opt)
+    {
+      if (this != &opt)
+	copy (opt);
 
-  LSODE_options& operator = (const LSODE_options& opt);
+      return *this;
+    }
+
+  ~LSODE_options (void) { }
 
-  ~LSODE_options (void);
+  void init (void)
+    {
+      double sqrt_eps = ::sqrt (DBL_EPSILON);
 
-  void init (void);
-  void copy (const LSODE_options& opt);
+      x_absolute_tolerance = sqrt_eps;
+      x_initial_step_size = -1.0;
+      x_maximum_step_size = -1.0;
+      x_minimum_step_size = 0.0;
+      x_relative_tolerance = sqrt_eps;
+    }
 
-  void set_default_options (void);
+  void copy (const LSODE_options& opt)
+    {
+      x_absolute_tolerance = opt.x_absolute_tolerance;
+      x_initial_step_size = opt.x_initial_step_size;
+      x_maximum_step_size = opt.x_maximum_step_size;
+      x_minimum_step_size = opt.x_minimum_step_size;
+      x_relative_tolerance = opt.x_relative_tolerance;
+    }
 
-  void set_absolute_tolerance (double);
-  void set_initial_step_size (double);
-  void set_maximum_step_size (double);
-  void set_minimum_step_size (double);
-  void set_relative_tolerance (double);
+  void set_default_options (void) { init (); }
+
+  void set_absolute_tolerance (double val)
+    { x_absolute_tolerance = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); }
+
+  void set_initial_step_size (double val)
+    { x_initial_step_size = (val >= 0.0) ? val : -1.0; }
+
+  void set_maximum_step_size (double val)
+    { x_maximum_step_size = (val >= 0.0) ? val : -1.0; }
 
-  double absolute_tolerance (void);
-  double initial_step_size (void);
-  double maximum_step_size (void);
-  double minimum_step_size (void);
-  double relative_tolerance (void);
+  void set_minimum_step_size (double val)
+    { x_minimum_step_size = (val >= 0.0) ? val : 0.0; }
+
+  void set_relative_tolerance (double val)
+    { x_relative_tolerance = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); }
+
+  double absolute_tolerance (void)
+    { return x_absolute_tolerance; }
 
- private:
+  double initial_step_size (void)
+    { return x_initial_step_size; }
+
+  double maximum_step_size (void)
+    { return x_maximum_step_size; }
+
+  double minimum_step_size (void)
+    { return x_minimum_step_size; }
+
+  double relative_tolerance (void)
+    {  return x_relative_tolerance; }
+
+private:
 
   double x_absolute_tolerance;
   double x_initial_step_size;
@@ -71,7 +116,8 @@
   double x_relative_tolerance;
 };
 
-class LSODE : public ODE, public LSODE_options
+class
+LSODE : public ODE, public LSODE_options
 {
 public: