changeset 1869:51fd6b03c3bb

[project @ 1996-02-04 11:47:32 by jwe]
author jwe
date Sun, 04 Feb 1996 11:52:19 +0000
parents 6822f1ccec47
children 34c0a016c6f0
files liboctave/Bounds.cc liboctave/Bounds.h liboctave/CollocWt.h
diffstat 3 files changed, 60 insertions(+), 127 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/Bounds.cc
+++ b/liboctave/Bounds.cc
@@ -42,19 +42,6 @@
   (*current_liboctave_error_handler) ("fatal bounds error: ", msg);
 }
 
-Bounds::Bounds (const ColumnVector l, const ColumnVector u)
-{
-  if (l.capacity () != u.capacity ())
-    {
-      error ("inconsistent sizes for lower and upper bounds");
-      return;
-    }
-
-  nb = l.capacity ();
-  lb = l;
-  ub = u;
-}
-
 Bounds&
 Bounds::set_bounds (const ColumnVector l, const ColumnVector u)
 {
--- a/liboctave/Bounds.h
+++ b/liboctave/Bounds.h
@@ -1,7 +1,7 @@
 // Bounds.h                                                -*- C++ -*-
 /*
 
-Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton
+Copyright (C) 1996 John W. Eaton
 
 This file is part of Octave.
 
@@ -32,37 +32,46 @@
 
 #include "dColVector.h"
 
-class Bounds
+class
+Bounds
 {
 public:
 
-  Bounds (void) { nb = 0; }
+  Bounds (void)
+    : lb (), ub () { }
+
+  Bounds (int n)
+    : lb (n, 0.0), ub (n, 0.0) { }
 
-  Bounds (int n) : lb (nb, 0.0), ub (nb, 0.0) { nb = n; }
-
-  Bounds (const ColumnVector lb, const ColumnVector ub);
+  Bounds (const ColumnVector l, const ColumnVector u)
+    : lb (l), ub (u)
+      {
+        if (lb.capacity () != ub.capacity ())
+	  {
+	    error ("inconsistent sizes for lower and upper bounds");
+	    return;
+	  }
+      }
 
   Bounds (const Bounds& a)
-    {
-      nb = a.size ();
-      lb = a.lower_bounds ();
-      ub = a.upper_bounds ();
-    }
+    : lb (a.lb), ub (a.ub) { }
 
   Bounds& operator = (const Bounds& a)
     {
-      nb = a.size ();
-      lb = a.lower_bounds ();
-      ub = a.upper_bounds ();
-
+      if (this != &a)
+	{
+	  lb = a.lower_bounds ();
+	  ub = a.upper_bounds ();
+	}
       return *this;
     }
 
+  ~Bounds (void) { }
+
   Bounds& resize (int n)
     {
-      nb = n;
-      lb.resize (nb);
-      ub.resize (nb);
+      lb.resize (n);
+      ub.resize (n);
 
       return *this;
     }
@@ -73,7 +82,7 @@
   ColumnVector lower_bounds (void) const { return lb; }
   ColumnVector upper_bounds (void) const { return ub; }
 
-  int size (void) const { return nb; }
+  int size (void) const { return lb.capacity (); }
 
   Bounds& set_bound (int index, double low, double high)
     {
@@ -125,12 +134,9 @@
   ColumnVector lb;
   ColumnVector ub;
 
-  int nb;
-
 private:
 
   void error (const char *msg);
-
 };
 
 #endif
--- a/liboctave/CollocWt.h
+++ b/liboctave/CollocWt.h
@@ -1,7 +1,7 @@
 // CollocWt.h                                                -*- C++ -*-
 /*
 
-Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton
+Copyright (C) 1996 John W. Eaton
 
 This file is part of Octave.
 
@@ -33,118 +33,59 @@
 #include "dMatrix.h"
 #include "dColVector.h"
 
-class CollocWt
+class
+CollocWt
 {
 public:
 
   CollocWt::CollocWt (void)
-    {
-      n = 0;
-      inc_left = 0;
-      inc_right = 0;
-      lb = 0.0;
-      rb = 1.0;
-
-      Alpha = 0.0;
-      Beta = 0.0;
-
-      initialized = 0;
-    }
+    : n (0), inc_left (0), inc_right (0), lb (0.0), rb (1.0),
+      Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (0) { }
 
   CollocWt::CollocWt (int nc, int il, int ir)
-    {
-      n = nc;
-      inc_left = il;
-      inc_right = ir;
-      lb = 0.0;
-      rb = 1.0;
-
-      Alpha = 0.0;
-      Beta = 0.0;
-
-      initialized = 0;
-    }
+    : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0),
+      Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (0) { }
 
   CollocWt::CollocWt (int nc, int il, int ir, double l, double r)
-    {
-      n = nc;
-      inc_left = il;
-      inc_right = ir;
-      lb = l;
-      rb = r;
-
-      Alpha = 0.0;
-      Beta = 0.0;
-
-      initialized = 0;
-    }
+    : n (nc), inc_left (il), inc_right (ir), lb (l), rb (r),
+      Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (0) { }
 
   CollocWt::CollocWt (int nc, double a, double b, int il, int ir)
-    {
-      n = nc;
-      inc_left = il;
-      inc_right = ir;
-      lb = 0.0;
-      rb = 1.0;
-
-      Alpha = a;
-      Beta = b;
-
-      initialized = 0;
-    }
+    : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0),
+      Alpha (a), Beta (b), initialized (0) { }
 
   CollocWt::CollocWt (int nc, double a, double b, int il, int ir,
 		      double l, double r)  
-    {
-      n = nc;
-      inc_left = il;
-      inc_right = ir;
-      lb = l;
-      rb = r;
-
-      Alpha = a;
-      Beta = b;
-
-      initialized = 0;
-    }
+    : n (nc), inc_left (il), inc_right (ir), lb (l), rb (r),
+      Alpha (a), Beta (b), r (), q (), A (), B (), initialized (0) { }
 
   CollocWt::CollocWt (const CollocWt& a)
-    {
-      n = a.n;
-      inc_left = a.inc_left;
-      inc_right = a.inc_right;
-      lb = a.lb;
-      rb = a.rb;
-      r = a.r;
-      q = a.q;
-      A = a.A;
-      B = a.B;
-
-      nt = n + inc_left + inc_right;
-
-      initialized = a.initialized;
-    }
+    : n (a.n), inc_left (a.inc_left), inc_right (a.inc_right),
+      lb (a.lb), rb (a.rb), Alpha (a.Alpha), Beta (a.Beta),
+      r (a.r), q (a.q), A (a.A), B (a.B),
+      initialized (a.initialized) { } 
 
   CollocWt&
   CollocWt::operator = (const CollocWt& a)
     {
-      n = a.n;
-      inc_left = a.inc_left;
-      inc_right = a.inc_right;
-      lb = a.lb;
-      rb = a.rb;
-      r = a.r;
-      q = a.q;
-      A = a.A;
-      B = a.B;
-
-      nt = a.nt;
-
-      initialized = a.initialized;
-
+      if (this != &a)
+	{
+	  n = a.n;
+	  inc_left = a.inc_left;
+	  inc_right = a.inc_right;
+	  lb = a.lb;
+	  rb = a.rb;
+	  r = a.r;
+	  q = a.q;
+	  A = a.A;
+	  B = a.B;
+	  initialized = a.initialized;
+	}
       return *this;
     }
 
+  ~CollocWt (void) { }
+
   CollocWt& resize (int ncol)
     {
       n = ncol;
@@ -225,7 +166,6 @@
 protected:
 
   int n;
-  int nt;
 
   int inc_left;
   int inc_right;