diff liboctave/Bounds.h @ 1528:dc527156c38c

[project @ 1995-10-05 01:44:18 by jwe]
author jwe
date Thu, 05 Oct 1995 01:45:30 +0000
parents 611d403c7f3d
children 51fd6b03c3bb
line wrap: on
line diff
--- a/liboctave/Bounds.h	Thu Oct 05 01:44:18 1995 +0000
+++ b/liboctave/Bounds.h	Thu Oct 05 01:45:30 1995 +0000
@@ -32,51 +32,98 @@
 
 #include "dColVector.h"
 
-#ifndef Vector
-#define Vector ColumnVector
-#endif
-
 class Bounds
 {
 public:
 
-  Bounds (void);
-  Bounds (int n);
-  Bounds (const Vector lb, const Vector ub);
-  Bounds (const Bounds& a);
+  Bounds (void) { nb = 0; }
+
+  Bounds (int n) : lb (nb, 0.0), ub (nb, 0.0) { nb = n; }
+
+  Bounds (const ColumnVector lb, const ColumnVector ub);
 
-  Bounds& operator = (const Bounds& a);
+  Bounds (const Bounds& a)
+    {
+      nb = a.size ();
+      lb = a.lower_bounds ();
+      ub = a.upper_bounds ();
+    }
+
+  Bounds& operator = (const Bounds& a)
+    {
+      nb = a.size ();
+      lb = a.lower_bounds ();
+      ub = a.upper_bounds ();
 
-  Bounds& resize (int n);
+      return *this;
+    }
+
+  Bounds& resize (int n)
+    {
+      nb = n;
+      lb.resize (nb);
+      ub.resize (nb);
 
-  double lower_bound (int index) const;
-  double upper_bound (int index) const;
+      return *this;
+    }
 
-  Vector lower_bounds (void) const;
-  Vector upper_bounds (void) const;
+  double lower_bound (int index) const { return lb.elem (index); }
+  double upper_bound (int index) const { return ub.elem (index); }
+
+  ColumnVector lower_bounds (void) const { return lb; }
+  ColumnVector upper_bounds (void) const { return ub; }
+
+  int size (void) const { return nb; }
 
-  int size (void) const;
+  Bounds& set_bound (int index, double low, double high)
+    {
+      lb.elem (index) = low;
+      ub.elem (index) = high;
+      return *this;
+    }
 
-  Bounds& set_bound (int index, double low, double high);
+  Bounds& set_bounds (double low, double high)
+    {
+      lb.fill (low);
+      ub.fill (high);
+      return *this;
+    }
 
-  Bounds& set_bounds (double low, double high);
-  Bounds& set_bounds (const Vector lb, const Vector ub);
+  Bounds& set_bounds (const ColumnVector lb, const ColumnVector ub);
 
-  Bounds& set_lower_bound (int index, double low);
-  Bounds& set_upper_bound (int index, double high);
+  Bounds& set_lower_bound (int index, double low)
+    {
+      lb.elem (index) = low;
+      return *this;
+    }
+
+  Bounds& set_upper_bound (int index, double high)
+    {
+      ub.elem (index) = high;
+      return *this;
+    }
 
-  Bounds& set_lower_bounds (double low);
-  Bounds& set_upper_bounds (double high);
+  Bounds& set_lower_bounds (double low)
+    {
+      lb.fill (low);
+      return *this;
+    }
 
-  Bounds& set_lower_bounds (const Vector lb);
-  Bounds& set_upper_bounds (const Vector ub);
+  Bounds& set_upper_bounds (double high)
+    {
+      ub.fill (high);
+      return *this;
+    }
+
+  Bounds& set_lower_bounds (const ColumnVector lb);
+  Bounds& set_upper_bounds (const ColumnVector ub);
 
   friend ostream& operator << (ostream& os, const Bounds& b);
 
 protected:
 
-  Vector lb;
-  Vector ub;
+  ColumnVector lb;
+  ColumnVector ub;
 
   int nb;