Mercurial > octave
changeset 20757:b4f5962b3373
maint: periodic merge of stable to default
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 25 Nov 2015 15:28:46 -0500 |
parents | 200ae1d650b7 (current diff) a0655d18c9cc (diff) |
children | 2892f62fb37c |
files | |
diffstat | 2 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/stmt.txi Wed Nov 25 15:27:48 2015 -0500 +++ b/doc/interpreter/stmt.txi Wed Nov 25 15:28:46 2015 -0500 @@ -86,8 +86,14 @@ is nonzero, and false if its value is zero. If the value of the conditional expression in an @code{if} statement is a vector or a matrix, it is considered true only if it is non-empty and @emph{all} -of the elements are nonzero. +of the elements are nonzero. The conceptually equivalent code when +@var{condition} is a matrix is shown below. +@example +if (@var{matrix}) @equiv{} if (all (@var{matrix}(:))) +@end example + +@noindent The second form of an if statement looks like this: @example @@ -589,9 +595,8 @@ @noindent In the above case, the multi-dimensional matrix @var{c} is reshaped to a -two-dimensional matrix as @code{reshape (c, rows (c), -prod (size (c)(2:end)))} and then the same behavior as a loop over a two -dimensional matrix is produced. +two-dimensional matrix as @code{reshape (c, rows (c), prod (size (c)(2:end)))} +and then the same behavior as a loop over a two dimensional matrix is produced. Although it is possible to rewrite all @code{for} loops as @code{while} loops, the Octave language has both statements because often a
--- a/scripts/statistics/base/lscov.m Wed Nov 25 15:27:48 2015 -0500 +++ b/scripts/statistics/base/lscov.m Wed Nov 25 15:28:46 2015 -0500 @@ -172,7 +172,7 @@ %! assert(mseg, 0.0019, 1E-4); %! y2 = [y 2*y]; %! [b2, se_b2, mse2, S2] = lscov (X, y2); -%! assert(b2, [b 2*b], eps) +%! assert(b2, [b 2*b], 2*eps) %! assert(se_b2, [se_b 2*se_b], eps) %! assert(mse2, [mse 4*mse], eps) %! assert(S2(:, :, 1), S, eps)