Mercurial > hg > octave-lojdl
changeset 3175:096940972434
[project @ 1998-05-18 17:03:01 by jwe]
author | jwe |
---|---|
date | Mon, 18 May 1998 17:03:02 +0000 |
parents | 390d5e396682 |
children | fccab8e7d35f |
files | scripts/ChangeLog scripts/linear-algebra/dot.m scripts/plot/__plt2mv__.m scripts/plot/hist.m scripts/plot/oneplot.m scripts/strings/deblank.m scripts/strings/isletter.m scripts/strings/lower.m scripts/strings/upper.m |
diffstat | 9 files changed, 145 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,26 @@ +Mon May 18 11:42:36 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * linear-algebra/dot.m: New function. + + * strings/lower.m, strings/upper.m: New functions, for Matlab + compatibility. + +Fri May 15 01:16:53 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * plot/hist.m: Also allow just one output argument. + +Sun May 10 23:00:45 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * strings/deblank.m: Make it work if the string is only blanks. + +Tue May 5 00:53:36 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * plot/__plt2mv__.m: Delete calls to keyboard. + +Mon May 4 11:43:31 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * plot/oneplot.m: Fix typo. + Wed Apr 22 12:11:27 1998 John W. Eaton <jwe@bevo.che.wisc.edu> * miscellaneous/flops.m: Allow a single argument too.
new file mode 100644 --- /dev/null +++ b/scripts/linear-algebra/dot.m @@ -0,0 +1,49 @@ +## Copyright (C) 1998 John W. Eaton +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this file. If not, write to the Free Software Foundation, +## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +## usage: dot (x, y) +## +## Computes the dot product of two vectors. + +## Author: jwe + +function z = dot (x, y) + + if (nargin != 2) + usage ("dot (x, y)"); + endif + + if (is_vector (x) && is_vector (y) && length (x) == length (y)) + [x_nr, x_nc] = size (x); + [y_nr, y_nc] = size (y); + if (x_nr == 1) + if (y_nr == 1) + z = x * y'; + else + z = x * y; + endif + else + if (y_nr == 1) + z = y * x'; + else + z = y * x; + endif + endif + else + error ("dot: both arguments must be vectors of the same length"); + endif + +endfunction
--- a/scripts/plot/__plt2mv__.m +++ b/scripts/plot/__plt2mv__.m @@ -21,7 +21,6 @@ function __plt2mv__ (x, y, fmt) - keyboard if (nargin < 2 || nargin > 3) msg = sprintf ("__plt2mv__ (x, y)\n"); msg = sprintf ("%s __plt2mv__ (x, y, fmt)", msg); @@ -55,7 +54,6 @@ fmt_nr = rows (fmt); if (x_nc > 0) tmp = [x, y]; - keyboard cmd = sprintf ("gplot tmp(:,%d:%d:%d) %s", 1, x_nc, x_nc+1, deblank (fmt (k, :))); if (k < fmt_nr)
--- a/scripts/plot/hist.m +++ b/scripts/plot/hist.m @@ -90,7 +90,7 @@ endfor freq (n) = sum (y >= cutoff (n-1)); - if (nargout == 2) + if (nargout > 0) nn = freq; xx = x; else
--- a/scripts/plot/oneplot.m +++ b/scripts/plot/oneplot.m @@ -40,7 +40,7 @@ gset size 1, 1; gset origin 0, 0; __multiplot_mode__ = 0; - gnuplot_command_replot "rep"; + gnuplot_command_replot = "rep"; clearplot; endif
--- a/scripts/strings/deblank.m +++ b/scripts/strings/deblank.m @@ -37,6 +37,8 @@ if (len == 0) t = s; + elseif (s == " ") + t = ""; else s = reshape (s, 1, len); k = max (find (s != " "));
--- a/scripts/strings/isletter.m +++ b/scripts/strings/isletter.m @@ -1,4 +1,4 @@ -## Copyright (C) 1996 John W. Eaton +## Copyright (C) 1998 John W. Eaton ## ## This file is part of Octave. ##
new file mode 100644 --- /dev/null +++ b/scripts/strings/lower.m @@ -0,0 +1,34 @@ +## Copyright (C) 1998 John W. Eaton +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. + +## usage: lower (s) +## +## See also: tolower + +## Author: jwe + +function retval = lower (s) + + if (nargin != 1) + usage ("lower (s)"); + endif + + retval = tolower (s); + +endfunction
new file mode 100644 --- /dev/null +++ b/scripts/strings/upper.m @@ -0,0 +1,34 @@ +## Copyright (C) 1998 John W. Eaton +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. + +## usage: upper (s) +## +## See also: toupper + +## Author: jwe + +function retval = upper (s) + + if (nargin != 1) + usage ("upper (s)"); + endif + + retval = toupper (s); + +endfunction