# HG changeset patch # User jwe # Date 857034129 0 # Node ID 99dd10f4eaaf5b10e208196ba927b5aebab22986 # Parent 73a51c5250ecd03518d81bc76ab6fea4b69f82d4 [project @ 1997-02-27 08:59:55 by jwe] diff --git a/doc/interpreter/control.texi b/doc/interpreter/control.texi --- a/doc/interpreter/control.texi +++ b/doc/interpreter/control.texi @@ -366,8 +366,8 @@ for square matrices @var{a}, @var{b}. If @var{b} is not square, then the function attempts to solve either @iftex +@tex $AXA^T - X + B B^T = 0$ or $A^TXA - X + B^TB = 0$, -@tex @end tex @ifinfo @code{a x a' - x + b b' = 0} or @code{a' x a - x + b' b = 0}, @@ -393,7 +393,7 @@ @deftypefn {Function File} {} is_observable (@var{a}, @var{c}, @var{tol}) Return 1 if the pair (@var{a}, @var{c}) is observable. -Otherwise, return0. +Otherwise, return 0. The optional argument @var{tol} is a roundoff parameter. If it is omitted, a value of @code{2*eps} is used. @@ -533,8 +533,8 @@ @item k The state feedback gain, @iftex +@tex $(A - B K)$ -@tex @end tex @end iftex @ifinfo diff --git a/doc/interpreter/intro.texi b/doc/interpreter/intro.texi --- a/doc/interpreter/intro.texi +++ b/doc/interpreter/intro.texi @@ -363,7 +363,10 @@ Examples of Octave code appear in this font or form: @code{svd (a)}. Names that represent arguments or metasyntactic variables appear -in this font or form: @var{first-number}. +in this font or form: @var{first-number}. Commands that you type +sometimes appear in this font or form: @kbd{foo --bar --baz}. Specific +keys on your keyboard appear in this font or form: @key{ANY}. +@cindex any key @node Evaluation Notation, Printing Notation, Fonts, Conventions @subsection Evaluation Notation diff --git a/doc/interpreter/io.texi b/doc/interpreter/io.texi --- a/doc/interpreter/io.texi +++ b/doc/interpreter/io.texi @@ -547,9 +547,9 @@ @item @samp{r+} Open an existing file for reading and writing. -item @samp{w+} +@item @samp{w+} Open a file for reading or writing. The previous contents are -discared. +discarded. @item @samp{a+} Open or create a file for reading or writing at the end of the diff --git a/doc/interpreter/linalg.texi b/doc/interpreter/linalg.texi --- a/doc/interpreter/linalg.texi +++ b/doc/interpreter/linalg.texi @@ -287,7 +287,7 @@ @end example @end deftypefn -@deftypefn {Loadable Function} {[@var{q}, @var{r}] =} qr (@var{a}) +@deftypefn {Loadable Function} {[@var{q}, @var{r}, @var{p}] =} qr (@var{a}) @cindex QR factorization Compute the QR factorization of @var{a}, using standard @sc{Lapack} subroutines. For example, given the matrix @code{a = [1, 2; 3, 4]}, @@ -336,13 +336,21 @@ @ifinfo @code{a} @end ifinfo - is a tall, thin matrix). The @code{qr} factorization is @code{q * r = a} -where @code{q} is an orthogonal matrix and @code{r} is upper triangular. + is a tall, thin matrix). The QR factorization is +@iftex +@tex +$QR = A$ where $Q$ is an orthogonal matrix and $R$ is upper triangular. +@end tex +@end iftex +@ifinfo +@code{q * r = a} where @code{q} is an orthogonal matrix and @code{r} is +upper triangular. +@end ifinfo -The permuted @code{qr} factorization @code{[q, r, pi] = qr (a)} forms -the @code{qr} factorization such that the diagonal entries of @code{r} -are decreasing in magnitude order. For example, given the matrix -@code{a = [1, 2; 3, 4]}, +The permuted QR factorization @code{[@var{q}, @var{r}, @var{p}] = +qr (@var{a})} forms the QR factorization such that the diagonal +entries of @code{r} are decreasing in magnitude order. For example, +given the matrix @code{a = [1, 2; 3, 4]}, @example [q, r, pi] = qr(a) @@ -368,12 +376,12 @@ 1 0 @end example -The permuted @code{qr} factorization @code{[q, r, pi] = qr (a)} +The permuted @code{qr} factorization @code{[q, r, p] = qr (a)} factorization allows the construction of an orthogonal basis of @code{span (a)}. @end deftypefn -@deftypefn {Loadable Function} {@var{s}} schur (@var{a}) +@deftypefn {Loadable Function} {@var{s} =} schur (@var{a}) @deftypefnx {Loadable Function} {[@var{u}, @var{s}] =} schur (@var{a}, @var{opt}) @cindex Schur decomposition The Schur decomposition is used to compute eigenvalues of a diff --git a/doc/interpreter/matrix.texi b/doc/interpreter/matrix.texi --- a/doc/interpreter/matrix.texi +++ b/doc/interpreter/matrix.texi @@ -305,7 +305,7 @@ If @var{x} is a matrix, do the same for each column of @var{x}. @end deftypefn -@deftypefn {Loadable Function} {[s, i] =} sort (@var{x}) +@deftypefn {Loadable Function} {[@var{s}, @var{i}] =} sort (@var{x}) Returns a copy of @var{x} with the elements elements arranged in increasing order. For matrices, @code{sort} orders the elements in each column. @@ -365,7 +365,7 @@ @deftypefn {Function File} {} tril (@var{a}, @var{k}) @deftypefnx {Function File} {} triu (@var{a}, @var{k}) -Return a new matrix form by extracting extract the lower (@code{tril}) +Return a new matrix formed by extracting extract the lower (@code{tril}) or upper (@code{triu}) triangular part of the matrix @var{a}, and setting all other elements to zero. The second argument is optional, and specifies how many diagonals above or below the main diagonal should diff --git a/doc/interpreter/stats.texi b/doc/interpreter/stats.texi --- a/doc/interpreter/stats.texi +++ b/doc/interpreter/stats.texi @@ -34,7 +34,7 @@ $$ {\rm median} (x) = \cases{x(\lceil N/2\rceil), & $N$ odd;\cr - (x(N/2)+x((N/2)+1))/2, & $N$ even.} + (x(N/2)+x(N/2+1))/2, & $N$ even.} $$ @end tex @end iftex @@ -74,7 +74,7 @@ each column and return them in a row vector. @end deftypefn -@deftypefn {Function File} {} cov (@var{x} [, @var{y}]) +@deftypefn {Function File} {} cov (@var{x}, @var{y}) If each row of @var{x} and @var{y} is an observation and each column is a variable, the (@var{i},@var{j})-th entry of @code{cov (@var{x}, @var{y})} is the covariance between the @var{i}-th @@ -82,7 +82,7 @@ with one argument, compute @code{cov (@var{x}, @var{x})}. @end deftypefn -@deftypefn {Function File} {} corrcoef (@var{x} [, @var{y}]) +@deftypefn {Function File} {} corrcoef (@var{x}, @var{y}) If each row of @var{x} and @var{y} is an observation and each column is a variable, the (@var{i},@var{j})-th entry of @code{corrcoef (@var{x}, @var{y})} is the correlation between the @@ -122,7 +122,7 @@ @iftex @tex $$ -{\rm skewness} (x) = {1\over N \sigma(x)^3} \sum_{i=1}^N (x_i)-\bar{x})^3 +{\rm skewness} (x) = {1\over N \sigma(x)^3} \sum_{i=1}^N (x_i-\bar{x})^3 $$ @end tex @end iftex diff --git a/doc/interpreter/strings.texi b/doc/interpreter/strings.texi --- a/doc/interpreter/strings.texi +++ b/doc/interpreter/strings.texi @@ -154,8 +154,8 @@ s = [ "ab"; "cde" ] strcat (s, s, s) - @result{} "ab ab ab " - "cdecdecde" + @result{} "ab ab ab " + "cdecdecde" @end group @end example @end deftypefn @@ -170,8 +170,8 @@ string_fill_char = "X"; [ "these"; "are"; "strings" ] @result{} "theseXX" - @result{} "areXXXX" - @result{} "strings" + "areXXXX" + "strings" @end group @end example @end defvr @@ -182,7 +182,7 @@ matrix. @strong{Note:} -This function is modelled after @sc{MATLAB}. In Octave, you can create +This function is modelled after @sc{Matlab}. In Octave, you can create a matrix of strings by @code{[@var{s_1}; @dots{}; @var{s_n}]} even if the strings are not all the same length. @end deftypefn diff --git a/doc/interpreter/system.texi b/doc/interpreter/system.texi --- a/doc/interpreter/system.texi +++ b/doc/interpreter/system.texi @@ -122,7 +122,7 @@ @example @group -locatltime (time ()) +localtime (time ()) @result{} @{ usec = 0 year = 97 @@ -141,8 +141,8 @@ @end deftypefn @deftypefn {Loadable Function} {} mktime (@var{tm_struct}) -Convert a time structure to the number of seconds since the epoch. For -example, +Convert a time structure corresponding to the local time to the number +of seconds since the epoch. For example, @example @group @@ -858,7 +858,7 @@ system-dependent error message. @end deftypefn -@deftypefn {Built-in Function} {[fid, msg] =} dup2 (@var{old}, @var{new}) +@deftypefn {Built-in Function} {[@var{fid}, @var{msg}] =} dup2 (@var{old}, @var{new}) Duplicate a file descriptor. If successful, @var{fid} is greater than zero and contains the new file @@ -1130,18 +1130,18 @@ In the descriptions of the following functions, this data structure is referred to as a @var{grp_struct}. -@deftypefn {Loadable Function} {grp_struct =} getgrent () +@deftypefn {Loadable Function} {@var{grp_struct} =} getgrent () Return an entry from the group database, opening it if necessary. Once the end of the data has been reached, @code{getgrent} returns 0. @end deftypefn -@deftypefn {Loadable Function} {grp_struct =} getgrgid (@var{gid}). +@deftypefn {Loadable Function} {@var{grp_struct} =} getgrgid (@var{gid}). Return the first entry from the group database with the group ID @var{gid}. If the group ID does not exist in the database, @code{getgrgid} returns 0. @end deftypefn -@deftypefn {Loadable Function} {grp_struct =} getgrnam (@var{name}) +@deftypefn {Loadable Function} {@var{grp_struct} =} getgrnam (@var{name}) Return the first entry from the group database with the group name @var{name}. If the group name does not exist in the database, @code{getgrname} returns 0. diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +Wed Feb 26 15:46:28 1997 John W. Eaton + + * mach-info.cc (oct_mach_info::string_to_float_format): + Recognize "vaxg", not "vax_g". + Fri Feb 21 16:07:56 1997 John W. Eaton * Array2-idx.h (Array2::maybe_delete_elements): Use correct diff --git a/liboctave/mach-info.cc b/liboctave/mach-info.cc --- a/liboctave/mach-info.cc +++ b/liboctave/mach-info.cc @@ -185,7 +185,7 @@ retval = oct_mach_info::ieee_little_endian; else if (s == "vaxd" || s == "d") retval = oct_mach_info::vax_d; - else if (s == "vax_g" || s == "g") + else if (s == "vaxg" || s == "g") retval = oct_mach_info::vax_g; else if (s == "cray" || s == "c") retval = oct_mach_info::cray; diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +Wed Feb 26 16:43:31 1997 John W. Eaton + + * oct-stream.cc (octave_base_stream::do_scanf): Don't report an + error if a conversion fails or we reach EOF. + Tue Feb 25 22:21:05 1997 John W. Eaton * time.cc (strftime): increase initial buffer size. diff --git a/src/oct-stream.cc b/src/oct-stream.cc --- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -999,7 +999,7 @@ is.scan (fmt, &dummy); } - break; + break; case 'd': case 'i': case 'o': case 'u': case 'x': { @@ -1008,7 +1008,7 @@ do_scanf_conv (is, fmt, &tmp, mval, data, count, nr, max_size, discard); } - break; + break; case 'e': case 'f': case 'g': { @@ -1017,7 +1017,7 @@ do_scanf_conv (is, fmt, &tmp, mval, data, count, nr, max_size, discard); } - break; + break; case 'c': is.unsetf (ios::skipws); @@ -1070,7 +1070,7 @@ is.setf (flags); } - break; + break; case 'p': case '[': error ("fscanf: unsupported format specifier"); @@ -1087,20 +1087,12 @@ } else if (! is) { - if (is.eof ()) + if (nr > 0) { - if (nr > 0) + if (count > nr) { - if (count > nr) - { - final_nr = nr; - final_nc = (count - 1) / nr + 1; - } - else - { - final_nr = count; - final_nc = 1; - } + final_nr = nr; + final_nc = (count - 1) / nr + 1; } else { @@ -1110,19 +1102,20 @@ } else { - error ("fscanf: read error"); - - // XXX FIXME XXX -- is this the right thing to do? - // What about other streams? - if (name () == "stdin") - { - is.clear (); - - // Skip to end of line. - - bool err; - do_gets (-1, err, false, "fscanf"); - } + final_nr = count; + final_nc = 1; + } + + // XXX FIXME XXX -- is this the right thing to do? + // What about other streams? + if (name () == "stdin") + { + is.clear (); + + // Skip to end of line. + + bool err; + do_gets (-1, err, false, "fscanf"); } break; diff --git a/test/octave.test/nonlin/nonlin.exp b/test/octave.test/nonlin/nonlin.exp --- a/test/octave.test/nonlin/nonlin.exp +++ b/test/octave.test/nonlin/nonlin.exp @@ -11,9 +11,9 @@ do_test fsolve_options-1.m set test fsolve_options-2 -set prog_output "\n... quad_options:.*" +set prog_output "\n... fsolve_options:.*" do_test fsolve_options-2.m set test fsolve_options-3 -set prog_output "\n... quad_options:.*" +set prog_output "\n... fsolve_options:.*" do_test fsolve_options-3.m diff --git a/test/octave.test/number/is_matrix-3.m b/test/octave.test/number/is_matrix-3.m --- a/test/octave.test/number/is_matrix-3.m +++ b/test/octave.test/number/is_matrix-3.m @@ -1,1 +1,3 @@ -is_matrix ([]) +## Yes, this is right, is_matrix() checks for non-empty matrices. + +is_matrix ([]) == 0 diff --git a/test/octave.test/stats/corrcoef-1.m b/test/octave.test/stats/corrcoef-1.m --- a/test/octave.test/stats/corrcoef-1.m +++ b/test/octave.test/stats/corrcoef-1.m @@ -1,4 +1,5 @@ x = rand (10); cc1 = corrcoef (x); cc2 = corrcoef (x, x); -size (cc1) == [10, 10] && size (cc2) == [10, 10] && abs (cc1 - cc2) < eps +(size (cc1) == [10, 10] && size (cc2) == [10, 10] + && abs (cc1 - cc2) < sqrt (eps))