changeset 10765:3952b4c4e44a

merge with main repo
author Jaroslav Hajek <highegg@gmail.com>
date Fri, 02 Jul 2010 10:18:14 +0200
parents e141bcb1befd (current diff) 5faf6832855a (diff)
children f0304c545588
files src/ChangeLog
diffstat 7 files changed, 83 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/doc/ChangeLog	Fri Jul 02 10:10:51 2010 +0200
+++ b/doc/ChangeLog	Fri Jul 02 10:18:14 2010 +0200
@@ -1,3 +1,11 @@
+2010-07-01  Rik <octave@nomad.inbox5.com>
+
+        * refcard/refcard.tex: Fix italic macro typo for stem.
+
+2010-06-28  Rik <octave@nomad.inbox5.com>
+
+        * refcard/refcard.tex: Fix typos in refcard (bug #30260).
+
 2010-06-16  Rik <octave@nomad.inbox5.com>
 
         * ChangeLog: Correctly break lines > 80 characters.
--- a/doc/refcard/refcard.tex	Fri Jul 02 10:10:51 2010 +0200
+++ b/doc/refcard/refcard.tex	Fri Jul 02 10:18:14 2010 +0200
@@ -533,7 +533,7 @@
 
 \sec Sparse Matrices;
 sparse (...)&create a sparse matrix.\cr
-speye ({\it n)}&create sparse identify matrix.\cr
+speye ({\it n)}&create sparse identity matrix.\cr
 sprand ({\it n}, {\it m}, {\it d})&sparse rand matrix of density {\it d}.\cr
 spdiags (...)&sparse generalization of {\it diag}.\cr
 nnz ({\it s})&No. non-zero elements in sparse matrix.\cr
@@ -575,7 +575,7 @@
 
 \sec Global and Persistent Variables;
 global {\it var1} ...&Declare variables global.\cr
-global {\it var1} = {\it val}&Declare variable global. Set intial value.\cr
+global {\it var1} = {\it val}&Declare variable global. Set initial value.\cr
 persistent {\it var1}&Declare a variable as static to a function.\cr
 persistent {\it var1} = {\it val}&Declare a variable as static to a 
   function and set its initial value.\cr
@@ -677,7 +677,7 @@
 \vfill\eject
 
 \sec Paths and Packages;
-path&display the current Octave cunction path.\cr
+path&display the current Octave function path.\cr
 pathdef&display the default path.\cr
 addpath({\it dir})&add a directory to the path.\cr
 EXEC\_PATH&manipulate the Octave executable path.\cr
@@ -771,7 +771,7 @@
 clear {\it pattern}&clear variables matching pattern\cr
 exist ({\it str})&check existence of variable or function\cr
 who, whos&list current variables\cr
-whos {\it var}&details of the varibale {\it var}\cr
+whos {\it var}&details of the variable {\it var}\cr
 \endsec
 
 \sec Basic Matrix Manipulations;
@@ -820,7 +820,7 @@
 pinv ({\it a})&compute pseudoinverse of {\it a}\cr
 qr ({\it a})&compute the QR factorization of a matrix\cr
 rank ({\it a})&matrix rank\cr
-sprank ({\it a})&structrual matrix rank\cr
+sprank ({\it a})&structural matrix rank\cr
 schur ({\it a})&Schur decomposition of a matrix\cr
 svd ({\it a})&singular value decomposition\cr
 syl ({\it a}, {\it b}, {\it c})&solve the Sylvester equation\cr
@@ -854,8 +854,8 @@
 freqz ({\it args})&FIR filter frequency response\cr
 filter ({\it a}, {\it b}, {\it x})&filter by transfer function\cr
 conv ({\it a}, {\it b})&convolve two vectors\cr
-hamming ({\it n})&return Hamming window coefficents\cr
-hanning ({\it n})&return Hanning window coefficents\cr
+hamming ({\it n})&return Hamming window coefficients\cr
+hanning ({\it n})&return Hanning window coefficients\cr
 \endsec
 
 \altsec Image Processing;
@@ -938,7 +938,7 @@
 loglog ({\it args})&2D plot with logarithmic axes\cr
 bar ({\it args})&plot bar charts\cr
 stairs ({\it x}, {\it y})&plot stairsteps\cr
-stem ({\it x}, {it y})&plot a stem graph\cr
+stem ({\it x}, {\it y})&plot a stem graph\cr
 hist ({\it y}, {\it x})&plot histograms\cr
 contour ({\it x}, {\it y}, {\it z})&contour plot\cr
 title ({\it string})&set plot title\cr
--- a/scripts/ChangeLog	Fri Jul 02 10:10:51 2010 +0200
+++ b/scripts/ChangeLog	Fri Jul 02 10:18:14 2010 +0200
@@ -1,3 +1,7 @@
+2010-06-16  Rik <octave@nomad.inbox5.com>
+
+        * plot/stairs.m: Add additional calling forms to documentation.
+
 2010-06-24  John W. Eaton  <jwe@octave.org>
 
 	* plot/private/__plt__.m: Replace usage message with error.
--- a/scripts/plot/stairs.m	Fri Jul 02 10:10:51 2010 +0200
+++ b/scripts/plot/stairs.m	Fri Jul 02 10:18:14 2010 +0200
@@ -18,16 +18,19 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {} stairs (@var{x}, @var{y})
+## @deftypefn  {Function File} {} stairs (@var{y})
+## @deftypefnx {Function File} {} stairs (@var{x}, @var{y})
 ## @deftypefnx {Function File} {} stairs (@dots{}, @var{style})
 ## @deftypefnx {Function File} {} stairs (@dots{}, @var{prop}, @var{val})
 ## @deftypefnx {Function File} {} stairs (@var{h}, @dots{})
 ## @deftypefnx {Function File} {@var{h} =} stairs (@dots{})
+## @deftypefnx {Function File} {[@var{xstep}, @var{ystep}] =} stairs (@dots{})
 ## Produce a stairstep plot.  The arguments may be vectors or matrices.
 ##
 ## If only one argument is given, it is taken as a vector of y-values
 ## and the x coordinates are taken to be the indices of the elements.
 ##
+## If one output argument is requested, return a graphics handle to the plot.
 ## If two output arguments are specified, the data are generated but
 ## not plotted.  For example,
 ##
--- a/src/ChangeLog	Fri Jul 02 10:10:51 2010 +0200
+++ b/src/ChangeLog	Fri Jul 02 10:18:14 2010 +0200
@@ -71,6 +71,23 @@
 
 	* ov-struct.cc (Fcell2struct): Rewrite.
 
+2010-06-30  Jaroslav Hajek  <highegg@gmail.com>
+
+	* ov-range.cc (octave_range::save_ascii): Save length rather than
+	limit when inc is zero. Adjust comment.
+	(octave_range::save_binary, octave_range::save_hdf5): Ditto.
+	(octave_range::load_ascii): Assume limit is length when increment is
+	zero.
+	(octave_range::load_binary, octave_range::load_hdf5): Ditto.
+
+
+2010-06-25  John W. Eaton  <jwe@octave.org>
+
+	* graphics.cc (reset_default_properties): New static function.
+	(root_figure::reset_default_properties,
+	figure::reset_default_properties, axes::reset_default_properties):
+	Use it to avoid duplicated code.
+
 2010-06-24  Rik <octave@nomad.inbox5.com>
 
         * octave.cc: Add [FILE] to octave usage string (bug #30258).
--- a/src/graphics.cc	Fri Jul 02 10:10:51 2010 +0200
+++ b/src/graphics.cc	Fri Jul 02 10:18:14 2010 +0200
@@ -2625,8 +2625,8 @@
 property_list
 root_figure::factory_properties = root_figure::init_factory_properties ();
 
-void
-root_figure::reset_default_properties (void)
+static void
+reset_default_properties (property_list& default_properties)
 {
   property_list new_defaults;
 
@@ -2650,9 +2650,16 @@
             new_defaults.set (prefix + s, q->second);
         }
     }
+
   default_properties = new_defaults;
 }
 
