Mercurial > octave-nkf
comparison scripts/statistics/distributions/gaminv.m @ 20644:4e307c55a2b5
Use isempty () rather than any () for faster code in inverse statistical distributions.
betainv.m, binoinv.m, gaminv.m, poissinv.m: Use '! isempty (k)' rather than
'any (k)' for faster code.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 11 Oct 2015 21:09:41 -0700 |
parents | c3c052b9192a |
children |
comparison
equal
deleted
inserted
replaced
20643:d6d04088ac9e | 20644:4e307c55a2b5 |
---|---|
56 | 56 |
57 k = (x == 1) & (a > 0) & (a < Inf) & (b > 0) & (b < Inf); | 57 k = (x == 1) & (a > 0) & (a < Inf) & (b > 0) & (b < Inf); |
58 inv(k) = Inf; | 58 inv(k) = Inf; |
59 | 59 |
60 k = find ((x > 0) & (x < 1) & (a > 0) & (a < Inf) & (b > 0) & (b < Inf)); | 60 k = find ((x > 0) & (x < 1) & (a > 0) & (a < Inf) & (b > 0) & (b < Inf)); |
61 if (any (k)) | 61 if (! isempty (k)) |
62 if (! isscalar (a) || ! isscalar (b)) | 62 if (! isscalar (a) || ! isscalar (b)) |
63 a = a(k); | 63 a = a(k); |
64 b = b(k); | 64 b = b(k); |
65 y = a .* b; | 65 y = a .* b; |
66 else | 66 else |