# HG changeset patch # User jwe # Date 1082131043 0 # Node ID c4cefcb802dabbb5687ec5a3f789973248b3b66f # Parent a0997c4d1d54757142abe05249b7dd041dd13212 [project @ 2004-04-16 15:57:23 by jwe] diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2004-04-16 John W. Eaton + + * elfun/gcd.m: Delete. + 2004-04-15 David Bateman * set/create_set.m, general/is_duplicate_entry.m: Make N-d array aware. diff --git a/scripts/elfun/gcd.m b/scripts/elfun/gcd.m deleted file mode 100644 --- a/scripts/elfun/gcd.m +++ /dev/null @@ -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 -## 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 diff --git a/scripts/statistics/distributions/binomial_rnd.m b/scripts/statistics/distributions/binomial_rnd.m --- a/scripts/statistics/distributions/binomial_rnd.m +++ b/scripts/statistics/distributions/binomial_rnd.m @@ -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 diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2004-04-16 John W. Eaton + + * Makefile.in (DLD_XSRC): Add gcd.cc to the list. + +2004-04-16 David Bateman + + * DLD-FUNCTIONS/gcd.cc: New file. + 2004-04-15 David Bateman * src/ov-ch-mat.h: convert_to_str_interal returns charNDArray. diff --git a/src/Makefile.in b/src/Makefile.in --- a/src/Makefile.in +++ b/src/Makefile.in @@ -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 diff --git a/test/octave.test/arith/arith.exp b/test/octave.test/arith/arith.exp --- a/test/octave.test/arith/arith.exp +++ b/test/octave.test/arith/arith.exp @@ -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