+void
+root_figure::reset_default_properties (void)
+{
+  ::reset_default_properties (default_properties);
+}
+
 // ---------------------------------------------------------------------
 
 void
@@ -2800,29 +2807,7 @@
 void
 figure::reset_default_properties (void)
 {
-  property_list new_defaults;
-
-  for (property_list::plist_map_const_iterator p = default_properties.begin ();
-       p != default_properties.end (); p++)
-    {
-      const property_list::pval_map_type pval_map = p->second;
-      std::string prefix = p->first;
-      
-      for (property_list::pval_map_const_iterator q = pval_map.begin ();
-           q != pval_map.end ();
-           q++)
-        {
-          std::string s = q->first;
-
-          if (prefix == "axes" && (s == "position" || s == "units"))
-            new_defaults.set (prefix + s, q->second);
-          else if (prefix == "figure" && (s == "position" || s == "units" 
-                                          || s == "windowstyle" 
-                                          || s == "paperunits"))
-            new_defaults.set (prefix + s, q->second);
-        }
-    }
-  default_properties = new_defaults;
+  ::reset_default_properties (default_properties);
 }
 
 // ---------------------------------------------------------------------
@@ -4345,29 +4330,7 @@
 void
 axes::reset_default_properties (void)
 {
-  property_list new_defaults;
-
-  for (property_list::plist_map_const_iterator p = default_properties.begin ();
-       p != default_properties.end (); p++)
-    {
-      const property_list::pval_map_type pval_map = p->second;
-      std::string prefix = p->first;
-      
-      for (property_list::pval_map_const_iterator q = pval_map.begin ();
-           q != pval_map.end ();
-           q++)
-        {
-          std::string s = q->first;
-
-          if (prefix == "axes" && (s == "position" || s == "units"))
-            new_defaults.set (prefix + s, q->second);
-          else if (prefix == "figure" && (s == "position" || s == "units" 
-                                          || s == "windowstyle" 
-                                          || s == "paperunits"))
-            new_defaults.set (prefix + s, q->second);
-        }
-    }
-  default_properties = new_defaults;
+  ::reset_default_properties (default_properties);
 }
 
 // ---------------------------------------------------------------------
