# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1322402857 18000 # Node ID c72ad9f5fa2ead0782627e4239bf4260093b76d8 # Parent dd1f5493fff4bd731ddf7fbbd403e3cf46a50daf# Parent 0c15fece33ad8746c9ca5dbf3f462f872a14772b Merge default onto gui diff -r dd1f5493fff4 -r c72ad9f5fa2e .hgsubstate --- a/.hgsubstate Wed Nov 23 09:19:40 2011 +0000 +++ b/.hgsubstate Sun Nov 27 09:07:37 2011 -0500 @@ -1,1 +1,1 @@ -84c3f9cf54eaa688c5a1a26925886535079a91de gnulib +ff549c078493ea86e7bd87526db276a1b94a411a gnulib diff -r dd1f5493fff4 -r c72ad9f5fa2e NEWS --- a/NEWS Wed Nov 23 09:19:40 2011 +0000 +++ b/NEWS Sun Nov 27 09:07:37 2011 -0500 @@ -8,6 +8,28 @@ ** The PCRE library is now required to build Octave. + ** The following binary elementwise operators and functions now perform + Numpy-like broadcasting (a.k.a. binary singleton expansion): + + plus ldivide rem eq gt xor + minus power mod ne ge + times max atan2 lt and + rdivide min hypot le or + + + .* & + - ./ | + .+ .\ + .- .^ + + += .*= &= + -= ./= |= + .+= .\= + .-= .^= + + This makes the bsxfun function mostly redundant except for + user-defined functions. A new section in the manual has been written + to explain and clarify this change. + ** Octave now features a profiler, thanks to the work of Daniel Kraft under the Google Summer of Code mentorship program. The manual has been updated to reflect this addition. The new user-visible @@ -77,21 +99,43 @@ Now accepts cellstr inputs. ** Octave warning IDs updated + "associativity-change": removed + "complex-cmp-ops" : removed "empty-list-elements" : removed "fortran-indexing" : removed - "complex-cmp-ops" : removed + "precedence-change" : removed "string-concat" : renamed to "mixed-string-concat" ** Matlab-compatible preference functions added: addpref getpref ispref rmpref setpref + ** Matlab-compatible handle graphics functions added: + + guidata uipanel uitoolbar + guihandles uipushtool uiwait + uicontextmenu uiresume waitfor + uicontrol uitoggletool + + The uiXXX functions above are experimental. + + Except for uiwait and uiresume, the uiXXX functions are not supported on + the FLTK backend. + + The gnuplot backend does not support any of the uiXXX functions nor + the waitfor function. + + ** New keyword parfor + + parfor (parallel for loop) is now recognized as a valid keyword. + Implementation, however, is still mapped to an ordinary for loop. + ** Other new functions added in 3.6.0: - is_dq_string python zscore - is_sq_string usejava - nthargout waitbar - + is_dq_string nthargout usejava + is_sq_string python waitbar + narginchk recycle zscore + ** Deprecated functions. The following functions were deprecated in Octave 3.2 and have been diff -r dd1f5493fff4 -r c72ad9f5fa2e doc/interpreter/Makefile.am --- a/doc/interpreter/Makefile.am Wed Nov 23 09:19:40 2011 +0000 +++ b/doc/interpreter/Makefile.am Sun Nov 27 09:07:37 2011 -0500 @@ -118,6 +118,7 @@ fn-idx.texi \ func.texi \ geometry.texi \ + gui.texi \ gpl.texi \ grammar.texi \ image.texi \ diff -r dd1f5493fff4 -r c72ad9f5fa2e doc/interpreter/contributors.in --- a/doc/interpreter/contributors.in Wed Nov 23 09:19:40 2011 +0000 +++ b/doc/interpreter/contributors.in Sun Nov 27 09:07:37 2011 -0500 @@ -210,6 +210,7 @@ Thomas L. Scofield Daniel J. Sebald Dmitri A. Sergatskov +Vanya Sergeev Baylis Shanks Andriy Shinkarchuck Joseph P. Skudlarek diff -r dd1f5493fff4 -r c72ad9f5fa2e doc/interpreter/debug.txi --- a/doc/interpreter/debug.txi Wed Nov 23 09:19:40 2011 +0000 +++ b/doc/interpreter/debug.txi Sun Nov 27 09:07:37 2011 -0500 @@ -194,7 +194,7 @@ profiling is enabled, each call to a function (supporting built-ins, operators, functions in oct- and mex-files, user-defined functions in Octave code and anonymous functions) is recorded while running Octave -code. After that, this data can aid in analyzing the code behaviour, and +code. After that, this data can aid in analyzing the code behavior, and is in particular helpful for finding ``hot spots'' in the code which use up a lot of computation time and are the best targets to spend optimization efforts on. @@ -221,7 +221,7 @@ @end group @end example -This shows that most of the runtime was spent executing the function +This shows that most of the run time was spent executing the function @samp{myfib}, and some minor proportion evaluating the listed binary operators. Furthermore, it is shown how often the function was called and the profiler also records that it is recursive. @@ -334,7 +334,7 @@ once. The second expensive operation is the matrix-vector product in the routine @code{timesteps}. @footnote{We only know it is the binary multiplication operator, but fortunately this operator appears only at -one place in the code and thus we know which occurence takes so much +one place in the code and thus we know which occurrence takes so much time. If there were multiple places, we would have to use the hierarchical profile to find out the exact place which uses up the time which is not covered in this example.} @@ -405,7 +405,7 @@ suboptimal way, and most of the time was spent in @code{bar} itself. Finally, let's say we want to profile the execution of both @code{foo} -and @code{bar} together. Since we already have the runtime data +and @code{bar} together. Since we already have the run-time data collected for @code{bar}, we can restart the profiler without clearing the existing data and collect the missing statistics about @code{foo}. This is done by: diff -r dd1f5493fff4 -r c72ad9f5fa2e doc/interpreter/doccheck/aspell-octave.en.pws --- a/doc/interpreter/doccheck/aspell-octave.en.pws Wed Nov 23 09:19:40 2011 +0000 +++ b/doc/interpreter/doccheck/aspell-octave.en.pws Sun Nov 27 09:07:37 2011 -0500 @@ -1,11 +1,12 @@ personal_ws-1.1 en 1 Abramowitz accumarray +Acknowledgements acknowledgements -Acknowledgements ACM adams Affero +afterwards Ahalt aifm AIX @@ -15,8 +16,8 @@ alnum alphanum amd +ANOVA anova -ANOVA Anymap API approximant @@ -32,14 +33,15 @@ Autoconf autocorrelations autocovariances +autoload Autoload -autoload autoloaded autoloading Autoloading autoregression autoregressions autoscaled +AutoScaling AWK backend Backends @@ -104,6 +106,7 @@ ceil cellstr ChangeLog +changelogs changeset changesets Chaves @@ -128,12 +131,14 @@ cof coffset colamd +collectoutput colorbar colormap colperm Comint Commandline commentstyle +ComplexEqn cond condest conformant @@ -151,6 +156,7 @@ cov CPLEX CreateFcn +CRLF csymamd ctranspose CTRL @@ -167,6 +173,8 @@ dataset datasets datasource +datestr +datestrings davis ddd dddd @@ -175,8 +183,8 @@ deallocated deconv deftypefn +Delaunay delaunay -Delaunay delaunayn DeleteFcn delim @@ -225,9 +233,11 @@ endian Endian endif +endofline Engle's eof EOF +EOLs EOS eps eq @@ -257,8 +267,9 @@ facevertexcdata fcdf femmodel +FFF +FFT fft -FFT fftn fftpack FFTs @@ -269,6 +280,7 @@ filename filenames Filesystem +FinDiffType finv FIRfilter FIXME @@ -292,6 +304,7 @@ Frobenius Fs FSF +FunValCheck gamcdf gaminv gampdf @@ -319,17 +332,18 @@ globbing glpk GLS +gnuplot Gnuplot -gnuplot gnuplot's Golub Gonnet +goto Goto -goto gotos GPL gplot grabdemo +GradObj GraphicsMagick Graymap grayscale @@ -346,6 +360,7 @@ Hankel Hanning hardcode +hardcoding Hauberg HDF hdf @@ -377,8 +392,8 @@ hygepdf hygernd Hyndman +Hypergeometric hypergeometric -Hypergeometric IEEE iff ifft @@ -446,13 +461,14 @@ ldivide ldots le +Leftarrow leftarrow -Leftarrow Leftrightarrow leftrightarrow Lehoucq leq Levinson +LF lfloor li libcruft @@ -463,12 +479,13 @@ lineanchors linefeeds linesearch +linespec linespoints linkprop literalspacing Liu +LM lm -LM loadpath Lobatto logit @@ -506,8 +523,10 @@ matchcase matlab Matsumoto +MaxFunEvals maxima MaxIntervalCount +MaxIter mcnemar McNemar's meansq @@ -515,8 +534,8 @@ Mersenne meshgrid meshgridded +metafile Metafile -metafile metafiles Metafont mex @@ -548,6 +567,7 @@ multi multibyte multiline +multipledelimsasone MultiSelect mxArray myclass @@ -590,6 +610,7 @@ noscal noshare notin +nthargout NTSC nul Nx @@ -626,8 +647,8 @@ PCRE PCX pcx +pdf PDF -pdf periodogram perp Petzold's @@ -661,6 +682,8 @@ presolver printf priori +Profiler +profiler propto proven ps @@ -677,15 +700,15 @@ qhull QP QQ +qrupdate QRUPDATE -qrupdate quadcc quadgk quadl quadpack quadv +quantile Quantile -quantile quantiles Quickhull qz @@ -703,6 +726,7 @@ Readline readline recursing +reentrant regex regressor reimported @@ -718,6 +742,7 @@ resnorm resparsify RET +returnonerror rfloor RGB Riccati @@ -791,9 +816,10 @@ Stadlober stairstep Stallman +startup Startup -startup stdnormal +stdout Stegun Stepleman stepsize @@ -812,8 +838,8 @@ subexpressions subfunction Subfunction +subfunctions Subfunctions -subfunctions subinterval Subintervals subintervals @@ -826,8 +852,8 @@ subprocesses Subprocesses subsasgn +Subscripted subscripted -Subscripted subscripting subseteq subsindex @@ -857,8 +883,9 @@ Tcv terminal's tex +texinfo Texinfo -texinfo +textscan th ths tif @@ -878,6 +905,7 @@ tpdf traceback trapz +treatasempty treelayout treeplot tridiagonal @@ -888,6 +916,7 @@ Tx txi typedefs +TypicalX ub UB uchar @@ -955,16 +984,16 @@ wblpdf wblrnd Weibull +Welch welch -Welch WestOutside whitespace Whitespace whos wienrnd Wikipedia +wilcoxon Wilcoxon -wilcoxon wildcard Wildcards wildcards @@ -1000,10 +1029,10 @@ ydata yerrorbar yerrorbars +yy YY -yy +yyyy YYYY -yyyy yyyymmdd yyyymmddTHHMMSS Zechner diff -r dd1f5493fff4 -r c72ad9f5fa2e doc/interpreter/grammar.txi --- a/doc/interpreter/grammar.txi Wed Nov 23 09:19:40 2011 +0000 +++ b/doc/interpreter/grammar.txi Sun Nov 27 09:07:37 2011 -0500 @@ -41,16 +41,17 @@ @item @code{case} @tab @code{catch} @tab @code{classdef} @item @code{continue} @tab @code{do} @tab @code{else} @item @code{elseif} @tab @code{end} @tab @code{end_try_catch} -@item @code{end_unwind_protect} @tab @code{endclassdef} @tab @code{endevents} -@item @code{endfor} @tab @code{endfunction} @tab @code{endif} -@item @code{endmethods} @tab @code{endproperties} @tab @code{endswitch} -@item @code{endwhile} @tab @code{events} @tab @code{for} +@item @code{end_unwind_protect} @tab @code{endclassdef} @tab @code{endenumeration} +@item @code{endevents} @tab @code{endfor} @tab @code{endfunction} +@item @code{endif} @tab @code{endmethods} @tab @code{endparfor} +@item @code{endproperties} @tab @code{endswitch} @tab @code{endwhile} +@item @code{enumeration} @tab @code{events} @tab @code{for} @item @code{function} @tab @code{get} @tab @code{global} @item @code{if} @tab @code{methods} @tab @code{otherwise} -@item @code{persistent} @tab @code{properties} @tab @code{return} -@item @code{set} @tab @code{static} @tab @code{switch} -@item @code{try} @tab @code{until} @tab @code{unwind_protect} -@item @code{unwind_protect_cleanup}@tab @code{while} +@item @code{parfor} @tab @code{persistent} @tab @code{properties} +@item @code{return} @tab @code{set} @tab @code{static} +@item @code{switch} @tab @code{try} @tab @code{until} +@item @code{unwind_protect} @tab @code{unwind_protect_cleanup} @tab @code{while} @end multitable The function @code{iskeyword} can be used to quickly check whether an diff -r dd1f5493fff4 -r c72ad9f5fa2e doc/interpreter/gui.txi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/interpreter/gui.txi Sun Nov 27 09:07:37 2011 -0500 @@ -0,0 +1,93 @@ +@c Copyright (C) 2011 Rik Wehbring +@c +@c This file is part of Octave. +@c +@c Octave is free software; you can redistribute it and/or modify it +@c under the terms of the GNU General Public License as published by the +@c Free Software Foundation; either version 3 of the License, or (at +@c your option) any later version. +@c +@c Octave is distributed in the hope that it will be useful, but WITHOUT +@c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +@c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +@c for more details. +@c +@c You should have received a copy of the GNU General Public License +@c along with Octave; see the file COPYING. If not, see +@c . + +@node GUI Development +@chapter GUI Development + +Octave is principally a batch or command-line language. However, it does +offer some limited features for constructing graphical interfaces for +interacting with users. + +The GUI elements available are I/O dialogs and a progress bar. For example, +rather than hardcoding a filename for output results a script can open a dialog +box and allow the user to choose a file. Similarly, if a calculation is +expected to take a long time a script can display a progress bar. + +Several utility functions make it possible to store private data for use with +a GUI which will not pollute the user's variable space. + +Finally, a program written in Octave might want to have long term storage of +preferences or state variables. This can be done with user-defined +preferences. + +@menu +* I/O Dialogs:: +* Progress Bar:: +* GUI Utility Functions:: +* User-Defined Preferences:: +@end menu + +@node I/O Dialogs +@section I/O Dialogs + +Simple dialog menus are available for choosing directories or files. They +return a string variable which can then be used with any command requiring +a file name. + +@DOCSTRING(uigetdir) + +@DOCSTRING(uigetfile) + +@DOCSTRING(uiputfile) + +@node Progress Bar +@section Progress Bar +@cindex Progress Bar + +@DOCSTRING(waitbar) + +@node GUI Utility Functions +@section GUI Utility Functions + +These functions do not implement a GUI element but are useful when developing +programs that do. @strong{Warning:} The functions @code{uiwait}, +@code{uiresume}, and @code{waitfor} are only available for the FLTK tooolkit. + +@DOCSTRING(guidata) + +@DOCSTRING(guihandles) + +@DOCSTRING(uiwait) + +@DOCSTRING(uiresume) + +@DOCSTRING(waitfor) + +@node User-Defined Preferences +@section User-Defined Preferences + +@DOCSTRING(addpref) + +@DOCSTRING(getpref) + +@DOCSTRING(ispref) + +@DOCSTRING(rmpref) + +@DOCSTRING(setpref) + diff -r dd1f5493fff4 -r c72ad9f5fa2e doc/interpreter/io.txi --- a/doc/interpreter/io.txi Wed Nov 23 09:19:40 2011 +0000 +++ b/doc/interpreter/io.txi Sun Nov 27 09:07:37 2011 -0500 @@ -28,7 +28,6 @@ @menu * Basic Input and Output:: * C-Style I/O Functions:: -* GUI Dialogs for I/O:: @end menu @node Basic Input and Output @@ -1065,16 +1064,3 @@ @end group @end example -@node GUI Dialogs for I/O -@section GUI Dialogs for I/O - -Simple dialog menus are available for choosing directories or files. They -return a string variable which can then be used when calling any command -requiring a file name. - -@DOCSTRING(uigetdir) - -@DOCSTRING(uigetfile) - -@DOCSTRING(uiputfile) - diff -r dd1f5493fff4 -r c72ad9f5fa2e doc/interpreter/obsolete.txi --- a/doc/interpreter/obsolete.txi Wed Nov 23 09:19:40 2011 +0000 +++ b/doc/interpreter/obsolete.txi Sun Nov 27 09:07:37 2011 -0500 @@ -118,4 +118,37 @@ @item @code{weibull_pdf} @tab @code{wblpdf} @tab 3.4.0 @item @code{weibull_rnd} @tab @code{wblrnd} @tab 3.4.0 @item @code{wiener_rnd} @tab @code{wienrnd} @tab 3.4.0 +@item @code{create_set} @tab @code{unique} @tab 3.6.0 +@item @code{dmult} @tab @code{diag (A) * B} @tab 3.6.0 +@item @code{iscommand} @tab None @tab 3.6.0 +@item @code{israwcommand} @tab None @tab 3.6.0 +@item @code{lchol} @tab @code{chol (@dots{}, "lower")} @tab 3.6.0 +@item @code{loadimage} @tab @code{load} or @code{imread} @tab 3.6.0 +@item @code{mark_as_command} @tab None @tab 3.6.0 +@item @code{mark_as_rawcommand} @tab None @tab 3.6.0 +@item @code{spatan2} @tab @code{atan2} @tab 3.6.0 +@item @code{spchol} @tab @code{chol} @tab 3.6.0 +@item @code{spchol2inv} @tab @code{chol2inv} @tab 3.6.0 +@item @code{spcholinv} @tab @code{cholinv} @tab 3.6.0 +@item @code{spcumprod} @tab @code{cumprod} @tab 3.6.0 +@item @code{spcumsum} @tab @code{cumsum} @tab 3.6.0 +@item @code{spdet} @tab @code{det} @tab 3.6.0 +@item @code{spdiag} @tab @code{sparse (diag (@dots{}))} @tab 3.6.0 +@item @code{spfind} @tab @code{find} @tab 3.6.0 +@item @code{sphcat} @tab @code{horzcat} @tab 3.6.0 +@item @code{spinv} @tab @code{inv} @tab 3.6.0 +@item @code{spkron} @tab @code{kron} @tab 3.6.0 +@item @code{splchol} @tab @code{chol (@dots{}, "lower")} @tab 3.6.0 +@item @code{split} @tab @code{char (strsplit (s, t))} @tab 3.6.0 +@item @code{splu} @tab @code{lu} @tab 3.6.0 +@item @code{spmax} @tab @code{max} @tab 3.6.0 +@item @code{spmin} @tab @code{min} @tab 3.6.0 +@item @code{spprod} @tab @code{prod} @tab 3.6.0 +@item @code{spqr} @tab @code{qr} @tab 3.6.0 +@item @code{spsum} @tab @code{sum} @tab 3.6.0 +@item @code{spsumsq} @tab @code{sumsq} @tab 3.6.0 +@item @code{spvcat} @tab @code{vertcat} @tab 3.6.0 +@item @code{str2mat} @tab @code{char} @tab 3.6.0 +@item @code{unmark_command} @tab None @tab 3.6.0 +@item @code{unmark_rawcommand} @tab None @tab 3.6.0 @end multitable diff -r dd1f5493fff4 -r c72ad9f5fa2e doc/interpreter/octave.texi --- a/doc/interpreter/octave.texi Wed Nov 23 09:19:40 2011 +0000 +++ b/doc/interpreter/octave.texi Sun Nov 27 09:07:37 2011 -0500 @@ -213,6 +213,7 @@ * Image Processing:: * Audio Processing:: * Object Oriented Programming:: +* GUI Development:: * System Utilities:: * Packages:: * Dynamically Linked Functions:: @@ -476,7 +477,6 @@ * Basic Input and Output:: * C-Style I/O Functions:: -* GUI Dialogs for I/O:: Basic Input and Output @@ -754,6 +754,13 @@ * Operator Overloading:: * Precedence of Objects:: +GUI Development + +* I/O Dialogs:: +* Progress Bar:: +* GUI Utility Functions:: +* User-Defined Preferences:: + System Utilities * Timing Utilities:: @@ -855,7 +862,7 @@ Reporting Bugs * Bug Criteria:: -* Bug Tracker::ff Where to submit your bug report. +* Bug Tracker:: Where to submit your bug report. * Bug Reporting:: How to report a bug effectively. * Sending Patches:: How to send a patch for Octave. @@ -914,6 +921,7 @@ @include image.texi @include audio.texi @include oop.texi +@include gui.texi @include system.texi @include package.texi diff -r dd1f5493fff4 -r c72ad9f5fa2e doc/interpreter/plot.txi --- a/doc/interpreter/plot.txi Wed Nov 23 09:19:40 2011 +0000 +++ b/doc/interpreter/plot.txi Sun Nov 27 09:07:37 2011 -0500 @@ -1808,6 +1808,7 @@ @item deletefcn @item displayname +The text of the legend entry corresponding to this line. @item erasemode @@ -1819,11 +1820,6 @@ @item interruptible -@item keylabel -The text of the legend entry corresponding to this line. Note that this -property is not compatible with @sc{matlab} and may be removed in a -future version of Octave. - @item ldata The lower errorbar in the y direction to be plotted. @@ -1925,6 +1921,7 @@ @item deletefcn @item displayname +The text of the legend entry corresponding to this line. @item edgecolor @@ -2132,6 +2129,9 @@ @item diffusestrength +@item displayname +The text of the legend entry corresponding to this line. + @item edgealpha @item edgecolor @@ -2163,8 +2163,6 @@ @item interruptible -@item keylabel - @item linestyle @xref{Line Styles}. @@ -2282,6 +2280,9 @@ @item diffusestrength +@item displayname +The text of the legend entry corresponding to this surface. + @item edgealpha @item edgecolor @@ -2304,11 +2305,6 @@ @item interruptible -@item keylabel -The text of the legend entry corresponding to this surface. Note that -this property is not compatible with @sc{matlab} and may be removed in a -future version of Octave. - @item linestyle @item linewidth @@ -2397,7 +2393,7 @@ Although default values may be set for any object, they are set in parent objects and apply to child objects, of the specified object type. -For example, seeting the default @code{color} property of @code{line} +For example, setting the default @code{color} property of @code{line} objects to "green", for the @code{root} object, will result in all @code{line} objects inheriting the @code{color} "green" as the default value. diff -r dd1f5493fff4 -r c72ad9f5fa2e doc/interpreter/strings.txi --- a/doc/interpreter/strings.txi Wed Nov 23 09:19:40 2011 +0000 +++ b/doc/interpreter/strings.txi Sun Nov 27 09:07:37 2011 -0500 @@ -147,6 +147,12 @@ @end group @end example +In scripts the two different string types can be distinguished if necessary +by using @code{is_dq_string} and @code{is_sq_string}. + +@DOCSTRING(is_dq_string) + +@DOCSTRING(is_sq_string) @node Character Arrays @section Character Arrays diff -r dd1f5493fff4 -r c72ad9f5fa2e doc/interpreter/system.txi --- a/doc/interpreter/system.txi Wed Nov 23 09:19:40 2011 +0000 +++ b/doc/interpreter/system.txi Sun Nov 27 09:07:37 2011 -0500 @@ -503,6 +503,8 @@ @DOCSTRING(octave_config_info) +@DOCSTRING(usejava) + @DOCSTRING(getrusage) @node Hashing Functions diff -r dd1f5493fff4 -r c72ad9f5fa2e doc/interpreter/testfun.txi --- a/doc/interpreter/testfun.txi Wed Nov 23 09:19:40 2011 +0000 +++ b/doc/interpreter/testfun.txi Sun Nov 27 09:07:37 2011 -0500 @@ -167,9 +167,10 @@ @example @group - %!function @var{a} = fn(@var{b}) + %!function @var{a} = fn (@var{b}) %! @var{a} = 2*@var{b}; - %!assert (@var{a}(2),4); + %!endfunction + %!assert (@var{fn}(2), 4); @end group @end example @@ -263,13 +264,16 @@ comment: ignore everything within the block @item %!shared x,y,z -declares variables for use in multiple tests +declare variables for use in multiple tests @item %!function -defines a function value for a shared variable +define a function for use in multiple tests + +@item %!endfunction +close a function definition @item %!assert (x, y, tol) -shorthand for %!test assert (x, y, tol) +shorthand for @code{%!test assert (x, y, tol)} @end table You can also create test scripts for builtins and your own C++ diff -r dd1f5493fff4 -r c72ad9f5fa2e etc/HACKING --- a/etc/HACKING Wed Nov 23 09:19:40 2011 +0000 +++ b/etc/HACKING Sun Nov 27 09:07:37 2011 -0500 @@ -7,8 +7,7 @@ These notes are intended to help people working on sources checked-out from the savannah source code repository. -These requirements do not apply when building from a distribution -tarball. +These requirements do not apply when building from a distribution tarball. ** Requirements @@ -120,7 +119,7 @@ fftpack * subroutines for fast fourier transforms lapack-xtra * wrappers for lapack functions used in Octave misc * miscellaneous utilities - odepack * odinary differential equation solver + odepack * ordinary differential equation solver ordered-qz * code for ordering eigenvalues for QZ factorization quadpack * subroutines for numerical integration ranlib * random number generators @@ -137,8 +136,8 @@ @ftp * ftp object class general * utility functions geometry * geometry algorithms + help * help subsystem functions image * image processing - help * help subsystem functions io * input/output functions linear-algebra * linear algebra stuff miscellaneous * stuff that doesn't fit anywhere else @@ -147,6 +146,7 @@ pkg * the package manager plot * plotting functions polynomial * polynomial manipulation + prefs * user-defined preferences set * set manipulation signal * signal processing sparse * sparse matrix support @@ -159,13 +159,13 @@ time * time and date functions src -- the interpreter itself plus lots of infrastructure - around it. Octave's extensive octave_value class + around it. Octave's extensive octave_value class hierarchy for polymorphically handling all Octave - types is defined here. The built-in functions are + types is defined here. The built-in functions are also defined here, so if "help foo" tells you foo is built-in, its source will be somewhere in this directory. - DLD-FUNCTIONS * Dynamically linked oct files. If you see "help foo" + DLD-FUNCTIONS * Dynamically linked oct files. If you see "help foo" telling you that foo is defined in foo.oct, then foo.cc will be found here and contain the source code. @@ -184,7 +184,7 @@ jwe@octave.org -Last updated: Wed Sep 28 22:37:37 CDT 2011 +Last updated: Tue Nov 22 20:51:34 PST 2011 ################################################################################ diff -r dd1f5493fff4 -r c72ad9f5fa2e liboctave/CSparse.cc --- a/liboctave/CSparse.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/liboctave/CSparse.cc Sun Nov 27 09:07:37 2011 -0500 @@ -579,7 +579,7 @@ SparseComplexMatrix::column (octave_idx_type i) const { octave_idx_type nr = rows (); - ComplexColumnVector retval (nr); + ComplexColumnVector retval (nr, 0); for (octave_idx_type k = cidx (i); k < cidx (i+1); k++) retval(ridx (k)) = data (k); diff -r dd1f5493fff4 -r c72ad9f5fa2e liboctave/cmd-edit.cc --- a/liboctave/cmd-edit.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/liboctave/cmd-edit.cc Sun Nov 27 09:07:37 2011 -0500 @@ -1227,6 +1227,12 @@ } void +command_editor::run_event_hooks (void) +{ + event_handler (); +} + +void command_editor::read_init_file (const std::string& file_arg) { if (instance_ok ()) diff -r dd1f5493fff4 -r c72ad9f5fa2e liboctave/cmd-edit.h --- a/liboctave/cmd-edit.h Wed Nov 23 09:19:40 2011 +0000 +++ b/liboctave/cmd-edit.h Sun Nov 27 09:07:37 2011 -0500 @@ -137,6 +137,8 @@ static void remove_event_hook (event_hook_fcn f); + static void run_event_hooks (void); + static void read_init_file (const std::string& file = std::string ()); static void re_read_init_file (void); diff -r dd1f5493fff4 -r c72ad9f5fa2e liboctave/dSparse.cc --- a/liboctave/dSparse.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/liboctave/dSparse.cc Sun Nov 27 09:07:37 2011 -0500 @@ -585,7 +585,7 @@ SparseMatrix::column (octave_idx_type i) const { octave_idx_type nr = rows (); - ColumnVector retval (nr); + ColumnVector retval (nr, 0); for (octave_idx_type k = cidx (i); k < cidx (i+1); k++) retval(ridx (k)) = data (k); diff -r dd1f5493fff4 -r c72ad9f5fa2e liboctave/oct-norm.cc --- a/liboctave/oct-norm.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/liboctave/oct-norm.cc Sun Nov 27 09:07:37 2011 -0500 @@ -57,9 +57,10 @@ #include "floatSVD.h" #include "fCmplxSVD.h" -// Theory: norm accumulator is an object that has an accum method able to handle -// both real and complex element, and a cast operator returning the intermediate -// norm. +// Theory: norm accumulator is an object that has an accum method able +// to handle both real and complex element, and a cast operator +// returning the intermediate norm. Reference: Higham, N. "Estimating +// the Matrix p-Norm." Numer. Math. 62, 539-555, 1992. // norm accumulator for the p-norm template diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/general/accumarray.m --- a/scripts/general/accumarray.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/general/accumarray.m Sun Nov 27 09:07:37 2011 -0500 @@ -24,14 +24,14 @@ ## Create an array by accumulating the elements of a vector into the ## positions defined by their subscripts. The subscripts are defined by ## the rows of the matrix @var{subs} and the values by @var{vals}. Each -## row of @var{subs} corresponds to one of the values in @var{vals}. If +## row of @var{subs} corresponds to one of the values in @var{vals}. If ## @var{vals} is a scalar, it will be used for each of the row of ## @var{subs}. ## ## The size of the matrix will be determined by the subscripts -## themselves. However, if @var{sz} is defined it determines the matrix -## size. The length of @var{sz} must correspond to the number of columns -## in @var{subs}. An exception is if @var{subs} has only one column, in +## themselves. However, if @var{sz} is defined it determines the matrix +## size. The length of @var{sz} must correspond to the number of columns +## in @var{subs}. An exception is if @var{subs} has only one column, in ## which case @var{sz} may be the dimensions of a vector and the subscripts ## of @var{subs} are taken as the indices into it. ## @@ -42,14 +42,14 @@ ## function should not depend on the order of the subscripts. ## ## The elements of the returned array that have no subscripts associated -## with them are set to zero. Defining @var{fillval} to some other value -## allows these values to be defined. This behaviour changes, however, -## for certain values of @var{func}. If @var{func} is @code{min} +## with them are set to zero. Defining @var{fillval} to some other value +## allows these values to be defined. This behavior changes, however, +## for certain values of @var{func}. If @var{func} is @code{min} ## (respectively, @code{max}) then the result will be filled with the ## minimum (respectively, maximum) integer if @var{vals} is of integral ## type, logical false (respectively, logical true) if @var{vals} is of ## logical type, zero if @var{fillval} is zero and all values are -## nonpositive (respectively, nonnegative), and NaN otherwise. +## non-positive (respectively, non-negative), and NaN otherwise. ## ## By default @code{accumarray} returns a full matrix. If ## @var{issparse} is logically true, then a sparse matrix is returned @@ -57,7 +57,7 @@ ## ## The following @code{accumarray} example constructs a frequency table ## that in the first column counts how many occurrences each number in -## the second column has, taken from the vector @var{x}. Note the usage +## the second column has, taken from the vector @var{x}. Note the usage ## of @code{unique} for assigning to all repeated elements of @var{x} ## the same index (@pxref{doc-unique}). ## @@ -74,7 +74,7 @@ ## @end group ## @end example ## -## Another example, where the result is a multidimensional 3D array and +## Another example, where the result is a multi-dimensional 3-D array and ## the default value (zero) appears in the output: ## ## @example @@ -91,9 +91,9 @@ ## ## The complexity in the non-sparse case is generally O(M+N), where N is ## the number of subscripts and M is the maximum subscript (linearized -## in multi-dimensional case). If @var{func} is one of @code{@@sum} +## in multi-dimensional case). If @var{func} is one of @code{@@sum} ## (default), @code{@@max}, @code{@@min} or @code{@@(x) @{x@}}, an -## optimized code path is used. Note that for general reduction function +## optimized code path is used. Note that for general reduction function ## the interpreter overhead can play a major part and it may be more ## efficient to do multiple accumarray calls and compute the results in ## a vectorized manner. diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/general/blkdiag.m --- a/scripts/general/blkdiag.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/general/blkdiag.m Sun Nov 27 09:07:37 2011 -0500 @@ -20,7 +20,7 @@ ## @deftypefn {Function File} {} blkdiag (@var{A}, @var{B}, @var{C}, @dots{}) ## Build a block diagonal matrix from @var{A}, @var{B}, @var{C}, @dots{} ## All the arguments must be numeric and are two-dimensional matrices or -## scalars. If any argument is of type sparse, the output will also be +## scalars. If any argument is of type sparse, the output will also be ## sparse. ## @seealso{diag, horzcat, vertcat, sparse} ## @end deftypefn diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/general/nargoutchk.m --- a/scripts/general/nargoutchk.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/general/nargoutchk.m Sun Nov 27 09:07:37 2011 -0500 @@ -25,11 +25,11 @@ ## Check for correct number of output arguments. ## ## On the first form, returns an error unless the number of arguments in its -## caller is between the values of @var{minargs} and @var{maxargs}. It does -## nothing otherwise. Note that this function evaluates the value of +## caller is between the values of @var{minargs} and @var{maxargs}. It does +## nothing otherwise. Note that this function evaluates the value of ## @code{nargout} on the caller so its value must have not been tampered with. ## -## Both @var{minargs} and @var{maxargs} need to be a numeric scalar. Zero, Inf +## Both @var{minargs} and @var{maxargs} need to be a numeric scalar. Zero, Inf ## and negative are all valid, and they can have the same value. ## ## For backward compatibility reasons, the other forms return an appropriate diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/general/nthargout.m --- a/scripts/general/nthargout.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/general/nthargout.m Sun Nov 27 09:07:37 2011 -0500 @@ -20,10 +20,10 @@ ## @deftypefn {Function File} {} nthargout (@var{n}, @var{func}, @dots{}) ## @deftypefnx {Function File} {} nthargout (@var{n}, @var{ntot}, @var{func}, @dots{}) ## Return the @var{n}th output argument of function given by the -## function handle or string @var{func}. Any arguments after @var{func} -## are passed to @var{func}. The total number of arguments to call +## function handle or string @var{func}. Any arguments after @var{func} +## are passed to @var{func}. The total number of arguments to call ## @var{func} with can be passed in @var{ntot}; by default @var{ntot} -## is @var{n}. The input @var{n} can also be a vector of indices of the +## is @var{n}. The input @var{n} can also be a vector of indices of the ## output, in which case the output will be a cell array of the ## requested output arguments. ## diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/general/profexplore.m --- a/scripts/general/profexplore.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/general/profexplore.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} profexplore (@var{data}) +## @deftypefn {Function File} {} profexplore (@var{data}) ## Interactively explore hierarchical profiler output. ## ## Assuming @var{data} is the structure with profile data returned by diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/general/profile.m --- a/scripts/general/profile.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/general/profile.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,10 +17,10 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} profile on -## @deftypefnx {Function File} {} profile off -## @deftypefnx {Function File} {} profile resume -## @deftypefnx {Function File} {} profile clear +## @deftypefn {Command} {} profile on +## @deftypefnx {Command} {} profile off +## @deftypefnx {Command} {} profile resume +## @deftypefnx {Command} {} profile clear ## @deftypefnx {Function File} {@var{S} =} profile ('status') ## @deftypefnx {Function File} {@var{T} =} profile ('info') ## Control the built-in profiler. diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/help/unimplemented.m --- a/scripts/help/unimplemented.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/help/unimplemented.m Sun Nov 27 09:07:37 2011 -0500 @@ -330,7 +330,6 @@ "quad2d", "questdlg", "rbbox", - "recycle", "reducepatch", "reducevolume", "resample", diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/io/fileread.m --- a/scripts/io/fileread.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/io/fileread.m Sun Nov 27 09:07:37 2011 -0500 @@ -49,8 +49,8 @@ %!test %! cstr = {"Hello World", "The answer is 42", "Goodbye World"}; %! fname = tmpnam (); -%! fid = fopen (fname, "wt"); -%! fprintf(fid, "%s\n", cstr{:}) +%! fid = fopen (fname, "w"); +%! fprintf (fid, "%s\n", cstr{:}) %! fclose (fid); %! str = fileread (fname); %! assert (str', [cstr{1} "\n" cstr{2} "\n" cstr{3} "\n"]); diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/linear-algebra/krylov.m --- a/scripts/linear-algebra/krylov.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/linear-algebra/krylov.m Sun Nov 27 09:07:37 2011 -0500 @@ -28,8 +28,8 @@ ## Using Householder reflections to guard against loss of orthogonality. ## ## If @var{V} is a vector, then @var{h} contains the Hessenberg matrix -## such that @xcode{a*u == u*h+rk*ek'}, in which @code{rk = -## a*u(:,k)-u*h(:,k)}, and @xcode{ek'} is the vector +## such that @nospell{@xcode{a*u == u*h+rk*ek'}}, in which @code{rk = +## a*u(:,k)-u*h(:,k)}, and @nospell{@xcode{ek'}} is the vector ## @code{[0, 0, @dots{}, 1]} of length @code{k}. Otherwise, @var{h} is ## meaningless. ## diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/miscellaneous/computer.m --- a/scripts/miscellaneous/computer.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/miscellaneous/computer.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{c}, @var{maxsize}, @var{endian}] =} computer () +## @deftypefn {Function File} {[@var{c}, @var{maxsize}, @var{endian}] =} computer () ## @deftypefnx {Function File} {@var{arch} =} computer ("arch") ## Print or return a string of the form @var{cpu}-@var{vendor}-@var{os} ## that identifies the kind of computer Octave is running on. If invoked diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/miscellaneous/ls.m --- a/scripts/miscellaneous/ls.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/miscellaneous/ls.m Sun Nov 27 09:07:37 2011 -0500 @@ -50,7 +50,15 @@ args = tilde_expand (varargin); - cmd = sprintf ("%s ", __ls_command__, args{:}); + if (nargin > 0) + ## FIXME -- this will fail for filenames that contain single quote + ## characters... + cmd = sprintf (" '%s'", args{:}); + else + cmd = ""; + endif + + cmd = sprintf ("%s%s", __ls_command__, cmd); if (page_screen_output () || nargout > 0) diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/miscellaneous/orderfields.m diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/miscellaneous/recycle.m --- a/scripts/miscellaneous/recycle.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/miscellaneous/recycle.m Sun Nov 27 09:07:37 2011 -0500 @@ -18,8 +18,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{current_state}} recycle () -## @deftypefnx {Function File} {@var{old_state}} recycle (@var{new_state}) -## Display or set the preference for recycling deleted files. +## @deftypefnx {Function File} {@var{old_state}} recycle (@var{new_state}) +## Query or set the preference for recycling deleted files. ## ## Recycling files instead of permanently deleting them is currently not ## implemented in Octave. To help avoid accidental data loss it @@ -51,7 +51,7 @@ error ("recycle: invalid value of STATE = `%s'", state); endif else - erroor ("recycle: expecting STATE to be a character string"); + error ("recycle: expecting STATE to be a character string"); endif endif diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/miscellaneous/version.m --- a/scripts/miscellaneous/version.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/miscellaneous/version.m Sun Nov 27 09:07:37 2011 -0500 @@ -20,7 +20,7 @@ ## @deftypefn {Function File} {} version () ## Return the version number of Octave, as a string. ## -## This is an alias for the function @code{OCTAVE_VERSION} provided for +## This is an alias for the function @w{@env{OCTAVE_VERSION}} provided for ## compatibility ## @seealso{OCTAVE_VERSION}. ## @end deftypefn diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/optimization/sqp.m --- a/scripts/optimization/sqp.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/optimization/sqp.m Sun Nov 27 09:07:37 2011 -0500 @@ -75,7 +75,7 @@ ## formula is used to approximate the Hessian. ## ## When supplied, the gradient function @code{@var{phi}@{2@}} must accept -## one vector argument and return a vector. When supplifed, the Hessian +## one vector argument and return a vector. When supplied, the Hessian ## function @code{@var{phi}@{3@}} must accept one vector argument and ## return a matrix. ## @@ -83,7 +83,7 @@ ## handles pointing to functions that compute the equality constraints ## and the inequality constraints, respectively. If the problem does ## not have equality (or inequality) constraints, then use an empty -## matrix ([]) for @var{g} (or @var{h}). When supplied, these equality +## matrix ([]) for @var{g} (or @var{h}). When supplied, these equality ## and inequality constraint functions must accept one vector argument ## and return a vector. ## @@ -113,16 +113,16 @@ ## and upper bounds on @var{x}. These must be consistent with the ## equality and inequality constraints @var{g} and @var{h}. If the ## arguments are vectors then @var{x}(i) is bound by @var{lb}(i) and -## @var{ub}(i). A bound can also be a scalar in which case all elements +## @var{ub}(i). A bound can also be a scalar in which case all elements ## of @var{x} will share the same bound. If only one bound (lb, ub) is ## specified then the other will default to (-@var{realmax}, ## +@var{realmax}). ## ## The seventh argument @var{maxiter} specifies the maximum number of -## iterations. The default value is 100. +## iterations. The default value is 100. ## ## The eighth argument @var{tol} specifies the tolerance for the -## stopping criteria. The default value is @code{sqrt(eps)}. +## stopping criteria. The default value is @code{sqrt(eps)}. ## ## The value returned in @var{info} may be one of the following: ## diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/path/matlabroot.m --- a/scripts/path/matlabroot.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/path/matlabroot.m Sun Nov 27 09:07:37 2011 -0500 @@ -20,7 +20,7 @@ ## @deftypefn {Function File} {} matlabroot () ## Return the name of the top-level Octave installation directory. ## -## This is an alias for the function @code{OCTAVE_HOME} provided +## This is an alias for the function @w{@code{OCTAVE_HOME}} provided ## for compatibility. ## @seealso{OCTAVE_HOME} ## @end deftypefn diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/pkg/pkg.m --- a/scripts/pkg/pkg.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/pkg/pkg.m Sun Nov 27 09:07:37 2011 -0500 @@ -72,7 +72,7 @@ ## @end table ## ## @item update -## Check installed Octave-Forge pacakages against repository and update any +## Check installed Octave-Forge packages against repository and update any ## outdated items. This requires an internet connection and the cURL library. ## Usage: ## diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/__plt_get_axis_arg__.m --- a/scripts/plot/__plt_get_axis_arg__.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/plot/__plt_get_axis_arg__.m Sun Nov 27 09:07:37 2011 -0500 @@ -33,7 +33,7 @@ nogca = false; endif - ## Figure handles are integers, but object handles are non integer, + ## Figure handles are integers, but object handles are non-integer, ## therefore ignore integer scalars. if (nargin > 1 && length (varargin) > 0 && isnumeric (varargin{1}) && numel (varargin{1}) == 1 && ishandle (varargin{1}(1)) diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/guidata.m --- a/scripts/plot/guidata.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/plot/guidata.m Sun Nov 27 09:07:37 2011 -0500 @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{data} =} guidata (@var{handle}) -## @deftypefnx {Function File} guidata (@var{handle}, @var{data}) +## @deftypefnx {Function File} {} guidata (@var{handle}, @var{data}) ## @end deftypefn ## Author: goffioul diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/isonormals.m --- a/scripts/plot/isonormals.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/plot/isonormals.m Sun Nov 27 09:07:37 2011 -0500 @@ -45,8 +45,8 @@ ## given by the patch handle @var{p}. ## ## For example: +## @c Set example in small font to prevent overfull line ## -## @c Set example in small font to prevent overfull line ## @smallexample ## function [] = isofinish (p) ## set (gca, "PlotBoxAspectRatioMode", "manual", ... diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/isosurface.m --- a/scripts/plot/isosurface.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/plot/isosurface.m Sun Nov 27 09:07:37 2011 -0500 @@ -70,8 +70,8 @@ ## will directly draw a random isosurface geometry in a graphics window. ## Another example for an isosurface geometry with different additional ## coloring +## @c Set example in small font to prevent overfull line ## -## @c Set example in small font to prevent overfull line ## @smallexample ## N = 15; # Increase number of vertices in each direction ## iso = .4; # Change isovalue to .1 to display a sphere diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/legend.m --- a/scripts/plot/legend.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/plot/legend.m Sun Nov 27 09:07:37 2011 -0500 @@ -40,6 +40,9 @@ ## ## @multitable @columnfractions 0.06 0.14 0.80 ## +## @headitem @tab @var{pos} @tab +## location of the legend +## ## @item @tab north @tab ## center top ## @@ -403,7 +406,7 @@ if (isfield (hgobj, "displayname") && ! isempty (hgobj.displayname)) hplots = [hplots, hgkids(j)]; - text_strings = {text_strings{:}, hbobj.displayname}; + text_strings = {text_strings{:}, hgobj.displayname}; break; endif endfor @@ -1083,7 +1086,7 @@ %! clf %! rand_2x3_data1 = [0.341447, 0.171220, 0.284370; 0.039773, 0.731725, 0.779382]; %! bar (rand_2x3_data1); -%! ylim ([0 1.2]); +%! ylim ([0 1.0]); %! legend ({"1st Bar", "2nd Bar", "3rd Bar"}); %!demo @@ -1092,6 +1095,7 @@ %! bar (rand_2x3_data2); %! ylim ([0 1.2]); %! legend ("1st Bar", "2nd Bar", "3rd Bar"); +%! legend right %!demo %! clf diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/module.mk --- a/scripts/plot/module.mk Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/plot/module.mk Sun Nov 27 09:07:37 2011 -0500 @@ -190,8 +190,10 @@ plot/uipanel.m \ plot/uipushtool.m \ plot/uiputfile.m \ + plot/uiresume.m \ plot/uitoggletool.m \ plot/uitoolbar.m \ + plot/uiwait.m \ plot/view.m \ plot/waitforbuttonpress.m \ plot/whitebg.m \ diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/private/__bar__.m --- a/scripts/plot/private/__bar__.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/plot/private/__bar__.m Sun Nov 27 09:07:37 2011 -0500 @@ -82,7 +82,7 @@ [linespec, valid] = __pltopt__ (func, varargin{idx}, false); if (valid) have_line_spec = true; - newargs = [{linespec.color}, newargs]; + newargs = [{"facecolor", linespec.color}, newargs] idx++; continue; endif diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/private/__fltk_file_filter__.m --- a/scripts/plot/private/__fltk_file_filter__.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/plot/private/__fltk_file_filter__.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {@var{filterspec} =} __fltk_file_filter__ (@var{filter}) +## @deftypefn {Function File} {@var{filterspec} =} __fltk_file_filter__ (@var{filter}) ## Undocumented internal function. ## @end deftypefn diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/private/__is_function__.m --- a/scripts/plot/private/__is_function__.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/plot/private/__is_function__.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {@var{result} =} __is_function__ (@var{func}) +## @deftypefn {Function File} {@var{result} =} __is_function__ (@var{func}) ## Undocumented internal function. ## @end deftypefn diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/private/__next_line_style__.m --- a/scripts/plot/private/__next_line_style__.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/plot/private/__next_line_style__.m Sun Nov 27 09:07:37 2011 -0500 @@ -39,7 +39,10 @@ style_index = 1; endif elseif (reset || isempty (style_rotation)) - style_rotation = strsplit (get (gca (), "linestyleorder"), "|"); + style_rotation = get (gca (), "linestyleorder"); + if (ischar (style_rotation)) + style_rotation = strsplit (style_rotation, "|"); + endif num_styles = length (style_rotation); style_index = 1; endif diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/private/__uigetdir_fltk__.m --- a/scripts/plot/private/__uigetdir_fltk__.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/plot/private/__uigetdir_fltk__.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {@var{dirname} =} __uigetdir_fltk__ (@var{start_path}, @var{dialog_title}) +## @deftypefn {Function File} {@var{dirname} =} __uigetdir_fltk__ (@var{start_path}, @var{dialog_title}) ## Undocumented internal function. ## @end deftypefn diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/private/__uigetfile_fltk__.m --- a/scripts/plot/private/__uigetfile_fltk__.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/plot/private/__uigetfile_fltk__.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} __uigetfile_fltk__ () +## @deftypefn {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} __uigetfile_fltk__ () ## Undocumented internal function. ## @end deftypefn diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/private/__uiobject_split_args__.m --- a/scripts/plot/private/__uiobject_split_args__.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/plot/private/__uiobject_split_args__.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{p}, @var{args}] =} __uiobject_split_args__ (@var{who}, @var{args}, @var{parent_type}, @var{use_gcf}) +## @deftypefn {Function File} {[@var{p}, @var{args}] =} __uiobject_split_args__ (@var{who}, @var{args}, @var{parent_type}, @var{use_gcf}) ## @end deftypefn ## Author: goffioul diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/private/__uiputfile_fltk__.m --- a/scripts/plot/private/__uiputfile_fltk__.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/plot/private/__uiputfile_fltk__.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} __uiputfile_fltk__ () +## @deftypefn {Function File} {[@var{fname}, @var{fpath}, @var{fltidx}] =} __uiputfile_fltk__ () ## Undocumented internal function. ## @end deftypefn diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/uicontextmenu.m --- a/scripts/plot/uicontextmenu.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/plot/uicontextmenu.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {@var{handle} =} uicontextmenu ('Name', value, @dots{}) +## @deftypefn {Function File} {@var{handle} =} uicontextmenu ('Name', value, @dots{}) ## @end deftypefn ## Author: goffioul diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/uicontrol.m --- a/scripts/plot/uicontrol.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/plot/uicontrol.m Sun Nov 27 09:07:37 2011 -0500 @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{handle} =} uicontrol ('Name', value, @dots{}) ## @deftypefnx {Function File} {@var{handle} =} uicontrol (@var{parent}, 'Name', value, @dots{}) -## @deftypefnx {Function File} uicontrol (@var{handle}) +## @deftypefnx {Function File} {} uicontrol (@var{handle}) ## @end deftypefn ## Author: goffioul diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/uiresume.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/plot/uiresume.m Sun Nov 27 09:07:37 2011 -0500 @@ -0,0 +1,45 @@ +## Copyright (C) 2011 Michael Goffioul +## +## 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 3 of the License, 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, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {} uiresume (@var{h}) +## Resume program execution suspended with @code{uiwait}. The handle @var{h} +## must be the same as the on specified in @code{uiwait}. If the handle +## is invalid or there is no @code{uiwait} call pending for the figure +## with handle @var{h}, this function does nothing. +## @seealso{uiwait} +## @end deftypefn + +## Author: goffioul + +function uiresume (h) + + if (! ishandle (h) || ! strcmp (get (h, "type"), "figure")) + error ("uiresume: invalid figure handle"); + endif + + try + uiwait_state = get (h, "__uiwait_state__"); + if (strcmp (uiwait_state, "active")) + set (h, "__uiwait_state__", "triggered"); + endif + catch + # Ignore exception + end_try_catch + +endfunction diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/plot/uiwait.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/plot/uiwait.m Sun Nov 27 09:07:37 2011 -0500 @@ -0,0 +1,80 @@ +## Copyright (C) 2011 Michael Goffioul +## +## 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 3 of the License, 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, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {} uiwait +## @deftypefnx {Function File} {} uiwait (@var{h}) +## @deftypefnx {Function File} {} uiwait (@var{h}, @var{timeout}) +## Suspend program execution until the figure with handle @var{h} is +## deleted or @code{uiresume} is called. When no figure handle is specified, +## this function uses the current figure. +## +## If the figure handle is invalid or there is no current figure, this +## functions returns immediately. +## +## When specified, @var{timeout} defines the number of seconds to wait +## for the figure deletion or the @code{uiresume} call. The timeout value +## must be at least 1. If a smaller value is specified, a warning is issued +## and a timeout value of 1 is used instead. If a non-integer value is +## specified, it is truncated towards 0. If @var{timeout} is not specified, +## the program execution is suspended indefinitely. +## @seealso{uiresume, waitfor} +## @end deftypefn + +## Author: goffioul + +function uiwait (varargin) + + h = []; + timeout = []; + + if (nargin == 0) + h = get (0, "currentfigure"); + else + h = varargin{1}; + if (! ishandle (h) || ! strcmp (get (h, "type"), "figure")) + error ("uiwait: invalid figure handle"); + endif + if (nargin > 1) + timeout = varargin{2}; + endif + endif + + if (! isempty (h)) + unwind_protect + try + addproperty ("__uiwait_state__", h, "radio", "none|{active}|triggered"); + catch + if (! strcmp (get (h, "__uiwait_state__"), "none")) + error ("uiwait: an active uiwait call for this figure already exists"); + endif + set (h, "__uiwait_state__", "active"); + end_try_catch + waitfor_args = {h, "__uiwait_state__", "triggered"}; + if (! isempty (timeout)) + waitfor_args(end+1:end+2) = {"timeout", timeout}; + endif + waitfor (waitfor_args{:}); + unwind_protect_cleanup + if (ishandle (h) && isprop (h, "__uiwait_state__")) + set (h, "__uiwait_state__", "none"); + endif + end_unwind_protect + endif + +endfunction diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/polynomial/mkpp.m --- a/scripts/polynomial/mkpp.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/polynomial/mkpp.m Sun Nov 27 09:07:37 2011 -0500 @@ -22,7 +22,7 @@ ## ## Construct a piece-wise polynomial (pp) structure from sample points ## @var{breaks} and coefficients @var{coefs}. @var{breaks} must be a vector of -## strictly increasing values. The number of intervals is given by +## strictly increasing values. The number of intervals is given by ## @code{@var{ni} = length (@var{breaks}) - 1}. ## When @var{m} is the polynomial order @var{coefs} must be of ## size: @var{ni} x @var{m} + 1. @@ -33,11 +33,11 @@ ## lowest (@var{0}). ## ## @var{coefs} may also be a multi-dimensional array, specifying a vector-valued -## or array-valued polynomial. In that case the polynomial order is defined +## or array-valued polynomial. In that case the polynomial order is defined ## by the length of the last dimension of @var{coefs}. ## The size of first dimension(s) are given by the scalar or -## vector @var{d}. If @var{d} is not given it is set to @code{1}. -## In any case @var{coefs} is reshaped to a 2d matrix of +## vector @var{d}. If @var{d} is not given it is set to @code{1}. +## In any case @var{coefs} is reshaped to a 2-D matrix of ## size @code{[@var{ni}*prod(@var{d} @var{m})] } ## ## @seealso{unmkpp, ppval, spline} diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/polynomial/ppder.m --- a/scripts/polynomial/ppder.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/polynomial/ppder.m Sun Nov 27 09:07:37 2011 -0500 @@ -18,8 +18,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {ppd =} ppder (pp, m) -## Computes the piecewise @var{m}-th derivative of a piecewise polynomial -## struct @var{pp}. If @var{m} is omitted the first derivate is +## Compute the piecewise @var{m}-th derivative of a piecewise polynomial +## struct @var{pp}. If @var{m} is omitted the first derivate is ## calculated. ## @seealso{mkpp, ppval, ppint} ## @end deftypefn diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/polynomial/residue.m --- a/scripts/polynomial/residue.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/polynomial/residue.m Sun Nov 27 09:07:37 2011 -0500 @@ -18,7 +18,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{r}, @var{p}, @var{k}, @var{e}] =} residue (@var{b}, @var{a}) +## @deftypefn {Function File} {[@var{r}, @var{p}, @var{k}, @var{e}] =} residue (@var{b}, @var{a}) ## @deftypefnx {Function File} {[@var{b}, @var{a}] =} residue (@var{r}, @var{p}, @var{k}) ## @deftypefnx {Function File} {[@var{b}, @var{a}] =} residue (@var{r}, @var{p}, @var{k}, @var{e}) ## The first calling form computes the partial fraction expansion for the diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/prefs/addpref.m --- a/scripts/prefs/addpref.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/prefs/addpref.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} addpref (@var{group}, @var{pref}, @var{val}) +## @deftypefn {Function File} {} addpref (@var{group}, @var{pref}, @var{val}) ## Add a preference @var{pref} and associated value @var{val} to the ## named preference group @var{group}. ## @@ -27,7 +27,7 @@ ## of character strings. The corresponding value @var{val} may be any ## value, or, if @var{pref} is a cell array of strings, @var{val} ## must be a cell array of values with the same size as @var{pref}. -## @seealso{pref, getpref, ispref, rmpref, setpref} +## @seealso{setpref, getpref, ispref, rmpref} ## @end deftypefn ## Author: jwe diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/prefs/getpref.m --- a/scripts/prefs/getpref.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/prefs/getpref.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} getpref (@var{group}, @var{pref}, @var{default}) +## @deftypefn {Function File} {} getpref (@var{group}, @var{pref}, @var{default}) ## Return the preference value corresponding to the named preference ## @var{pref} in the preference group @var{group}. ## @@ -37,7 +37,7 @@ ## ## If no arguments are specified, return a structure containing all ## groups of preferences and their values. -## @seealso{addpref, ispref, rmpref, setpref} +## @seealso{addpref, setpref, ispref, rmpref} ## @end deftypefn ## Author: jwe diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/prefs/ispref.m --- a/scripts/prefs/ispref.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/prefs/ispref.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} ispref (@var{group}, @var{pref}) +## @deftypefn {Function File} {} ispref (@var{group}, @var{pref}) ## Return true if the named preference @var{pref} exists in the ## preference group @var{group}. ## @@ -26,9 +26,9 @@ ## The preference @var{pref} may be a character string or a cell array ## of character strings. ## -## If @var{pref} is not specified, return true if the the preference +## If @var{pref} is not specified, return true if the preference ## group @var{group} exists. -## @seealso{addpref, getpref, rmpref, setpref} +## @seealso{getpref, addpref, setpref, rmpref} ## @end deftypefn ## Author: jwe diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/prefs/private/loadprefs.m --- a/scripts/prefs/private/loadprefs.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/prefs/private/loadprefs.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} loadprefs () +## @deftypefn {Function File} {} loadprefs () ## Undocumented internal function. ## @end deftypefn diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/prefs/private/prefsfile.m --- a/scripts/prefs/private/prefsfile.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/prefs/private/prefsfile.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} prefsfile () +## @deftypefn {Function File} {} prefsfile () ## Undocumented internal function. ## @end deftypefn diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/prefs/private/saveprefs.m --- a/scripts/prefs/private/saveprefs.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/prefs/private/saveprefs.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} saveprefs () +## @deftypefn {Function File} {} saveprefs () ## Undocumented internal function. ## @end deftypefn diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/prefs/rmpref.m --- a/scripts/prefs/rmpref.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/prefs/rmpref.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} rmpref (@var{group}, @var{pref}) +## @deftypefn {Function File} {} rmpref (@var{group}, @var{pref}) ## Remove the named preference @var{pref} from the preference group ## @var{group}. ## @@ -30,7 +30,7 @@ ## @var{group}. ## ## It is an error to remove a nonexistent preference or group. -## @seealso{addpref, getpref, rmpref, setpref} +## @seealso{addpref, ispref, setpref, getpref} ## @end deftypefn ## Author: jwe diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/prefs/setpref.m --- a/scripts/prefs/setpref.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/prefs/setpref.m Sun Nov 27 09:07:37 2011 -0500 @@ -17,7 +17,7 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} setpref (@var{group}, @var{pref}, @var{val}) +## @deftypefn {Function File} {} setpref (@var{group}, @var{pref}, @var{val}) ## Set a preference @var{pref} to the given @var{val} in the named ## preference group @var{group}. ## @@ -29,7 +29,7 @@ ## must be a cell array of values with the same size as @var{pref}. ## ## If the named preference or group does not exist, it is added. -## @seealso{pref, getpref, ispref, rmpref, setpref} +## @seealso{addpref, getpref, ispref, rmpref} ## @end deftypefn ## Author: jwe diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/signal/fftshift.m --- a/scripts/signal/fftshift.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/signal/fftshift.m Sun Nov 27 09:07:37 2011 -0500 @@ -31,7 +31,8 @@ ## f = [ -(ceil((N-1)/2):-1:1)*df 0 (1:floor((N-1)/2))*df ] ## @end example ## -## where @math{df} = 1 / @math{dt}. +## @noindent +## where @nospell{@math{df}} = 1 / @math{dt}. ## ## If @var{x} is a matrix, the same holds for rows and columns. If ## @var{x} is an array, then the same holds along each dimension. diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/sparse/bicg.m --- a/scripts/sparse/bicg.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/sparse/bicg.m Sun Nov 27 09:07:37 2011 -0500 @@ -16,17 +16,19 @@ ## -*- texinfo -*- ## -## @deftypefn {Function File} {@var{x} =} bicg (@var{A}, @var{b}, @var{rtol}, @var{maxit}, @var{M1}, @var{M2}, @var{x0}) +## @deftypefn {Function File} {@var{x} =} bicg (@var{A}, @var{b}, @var{rtol}, @var{maxit}, @var{M1}, @var{M2}, @var{x0}) ## @deftypefnx {Function File} {@var{x} =} bicg (@var{A}, @var{b}, @var{rtol}, @var{maxit}, @var{P}) -## @deftypefnx {Function File} {[@var{x}, @var{flag}, @var{relres}, @var{iter}, @var{resvec}] =} bicg (@var{A}, @var{b}, ...) +## @deftypefnx {Function File} {[@var{x}, @var{flag}, @var{relres}, @var{iter}, @var{resvec}] =} bicg (@var{A}, @var{b}, @dots{}) ## Solve @code{A x = b} using the Bi-conjugate gradient iterative method. ## ## @itemize @minus ## @item @var{rtol} is the relative tolerance, if not given ## or set to [] the default value 1e-6 is used. +## ## @item @var{maxit} the maximum number of outer iterations, ## if not given or set to [] the default value ## @code{min (20, numel (b))} is used. +## ## @item @var{x0} the initial guess, if not given or set to [] ## the default value @code{zeros (size (b))} is used. ## @end itemize @@ -41,22 +43,27 @@ ## @code{g(x, 'notransp') = M1 \ x} or @code{g(x, 'notransp') = M2 \ x} and ## @code{g(x, 'transp') = M1' \ x} or @code{g(x, 'transp') = M2' \ x}. ## -## If colled with more than one output parameter +## If called with more than one output parameter ## ## @itemize @minus ## @item @var{flag} indicates the exit status: ## @itemize @minus ## @item 0: iteration converged to the within the chosen tolerance +## ## @item 1: the maximum number of iterations was reached before convergence +## ## @item 3: the algorithm reached stagnation ## @end itemize ## (the value 2 is unused but skipped for compatibility). +## ## @item @var{relres} is the final value of the relative residual. +## ## @item @var{iter} is the number of iterations performed. +## ## @item @var{resvec} is a vector containing the relative residual at each iteration. ## @end itemize ## -## @seealso{bicgstab,cgs,gmres,pcg} +## @seealso{bicgstab, cgs, gmres, pcg} ## ## @end deftypefn diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/sparse/bicgstab.m --- a/scripts/sparse/bicgstab.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/sparse/bicgstab.m Sun Nov 27 09:07:37 2011 -0500 @@ -19,17 +19,20 @@ ## -*- texinfo -*- ## -## @deftypefn {Function File} {@var{x} =} bicgstab (@var{A}, @var{b}, @var{rtol}, @var{maxit}, @var{M1}, @var{M2}, @var{x0}) +## @deftypefn {Function File} {@var{x} =} bicgstab (@var{A}, @var{b}, @var{rtol}, @var{maxit}, @var{M1}, @var{M2}, @var{x0}) ## @deftypefnx {Function File} {@var{x} =} bicgstab (@var{A}, @var{b}, @var{rtol}, @var{maxit}, @var{P}) -## @deftypefnx {Function File} {[@var{x}, @var{flag}, @var{relres}, @var{iter}, @var{resvec}] =} bicgstab (@var{A}, @var{b}, ...) -## Solve @code{A x = b} using the stabilizied Bi-conjugate gradient iterative method. +## @deftypefnx {Function File} {[@var{x}, @var{flag}, @var{relres}, @var{iter}, @var{resvec}] =} bicgstab (@var{A}, @var{b}, @dots{}) +## Solve @code{A x = b} using the stabilizied Bi-conjugate gradient iterative +## method. ## ## @itemize @minus ## @item @var{rtol} is the relative tolerance, if not given or set to ## [] the default value 1e-6 is used. +## ## @item @var{maxit} the maximum number of outer iterations, if not ## given or set to [] the default value @code{min (20, numel (b))} is ## used. +## ## @item @var{x0} the initial guess, if not given or set to [] the ## default value @code{zeros (size (b))} is used. ## @end itemize @@ -38,8 +41,9 @@ ## inline function @code{f} such that @code{f(x) = A*x}. ## ## The preconditioner @var{P} is given as @code{P = M1 * M2}. -## Both @var{M1} and @var{M2} can be passed as a matrix or as a function handle or -## inline function @code{g} such that @code{g(x) = M1 \ x} or @code{g(x) = M2 \ x}. +## Both @var{M1} and @var{M2} can be passed as a matrix or as a function +## handle or inline function @code{g} such that @code{g(x) = M1 \ x} or +## @code{g(x) = M2 \ x}. ## ## If called with more than one output parameter ## @@ -47,16 +51,21 @@ ## @item @var{flag} indicates the exit status: ## @itemize @minus ## @item 0: iteration converged to the within the chosen tolerance +## ## @item 1: the maximum number of iterations was reached before convergence +## ## @item 3: the algorithm reached stagnation ## @end itemize ## (the value 2 is unused but skipped for compatibility). +## ## @item @var{relres} is the final value of the relative residual. +## ## @item @var{iter} is the number of iterations performed. +## ## @item @var{resvec} is a vector containing the relative residual at each iteration. ## @end itemize ## -## @seealso{bicg,cgs,gmres,pcg} +## @seealso{bicg, cgs, gmres, pcg} ## ## @end deftypefn diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/sparse/cgs.m --- a/scripts/sparse/cgs.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/sparse/cgs.m Sun Nov 27 09:07:37 2011 -0500 @@ -19,18 +19,20 @@ ## -*- texinfo -*- ## -## @deftypefn {Function File} {@var{x} =} cgs (@var{A}, @var{b}, @var{rtol}, @var{maxit}, @var{M1}, @var{M2}, @var{x0}) +## @deftypefn {Function File} {@var{x} =} cgs (@var{A}, @var{b}, @var{rtol}, @var{maxit}, @var{M1}, @var{M2}, @var{x0}) ## @deftypefnx {Function File} {@var{x} =} cgs (@var{A}, @var{b}, @var{rtol}, @var{maxit}, @var{P}) -## @deftypefnx {Function File} {[@var{x}, @var{flag}, @var{relres}, @var{iter}, @var{resvec}] =} cgs (@var{A}, @var{b}, ...) +## @deftypefnx {Function File} {[@var{x}, @var{flag}, @var{relres}, @var{iter}, @var{resvec}] =} cgs (@var{A}, @var{b}, @dots{}) ## Solve @code{A x = b}, where @var{A} is a square matrix, using the ## Conjugate Gradients Squared method. ## ## @itemize @minus ## @item @var{rtol} is the relative tolerance, if not given or set to [] ## the default value 1e-6 is used. +## ## @item @var{maxit} the maximum number of outer iterations, if not ## given or set to [] the default value @code{min (20, numel (b))} is ## used. +## ## @item @var{x0} the initial guess, if not given or set to [] the ## default value @code{zeros (size (b))} is used. ## @end itemize @@ -49,17 +51,22 @@ ## @item @var{flag} indicates the exit status: ## @itemize @minus ## @item 0: iteration converged to the within the chosen tolerance +## ## @item 1: the maximum number of iterations was reached before convergence +## ## @item 3: the algorithm reached stagnation ## @end itemize ## (the value 2 is unused but skipped for compatibility). +## ## @item @var{relres} is the final value of the relative residual. +## ## @item @var{iter} is the number of iterations performed. +## ## @item @var{resvec} is a vector containing the relative residual at ## each iteration. ## @end itemize ## -## @seealso{pcg,bicgstab,bicg,gmres} +## @seealso{pcg, bicgstab, bicg, gmres} ## @end deftypefn function [x, flag, relres, iter, resvec] = cgs (A, b, tol, maxit, M1, M2, x0) diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/sparse/gmres.m --- a/scripts/sparse/gmres.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/sparse/gmres.m Sun Nov 27 09:07:37 2011 -0500 @@ -51,13 +51,19 @@ ## @item @var{flag} indicates the exit status: ## @table @asis ## @item 0 : iteration converged to within the specified tolerance +## ## @item 1 : maximum number of iterations exceeded +## ## @item 2 : unused, but skipped for compatibility +## ## @item 3 : algorithm reached stagnation ## @end table +## ## @item @var{relres} is the final value of the relative residual. +## ## @item @var{iter} is a vector containing the number of outer iterations and ## total iterations performed. +## ## @item @var{resvec} is a vector containing the relative residual at each ## iteration. ## @end itemize diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/sparse/private/__sprand_impl__.m --- a/scripts/sparse/private/__sprand_impl__.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/sparse/private/__sprand_impl__.m Sun Nov 27 09:07:37 2011 -0500 @@ -21,7 +21,7 @@ ## public domain. ## -*- texinfo -*- -## @deftypefn {Function File} {} __sprand_impl__ (@var{s}, @var{randfun}) +## @deftypefn {Function File} {} __sprand_impl__ (@var{s}, @var{randfun}) ## @deftypefnx {Function File} {} __sprand_impl__ (@var{m}, @var{n}, @var{d}, @var{funname}, @var{randfun}) ## Undocumented internal function. ## @end deftypefn diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/special-matrix/hadamard.m --- a/scripts/special-matrix/hadamard.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/special-matrix/hadamard.m Sun Nov 27 09:07:37 2011 -0500 @@ -66,9 +66,9 @@ ## Find k if n = 2^k*p. k = 0; - while (n > 1 && floor (n/2) == n/2) + while (n > 1 && fix (n/2) == n/2) k++; - n = n/2; + n /= 2; endwhile ## Find base hadamard. @@ -90,7 +90,7 @@ case 5 h = h20 (); case 7 - h = hnormalize (h28 ()); + h = h28 (); otherwise error ("hadamard: N must be 2^k*p, for p = 1, 12, 20 or 28"); endswitch @@ -98,15 +98,16 @@ ## Build H(2^k*n) from kron(H(2^k),H(n)). h2 = [1,1;1,-1]; while (true) - if (floor (k/2) != k/2) + if (fix (k/2) != k/2) h = kron (h2, h); endif - k = floor (k/2); + k = fix (k/2); if (k == 0) break; endif h2 = kron (h2, h2); endwhile + endfunction function h = h12 () @@ -117,7 +118,6 @@ h(2:end,2:end) = toeplitz (tu, tl); endfunction - function h = h20 () tu = [+1,-1,-1,+1,+1,+1,+1,-1,+1,-1,+1,-1,-1,-1,-1,+1,+1,-1,-1]; tl = [+1,-1,-1,+1,+1,-1,-1,-1,-1,+1,-1,+1,-1,+1,+1,+1,+1,-1,-1]; @@ -126,53 +126,50 @@ h(2:end,2:end) = fliplr (toeplitz (tu, tl)); endfunction -function h = hnormalize (h) - ## Make sure each row and column starts with +1. - h(h(:,1)==-1,:) *= -1; - h(:,h(1,:)==-1) *= -1; -endfunction - function h = h28 () ## Williamson matrix construction from ## http://www.research.att.com/~njas/hadamard/had.28.will.txt - s = ["+------++----++-+--+-+--++--"; - "-+-----+++-----+-+--+-+--++-"; - "--+-----+++---+-+-+----+--++"; - "---+-----+++---+-+-+-+--+--+"; - "----+-----+++---+-+-+++--+--"; - "-----+-----++++--+-+--++--+-"; - "------++----++-+--+-+--++--+"; - "--++++-+-------++--+++-+--+-"; - "---++++-+-----+-++--+-+-+--+"; - "+---+++--+----++-++--+-+-+--"; - "++---++---+----++-++--+-+-+-"; - "+++---+----+----++-++--+-+-+"; - "++++--------+-+--++-++--+-+-"; - "-++++--------+++--++--+--+-+"; - "-+-++-++--++--+--------++++-"; - "+-+-++--+--++--+--------++++"; - "-+-+-++--+--++--+----+---+++"; - "+-+-+-++--+--+---+---++---++"; - "++-+-+-++--+------+--+++---+"; - "-++-+-+-++--+------+-++++---"; - "+-++-+---++--+------+-++++--"; - "-++--++-+-++-+++----++------"; - "+-++--++-+-++-+++-----+-----"; - "++-++---+-+-++-+++-----+----"; - "-++-++-+-+-+-+--+++-----+---"; - "--++-++++-+-+----+++-----+--"; - "+--++-+-++-+-+----+++-----+-"; - "++--++-+-++-+-+----++------+"]; - ## Without this, the assignment of -1 will not work properly - ## (compatibility forces LHS(idx) = ANY_VAL to keep the LHS logical - ## instead of widening to a type that can represent ANY_VAL). - h = double (s == "+"); - h(!h) = -1; + ## Normalized so that each row and column starts with +1 + h = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 1 1 1 1 -1 1 1 1 1 -1 1 -1 1 -1 + 1 -1 1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 -1 -1 -1 -1 1 1 -1 1 -1 1 1 1 1 1 + 1 -1 -1 1 -1 -1 -1 1 1 1 1 1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 + 1 -1 -1 -1 1 -1 -1 1 1 -1 1 1 1 1 1 -1 -1 -1 1 1 1 -1 1 -1 1 -1 -1 -1 + 1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 1 -1 + 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 1 -1 1 + 1 -1 1 1 1 1 -1 -1 1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 -1 -1 1 1 1 1 -1 + 1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 1 -1 1 + 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 -1 1 -1 -1 -1 -1 -1 1 1 1 -1 -1 1 1 1 + 1 -1 1 1 1 -1 -1 -1 -1 1 -1 1 1 -1 -1 -1 1 1 -1 1 1 -1 -1 1 1 -1 -1 1 + 1 -1 -1 1 1 1 -1 -1 -1 1 1 -1 1 -1 -1 1 1 -1 1 1 -1 -1 1 -1 -1 1 1 -1 + 1 -1 -1 -1 1 1 1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 1 + 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 + 1 1 -1 1 1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 1 -1 + 1 1 -1 1 -1 -1 1 -1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 1 -1 1 1 1 1 -1 -1 + 1 1 -1 1 -1 1 1 1 1 1 -1 -1 1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 1 1 + 1 1 -1 1 -1 1 -1 1 -1 1 -1 1 1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 + 1 -1 1 -1 1 -1 1 1 1 1 1 -1 1 -1 -1 1 -1 1 -1 -1 1 1 -1 -1 -1 -1 1 -1 + 1 1 1 -1 1 -1 1 1 -1 1 -1 -1 1 1 1 -1 1 -1 -1 -1 -1 -1 1 1 -1 1 -1 -1 + 1 1 -1 -1 1 -1 1 -1 -1 -1 -1 1 1 1 -1 1 -1 1 1 -1 -1 -1 -1 -1 1 1 1 1 + 1 1 1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 + 1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 -1 1 1 1 -1 1 -1 -1 1 -1 -1 1 1 + 1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 1 -1 -1 -1 1 1 + 1 1 1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 1 1 -1 1 -1 -1 -1 1 -1 -1 + 1 -1 1 1 -1 1 1 -1 -1 -1 1 -1 1 1 1 -1 1 1 1 -1 -1 1 -1 -1 1 -1 -1 -1 + 1 1 1 -1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 1 -1 1 -1 -1 1 1 -1 -1 -1 1 + 1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 1 -1 1 1 1 -1 -1 1 1 -1 -1 1 -1]; endfunction -%!assert(hadamard(1),1) -%!assert(hadamard(2),[1,1;1,-1]) + +%!assert (hadamard (1), 1) +%!assert (hadamard (2), [1,1;1,-1]) %!test -%! for n=[1,2,4,8,12,24,48,20,28,2^9] -%! h=hadamard(n); assert(norm(h*h'-n*eye(n)),0); -%! end +%! for n = [1,2,4,8,12,24,48,20,28,2^9] +%! h = hadamard(n); +%! assert (norm (h*h' - n*eye (n)), 0); +%! endfor + +%!error hadamard () +%!error hadamard (1,2) +%!error hadamard (5) + diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/special-matrix/hankel.m --- a/scripts/special-matrix/hankel.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/special-matrix/hankel.m Sun Nov 27 09:07:37 2011 -0500 @@ -49,69 +49,50 @@ function retval = hankel (c, r) - if (nargin == 1) - r = resize (resize (c, 0), size(c)); - elseif (nargin != 2) + if (nargin < 1 || nargin > 2) print_usage (); endif - [c_nr, c_nc] = size (c); - [r_nr, r_nc] = size (r); - - if ((c_nr != 1 && c_nc != 1) || (r_nr != 1 && r_nc != 1)) - error ("hankel: expecting vector arguments"); - endif - if (nargin == 1) - r (1) = c (length (c)); - endif + + if (! isvector (c)) + error ("hankel: C must be a vector"); + endif - if (c_nc != 1) - c = c.'; - endif + nr = length (c); + nc = nr; + data = [c(:) ; zeros(nr, 1)]; + + else - if (r_nr != 1) - r = r.'; - endif + if (! (isvector (c) && isvector (r))) + error ("hankel: C and R must be vectors"); + elseif (r(1) != c(end)) + warning ("hankel: column wins anti-diagonal conflict"); + endif - nc = length (r); - nr = length (c); + nr = length (c); + nc = length (r); + data = [c(:) ; r(2:end)(:)]; - if (r (1) != c (nr)) - warning ("hankel: column wins anti-diagonal conflict"); endif - - ## This should probably be done with the colon operator... - - retval = resize (resize (c, 0), nr, nc); - - for i = 1:min (nr, nc) - retval (1:nr-i+1, i) = c (i:nr); - endfor - - tmp = 1; - if (nc <= nr) - tmp = nr - nc + 2; - endif - - for i = nr:-1:tmp - retval (i, 2+nr-i:nc) = r (2:nc-nr+i); - endfor + + slices = cellslices (data, 1:nc, nr:1:nc+nr-1); + retval = horzcat (slices{:}); endfunction -%!assert(hankel(1:3),[1,2,3;2,3,0;3,0,0]) -%!assert(hankel(1),[1]); -%!assert(hankel(1:3,3:6),[1,2,3,4;2,3,4,5;3,4,5,6]); -%!assert(hankel(1:3,3:4),[1,2;2,3;3,4]); -%!assert(hankel(1:3,4:6),[1,2,3;2,3,5;3,5,6]); -%!assert((hankel (1) == 1 && hankel ([1, 2]) == [1, 2; 2, 0] -%! && hankel ([1, 2], [2; -1; -3]) == [1, 2, -1; 2, -1, -3])); - -%!error hankel ([1, 2; 3, 4], [1, 2; 3, 4]); +%!assert (hankel (1), [1]) +%!assert (hankel ([1, 2]), [1, 2; 2, 0]) +%!assert (hankel ([1, 2], [2; -1; -3]), [1, 2, -1; 2, -1, -3]) +%!assert (hankel (1:3), [1,2,3;2,3,0;3,0,0]) +%!assert (hankel (1:3,3:6), [1,2,3,4;2,3,4,5;3,4,5,6]) +%!assert (hankel (1:3,3:4), [1,2;2,3;3,4]) +%!assert (hankel (1:3,4:6), [1,2,3;2,3,5;3,5,6]) %!error hankel (); +%!error hankel (1, 2, 3); +%!error hankel ([1, 2; 3, 4]) +%!error hankel (1:4, [1, 2; 3, 4]) -%!error hankel (1, 2, 3); - diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/special-matrix/invhilb.m --- a/scripts/special-matrix/invhilb.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/special-matrix/invhilb.m Sun Nov 27 09:07:37 2011 -0500 @@ -77,57 +77,52 @@ if (nargin != 1) print_usage (); + elseif (! isscalar (n)) + error ("invhilb: N must be a scalar integer"); endif - nmax = length (n); - if (nmax == 1) + ## The point about the second formula above is that when vectorized, + ## p(k) is evaluated for k=1:n which involves O(n) calls to bincoeff + ## instead of O(n^2). + ## + ## We evaluate the expression as (-1)^(i+j)*(p(i)*p(j))/(i+j-1) except + ## when p(i)*p(j) would overflow. In cases where p(i)*p(j) is an exact + ## machine number, the result is also exact. Otherwise we calculate + ## (-1)^(i+j)*p(i)*(p(j)/(i+j-1)). + ## + ## The Octave bincoeff routine uses transcendental functions (gammaln + ## and exp) rather than multiplications, for the sake of speed. + ## However, it rounds the answer to the nearest integer, which + ## justifies the claim about exactness made above. - ## The point about the second formula above is that when vectorized, - ## p(k) is evaluated for k=1:n which involves O(n) calls to bincoeff - ## instead of O(n^2). - ## - ## We evaluate the expression as (-1)^(i+j)*(p(i)*p(j))/(i+j-1) except - ## when p(i)*p(j) would overflow. In cases where p(i)*p(j) is an exact - ## machine number, the result is also exact. Otherwise we calculate - ## (-1)^(i+j)*p(i)*(p(j)/(i+j-1)). - ## - ## The Octave bincoeff routine uses transcendental functions (gammaln - ## and exp) rather than multiplications, for the sake of speed. - ## However, it rounds the answer to the nearest integer, which - ## justifies the claim about exactness made above. - - retval = zeros (n); - k = [1:n]; - p = k .* bincoeff (k+n-1, k-1) .* bincoeff (n, k); - p(2:2:n) = -p(2:2:n); - if (n < 203) - for l = 1:n - retval(l,:) = (p(l) * p) ./ [l:l+n-1]; - endfor - else - for l = 1:n - retval(l,:) = p(l) * (p ./ [l:l+n-1]); - endfor - endif + retval = zeros (n); + k = [1:n]; + p = k .* bincoeff (k+n-1, k-1) .* bincoeff (n, k); + p(2:2:n) = -p(2:2:n); + if (n < 203) + for l = 1:n + retval(l,:) = (p(l) * p) ./ [l:l+n-1]; + endfor else - error ("invhilb: expecting scalar argument, found something else"); + for l = 1:n + retval(l,:) = p(l) * (p ./ [l:l+n-1]); + endfor endif endfunction + +%!assert (invhilb (1), 1) +%!assert (invhilb (2), [4, -6; -6, 12]) %!test -%! result4 = [16, -120, 240, -140; -%! -120, 1200, -2700, 1680; -%! 240, -2700, 6480, -4200; -%! -140, 1680, -4200, 2800]; -%! -%! assert((invhilb (1) == 1 && invhilb (2) == [4, -6; -6, 12] -%! && invhilb (4) == result4 -%! && abs (invhilb (7) * hilb (7) - eye (7)) < sqrt (eps))); +%! result4 = [16 , -120 , 240 , -140; +%! -120, 1200 , -2700, 1680; +%! 240 , -2700, 6480 , -4200; +%! -140, 1680 , -4200, 2800]; +%! assert (invhilb (4), result4); +%!assert (abs (invhilb (7) * hilb (7) - eye (7)) < sqrt (eps)) -%!error invhilb ([1, 2]); +%!error invhilb () +%!error invhilb (1, 2) +%!error invhilb ([1, 2]) -%!error invhilb (); - -%!error invhilb (1, 2); - diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/special-matrix/magic.m --- a/scripts/special-matrix/magic.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/special-matrix/magic.m Sun Nov 27 09:07:37 2011 -0500 @@ -32,8 +32,8 @@ print_usage (); endif - if (n != floor (n) || n < 0 || n == 2) - error ("magic: N must be an positive integer not equal to 2"); + if (n != fix (n) || n < 0 || n == 2) + error ("magic: N must be a positive integer not equal to 2"); endif if (n == 0) @@ -45,7 +45,7 @@ shift = floor ((0:n*n-1)/n); c = mod ([1:n*n] - shift + (n-3)/2, n); r = mod ([n*n:-1:1] + 2*shift, n); - A (c*n+r+1) = 1:n*n; + A(c*n+r+1) = 1:n*n; A = reshape (A, n, n); elseif (mod (n, 4) == 0) @@ -64,7 +64,7 @@ A = magic (m); A = [A, A+2*m*m; A+3*m*m, A+m*m]; k = (m-1)/2; - if (k>1) + if (k > 1) I = 1:m; J = [2:k, n-k+2:n]; A([I,I+m],J) = A([I+m,I],J); @@ -78,11 +78,20 @@ endfunction + %!test %! for i=3:30 -%! A=magic(i); -%! assert(norm(diff([sum(diag(A)),sum(diag(flipud(A))),sum(A),sum(A')])),0) +%! A = magic (i); +%! assert (norm(diff([sum(diag(A)),sum(diag(flipud(A))),sum(A),sum(A')])),0); %! endfor -%!assert(isempty(magic(0))); -%!assert(magic(1),1); -%!error magic(2) + +%!assert (isempty (magic (0))) +%!assert (magic(1), 1) + +%% Test input validation +%!error magic () +%!error magic (1, 2) +%!error magic (1.5) +%!error magic (-1) +%!error magic (2) + diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/special-matrix/pascal.m --- a/scripts/special-matrix/pascal.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/special-matrix/pascal.m Sun Nov 27 09:07:37 2011 -0500 @@ -36,57 +36,55 @@ ## Author: Peter Ekberg ## (peda) -function retval = pascal (n, t) - - if (nargin > 2) || (nargin == 0) - print_usage (); - endif +function retval = pascal (n, t = 0) - if (nargin == 1) - t = 0; - endif - - if (! isscalar (n) || ! isscalar (t)) - error ("pascal: expecting scalar arguments, found something else"); - endif - - if (t < -1 || t > 2) + if (nargin < 1 || nargin > 2) + print_usage (); + elseif (! (isscalar (n) && isscalar (t))) + error ("pascal: N and T must be scalars"); + elseif (! any (t == [-1, 0, 1, 2])) error ("pascal: expecting T to be -1, 0, 1, or 2, found %d", t); endif retval = zeros (n); - retval(:,1) = 1; + if (n > 0) + retval(:,1) = 1; + endif if (t == -1) for j = 2:n - retval(j:n,j) = cumsum (retval (j-1:n-1,j-1)); + retval(j:n,j) = cumsum (retval(j-1:n-1,j-1)); endfor else for j = 2:n - retval(j:n,j) = -cumsum (retval (j-1:n-1,j-1)); + retval(j:n,j) = -cumsum (retval(j-1:n-1,j-1)); endfor endif if (t == 0) retval = retval*retval'; elseif (t == 2) - retval = retval'; - retval = retval(n:-1:1,:); - retval(:,n) = -retval(:,n); - retval(n,:) = -retval(n,:); - if (rem(n,2) != 1) - retval = -retval; + retval = rot90 (retval, 3); + if (rem (n,2) != 1) + retval *= -1; endif endif endfunction -%!assert (pascal(3,-1), [1,0,0;1,1,0;1,2,1]) -%!assert (pascal(3,0), [1,1,1;1,2,3;1,3,6]) -%!assert (pascal(3,0), pascal(3)) -%!assert (pascal(3,1), [1,0,0;1,-1,0;1,-2,1]) -%!assert (pascal(3,2), [0,0,-1;0,-1,2;-1,-1,1]) -%!error (pascal(3,4)) -%!error (pascal(3,-2)) -%!error (pascal()) -%!error (pascal(1,2,3)) + +%!assert (pascal (3,-1), [1,0,0;1,1,0;1,2,1]) +%!assert (pascal (3,0), [1,1,1;1,2,3;1,3,6]) +%!assert (pascal (3,0), pascal (3)) +%!assert (pascal (3,1), [1,0,0;1,-1,0;1,-2,1]) +%!assert (pascal (3,2), [1,1,1;-2,-1,0;1,0,0]) +%!assert (pascal (0,2), []) + +%% Test input validation +%!error pascal () +%!error pascal (1,2,3) +%!error pascal ([1 2]) +%!error pascal (1, [1 2]) +%!error pascal (3,-2) +%!error pascal (3,4) + diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/special-matrix/toeplitz.m --- a/scripts/special-matrix/toeplitz.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/special-matrix/toeplitz.m Sun Nov 27 09:07:37 2011 -0500 @@ -58,50 +58,55 @@ function retval = toeplitz (c, r) - if (nargin == 1) - r = c; - elseif (nargin != 2) + if (nargin < 1 || nargin > 2) print_usage (); endif - if (! (isvector (c) && isvector (r))) - error ("toeplitz: expecting vector arguments"); + if (nargin == 1) + if (! isvector (c)) + error ("toeplitz: C must be a vector"); + endif + + r = c; + nr = length (c); + nc = nr; + else + if (! (isvector (c) && isvector (r))) + error ("toeplitz: C and R must be vectors"); + elseif (r(1) != c(1)) + warning ("toeplitz: column wins anti-diagonal conflict"); + endif + + nr = length (c); + nc = length (r); endif - nc = length (r); - nr = length (c); - if (nr == 0 || nc == 0) ## Empty matrix. retval = zeros (nr, nc, class (c)); return; endif - if (r (1) != c (1)) - warning ("toeplitz: column wins diagonal conflict"); - endif - ## If we have a single complex argument, we want to return a ## Hermitian-symmetric matrix (actually, this will really only be ## Hermitian-symmetric if the first element of the vector is real). - if (nargin == 1 && iscomplex (c)) c = conj (c); c(1) = conj (c(1)); endif - if (issparse(c) && issparse(r)) - c = c(:).'; - r = r(:).'; - cidx = find(c); - ridx = find(r); + if (issparse (c) && issparse (r)) + c = c(:).'; ## enforce row vector + r = r(:).'; ## enforce row vector + cidx = find (c); + ridx = find (r); ## Ignore the first element in r. ridx = ridx(ridx > 1); ## Form matrix. - retval = spdiags(repmat(c(cidx),nr,1),1-cidx,nr,nc)+... - spdiags(repmat(r(ridx),nr,1),ridx-1,nr,nc); + retval = spdiags(repmat (c(cidx),nr,1),1-cidx,nr,nc) + ... + spdiags(repmat (r(ridx),nr,1),ridx-1,nr,nc); else ## Concatenate data into a single column vector. data = [r(end:-1:2)(:); c(:)]; @@ -112,15 +117,18 @@ ## Form matrix. retval = horzcat (slices{:}); endif + endfunction -%!assert((toeplitz (1) == 1 -%! && toeplitz ([1, 2, 3], [1; -3; -5]) == [1, -3, -5; 2, 1, -3; 3, 2, 1] -%! && toeplitz ([1, 2, 3], [1; -3i; -5i]) == [1, -3i, -5i; 2, 1, -3i; 3, 2, 1])); + +%!assert (toeplitz (1), [1]) +%!assert (toeplitz ([1, 2, 3], [1; -3; -5]), [1, -3, -5; 2, 1, -3; 3, 2, 1]) +%!assert (toeplitz ([1, 2, 3], [1; -3i; -5i]), [1, -3i, -5i; 2, 1, -3i; 3, 2, 1]) -%!error toeplitz ([1, 2; 3, 4], 1); +%% Test input validation +%!error toeplitz () +%!error toeplitz (1, 2, 3) +%!error toeplitz ([1, 2; 3, 4]) +%!error toeplitz ([1, 2; 3, 4], 1) +%!error toeplitz (1, [1, 2; 3, 4]) -%!error toeplitz (); - -%!error toeplitz (1, 2, 3); - diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/special-matrix/wilkinson.m --- a/scripts/special-matrix/wilkinson.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/special-matrix/wilkinson.m Sun Nov 27 09:07:37 2011 -0500 @@ -35,7 +35,7 @@ print_usage (); endif - if (! (isscalar (n) && (n == fix (n)) && n >= 0)) + if (! (isscalar (n) && n >= 0 && (n == fix (n)))) error ("wilkinson: N must be a non-negative integer"); endif @@ -45,10 +45,17 @@ endfunction -%!assert (wilkinson(0), []) -%!assert (wilkinson(1), 0) -%!assert (wilkinson(2), [0.5,1;1,0.5]) -%!assert (wilkinson(3), [1,1,0;1,0,1;0,1,1]) -%!assert (wilkinson(4), [1.5,1,0,0;1,0.5,1,0;0,1,0.5,1;0,0,1,1.5]) -%!error (wilkinson()) -%!error (wilkinson(1,2)) + +%!assert (wilkinson (0), []) +%!assert (wilkinson (1), 0) +%!assert (wilkinson (2), [0.5,1;1,0.5]) +%!assert (wilkinson (3), [1,1,0;1,0,1;0,1,1]) +%!assert (wilkinson (4), [1.5,1,0,0;1,0.5,1,0;0,1,0.5,1;0,0,1,1.5]) + +%% Test input validation +%!error wilkinson () +%!error wilkinson (1,2) +%!error wilkinson (ones (2)) +%!error wilkinson (-1) +%!error wilkinson (1.5) + diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/statistics/base/quantile.m --- a/scripts/statistics/base/quantile.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/statistics/base/quantile.m Sun Nov 27 09:07:37 2011 -0500 @@ -89,8 +89,8 @@ ## @end itemize ## ## Examples: +## @c Set example in small font to prevent overfull line ## -## @c Set example in small font to prevent overfull line ## @smallexample ## @group ## x = randi (1000, [10, 1]); # Create empirical data in range 1-1000 diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/statistics/distributions/binocdf.m --- a/scripts/statistics/distributions/binocdf.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/statistics/distributions/binocdf.m Sun Nov 27 09:07:37 2011 -0500 @@ -21,7 +21,8 @@ ## @deftypefn {Function File} {} binocdf (@var{x}, @var{n}, @var{p}) ## For each element of @var{x}, compute the cumulative distribution function ## (CDF) at @var{x} of the binomial distribution with parameters @var{n} and -## @var{p}. +## @var{p}, where @var{n} is the number of trials and @var{p} is the +## probability of success. ## @end deftypefn ## Author: KH diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/statistics/distributions/binoinv.m --- a/scripts/statistics/distributions/binoinv.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/statistics/distributions/binoinv.m Sun Nov 27 09:07:37 2011 -0500 @@ -21,7 +21,8 @@ ## @deftypefn {Function File} {} binoinv (@var{x}, @var{n}, @var{p}) ## For each element of @var{x}, compute the quantile (the inverse of ## the CDF) at @var{x} of the binomial distribution with parameters -## @var{n} and @var{p}. +## @var{n} and @var{p}, where @var{n} is the number of trials and +## @var{p} is the probability of success. ## @end deftypefn ## Author: KH diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/statistics/distributions/binopdf.m --- a/scripts/statistics/distributions/binopdf.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/statistics/distributions/binopdf.m Sun Nov 27 09:07:37 2011 -0500 @@ -21,7 +21,8 @@ ## @deftypefn {Function File} {} binopdf (@var{x}, @var{n}, @var{p}) ## For each element of @var{x}, compute the probability density function ## (PDF) at @var{x} of the binomial distribution with parameters @var{n} -## and @var{p}. +## and @var{p}, where @var{n} is the number of trials and @var{p} is the +## probability of success. ## @end deftypefn ## Author: KH diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/statistics/distributions/binornd.m --- a/scripts/statistics/distributions/binornd.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/statistics/distributions/binornd.m Sun Nov 27 09:07:37 2011 -0500 @@ -22,8 +22,9 @@ ## @deftypefnx {Function File} {} binornd (@var{n}, @var{p}, @var{r}) ## @deftypefnx {Function File} {} binornd (@var{n}, @var{p}, @var{r}, @var{c}, @dots{}) ## @deftypefnx {Function File} {} binornd (@var{n}, @var{p}, [@var{sz}]) -## Return a matrix of random samples from the binonmial distribution with -## parameters @var{n} and @var{p}. +## Return a matrix of random samples from the binomial distribution with +## parameters @var{n} and @var{p}, where @var{n} is the number of trials +## and @var{p} is the probability of success. ## ## When called with a single size argument, return a square matrix with ## the dimension specified. When called with more than one scalar argument the diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/statistics/distributions/gamcdf.m --- a/scripts/statistics/distributions/gamcdf.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/statistics/distributions/gamcdf.m Sun Nov 27 09:07:37 2011 -0500 @@ -20,8 +20,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} gamcdf (@var{x}, @var{a}, @var{b}) ## For each element of @var{x}, compute the cumulative distribution -## function (CDF) at @var{x} of the Gamma distribution with parameters -## @var{a} and @var{b}. +## function (CDF) at @var{x} of the Gamma distribution with shape +## parameter @var{a} and scale @var{b}. ## @end deftypefn ## Author: TT diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/statistics/distributions/gaminv.m --- a/scripts/statistics/distributions/gaminv.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/statistics/distributions/gaminv.m Sun Nov 27 09:07:37 2011 -0500 @@ -20,8 +20,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} gaminv (@var{x}, @var{a}, @var{b}) ## For each element of @var{x}, compute the quantile (the inverse of -## the CDF) at @var{x} of the Gamma distribution with parameters @var{a} -## and @var{b}. +## the CDF) at @var{x} of the Gamma distribution with shape parameter +## @var{a} and scale @var{b}. ## @end deftypefn ## Author: KH diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/statistics/distributions/gampdf.m --- a/scripts/statistics/distributions/gampdf.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/statistics/distributions/gampdf.m Sun Nov 27 09:07:37 2011 -0500 @@ -20,8 +20,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} gampdf (@var{x}, @var{a}, @var{b}) ## For each element of @var{x}, return the probability density function -## (PDF) at @var{x} of the Gamma distribution with parameters @var{a} -## and @var{b}. +## (PDF) at @var{x} of the Gamma distribution with shape parameter +## @var{a} and scale @var{b}. ## @end deftypefn ## Author: TT diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/statistics/distributions/gamrnd.m --- a/scripts/statistics/distributions/gamrnd.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/statistics/distributions/gamrnd.m Sun Nov 27 09:07:37 2011 -0500 @@ -23,7 +23,7 @@ ## @deftypefnx {Function File} {} gamrnd (@var{a}, @var{b}, @var{r}, @var{c}, @dots{}) ## @deftypefnx {Function File} {} gamrnd (@var{a}, @var{b}, [@var{sz}]) ## Return a matrix of random samples from the Gamma distribution with -## parameters @var{a} and @var{b}. +## shape parameter @var{a} and scale @var{b}. ## ## When called with a single size argument, return a square matrix with ## the dimension specified. When called with more than one scalar argument the diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/strings/deblank.m --- a/scripts/strings/deblank.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/strings/deblank.m Sun Nov 27 09:07:37 2011 -0500 @@ -24,6 +24,7 @@ ## string element. ## ## Examples: +## ## @example ## @group ## deblank (" abc ") diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/strings/str2num.m --- a/scripts/strings/str2num.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/strings/str2num.m Sun Nov 27 09:07:37 2011 -0500 @@ -35,7 +35,7 @@ ## @end example ## ## The optional second output, @var{state}, is logically true when the -## coversion is successful. If the conversion fails the numeric output, +## conversion is successful. If the conversion fails the numeric output, ## @var{x}, is empty and @var{state} is false. ## ## @strong{Caution:} As @code{str2num} uses the @code{eval} function diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/strings/strsplit.m --- a/scripts/strings/strsplit.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/strings/strsplit.m Sun Nov 27 09:07:37 2011 -0500 @@ -28,7 +28,9 @@ ## boundaries. ## ## Example: +## ## @example +## @group ## strsplit ("a,b,c", ",") ## @result{} ## @{ @@ -44,7 +46,6 @@ ## [1,2] = b ## [1,3] = cde ## @} -## @group ## @end group ## @end example ## @seealso{strtok} diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/testfun/test.m --- a/scripts/testfun/test.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/testfun/test.m Sun Nov 27 09:07:37 2011 -0500 @@ -677,13 +677,14 @@ %!xtest error("This test is known to fail") ### example from toeplitz -%!shared msg -%! msg="expecting vector arguments"; -%!fail ('toeplitz([])', msg); -%!fail ('toeplitz([1,2],[])', msg); -%!fail ('toeplitz([1,2;3,4])', msg); -%!fail ('toeplitz([1,2],[1,2;3,4])', msg); -%!fail ('toeplitz ([1,2;3,4],[1,2])', msg); +%!shared msg1,msg2 +%! msg1="C must be a vector"; +%! msg2="C and R must be vectors"; +%!fail ('toeplitz([])', msg1); +%!fail ('toeplitz([1,2;3,4])', msg1); +%!fail ('toeplitz([1,2],[])', msg2); +%!fail ('toeplitz([1,2],[1,2;3,4])', msg2); +%!fail ('toeplitz ([1,2;3,4],[1,2])', msg2); % !fail ('toeplitz','usage: toeplitz'); # usage doesn't generate an error % !fail ('toeplitz(1, 2, 3)', 'usage: toeplitz'); %!test assert (toeplitz ([1,2,3], [1,4]), [1,4; 2,1; 3,2]); diff -r dd1f5493fff4 -r c72ad9f5fa2e scripts/time/addtodate.m --- a/scripts/time/addtodate.m Wed Nov 23 09:19:40 2011 +0000 +++ b/scripts/time/addtodate.m Sun Nov 27 09:07:37 2011 -0500 @@ -18,7 +18,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{d} =} addtodate (@var{d}, @var{q}, @var{f}) -## Add @var{q} amount of time (with units @var{f}) to the serial datenum, @var{d}. +## Add @var{q} amount of time (with units @var{f}) to the serial datenum, +## @var{d}. ## ## @var{f} must be one of "year", "month", "day", "hour", "minute", "second", ## or "millisecond". diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/__voronoi__.cc --- a/src/DLD-FUNCTIONS/__voronoi__.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/__voronoi__.cc Sun Nov 27 09:07:37 2011 -0500 @@ -65,6 +65,8 @@ { octave_value_list retval; + std::string caller = args(0).string_value (); + #ifdef HAVE_QHULL retval(0) = 0.0; @@ -76,8 +78,6 @@ return retval; } - std::string caller = args(0).string_value (); - Matrix points = args(1).matrix_value (); const octave_idx_type dim = points.columns (); const octave_idx_type num_points = points.rows (); diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/betainc.cc --- a/src/DLD-FUNCTIONS/betainc.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/betainc.cc Sun Nov 27 09:07:37 2011 -0500 @@ -322,12 +322,12 @@ %! assert(v3, v4, sqrt(eps ('single'))); %% test/octave.test/arith/betainc-2.m -%!error betainc(); +%!error betainc(); %% test/octave.test/arith/betainc-3.m -%!error betainc(1); +%!error betainc(1); %% test/octave.test/arith/betainc-4.m -%!error betainc(1,2); +%!error betainc(1,2); */ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/bsxfun.cc --- a/src/DLD-FUNCTIONS/bsxfun.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/bsxfun.cc Sun Nov 27 09:07:37 2011 -0500 @@ -315,13 +315,13 @@ The binary singleton expansion function applier does what its name\n\ suggests: applies a binary function @var{f} element-by-element to two\n\ array arguments @var{A} and @var{B}, and expands as necessary\n\ -singleton dimensions in either input argument. @var{f} is a function\n\ +singleton dimensions in either input argument. @var{f} is a function\n\ handle, inline function, or string containing the name of the function\n\ -to evaluate. The function @var{f} must be capable of accepting two\n\ +to evaluate. The function @var{f} must be capable of accepting two\n\ column-vector arguments of equal length, or one column vector argument\n\ and a scalar.\n\ \n\ -The dimensions of @var{A} and @var{B} must be equal or singleton. The\n\ +The dimensions of @var{A} and @var{B} must be equal or singleton. The\n\ singleton dimensions of the arrays will be expanded to the same\n\ dimensionality as the other array.\n\ @seealso{arrayfun, cellfun}\n\ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/cellfun.cc --- a/src/DLD-FUNCTIONS/cellfun.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/cellfun.cc Sun Nov 27 09:07:37 2011 -0500 @@ -2295,6 +2295,7 @@ \n\ The position of the index is determined by @var{dim}. If not specified,\n\ slicing is done along the first non-singleton dimension.\n\ +@seealso{cell2mat, cellindexmat, cellfun}\n\ @end deftypefn") { octave_value retval; @@ -2408,7 +2409,7 @@ endfor\n\ @end group\n\ @end example\n\ -@seealso{cellfun, cellslices}\n\ +@seealso{cellslices, cellfun}\n\ @end deftypefn") { octave_value retval; diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/chol.cc --- a/src/DLD-FUNCTIONS/chol.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/chol.cc Sun Nov 27 09:07:37 2011 -0500 @@ -344,8 +344,8 @@ %!error chol ([1, 2; 3, 4]); %!error chol ([1, 2; 3, 4; 5, 6]); -%!error chol (); -%!error chol (1, 2); +%!error chol (); +%!error chol (1, 2); */ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/dassl.cc --- a/src/DLD-FUNCTIONS/dassl.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/dassl.cc Sun Nov 27 09:07:37 2011 -0500 @@ -558,6 +558,6 @@ %! dassl_options ("absolute tolerance", eps); %! assert(dassl_options ("absolute tolerance") == eps); -%!error dassl_options ("foo", 1, 2); +%!error dassl_options ("foo", 1, 2); */ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/det.cc --- a/src/DLD-FUNCTIONS/det.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/det.cc Sun Nov 27 09:07:37 2011 -0500 @@ -248,8 +248,8 @@ %!assert(det ([1, 2; 3, 4]), -2, 10 * eps); %!assert(det (single([1, 2; 3, 4])), single(-2), 10 * eps ('single')); -%!error det (); -%!error det (1, 2); +%!error det (); +%!error det (1, 2); %!error det ([1, 2; 3, 4; 5, 6]); */ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/eig.cc --- a/src/DLD-FUNCTIONS/eig.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/eig.cc Sun Nov 27 09:07:37 2011 -0500 @@ -325,8 +325,8 @@ %! assert(A * v(:, 1), d(1, 1) * B * v(:, 1), sqrt (eps)); %! assert(A * v(:, 2), d(2, 2) * B * v(:, 2), sqrt (eps)); -%!error eig (); -%!error eig ([1, 2; 3, 4], [4, 3; 2, 1], 1); +%!error eig (); +%!error eig ([1, 2; 3, 4], [4, 3; 2, 1], 1); %!error eig ([1, 2; 3, 4], 2); %!error eig ([1, 2; 3, 4; 5, 6]); %!error eig ("abcd"); diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/find.cc --- a/src/DLD-FUNCTIONS/find.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/find.cc Sun Nov 27 09:07:37 2011 -0500 @@ -617,6 +617,6 @@ %!assert (find ([2 0 1 0 5 0], Inf), [1, 3, 5]) %!assert (find ([2 0 1 0 5 0], Inf, "last"), [1, 3, 5]) -%!error find (); +%!error find (); */ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/gcd.cc --- a/src/DLD-FUNCTIONS/gcd.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/gcd.cc Sun Nov 27 09:07:37 2011 -0500 @@ -522,7 +522,7 @@ %!assert(gcd (uint64(200), uint64(300), uint64(50), uint64(35)), uint64(5)) %!assert(gcd (18-i, -29+3i), -3-4i) -%!error gcd (); +%!error gcd (); %!test %! s.a = 1; diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/hess.cc --- a/src/DLD-FUNCTIONS/hess.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/hess.cc Sun Nov 27 09:07:37 2011 -0500 @@ -184,8 +184,8 @@ %! [p, h] = hess (a); %! assert(p * h * p', a, sqrt(eps ('single'))); -%!error hess (); -%!error hess ([1, 2; 3, 4], 2); +%!error hess (); +%!error hess ([1, 2; 3, 4], 2); %!error hess ([1, 2; 3, 4; 5, 6]); */ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/inv.cc --- a/src/DLD-FUNCTIONS/inv.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/inv.cc Sun Nov 27 09:07:37 2011 -0500 @@ -228,8 +228,8 @@ %!assert(inv ([1, 2; 3, 4]), [-2, 1; 1.5, -0.5], sqrt (eps)) %!assert(inv (single([1, 2; 3, 4])), single([-2, 1; 1.5, -0.5]), sqrt (eps ('single'))) -%!error inv (); -%!error inv ([1, 2; 3, 4], 2); +%!error inv (); +%!error inv ([1, 2; 3, 4], 2); %!error inv ([1, 2; 3, 4; 5, 6]); */ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/kron.cc --- a/src/DLD-FUNCTIONS/kron.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/kron.cc Sun Nov 27 09:07:37 2011 -0500 @@ -239,7 +239,7 @@ DEFUN_DLD (kron, args, , "-*- texinfo -*-\n\ -@deftypefn {Loadable Function} {} kron (@var{A}, @var{B})\n\ +@deftypefn {Loadable Function} {} kron (@var{A}, @var{B})\n\ @deftypefnx {Loadable Function} {} kron (@var{A1}, @var{A2}, @dots{})\n\ Form the Kronecker product of two or more matrices, defined block by \n\ block as\n\ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/lsode.cc --- a/src/DLD-FUNCTIONS/lsode.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/lsode.cc Sun Nov 27 09:07:37 2011 -0500 @@ -541,6 +541,6 @@ %! lsode_options ("absolute tolerance", eps); %! assert(lsode_options ("absolute tolerance") == eps); -%!error lsode_options ("foo", 1, 2); +%!error lsode_options ("foo", 1, 2); */ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/lu.cc --- a/src/DLD-FUNCTIONS/lu.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/lu.cc Sun Nov 27 09:07:37 2011 -0500 @@ -580,7 +580,7 @@ %! assert(u, single([5, 6; 0, 4/5]), sqrt (eps('single'))); %! assert(p(:,:), single([0, 0, 1; 1, 0, 0; 0 1 0]), sqrt (eps('single'))); -%!error lu (); +%!error lu (); %!error lu ([1, 2; 3, 4], 2); */ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/max.cc --- a/src/DLD-FUNCTIONS/max.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/max.cc Sun Nov 27 09:07:37 2011 -0500 @@ -367,10 +367,10 @@ %!assert(all (min ([4, i; -2, 2]) == [-2, i])); %% test/octave.test/arith/min-3.m -%!error min (); +%!error min (); %% test/octave.test/arith/min-4.m -%!error min (1, 2, 3, 4); +%!error min (1, 2, 3, 4); %!test %! x = reshape (1:8,[2,2,2]); @@ -446,10 +446,10 @@ %!assert(all (max ([4, i 4.999; -2, 2, 3+4i]) == [4, 2, 3+4i])); %% test/octave.test/arith/max-3.m -%!error max (); +%!error max (); %% test/octave.test/arith/max-4.m -%!error max (1, 2, 3, 4); +%!error max (1, 2, 3, 4); %!test %! x = reshape (1:8,[2,2,2]); diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/qr.cc --- a/src/DLD-FUNCTIONS/qr.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/qr.cc Sun Nov 27 09:07:37 2011 -0500 @@ -497,8 +497,8 @@ %! assert (q * r, a * p, sqrt (eps)); %! assert (qe * re, a(:, pe), sqrt (eps)); -%!error qr (); -%!error qr ([1, 2; 3, 4], 0, 2); +%!error qr (); +%!error qr ([1, 2; 3, 4], 0, 2); %!function retval = testqr (q, r, a, p) %! tol = 100*eps (class(q)); @@ -615,8 +615,8 @@ %! assert (q * r, a * p, sqrt (eps('single'))); %! assert (qe * re, a(:, pe), sqrt (eps('single'))); -%!error qr (); -%!error qr ([1, 2; 3, 4], 0, 2); +%!error qr (); +%!error qr ([1, 2; 3, 4], 0, 2); %!test %! diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/quad.cc --- a/src/DLD-FUNCTIONS/quad.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/quad.cc Sun Nov 27 09:07:37 2011 -0500 @@ -494,14 +494,14 @@ %! [v, ier, nfun, err] = quad ("f", single(0.001), single(3)); %! assert((ier == 0 || ier == 1) && abs (v - 1.98194120273598) < sqrt (eps ("single")) && nfun > 0); -%!error quad (); +%!error quad (); -%!error quad ("f", 1, 2, 3, 4, 5); +%!error quad ("f", 1, 2, 3, 4, 5); %!test %! quad_options ("absolute tolerance", eps); %! assert(quad_options ("absolute tolerance") == eps); -%!error quad_options (1, 2, 3); +%!error quad_options (1, 2, 3); */ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/regexp.cc --- a/src/DLD-FUNCTIONS/regexp.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/regexp.cc Sun Nov 27 09:07:37 2011 -0500 @@ -941,6 +941,7 @@ A structure containing the text of each matched named token, with the name\n\ being used as the fieldname. A named token is denoted by\n\ @code{(?@dots{})}.\n\ +\n\ @item sp\n\ A cell array of the text not returned by match.\n\ @end table\n\ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/schur.cc --- a/src/DLD-FUNCTIONS/schur.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/schur.cc Sun Nov 27 09:07:37 2011 -0500 @@ -289,7 +289,7 @@ %!test %! fail("schur ([1, 2; 3, 4], 2)","warning"); -%!error schur (); +%!error schur (); %!error schur ([1, 2, 3; 4, 5, 6]); */ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/sub2ind.cc --- a/src/DLD-FUNCTIONS/sub2ind.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/sub2ind.cc Sun Nov 27 09:07:37 2011 -0500 @@ -125,9 +125,9 @@ /* # Test input validation -%!error sub2ind([10 10.5], 1, 1); -%!error sub2ind([10 10], 1.5, 1); -%!error sub2ind([10 10], 1, 1.5); +%!error sub2ind([10 10.5], 1, 1); +%!error sub2ind([10 10], 1.5, 1); +%!error sub2ind([10 10], 1, 1.5); # Test evaluation %!shared s1, s2, s3, in @@ -140,9 +140,9 @@ # Test low index %!assert (sub2ind([10 10 10], 1, 1, 1), 1); -%!error sub2ind([10 10 10], 0, 1, 1); -%!error sub2ind([10 10 10], 1, 0, 1); -%!error sub2ind([10 10 10], 1, 1, 0); +%!error sub2ind([10 10 10], 0, 1, 1); +%!error sub2ind([10 10 10], 1, 0, 1); +%!error sub2ind([10 10 10], 1, 1, 0); # Test high index %!assert (sub2ind([10 10 10], 10, 10, 10), 1000); diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/svd.cc --- a/src/DLD-FUNCTIONS/svd.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/svd.cc Sun Nov 27 09:07:37 2011 -0500 @@ -398,9 +398,9 @@ %! assert (size (s), [0, 0]); %! assert (size (v), [0, 0]); -%!error svd (); -%!error svd ([1, 2; 4, 5], 2, 3); -%!error [u, v] = svd ([1, 2; 3, 4]); +%!error svd (); +%!error svd ([1, 2; 4, 5], 2, 3); +%!error [u, v] = svd ([1, 2; 3, 4]); */ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/syl.cc --- a/src/DLD-FUNCTIONS/syl.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/syl.cc Sun Nov 27 09:07:37 2011 -0500 @@ -213,8 +213,8 @@ %!assert(syl ([1, 2; 3, 4], [5, 6; 7, 8], [9, 10; 11, 12]), [-1/2, -2/3; -2/3, -1/2], sqrt (eps)); %!assert(syl (single([1, 2; 3, 4]), single([5, 6; 7, 8]), single([9, 10; 11, 12])), single([-1/2, -2/3; -2/3, -1/2]), sqrt (eps('single'))); -%!error syl (); -%!error syl (1, 2, 3, 4); +%!error syl (); +%!error syl (1, 2, 3, 4); %!error syl ([1, 2; 3, 4], [1, 2, 3; 4, 5, 6], [4, 3]); */ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/DLD-FUNCTIONS/time.cc --- a/src/DLD-FUNCTIONS/time.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/DLD-FUNCTIONS/time.cc Sun Nov 27 09:07:37 2011 -0500 @@ -186,9 +186,9 @@ %! && isfield (ts, "isdst") %! && isfield (ts, "yday"))); -%!error gmtime (); +%!error gmtime (); -%!error gmtime (1, 2); +%!error gmtime (1, 2); */ @@ -250,9 +250,9 @@ %! && isfield (ts, "isdst") %! && isfield (ts, "yday"))); -%!error localtime (); +%!error localtime (); -%!error localtime (1, 2); +%!error localtime (1, 2); */ @@ -301,9 +301,9 @@ %! t = time (); %! assert(fix (mktime (localtime (t))) == fix (t)); -%!error mktime (); +%!error mktime (); -%!error mktime (1, 2, 3); +%!error mktime (1, 2, 3); %% These tests fail on systems with mktime functions of limited %% intelligence: @@ -505,9 +505,9 @@ %! && ischar (strftime ("%c%C%d%e%D%h%j", localtime (time ()))) %! && ischar (strftime ("%m%U%w%W%x%y%Y", localtime (time ()))))); -%!error strftime (); +%!error strftime (); -%!error strftime ("foo", localtime (time ()), 1); +%!error strftime ("foo", localtime (time ()), 1); */ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/Makefile.am --- a/src/Makefile.am Wed Nov 23 09:19:40 2011 +0000 +++ b/src/Makefile.am Sun Nov 27 09:07:37 2011 -0500 @@ -286,6 +286,7 @@ parse.h \ pr-output.h \ procstream.h \ + profiler.h \ sighandlers.h \ siglist.h \ sparse-xdiv.h \ @@ -311,7 +312,6 @@ defaults.h \ graphics.h \ oct-conf.h \ - profiler.h \ mxarray.h \ version.h diff -r dd1f5493fff4 -r c72ad9f5fa2e src/bitfcns.cc --- a/src/bitfcns.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/bitfcns.cc Sun Nov 27 09:07:37 2011 -0500 @@ -410,10 +410,10 @@ @deftypefn {Built-in Function} {} bitshift (@var{a}, @var{k})\n\ @deftypefnx {Built-in Function} {} bitshift (@var{a}, @var{k}, @var{n})\n\ Return a @var{k} bit shift of @var{n}-digit unsigned\n\ -integers in @var{a}. A positive @var{k} leads to a left shift.\n\ +integers in @var{a}. A positive @var{k} leads to a left shift;\n\ A negative value to a right shift. If @var{n} is omitted it defaults\n\ to log2(bitmax)+1.\n\ -@var{n} must be in the range [1,log2(bitmax)+1] usually [1,33]\n\ +@var{n} must be in the range [1,log2(bitmax)+1] usually [1,33].\n\ \n\ @example\n\ @group\n\ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/data.cc --- a/src/data.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/data.cc Sun Nov 27 09:07:37 2011 -0500 @@ -149,8 +149,8 @@ %! && all (x, 1) == [0, 1, 1] %! && all (x, 2) == [0; 1; 1])); -%!error all (); -%!error all (1, 2, 3); +%!error all (); +%!error all (1, 2, 3); */ @@ -205,8 +205,8 @@ %! && any (x, 1) == [0, 0, 1] %! && any (x, 2) == [0; 0; 1])); -%!error any (); -%!error any (1, 2, 3); +%!error any (); +%!error any (1, 2, 3); */ @@ -293,8 +293,8 @@ %! x = single([1, 3, 1, 1, 1, 1, 3, 1]); %! assert(atan2 (y, x), v, sqrt (eps('single'))); -%!error atan2 (); -%!error atan2 (1, 2, 3); +%!error atan2 (); +%!error atan2 (1, 2, 3); */ @@ -1079,7 +1079,7 @@ %!assert (cumprod (single([i, 2+i, -3+2i, 4])), single([i, -1+2i, -1-8i, -4-32i])); %!assert (cumprod (single([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i])), single([1, 2, 3; i, 4i, 9i; -1+i, -8+8i, -27+27i])); -%!error cumprod (); +%!error cumprod (); %!assert (cumprod ([2, 3; 4, 5], 1), [2, 3; 8, 15]); %!assert (cumprod ([2, 3; 4, 5], 2), [2, 6; 4, 20]); @@ -1230,7 +1230,7 @@ %!assert (cumsum (single([i, 2+i, -3+2i, 4])), single([i, 2+2i, -1+4i, 3+4i])); %!assert (cumsum (single([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i])), single([1, 2, 3; 1+i, 2+2i, 3+3i; 2+2i, 4+4i, 6+6i])); -%!error cumsum (); +%!error cumsum (); %!assert (cumsum ([1, 2; 3, 4], 1), [1, 2; 4, 6]); %!assert (cumsum ([1, 2; 3, 4], 2), [1, 3; 3, 7]); @@ -1342,8 +1342,8 @@ %!assert(diag (int8([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0]), -1), int8([1; 2; 3])); %% Test input validation -%!error diag (); -%!error diag (1,2,3,4); +%!error diag (); +%!error diag (1,2,3,4); %!error diag (ones (2), 3, 3); %!error diag (1:3, -4, 3); @@ -1373,7 +1373,7 @@ %!assert (prod (single([i, 2+i, -3+2i, 4])), single(-4 - 32i)); %!assert (prod (single([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i])), single([-1+i, -8+8i, -27+27i])); -%!error prod (); +%!error prod (); %!assert (prod ([1, 2; 3, 4], 1), [3, 8]); %!assert (prod ([1, 2; 3, 4], 2), [2; 12]); @@ -2413,14 +2413,17 @@ @var{a}(@var{idx1}, @var{idx2}, @dots{})\n\ @end example\n\ \n\ -Note that the indices do not have to be numerical. For example\n\ +Note that the indices do not have to be numerical. For example,\n\ \n\ @example\n\ +@group\n\ @var{a} = 1;\n\ @var{b} = ones (2, 3);\n\ numel (@var{a}, @var{b});\n\ +@end group\n\ @end example\n\ \n\ +@noindent\n\ will return 6, as this is the number of ways to index with @var{b}.\n\ \n\ This method is also called when an object appears as lvalue with cs-list\n\ @@ -2815,7 +2818,7 @@ %!assert(sum (single([i, 2+i, -3+2i, 4])), single(3+4i)); %!assert(sum (single([1, 2, 3; i, 2i, 3i; 1+i, 2+2i, 3+3i])), single([2+2i, 4+4i, 6+6i])); -%!error sum (); +%!error sum (); %!assert (sum ([1, 2; 3, 4], 1), [4, 6]); %!assert (sum ([1, 2; 3, 4], 2), [3; 7]); @@ -2890,7 +2893,7 @@ %!assert(sumsq (single([-1; -2; 4i])), single(21)); %!assert(sumsq (single([1, 2, 3; 2, 3, 4; 4i, 6i, 2])), single([21, 49, 29])); -%!error sumsq (); +%!error sumsq (); %!assert (sumsq ([1, 2; 3, 4], 1), [10, 20]); %!assert (sumsq ([1, 2; 3, 4], 2), [5; 25]); @@ -3402,8 +3405,8 @@ %! s.a = 1; %! assert(ismatrix (s), false); -%!error ismatrix (); -%!error ismatrix ([1, 2; 3, 4], 2); +%!error ismatrix (); +%!error ismatrix ([1, 2; 3, 4], 2); */ @@ -4620,7 +4623,7 @@ %!assert (eye(3,'int8'), int8([1, 0, 0; 0, 1, 0; 0, 0, 1])); %!assert (eye(2, 3,'int8'), int8([1, 0, 0; 0, 1, 0])); -%!error eye (1, 2, 3); +%!error eye (1, 2, 3); */ @@ -4743,8 +4746,8 @@ % assert(linspace ([1, 2; 3, 4], 5, 6), linspace (1, 5, 6)); -%!error linspace (); -%!error linspace (1, 2, 3, 4); +%!error linspace (); +%!error linspace (1, 2, 3, 4); %!test %! fail("linspace ([1, 2; 3, 4], 5, 6)","warning"); @@ -4977,7 +4980,7 @@ %! s.a = 1; %! fail("reshape (s, 2, 3)"); -%!error reshape (); +%!error reshape (); %!error reshape (1, 2, 3, 4); */ @@ -6154,8 +6157,8 @@ %! [v, i] = sort (a); %! assert (i, [1, 4, 2, 5, 3]) -%!error sort (); -%!error sort (1, 2, 3, 4); +%!error sort (); +%!error sort (1, 2, 3, 4); */ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/dirfns.cc --- a/src/dirfns.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/dirfns.cc Sun Nov 27 09:07:37 2011 -0500 @@ -87,7 +87,7 @@ return cd_ok; } -DEFUN (cd, args, , +DEFUN (cd, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Command} {} cd dir\n\ @deftypefnx {Command} {} chdir dir\n\ @@ -127,10 +127,18 @@ } else { - std::string home_dir = octave_env::get_home_directory (); + // Behave like Unixy shells for "cd" by itself, but be Matlab + // compatible if doing "current_dir = cd". - if (home_dir.empty () || ! octave_change_to_directory (home_dir)) - return retval; + if (nargout == 0) + { + std::string home_dir = octave_env::get_home_directory (); + + if (home_dir.empty () || ! octave_change_to_directory (home_dir)) + return retval; + } + else + retval = octave_value (octave_env::get_current_directory ()); } return retval; diff -r dd1f5493fff4 -r c72ad9f5fa2e src/file-io.cc --- a/src/file-io.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/file-io.cc Sun Nov 27 09:07:37 2011 -0500 @@ -1203,7 +1203,7 @@ string @var{string} instead of from a stream. Reaching the end of the\n\ string is treated as an end-of-file condition. In addition to the values\n\ returned by @code{fscanf}, the index of the next character to be read\n\ -is returned in in @var{pos}.\n\ +is returned in @var{pos}.\n\ @seealso{fscanf, scanf, sprintf}\n\ @end deftypefn") { diff -r dd1f5493fff4 -r c72ad9f5fa2e src/graphics.cc --- a/src/graphics.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/graphics.cc Sun Nov 27 09:07:37 2011 -0500 @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -39,6 +40,7 @@ #include "file-stat.h" #include "cmd-edit.h" +#include "cutils.h" #include "defun.h" #include "display.h" #include "error.h" @@ -2384,7 +2386,7 @@ xinitialize (const graphics_handle& h) { graphics_object go = gh_manager::get_object (h); - + if (go) go.initialize (); } @@ -2484,7 +2486,10 @@ { const std::set& dynprops = dynamic_property_names (); - return dynprops.find (pname) != dynprops.end (); + if (dynprops.find (pname) != dynprops.end ()) + return true; + else + return all_props.find (pname) != all_props.end (); } void @@ -5113,8 +5118,22 @@ // FIXME: bbox should be stored in axes::properties Matrix bbox = get_extent (false); - ColumnVector p = xform.untransform (bbox(0)+bbox(2)/2, (bbox(1)-10), - (x_zlim(0)+x_zlim(1))/2, true); + + ColumnVector p = + graphics_xform::xform_vector (bbox(0)+bbox(2)/2, + bbox(1)-10, + (x_zlim(0)+x_zlim(1))/2); + + if (x2Dtop) + { + Matrix ext (1, 2, 0.0); + ext = get_ticklabel_extents (get_xtick ().matrix_value (), + get_xticklabel ().all_strings (), + get_xlim ().matrix_value ()); + p(1) -= ext(1); + } + + p = xform.untransform (p(0), p(1), p(2), true); title_props.set_position (p.extract_n(0, 3).transpose ()); title_props.set_positionmode ("auto"); @@ -7074,7 +7093,7 @@ // FIXME: parsed content should be cached for efficiency // FIXME: support multiline text - + elt = text_parser_none ().parse (get_string_string ()); #ifdef HAVE_FONTCONFIG text_renderer.set_font (get_fontname (), @@ -7105,7 +7124,7 @@ graphics_object parent_obj = gh_manager::get_object (get_parent ()); Matrix parent_bbox = parent_obj.get_properties ().get_boundingbox (true), parent_size = parent_bbox.extract_n (0, 2, 1, 2); - + pos = convert_position (pos, cached_units, get_units (), parent_size); set_position (pos); @@ -7276,7 +7295,7 @@ graphics_object parent_obj = gh_manager::get_object (get_parent ()); Matrix parent_bbox = parent_obj.get_properties ().get_boundingbox (true), parent_size = parent_bbox.extract_n (0, 2, 1, 2); - + pos = convert_position (pos, old_units, get_units (), parent_size); set_position (pos); } @@ -7456,7 +7475,7 @@ const octave_value& data = Matrix ()) : base_graphics_event (), handle (h), callback_name (name), callback (), callback_data (data) { } - + callback_event (const graphics_handle& h, const octave_value& cb, const octave_value& data = Matrix ()) : base_graphics_event (), handle (h), callback_name (), @@ -7627,7 +7646,7 @@ else { gh_manager::auto_lock guard; - + do_post_event (graphics_event::create_callback_event (h, l)); } } @@ -7665,18 +7684,19 @@ octave_value cb = cb_arg; - if (cb.is_function_handle ()) + if (cb.is_function () || cb.is_function_handle ()) fcn = cb.function_value (); else if (cb.is_string ()) { int status; std::string s = cb.string_value (); - eval_string (s, false, status); + eval_string (s, false, status, 0); } else if (cb.is_cell () && cb.length () > 0 && (cb.rows () == 1 || cb.columns () == 1) - && cb.cell_value ()(0).is_function_handle ()) + && (cb.cell_value ()(0).is_function () + || cb.cell_value ()(0).is_function_handle ())) { Cell c = cb.cell_value (); @@ -7772,69 +7792,66 @@ { graphics_event e; bool old_Vdrawnow_requested = Vdrawnow_requested; - unwind_protect frame; - - static int process_events_executing = 0; - - frame.protect_var (process_events_executing); - - if (++process_events_executing <= 1) - { - do - { - e = graphics_event (); - - gh_manager::lock (); - - if (! event_queue.empty ()) + bool events_executed = false; + + do + { + e = graphics_event (); + + gh_manager::lock (); + + if (! event_queue.empty ()) + { + if (callback_objects.empty () || force) { - if (callback_objects.empty () || force) + e = event_queue.front (); + + event_queue.pop_front (); + } + else + { + const graphics_object& go = callback_objects.front (); + + if (go.get_properties ().is_interruptible ()) { e = event_queue.front (); event_queue.pop_front (); } - else - { - const graphics_object& go = callback_objects.front (); - - if (go.get_properties ().is_interruptible ()) - { - e = event_queue.front (); - - event_queue.pop_front (); - } - } } - - gh_manager::unlock (); - - if (e.ok ()) - e.execute (); - } - while (e.ok ()); - - gh_manager::lock (); - - if (event_queue.empty () && event_processing == 0) - command_editor::remove_event_hook (gh_manager::process_events); + } gh_manager::unlock (); - flush_octave_stdout (); - - if (Vdrawnow_requested && ! old_Vdrawnow_requested) - { - feval ("drawnow"); - - Vdrawnow_requested = false; - } + if (e.ok ()) + { + e.execute (); + events_executed = true; + } + } + while (e.ok ()); + + gh_manager::lock (); + + if (event_queue.empty () && event_processing == 0) + command_editor::remove_event_hook (gh_manager::process_events); + + gh_manager::unlock (); + + if (events_executed) + flush_octave_stdout (); + + if (Vdrawnow_requested && ! old_Vdrawnow_requested) + { + feval ("drawnow"); + + Vdrawnow_requested = false; } return 0; } -void +void gh_manager::do_enable_event_processing (bool enable) { gh_manager::auto_lock guard; @@ -9419,3 +9436,392 @@ return ret; } + +static bool +compare_property_values (const octave_value& o1, const octave_value& o2) +{ + octave_value_list args (2); + + args(0) = o1; + args(1) = o2; + + octave_value_list result = feval ("isequal", args, 1); + + if (! error_state && result.length () > 0) + return result(0).bool_value (); + + return false; +} + +static std::map waitfor_results; + +static void +cleanup_waitfor_id (uint32_t id) +{ + waitfor_results.erase (id); +} + +static void +do_cleanup_waitfor_listener (const octave_value& listener, + listener_mode mode = POSTSET) +{ + Cell c = listener.cell_value (); + + if (c.numel () >= 4) + { + double h = c(2).double_value (); + + if (! error_state) + { + caseless_str pname = c(3).string_value (); + + if (! error_state) + { + gh_manager::auto_lock guard; + + graphics_handle handle = gh_manager::lookup (h); + + if (handle.ok ()) + { + graphics_object go = gh_manager::get_object (handle); + + if (go.get_properties ().has_property (pname)) + { + go.get_properties () + .delete_listener (pname, listener, mode); + if (mode == POSTSET) + go.get_properties () + .delete_listener (pname, listener, PERSISTENT); + } + } + } + } + } +} + +static void +cleanup_waitfor_postset_listener(const octave_value& listener) +{ do_cleanup_waitfor_listener (listener, POSTSET); } + +static void +cleanup_waitfor_predelete_listener(const octave_value& listener) +{ do_cleanup_waitfor_listener (listener, PREDELETE); } + +static octave_value_list +waitfor_listener (const octave_value_list& args, int) +{ + if (args.length () > 3) + { + uint32_t id = args(2).uint32_scalar_value ().value (); + + if (! error_state) + { + if (args.length () > 5) + { + double h = args(0).double_value (); + + if (! error_state) + { + caseless_str pname = args(4).string_value (); + + if (! error_state) + { + gh_manager::auto_lock guard; + + graphics_handle handle = gh_manager::lookup (h); + + if (handle.ok ()) + { + graphics_object go = gh_manager::get_object (handle); + octave_value pvalue = go.get (pname); + + if (compare_property_values (pvalue, args(5))) + waitfor_results[id] = true; + } + } + } + } + else + waitfor_results[id] = true; + } + } + + return octave_value_list (); +} + +static octave_value_list +waitfor_del_listener (const octave_value_list& args, int) +{ + if (args.length () > 2) + { + uint32_t id = args(2).uint32_scalar_value ().value (); + + if (! error_state) + waitfor_results[id] = true; + } + + return octave_value_list (); +} + +DEFUN (waitfor, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} waitfor (@var{h})\n\ +@deftypefnx {Built-in Function} {} waitfor (@var{h}, @var{prop})\n\ +@deftypefnx {Built-in Function} {} waitfor (@var{h}, @var{prop}, @var{value})\n\ +@deftypefnx {Built-in Function} {} waitfor (@dots{}, \"timeout\", @var{timeout})\n\ +Suspend the execution of the current program until a condition is\n\ +satisfied on the graphics handle @var{h}. While the program is suspended\n\ +graphics events are still being processed normally, allowing callbacks to\n\ +modify the state of graphics objects. This function is reentrant and can be\n\ +called from a callback, while another @code{waitfor} call is pending at\n\ +top-level.\n\ +\n\ +In the first form, program execution is suspended until the graphics object\n\ +@var{h} is destroyed. If the graphics handle is invalid, the function\n\ +returns immediately.\n\ +\n\ +In the second form, execution is suspended until the graphics object is\n\ +destroyed or the property named @var{prop} is modified. If the graphics\n\ +handle is invalid or the property does not exist, the function returns\n\ +immediately.\n\ +\n\ +In the third form, execution is suspended until the graphics object is\n\ +destroyed or the property named @var{prop} is set to @var{value}. The\n\ +function @code{isequal} is used to compare property values. If the graphics\n\ +handle is invalid, the property does not exist or the property is already\n\ +set to @var{value}, the function returns immediately.\n\ +\n\ +An optional timeout can be specified using the property @code{timeout}.\n\ +This timeout value is the number of seconds to wait for the condition to be\n\ +true. @var{timeout} must be at least 1. If a smaller value is specified, a\n\ +warning is issued and a value of 1 is used instead. If the timeout value is\n\ +not an integer, it is truncated towards 0.\n\ +\n\ +To define a condition on a property named @code{timeout}, use the string\n\ +@code{\\timeout} instead.\n\ +\n\ +In all cases, typing CTRL-C stops program execution immediately.\n\ +@seealso{isequal}\n\ +@end deftypefn") +{ + if (args.length () > 0) + { + double h = args(0).double_value (); + + if (! error_state) + { + caseless_str pname; + + unwind_protect frame; + + static uint32_t id_counter = 0; + uint32_t id = 0; + + int max_arg_index = 0; + int timeout_index = -1; + + int timeout = 0; + + if (args.length () > 1) + { + pname = args(1).string_value (); + if (! error_state + && ! pname.empty () + && ! pname.compare ("timeout")) + { + if (pname.compare ("\\timeout")) + pname = "timeout"; + + static octave_value wf_listener; + + if (! wf_listener.is_defined ()) + wf_listener = + octave_value (new octave_builtin (waitfor_listener, + "waitfor_listener")); + + max_arg_index++; + if (args.length () > 2) + { + if (args(2).is_string ()) + { + caseless_str s = args(2).string_value (); + + if (! error_state) + { + if (s.compare ("timeout")) + timeout_index = 2; + else + max_arg_index++; + } + } + else + max_arg_index++; + } + + Cell listener (1, max_arg_index >= 2 ? 5 : 4); + + id = id_counter++; + frame.add_fcn (cleanup_waitfor_id, id); + waitfor_results[id] = false; + + listener(0) = wf_listener; + listener(1) = octave_uint32 (id); + listener(2) = h; + listener(3) = pname; + + if (max_arg_index >= 2) + listener(4) = args(2); + + octave_value ov_listener (listener); + + gh_manager::auto_lock guard; + + graphics_handle handle = gh_manager::lookup (h); + + if (handle.ok ()) + { + graphics_object go = gh_manager::get_object (handle); + + if (max_arg_index >= 2 + && compare_property_values (go.get (pname), + args(2))) + waitfor_results[id] = true; + else + { + + frame.add_fcn (cleanup_waitfor_postset_listener, + ov_listener); + go.add_property_listener (pname, ov_listener, + POSTSET); + go.add_property_listener (pname, ov_listener, + PERSISTENT); + + if (go.get_properties () + .has_dynamic_property (pname)) + { + static octave_value wf_del_listener; + + if (! wf_del_listener.is_defined ()) + wf_del_listener = + octave_value (new octave_builtin + (waitfor_del_listener, + "waitfor_del_listener")); + + Cell del_listener (1, 4); + + del_listener(0) = wf_del_listener; + del_listener(1) = octave_uint32 (id); + del_listener(2) = h; + del_listener(3) = pname; + + octave_value ov_del_listener (del_listener); + + frame.add_fcn (cleanup_waitfor_predelete_listener, + ov_del_listener); + go.add_property_listener (pname, ov_del_listener, + PREDELETE); + } + } + } + } + else if (error_state || pname.empty ()) + error ("waitfor: invalid property name, expected a non-empty string value"); + } + + if (! error_state + && timeout_index < 0 + && args.length () > (max_arg_index + 1)) + { + caseless_str s = args(max_arg_index + 1).string_value (); + + if (! error_state) + { + if (s.compare ("timeout")) + timeout_index = max_arg_index + 1; + else + error ("waitfor: invalid parameter `%s'", s.c_str ()); + } + else + error ("waitfor: invalid parameter, expected `timeout'"); + } + + if (! error_state && timeout_index >= 0) + { + if (args.length () > (timeout_index + 1)) + { + timeout = static_cast + (args(timeout_index + 1).scalar_value ()); + + if (! error_state) + { + if (timeout < 1) + { + warning ("waitfor: the timeout value must be >= 1, using 1 instead"); + timeout = 1; + } + } + else + error ("waitfor: invalid timeout value, expected a value >= 1"); + } + else + error ("waitfor: missing timeout value"); + } + + // FIXME: There is still a "hole" in the following loop. The code + // assumes that an object handle is unique, which is a fair + // assumptions, except for figures. If a figure is destroyed + // then recreated with the same figure ID, within the same + // run of event hooks, then the figure destruction won't be + // caught and the loop will not stop. This is an unlikely + // possibility in practice, though. + // + // Using deletefcn callback is also unreliable as it could be + // modified during a callback execution and the waitfor loop + // would not stop. + // + // The only "good" implementation would require object + // listeners, similar to property listeners. + + time_t start = 0; + + if (timeout > 0) + start = time (0); + + while (! error_state) + { + if (true) + { + gh_manager::auto_lock guard; + + graphics_handle handle = gh_manager::lookup (h); + + if (handle.ok ()) + { + if (! pname.empty () && waitfor_results[id]) + break; + } + else + break; + } + + octave_usleep (100000); + + OCTAVE_QUIT; + + command_editor::run_event_hooks (); + + if (timeout > 0) + { + if (start + timeout < time (0)) + break; + } + } + } + else + error ("waitfor: invalid handle value."); + } + else + print_usage (); + + return octave_value (); +} diff -r dd1f5493fff4 -r c72ad9f5fa2e src/graphics.h.in --- a/src/graphics.h.in Wed Nov 23 09:19:40 2011 +0000 +++ b/src/graphics.h.in Sun Nov 27 09:07:37 2011 -0500 @@ -333,7 +333,7 @@ class property; -enum listener_mode { POSTSET, PERSISTENT }; +enum listener_mode { POSTSET, PERSISTENT, PREDELETE }; class base_property { @@ -661,6 +661,8 @@ else replace = true; + desired_type = string_t; + if (replace) { str = strings; @@ -690,6 +692,8 @@ } } + desired_type = cell_t; + if (replace) { str = strings; diff -r dd1f5493fff4 -r c72ad9f5fa2e src/load-save.cc --- a/src/load-save.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/load-save.cc Sun Nov 27 09:07:37 2011 -0500 @@ -649,7 +649,7 @@ std::string orig_fname = ""; // Function called with Matlab-style ["filename", options] syntax - if (argv[1].at(0) != '-') + if (argc > 1 && argv[1].at(0) != '-') { orig_fname = argv[1]; i++; @@ -1475,6 +1475,7 @@ @table @code\n\ @item -append\n\ Append to the destination instead of overwriting.\n\ +\n\ @item -ascii\n\ Save a single matrix in a text file without header or any other information.\n\ \n\ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/mappers.cc --- a/src/mappers.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/mappers.cc Sun Nov 27 09:07:37 2011 -0500 @@ -1565,7 +1565,7 @@ "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} round (@var{x})\n\ Return the integer nearest to @var{x}. If @var{x} is complex, return\n\ -@code{round (real (@var{x})) + round (imag (@var{x})) * I}. If there\n\ +@code{round (real (@var{x})) + round (imag (@var{x})) * I}. If there\n\ are two nearest integers, return the one further away from zero.\n\ \n\ @example\n\ @@ -1902,8 +1902,8 @@ DEFALIAS (lower, tolower); /* -%!error tolower(); -%!error lower(); +%!error tolower(); +%!error lower(); %!error tolower (1, 2); %!assert(tolower("OCTAVE"), "octave"); %!assert(tolower("123OCTave!_&"), "123octave!_&"); @@ -1953,8 +1953,8 @@ DEFALIAS (upper, toupper); /* -%!error toupper(); -%!error upper(); +%!error toupper(); +%!error upper(); %!error toupper (1, 2); %!assert(toupper("octave"), "OCTAVE"); %!assert(toupper("123OCTave!_&"), "123OCTAVE!_&"); diff -r dd1f5493fff4 -r c72ad9f5fa2e src/oct-obj.cc --- a/src/oct-obj.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/oct-obj.cc Sun Nov 27 09:07:37 2011 -0500 @@ -29,6 +29,10 @@ #include "oct-obj.h" #include "Cell.h" +// We are likely to have a lot of octave_value_list objects to allocate, +// so make the grow_size large. +DEFINE_OCTAVE_ALLOCATOR2(octave_value_list, 1024); + octave_value_list::octave_value_list (const std::list& lst) { octave_idx_type n = 0, nel = 0; @@ -59,9 +63,6 @@ } -octave_allocator -octave_value_list::allocator (sizeof (octave_value_list)); - octave_value_list& octave_value_list::prepend (const octave_value& val) { diff -r dd1f5493fff4 -r c72ad9f5fa2e src/oct-obj.h --- a/src/oct-obj.h Wed Nov 23 09:19:40 2011 +0000 +++ b/src/oct-obj.h Sun Nov 27 09:07:37 2011 -0500 @@ -66,26 +66,6 @@ ~octave_value_list (void) { } - void *operator new (size_t size) - { return allocator.alloc (size); } - - void operator delete (void *p, size_t size) - { allocator.free (p, size); } - - // FIXME -- without this, I have errors with the stack of - // octave_value_list objects in ov-usr-fcn.h. Why? - void *operator new (size_t size, void *p) - { return ::operator new (size, p); } - - void operator delete (void *p, void *) - { -#if defined (HAVE_PLACEMENT_DELETE) - ::operator delete (p, static_cast (0)); -#else - ::operator delete (p); -#endif - } - octave_value_list& operator = (const octave_value_list& obj) { if (this != &obj) @@ -167,8 +147,6 @@ private: - static octave_allocator allocator; - Array data; // This list of strings can be used to tag each element of data with @@ -185,6 +163,8 @@ const octave_value& elem (octave_idx_type n) const { return data(n); } + + DECLARE_OCTAVE_ALLOCATOR }; #endif diff -r dd1f5493fff4 -r c72ad9f5fa2e src/ov.cc --- a/src/ov.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/ov.cc Sun Nov 27 09:07:37 2011 -0500 @@ -2714,6 +2714,83 @@ %!assert (sizeof ({"foo", "bar", "baaz"}), 10) */ +static void +decode_subscripts (const char* name, const octave_value& arg, + std::string& type_string, + std::list& idx) +{ + const octave_map m = arg.map_value (); + + if (! error_state + && m.nfields () == 2 && m.contains ("type") && m.contains ("subs")) + { + octave_idx_type nel = m.numel (); + + type_string = std::string (nel, '\0'); + idx = std::list (); + + if (nel == 0) + return; + + const Cell type = m.contents ("type"); + const Cell subs = m.contents ("subs"); + + for (int k = 0; k < nel; k++) + { + std::string item = type(k).string_value (); + + if (! error_state) + { + if (item == "{}") + type_string[k] = '{'; + else if (item == "()") + type_string[k] = '('; + else if (item == ".") + type_string[k] = '.'; + else + { + error("%s: invalid indexing type `%s'", name, item.c_str ()); + return; + } + } + else + { + error ("%s: expecting type(%d) to be a character string", + name, k+1); + return; + } + + octave_value_list idx_item; + + if (subs(k).is_string ()) + idx_item(0) = subs(k); + else if (subs(k).is_cell ()) + { + Cell subs_cell = subs(k).cell_value (); + + for (int n = 0; n < subs_cell.length (); n++) + { + if (subs_cell(n).is_string () + && subs_cell(n).string_value () == ":") + idx_item(n) = octave_value(octave_value::magic_colon_t); + else + idx_item(n) = subs_cell(n); + } + } + else + { + error ("%s: expecting subs(%d) to be a character string or cell array", + name, k+1); + return; + } + + idx.push_back (idx_item); + } + } + else + error ("%s: second argument must be a structure with fields `type' and `subs'", name); +} + DEFUN (subsref, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} subsref (@var{val}, @var{idx})\n\ @@ -2746,6 +2823,9 @@ \n\ @noindent\n\ Note that this is the same as writing @code{val(:,1:2)}.\n\ +\n\ +If @var{idx} is an empty structure array with fields @samp{type}\n\ +and @samp{subs}, return @var{val}.\n\ @seealso{subsasgn, substruct}\n\ @end deftypefn") { @@ -2760,8 +2840,12 @@ if (! error_state) { - octave_value tmp = args(0); - retval = tmp.subsref (type, idx, nargout); + octave_value arg0 = args(0); + + if (type.empty ()) + retval = arg0; + else + retval = arg0.subsref (type, idx, nargout); } } else @@ -2798,6 +2882,9 @@ @end example\n\ \n\ Note that this is the same as writing @code{val(:,1:2) = 0}.\n\ +\n\ +If @var{idx} is an empty structure array with fields @samp{type}\n\ +and @samp{subs}, return @var{rhs}.\n\ @seealso{subsref, substruct}\n\ @end deftypefn") { @@ -2810,12 +2897,24 @@ decode_subscripts ("subsasgn", args(1), type, idx); - octave_value arg0 = args(0); - - arg0.make_unique (); - if (! error_state) - retval = arg0.subsasgn (type, idx, args(2)); + { + if (type.empty ()) + { + // Regularize a null matrix if stored into a variable. + + retval = args(2).storable_value (); + } + else + { + octave_value arg0 = args(0); + + arg0.make_unique (); + + if (! error_state) + retval= arg0.subsasgn (type, idx, args(2)); + } + } } else print_usage (); @@ -2826,15 +2925,18 @@ /* %!test %! a = reshape ([1:25], 5,5); -%! idx1 = substruct ( "()", {3, 3}); -%! idx2 = substruct ( "()", {2:2:5, 2:2:5}); -%! idx3 = substruct ( "()", {":", [1,5]}); -%! assert (subsref (a, idx1), 13) -%! assert (subsref (a, idx2), [7 17; 9 19]) -%! assert (subsref (a, idx3), [1:5; 21:25]') +%! idx1 = substruct ("()", {3, 3}); +%! idx2 = substruct ("()", {2:2:5, 2:2:5}); +%! idx3 = substruct ("()", {":", [1,5]}); +%! idx4 = struct ("type", {}, "subs", {}); +%! assert (subsref (a, idx1), 13); +%! assert (subsref (a, idx2), [7 17; 9 19]); +%! assert (subsref (a, idx3), [1:5; 21:25]'); +%! assert (subsref (a, idx4), a); %! a = subsasgn (a, idx1, 0); %! a = subsasgn (a, idx2, 0); %! a = subsasgn (a, idx3, 0); +%!# a = subsasgn (a, idx4, 0); %! b = [0 6 11 16 0 %! 0 0 12 0 0 %! 0 8 0 18 0 @@ -2844,23 +2946,26 @@ %!test %! c = num2cell (reshape ([1:25],5,5)); -%! idx1 = substruct ( "{}", {3, 3}); -%! idx2 = substruct ( "()", {2:2:5, 2:2:5}); -%! idx3 = substruct ( "()", {":", [1,5]}); -%! idx2p = substruct ( "{}", {2:2:5, 2:2:5}); -%! idx3p = substruct ( "{}", {":", [1,5]}); -%! assert ({ subsref(c, idx1) }, {13}) -%! assert ({ subsref(c, idx2p) }, {7 9 17 19}) -%! assert ({ subsref(c, idx3p) }, num2cell ([1:5, 21:25])) +%! idx1 = substruct ("{}", {3, 3}); +%! idx2 = substruct ("()", {2:2:5, 2:2:5}); +%! idx3 = substruct ("()", {":", [1,5]}); +%! idx2p = substruct ("{}", {2:2:5, 2:2:5}); +%! idx3p = substruct ("{}", {":", [1,5]}); +%! idx4 = struct ("type", {}, "subs", {}); +%! assert ({ subsref(c, idx1) }, {13}); +%! assert ({ subsref(c, idx2p) }, {7 9 17 19}); +%! assert ({ subsref(c, idx3p) }, num2cell ([1:5, 21:25])); +%! assert (subsref(c, idx4), c); %! c = subsasgn (c, idx1, 0); %! c = subsasgn (c, idx2, 0); %! c = subsasgn (c, idx3, 0); +%!# c = subsasgn (c, idx4, 0); %! d = {0 6 11 16 0 %! 0 0 12 0 0 %! 0 8 0 18 0 %! 0 0 14 0 0 %! 0 10 15 20 0}; -%! assert (c,d); +%! assert (c, d); %!test %! s.a = "ohai"; @@ -2869,16 +2974,19 @@ %! idx1 = substruct (".", "a"); %! idx2 = substruct (".", "b"); %! idx3 = substruct (".", "c"); -%! assert (subsref (s, idx1), "ohai") -%! assert (subsref (s, idx2), "dere") -%! assert (subsref (s, idx3), 42) +%! idx4 = struct ("type", {}, "subs", {}); +%! assert (subsref (s, idx1), "ohai"); +%! assert (subsref (s, idx2), "dere"); +%! assert (subsref (s, idx3), 42); +%! assert (subsref (s, idx4), s); %! s = subsasgn (s, idx1, "Hello"); %! s = subsasgn (s, idx2, "There"); %! s = subsasgn (s, idx3, 163); +%!# s = subsasgn (s, idx4, 163); %! t.a = "Hello"; %! t.b = "There"; %! t.c = 163; -%! assert (s, t) +%! assert (s, t); */ diff -r dd1f5493fff4 -r c72ad9f5fa2e src/strfns.cc --- a/src/strfns.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/strfns.cc Sun Nov 27 09:07:37 2011 -0500 @@ -332,8 +332,8 @@ %!assert(ischar ("test"), logical (1)); %!assert(ischar (["test"; "ing"]), logical (1)); %!assert(ischar (struct ("foo", "bar")), logical (0)); -%!error ischar (); -%!error ischar ("test", 1); +%!error ischar (); +%!error ischar ("test", 1); */ static octave_value @@ -589,8 +589,8 @@ } /* -%!error strcmp (); -%!error strcmp ("foo", "bar", 3); +%!error strcmp (); +%!error strcmp ("foo", "bar", 3); %! %!shared x %! x = char (zeros (0, 2)); @@ -712,8 +712,8 @@ } /* -%!error strncmp (); -%!error strncmp ("abc", "def"); +%!error strncmp (); +%!error strncmp ("abc", "def"); %!assert (strncmp ("abce", "abc", 3) == 1) %!assert (strncmp (100, 100, 1) == 0) %!assert (all (strncmp ("abce", {"abcd", "bca", "abc"}, 3) == [1, 0, 1])) @@ -922,9 +922,9 @@ } /* -%!error list_in_columns (); -%!error list_in_columns (["abc", "def"], 20, 2); -%!error list_in_columns (["abc", "def"], "a"); +%!error list_in_columns (); +%!error list_in_columns (["abc", "def"], 20, 2); +%!error list_in_columns (["abc", "def"], "a"); %!test %! input = {"abc", "def", "ghijkl", "mnop", "qrs", "tuv"}; %! result = "abc mnop\ndef qrs\nghijkl tuv\n"; diff -r dd1f5493fff4 -r c72ad9f5fa2e src/symtab.cc --- a/src/symtab.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/symtab.cc Sun Nov 27 09:07:37 2011 -0500 @@ -674,7 +674,7 @@ octave_value& fval = q->second; if (fval.is_defined ()) - out_of_date_check (fval); + out_of_date_check (fval, "", false); if (fval.is_defined ()) return fval; diff -r dd1f5493fff4 -r c72ad9f5fa2e src/sysdep.cc --- a/src/sysdep.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/sysdep.cc Sun Nov 27 09:07:37 2011 -0500 @@ -110,8 +110,11 @@ { std::string bin_dir; - HANDLE h = CreateToolhelp32Snapshot (TH32CS_SNAPMODULE | - TH32CS_SNAPMODULE32, 0); + HANDLE h = CreateToolhelp32Snapshot (TH32CS_SNAPMODULE +#ifdef TH32CS_SNAPMODULE32 + | TH32CS_SNAPMODULE32 +#endif + , 0); if (h != INVALID_HANDLE_VALUE) { diff -r dd1f5493fff4 -r c72ad9f5fa2e src/utils.cc --- a/src/utils.cc Wed Nov 23 09:19:40 2011 +0000 +++ b/src/utils.cc Sun Nov 27 09:07:37 2011 -0500 @@ -1162,79 +1162,6 @@ return retval; } -void -decode_subscripts (const char* name, const octave_value& arg, - std::string& type_string, - std::list& idx) -{ - const octave_map m = arg.map_value (); - - if (! error_state - && m.nfields () == 2 && m.contains ("type") && m.contains ("subs")) - { - const Cell type = m.contents ("type"); - const Cell subs = m.contents ("subs"); - - octave_idx_type nel = type.numel (); - - type_string = std::string (nel, '\0'); - - for (int k = 0; k < nel; k++) - { - std::string item = type(k).string_value (); - - if (! error_state) - { - if (item == "{}") - type_string[k] = '{'; - else if (item == "()") - type_string[k] = '('; - else if (item == ".") - type_string[k] = '.'; - else - { - error("%s: invalid indexing type `%s'", name, item.c_str ()); - return; - } - } - else - { - error ("%s: expecting type(%d) to be a character string", - name, k+1); - return; - } - - octave_value_list idx_item; - - if (subs(k).is_string ()) - idx_item(0) = subs(k); - else if (subs(k).is_cell ()) - { - Cell subs_cell = subs(k).cell_value (); - - for (int n = 0; n < subs_cell.length (); n++) - { - if (subs_cell(n).is_string () - && subs_cell(n).string_value () == ":") - idx_item(n) = octave_value(octave_value::magic_colon_t); - else - idx_item(n) = subs_cell(n); - } - } - else - { - error ("%s: expecting subs(%d) to be a character string or cell array", - name, k+1); - return; - } - - idx.push_back (idx_item); - } - } - else - error ("%s: second argument must be a structure with fields `type' and `subs'", name); -} - Matrix identity_matrix (octave_idx_type nr, octave_idx_type nc) { diff -r dd1f5493fff4 -r c72ad9f5fa2e src/utils.h --- a/src/utils.h Wed Nov 23 09:19:40 2011 +0000 +++ b/src/utils.h Sun Nov 27 09:07:37 2011 -0500 @@ -97,11 +97,6 @@ extern OCTINTERP_API octave_idx_type dims_to_numel (const dim_vector& dims, const octave_value_list& idx); -extern OCTINTERP_API void -decode_subscripts (const char* name, const octave_value& arg, - std::string& type_string, - std::list& idx); - extern OCTINTERP_API Matrix identity_matrix (octave_idx_type nr, octave_idx_type nc); diff -r dd1f5493fff4 -r c72ad9f5fa2e test/classes/module.mk --- a/test/classes/module.mk Wed Nov 23 09:19:40 2011 +0000 +++ b/test/classes/module.mk Sun Nov 27 09:07:37 2011 -0500 @@ -1,63 +1,63 @@ classes_FCN_FILES = \ - @Blork/Blork.m \ - @Blork/bleek.m \ - @Blork/display.m \ - @Blork/get.m \ - @Blork/set.m \ - @Cork/Cork.m \ - @Cork/click.m \ - @Cork/display.m \ - @Cork/get.m \ - @Cork/set.m \ - @Dork/Dork.m \ - @Dork/bling.m \ - @Dork/display.m \ - @Dork/gack.m \ - @Dork/get.m \ - @Dork/getStash.m \ - @Dork/private/myStash.m \ - @Dork/set.m \ - @Gork/Gork.m \ - @Gork/cork.m \ - @Gork/display.m \ - @Gork/gark.m \ - @Gork/get.m \ - @Gork/set.m \ - @Gork/subsasgn.m \ - @Gork/subsref.m \ - @Pork/Pork.m \ - @Pork/bling.m \ - @Pork/display.m \ - @Pork/get.m \ - @Pork/gurk.m \ - @Pork/private/myStash.m \ - @Pork/set.m \ - @Sneetch/Sneetch.m \ - @Sneetch/display.m \ - @Snork/Snork.m \ - @Snork/cack.m \ - @Snork/display.m \ - @Snork/end.m \ - @Snork/get.m \ - @Snork/getStash.m \ - @Snork/gick.m \ - @Snork/loadobj.m \ - @Snork/private/myStash.m \ - @Snork/saveobj.m \ - @Snork/set.m \ - @Snork/subsasgn.m \ - @Snork/subsindex.m \ - @Snork/subsref.m \ - @Spork/Spork.m \ - @Spork/cack.m \ - @Spork/display.m \ - @Spork/geek.m \ - @Spork/get.m \ - @Spork/getStash.m \ - @Spork/loadobj.m \ - @Spork/private/myStash.m \ - @Spork/saveobj.m \ - @Spork/set.m \ - test_classes.m + classes/@Blork/Blork.m \ + classes/@Blork/bleek.m \ + classes/@Blork/display.m \ + classes/@Blork/get.m \ + classes/@Blork/set.m \ + classes/@Cork/Cork.m \ + classes/@Cork/click.m \ + classes/@Cork/display.m \ + classes/@Cork/get.m \ + classes/@Cork/set.m \ + classes/@Dork/Dork.m \ + classes/@Dork/bling.m \ + classes/@Dork/display.m \ + classes/@Dork/gack.m \ + classes/@Dork/get.m \ + classes/@Dork/getStash.m \ + classes/@Dork/private/myStash.m \ + classes/@Dork/set.m \ + classes/@Gork/Gork.m \ + classes/@Gork/cork.m \ + classes/@Gork/display.m \ + classes/@Gork/gark.m \ + classes/@Gork/get.m \ + classes/@Gork/set.m \ + classes/@Gork/subsasgn.m \ + classes/@Gork/subsref.m \ + classes/@Pork/Pork.m \ + classes/@Pork/bling.m \ + classes/@Pork/display.m \ + classes/@Pork/get.m \ + classes/@Pork/gurk.m \ + classes/@Pork/private/myStash.m \ + classes/@Pork/set.m \ + classes/@Sneetch/Sneetch.m \ + classes/@Sneetch/display.m \ + classes/@Snork/Snork.m \ + classes/@Snork/cack.m \ + classes/@Snork/display.m \ + classes/@Snork/end.m \ + classes/@Snork/get.m \ + classes/@Snork/getStash.m \ + classes/@Snork/gick.m \ + classes/@Snork/loadobj.m \ + classes/@Snork/private/myStash.m \ + classes/@Snork/saveobj.m \ + classes/@Snork/set.m \ + classes/@Snork/subsasgn.m \ + classes/@Snork/subsindex.m \ + classes/@Snork/subsref.m \ + classes/@Spork/Spork.m \ + classes/@Spork/cack.m \ + classes/@Spork/display.m \ + classes/@Spork/geek.m \ + classes/@Spork/get.m \ + classes/@Spork/getStash.m \ + classes/@Spork/loadobj.m \ + classes/@Spork/private/myStash.m \ + classes/@Spork/saveobj.m \ + classes/@Spork/set.m \ + classes/test_classes.m FCN_FILES += $(classes_FCN_FILES) diff -r dd1f5493fff4 -r c72ad9f5fa2e test/ctor-vs-method/module.mk --- a/test/ctor-vs-method/module.mk Wed Nov 23 09:19:40 2011 +0000 +++ b/test/ctor-vs-method/module.mk Sun Nov 27 09:07:37 2011 -0500 @@ -6,6 +6,6 @@ ctor-vs-method/@parent/method.m \ ctor-vs-method/@parent/parent.m \ ctor-vs-method/__trace__.m \ - test_ctor_vs_method.m + ctor-vs-method/test_ctor_vs_method.m FCN_FILES += $(ctor_vs_method_FCN_FILES) diff -r dd1f5493fff4 -r c72ad9f5fa2e test/fcn-handle-derived-resolution/module.mk --- a/test/fcn-handle-derived-resolution/module.mk Wed Nov 23 09:19:40 2011 +0000 +++ b/test/fcn-handle-derived-resolution/module.mk Sun Nov 27 09:07:37 2011 -0500 @@ -6,6 +6,6 @@ fcn-handle-derived-resolution/@other/other.m \ fcn-handle-derived-resolution/@parent/numel.m \ fcn-handle-derived-resolution/@parent/parent.m \ - test_fcn_handle_derived_resolution.m + fcn-handle-derived-resolution/test_fcn_handle_derived_resolution.m FCN_FILES += $(fcn_handle_derived_resolution_FCN_FILES) diff -r dd1f5493fff4 -r c72ad9f5fa2e test/test_io.m --- a/test/test_io.m Wed Nov 23 09:19:40 2011 +0000 +++ b/test/test_io.m Sun Nov 27 09:07:37 2011 -0500 @@ -237,10 +237,10 @@ %!assert(puts (1),-1); %% test/octave.test/io/puts-3.m -%!error puts (); +%!error puts (); %% test/octave.test/io/puts-4.m -%!error puts (1, 2); +%!error puts (1, 2); %!assert (sscanf ('123456', '%10c'), '123456') %!assert (sscanf ('123456', '%10s'), '123456') @@ -279,13 +279,13 @@ %! && v2 == [1; 2] && c2 == 2 && ischar (m2))); %% test/octave.test/io/sscanf-2.m -%!error sscanf (); +%!error sscanf (); %% test/octave.test/io/sscanf-3.m %!error sscanf (1, 2); %% test/octave.test/io/sscanf-4.m -%!error sscanf ("foo", "bar", "C", 1); +%!error sscanf ("foo", "bar", "C", 1); %% test/octave.test/io/sscanf-5.m %!test @@ -310,7 +310,7 @@ %!error printf (1); %% test/octave.test/io/printf-3.m -%!error printf (); +%!error printf (); %% test/octave.test/io/sprintf-1.m %!test @@ -322,7 +322,7 @@ %!error sprintf (1); %% test/octave.test/io/sprintf-3.m -%!error sprintf (); +%!error sprintf (); %% test/octave.test/io/fopen-1.m %!test @@ -393,16 +393,16 @@ %! assert(prog_output_assert("error:.*")); %% test/octave.test/io/fopen-5.m -%!error fopen (); +%!error fopen (); %% test/octave.test/io/fopen-6.m -%!error fopen ("foo", "wb", "native", 1); +%!error fopen ("foo", "wb", "native", 1); %% test/octave.test/io/fclose-1.m %!error fclose (0); %% test/octave.test/io/fclose-2.m -%!error fclose (1, 2); +%!error fclose (1, 2); %% test/octave.test/io/tmpnam-1.m %!assert(ischar (tmpnam ())); @@ -414,7 +414,7 @@ %!warning tmpnam ("foo", 1); %% test/octave.test/io/tmpnam-4.m -%!error tmpnam (1, 2, 3); +%!error tmpnam (1, 2, 3); %% test/octave.test/io/binary-io-1.m %!test @@ -499,37 +499,37 @@ %! unlink (nm); %% test/octave.test/io/fputs-1.m -%!error fputs (); +%!error fputs (); %% test/octave.test/io/fputs-2.m -%!error fputs (1, "foo", 1); +%!error fputs (1, "foo", 1); %% test/octave.test/io/fputs-3.m %!assert(fputs (1, 1),-1); %% test/octave.test/io/fgetl-1.m -%!error fgetl (); +%!error fgetl (); %% test/octave.test/io/fgetl-2.m -%!error fgetl (1, 2, 3); +%!error fgetl (1, 2, 3); %% test/octave.test/io/fgetl-3.m %!error fgetl ("foo", 1); %% test/octave.test/io/fgets-1.m -%!error fgets (); +%!error fgets (); %% test/octave.test/io/fgets-2.m -%!error fgets (1, 2, 3); +%!error fgets (1, 2, 3); %% test/octave.test/io/fgets-3.m %!error fgets ("foo", 1); %% test/octave.test/io/fprintf-1.m -%!error fprintf (); +%!error fprintf (); %% test/octave.test/io/fprintf-2.m -%!error fprintf (1); +%!error fprintf (1); %% test/octave.test/io/fprintf-3.m %!test @@ -543,37 +543,37 @@ %!error fprintf (-1, "foo"); %% test/octave.test/io/fscanf-1.m -%!error fscanf (); +%!error fscanf (); %% test/octave.test/io/fscanf-2.m -%!error fscanf (1); +%!error fscanf (1); %% test/octave.test/io/fscanf-3.m %!error fscanf ("foo", "bar"); %% test/octave.test/io/fread-1.m -%!error fread (); +%!error fread (); %% test/octave.test/io/fread-2.m -%!error fread (1, 2, "char", 1, "native", 2); +%!error fread (1, 2, "char", 1, "native", 2); %% test/octave.test/io/fread-3.m %!error fread ("foo"); %% test/octave.test/io/fwrite-1.m -%!error fwrite (); +%!error fwrite (); %% test/octave.test/io/fwrite-2.m -%!error fwrite (1, rand (10), "char", 1, "native", 2); +%!error fwrite (1, rand (10), "char", 1, "native", 2); %% test/octave.test/io/fwrite-3.m %!error fwrite ("foo", 1); %% test/octave.test/io/feof-1.m -%!error feof (); +%!error feof (); %% test/octave.test/io/feof-2.m -%!error feof (1, 2); +%!error feof (1, 2); %% test/octave.test/io/feof-3.m %!error feof ("foo"); @@ -592,28 +592,28 @@ %!error ferror ("foo"); %% test/octave.test/io/ftell-1.m -%!error ftell (); +%!error ftell (); %% test/octave.test/io/ftell-2.m -%!error ftell (1, 2); +%!error ftell (1, 2); %% test/octave.test/io/ftell-3.m %!error ftell ("foo"); %% test/octave.test/io/fseek-1.m -%!error fseek (); +%!error fseek (); %% test/octave.test/io/fseek-2.m -%!error fseek (1, 0, SEEK_SET, 1); +%!error fseek (1, 0, SEEK_SET, 1); %% test/octave.test/io/fseek-3.m %!error fseek ("foo", 0, SEEK_SET); %% test/octave.test/io/frewind-1.m -%!error frewind (); +%!error frewind (); %% test/octave.test/io/frewind-2.m -%!error frewind (1, 2); +%!error frewind (1, 2); %% test/octave.test/io/frewind-3.m %!error frewind ("foo"); diff -r dd1f5493fff4 -r c72ad9f5fa2e test/test_struct.m --- a/test/test_struct.m Wed Nov 23 09:19:40 2011 +0000 +++ b/test/test_struct.m Sun Nov 27 09:07:37 2011 -0500 @@ -29,7 +29,7 @@ %! assert(iscell (c) && strcmp (c{1}, "b")); %% test/octave.test/struct/fieldnames-3.m -%!error fieldnames (); +%!error fieldnames (); %% test/octave.test/struct/fieldnames-4.m %!test @@ -52,7 +52,7 @@ %! assert(!(isfield (s, "b"))); %% test/octave.test/struct/isfield-3.m -%!error isfield (); +%!error isfield (); %% test/octave.test/struct/isfield-4.m %!test @@ -100,7 +100,7 @@ %! assert(isstruct (s.a)); %% test/octave.test/struct/isstruct-10.m -%!error isstruct (); +%!error isstruct (); %% test/octave.test/struct/isstruct-11.m %!test diff -r dd1f5493fff4 -r c72ad9f5fa2e test/test_system.m --- a/test/test_system.m Wed Nov 23 09:19:40 2011 +0000 +++ b/test/test_system.m Sun Nov 27 09:07:37 2011 -0500 @@ -39,7 +39,7 @@ %! assert(prog_output_assert("ok")); %% test/octave.test/system/pause-2.m -%!error pause (1, 2); +%!error pause (1, 2); %% test/octave.test/system/sleep-1.m %!test @@ -48,10 +48,10 @@ %! assert(prog_output_assert("ok")); %% test/octave.test/system/sleep-2.m -%!error sleep (); +%!error sleep (); %% test/octave.test/system/sleep-3.m -%!error sleep (1, 2); +%!error sleep (1, 2); %% test/octave.test/system/usleep-1.m %!test @@ -60,10 +60,10 @@ %! assert(prog_output_assert("ok")); %% test/octave.test/system/usleep-2.m -%!error usleep (); +%!error usleep (); %% test/octave.test/system/usleep-3.m -%!error usleep (1, 2); +%!error usleep (1, 2); %% test/octave.test/system/rename-1.m %!test @@ -85,10 +85,10 @@ %! endif %% test/octave.test/system/rename-2.m -%!error rename (); +%!error rename (); %% test/octave.test/system/rename-3.m -%!error rename ("foo", "bar", 1); +%!error rename ("foo", "bar", 1); %% test/octave.test/system/unlink-1.m %!test @@ -102,10 +102,10 @@ %! endif %% test/octave.test/system/unlink-2.m -%!error unlink (); +%!error unlink (); %% test/octave.test/system/unlink-3.m -%!error unlink ("foo", 1); +%!error unlink ("foo", 1); %% test/octave.test/system/readdir-1.m %!test @@ -113,10 +113,10 @@ %! assert(iscell (files) && status == 0 && strcmp (msg, "")); %% test/octave.test/system/readdir-2.m -%!error readdir (); +%!error readdir (); %% test/octave.test/system/readdir-3.m -%!error readdir ("foo", 1); +%!error readdir ("foo", 1); %% test/octave.test/system/mk-rm-dir-1.m %!test @@ -128,13 +128,13 @@ %! assert((e1 && strcmp (s2.modestr(1), "d") && e3 && e4 < 0)); %% test/octave.test/system/mkdir-1.m -%!error mkdir (); +%!error mkdir (); %% test/octave.test/system/mkdir-2.m -%!error mkdir ("foo", 1, 2); +%!error mkdir ("foo", 1, 2); %% test/octave.test/system/rmdir-1.m -%!error rmdir (); +%!error rmdir (); %% test/octave.test/system/rmdir-2.m %!test @@ -163,10 +163,10 @@ %! assert(strcmp (s1.modestr, "-rw-rw-rw-") && strcmp (s2.modestr, "----------")); %% test/octave.test/system/umask-2.m -%!error umask (); +%!error umask (); %% test/octave.test/system/umask-3.m -%!error umask (1, 2); +%!error umask (1, 2); %% test/octave.test/system/stat-1.m %!test @@ -186,10 +186,10 @@ %! && ischar (msg))); %% test/octave.test/system/stat-2.m -%!error stat (); +%!error stat (); %% test/octave.test/system/stat-3.m -%!error stat ("foo", 1); +%!error stat ("foo", 1); %% test/octave.test/system/lstat-1.m %!test @@ -209,10 +209,10 @@ %! && ischar (msg))); %% test/octave.test/system/lstat-2.m -%!error lstat (); +%!error lstat (); %% test/octave.test/system/lstat-3.m -%!error lstat ("foo", 1); +%!error lstat ("foo", 1); %% test/octave.test/system/glob-1.m %!assert(iscell (glob ([filesep "*"]))); @@ -221,7 +221,7 @@ %!error glob (); %% test/octave.test/system/glob-3.m -%!error glob ("foo", 1); +%!error glob ("foo", 1); %% test/octave.test/system/fnmatch-1.m %!test @@ -233,10 +233,10 @@ %! && fnmatch ("x???y", {"xabcy"; "xy"}) == [1; 0])); %% test/octave.test/system/fnmatch-2.m -%!error fnmatch (); +%!error fnmatch (); %% test/octave.test/system/fnmatch-3.m -%!error fnmatch ("foo", "bar", 3); +%!error fnmatch ("foo", "bar", 3); %% test/octave.test/system/file_in_path-1.m %!assert(ischar (file_in_path (path (), "date.m"))); @@ -245,10 +245,10 @@ %!error file_in_path ("foo", "bar", 1); %% test/octave.test/system/file_in_path-3.m -%!error file_in_path (); +%!error file_in_path (); %% test/octave.test/system/file_in_path-4.m -%!error file_in_path ("foo", "bar", "baz", "ooka"); +%!error file_in_path ("foo", "bar", "baz", "ooka"); %% test/octave.test/system/tilde_expand-1.m %!testif HAVE_GETPWUID @@ -258,10 +258,10 @@ %! && strcmp ("foobar", tilde_expand ("foobar")))); %% test/octave.test/system/tilde_expand-2.m -%!error tilde_expand (); +%!error tilde_expand (); %% test/octave.test/system/tilde_expand-3.m -%!error tilde_expand ("str", 2); +%!error tilde_expand ("str", 2); %% test/octave.test/system/getpgrp-1.m %!testif HAVE_GETPGRP @@ -311,10 +311,10 @@ %!assert(strcmp (getenv ("HOME"), tilde_expand ("~"))); %% test/octave.test/system/getenv-2.m -%!error getenv (); +%!error getenv (); %% test/octave.test/system/getenv-3.m -%!error getenv ("foo", 1); +%!error getenv ("foo", 1); %% test/octave.test/system/getenv-4.m %!test @@ -329,10 +329,10 @@ %! assert(strcmp (getenv ("foobar"), "baz")); %% test/octave.test/system/putenv-2.m -%!error putenv (); +%!error putenv (); %% test/octave.test/system/putenv-3.m -%!error putenv ("foo", "bar", 1); +%!error putenv ("foo", "bar", 1); %% test/octave.test/system/putenv-4.m %!test @@ -377,7 +377,7 @@ %! && isfield (s, "shell"))); %% test/octave.test/system/getpwent-2.m -%!error getpwent (1); +%!error getpwent (1); %% test/octave.test/system/getpwuid-1.m %!testif HAVE_GETPWUID @@ -387,10 +387,10 @@ %! assert(strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); %% test/octave.test/system/getpwuid-2.m -%!error getpwuid (); +%!error getpwuid (); %% test/octave.test/system/getpwuid-3.m -%!error getpwuid (1, 2); +%!error getpwuid (1, 2); %% test/octave.test/system/getpwnam-1.m %!testif HAVE_GETPWNAM @@ -400,10 +400,10 @@ %! assert(strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); %% test/octave.test/system/getpwnam-2.m -%!error getpwnam (); +%!error getpwnam (); %% test/octave.test/system/getpwnam-3.m -%!error getpwnam ("foo", 1); +%!error getpwnam ("foo", 1); %% test/octave.test/system/setpwent-1.m %!testif HAVE_SETPWENT @@ -414,10 +414,10 @@ %! assert(strcmp (x.name, y.name) && x.uid == y.uid && x.gid == y.gid); %% test/octave.test/system/setpwent-2.m -%!error setpwent (1); +%!error setpwent (1); %% test/octave.test/system/endpwent-1.m -%!error endpwent (1); +%!error endpwent (1); %% test/octave.test/system/getgrent-1.m %!testif HAVE_GETGRENT @@ -430,7 +430,7 @@ %! && isfield (x, "mem"))); %% test/octave.test/system/getgrent-2.m -%!error getgrent (1); +%!error getgrent (1); %% test/octave.test/system/getgrgid-1.m %!testif HAVE_GETGRGID @@ -440,10 +440,10 @@ %! assert(strcmp (x.name, y.name) && x.gid == y.gid); %% test/octave.test/system/getgrgid-2.m -%!error getgrgid (); +%!error getgrgid (); %% test/octave.test/system/getgrgid-3.m -%!error getgrgid (1, 2); +%!error getgrgid (1, 2); %% test/octave.test/system/getgrnam-1.m %!testif HAVE_GETGRNAM @@ -453,10 +453,10 @@ %! assert(strcmp (x.name, y.name) && x.gid == y.gid); %% test/octave.test/system/getgrnam-2.m -%!error getgrnam (); +%!error getgrnam (); %% test/octave.test/system/getgrnam-3.m -%!error getgrnam ("foo", 1); +%!error getgrnam ("foo", 1); %% test/octave.test/system/setgrent-1.m %!testif HAVE_SETGRENT @@ -467,10 +467,10 @@ %! assert(strcmp (x.name, y.name) && x.gid == y.gid); %% test/octave.test/system/setgrent-2.m -%!error setgrent (1); +%!error setgrent (1); %% test/octave.test/system/endgrent-1.m -%!error endgrent (1); +%!error endgrent (1); %% test/octave.test/system/isieee-1.m %!assert(isieee () == 1 || isieee () == 0);