changeset 4863:c4cefcb802da

[project @ 2004-04-16 15:57:23 by jwe]
author jwe
date Fri, 16 Apr 2004 15:57:23 +0000
parents a0997c4d1d54
children d49d761c8c93
files scripts/ChangeLog scripts/elfun/gcd.m scripts/statistics/distributions/binomial_rnd.m src/ChangeLog src/Makefile.in test/octave.test/arith/arith.exp
diffstat 6 files changed, 15 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Thu Apr 15 21:14:44 2004 +0000
+++ b/scripts/ChangeLog	Fri Apr 16 15:57:23 2004 +0000
@@ -1,3 +1,7 @@
+2004-04-16  John W. Eaton  <jwe@octave.org>
+
+	* elfun/gcd.m: Delete.
+
 2004-04-15  David Bateman  <dbateman@free.fr>
 
 	* set/create_set.m, general/is_duplicate_entry.m: Make N-d array aware.
--- a/scripts/elfun/gcd.m	Thu Apr 15 21:14:44 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-## Copyright (C) 1996, 1997 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.
-
-## -*- texinfo -*-
-## @deftypefn {Mapping Function} {} gcd (@var{x}, @code{...})
-## Compute the greatest common divisor of the elements of @var{x}, or the
-## list of all the arguments.  For example,
-##
-## @example
-## gcd (a1, ..., ak)
-## @end example
-##
-## @noindent
-## is the same as
-##
-## @example
-## gcd ([a1, ..., ak])
-## @end example
-##
-## An optional second return value, @var{v}
-## contains an integer vector such that
-##
-## @example
-## g = v(1) * a(k) + ... + v(k) * a(k)
-## @end example
-## @end deftypefn
-## @seealso{lcm, min, max, ceil, and floor}
-
-## Author: KH <Kurt.Hornik@ci.tuwien.ac.at>
-## Created: 16 September 1994
-## Adapted-By: jwe
-
-function [g, v] = gcd (a, varargin)
-
-  if (nargin == 0)
-    usage ("[g, v] = gcd (a, ...)");
-  endif
-
-  if (nargin > 1)
-    k = 1;
-    for i = 2:nargin
-      a = [a, varargin{k++}];
-    endfor
-  endif
-
-  if (round (a) != a)
-    error ("gcd: all arguments must be integer");
-  endif
-
-  g = abs (a(1));
-  v = sign (a(1));
-  for k = 1:(length (a) - 1)
-    x = [g, 1, 0];
-    y = [(abs (a(k+1))), 0, 1];
-    while (y(1) > 0)
-      r = x - y * floor (x(1) / y(1));
-      x = y;
-      y = r;
-    endwhile
-    g = x(1);
-    v = [x(2) * v, x(3) * (sign (a(k+1)))];
-  endfor
-
-endfunction
--- a/scripts/statistics/distributions/binomial_rnd.m	Thu Apr 15 21:14:44 2004 +0000
+++ b/scripts/statistics/distributions/binomial_rnd.m	Fri Apr 16 15:57:23 2004 +0000
@@ -82,9 +82,7 @@
     else
       nel = prod (sz);
       tmp = rand (n, nel);
-      ind = (1 : n)' * ones (1, nel);
-      rnd = sum ((tmp < ones (n, nel) * p) &
-                    (ind <= ones (n, nel) * n));
+      rnd = tmp < ones (n, nel) * p;
       rnd = reshape(rnd, sz);
     endif
   else
--- a/src/ChangeLog	Thu Apr 15 21:14:44 2004 +0000
+++ b/src/ChangeLog	Fri Apr 16 15:57:23 2004 +0000
@@ -1,3 +1,11 @@
+2004-04-16  John W. Eaton  <jwe@octave.org>
+
+	* Makefile.in (DLD_XSRC): Add gcd.cc to the list.
+
+2004-04-16  David Bateman  <dbateman@free.fr>
+
+	* DLD-FUNCTIONS/gcd.cc: New file.
+
 2004-04-15  David Bateman  <dbateman@free.fr>
 
 	* src/ov-ch-mat.h: convert_to_str_interal returns charNDArray.
--- a/src/Makefile.in	Thu Apr 15 21:14:44 2004 +0000
+++ b/src/Makefile.in	Fri Apr 16 15:57:23 2004 +0000
@@ -46,7 +46,7 @@
 DLD_XSRC := balance.cc besselj.cc betainc.cc chol.cc colloc.cc \
 	daspk.cc dasrt.cc dassl.cc det.cc eig.cc expm.cc fft.cc fft2.cc \
 	fftn.cc fftw_wisdom.cc filter.cc find.cc fsolve.cc gammainc.cc \
-	getgrent.cc getpwent.cc getrusage.cc givens.cc hess.cc \
+	gcd.cc getgrent.cc getpwent.cc getrusage.cc givens.cc hess.cc \
 	inv.cc kron.cc lpsolve.cc lsode.cc lu.cc minmax.cc \
 	odessa.cc pinv.cc qr.cc quad.cc qz.cc rand.cc schur.cc \
 	sort.cc sqrtm.cc svd.cc syl.cc time.cc
--- a/test/octave.test/arith/arith.exp	Thu Apr 15 21:14:44 2004 +0000
+++ b/test/octave.test/arith/arith.exp	Fri Apr 16 15:57:23 2004 +0000
@@ -137,7 +137,7 @@
 do_test gcd-1.m
 
 set test gcd-2
-set prog_output "^usage:.*"
+set prog_output "\n... gcd:.*"
 do_test gcd-2.m
 
 set test gcd-3