--- a/src/ov-range.cc	Fri Jul 02 10:10:51 2010 +0200
+++ b/src/ov-range.cc	Fri Jul 02 10:18:14 2010 +0200
@@ -402,11 +402,19 @@
   double base = r.base ();
   double limit = r.limit ();
   double inc = r.inc ();
+  octave_idx_type len = r.nelem ();
 
-  os << "# base, limit, increment\n";
+  if (inc != 0)
+    os << "# base, limit, increment\n";
+  else
+    os << "# base, length, increment\n";
+
   octave_write_double (os, base);
   os << " ";
-  octave_write_double (os, limit);
+  if (inc != 0)
+    octave_write_double (os, limit);
+  else
+    os << len;
   os << " ";
   octave_write_double (os, inc);
   os << "\n";
@@ -420,7 +428,8 @@
   // # base, limit, range comment added by save ().
   skip_comments (is);
 
-  is >> range;
+  double base, limit, inc;
+  is >> base >> limit >> inc;
 
   if (!is)
     {
@@ -428,6 +437,11 @@
       return false;
     }
 
+  if (inc != 0)
+    range = Range (base, limit, inc);
+  else
+    range = Range (base, inc, static_cast<octave_idx_type> (limit));
+
   return true;
 }
 
@@ -440,6 +454,9 @@
   double bas = r.base ();
   double lim = r.limit ();
   double inc = r.inc ();
+  if (inc == 0)
+    lim = r.nelem ();
+
   os.write (reinterpret_cast<char *> (&bas), 8);
   os.write (reinterpret_cast<char *> (&lim), 8);
   os.write (reinterpret_cast<char *> (&inc), 8);
@@ -467,8 +484,11 @@
     return false;
   if (swap)
     swap_bytes<8> (&inc);
-  Range r (bas, lim, inc);
-  range = r;
+  if (inc != 0)
+    range = Range (bas, lim, inc);
+  else
+    range = Range (bas, inc, static_cast<octave_idx_type> (lim));
+
   return true;
 }
 
@@ -525,7 +545,7 @@
   Range r = range_value ();
   double range_vals[3];
   range_vals[0] = r.base ();
-  range_vals[1] = r.limit ();
+  range_vals[1] = r.inc () != 0 ? r.limit () : r.nelem ();
   range_vals[2] = r.inc ();
 
   retval = H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
@@ -575,8 +595,11 @@
                rangevals) >= 0)
     {
       retval = true;
-      Range r (rangevals[0], rangevals[1], rangevals[2]);
-      range = r;
+      if (rangevals[2] != 0)
+        range = Range (rangevals[0], rangevals[1], rangevals[2]);
+      else
+        range = Range (rangevals[0], rangevals[2], 
+                       static_cast<octave_idx_type> (rangevals[1]));
     }
 
   H5Tclose (range_type);