Mercurial > hg > octave-nkf
diff liboctave/randgamma.c @ 15018:3d8ace26c5b4
maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
* Array-util.cc, Array.cc, Array.h, CMatrix.cc, CNDArray.cc, CSparse.cc,
CmplxQR.cc, CollocWt.cc, DASPK.cc, DASRT.cc, DASSL.cc, EIG.cc, LSODE.cc,
MSparse.cc, MatrixType.cc, Sparse-op-defs.h, Sparse-perm-op-defs.h, Sparse.cc,
Sparse.h, SparseCmplxCHOL.cc, SparseCmplxLU.cc, SparseCmplxQR.cc, SparseQR.cc,
SparsedbleCHOL.cc, SparsedbleLU.cc, boolSparse.cc, cmd-hist.cc, dDiagMatrix.cc,
dMatrix.cc, dNDArray.cc, dSparse.cc, data-conv.cc, dbleQR.cc, dbleSVD.cc,
dim-vector.cc, eigs-base.cc, f2c-main.c, fCMatrix.cc, fCNDArray.cc,
fCmplxQR.cc, fEIG.cc, fMatrix.cc, fNDArray.cc, floatQR.cc, floatSVD.cc,
idx-vector.cc, kpse.cc, lo-specfun.cc, mx-inlines.cc, mx-op-defs.h,
oct-alloc.cc, oct-binmap.h, oct-fftw.cc, oct-group.h, oct-inttypes.cc,
oct-inttypes.h, oct-locbuf.cc, oct-md5.cc, oct-rand.cc, oct-sort.cc,
oct-syscalls.cc, randgamma.c, randmtzig.c, randpoisson.c, sparse-base-chol.cc,
sparse-base-lu.cc, sparse-dmsolve.cc, str-vec.cc, str-vec.h, tempnam.c,
tempname.c: Use Octave coding conventions for cuddled parentheses in liboctave/.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 26 Jul 2012 08:13:22 -0700 |
parents | 460a3c6d8bf1 |
children |
line wrap: on
line diff
--- a/liboctave/randgamma.c +++ b/liboctave/randgamma.c @@ -25,8 +25,8 @@ /* -double randg(a) -void fill_randg(a,n,x) +double randg (a) +void fill_randg (a,n,x) Generate a series of standard gamma distributions. @@ -99,9 +99,9 @@ oct_fill_randg (double a, octave_idx_type n, double *r) { octave_idx_type i; - /* If a < 1, start by generating gamma(1+a) */ + /* If a < 1, start by generating gamma (1+a) */ const double d = (a < 1. ? 1.+a : a) - 1./3.; - const double c = 1./sqrt(9.*d); + const double c = 1./sqrt (9.*d); /* Handle invalid cases */ if (a <= 0 || INFINITE(a)) @@ -122,7 +122,7 @@ goto restart; /* rare, so don't bother moving up */ u = RUNI; xsq = x*x; - if (u >= 1.-0.0331*xsq*xsq && log(u) >= 0.5*xsq + d*(1-v+log(v))) + if (u >= 1.-0.0331*xsq*xsq && log (u) >= 0.5*xsq + d*(1-v+log (v))) goto restart; r[i] = d*v; } @@ -130,7 +130,7 @@ { /* Use gamma(a) = gamma(1+a)*U^(1/a) */ /* Given REXP = -log(U) then U^(1/a) = exp(-REXP/a) */ for (i = 0; i < n; i++) - r[i] *= exp(-REXP/a); + r[i] *= exp (-REXP/a); } } @@ -138,7 +138,7 @@ oct_randg (double a) { double ret; - oct_fill_randg(a,1,&ret); + oct_fill_randg (a,1,&ret); return ret; } @@ -157,7 +157,7 @@ octave_idx_type i; /* If a < 1, start by generating gamma(1+a) */ const float d = (a < 1. ? 1.+a : a) - 1./3.; - const float c = 1./sqrt(9.*d); + const float c = 1./sqrt (9.*d); /* Handle invalid cases */ if (a <= 0 || INFINITE(a)) @@ -178,7 +178,7 @@ goto frestart; /* rare, so don't bother moving up */ u = RUNI; xsq = x*x; - if (u >= 1.-0.0331*xsq*xsq && log(u) >= 0.5*xsq + d*(1-v+log(v))) + if (u >= 1.-0.0331*xsq*xsq && log (u) >= 0.5*xsq + d*(1-v+log (v))) goto frestart; r[i] = d*v; } @@ -186,7 +186,7 @@ { /* Use gamma(a) = gamma(1+a)*U^(1/a) */ /* Given REXP = -log(U) then U^(1/a) = exp(-REXP/a) */ for (i = 0; i < n; i++) - r[i] *= exp(-REXP/a); + r[i] *= exp (-REXP/a); } } @@ -194,6 +194,6 @@ oct_float_randg (float a) { float ret; - oct_fill_float_randg(a,1,&ret); + oct_fill_float_randg (a,1,&ret); return ret; }