Mercurial > hg > octave-terminal
changeset 11587:c792872f8942
all script files: untabify and strip trailing whitespace
line wrap: on
line diff
--- a/scripts/@ftp/dir.m +++ b/scripts/@ftp/dir.m @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{lst} =} dir (@var{f}) -## List the current directory in verbose form for the FTP connection +## List the current directory in verbose form for the FTP connection ## @var{f}. @var{f} is an FTP object returned by the @code{ftp} function. ## @end deftypefn
--- a/scripts/@ftp/mget.m +++ b/scripts/@ftp/mget.m @@ -22,7 +22,7 @@ ## @deftypefnx {Function File} {} mget (@dots{}, @var{target}) ## Downloads a remote file @var{file} or directory @var{dir} to the local ## directory on the FTP connection @var{f}. @var{f} is an FTP object -## returned by the @code{ftp} function. +## returned by the @code{ftp} function. ## ## The arguments @var{file} and @var{dir} can include wildcards and any ## files or directories on the remote server that match will be downloaded.
--- a/scripts/@ftp/mput.m +++ b/scripts/@ftp/mput.m @@ -20,7 +20,7 @@ ## @deftypefn {Function File} {} mput (@var{f}, @var{file}) ## Upload the local file @var{file} into the current remote directory on ## the FTP connection @var{f}. @var{f} is an FTP object returned by the -## ftp function. +## ftp function. ## ## The argument @var{file} is passed by the @dfn{glob} function and any ## files that match the wildcards in @var{file} will be uploaded.
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,191 @@ +2011-01-20 John W. Eaton <jwe@octave.org> + + * @ftp/dir.m, @ftp/mget.m, @ftp/mput.m, ChangeLog, + audio/lin2mu.m, audio/setaudio.m, audio/wavread.m, + audio/wavwrite.m, deprecated/autocor.m, deprecated/autocov.m, + deprecated/betai.m, deprecated/create_set.m, + deprecated/dispatch.m, deprecated/gammai.m, + deprecated/intwarning.m, deprecated/replot.m, elfun/cosd.m, + elfun/sind.m, elfun/tand.m, general/accumarray.m, + general/accumdim.m, general/arrayfun.m, general/bicubic.m, + general/bitcmp.m, general/bitget.m, general/bitset.m, + general/cart2pol.m, general/cart2sph.m, general/cell2mat.m, + general/celldisp.m, general/circshift.m, general/cplxpair.m, + general/cumtrapz.m, general/curl.m, general/dblquad.m, + general/deal.m, general/del2.m, general/divergence.m, + general/flipud.m, general/gradient.m, general/idivide.m, + general/int2str.m, general/interp1.m, general/interp2.m, + general/interp3.m, general/interpft.m, general/interpn.m, + general/isdir.m, general/loadobj.m, general/logspace.m, + general/num2str.m, general/pol2cart.m, general/polyarea.m, + general/quadgk.m, general/quadl.m, general/quadv.m, + general/randi.m, general/rat.m, general/repmat.m, + general/rot90.m, general/rotdim.m, general/saveobj.m, + general/shift.m, general/sortrows.m, general/sph2cart.m, + general/structfun.m, general/subsindex.m, general/trapz.m, + general/triplequad.m, geometry/convhull.m, geometry/delaunay.m, + geometry/delaunay3.m, geometry/delaunayn.m, geometry/dsearch.m, + geometry/dsearchn.m, geometry/griddata3.m, geometry/griddatan.m, + geometry/inpolygon.m, geometry/rectint.m, geometry/trimesh.m, + geometry/trisurf.m, geometry/tsearchn.m, geometry/voronoi.m, + help/__makeinfo__.m, help/__strip_html_tags__.m, help/doc.m, + help/gen_doc_cache.m, help/get_first_help_sentence.m, + help/help.m, help/lookfor.m, help/print_usage.m, help/type.m, + image/autumn.m, image/bone.m, image/brighten.m, image/cool.m, + image/copper.m, image/flag.m, image/gmap40.m, image/gray.m, + image/hot.m, image/hsv.m, image/hsv2rgb.m, image/image.m, + image/imread.m, image/imshow.m, image/imwrite.m, + image/ind2rgb.m, image/jet.m, image/ntsc2rgb.m, image/ocean.m, + image/pink.m, image/prism.m, image/rainbow.m, image/rgb2hsv.m, + image/rgb2ind.m, image/rgb2ntsc.m, image/spring.m, + image/summer.m, image/winter.m, io/dlmwrite.m, io/fileread.m, + io/strread.m, io/textread.m, linear-algebra/cond.m, + linear-algebra/condest.m, linear-algebra/cross.m, + linear-algebra/expm.m, linear-algebra/isdefinite.m, + linear-algebra/krylov.m, linear-algebra/logm.m, + linear-algebra/normest.m, linear-algebra/onenormest.m, + linear-algebra/rref.m, linear-algebra/subspace.m, + miscellaneous/ans.m, miscellaneous/bincoeff.m, + miscellaneous/bunzip2.m, miscellaneous/bzip2.m, + miscellaneous/computer.m, miscellaneous/copyfile.m, + miscellaneous/debug.m, miscellaneous/edit.m, + miscellaneous/getappdata.m, miscellaneous/getfield.m, + miscellaneous/gunzip.m, miscellaneous/gzip.m, + miscellaneous/isappdata.m, miscellaneous/ls.m, + miscellaneous/mkoctfile.m, miscellaneous/movefile.m, + miscellaneous/namelengthmax.m, miscellaneous/orderfields.m, + miscellaneous/private/__xzip__.m, miscellaneous/rmappdata.m, + miscellaneous/setappdata.m, miscellaneous/substruct.m, + miscellaneous/swapbytes.m, miscellaneous/tar.m, + miscellaneous/unimplemented.m, miscellaneous/unpack.m, + miscellaneous/untar.m, miscellaneous/unzip.m, + miscellaneous/ver.m, miscellaneous/warning_ids.m, + miscellaneous/what.m, miscellaneous/zip.m, + optimization/__all_opts__.m, optimization/fminbnd.m, + optimization/fminunc.m, optimization/fsolve.m, + optimization/fzero.m, optimization/glpk.m, + optimization/lsqnonneg.m, optimization/optimget.m, + optimization/pqpnonneg.m, optimization/qp.m, optimization/sqp.m, + path/pathdef.m, path/savepath.m, pkg/pkg.m, + plot/__fltk_ginput__.m, plot/__gnuplot_ginput__.m, + plot/__gnuplot_has_feature__.m, plot/__gnuplot_open_stream__.m, + plot/__gnuplot_print__.m, plot/__go_draw_axes__.m, + plot/__go_draw_figure__.m, plot/__marching_cube__.m, + plot/__next_line_color__.m, plot/__next_line_style__.m, + plot/__plt_get_axis_arg__.m, plot/__print_parse_opts__.m, + plot/area.m, plot/axis.m, plot/bar.m, plot/barh.m, plot/caxis.m, + plot/cla.m, plot/clabel.m, plot/colorbar.m, plot/comet.m, + plot/comet3.m, plot/compass.m, plot/contour.m, plot/contour3.m, + plot/contourc.m, plot/cylinder.m, plot/daspect.m, + plot/diffuse.m, plot/ellipsoid.m, plot/errorbar.m, + plot/ezcontour.m, plot/ezcontourf.m, plot/ezmesh.m, + plot/ezmeshc.m, plot/ezplot.m, plot/ezplot3.m, plot/ezpolar.m, + plot/ezsurf.m, plot/ezsurfc.m, plot/feather.m, plot/findobj.m, + plot/fplot.m, plot/gnuplot_drawnow.m, plot/gtext.m, plot/hist.m, + plot/hold.m, plot/ishghandle.m, plot/isocolors.m, + plot/isonormals.m, plot/isosurface.m, plot/isprop.m, + plot/legend.m, plot/loglog.m, plot/loglogerr.m, plot/meshc.m, + plot/meshz.m, plot/ndgrid.m, plot/orient.m, plot/pareto.m, + plot/patch.m, plot/pbaspect.m, plot/pcolor.m, plot/peaks.m, + plot/pie.m, plot/pie3.m, plot/plot.m, plot/plot3.m, + plot/plotmatrix.m, plot/plotyy.m, plot/polar.m, plot/print.m, + plot/private/__actual_axis_position__.m, + plot/private/__axis_label__.m, plot/private/__bar__.m, + plot/private/__clabel__.m, plot/private/__contour__.m, + plot/private/__errplot__.m, plot/private/__ezplot__.m, + plot/private/__fltk_file_filter__.m, + plot/private/__ghostscript__.m, + plot/private/__gnuplot_has_terminal__.m, + plot/private/__patch__.m, plot/private/__pie__.m, + plot/private/__pltopt__.m, plot/private/__quiver__.m, + plot/private/__scatter__.m, plot/private/__stem__.m, + plot/private/__tight_eps_bbox__.m, plot/quiver.m, + plot/quiver3.m, plot/refreshdata.m, plot/rose.m, plot/saveas.m, + plot/scatter.m, plot/scatter3.m, plot/semilogx.m, + plot/semilogxerr.m, plot/semilogy.m, plot/semilogyerr.m, + plot/shading.m, plot/slice.m, plot/specular.m, plot/sphere.m, + plot/stairs.m, plot/stem.m, plot/stem3.m, plot/subplot.m, + plot/surface.m, plot/surfc.m, plot/surfl.m, plot/surfnorm.m, + plot/uigetdir.m, plot/uigetfile.m, plot/uimenu.m, + plot/uiputfile.m, plot/view.m, plot/waitforbuttonpress.m, + plot/whitebg.m, plot/xlim.m, plot/ylim.m, plot/zlim.m, + polynomial/mkpp.m, polynomial/mpoles.m, polynomial/pchip.m, + polynomial/poly.m, polynomial/polyaffine.m, + polynomial/polyderiv.m, polynomial/polyfit.m, + polynomial/polyreduce.m, polynomial/polyval.m, + polynomial/ppder.m, polynomial/ppint.m, polynomial/ppjumps.m, + polynomial/ppval.m, polynomial/residue.m, polynomial/roots.m, + polynomial/spline.m, polynomial/unmkpp.m, set/ismember.m, + set/private/validargs.m, set/setdiff.m, set/setxor.m, + set/union.m, set/unique.m, signal/arma_rnd.m, signal/fftconv.m, + signal/fftshift.m, signal/filter2.m, signal/freqz.m, + signal/ifftshift.m, signal/unwrap.m, sparse/bicgstab.m, + sparse/cgs.m, sparse/gplot.m, sparse/pcg.m, sparse/pcr.m, + sparse/spaugment.m, sparse/spdiags.m, sparse/speye.m, + sparse/spfun.m, sparse/sprand.m, sparse/sprandn.m, + sparse/sprandsym.m, sparse/spstats.m, sparse/spy.m, + sparse/svds.m, sparse/treelayout.m, sparse/treeplot.m, + specfun/bessel.m, specfun/betaln.m, specfun/factor.m, + specfun/legendre.m, specfun/nchoosek.m, specfun/nthroot.m, + specfun/primes.m, specfun/reallog.m, specfun/realpow.m, + specfun/realsqrt.m, special-matrix/hadamard.m, + special-matrix/invhilb.m, special-matrix/magic.m, + special-matrix/pascal.m, special-matrix/toeplitz.m, + startup/__finish__.m, statistics/base/cov.m, + statistics/base/histc.m, statistics/base/iqr.m, + statistics/base/kendall.m, statistics/base/kurtosis.m, + statistics/base/mean.m, statistics/base/meansq.m, + statistics/base/median.m, statistics/base/mode.m, + statistics/base/moment.m, statistics/base/ols.m, + statistics/base/prctile.m, statistics/base/qqplot.m, + statistics/base/quantile.m, statistics/base/ranks.m, + statistics/base/run_count.m, statistics/base/skewness.m, + statistics/base/statistics.m, statistics/base/std.m, + statistics/base/studentize.m, statistics/base/var.m, + statistics/distributions/betainv.m, + statistics/distributions/betapdf.m, + statistics/distributions/betarnd.m, + statistics/distributions/binoinv.m, + statistics/distributions/binornd.m, + statistics/distributions/cauchy_cdf.m, + statistics/distributions/cauchy_inv.m, + statistics/distributions/cauchy_pdf.m, + statistics/distributions/cauchy_rnd.m, + statistics/distributions/chi2rnd.m, + statistics/distributions/discrete_rnd.m, + statistics/distributions/exprnd.m, + statistics/distributions/fcdf.m, + statistics/distributions/frnd.m, + statistics/distributions/gamrnd.m, + statistics/distributions/lognrnd.m, + statistics/distributions/nbincdf.m, + statistics/distributions/nbininv.m, + statistics/distributions/nbinpdf.m, + statistics/distributions/nbinrnd.m, + statistics/distributions/normrnd.m, + statistics/distributions/poissrnd.m, + statistics/distributions/stdnormal_rnd.m, + statistics/distributions/tpdf.m, + statistics/distributions/trnd.m, + statistics/distributions/unifcdf.m, + statistics/distributions/unifrnd.m, + statistics/distributions/wblrnd.m, + statistics/tests/bartlett_test.m, + statistics/tests/kolmogorov_smirnov_test_2.m, + statistics/tests/kruskal_wallis_test.m, + statistics/tests/t_test_regression.m, strings/blanks.m, + strings/dec2base.m, strings/dec2hex.m, strings/findstr.m, + strings/index.m, strings/isstrprop.m, strings/mat2str.m, + strings/regexptranslate.m, strings/str2num.m, strings/strchr.m, + strings/strjust.m, strings/strmatch.m, strings/strsplit.m, + strings/strtok.m, strings/untabify.m, testfun/assert.m, + testfun/demo.m, testfun/example.m, testfun/fail.m, + testfun/speed.m, testfun/test.m, time/datenum.m, time/datestr.m, + time/datetick.m, time/datevec.m, time/etime.m: + Strip trailing whitespace. + + * statistics/distributions/betapdf.m: Untabify. + 2010-01-20 Petr Mikulik <mikulik@physics.muni.cz> * plot/uigetdir.m: Use correct variable name for argument check.
--- a/scripts/audio/lin2mu.m +++ b/scripts/audio/lin2mu.m @@ -20,10 +20,10 @@ ## @deftypefn {Function File} {} lin2mu (@var{x}) ## @deftypefnx {Function File} {} lin2mu (@var{x}, @var{n}) ## Convert audio data from linear to mu-law. Mu-law values use 8-bit -## unsigned integers. Linear values use @var{n}-bit signed integers or +## unsigned integers. Linear values use @var{n}-bit signed integers or ## floating point values in the range -1 @leq{} @var{x} @leq{} 1 if -## @var{n} is 0. -## If @var{n} is not specified it defaults to 0, 8, or 16 depending on +## @var{n} is 0. +## If @var{n} is not specified it defaults to 0, 8, or 16 depending on ## the range of values in @var{x}. ## @seealso{mu2lin, loadaudio, saveaudio} ## @end deftypefn
--- a/scripts/audio/setaudio.m +++ b/scripts/audio/setaudio.m @@ -20,7 +20,7 @@ ## @deftypefn {Function File} {} setaudio () ## @deftypefnx {Function File} {} setaudio (@var{w_type}) ## @deftypefnx {Function File} {} setaudio (@var{w_type}, @var{value}) -## Execute the shell command @samp{mixer}, possibly with optional +## Execute the shell command @samp{mixer}, possibly with optional ## arguments @var{w_type} and @var{value}. ## @end deftypefn
--- a/scripts/audio/wavread.m +++ b/scripts/audio/wavread.m @@ -23,7 +23,7 @@ ## @var{y} is a matrix with the channels represented as columns. ## ## @deftypefnx {Function File} {[@var{y}, @var{Fs}, @var{bits}] =} wavread (@var{filename}) -## Additionally return the sample rate (@var{fs}) in Hz and the number of bits +## Additionally return the sample rate (@var{fs}) in Hz and the number of bits ## per sample (@var{bits}). ## ## @deftypefnx {Function File} {[@dots{}] =} wavread (@var{filename}, @var{n}) @@ -80,7 +80,7 @@ error ("wavread: file contains no WAVE signature"); endif riff_pos = riff_pos + 4; - riff_size = riff_size - 4; + riff_size = riff_size - 4; ## Find format chunk inside the RIFF chunk. fseek (fid, riff_pos, "bof"); @@ -90,7 +90,7 @@ fclose (fid); error ("wavread: file contains no format chunk"); endif - + ## Find data chunk inside the RIFF chunk. ## We don't assume that it comes after the format chunk. fseek (fid, riff_pos, "bof"); @@ -100,10 +100,10 @@ fclose (fid); error ("wavread: file contains no data chunk"); endif - + ### Read format chunk. fseek (fid, fmt_pos, "bof"); - + ## Sample format code. format_tag = fread (fid, 1, "uint16", 0, BYTEORDER); if (format_tag != FORMAT_PCM && format_tag != FORMAT_IEEE_FLOAT) @@ -123,17 +123,17 @@ ### Read data chunk. fseek (fid, data_pos, "bof"); - + ## Determine sample data type. if (format_tag == FORMAT_PCM) switch (bits_per_sample) case 8 format = "uint8"; - case 16 + case 16 format = "int16"; case 24 format = "uint8"; - case 32 + case 32 format = "int32"; otherwise fclose (fid); @@ -142,9 +142,9 @@ endswitch else switch (bits_per_sample) - case 32 + case 32 format = "float32"; - case 64 + case 64 format = "float64"; otherwise fclose (fid); @@ -152,7 +152,7 @@ bits_per_sample); endswitch endif - + ## Parse arguments. if (nargin == 1) length = 8 * data_size / bits_per_sample; @@ -210,11 +210,11 @@ yi /= 2147483647; endswitch endif - + ## Deinterleave. nr = numel (yi) / channels; y = reshape (yi, channels, nr)'; - + endfunction ## Given a chunk_id, scan through chunks from the current file position @@ -232,7 +232,7 @@ id = char (fread (fid, 4))'; chunk_size = fread (fid, 1, "uint32", 0, "ieee-le"); ## Chunk sizes must be word-aligned (2 byte) - chunk_size += rem (chunk_size, 2); + chunk_size += rem (chunk_size, 2); offset = offset + 8 + chunk_size; endwhile if (! strcmp (id, chunk_id))
--- a/scripts/audio/wavwrite.m +++ b/scripts/audio/wavwrite.m @@ -78,33 +78,33 @@ ## determine sample format switch (bits_per_sample) - case 8 + case 8 format = "uint8"; - case 16 + case 16 format = "int16"; - case 32 + case 32 format = "int32"; otherwise error ("wavwrite: sample resolution not supported"); endswitch - + ## calculate filesize [n, channels] = size(y); ## size of data chunk ck_size = n*channels*(bits_per_sample/8); - + ## open file for writing binary if (! ischar (filename)) error ("wavwrite: expecting FILENAME to be a character string"); endif - + [fid, msg] = fopen (filename, "wb"); if (fid < 0) error ("wavwrite: %s", msg); endif - + ## write RIFF/WAVE header c = 0; c += fwrite (fid, "RIFF", "uchar"); @@ -132,18 +132,18 @@ ## block align c += fwrite (fid, channels*bits_per_sample/8, "uint16", 0, BYTEORDER); - c += fwrite (fid, bits_per_sample, "uint16", 0, BYTEORDER); + c += fwrite (fid, bits_per_sample, "uint16", 0, BYTEORDER); c += fwrite (fid, "data", "uchar"); c += fwrite (fid, ck_size, "uint32", 0, BYTEORDER); - + if (c < 25) fclose (fid); error ("wavwrite: writing to file failed"); endif - + ## interleave samples yi = reshape (y', n*channels, 1); - + ## scale samples switch (bits_per_sample) case 8 @@ -153,12 +153,12 @@ case 32 yi = round (yi*2147483647); endswitch - + ## write to file c = fwrite (fid, yi, format, 0, BYTEORDER); - + fclose (fid); - + endfunction %!test
--- a/scripts/deprecated/autocor.m +++ b/scripts/deprecated/autocor.m @@ -22,7 +22,7 @@ ## If @var{h} is omitted, all autocorrelations are computed. ## If @var{x} is a matrix, the autocorrelations of each column are ## computed. -## The particular algorithm used is from the field of statistics and +## The particular algorithm used is from the field of statistics and ## differs from the definition used in signal processing. ## @end deftypefn
--- a/scripts/deprecated/autocov.m +++ b/scripts/deprecated/autocov.m @@ -22,7 +22,7 @@ ## If @var{h} is omitted, all autocovariances are computed. ## If @var{x} is a matrix, the autocovariances of each column are ## computed. -## The particular algorithm used is from the field of statistics and +## The particular algorithm used is from the field of statistics and ## differs from the definition used in signal processing. ## @end deftypefn
--- a/scripts/deprecated/betai.m +++ b/scripts/deprecated/betai.m @@ -21,8 +21,8 @@ ## This function is provided for compatibility with older versions of ## Octave. New programs should use betainc instead. ## -## @code{betai (@var{a}, @var{b}, @var{x})} is the same as -## @code{betainc (@var{x}, @var{a}, @var{b})}. +## @code{betai (@var{a}, @var{b}, @var{x})} is the same as +## @code{betainc (@var{x}, @var{a}, @var{b})}. ## @end deftypefn ## Author: jwe
--- a/scripts/deprecated/create_set.m +++ b/scripts/deprecated/create_set.m @@ -60,7 +60,7 @@ if (nargin < 1 || nargin > 2) print_usage (); endif - + if (nargin == 1) y = unique (x)(:)'; elseif (strcmpi (rows_opt, "rows"))
--- a/scripts/deprecated/dispatch.m +++ b/scripts/deprecated/dispatch.m @@ -52,7 +52,7 @@ %!test # builtin function replacement %! dispatch('sin','length','string') %! assert(sin("abc"),3) -%! assert(sin(0),0,10*eps); +%! assert(sin(0),0,10*eps); %!test # 'any' function %! dispatch('sin','exp','any')
--- a/scripts/deprecated/gammai.m +++ b/scripts/deprecated/gammai.m @@ -21,7 +21,7 @@ ## This function is provided for compatibility with older versions of ## Octave. New programs should use @code{gammainc} instead. ## -## @code{gammai (@var{a}, @var{x})} is the same as +## @code{gammai (@var{a}, @var{x})} is the same as ## @code{gammainc (@var{x}, @var{a})}. ## @end deftypefn
--- a/scripts/deprecated/intwarning.m +++ b/scripts/deprecated/intwarning.m @@ -38,7 +38,7 @@ ## The state of warning "Octave:int-convert-overflow" is "off" ## The state of warning "Octave:int-math-overflow" is "off" ## @end group -## @end smallexample +## @end smallexample ## ## @item "on" ## @itemx "off" @@ -101,8 +101,8 @@ elseif (strcmpi (x, "off")) warning ("off", "Octave:int-convert-nan"); warning ("off", "Octave:int-convert-non-int-val"); - warning ("off", "Octave:int-convert-overflow"); - warning ("off", "Octave:int-math-overflow"); + warning ("off", "Octave:int-convert-overflow"); + warning ("off", "Octave:int-math-overflow"); else error ("intwarning: unrecognized argument"); endif @@ -128,6 +128,6 @@ endfunction function __print_int_warn_state__ (s) - fprintf ("The state of warning \"%s\" is \"%s\"\n", + fprintf ("The state of warning \"%s\" is \"%s\"\n", s, warning ("query", s).state); endfunction
--- a/scripts/deprecated/replot.m +++ b/scripts/deprecated/replot.m @@ -26,7 +26,7 @@ ## Deprecated in version 3.4 function replot () - + persistent warned = false; if (! warned) warned = true;
--- a/scripts/elfun/cosd.m +++ b/scripts/elfun/cosd.m @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} cosd (@var{x}) -## Compute the cosine for each element of @var{x} in degrees. Returns zero +## Compute the cosine for each element of @var{x} in degrees. Returns zero ## for elements where @code{(@var{x}-90)/180} is an integer. ## @seealso{acosd, cos} ## @end deftypefn
--- a/scripts/elfun/sind.m +++ b/scripts/elfun/sind.m @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} sind (@var{x}) -## Compute the sine for each element of @var{x} in degrees. Returns zero +## Compute the sine for each element of @var{x} in degrees. Returns zero ## for elements where @code{@var{x}/180} is an integer. ## @seealso{asind, sin} ## @end deftypefn
--- a/scripts/elfun/tand.m +++ b/scripts/elfun/tand.m @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} tand (@var{x}) -## Compute the tangent for each element of @var{x} in degrees. Returns zero +## Compute the tangent for each element of @var{x} in degrees. Returns zero ## for elements where @code{@var{x}/180} is an integer and @code{Inf} for ## elements where @code{(@var{x}-90)/180} is an integer. ## @seealso{atand, tan}
--- a/scripts/general/accumarray.m +++ b/scripts/general/accumarray.m @@ -32,7 +32,7 @@ ## ## The default action of @code{accumarray} is to sum the elements with the ## same subscripts. This behavior can be modified by defining the @var{func} -## function. This should be a function or function handle that accepts a +## function. This should be a function or function handle that accepts a ## column vector and returns a scalar. The result of the function should not ## depend on the order of the subscripts. ## @@ -58,13 +58,13 @@ ## subscripts and M is the maximum subscript (linearized 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. +## or @code{@@(x) @{x@}}, an 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. ## @end deftypefn -function A = accumarray (subs, vals, sz = [], func = [], fillval = [], issparse = []) +function A = accumarray (subs, vals, sz = [], func = [], fillval = [], issparse = []) if (nargin < 2 || nargin > 6) print_usage (); @@ -118,7 +118,7 @@ ## Reduce values. This is not needed if we're about to sum them, because ## "sparse" can do that. - + ## Sort indices. [subs, idx] = sortrows (subs); n = rows (subs); @@ -237,14 +237,14 @@ endif else - ## The general case. Reduce values. + ## The general case. Reduce values. n = rows (subs); if (numel (vals) == 1) vals = vals(ones (1, n), 1); else vals = vals(:); endif - + ## Sort indices. [subs, idx] = sort (subs); ## Identify runs.
--- a/scripts/general/accumdim.m +++ b/scripts/general/accumdim.m @@ -19,18 +19,18 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} accumdim (@var{subs}, @var{vals}, @var{dim}, @var{n}, @var{func}, @var{fillval}) ## Create an array by accumulating the slices of an array into the -## positions defined by their subscripts along a specified dimension. +## positions defined by their subscripts along a specified dimension. ## The subscripts are defined by the index vector @var{subs}. ## The dimension is specified by @var{dim}. If not given, it defaults ## to the first non-singleton dimension. ## -## The extent of the result matrix in the working dimension will be determined +## The extent of the result matrix in the working dimension will be determined ## by the subscripts themselves. ## However, if @var{n} is defined it determines this extent. ## ## The default action of @code{accumdim} is to sum the subarrays with the ## same subscripts. This behavior can be modified by defining the @var{func} -## function. This should be a function or function handle that accepts an +## function. This should be a function or function handle that accepts an ## array and a dimension, and reduces the array along this dimension. ## As a special exception, the built-in @code{min} and @code{max} functions ## can be used directly, and @code{accumdim} accounts for the middle empty @@ -85,11 +85,11 @@ sz(end+1:dim) = 1; endif sz(dim) = n; - + if (isempty (func) || func == @sum) ## Fast summation case. A = __accumdim_sum__ (subs, vals, dim, n); - + ## Fill in nonzero fill value if (fillval != 0) mask = true (n, 1);
--- a/scripts/general/arrayfun.m +++ b/scripts/general/arrayfun.m @@ -35,7 +35,7 @@ ## array, a structure array or a cell array. By a call of the function ## @command{arrayfun} all elements of @var{A} are passed on to the named ## function @var{func} individually. -## +## ## The named function can also take more than two input arguments, with ## the input arguments given as third input argument @var{b}, fourth ## input argument @var{c}, @dots{} If given more than one array input
--- a/scripts/general/bicubic.m +++ b/scripts/general/bicubic.m @@ -57,7 +57,7 @@ if (nargin <= 2) ## bicubic (z) or bicubic (z, 2) - if (nargin == 1) + if (nargin == 1) n = 1; else n = y; @@ -76,7 +76,7 @@ z = x; [rz, cz] = size (z); elseif (nargin == 5 || nargin == 6) - [rz, cz] = size (z) ; + [rz, cz] = size (z) ; if (isvector (x) && isvector (y)) if (rz != length (y) || cz != length (x)) error ("bicubic: length of X and Y must match the size of Z"); @@ -87,10 +87,10 @@ else error ("bicubic: X, Y and Z must be equal size matrices of same size"); endif - + ## Mark values outside the lookup table. xfirst_ind = find (xi < x(1)); - xlast_ind = find (xi > x(cz)); + xlast_ind = find (xi > x(cz)); yfirst_ind = find (yi < y(1)); ylast_ind = find (yi > y(rz)); ## Set value outside the table preliminary to min max index. @@ -102,31 +102,31 @@ x = reshape (x, 1, cz); x(cz) *= 1 + sign (x(cz))*myeps; - if (x(cz) == 0) + if (x(cz) == 0) x(cz) = myeps; - endif; + endif; xi = reshape (xi, 1, length (xi)); [m, i] = sort ([x, xi]); o = cumsum (i <= cz); xidx = o(find (i > cz)); - + y = reshape (y, rz, 1); y(rz) *= 1 + sign (y(rz))*myeps; - if (y(rz) == 0) + if (y(rz) == 0) y(rz) = myeps; - endif; + endif; yi = reshape (yi, length (yi), 1); [m, i] = sort ([y; yi]); o = cumsum (i <= rz); yidx = o([find(i > rz)]); - + ## Set s and t used follow codes. s = xidx + ((xi .- x(xidx))./(x(xidx+1) .- x(xidx))); t = yidx + ((yi - y(yidx))./(y(yidx+1) - y(yidx))); else print_usage (); endif - + if (rz < 3 || cz < 3) error ("bicubic: Z at least a 3 by 3 matrices"); endif @@ -136,7 +136,7 @@ s = s - floor (s); inds(d) = cz-1; s(d) = 1.0; - + d = []; indt = floor (t); d = find (t == rz); @@ -179,7 +179,7 @@ lent = length (ct0); lens = columns (cs0); zi = zeros (lent, lens); - + for i = 1:lent it = indt(i); int = [it, it+1, it+2, it+3];
--- a/scripts/general/bitcmp.m +++ b/scripts/general/bitcmp.m @@ -37,7 +37,7 @@ ## Liberally based on the version by Kai Habel from octave-forge function C = bitcmp (A, k) - + if (nargin < 1 || nargin > 2) print_usage (); endif
--- a/scripts/general/bitget.m +++ b/scripts/general/bitget.m @@ -24,7 +24,7 @@ ## @example ## @group ## bitget (100, 8:-1:1) -## @result{} 0 1 1 0 0 1 0 0 +## @result{} 0 1 1 0 0 1 0 0 ## @end group ## @end example ## @seealso{bitand, bitor, bitxor, bitset, bitcmp, bitshift, bitmax}
--- a/scripts/general/bitset.m +++ b/scripts/general/bitset.m @@ -43,7 +43,7 @@ if (nargin == 2) val = 1; endif - + if (isa (A, "double")) Bmax = bitmax; Amax = log2 (Bmax) + 1;
--- a/scripts/general/cart2pol.m +++ b/scripts/general/cart2pol.m @@ -28,10 +28,10 @@ ## @var{theta} describes the angle relative to the positive x-axis. ## @var{r} is the distance to the z-axis @w{(0, 0, z)}. ## @var{x}, @var{y} (and @var{z}) must be the same shape, or scalar. -## If called with a single matrix argument then each row of @var{c} +## If called with a single matrix argument then each row of @var{c} ## represents the Cartesian coordinate (@var{x}, @var{y} (, @var{z})). ## -## If only a single return argument is requested then return a matrix +## If only a single return argument is requested then return a matrix ## @var{p} where each row represents one polar/(cylindrical) coordinate ## (@var{theta}, @var{phi} (, @var{z})). ## @seealso{pol2cart, cart2sph, sph2cart} @@ -54,7 +54,7 @@ z = []; endif y = x(:,2); - x = x(:,1); + x = x(:,1); else error ("cart2pol: matrix input must have 2 or 3 columns [X, Y (, Z)]"); endif
--- a/scripts/general/cart2sph.m +++ b/scripts/general/cart2sph.m @@ -26,11 +26,11 @@ ## @var{phi} is the angle relative to the xy-plane. ## @var{r} is the distance to the origin @w{(0, 0, 0)}. ## @var{x}, @var{y}, and @var{z} must be the same shape, or scalar. -## If called with a single matrix argument then each row of @var{c} +## If called with a single matrix argument then each row of @var{c} ## represents the Cartesian coordinate (@var{x}, @var{y}, @var{z}). -## -## If only a single return argument is requested then return a matrix -## @var{s} where each row represents one spherical coordinate +## +## If only a single return argument is requested then return a matrix +## @var{s} where each row represents one spherical coordinate ## (@var{theta}, @var{phi}, @var{r}). ## @seealso{sph2cart, cart2pol, pol2cart} ## @end deftypefn @@ -46,9 +46,9 @@ if (nargin == 1) if (ismatrix (x) && columns (x) == 3) - z = x(:,3); - y = x(:,2); - x = x(:,1); + z = x(:,3); + y = x(:,2); + x = x(:,1); else error ("cart2sph: matrix input must have 3 columns [X, Y, Z]"); endif
--- a/scripts/general/cell2mat.m +++ b/scripts/general/cell2mat.m @@ -21,7 +21,7 @@ ## @deftypefn {Function File} {@var{m} =} cell2mat (@var{c}) ## Convert the cell array @var{c} into a matrix by concatenating all ## elements of @var{c} into a hyperrectangle. Elements of @var{c} must -## be numeric, logical or char matrices, or cell arrays, and @code{cat} +## be numeric, logical or char matrices, or cell arrays, and @code{cat} ## must be able to concatenate them together. ## @seealso{mat2cell, num2cell} ## @end deftypefn @@ -35,7 +35,7 @@ if (! iscell (c)) error ("cell2mat: C is not a cell array"); endif - + nb = numel (c); if (nb == 0) @@ -60,7 +60,7 @@ ## n / (d1 * d2) ## n / (d1 * d2 * d3) ## etc. - ## This is minimized if d1 >= d2 >= d3... + ## This is minimized if d1 >= d2 >= d3... sc = size (c); nd = ndims (c);
--- a/scripts/general/celldisp.m +++ b/scripts/general/celldisp.m @@ -21,19 +21,19 @@ ## Recursively display the contents of a cell array. By default the values ## are displayed with the name of the variable @var{c}. However, this name ## can be replaced with the variable @var{name}. For example: -## +## ## @example ## @group ## c = @{1, 2, @{31, 32@}@}; ## celldisp(c, "b") ## @result{} -## b@{1@} = +## b@{1@} = ## 1 -## b@{2@} = +## b@{2@} = ## 2 -## b@{3@}@{1@} = +## b@{3@}@{1@} = ## 31 -## b@{3@}@{2@} = +## b@{3@}@{2@} = ## 32 ## @end group ## @end example @@ -80,4 +80,4 @@ %!demo %! c = {1, 2, {31, 32}}; -%! celldisp(c, "b") \ No newline at end of file +%! celldisp(c, "b") \ No newline at end of file
--- a/scripts/general/circshift.m +++ b/scripts/general/circshift.m @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{y} =} circshift (@var{x}, @var{n}) ## Circularly shifts the values of the array @var{x}. @var{n} must be -## a vector of integers no longer than the number of dimensions in +## a vector of integers no longer than the number of dimensions in ## @var{x}. The values of @var{n} can be either positive or negative, ## which determines the direction in which the values or @var{x} are ## shifted. If an element of @var{n} is zero, then the corresponding @@ -57,7 +57,7 @@ if (! isvector (n) && length (n) > nd) error ("circshift: N must be a vector, no longer than the number of dimension in X"); endif - + if (any (n != floor (n))) error ("circshift: all values of N must be integers"); endif
--- a/scripts/general/cplxpair.m +++ b/scripts/general/cplxpair.m @@ -20,7 +20,7 @@ ## @deftypefn {Function File} {} cplxpair (@var{z}) ## @deftypefnx {Function File} {} cplxpair (@var{z}, @var{tol}) ## @deftypefnx {Function File} {} cplxpair (@var{z}, @var{tol}, @var{dim}) -## Sort the numbers @var{z} into complex conjugate pairs ordered by +## Sort the numbers @var{z} into complex conjugate pairs ordered by ## increasing real part. Place the negative imaginary complex number ## first within each pair. Place all the real numbers (those with ## @code{abs (imag (@var{z}) / @var{z}) < @var{tol})}) after the @@ -58,14 +58,14 @@ if (length (z) == 0) y = zeros (size (z)); - return; + return; endif if (nargin < 2 || isempty (tol)) if (isa (z, "single")) tol = 100 * eps("single"); else - tol = 100*eps; + tol = 100*eps; endif endif @@ -148,7 +148,7 @@ %!assert (cplxpair([1+1i, 1+1i, 1, 1-1i, 1-1i, 2]), \ %! [1-1i, 1+1i, 1-1i, 1+1i, 1, 2]) %!assert (cplxpair([1+1i; 1+1i; 1; 1-1i; 1-1i; 2]), \ -%! [1-1i; 1+1i; 1-1i; 1+1i; 1; 2]) +%! [1-1i; 1+1i; 1-1i; 1+1i; 1; 2]) %!assert (cplxpair([0, 1, 2]), [0, 1, 2]); %!shared z
--- a/scripts/general/cumtrapz.m +++ b/scripts/general/cumtrapz.m @@ -20,23 +20,23 @@ ## @deftypefn {Function File} {@var{z} =} cumtrapz (@var{y}) ## @deftypefnx {Function File} {@var{z} =} cumtrapz (@var{x}, @var{y}) ## @deftypefnx {Function File} {@var{z} =} cumtrapz (@dots{}, @var{dim}) -## +## ## Cumulative numerical integration using trapezoidal method. -## @code{cumtrapz (@var{y})} computes the cumulative integral of the -## @var{y} along the first non-singleton dimension. If the argument -## @var{x} is omitted an equally spaced vector is assumed. @code{cumtrapz -## (@var{x}, @var{y})} evaluates the cumulative integral with respect +## @code{cumtrapz (@var{y})} computes the cumulative integral of the +## @var{y} along the first non-singleton dimension. If the argument +## @var{x} is omitted an equally spaced vector is assumed. @code{cumtrapz +## (@var{x}, @var{y})} evaluates the cumulative integral with respect ## to @var{x}. -## +## ## @seealso{trapz,cumsum} ## @end deftypefn ## Author: Kai Habel <kai.habel@gmx.de> ## -## also: June 2000 Paul Kienzle (fixes,suggestions) +## also: June 2000 Paul Kienzle (fixes,suggestions) ## 2006-05-12 David Bateman - Modified for NDArrays -function z = cumtrapz (x, y, dim) +function z = cumtrapz (x, y, dim) if (nargin < 1) || (nargin > 3) print_usage (); @@ -78,7 +78,7 @@ idx1{i} = 1:sz(i); endfor idx2 = idx1; - idx1{dim} = 2 : n; + idx1{dim} = 2 : n; idx2{dim} = 1 : (n - 1); if (! have_x) @@ -87,7 +87,7 @@ if (! size_equal (x, y)) error ("cumtrapz: X and Y must have the same shape"); endif - z = 0.5 * cumsum ((x(idx1{:}) - x(idx2{:})) .* + z = 0.5 * cumsum ((x(idx1{:}) - x(idx2{:})) .* (y(idx1{:}) + y(idx2{:})), dim); endif
--- a/scripts/general/curl.m +++ b/scripts/general/curl.m @@ -23,7 +23,7 @@ ## @deftypefnx {Function File} {[@dots{}] =} curl (@var{fx}, @var{fy}) ## @deftypefnx {Function File} {@var{v} =} curl (@dots{}) ## Calculate curl of vector field given by the arrays @var{fx}, @var{fy}, and -## @var{fz} or @var{fx}, @var{fy} respectively. +## @var{fz} or @var{fx}, @var{fy} respectively. ## @tex ## $$ curl F(x,y,z) = \left( {\partial{d} \over \partial{y}} F_z - {\partial{d} \over \partial{z}} F_y, {\partial{d} \over \partial{z}} F_x - {\partial{d} \over \partial{x}} F_z, {\partial{d} \over \partial{x}} F_y - {\partial{d} \over \partial{y}} F_x \right)$$ ## @end tex @@ -73,7 +73,7 @@ else print_usage(); endif - + if ((nargin == 4) || (nargin == 2)) if (!size_equal (varargin{fidx}, varargin{fidx + 1})) error ("curl: size of X and Y must match.");
--- a/scripts/general/dblquad.m +++ b/scripts/general/dblquad.m @@ -22,7 +22,7 @@ ## integrate is defined by @code{@var{f}}, and the interval for the ## integration is defined by @code{[@var{xa}, @var{xb}, @var{ya}, ## @var{yb}]}. The function @var{f} must accept a vector @var{x} and a -## scalar @var{y}, and return a vector of the same length as @var{x}. +## scalar @var{y}, and return a vector of the same length as @var{x}. ## ## If defined, @var{tol} defines the absolute tolerance to which to ## which to integrate each sub-integral. @@ -32,15 +32,15 @@ ## @seealso{triplequad,quad,quadv,quadl,quadgk,quadcc,trapz} ## @end deftypefn -function q = dblquad(f, xa, xb, ya, yb, tol, quadf, varargin) +function q = dblquad(f, xa, xb, ya, yb, tol, quadf, varargin) if (nargin < 5) print_usage (); endif if (nargin < 6 || isempty (tol)) - tol = 1e-6; + tol = 1e-6; endif if (nargin < 7 || isempty (quadf)) - quadf = @quadgk; + quadf = @quadgk; endif inner = @__dblquad_inner__;
--- a/scripts/general/deal.m +++ b/scripts/general/deal.m @@ -1,5 +1,5 @@ ## Copyright (C) 1998-2011 Ariel Tankus -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it
--- a/scripts/general/del2.m +++ b/scripts/general/del2.m @@ -38,7 +38,7 @@ ## @example ## @group ## 1 / d^2 d^2 \ -## D = --- * | --- M(x,y) + --- M(x,y) | +## D = --- * | --- M(x,y) + --- M(x,y) | ## 4 \ dx^2 dy^2 / ## @end group ## @end example @@ -48,9 +48,9 @@ ## derivatives over the additional higher dimensions. ## ## The spacing between evaluation points may be defined by @var{h}, which is a -## scalar defining the equidistant spacing in all dimensions. Alternatively, +## scalar defining the equidistant spacing in all dimensions. Alternatively, ## the spacing in each dimension may be defined separately by @var{dx}, -## @var{dy}, etc. A scalar spacing argument defines equidistant spacing, +## @var{dy}, etc. A scalar spacing argument defines equidistant spacing, ## whereas a vector argument can be used to specify variable spacing. The ## length of the spacing vectors must match the respective dimension of ## @var{M}. The default spacing value is 1. @@ -64,7 +64,7 @@ ## Author: Kai Habel <kai.habel@gmx.de> function D = del2 (M, varargin) - + if (nargin < 1) print_usage (); endif
--- a/scripts/general/divergence.m +++ b/scripts/general/divergence.m @@ -22,7 +22,7 @@ ## @deftypefnx {Function File} {@var{div} =} divergence (@var{x}, @var{y}, @var{fx}, @var{fy}) ## @deftypefnx {Function File} {@var{div} =} divergence (@var{fx}, @var{fy}) ## Calculate divergence of a vector field given by the arrays @var{fx}, -## @var{fy}, and @var{fz} or @var{fx}, @var{fy} respectively. +## @var{fy}, and @var{fz} or @var{fx}, @var{fy} respectively. ## @tex ## $$ ## div F(x,y,z) = \partial_x{F} + \partial_y{F} + \partial_z{F} @@ -40,7 +40,7 @@ ## ## @end ifnottex ## The coordinates of the vector field can be given by the arguments @var{x}, -## @var{y}, @var{z} or @var{x}, @var{y} respectively. +## @var{y}, @var{z} or @var{x}, @var{y} respectively. ## ## @seealso{curl, gradient, del2, cross, dot} ## @end deftypefn @@ -71,7 +71,7 @@ else print_usage(); endif - + if ((nargin == 4) || (nargin == 2)) if (!size_equal (varargin{fidx},varargin{fidx + 1})) error ("divergence: size of X and Y must match."); @@ -83,7 +83,7 @@ retval = gradient(varargin{fidx}, dx, dy); retval += gradient(varargin{fidx + 1}.', dy, dx).'; - + elseif ((nargin == 6) || (nargin == 3)) if (!size_equal (varargin{fidx},varargin{fidx + 1},varargin{fidx + 2})) error ("divergence: size of X, Y, and Z must match")
--- a/scripts/general/flipud.m +++ b/scripts/general/flipud.m @@ -29,7 +29,7 @@ ## @end group ## @end example ## -## Due to the difficulty of defining which axis about which to flip the +## Due to the difficulty of defining which axis about which to flip the ## matrix @code{flipud} only work with 2-d arrays. To flip N-d arrays ## use @code{flipdim} instead. ## @seealso{fliplr, flipdim, rot90, rotdim}
--- a/scripts/general/gradient.m +++ b/scripts/general/gradient.m @@ -36,21 +36,21 @@ ## ## A constant spacing between two points can be provided by the ## @var{s} parameter. If @var{s} is a scalar, it is assumed to be the spacing -## for all dimensions. +## for all dimensions. ## Otherwise, separate values of the spacing can be supplied by ## the @var{x}, @dots{} arguments. Scalar values specify an equidistant ## spacing. ## Vector values for the @var{x}, @dots{} arguments specify the coordinate for ## that ## dimension. The length must match their respective dimension of @var{m}. -## +## ## At boundary points a linear extrapolation is applied. Interior points ## are calculated with the first approximation of the numerical gradient ## ## @example ## y'(i) = 1/(x(i+1)-x(i-1)) * (y(i-1)-y(i+1)). ## @end example -## +## ## If the first argument @var{f} is a function handle, the gradient of the ## function at the points in @var{x0} is approximated using central ## difference. For example, @code{gradient (@@cos, 0)} approximates the @@ -65,7 +65,7 @@ ## Modified: David Bateman <dbateman@free.fr> Added NDArray support function varargout = gradient (m, varargin) - + if (nargin < 1) print_usage () endif @@ -100,7 +100,7 @@ if (nargin > 2 && nargin != nd + 1) print_usage () endif - + ## cell d stores a spacing vector for each dimension d = cell (1, nd); if (nargin == 1) @@ -137,7 +137,7 @@ mr = rows (m); mc = numel (m) / mr; Y = zeros (size (m), class (m)); - + if (mr > 1) ## Top and bottom boundary. Y(1,:) = diff (m(1:2, :)) / d{i}(1); @@ -186,7 +186,7 @@ num_points = p0_size (1); dim = p0_size (2); endif - + if (length (varargin) == 0) delta = 1; elseif (length (varargin) == 1 || length (varargin) == dim) @@ -198,13 +198,13 @@ else error ("gradient: incorrect number of spacing parameters"); endif - + if (isscalar (delta)) delta = repmat (delta, 1, dim); elseif (!isvector (delta)) error ("gradient: spacing values must be scalars or a vector"); endif - + ## Calculate the gradient p0 = mat2cell (p0, num_points, ones (1, dim)); varargout = cell (1, dim);
--- a/scripts/general/idivide.m +++ b/scripts/general/idivide.m @@ -18,14 +18,14 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} idivide (@var{x}, @var{y}, @var{op}) -## Integer division with different rounding rules. +## Integer division with different rounding rules. ## ## The standard behavior of integer division such as @code{@var{a} ./ @var{b}} -## is to round the result to the nearest integer. This is not always the +## is to round the result to the nearest integer. This is not always the ## desired behavior and @code{idivide} permits integer element-by-element ## division to be performed with different treatment for the fractional ## part of the division as determined by the @var{op} flag. @var{op} is -## a string with one of the values: +## a string with one of the values: ## ## @table @asis ## @item "fix" @@ -44,7 +44,7 @@ ## Calculate @code{@var{a} ./ @var{b}} with the fractional part rounded ## towards positive infinity. ## @end table -## +## ## @noindent ## If @var{op} is not given it defaults to @code{"fix"}. ## An example demonstrating these rounding rules is @@ -99,7 +99,7 @@ endif endif endfunction - + %!shared a, af, b, bf %! a = int8(3); %! af = 3;
--- a/scripts/general/int2str.m +++ b/scripts/general/int2str.m @@ -28,20 +28,20 @@ ## @result{} "123" ## ## s = int2str ([1, 2, 3; 4, 5, 6]) -## @result{} s = +## @result{} s = ## 1 2 3 ## 4 5 6 -## +## ## whos s -## @result{} s = +## @result{} s = ## Attr Name Size Bytes Class -## ==== ==== ==== ===== ===== +## ==== ==== ==== ===== ===== ## s 2x7 14 char ## @end group ## @end example ## ## This function is not very flexible. For better control over the -## results, use @code{sprintf} (@pxref{Formatted Output}). +## results, use @code{sprintf} (@pxref{Formatted Output}). ## @seealso{sprintf, num2str, mat2str} ## @end deftypefn
--- a/scripts/general/interp1.m +++ b/scripts/general/interp1.m @@ -25,7 +25,7 @@ ## @deftypefnx {Function File} {@var{pp} =} interp1 (@dots{}, 'pp') ## ## One-dimensional interpolation. Interpolate @var{y}, defined at the -## points @var{x}, at the points @var{xi}. The sample points @var{x} +## points @var{x}, at the points @var{xi}. The sample points @var{x} ## must be monotonic. If not specified, @var{x} is taken to be the ## indices of @var{y}. If @var{y} is an array, treat the columns ## of @var{y} separately. @@ -151,7 +151,7 @@ if (isvector (y)) y = y(:); elseif (isvector (xi)) - szx = length (xi); + szx = length (xi); endif szy = size (y); y = y(:,:); @@ -249,7 +249,7 @@ yi = bsxfun (@times, s, dy(idx,:)) + y(idx,:); endif case {"pchip", "*pchip"} - if (nx == 2 || starmethod) + if (nx == 2 || starmethod) x = linspace (x(1), x(nx), ny); endif ## Note that pchip's arguments are transposed relative to interp1 @@ -267,7 +267,7 @@ ## FIXME Is there a better way to treat pp return and *cubic if (starmethod && ! pp) - ## From: Miloje Makivic + ## From: Miloje Makivic ## http://www.npac.syr.edu/projects/nasa/MILOJE/final/node36.html t = (xi - x(1))/dx + 1; idx = max (min (floor (t), ny-2), 2); @@ -284,7 +284,7 @@ + c(:,J) .* y(idx-1,:) + d(:,J) .* y(idx+2,:); else if (starmethod) - x = linspace (x(1), x(nx), ny).'; + x = linspace (x(1), x(nx), ny).'; nx = ny; endif @@ -306,8 +306,8 @@ if (pp) xs = [x(1);x(3:nx-2)]; - yi = mkpp ([x(1);x(3:nx-2);x(nx)], - [a(:), (b(:) + 3.*xs(:,J).*a(:)), ... + yi = mkpp ([x(1);x(3:nx-2);x(nx)], + [a(:), (b(:) + 3.*xs(:,J).*a(:)), ... (c(:) + 2.*xs(:,J).*b(:) + 3.*xs(:,J)(:).^2.*a(:)), ... (d(:) + xs(:,J).*c(:) + xs(:,J).^2.*b(:) + ... xs(:,J).^3.*a(:))], szy(2:end)); @@ -317,8 +317,8 @@ endif endif case {"spline", "*spline"} - if (nx == 2 || starmethod) - x = linspace(x(1), x(nx), ny); + if (nx == 2 || starmethod) + x = linspace(x(1), x(nx), ny); endif ## Note that spline's arguments are transposed relative to interp1 if (pp) @@ -401,7 +401,7 @@ ## confirm they are the correct values. %!shared xp, yp, xi, style -%! xp=0:2:10; yp = sin(2*pi*xp/5); +%! xp=0:2:10; yp = sin(2*pi*xp/5); %! xi = [-1, 0, 2.2, 4, 6.6, 10, 11]; @@ -410,7 +410,7 @@ ## The test for ppval of cubic has looser tolerance, but otherwise ## the tests are identical. ## Note that the block checks style and *style; if you add more tests -## before to add them to both sections of each block. One test, +## before to add them to both sections of each block. One test, ## style vs. *style, occurs only in the first section. ## There is an ENDBLOCKTEST after the final block %!test style = "nearest";
--- a/scripts/general/interp2.m +++ b/scripts/general/interp2.m @@ -27,29 +27,29 @@ ## Two-dimensional interpolation. @var{x}, @var{y} and @var{z} describe a ## surface function. If @var{x} and @var{y} are vectors their length ## must correspondent to the size of @var{z}. @var{x} and @var{y} must be -## monotonic. If they are matrices they must have the @code{meshgrid} -## format. +## monotonic. If they are matrices they must have the @code{meshgrid} +## format. ## ## @table @code -## @item interp2 (@var{x}, @var{y}, @var{Z}, @var{xi}, @var{yi}, @dots{}) +## @item interp2 (@var{x}, @var{y}, @var{Z}, @var{xi}, @var{yi}, @dots{}) ## Returns a matrix corresponding to the points described by the -## matrices @var{xi}, @var{yi}. +## matrices @var{xi}, @var{yi}. ## ## If the last argument is a string, the interpolation method can ## be specified. The method can be 'linear', 'nearest' or 'cubic'. ## If it is omitted 'linear' interpolation is assumed. ## ## @item interp2 (@var{z}, @var{xi}, @var{yi}) -## Assumes @code{@var{x} = 1:rows (@var{z})} and @code{@var{y} = +## Assumes @code{@var{x} = 1:rows (@var{z})} and @code{@var{y} = ## 1:columns (@var{z})} -## -## @item interp2 (@var{z}, @var{n}) +## +## @item interp2 (@var{z}, @var{n}) ## Interleaves the matrix @var{z} n-times. If @var{n} is omitted a value ## of @code{@var{n} = 1} is assumed. ## @end table ## ## The variable @var{method} defines the method to use for the -## interpolation. It can take one of the following values +## interpolation. It can take one of the following values ## ## @table @asis ## @item 'nearest' @@ -70,15 +70,15 @@ ## @end table ## ## If a scalar value @var{extrapval} is defined as the final value, then -## values outside the mesh as set to this value. Note that in this case +## values outside the mesh as set to this value. Note that in this case ## @var{method} must be defined as well. If @var{extrapval} is not -## defined then NA is assumed. +## defined then NA is assumed. ## ## @seealso{interp1} ## @end deftypefn ## Author: Kai Habel <kai.habel@gmx.de> -## 2005-03-02 Thomas Weber <weber@num.uni-sb.de> +## 2005-03-02 Thomas Weber <weber@num.uni-sb.de> ## * Add test cases ## 2005-03-02 Paul Kienzle <pkienzle@users.sf.net> ## * Simplify @@ -125,7 +125,7 @@ else [X, Y, Z, XI, YI] = deal (varargin{:}); endif - case 6 + case 6 [X, Y, Z, XI, YI, method] = deal (varargin{:}); case 7 [X, Y, Z, XI, YI, method, extrapval] = deal (varargin{:}); @@ -135,13 +135,13 @@ ## Type checking. if (!ismatrix (Z)) - error ("interp2: Z must be a matrix"); + error ("interp2: Z must be a matrix"); endif if (!isempty (n) && !isscalar (n)) - error ("interp2: N must be a scalar"); + error ("interp2: N must be a scalar"); endif if (!ischar (method)) - error ("interp2: METHOD must be a string"); + error ("interp2: METHOD must be a string"); endif if (ischar (extrapval) || strcmp (extrapval, "extrap")) extrapval = []; @@ -152,19 +152,19 @@ ## Define X, Y, XI, YI if needed [zr, zc] = size (Z); if (isempty (X)) - X = 1:zc; + X = 1:zc; Y = 1:zr; endif if (! isnumeric (X) || ! isnumeric (Y)) - error ("interp2: X, Y must be numeric matrices"); + error ("interp2: X, Y must be numeric matrices"); endif if (! isempty (n)) - p = 2^n; - XI = (p:p*zc)/p; - YI = (p:p*zr)'/p; + p = 2^n; + XI = (p:p*zc)/p; + YI = (p:p*zr)'/p; endif if (! isnumeric (XI) || ! isnumeric (YI)) - error ("interp2: XI, YI must be numeric"); + error ("interp2: XI, YI must be numeric"); endif @@ -251,7 +251,7 @@ DY = __pchip_deriv__ (Y, Z, 1); ## Compute mixed derivatives row-wise and column-wise, use the average. DXY = (__pchip_deriv__ (X, DY, 2) + __pchip_deriv__ (Y, DX, 1))/2; - + ## do the bicubic interpolation hx = diff (X); hx = hx(xidx); hy = diff (Y); hy = hy(yidx); @@ -352,14 +352,14 @@ elseif (isgriddata (X) && isgriddata (Y')) ## Allocate output ZI = zeros (size (X)); - + ## Find inliers inside = !(XI < X (1) | XI > X (end) | YI < Y (1) | YI > Y (end)); - + ## Scale XI and YI to match indices of Z XI = (columns (Z) - 1) * (XI - X (1)) / (X (end) - X (1)) + 1; YI = (rows (Z) - 1) * (YI - Y (1)) / (Y (end) - Y (1)) + 1; - + ## Start the real work K = floor (XI); L = floor (YI); @@ -393,14 +393,14 @@ + AY1 .* AX0 .* Z (sym_sub2ind (sz, L-1, K)) ... + AY1 .* AX1 .* Z (sym_sub2ind (sz, L-1, K-1)); ZI (!inside) = extrapval; - + else error ("interp2: input data must have `meshgrid' format"); endif elseif (strcmp (method, "spline")) if (isgriddata (XI) && isgriddata (YI')) - ZI = __splinen__ ({Y(:,1).', X(1,:)}, Z, {YI(:,1), XI(1,:)}, extrapval, + ZI = __splinen__ ({Y(:,1).', X(1,:)}, Z, {YI(:,1), XI(1,:)}, extrapval, "spline"); else error ("interp2: input data must have `meshgrid' format"); @@ -449,7 +449,7 @@ %! xi=linspace(min(x),max(x),17); %! yi=linspace(min(y),max(y),26)'; %! mesh(xi,yi,interp2(x,y,A,xi,yi,'linear')); -%! [x,y] = meshgrid(x,y); +%! [x,y] = meshgrid(x,y); %! hold on; plot3(x(:),y(:),A(:),"b*"); hold off; %!demo @@ -458,7 +458,7 @@ %! xi=linspace(min(x),max(x),41); %! yi=linspace(min(y),max(y),41)'; %! mesh(xi,yi,interp2(x,y,A,xi,yi,'linear')); -%! [x,y] = meshgrid(x,y); +%! [x,y] = meshgrid(x,y); %! hold on; plot3(x(:),y(:),A(:),"b*"); hold off; %!demo @@ -467,7 +467,7 @@ %! xi=linspace(min(x),max(x),17); %! yi=linspace(min(y),max(y),26)'; %! mesh(xi,yi,interp2(x,y,A,xi,yi,'nearest')); -%! [x,y] = meshgrid(x,y); +%! [x,y] = meshgrid(x,y); %! hold on; plot3(x(:),y(:),A(:),"b*"); hold off; %!demo @@ -476,7 +476,7 @@ %! xi=linspace(min(x),max(x),41); %! yi=linspace(min(y),max(y),41)'; %! mesh(xi,yi,interp2(x,y,A,xi,yi,'nearest')); -%! [x,y] = meshgrid(x,y); +%! [x,y] = meshgrid(x,y); %! hold on; plot3(x(:),y(:),A(:),"b*"); hold off; %!demo @@ -485,7 +485,7 @@ %! xi=linspace(min(x),max(x),17); %! yi=linspace(min(y),max(y),26)'; %! mesh(xi,yi,interp2(x,y,A,xi,yi,'pchip')); -%! [x,y] = meshgrid(x,y); +%! [x,y] = meshgrid(x,y); %! hold on; plot3(x(:),y(:),A(:),"b*"); hold off; %!demo @@ -494,7 +494,7 @@ %! xi=linspace(min(x),max(x),41); %! yi=linspace(min(y),max(y),41)'; %! mesh(xi,yi,interp2(x,y,A,xi,yi,'pchip')); -%! [x,y] = meshgrid(x,y); +%! [x,y] = meshgrid(x,y); %! hold on; plot3(x(:),y(:),A(:),"b*"); hold off; %!demo @@ -503,7 +503,7 @@ %! xi=linspace(min(x),max(x),17); %! yi=linspace(min(y),max(y),26)'; %! mesh(xi,yi,interp2(x,y,A,xi,yi,'cubic')); -%! [x,y] = meshgrid(x,y); +%! [x,y] = meshgrid(x,y); %! hold on; plot3(x(:),y(:),A(:),"b*"); hold off; %!demo @@ -512,7 +512,7 @@ %! xi=linspace(min(x),max(x),41); %! yi=linspace(min(y),max(y),41)'; %! mesh(xi,yi,interp2(x,y,A,xi,yi,'cubic')); -%! [x,y] = meshgrid(x,y); +%! [x,y] = meshgrid(x,y); %! hold on; plot3(x(:),y(:),A(:),"b*"); hold off; %!demo @@ -521,7 +521,7 @@ %! xi=linspace(min(x),max(x),17); %! yi=linspace(min(y),max(y),26)'; %! mesh(xi,yi,interp2(x,y,A,xi,yi,'spline')); -%! [x,y] = meshgrid(x,y); +%! [x,y] = meshgrid(x,y); %! hold on; plot3(x(:),y(:),A(:),"b*"); hold off; %!demo @@ -530,7 +530,7 @@ %! xi=linspace(min(x),max(x),41); %! yi=linspace(min(y),max(y),41)'; %! mesh(xi,yi,interp2(x,y,A,xi,yi,'spline')); -%! [x,y] = meshgrid(x,y); +%! [x,y] = meshgrid(x,y); %! hold on; plot3(x(:),y(:),A(:),"b*"); hold off; %!test % simple test @@ -557,7 +557,7 @@ %! xi = [1:0.25:3]; yi = [4:0.25:7]'; %! Expected = interp2(x,y,Orig, xi, yi); %! Result = interp2(Orig,2); -%! +%! %! assert(Result, Expected, 10*eps); %!test % matrix slice @@ -580,7 +580,7 @@ %!test % for values at boundaries %! A=[1,2;3,4]; -%! x=[0,1]; +%! x=[0,1]; %! y=[2,3]'; %! assert(interp2(x,y,A,x,y,'linear'), A); %! assert(interp2(x,y,A,x,y,'nearest'), A);
--- a/scripts/general/interp3.m +++ b/scripts/general/interp3.m @@ -24,19 +24,19 @@ ## @deftypefnx {Function File} {@var{vi} =} interp3 (@dots{}, @var{method}) ## @deftypefnx {Function File} {@var{vi} =} interp3 (@dots{}, @var{method}, @var{extrapval}) ## -## Perform 3-dimensional interpolation. Each element of the 3-dimensional -## array @var{v} represents a value at a location given by the parameters -## @var{x}, @var{y}, and @var{z}. The parameters @var{x}, @var{x}, and -## @var{z} are either 3-dimensional arrays of the same size as the array -## @var{v} in the 'meshgrid' format or vectors. The parameters @var{xi}, etc. -## respect a similar format to @var{x}, etc., and they represent the points +## Perform 3-dimensional interpolation. Each element of the 3-dimensional +## array @var{v} represents a value at a location given by the parameters +## @var{x}, @var{y}, and @var{z}. The parameters @var{x}, @var{x}, and +## @var{z} are either 3-dimensional arrays of the same size as the array +## @var{v} in the 'meshgrid' format or vectors. The parameters @var{xi}, etc. +## respect a similar format to @var{x}, etc., and they represent the points ## at which the array @var{vi} is interpolated. ## -## If @var{x}, @var{y}, @var{z} are omitted, they are assumed to be +## If @var{x}, @var{y}, @var{z} are omitted, they are assumed to be ## @code{x = 1 : size (@var{v}, 2)}, @code{y = 1 : size (@var{v}, 1)} and ## @code{z = 1 : size (@var{v}, 3)}. If @var{m} is specified, then -## the interpolation adds a point half way between each of the interpolation -## points. This process is performed @var{m} times. If only @var{v} is +## the interpolation adds a point half way between each of the interpolation +## points. This process is performed @var{m} times. If only @var{v} is ## specified, then @var{m} is assumed to be @code{1}. ## ## Method is one of:
--- a/scripts/general/interpft.m +++ b/scripts/general/interpft.m @@ -36,7 +36,7 @@ ## 2001-02-11 ## * initial version ## 2002-03-17 aadler -## * added code to work on matrices as well +## * added code to work on matrices as well ## 2006-05-25 dbateman ## * Make it matlab compatiable, cutting out the 2-D interpolation
--- a/scripts/general/interpn.m +++ b/scripts/general/interpn.m @@ -24,19 +24,19 @@ ## @deftypefnx {Function File} {@var{vi} =} interpn (@dots{}, @var{method}) ## @deftypefnx {Function File} {@var{vi} =} interpn (@dots{}, @var{method}, @var{extrapval}) ## -## Perform @var{n}-dimensional interpolation, where @var{n} is at least two. -## Each element of the @var{n}-dimensional array @var{v} represents a value -## at a location given by the parameters @var{x1}, @var{x2}, @dots{}, @var{xn}. -## The parameters @var{x1}, @var{x2}, @dots{}, @var{xn} are either -## @var{n}-dimensional arrays of the same size as the array @var{v} in -## the 'ndgrid' format or vectors. The parameters @var{y1}, etc. respect a +## Perform @var{n}-dimensional interpolation, where @var{n} is at least two. +## Each element of the @var{n}-dimensional array @var{v} represents a value +## at a location given by the parameters @var{x1}, @var{x2}, @dots{}, @var{xn}. +## The parameters @var{x1}, @var{x2}, @dots{}, @var{xn} are either +## @var{n}-dimensional arrays of the same size as the array @var{v} in +## the 'ndgrid' format or vectors. The parameters @var{y1}, etc. respect a ## similar format to @var{x1}, etc., and they represent the points at which ## the array @var{vi} is interpolated. ## -## If @var{x1}, @dots{}, @var{xn} are omitted, they are assumed to be +## If @var{x1}, @dots{}, @var{xn} are omitted, they are assumed to be ## @code{x1 = 1 : size (@var{v}, 1)}, etc. If @var{m} is specified, then -## the interpolation adds a point half way between each of the interpolation -## points. This process is performed @var{m} times. If only @var{v} is +## the interpolation adds a point half way between each of the interpolation +## points. This process is performed @var{m} times. If only @var{v} is ## specified, then @var{m} is assumed to be @code{1}. ## ## Method is one of: @@ -112,7 +112,7 @@ for i = 1 : nd; x{i} = 1 : sz(i); endfor - elseif (rem (nargs, 2) == 1 && nargs == + elseif (rem (nargs, 2) == 1 && nargs == (2 * ndims (varargin{ceil (nargs / 2)})) + 1) nv = ceil (nargs / 2); v = varargin{nv}; @@ -167,7 +167,7 @@ idx |= y{i} < min (x{i}(:)) | y{i} > max (x{i}(:)); endfor vi(idx) = extrapval; - vi = reshape (vi, yshape); + vi = reshape (vi, yshape); elseif (strcmp (method, "spline")) if (any (! cellfun (@isvector, y))) for i = 2 : nd @@ -196,7 +196,7 @@ vi = vi (cellfun (@(x) sub2ind (size(vi), x{:}), idx)); vi = reshape (vi, size(y{1})); endif - elseif (strcmp (method, "cubic")) + elseif (strcmp (method, "cubic")) error ("interpn: cubic interpolation not yet implemented"); else error ("interpn: unrecognized interpolation METHOD"); @@ -210,7 +210,7 @@ %! xi=linspace(min(x),max(x),17); %! yi=linspace(min(y),max(y),26)'; %! mesh(xi,yi,interpn(x,y,A.',xi,yi,"linear").'); -%! [x,y] = meshgrid(x,y); +%! [x,y] = meshgrid(x,y); %! hold on; plot3(x(:),y(:),A(:),"b*"); hold off; %!demo @@ -219,7 +219,7 @@ %! xi=linspace(min(x),max(x),17); %! yi=linspace(min(y),max(y),26)'; %! mesh(xi,yi,interpn(x,y,A.',xi,yi,"nearest").'); -%! [x,y] = meshgrid(x,y); +%! [x,y] = meshgrid(x,y); %! hold on; plot3(x(:),y(:),A(:),"b*"); hold off; %!#demo @@ -228,7 +228,7 @@ %! xi=linspace(min(x),max(x),17); %! yi=linspace(min(y),max(y),26)'; %! mesh(xi,yi,interpn(x,y,A.',xi,yi,"cubic").'); -%! [x,y] = meshgrid(x,y); +%! [x,y] = meshgrid(x,y); %! hold on; plot3(x(:),y(:),A(:),"b*"); hold off; %!demo @@ -237,7 +237,7 @@ %! xi=linspace(min(x),max(x),17); %! yi=linspace(min(y),max(y),26)'; %! mesh(xi,yi,interpn(x,y,A.',xi,yi,"spline").'); -%! [x,y] = meshgrid(x,y); +%! [x,y] = meshgrid(x,y); %! hold on; plot3(x(:),y(:),A(:),"b*"); hold off;
--- a/scripts/general/isdir.m +++ b/scripts/general/isdir.m @@ -1,4 +1,4 @@ -## Copyright (C) 2004-2011 Alois Schloegl +## Copyright (C) 2004-2011 Alois Schloegl ## ## This file is part of Octave. ##
--- a/scripts/general/loadobj.m +++ b/scripts/general/loadobj.m @@ -18,8 +18,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{b} =} loadobj (@var{a}) -## Method of a class to manipulate an object after loading it from a file. -## The function @code{loadobj} is called when the object @var{a} is loaded +## Method of a class to manipulate an object after loading it from a file. +## The function @code{loadobj} is called when the object @var{a} is loaded ## using the @code{load} function. An example of the use of @code{saveobj} ## might be to add fields to an object that don't make sense to be saved. ## For example:
--- a/scripts/general/logspace.m +++ b/scripts/general/logspace.m @@ -53,7 +53,7 @@ ## function. ## If @var{n} is unspecified it defaults to 50. ## -## Also for compatibility with @sc{matlab}, return the second argument if +## Also for compatibility with @sc{matlab}, return the second argument if ## fewer than two values are requested. ## @seealso{linspace} ## @end deftypefn
--- a/scripts/general/num2str.m +++ b/scripts/general/num2str.m @@ -25,7 +25,7 @@ ## digits (@var{precision}) to be used in the output or a format ## template string (@var{format}) as in @code{sprintf} (@pxref{Formatted ## Output}). @code{num2str} can also handle complex numbers. For -## example: +## example: ## ## @example ## @group @@ -42,7 +42,7 @@ ## whos s ## @result{} ## Attr Name Size Bytes Class -## ==== ==== ==== ===== ===== +## ==== ==== ==== ===== ===== ## s 2x8 16 char ## ## num2str (1.234 + 27.3i) @@ -51,10 +51,10 @@ ## @end example ## ## The @code{num2str} function is not very flexible. For better control -## over the results, use @code{sprintf} (@pxref{Formatted Output}). +## over the results, use @code{sprintf} (@pxref{Formatted Output}). ## Note that for complex @var{x}, the format string may only contain one ## output conversion specification and nothing else. Otherwise, you -## will get unpredictable results. +## will get unpredictable results. ## @seealso{sprintf, int2str, mat2str} ## @end deftypefn @@ -91,7 +91,7 @@ max (abs (imag (x(:))))))) + 2; endif dgt2 = dgt1 - (min (real (x(:))) >= 0); - + if (length (abs (x) == x) > 0) fmt = sprintf("%%%dg%%+-%dgi ", dgt2, dgt1); else
--- a/scripts/general/pol2cart.m +++ b/scripts/general/pol2cart.m @@ -27,10 +27,10 @@ ## @var{theta}, @var{r}, (and @var{z}) must be the same shape, or scalar. ## @var{theta} describes the angle relative to the positive x-axis. ## @var{r} is the distance to the z-axis (0, 0, z). -## If called with a single matrix argument then each row of @var{p} +## If called with a single matrix argument then each row of @var{p} ## represents the polar/(cylindrical) coordinate (@var{x}, @var{y} (, @var{z})). ## -## If only a single return argument is requested then return a matrix +## If only a single return argument is requested then return a matrix ## @var{C} where each row represents one Cartesian coordinate ## (@var{x}, @var{y} (, @var{z})). ## @seealso{cart2pol, sph2cart, cart2sph} @@ -53,7 +53,7 @@ z = []; endif r = theta(:,2); - theta = theta(:,1); + theta = theta(:,1); else error ("pol2car: matrix input must have 2 or 3 columns [THETA, R (, Z)]"); endif
--- a/scripts/general/polyarea.m +++ b/scripts/general/polyarea.m @@ -33,14 +33,14 @@ ## todo: Add moments for centroid, etc. ## -## bugs and limitations: +## bugs and limitations: ## Probably ought to be an optional check to make sure that -## traversing the vertices doesn't make any sides cross -## (Is simple closed curve the technical definition of this?). +## traversing the vertices doesn't make any sides cross +## (Is simple closed curve the technical definition of this?). ## Author: David M. Doolin <doolin@ce.berkeley.edu> ## Date: 1999-04-14 -## Modified-by: +## Modified-by: ## 2000-01-15 Paul Kienzle <pkienzle@kienzle.powernet.co.uk> ## * use matlab compatible interface ## * return absolute value of area so traversal order doesn't matter
--- a/scripts/general/quadgk.m +++ b/scripts/general/quadgk.m @@ -190,7 +190,7 @@ elseif (isinf (a) && isinf(b)) ## Standard Infinite to finite integral transformation. ## \int_{-\infinity_^\infinity f(x) dx = \int_-1^1 f (g(t)) g'(t) dt - ## where + ## where ## g(t) = t / (1 - t^2) ## g'(t) = (1 + t^2) / (1 - t^2) ^ 2 ## waypoint transform is then @@ -199,7 +199,7 @@ trans = @(x) (2 * x) ./ (1 + sqrt(1 + 4 * x .^ 2)); subs = [-1; trans(waypoints); 1]; else - subs = linspace (-1, 1, 11)'; + subs = linspace (-1, 1, 11)'; endif h = 2; h0 = b - a; @@ -209,12 +209,12 @@ ## Formula defined in Shampine paper as two separate steps. One to ## weaken singularity at finite end, then a second to transform to ## a finite interval. The singularity weakening transform is - ## \int_{-\infinity}^b f(x) dx = + ## \int_{-\infinity}^b f(x) dx = ## - \int_{-\infinity}^0 f (b - t^2) 2 t dt ## (note minus sign) and the finite interval transform is - ## \int_{-\infinity}^0 f(b - t^2) 2 t dt = + ## \int_{-\infinity}^0 f(b - t^2) 2 t dt = ## \int_{-1}^0 f (b - g(s) ^ 2) 2 g(s) g'(s) ds - ## where + ## where ## g(s) = s / (1 + s) ## g'(s) = 1 / (1 + s) ^ 2 ## waypoint transform is then @@ -225,7 +225,7 @@ trans = @(x) - x ./ (x + 1); subs = [0; trans(tmp); 1]; else - subs = linspace (0, 1, 11)'; + subs = linspace (0, 1, 11)'; endif h = 1; h0 = b - a; @@ -237,9 +237,9 @@ ## a finite interval. The singularity weakening transform is ## \int_a^\infinity f(x) dx = \int_0^\infinity f (a + t^2) 2 t dt ## and the finite interval transform is - ## \int_0^\infinity f(a + t^2) 2 t dt = + ## \int_0^\infinity f(a + t^2) 2 t dt = ## \int_0^1 f (a + g(s) ^ 2) 2 g(s) g'(s) ds - ## where + ## where ## g(s) = s / (1 - s) ## g'(s) = 1 / (1 - s) ^ 2 ## waypoint transform is then @@ -250,7 +250,7 @@ trans = @(x) x ./ (x + 1); subs = [0; trans(tmp); 1]; else - subs = linspace (0, 1, 11)'; + subs = linspace (0, 1, 11)'; endif h = 1; h0 = b - a; @@ -272,7 +272,7 @@ trans = @__quadgk_finite_waypoint__; subs = [-1; trans(waypoints, a, b); 1]; else - subs = linspace(-1, 1, 11)'; + subs = linspace(-1, 1, 11)'; endif h = 2; h0 = b - a; @@ -298,7 +298,7 @@ [q_subs, q_errs] = __quadgk_eval__ (f, subs); q0 = sum (q_subs); err0 = sum (q_errs); - + if (isa (a, "single") || isa (b, "single") || isa (waypoints, "single")) myeps = eps ("single"); else @@ -318,7 +318,7 @@ ## Quit if any evaluations are not finite (Inf or NaN) if (any (! isfinite (q_subs))) - warning ("quadgk: non finite integrand encountered"); + warning ("quadgk: non finite integrand encountered"); q = q0; err = err0; break; @@ -377,7 +377,7 @@ warning ("quadgk: Error tolerance not met. Estimated error %g", err); endif unwind_protect_cleanup - if (strcmp (warn_state.state, "on")) + if (strcmp (warn_state.state, "on")) warning ("on", "Octave:divide-by-zero"); endif end_unwind_protect
--- a/scripts/general/quadl.m +++ b/scripts/general/quadl.m @@ -31,14 +31,14 @@ ## ## If defined, @var{tol} defines the relative tolerance to which to ## which to integrate @code{@var{f}(@var{x})}. While if @var{trace} is -## defined, displays the left end point of the current interval, the +## defined, displays the left end point of the current interval, the ## interval length, and the partial integral. ## ## Additional arguments @var{p1}, etc., are passed directly to @var{f}. ## To use default values for @var{tol} and @var{trace}, one may pass ## empty matrices. ## -## Reference: W. Gander and W. Gautschi, @cite{Adaptive Quadrature - +## Reference: W. Gander and W. Gautschi, @cite{Adaptive Quadrature - ## Revisited}, BIT Vol. 40, No. 1, March 2000, pp. 84--101. ## @url{http://www.inf.ethz.ch/personal/gander/} ## @seealso{quad,quadv,quadgk,quadcc,trapz,dblquad,triplequad} @@ -58,10 +58,10 @@ function Q = quadl (f, a, b, tol, trace, varargin) need_warning (1); if (nargin < 4) - tol = []; + tol = []; endif if (nargin < 5) - trace = []; + trace = []; endif if (isa (a, "single") || isa (b, "single")) myeps = eps ("single"); @@ -69,21 +69,21 @@ myeps = eps; endif if (isempty (tol)) - tol = myeps; + tol = myeps; endif if (isempty (trace)) - trace = 0; + trace = 0; endif if (tol < myeps) tol = myeps; endif - m = (a+b)/2; + m = (a+b)/2; h = (b-a)/2; - alpha = sqrt(2/3); + alpha = sqrt(2/3); beta = 1/sqrt(5); - x1 = .942882415695480; + x1 = .942882415695480; x2 = .641853342345781; x3 = .236383199662150; @@ -92,7 +92,7 @@ y = feval (f, x, varargin{:}); - fa = y(1); + fa = y(1); fb = y(13); i2 = (h/6)*(y(1) + y(13) + 5*(y(5)+y(9))); @@ -110,19 +110,19 @@ + .224926465333340*(y(6)+y(8)) + .242611071901408*y(7)); - s = sign(is); + s = sign(is); if (s == 0) s = 1; endif erri1 = abs(i1-is); erri2 = abs(i2-is); - R = 1; + R = 1; if (erri2 != 0) - R = erri1/erri2; + R = erri1/erri2; endif if (R > 0 && R < 1) - tol = tol/R; + tol = tol/R; endif is = s*abs(is)*tol/myeps; if (is == 0) @@ -142,20 +142,20 @@ ## Walter Gautschi, 08/03/98 function Q = adaptlobstp (f, a, b, fa, fb, is, trace, varargin) - h = (b-a)/2; + h = (b-a)/2; m = (a+b)/2; - alpha = sqrt(2/3); + alpha = sqrt(2/3); beta = 1/sqrt(5); - mll = m-alpha*h; - ml = m-beta*h; - mr = m+beta*h; + mll = m-alpha*h; + ml = m-beta*h; + mr = m+beta*h; mrr = m+alpha*h; x = [mll, ml, m, mr, mrr]; y = feval(f, x, varargin{:}); - fmll = y(1); - fml = y(2); - fm = y(3); - fmr = y(4); + fmll = y(1); + fml = y(2); + fm = y(3); + fmr = y(4); fmrr = y(5); i2 = (h/6)*(fa + fb + 5*(fml+fmr)); i1 = (h/1470)*(77*(fa+fb) + 432*(fmll+fmrr) + 625*(fml+fmr) + 672*fm); @@ -183,7 +183,7 @@ persistent w = []; if (nargin == 0) r = w; - else - w = v; + else + w = v; endif endfunction
--- a/scripts/general/quadv.m +++ b/scripts/general/quadv.m @@ -23,13 +23,13 @@ ## @deftypefnx {Function File} {@var{q} =} quadv (@var{f}, @var{a}, @var{b}, @var{tol}, @var{trace}, @var{p1}, @var{p2}, @dots{}) ## @deftypefnx {Function File} {[@var{q}, @var{fcnt}] =} quadv (@dots{}) ## -## Numerically evaluate the integral of @var{f} from @var{a} to @var{b} +## Numerically evaluate the integral of @var{f} from @var{a} to @var{b} ## using adaptive Simpson's rule. ## @var{f} is either a function handle, inline function or string -## containing the name of the function to evaluate. +## containing the name of the function to evaluate. ## The function defined by @var{f} may be a scalar, vector or array-valued. ## -## If a value for @var{tol} is given, it defines the tolerance used to stop +## If a value for @var{tol} is given, it defines the tolerance used to stop ## the adaptation procedure, otherwise the default value of 1e-6 is used. ## ## The algorithm used by @code{quadv}, involves recursively subdividing the @@ -51,10 +51,10 @@ print_usage (); endif if (nargin < 4) - tol = []; + tol = []; endif if (nargin < 5) - trace = []; + trace = []; endif if (isa (a, "single") || isa (b, "single")) myeps = eps ("single"); @@ -62,10 +62,10 @@ myeps = eps; endif if (isempty (tol)) - tol = 1e-6; + tol = 1e-6; endif if (isempty (trace)) - trace = 0; + trace = 0; endif ## Split the interval into 3 abscissa, and apply a 3 point Simpson's rule @@ -86,8 +86,8 @@ h = (b - a); q = (b - a) / 6 * (fa + 4 * fc + fb); - - [q, fcnt, hmin] = simpsonstp (f, a, b, c, fa, fb, fc, q, fcnt, abs (h), + + [q, fcnt, hmin] = simpsonstp (f, a, b, c, fa, fb, fc, q, fcnt, abs (h), tol, trace, varargin{:}); if (fcnt > 10000) @@ -99,7 +99,7 @@ endif endfunction -function [q, fcnt, hmin] = simpsonstp (f, a, b, c, fa, fb, fc, q0, +function [q, fcnt, hmin] = simpsonstp (f, a, b, c, fa, fb, fc, q0, fcnt, hmin, tol, trace, varargin) if (fcnt > 10000) q = q0;
--- a/scripts/general/randi.m +++ b/scripts/general/randi.m @@ -22,12 +22,12 @@ ## @deftypefnx {Function File} {} randi (@var{imax}, @var{m}, @var{n}, @dots{}) ## @deftypefnx {Function File} {} randi ([@var{imin}, @var{imax}], @dots{}) ## @deftypefnx {Function File} {} randi (@dots{}, "@var{class}") -## Return random integers in the range 1:@var{imax}. +## Return random integers in the range 1:@var{imax}. ## ## Additional arguments determine the shape of the return matrix. When no ## arguments are specified a single random integer is returned. If one ## argument @var{n} is specified then a square matrix @w{(@var{n} x @var{n})} is -## returned. Two or more arguments will return a multi-dimensional +## returned. Two or more arguments will return a multi-dimensional ## matrix @w{(@var{m} x @var{n} x @dots{})}. ## ## The integer range may optionally be described by a two element matrix @@ -45,7 +45,7 @@ ## ## Implementation Note: @code{randi} relies internally on @code{rand} which ## uses class "double" to represent numbers. This limits the maximum -## integer (@var{imax}) and range (@var{imax} - @var{imin}) to the value +## integer (@var{imax}) and range (@var{imax} - @var{imin}) to the value ## returned by the @code{bitmax} function. For IEEE floating point numbers ## this value is @w{@code{2^53 - 1}}. ## @@ -69,15 +69,15 @@ imax = fix (bounds); if (imax < 1) error ("randi: require IMAX >= 1"); - endif + endif else imin = fix (bounds(1)); imax = fix (bounds(2)); if (imax < imin) error ("randi: require IMIN <= IMAX"); - endif + endif endif - + if (nargin > 1 && ischar (varargin{end})) rclass = varargin{end}; varargin(end) = []; @@ -95,7 +95,7 @@ endif endif ## Limit set by use of class double in rand() - if (imax > bitmax) + if (imax > bitmax) error ("randi: maximum integer IMAX must be smaller than bitmax ()"); endif if ((imax - imin) > bitmax)
--- a/scripts/general/rat.m +++ b/scripts/general/rat.m @@ -26,7 +26,7 @@ ## @example ## @group ## rat(pi) = 3 + 1/(7 + 1/16) = 355/113 -## rat(e) = 3 + 1/(-4 + 1/(2 + 1/(5 + 1/(-2 + 1/(-7))))) +## rat(e) = 3 + 1/(-4 + 1/(2 + 1/(5 + 1/(-2 + 1/(-7))))) ## = 1457/536 ## @end group ## @end example
--- a/scripts/general/repmat.m +++ b/scripts/general/repmat.m @@ -22,7 +22,7 @@ ## @deftypefnx {Function File} {} repmat (@var{A}, [@var{m} @var{n}]) ## @deftypefnx {Function File} {} repmat (@var{A}, [@var{m} @var{n} @var{p} @dots{}]) ## Form a block matrix of size @var{m} by @var{n}, with a copy of matrix -## @var{A} as each element. If @var{n} is not specified, form an +## @var{A} as each element. If @var{n} is not specified, form an ## @var{m} by @var{m} block matrix. ## @seealso{repelems} ## @end deftypefn @@ -41,7 +41,7 @@ error ("repmat: with 3 arguments M and N must be scalar"); endif idx = [m, n]; - else + else if (isscalar (m)) idx = [m, m]; n = m; @@ -52,7 +52,7 @@ error ("repmat: invalid dimensional argument"); endif endif - + if (all (idx < 0)) error ("repmat: invalid dimensions"); else
--- a/scripts/general/rot90.m +++ b/scripts/general/rot90.m @@ -44,7 +44,7 @@ ## @end group ## @end example ## -## Due to the difficulty of defining an axis about which to rotate the +## Due to the difficulty of defining an axis about which to rotate the ## matrix @code{rot90} only work with 2-D arrays. To rotate N-d arrays ## use @code{rotdim} instead. ## @seealso{rotdim, flipud, fliplr, flipdim} @@ -95,7 +95,7 @@ %! x2 = [2, 4; 1, 3]; %! x3 = [4, 3; 2, 1]; %! x4 = [3, 1; 4, 2]; -%! +%! %! assert(rot90 (x1) == x2); %! assert(rot90 (x1, 2) == x3); %! assert(rot90 (x1, 3) == x4);
--- a/scripts/general/rotdim.m +++ b/scripts/general/rotdim.m @@ -52,7 +52,7 @@ ## @end deftypefn function y = rotdim (x, n, plane) - + if (nargin < 1 || nargin > 3) print_usage (); endif
--- a/scripts/general/saveobj.m +++ b/scripts/general/saveobj.m @@ -18,8 +18,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{b} =} saveobj (@var{a}) -## Method of a class to manipulate an object prior to saving it to a file. -## The function @code{saveobj} is called when the object @var{a} is saved +## Method of a class to manipulate an object prior to saving it to a file. +## The function @code{saveobj} is called when the object @var{a} is saved ## using the @code{save} function. An example of the use of @code{saveobj} ## might be to remove fields of the object that don't make sense to be saved ## or it might be used to ensure that certain fields of the object are
--- a/scripts/general/shift.m +++ b/scripts/general/shift.m @@ -23,7 +23,7 @@ ## the elements of @var{x}. ## ## If @var{x} is a matrix, do the same for each column of @var{x}. -## If the optional @var{dim} argument is given, operate along this +## If the optional @var{dim} argument is given, operate along this ## dimension. ## @end deftypefn @@ -82,10 +82,10 @@ %! a = [1, 2, 3]; %! b = [4, 5, 6]; %! c = [7, 8, 9]; -%! +%! %! r = [a, b, c]; %! m = [a; b; c]; -%! +%! %! assert((shift (r, 3) == [c, a, b] %! && shift (r, -6) == [c, a, b] %! && shift (r, -3) == [b, c, a]
--- a/scripts/general/sortrows.m +++ b/scripts/general/sortrows.m @@ -21,8 +21,8 @@ ## @deftypefn {Function File} {} sortrows (@var{A}, @var{c}) ## Sort the rows of the matrix @var{A} according to the order of the ## columns specified in @var{c}. If @var{c} is omitted, a -## lexicographical sort is used. By default ascending order is used -## however if elements of @var{c} are negative then the corresponding +## lexicographical sort is used. By default ascending order is used +## however if elements of @var{c} are negative then the corresponding ## column is sorted in descending order. ## @end deftypefn
--- a/scripts/general/sph2cart.m +++ b/scripts/general/sph2cart.m @@ -26,9 +26,9 @@ ## @var{phi} is the angle relative to the xy-plane. ## @var{r} is the distance to the origin @w{(0, 0, 0)}. ## @var{theta}, @var{phi}, and @var{r} must be the same shape, or scalar. -## If called with a single matrix argument then each row of @var{s} +## If called with a single matrix argument then each row of @var{s} ## represents the spherical coordinate (@var{theta}, @var{phi}, @var{r}). -## +## ## If only a single return argument is requested then return a matrix ## @var{C} where each row represents one Cartesian coordinate ## (@var{x}, @var{y}, @var{z}). @@ -46,9 +46,9 @@ if (nargin == 1) if (ismatrix (theta) && columns (theta) == 3) - r = theta(:,3); - phi = theta(:,2); - theta = theta(:,1); + r = theta(:,3); + phi = theta(:,2); + theta = theta(:,1); else error ("sph2cart: matrix input must have 3 columns [THETA, PHI, R]"); endif
--- a/scripts/general/structfun.m +++ b/scripts/general/structfun.m @@ -22,15 +22,15 @@ ## @deftypefnx {Function File} {[@var{A}, @dots{}] =} structfun (@dots{}) ## @deftypefnx {Function File} {} structfun (@dots{}, "ErrorHandler", @var{errfunc}) ## @deftypefnx {Function File} {} structfun (@dots{}, "UniformOutput", @var{val}) -## +## ## Evaluate the function named @var{name} on the fields of the structure ## @var{S}. The fields of @var{S} are passed to the function @var{func} ## individually. ## -## @code{structfun} accepts an arbitrary function @var{func} in the form of -## an inline function, function handle, or the name of a function (in a -## character string). In the case of a character string argument, the -## function must accept a single argument named @var{x}, and it must return +## @code{structfun} accepts an arbitrary function @var{func} in the form of +## an inline function, function handle, or the name of a function (in a +## character string). In the case of a character string argument, the +## function must accept a single argument named @var{x}, and it must return ## a string value. If the function returns more than one argument, they are ## returned as separate output variables. ## @@ -40,35 +40,35 @@ ## return value. If "UniformOutput" is false, the outputs are placed into a ## structure ## with the same fieldnames as the input structure. -## +## ## @example ## @group -## s.name1 = "John Smith"; -## s.name2 = "Jill Jones"; -## structfun (@@(x) regexp (x, '(\w+)$', "matches")@{1@}, s, +## s.name1 = "John Smith"; +## s.name2 = "Jill Jones"; +## structfun (@@(x) regexp (x, '(\w+)$', "matches")@{1@}, s, ## "UniformOutput", false) ## @result{} ## @{ ## name1 = Smith ## name2 = Jones -## @} +## @} ## @end group ## @end example -## +## ## Given the parameter "ErrorHandler", @var{errfunc} defines a function to ## call in case @var{func} generates an error. The form of the function is -## +## ## @example ## function [@dots{}] = errfunc (@var{se}, @dots{}) ## @end example -## +## ## @noindent ## where there is an additional input argument to @var{errfunc} relative to ## @var{func}, given by @var{se}. This is a structure with the elements ## "identifier", "message" and "index", giving respectively the error ## identifier, the error message, and the index into the input arguments ## of the element that caused the error. For an example on how to use -## an error handler, @pxref{doc-cellfun, @code{cellfun}}. +## an error handler, @pxref{doc-cellfun, @code{cellfun}}. ## ## @seealso{cellfun, arrayfun, spfun} ## @end deftypefn @@ -112,11 +112,11 @@ %!test -%! s.name1 = "John Smith"; -%! s.name2 = "Jill Jones"; +%! s.name1 = "John Smith"; +%! s.name2 = "Jill Jones"; %! l.name1 = "Smith"; %! l.name2 = "Jones"; -%! o = structfun (@(x) regexp (x, '(\w+)$', "matches"){1}, s, +%! o = structfun (@(x) regexp (x, '(\w+)$', "matches"){1}, s, %! "UniformOutput", false); %! assert (o, l);
--- a/scripts/general/subsindex.m +++ b/scripts/general/subsindex.m @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{idx} =} subsindex (@var{a}) -## Convert an object to an index vector. When @var{a} is a class object +## Convert an object to an index vector. When @var{a} is a class object ## defined with a class constructor, then @code{subsindex} is the ## overloading method that allows the conversion of this class object to ## a valid indexing vector. It is important to note that
--- a/scripts/general/trapz.m +++ b/scripts/general/trapz.m @@ -20,23 +20,23 @@ ## @deftypefn {Function File} {@var{z} =} trapz (@var{y}) ## @deftypefnx {Function File} {@var{z} =} trapz (@var{x}, @var{y}) ## @deftypefnx {Function File} {@var{z} =} trapz (@dots{}, @var{dim}) -## +## ## Numerical integration using trapezoidal method. @code{trapz ## (@var{y})} computes the integral of the @var{y} along the first -## non-singleton dimension. If the argument @var{x} is omitted a -## equally spaced vector is assumed. @code{trapz (@var{x}, @var{y})} +## non-singleton dimension. If the argument @var{x} is omitted a +## equally spaced vector is assumed. @code{trapz (@var{x}, @var{y})} ## evaluates the integral with respect to @var{x}. -## +## ## @seealso{cumtrapz} ## @end deftypefn ## Author: Kai Habel <kai.habel@gmx.de> ## -## also: June 2000 - Paul Kienzle (fixes,suggestions) +## also: June 2000 - Paul Kienzle (fixes,suggestions) ## 2006-05-12 David Bateman - Modified for NDArrays function z = trapz (x, y, dim) - + if (nargin < 1) || (nargin > 3) print_usage (); endif @@ -71,14 +71,14 @@ error ("trapz: invalid dimension DIM along which to sort"); endif endif - + n = sz(dim); idx1 = cell (); for i = 1:nd idx1{i} = 1:sz(i); endfor idx2 = idx1; - idx1{dim} = 2 : n; + idx1{dim} = 2 : n; idx2{dim} = 1 : (n - 1); if (! have_x) @@ -87,7 +87,7 @@ if (! size_equal (x, y)) error ("trapz: X and Y must have same shape"); endif - z = 0.5 * sum ((x(idx1{:}) - x(idx2{:})) .* + z = 0.5 * sum ((x(idx1{:}) - x(idx2{:})) .* (y(idx1{:}) + y(idx2{:})), dim); endif endfunction
--- a/scripts/general/triplequad.m +++ b/scripts/general/triplequad.m @@ -38,10 +38,10 @@ print_usage (); endif if (nargin < 8 || isempty (tol)) - tol = 1e-6; + tol = 1e-6; endif if (nargin < 9 || isempty (quadf)) - quadf = @quadgk; + quadf = @quadgk; endif inner = @__triplequad_inner__;
--- a/scripts/geometry/convhull.m +++ b/scripts/geometry/convhull.m @@ -23,7 +23,7 @@ ## data points are defined by the x and y vectors. ## ## A third optional argument, which must be a string, contains extra options -## passed to the underlying qhull command. See the documentation for the +## passed to the underlying qhull command. See the documentation for the ## Qhull library for details. ## ## @seealso{delaunay, convhulln}
--- a/scripts/geometry/delaunay.m +++ b/scripts/geometry/delaunay.m @@ -25,7 +25,7 @@ ## No other data point is in the circum-circle of the defining triangle. ## ## A third optional argument, which must be a string, contains extra options -## passed to the underlying qhull command. See the documentation for the +## passed to the underlying qhull command. See the documentation for the ## Qhull library for details. ## ## @example @@ -49,7 +49,7 @@ if (nargin != 2 && nargin != 3) print_usage (); endif - + if ((isvector (x) && isvector (y) && length (x) == length (y)) || size_equal (x, y)) if (nargin == 2)
--- a/scripts/geometry/delaunay3.m +++ b/scripts/geometry/delaunay3.m @@ -19,12 +19,12 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{T} =} delaunay3 (@var{x}, @var{y}, @var{z}) ## @deftypefnx {Function File} {@var{T} =} delaunay3 (@var{x}, @var{y}, @var{z}, @var{opt}) -## A matrix of size [n, 4] is returned. Each row contains a +## A matrix of size [n, 4] is returned. Each row contains a ## set of tetrahedron which are ## described by the indices to the data point vectors (x,y,z). ## ## A fourth optional argument, which must be a string or cell array of strings, -## contains extra options passed to the underlying qhull command. See the +## contains extra options passed to the underlying qhull command. See the ## documentation for the Qhull library for details. ## @seealso{delaunay,delaunayn} ## @end deftypefn
--- a/scripts/geometry/delaunayn.m +++ b/scripts/geometry/delaunayn.m @@ -28,24 +28,24 @@ ## size @code{[m, dim+1]}. It contains for each row a set of indices to ## the points, which describes a simplex of dimension dim. For example, ## a 2-D simplex is a triangle and 3-D simplex is a tetrahedron. -## +## ## Extra options for the underlying Qhull command can be specified by the ## second argument. This argument is a cell array of strings. The default -## options depend on the dimension of the input: -## -## @itemize +## options depend on the dimension of the input: +## +## @itemize ## @item 2D and 3D: @var{opt} = @code{@{"Qt", "Qbb", "Qc"@}} ## -## @item 4D and higher: @var{opt} = @code{@{"Qt", "Qbb", "Qc", "Qz"@}} +## @item 4D and higher: @var{opt} = @code{@{"Qt", "Qbb", "Qc", "Qz"@}} ## @end itemize -## +## ## If @var{opt} is [], then the default arguments are used. If @var{opt} -## is @code{@{"@w{}"@}}, then none of the default arguments are used by Qhull. -## See the Qhull documentation for the available options. -## +## is @code{@{"@w{}"@}}, then none of the default arguments are used by Qhull. +## See the Qhull documentation for the available options. +## ## All options can also be specified as single string, for example ## @code{"Qt Qbb Qc Qz"}. -## +## ## @end deftypefn function t = delaunayn (p, varargin) @@ -62,13 +62,13 @@ endif ## Try to remove the zero volume simplices. The volume of the i-th simplex is - ## given by abs(det(p(t(i,1:end-1),:)-p(t(i,2:end),:)))/prod(1:n) - ## (reference http://en.wikipedia.org/wiki/Simplex). Any simplex with a - ## relative volume less than some arbitrary criteria is rejected. The - ## criteria we use is the volume of the simplex corresponding to an - ## orthogonal simplex is equal edge length all equal to the edge length of + ## given by abs(det(p(t(i,1:end-1),:)-p(t(i,2:end),:)))/prod(1:n) + ## (reference http://en.wikipedia.org/wiki/Simplex). Any simplex with a + ## relative volume less than some arbitrary criteria is rejected. The + ## criteria we use is the volume of the simplex corresponding to an + ## orthogonal simplex is equal edge length all equal to the edge length of ## the original simplex. If the relative volume is 1e3*eps then the simplex - ## is rejected. Note division of the two volumes means that the factor + ## is rejected. Note division of the two volumes means that the factor ## prod(1:n) is dropped. idx = []; [nt, n] = size (t);
--- a/scripts/geometry/dsearch.m +++ b/scripts/geometry/dsearch.m @@ -35,6 +35,6 @@ %!shared x, y, tri %! x = [-1;-1;1]; %! y = [-1;1;-1]; -%! tri = [1,2,3]; +%! tri = [1,2,3]; %!assert (dsearch(x,y,tri,1,1/3), 3); %!assert (dsearch(x,y,tri,1/3,1), 2);
--- a/scripts/geometry/dsearchn.m +++ b/scripts/geometry/dsearchn.m @@ -23,8 +23,8 @@ ## @deftypefnx {Function File} {[@var{idx}, @var{d}] =} dsearchn (@dots{}) ## Returns the index @var{idx} or the closest point in @var{x} to the elements ## @var{xi}. If @var{outval} is supplied, then the values of @var{xi} that are -## not contained within one of the simplices @var{tri} are set to -## @var{outval}. Generally, @var{tri} is returned from @code{delaunayn +## not contained within one of the simplices @var{tri} are set to +## @var{outval}. Generally, @var{tri} is returned from @code{delaunayn ## (@var{x})}. ## @seealso{dsearch, tsearch} ## @end deftypefn @@ -47,8 +47,8 @@ endfunction %!shared x, tri -%! x = [-1,-1;-1,1;1,-1]; -%! tri = [1,2,3]; +%! x = [-1,-1;-1,1;1,-1]; +%! tri = [1,2,3]; %!assert (dsearchn(x,tri,[1,1/3]), 3); %!assert (dsearchn(x,tri,[1,1/3],NaN), NaN); %!assert (dsearchn(x,tri,[1,1/3],NA), NA);
--- a/scripts/geometry/griddata3.m +++ b/scripts/geometry/griddata3.m @@ -18,10 +18,10 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{vi} =} griddata3 (@var{x}, @var{y}, @var{z}, @var{v} @var{xi}, @var{yi}, @var{zi}, @var{method}, @var{options}) -## +## ## Generate a regular mesh from irregular data using interpolation. ## The function is defined by @code{@var{y} = f (@var{x},@var{y},@var{z})}. -## The interpolation points are all @var{xi}. +## The interpolation points are all @var{xi}. ## ## The interpolation method can be @code{"nearest"} or @code{"linear"}. ## If method is omitted it defaults to @code{"linear"}. @@ -31,7 +31,7 @@ ## Author: David Bateman <dbateman@free.fr> function vi = griddata3 (x, y, z, v, xi, yi, zi, method, varargin) - + if (nargin < 7) print_usage (); endif @@ -41,7 +41,7 @@ endif ## meshgrid xi, yi and zi if they are vectors unless they - ## are vectors of the same length + ## are vectors of the same length if (isvector (xi) && isvector (yi) && isvector (zi) && (numel (xi) != numel (yi) || numel (xi) != numel (zi))) [xi, yi, zi] = meshgrid (xi, yi, zi);
--- a/scripts/geometry/griddatan.m +++ b/scripts/geometry/griddatan.m @@ -18,10 +18,10 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{yi} =} griddatan (@var{x}, @var{y}, @var{xi}, @var{method}, @var{options}) -## +## ## Generate a regular mesh from irregular data using interpolation. ## The function is defined by @code{@var{y} = f (@var{x})}. -## The interpolation points are all @var{xi}. +## The interpolation points are all @var{xi}. ## ## The interpolation method can be @code{"nearest"} or @code{"linear"}. ## If method is omitted it defaults to @code{"linear"}. @@ -35,7 +35,7 @@ if (nargin == 3) method = "linear"; endif - if (nargin < 3) + if (nargin < 3) print_usage (); endif @@ -45,7 +45,7 @@ [m, n] = size (x); [mi, ni] = size (xi); - + if (n != ni || size (y, 1) != m || size (y, 2) != 1) error ("griddatan: dimensional mismatch"); endif @@ -55,7 +55,7 @@ tri = delaunayn (x); yi = NaN (mi, 1); - + if (strcmp (method, "nearest")) ## search index of nearest point idx = dsearchn (x, tri, xi);
--- a/scripts/geometry/inpolygon.m +++ b/scripts/geometry/inpolygon.m @@ -53,12 +53,12 @@ npol = length (xv); do_boundary = (nargout >= 2); - + in = zeros (size(x), "logical"); - if (do_boundary) - on = zeros (size(x), "logical"); + if (do_boundary) + on = zeros (size(x), "logical"); endif - + j = npol; for i = 1 : npol delta_xv = xv(j) - xv(i); @@ -95,7 +95,7 @@ %! ya=[0:0.1:1.4]; %! [x,y]=meshgrid(xa,ya); %! [in,on]=inpolygon(x,y,xv,yv); -%! +%! %! inside=in & !on; %! plot(xv,yv) %! hold on @@ -119,7 +119,7 @@ %! ya=[0:0.1:1.4]; %! [x,y]=meshgrid(xa,ya); %! [in,on]=inpolygon(x,y,xv,yv); -%! +%! %! inside=in & ~ on; %! plot(xv,yv) %! hold on
--- a/scripts/geometry/rectint.m +++ b/scripts/geometry/rectint.m @@ -34,7 +34,7 @@ ## Author: Bill Denney <bill@denney.ws> function area = rectint (a, b) - + if (nargin != 2) print_usage (); elseif (ndims (a) != 2 || ndims (b) != 2)
--- a/scripts/geometry/trimesh.m +++ b/scripts/geometry/trimesh.m @@ -20,9 +20,9 @@ ## @deftypefn {Function File} {} trimesh (@var{tri}, @var{x}, @var{y}, @var{z}) ## @deftypefnx {Function File} {@var{h} =} trimesh (@dots{}) ## Plot a triangular mesh in 3D@. The variable @var{tri} is the triangular -## meshing of the points @code{(@var{x}, @var{y})} which is returned -## from @code{delaunay}. The variable @var{z} is value at the point -## @code{(@var{x}, @var{y})}. The output argument @var{h} is the graphic +## meshing of the points @code{(@var{x}, @var{y})} which is returned +## from @code{delaunay}. The variable @var{z} is value at the point +## @code{(@var{x}, @var{y})}. The output argument @var{h} is the graphic ## handle to the plot. ## @seealso{triplot, delaunay3} ## @end deftypefn @@ -40,12 +40,12 @@ else newplot (); if (nargout > 0) - h = patch ("Vertices", [x(:), y(:), z(:)], "Faces", tri, - "FaceColor", "none", "EdgeColor", __next_line_color__(), + h = patch ("Vertices", [x(:), y(:), z(:)], "Faces", tri, + "FaceColor", "none", "EdgeColor", __next_line_color__(), varargin{:}); else - patch ("Vertices", [x(:), y(:), z(:)], "Faces", tri, - "FaceColor", "none", "EdgeColor", __next_line_color__(), + patch ("Vertices", [x(:), y(:), z(:)], "Faces", tri, + "FaceColor", "none", "EdgeColor", __next_line_color__(), varargin{:}); endif
--- a/scripts/geometry/trisurf.m +++ b/scripts/geometry/trisurf.m @@ -20,9 +20,9 @@ ## @deftypefn {Function File} {} trisurf (@var{tri}, @var{x}, @var{y}, @var{z}) ## @deftypefnx {Function File} {@var{h} =} trisurf (@dots{}) ## Plot a triangular surface in 3D@. The variable @var{tri} is the triangular -## meshing of the points @code{(@var{x}, @var{y})} which is returned -## from @code{delaunay}. The variable @var{z} is value at the point -## @code{(@var{x}, @var{y})}. The output argument @var{h} is the graphic +## meshing of the points @code{(@var{x}, @var{y})} which is returned +## from @code{delaunay}. The variable @var{z} is value at the point +## @code{(@var{x}, @var{y})}. The output argument @var{h} is the graphic ## handle to the plot. ## @seealso{triplot, delaunay3} ## @end deftypefn @@ -47,13 +47,13 @@ newplot (); if (nargout > 0) - h = patch ("Faces", tri, "Vertices", [x(:), y(:), z(:)], - "FaceVertexCData", reshape (c, numel (c), 1), + h = patch ("Faces", tri, "Vertices", [x(:), y(:), z(:)], + "FaceVertexCData", reshape (c, numel (c), 1), "FaceColor", "flat", "EdgeColor", "none", varargin{:}); else - patch ("Faces", tri, "Vertices", [x(:), y(:), z(:)], - "FaceVertexCData", reshape (c, numel (c), 1), + patch ("Faces", tri, "Vertices", [x(:), y(:), z(:)], + "FaceVertexCData", reshape (c, numel (c), 1), "FaceColor", "flat", "EdgeColor", "none", varargin{:}); endif
--- a/scripts/geometry/tsearchn.m +++ b/scripts/geometry/tsearchn.m @@ -44,7 +44,7 @@ b = cart2bary (x (t (i, :), :), xi(ni,:)); ## Our points xi are in the current triangle if - ## (all(b >= 0) && all (b <= 1)). However as we impose that + ## (all(b >= 0) && all (b <= 1)). However as we impose that ## sum(b,2) == 1 we only need to test all(b>=0). Note need to add ## a small margin for rounding errors intri = all (b >= -1e-12, 2);
--- a/scripts/geometry/voronoi.m +++ b/scripts/geometry/voronoi.m @@ -71,7 +71,7 @@ error ("voronoi: expecting first argument to be an axes object"); endif else - if (nargout < 2) + if (nargout < 2) handl = gca (); endif endif @@ -82,9 +82,9 @@ x = varargin{narg++}; y = varargin{narg++}; - + opts = {}; - if (narg <= nargin) + if (narg <= nargin) if (iscell (varargin{narg})) opts = varargin(narg++); elseif (ismatrix (varargin{narg})) @@ -94,7 +94,7 @@ endif linespec = {"b"}; - if (narg <= nargin) + if (narg <= nargin) if (ischar (varargin{narg})) linespec = varargin(narg); endif @@ -130,7 +130,7 @@ ll = length (idx); c = c(idx).'; k = sum (cellfun ('length', c)); - edges = cell2mat(cellfun (@(x) [x ; [x(end), x(1:end-1)]], c, + edges = cell2mat(cellfun (@(x) [x ; [x(end), x(1:end-1)]], c, "uniformoutput", false)); ## Identify the unique edges of the Voronoi diagram @@ -150,7 +150,7 @@ vx = reshape (p (edges, 1), size(edges)); vy = reshape (p (edges, 2), size(edges)); - if (nargout < 2) + if (nargout < 2) lim = [xmin, xmax, ymin, ymax]; h = plot (handl, vx, vy, linespec{:}, x, y, '+'); axis (lim + 0.1 * [[-1, 1] * (lim (2) - lim (1)), ...
--- a/scripts/help/__makeinfo__.m +++ b/scripts/help/__makeinfo__.m @@ -63,15 +63,15 @@ if (nargin == 0) print_usage (); endif - + if (!ischar (text)) error ("__makeinfo__: first input argument must be a string"); endif - + if (!ischar (output_type)) error ("__makeinfo__: second input argument must be a string"); endif - + ## Define the function which expands @seealso macro if (isempty (see_also)) if (strcmpi (output_type, "plain text")) @@ -80,15 +80,15 @@ see_also = @simple_see_also_with_refs; endif endif - + if (!isa (see_also, "function_handle")) error ("__makeinfo__: third input argument must be the empty matrix, or a function handle"); endif - - ## It seems like makeinfo sometimes gets angry if the first character + + ## It seems like makeinfo sometimes gets angry if the first character ## on a line is a space, so we remove these. text = strrep (text, "\n ", "\n"); - + ## Handle @seealso macro SEE_ALSO = "@seealso"; starts = strfind (text, SEE_ALSO); @@ -144,10 +144,10 @@ retval = text; return; endif - + ## Create the final TeXinfo input string text = sprintf ("\\input texinfo\n\n%s\n\n@bye\n", text); - + unwind_protect ## Write Texinfo to tmp file template = "octave-help-XXXXXX"; @@ -169,7 +169,7 @@ otherwise error ("__makeinfo__: unsupported output type: '%s'", output_type); endswitch - + ## Call makeinfo [status, retval] = system (cmd);
--- a/scripts/help/__strip_html_tags__.m +++ b/scripts/help/__strip_html_tags__.m @@ -22,7 +22,7 @@ ## @end deftypefn ## Remove HTML tags from text. This is used as a simple HTML-to-text -## function. +## function. function [text, status] = __strip_html_tags__ (html_text) start = find (html_text == "<"); @@ -62,12 +62,12 @@ if (groups (1, 1) == 1) keep (1:groups (1, 2)) = false; endif - + ## Remove end-lines from the end if (sum (groups (end, :)) - 1 == length (text)) keep (groups (end, 1):end) = false; endif - + ## Remove groups of end-lines with more than 3 end-lines next to each other idx = find (groups (:, 2) >= 3); for k = 1:length (idx) @@ -75,7 +75,7 @@ stop = start + groups (idx (k), 2) - 1; keep (start+2:stop) = false; endfor - + ## Actually remove the elements text = text (keep); endfunction
--- a/scripts/help/doc.m +++ b/scripts/help/doc.m @@ -1,5 +1,5 @@ ## Copyright (C) 2005-2011 Søren Hauberg -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -65,7 +65,7 @@ info_dir = fileparts (ffile); endif - ## Determine if a file called doc.info exist in the same + ## Determine if a file called doc.info exist in the same ## directory as the function. info_file_name = fullfile (info_dir, "doc.info");
--- a/scripts/help/gen_doc_cache.m +++ b/scripts/help/gen_doc_cache.m @@ -20,7 +20,7 @@ ## @deftypefn {Function File} {} gen_doc_cache (@var{out_file}, @var{directory}) ## Generate documentation caches for all functions in a given directory. ## -## A documentation cache is generated for all functions in @var{directory}. +## A documentation cache is generated for all functions in @var{directory}. ## The ## resulting cache is saved in the file @var{out_file}. ## The cache is used to speed up @code{lookfor}. @@ -36,7 +36,7 @@ if (!ischar (out_file)) print_usage (); endif - + ## Generate cache if (isempty (directory)) cache = gen_builtin_cache (); @@ -45,7 +45,7 @@ else error ("gen_doc_cache: second input argument must be a string"); endif - + ## Save cache if (! isempty (cache)) save ("-text", out_file, "cache"); @@ -71,7 +71,7 @@ otherwise status = 1; endswitch - + ## Did we get the help text? if (status != 0 || isempty (text)) warning ("gen_doc_cache: unusable help text in '%s'. Ignoring function.", f); @@ -84,21 +84,21 @@ function cache = create_cache (list) cache = {}; - + ## For each function: for n = 1:length (list) f = list {n}; - + ## Get help text [text, format] = get_help_text (f); - + [text, first_sentence, status] = handle_function (f, text, format); ## Did we get the help text? if (status != 0) continue; endif - + ## Store the help text cache (1, end+1) = f; cache (2, end) = text; @@ -120,7 +120,7 @@ endif prev_idx = idx (n) + 1; endfor - + if (!dir_in_path) addpath (directory); endif @@ -128,7 +128,7 @@ ## Get list of functions in directory and create cache list = __list_functions__ (directory); cache = create_cache (list); - + if (!dir_in_path) rmpath (directory); endif
--- a/scripts/help/get_first_help_sentence.m +++ b/scripts/help/get_first_help_sentence.m @@ -46,18 +46,18 @@ if (nargin == 0) error ("get_first_help_sentence: not enough input arguments"); endif - + if (!ischar (name)) error ("get_first_help_sentence: first input must be a string"); endif - + if (!isnumeric (max_len) || max_len <= 0 || max_len != round (max_len)) error ("get_first_help_sentence: second input must be positive integer"); endif ## First, we get the raw help text [help_text, format] = get_help_text (name); - + ## Then, we take action depending on the format switch (lower (format)) case "plain text" @@ -95,7 +95,7 @@ ## Lines ending with "@\n" are continuation lines, so they should be concatenated ## with the following line. help_text = strrep (help_text, "@\n", " "); - + ## Find, and remove, lines that start with @def. This should remove things ## such as @deftypefn, @deftypefnx, @defvar, etc. keep = true (size (help_text)); @@ -110,7 +110,7 @@ keep (def_idx (k):endl) = false; endif endfor - + ## Remove the @end ... that corresponds to the @def we removed above def1 = def_idx (1); space_idx = find (help_text == " "); @@ -133,13 +133,13 @@ else keep (end_idx:endl) = false; endif - + help_text = help_text (keep); endif - + ## Run makeinfo to generate plain text [help_text, status] = __makeinfo__ (help_text, "plain text"); - + ## Extract first line with plain text method. retval = first_sentence_plain_text (help_text, max_len); endfunction @@ -149,7 +149,7 @@ function [retval, status] = first_sentence_html (help_text, max_len) ## Strip tags [help_text, status] = strip_html_tags (help_text); - + ## Extract first line with plain text method. retval = first_sentence_plain_text (help_text, max_len); endfunction
--- a/scripts/help/help.m +++ b/scripts/help/help.m @@ -70,7 +70,7 @@ ## Get help text [text, format] = get_help_text (name); - + ## Take action depending on help text format switch (lower (format)) case "plain text" @@ -87,7 +87,7 @@ otherwise error ("help: internal error: unsupported help text format: '%s'\n", format); endswitch - + ## Print text if (status != 0) warning ("help: Texinfo formatting filter exited abnormally; raw Texinfo source of help text follows...\n");
--- a/scripts/help/lookfor.m +++ b/scripts/help/lookfor.m @@ -21,22 +21,22 @@ ## @deftypefnx {Command} {} lookfor -all @var{str} ## @deftypefnx {Function File} {[@var{func}, @var{helpstring}] =} lookfor (@var{str}) ## @deftypefnx {Function File} {[@var{func}, @var{helpstring}] =} lookfor ('-all', @var{str}) -## Search for the string @var{str} in all functions found in the current +## Search for the string @var{str} in all functions found in the current ## function search path. By default, @code{lookfor} searches for @var{str} ## in the first sentence of the help string of each function found. The entire -## help text of each function can be searched if the '-all' argument is +## help text of each function can be searched if the '-all' argument is ## supplied. All searches are case insensitive. -## -## Called with no output arguments, @code{lookfor} prints the list of -## matching functions to the terminal. Otherwise, the output arguments -## @var{func} and @var{helpstring} define the matching functions and the +## +## Called with no output arguments, @code{lookfor} prints the list of +## matching functions to the terminal. Otherwise, the output arguments +## @var{func} and @var{helpstring} define the matching functions and the ## first sentence of each of their help strings. -## +## ## The ability of @code{lookfor} to correctly identify the first ## sentence of the help text is dependent on the format of the ## function's help. All Octave core functions are correctly ## formatted, but the same can not be guaranteed for external packages and -## user-supplied functions. Therefore, the use of the '-all' argument may +## user-supplied functions. Therefore, the use of the '-all' argument may ## be necessary to find related functions that are not a part of Octave. ## @seealso{help, doc, which} ## @end deftypefn @@ -63,7 +63,7 @@ fun = help_text = {}; had_core_cache = false; endif - + ## Search functions in new path dirs. orig_path = strsplit (__pathorig__ (), pathsep ()); @@ -88,12 +88,12 @@ funs_in_f = __list_functions__ (elt); for m = 1:length (funs_in_f) fn = funs_in_f {m}; - + ## Skip files that start with __ if (length (fn) > 2 && strcmp (fn (1:2), "__")) continue; endif - + ## Extract first sentence try warn_state = warning (); @@ -121,7 +121,7 @@ catch status = 1; end_try_catch - + ## Take action depending on help text fmt switch (lower (fmt)) case "plain text" @@ -137,7 +137,7 @@ elseif (status == 0) # only search the first sentence of the help text text = first_sentence; endif - + ## Search the help text, if we can if (status == 0 && !isempty (strfind (text, str))) fun (end+1) = fn; @@ -146,7 +146,7 @@ endfor endif endfor - + if (nargout == 0) ## Print the results (FIXME: improve this to make it look better. indent = 20;
--- a/scripts/help/print_usage.m +++ b/scripts/help/print_usage.m @@ -44,7 +44,7 @@ else fullname = name; endif - + ## Determine if we're called from top level. at_toplev = length (x) < 2 || (length (x) == 2 && strcmp (x(2).name, name)); @@ -65,7 +65,7 @@ otherwise error ("print_usage: internal error: unsupported help text format: '%s'\n", format); endswitch - + ## Raise the final error if (status != 0) warning ("print_usage: Texinfo formatting filter exited abnormally"); @@ -100,7 +100,7 @@ ## Lines ending with "@\n" are continuation lines, so they should be ## concatenated with the following line. help_text = strrep (help_text, "@\n", " "); - + ## Find, and keep, lines that start with @def or @end def. This should include things ## such as @deftypefn, @deftypefnx, @defvar, etc. and their corresponding @end's def_idx = strfind (help_text, "@def"); @@ -115,7 +115,7 @@ buffer = strcat (buffer, help_text (def_idx (k):endl)); endif endfor - + end_def_idx = strfind (help_text, "@end def"); if (!isempty (end_def_idx)) buffer = strcat (buffer, help_text (end_def_idx:end)); @@ -131,7 +131,7 @@ function [retval, status] = get_usage_html (help_text, max_len) ## Strip tags [help_text, status] = strip_html_tags (help_text); - + ## Extract first line with plain text method. retval = get_usage_plain_text (help_text, max_len); endfunction
--- a/scripts/help/type.m +++ b/scripts/help/type.m @@ -21,12 +21,12 @@ ## @deftypefnx {Command} {} type -q @var{name} @dots{} ## @deftypefnx {Function File} {dfns =} type ("@var{name}", @dots{}) ## Display the definition of each @var{name} that refers to a function. -## +## ## Normally also displays whether each @var{name} is user-defined or built-in; ## the @option{-q} option suppresses this behavior. ## -## If an output argument is requested nothing is displayed. Instead, a cell -## array of strings is returned, where each element corresponds to the +## If an output argument is requested nothing is displayed. Instead, a cell +## array of strings is returned, where each element corresponds to the ## definition of each requested function. ## @end deftypefn @@ -39,7 +39,7 @@ if (!iscellstr (varargin)) error ("type: input arguments must be strings"); endif - + quiet = false; idx = strcmpi (varargin, "-q") | strcmpi (varargin, "-quiet"); if (any (idx)) @@ -50,10 +50,10 @@ if (nargout > 0) retval = cell (size (varargin)); endif - + for n = 1:length (varargin) name = varargin {n}; - + ## Find function and get its code text = ""; cmd = sprintf ("exist ('%s')", name); @@ -75,7 +75,7 @@ ## FIXME: Should we just print it anyway? error ("type: `%s' undefined\n", name); endif - + ## Read the file fid = fopen (file, "r"); if (fid < 0) @@ -83,13 +83,13 @@ endif contents = char (fread (fid).'); fclose (fid); - + if (quiet) text = contents; else text = sprintf ("%s is the user-defined function defined from: %s\n\n%s", name, file, contents); - endif + endif elseif (e == 3) text = sprintf ("%s is a dynamically-linked function", name); elseif (e == 5)
--- a/scripts/image/autumn.m +++ b/scripts/image/autumn.m @@ -21,7 +21,7 @@ ## @deftypefnx {Function File} {@var{map} =} autumn (@var{n}) ## Create color colormap. This colormap ranges from red through orange ## to yellow. -## The argument @var{n} must be a scalar. +## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. ## @seealso{colormap} ## @end deftypefn @@ -41,7 +41,7 @@ endif if (n == 1) - map = [1, 0, 0]; + map = [1, 0, 0]; elseif (n > 1) r = ones (n, 1); g = (0:n - 1)' ./ (n - 1);
--- a/scripts/image/bone.m +++ b/scripts/image/bone.m @@ -21,7 +21,7 @@ ## @deftypefnx {Function File} {@var{map} =} bone (@var{n}) ## Create color colormap. This colormap varies from black to white with ## gray-blue shades. -## The argument @var{n} must be a scalar. +## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. ## @seealso{colormap} ## @end deftypefn @@ -41,7 +41,7 @@ endif if (n == 1) - map = [0, 0, 0]; + map = [0, 0, 0]; elseif (n > 1) x = linspace (0, 1, n)';
--- a/scripts/image/brighten.m +++ b/scripts/image/brighten.m @@ -20,9 +20,9 @@ ## @deftypefn {Function File} {@var{map_out} =} brighten (@var{map}, @var{beta}) ## @deftypefnx {Function File} {@var{map_out} =} brighten (@var{h}, @var{beta}) ## @deftypefnx {Function File} {@var{map_out} =} brighten (@var{beta}) -## Darkens or brightens the given colormap. If the @var{map} argument +## Darkens or brightens the given colormap. If the @var{map} argument ## is omitted, the function is applied to the current colormap. The first -## argument can also be a valid graphics handle @var{h}, in which case +## argument can also be a valid graphics handle @var{h}, in which case ## @code{brighten} is applied to the colormap associated with this handle. ## ## Should the resulting colormap @var{map_out} not be assigned, it will be
--- a/scripts/image/cool.m +++ b/scripts/image/cool.m @@ -19,8 +19,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{map} =} cool () ## @deftypefnx {Function File} {@var{map} =} cool (@var{n}) -## Create color colormap. The colormap varies from cyan to magenta. -## The argument @var{n} must be a scalar. +## Create color colormap. The colormap varies from cyan to magenta. +## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. ## @seealso{colormap} ## @end deftypefn @@ -40,7 +40,7 @@ endif if (n == 1) - map = [0, 1, 1]; + map = [0, 1, 1]; elseif (n > 1) r = (0:n - 1)' ./ (n - 1); g = 1 - r;
--- a/scripts/image/copper.m +++ b/scripts/image/copper.m @@ -21,7 +21,7 @@ ## @deftypefnx {Function File} {@var{map} =} copper (@var{n}) ## Create color colormap. This colormap varies from black to ## a light copper tone. -## The argument @var{n} must be a scalar. +## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. ## @seealso{colormap} ## @end deftypefn @@ -41,7 +41,7 @@ endif if (n == 1) - map = [0, 0, 0]; + map = [0, 0, 0]; elseif (n > 1) x = linspace (0, 1, n)'; r = (x < 4/5) .* (5/4 * x) + (x >= 4/5);
--- a/scripts/image/flag.m +++ b/scripts/image/flag.m @@ -19,9 +19,9 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{map} =} flag () ## @deftypefnx {Function File} {@var{map} =} flag (@var{n}) -## Create color colormap. This colormap cycles through red, white, blue +## Create color colormap. This colormap cycles through red, white, blue ## and black with each index change. -## The argument @var{n} must be a scalar. +## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. ## @seealso{colormap} ## @end deftypefn
--- a/scripts/image/gmap40.m +++ b/scripts/image/gmap40.m @@ -22,7 +22,7 @@ ## Create color colormap. The colormap consists of red, green, blue, yellow, ## magenta and cyan. This colormap is specifically designed for users of ## gnuplot 4.0 where these 6 colors are the allowable ones for patch objects. -## The argument @var{n} must be a scalar. +## The argument @var{n} must be a scalar. ## If unspecified, a length of 6 is assumed. Larger values ## of @var{n} result in a repetition of the above colors. ## @seealso{colormap}
--- a/scripts/image/gray.m +++ b/scripts/image/gray.m @@ -21,7 +21,7 @@ ## @deftypefnx {Function File} {@var{map} =} gray (@var{n}) ## Create gray colormap. This colormap varies from black to white with ## shades of gray. -## The argument @var{n} must be a scalar. +## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. ## @end deftypefn
--- a/scripts/image/hot.m +++ b/scripts/image/hot.m @@ -19,9 +19,9 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{map} =} hot () ## @deftypefnx {Function File} {@var{map} =} hot (@var{n}) -## Create color colormap. This colormap ranges from black through dark red, -## red, orange, yellow, to white. -## The argument @var{n} must be a scalar. +## Create color colormap. This colormap ranges from black through dark red, +## red, orange, yellow, to white. +## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. ## @seealso{colormap} ## @end deftypefn @@ -32,7 +32,7 @@ if (nargin == 0) n = rows (colormap); - elseif (nargin == 1) + elseif (nargin == 1) if (! isscalar (n)) error ("hot: argument must be a scalar"); endif @@ -41,7 +41,7 @@ endif if (n == 1) - map = [0, 0, 0]; + map = [0, 0, 0]; elseif (n > 1) x = linspace (0, 1, n)'; r = (x < 2/5) .* (5/2 * x) + (x >= 2/5);
--- a/scripts/image/hsv.m +++ b/scripts/image/hsv.m @@ -18,14 +18,14 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} hsv (@var{n}) -## Create color colormap. This colormap begins with red, changes through -## yellow, green, cyan, blue, and magenta, before returning to red. +## Create color colormap. This colormap begins with red, changes through +## yellow, green, cyan, blue, and magenta, before returning to red. ## It is useful for displaying periodic functions. It is obtained by linearly ## varying the hue through all possible values while keeping constant maximum ## saturation and value and is equivalent to ## @code{hsv2rgb ([linspace(0,1,N)', ones(N,2)])}. ## -## The argument @var{n} must be a scalar. +## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. ## @seealso{colormap} ## @end deftypefn @@ -45,7 +45,7 @@ endif if (n == 1) - map = [1, 0, 0]; + map = [1, 0, 0]; elseif (n > 1) h = linspace (0, 1, n)'; map = hsv2rgb ([h, ones(n, 1), ones(n, 1)]);
--- a/scripts/image/hsv2rgb.m +++ b/scripts/image/hsv2rgb.m @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{rgb_map} =} hsv2rgb (@var{hsv_map}) -## Transform a colormap or image from the HSV space to the RGB space. +## Transform a colormap or image from the HSV space to the RGB space. ## @seealso{rgb2hsv} ## @end deftypefn @@ -64,7 +64,7 @@ rgb_map = kron ([1, 1, 1], hsv_map(:,3) .* (1 - hsv_map(:,2))); ## red(hue-2/3)=green(hue)=blue(hue-1/3) - ## apply modulo 1 for red and blue + ## apply modulo 1 for red and blue t = hsv_map(:,1); tp = t'; hue = [(tp - 2/3 - floor (t - 2/3)');
--- a/scripts/image/image.m +++ b/scripts/image/image.m @@ -27,7 +27,7 @@ ## @var{x} and @var{y}. If you're not using gnuplot 4.2 or later, these ## variables are ignored. ## -## Implementation Note: The origin (0, 0) for images is located in the +## Implementation Note: The origin (0, 0) for images is located in the ## upper left. For ordinary plots, the origin is located in the lower ## left. Octave handles this inversion by plotting the data normally, ## and then reversing the direction of the y-axis by setting the
--- a/scripts/image/imread.m +++ b/scripts/image/imread.m @@ -89,7 +89,7 @@ endfunction -%!testif HAVE_MAGICK +%!testif HAVE_MAGICK %! vpng = [ ... %! 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, ... %! 0, 13, 73, 72, 68, 82, 0, 0, 0, 3, ...
--- a/scripts/image/imshow.m +++ b/scripts/image/imshow.m @@ -1,5 +1,5 @@ ## Copyright (C) 1994-2011 John W. Eaton -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -138,7 +138,7 @@ warning ("imshow: only showing real part of complex image"); im = real (im); endif - + nans = isnan (im(:)); if (any (nans)) warning ("Octave:imshow-NaN",
--- a/scripts/image/imwrite.m +++ b/scripts/image/imwrite.m @@ -26,24 +26,24 @@ ## If @var{fmt} is not supplied, the file extension of @var{filename} is used ## to determine the format. ## -## The parameter-value pairs (@var{p1}, @var{v1}, @dots{}) are optional. +## The parameter-value pairs (@var{p1}, @var{v1}, @dots{}) are optional. ## Currently the following options are supported for @t{JPEG} images: ## ## @table @samp ## @item Quality ## Set the quality of the compression. The value should be an -## integer between 0 and 100, with larger values indicating higher visual +## integer between 0 and 100, with larger values indicating higher visual ## quality and lower compression. ## @end table ## -## @strong{Supported Formats} +## @strong{Supported Formats} ## @multitable @columnfractions .33 .66 -## @headitem Extension @tab Format -## @item bmp @tab Windows Bitmap -## @item gif @tab Graphics Interchange Format +## @headitem Extension @tab Format +## @item bmp @tab Windows Bitmap +## @item gif @tab Graphics Interchange Format ## @item jpg and jpeg @tab Joint Photographic Experts Group ## @item pbm @tab Portable Bitmap -## @item pcx @tab +## @item pcx @tab ## @item pgm @tab Portable Graymap ## @item png @tab Portable Network Graphics ## @item pnm @tab Portable Anymap @@ -53,9 +53,9 @@ ## @item xwd @tab X11 Dump ## @end multitable ## -## @strong{Unsupported Formats} +## @strong{Unsupported Formats} ## @multitable @columnfractions .33 .66 -## @headitem Extension @tab Format +## @headitem Extension @tab Format ## @item hdf @tab Hierarchical Data Format V4 ## @item jp2 and jpx @tab Joint Photographic Experts Group 2000 ## @end multitable @@ -64,13 +64,13 @@ ## @end deftypefn function imwrite (img, varargin) - + persistent imwrite_possible_formats = { "bmp"; "gif"; "jp2"; "jpg"; "jpx"; "jpeg"; "hdf"; "pbm"; "pcx"; "pgm"; "png"; "pnm"; "ppm"; "ras"; "tif"; "tiff"; "xwd" }; persistent accepted_formats = __magick_format_list__ (imwrite_possible_formats); - + if (nargin < 2 || ! (isnumeric (img) || islogical (img))) print_usage (); endif
--- a/scripts/image/ind2rgb.m +++ b/scripts/image/ind2rgb.m @@ -43,7 +43,7 @@ if (ndims (x) != 2 || any (x(:) != round (x(:))) || min (x(:)) < 1) error ("ind2rgb: X must be an indexed image"); endif - + ## Check the color map. if (ndims (map) != 2 || columns (map) != 3) error ("ind2rgb: MAP must be a valid colormap"); @@ -57,7 +57,7 @@ pad = repmat (map(end,:), maxidx-rm, 1); map(end+1:maxidx, :) = pad; endif - + ## Compute result [hi, wi] = size (x); R = reshape (map (x(:), 1), hi, wi);
--- a/scripts/image/jet.m +++ b/scripts/image/jet.m @@ -20,8 +20,8 @@ ## @deftypefn {Function File} {@var{map} =} jet () ## @deftypefnx {Function File} {@var{map} =} jet (@var{n}) ## Create color colormap. This colormap ranges from dark blue through blue, -## cyan, green, yellow, red, to dark red. -## The argument @var{n} must be a scalar. +## cyan, green, yellow, red, to dark red. +## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. ## @seealso{colormap} ## @end deftypefn @@ -41,7 +41,7 @@ endif if (n == 1) - map = [0, 0, 0.5]; + map = [0, 0, 0.5]; elseif (n > 1) x = linspace(0, 1, n)'; r = (x >= 3/8 & x < 5/8) .* (4 * x - 3/2)\
--- a/scripts/image/ntsc2rgb.m +++ b/scripts/image/ntsc2rgb.m @@ -51,7 +51,7 @@ if (! ismatrix (yiq) || columns (yiq) != 3) error ("ntsc2rgb: argument must be a matrix of size Nx3 or NxMx3"); endif - + ## Convert data trans = [ 1.0, 1.0, 1.0; 0.95617, -0.27269, -1.10374;
--- a/scripts/image/ocean.m +++ b/scripts/image/ocean.m @@ -21,7 +21,7 @@ ## @deftypefnx {Function File} {@var{map} =} ocean (@var{n}) ## Create color colormap. This colormap varies from black to white with shades ## of blue. -## The argument @var{n} must be a scalar. +## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. ## @end deftypefn
--- a/scripts/image/pink.m +++ b/scripts/image/pink.m @@ -20,8 +20,8 @@ ## @deftypefn {Function File} {@var{map} =} pink () ## @deftypefnx {Function File} {@var{map} =} pink (@var{n}) ## Create color colormap. This colormap varies from black to white with -## shades of gray-pink. It gives a sepia tone when used on grayscale images. -## The argument @var{n} must be a scalar. +## shades of gray-pink. It gives a sepia tone when used on grayscale images. +## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. ## @seealso{colormap} ## @end deftypefn @@ -41,7 +41,7 @@ endif if (n == 1) - map = [0, 0, 0]; + map = [0, 0, 0]; elseif (n > 1) x = linspace (0, 1, n)'; r = (x < 3/8) .* (14/9 * x) + (x >= 3/8) .* (2/3 * x + 1/3);
--- a/scripts/image/prism.m +++ b/scripts/image/prism.m @@ -21,7 +21,7 @@ ## @deftypefnx {Function File} {@var{map} =} prism (@var{n}) ## Create color colormap. This colormap cycles through red, orange, yellow, ## green, blue and violet with each index change. -## The argument @var{n} must be a scalar. +## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. ## @seealso{colormap} ## @end deftypefn
--- a/scripts/image/rainbow.m +++ b/scripts/image/rainbow.m @@ -19,9 +19,9 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{map} =} rainbow () ## @deftypefnx {Function File} {@var{map} =} rainbow (@var{n}) -## Create color colormap. This colormap ranges from red through orange, -## yellow, green, blue, to violet. -## The argument @var{n} must be a scalar. +## Create color colormap. This colormap ranges from red through orange, +## yellow, green, blue, to violet. +## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. ## @seealso{colormap} ## @end deftypefn @@ -44,7 +44,7 @@ endif if (n == 1) - map = [1, 0, 0]; + map = [1, 0, 0]; elseif (n > 1) x = linspace (0, 1, n)'; r = (x < 2/5) + (x >= 2/5 & x < 3/5) .* (-5 * x + 3)\
--- a/scripts/image/rgb2hsv.m +++ b/scripts/image/rgb2hsv.m @@ -24,7 +24,7 @@ ## ## In the HSV space each color is represented by their hue, saturation ## and value (brightness). Value gives the amount of light in the color. -## Hue describes the dominant wavelength. +## Hue describes the dominant wavelength. ## Saturation is the amount of hue mixed into the color. ## @seealso{hsv2rgb} ## @end deftypefn @@ -65,7 +65,7 @@ ## set hue to zero for undefined values (gray has no hue) h = zeros (size (v)); notgray = (s != v); - + ## blue hue idx = (v == rgb(:,3) & notgray); if (any (idx)) @@ -93,7 +93,7 @@ s(notgray) = 1 - s(notgray) ./ v(notgray); hsv_map = [h, s, v]; - + ## If input was an image, convert it back into one. if (is_image) hsv_map = reshape (hsv_map, Sz);
--- a/scripts/image/rgb2ind.m +++ b/scripts/image/rgb2ind.m @@ -34,7 +34,7 @@ if (nargin != 1 && nargin != 3) print_usage (); endif - + if (nargin == 1) rgb = R; if (length (size (rgb)) == 3 && size (rgb, 3) == 3)
--- a/scripts/image/rgb2ntsc.m +++ b/scripts/image/rgb2ntsc.m @@ -51,7 +51,7 @@ if (! ismatrix (rgb) || columns (rgb) != 3) error ("rgb2ntsc: argument must be a matrix of size Nx3 or NxMx3"); endif - + ## Convert data trans = [ 0.299, 0.596, 0.211; 0.587, -0.274, -0.523;
--- a/scripts/image/spring.m +++ b/scripts/image/spring.m @@ -20,7 +20,7 @@ ## @deftypefn {Function File} {@var{map} =} spring () ## @deftypefnx {Function File} {@var{map} =} spring (@var{n}) ## Create color colormap. This colormap varies from magenta to yellow. -## The argument @var{n} must be a scalar. +## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. ## @seealso{colormap} ## @end deftypefn @@ -40,7 +40,7 @@ endif if (n == 1) - map = [1, 0, 1]; + map = [1, 0, 1]; elseif (n > 1) r = ones (n, 1); g = (0:n - 1)' ./ (n - 1);
--- a/scripts/image/summer.m +++ b/scripts/image/summer.m @@ -20,7 +20,7 @@ ## @deftypefn {Function File} {@var{map} =} summer () ## @deftypefnx {Function File} {@var{map} =} summer (@var{n}) ## Create color colormap. This colormap varies from green to yellow. -## The argument @var{n} must be a scalar. +## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. ## @seealso{colormap} ## @end deftypefn @@ -40,7 +40,7 @@ endif if (n == 1) - map = [0, 0.5, 0.4]; + map = [0, 0.5, 0.4]; elseif (n > 1) r = (0:n - 1)' ./ (n - 1); g = 0.5 + r ./ 2;
--- a/scripts/image/winter.m +++ b/scripts/image/winter.m @@ -20,7 +20,7 @@ ## @deftypefn {Function File} {@var{map} =} winter () ## @deftypefnx {Function File} {@var{map} =} winter (@var{n}) ## Create color colormap. This colormap varies from blue to green. -## The argument @var{n} must be a scalar. +## The argument @var{n} must be a scalar. ## If unspecified, the length of the current colormap, or 64, is used. ## @seealso{colormap} ## @end deftypefn @@ -40,7 +40,7 @@ endif if (n == 1) - map = [0, 0, 1]; + map = [0, 0, 1]; elseif (n > 1) r = zeros (n, 1); g = (0:n - 1)' ./ (n - 1);
--- a/scripts/io/dlmwrite.m +++ b/scripts/io/dlmwrite.m @@ -75,9 +75,9 @@ ## @end deftypefn ## Author: Paul Kienzle <pkienzle@users.sf.net> -## +## ## This program was originally granted to the public domain -## +## ## 2002-03-08 Paul Kienzle <pkienzle@users.sf.net> ## * Initial revision ## 2005-11-27 Bill Denney <bill@givebillmoney.com>
--- a/scripts/io/fileread.m +++ b/scripts/io/fileread.m @@ -38,7 +38,7 @@ endif unwind_protect - str = fread (fid, "*char"); + str = fread (fid, "*char"); unwind_protect_cleanup fclose (fid); end_unwind_protect
--- a/scripts/io/strread.m +++ b/scripts/io/strread.m @@ -104,7 +104,7 @@ if (nargin < 1) print_usage (); endif - + if (!ischar (str) || !ischar (format)) error ("strread: STR and FORMAT arguments must be strings"); endif @@ -138,7 +138,7 @@ ## XXX: We could synthesize this, but that just seems weird... warning ("strread: property \"bufsize\" is not implemented"); case "whitespace" - white_spaces = varargin {n+1}; + white_spaces = varargin {n+1}; case "expchars" warning ("strread: property \"expchars\" is not implemented"); otherwise @@ -201,12 +201,12 @@ endif endif endfor - + ## Split 'str' into words words = split_by (str, delimiter_str); num_words = numel (words); num_lines = ceil (num_words / num_words_per_line); - + ## For each specifier k = 1; for m = 1:num_words_per_line
--- a/scripts/io/textread.m +++ b/scripts/io/textread.m @@ -40,7 +40,7 @@ if (nargin < 1) print_usage (); endif - + if (!ischar (filename) || !ischar (format)) error ("textread: first and second input arguments must be strings"); endif @@ -57,10 +57,10 @@ fskipl (fid, headerlines); varargin(headerlines:headerlines+1) = []; endif - + str = fread (fid, "char=>char").'; fclose (fid); - + ## Call strread to make it do the real work [varargout{1:max (nargout, 1)}] = strread (str, format, varargin {:});
--- a/scripts/linear-algebra/cond.m +++ b/scripts/linear-algebra/cond.m @@ -21,7 +21,7 @@ ## @deftypefnx {Function File} {} cond (@var{A}, @var{p}) ## Compute the @var{p}-norm condition number of a matrix. @code{cond ## (@var{A})} is -## defined as +## defined as ## @tex ## $ {\parallel A \parallel_p * \parallel A^{-1} \parallel_p .} $ ## @end tex @@ -30,7 +30,7 @@ ## @end ifnottex ## ## By default @code{@var{p} = 2} is used which implies a (relatively slow) -## singular value decomposition. Other possible selections are +## singular value decomposition. Other possible selections are ## @code{@var{p} = 1, Inf, "fro"} which are generally faster. See ## @code{norm} for a full discussion of possible @var{p} values. ## @seealso{condest, rcond, norm, svd} @@ -66,7 +66,7 @@ endif endif else - retval = norm (A, p) * norm (inv (A), p); + retval = norm (A, p) * norm (inv (A), p); endif else print_usage ();
--- a/scripts/linear-algebra/condest.m +++ b/scripts/linear-algebra/condest.m @@ -17,9 +17,9 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {} condest (@var{A}) -## @deftypefnx {Function File} {} condest (@var{A}, @var{t}) -## @deftypefnx {Function File} {[@var{est}, @var{v}] =} condest (@dots{}) +## @deftypefn {Function File} {} condest (@var{A}) +## @deftypefnx {Function File} {} condest (@var{A}, @var{t}) +## @deftypefnx {Function File} {[@var{est}, @var{v}] =} condest (@dots{}) ## @deftypefnx {Function File} {[@var{est}, @var{v}] =} condest (@var{A}, @var{solve}, @var{solve_t}, @var{t}) ## @deftypefnx {Function File} {[@var{est}, @var{v}] =} condest (@var{apply}, @var{apply_t}, @var{solve}, @var{solve_t}, @var{n}, @var{t}) ## @@ -27,8 +27,8 @@ ## using @var{t} test vectors using a randomized 1-norm estimator. ## If @var{t} exceeds 5, then only 5 test vectors are used. ## -## If the matrix is not explicit, e.g., when estimating the condition -## number of @var{A} given an LU factorization, @code{condest} uses the +## If the matrix is not explicit, e.g., when estimating the condition +## number of @var{A} given an LU factorization, @code{condest} uses the ## following functions: ## ## @table @var @@ -55,15 +55,15 @@ ## (@var{v}, 1) / @var{est}}. When @var{est} is large, @var{v} is an ## approximate null vector. ## -## References: +## References: ## @itemize -## @item +## @item ## N.J. Higham and F. Tisseur, @cite{A Block Algorithm ## for Matrix 1-Norm Estimation, with an Application to 1-Norm ## Pseudospectra}. SIMAX vol 21, no 4, pp 1185-1201. ## @url{http://dx.doi.org/10.1137/S0895479899356080} ## -## @item +## @item ## N.J. Higham and F. Tisseur, @cite{A Block Algorithm ## for Matrix 1-Norm Estimation, with an Application to 1-Norm ## Pseudospectra}. @url{http://citeseer.ist.psu.edu/223007.html}
--- a/scripts/linear-algebra/cross.m +++ b/scripts/linear-algebra/cross.m @@ -29,8 +29,8 @@ ## @end group ## @end example ## -## If @var{x} and @var{y} are matrices, the cross product is applied -## along the first dimension with 3 elements. The optional argument +## If @var{x} and @var{y} are matrices, the cross product is applied +## along the first dimension with 3 elements. The optional argument ## @var{dim} forces the cross product to be calculated along ## the specified dimension. ## @seealso{dot} @@ -41,7 +41,7 @@ ## Adapted-By: jwe function z = cross (x, y, dim) - + if (nargin != 2 && nargin != 3) print_usage (); endif @@ -61,7 +61,7 @@ if (nargin == 2) dim = find (size (x) == 3, 1); - if (isempty (dim)) + if (isempty (dim)) error ("cross: must have at least one dimension with 3 elements"); endif else
--- a/scripts/linear-algebra/expm.m +++ b/scripts/linear-algebra/expm.m @@ -26,30 +26,30 @@ ## $$ ## @end tex ## @ifnottex -## +## ## @example ## expm(A) = I + A + A^2/2! + A^3/3! + @dots{} ## @end example -## +## ## @end ifnottex ## The Taylor series is @emph{not} the way to compute the matrix ## exponential; see Moler and Van Loan, @cite{Nineteen Dubious Ways to ## Compute the Exponential of a Matrix}, SIAM Review, 1978. This routine -## uses Ward's diagonal Pad@'e approximation method with three step +## uses Ward's diagonal Pad@'e approximation method with three step ## preconditioning (SIAM Journal on Numerical Analysis, 1977). Diagonal ## Pad@'e approximations are rational polynomials of matrices ## @tex ## $D_q(A)^{-1}N_q(A)$ ## @end tex ## @ifnottex -## +## ## @example ## @group ## -1 ## D (A) N (A) ## @end group ## @end example -## +## ## @end ifnottex ## whose Taylor series matches the first ## @tex
--- a/scripts/linear-algebra/isdefinite.m +++ b/scripts/linear-algebra/isdefinite.m @@ -22,7 +22,7 @@ ## Return 1 if @var{x} is symmetric positive definite within the ## tolerance specified by @var{tol} or 0 if @var{x} is symmetric ## positive semidefinite. Otherwise, return -1. If @var{tol} -## is omitted, use a tolerance of +## is omitted, use a tolerance of ## @code{100 * eps * norm (@var{x}, "fro")} ## @seealso{issymmetric, ishermitian} ## @end deftypefn
--- a/scripts/linear-algebra/krylov.m +++ b/scripts/linear-algebra/krylov.m @@ -50,7 +50,7 @@ ## to improve numerical behavior. The default value is 0. ## ## Reference: A. Hodel, P. Misra, @cite{Partial Pivoting in the Computation of -## Krylov Subspaces of Large Sparse Systems}, Proceedings of the 42nd IEEE +## Krylov Subspaces of Large Sparse Systems}, Proceedings of the 42nd IEEE ## Conference on Decision and Control, December 2003. ## @end deftypefn
--- a/scripts/linear-algebra/logm.m +++ b/scripts/linear-algebra/logm.m @@ -35,12 +35,12 @@ ## ## @end deftypefn -## Reference: N. J. Higham, Functions of Matrices: Theory and Computation +## Reference: N. J. Higham, Functions of Matrices: Theory and Computation ## (SIAM, 2008.) ## function [s, iters] = logm (A, opt_iters = 100) - + if (nargin == 0 || nargin > 2) print_usage (); endif @@ -108,8 +108,8 @@ ################## ANCILLARY FUNCTIONS ################################ ###### Taken from the mfttoolbox (GPL 3) by D. Higham. -###### Reference: -###### D. Higham, Functions of Matrices: Theory and Computation +###### Reference: +###### D. Higham, Functions of Matrices: Theory and Computation ###### (SIAM, 2008.). #######################################################################
--- a/scripts/linear-algebra/normest.m +++ b/scripts/linear-algebra/normest.m @@ -39,11 +39,11 @@ if (! (isnumeric (A) && ndims (A) == 2)) error ("normest: A must be a numeric 2-D matrix"); - endif + endif if (! (isscalar (tol) && isreal (tol))) error ("normest: TOL must be a real scalar"); - endif + endif if (! isfloat (A)) A = double (A);
--- a/scripts/linear-algebra/onenormest.m +++ b/scripts/linear-algebra/onenormest.m @@ -17,18 +17,18 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{est}, @var{v}, @var{w}, @var{iter}] =} onenormest (@var{A}, @var{t}) +## @deftypefn {Function File} {[@var{est}, @var{v}, @var{w}, @var{iter}] =} onenormest (@var{A}, @var{t}) ## @deftypefnx {Function File} {[@var{est}, @var{v}, @var{w}, @var{iter}] =} onenormest (@var{apply}, @var{apply_t}, @var{n}, @var{t}) ## ## Apply Higham and Tisseur's randomized block 1-norm estimator to ## matrix @var{A} using @var{t} test vectors. If @var{t} exceeds 5, then ## only 5 test vectors are used. ## -## If the matrix is not explicit, e.g., when estimating the norm of -## @code{inv (@var{A})} given an LU factorization, @code{onenormest} applies -## @var{A} and its conjugate transpose through a pair of functions -## @var{apply} and @var{apply_t}, respectively, to a dense matrix of size -## @var{n} by @var{t}. The implicit version requires an explicit dimension +## If the matrix is not explicit, e.g., when estimating the norm of +## @code{inv (@var{A})} given an LU factorization, @code{onenormest} applies +## @var{A} and its conjugate transpose through a pair of functions +## @var{apply} and @var{apply_t}, respectively, to a dense matrix of size +## @var{n} by @var{t}. The implicit version requires an explicit dimension ## @var{n}. ## ## Returns the norm estimate @var{est}, two vectors @var{v} and @@ -37,7 +37,7 @@ ## and the number of iterations @var{iter}. The number of ## iterations is limited to 10 and is at least 2. ## -## References: +## References: ## @itemize ## @item ## N.J. Higham and F. Tisseur, @cite{A Block Algorithm @@ -198,7 +198,7 @@ replacements = 2*(rand (n,numpar) < 0.5) - 1; S(:,partest) = replacements; endif - + Z = feval (apply_t, S); ## Now find the largest non-previously-visted index per
--- a/scripts/linear-algebra/rref.m +++ b/scripts/linear-algebra/rref.m @@ -23,7 +23,7 @@ ## to @code{eps * max (size (@var{A})) * norm (@var{A}, inf)}. ## ## Called with two return arguments, @var{k} returns the vector of -## "bound variables", which are those columns on which elimination +## "bound variables", which are those columns on which elimination ## has been performed. ## ## @end deftypefn
--- a/scripts/linear-algebra/subspace.m +++ b/scripts/linear-algebra/subspace.m @@ -26,8 +26,8 @@ ## reference: ## [1] Andrew V. Knyazev, Merico E. Argentati: -## Principal Angles between Subspaces in an A-Based Scalar Product: -## Algorithms and Perturbation Estimates. +## Principal Angles between Subspaces in an A-Based Scalar Product: +## Algorithms and Perturbation Estimates. ## SIAM Journal on Scientific Computing, Vol. 23 no. 6, pp. 2008-2040 ## ## other texts are also around...
--- a/scripts/miscellaneous/ans.m +++ b/scripts/miscellaneous/ans.m @@ -20,11 +20,11 @@ ## @defvr {Automatic Variable} ans ## The most recently computed result that was not ## explicitly assigned to a variable. For example, after the expression -## +## ## @example ## 3^2 + 4^2 ## @end example -## +## ## @noindent ## is evaluated, the value returned by @code{ans} is 25. ## @end defvr
--- a/scripts/miscellaneous/bincoeff.m +++ b/scripts/miscellaneous/bincoeff.m @@ -73,7 +73,7 @@ ind = (! (k >= 0) | (k != real (round (k))) | isnan (n)); b(ind) = NaN; - + ind = (k == 0); b(ind) = 1;
--- a/scripts/miscellaneous/bunzip2.m +++ b/scripts/miscellaneous/bunzip2.m @@ -1,5 +1,5 @@ ## Copyright (C) 2006-2011 Bill Denney -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it
--- a/scripts/miscellaneous/bzip2.m +++ b/scripts/miscellaneous/bzip2.m @@ -22,8 +22,8 @@ ## @deftypefnx {Function File} {@var{entries} =} bzip2 (@var{files}, @var{outdir}) ## Compress the list of files specified in @var{files}. ## Each file is compressed separately and a new file with a '.bz2' extension -## is created. The original files are not touched. Existing compressed files -## are silently overwritten.If @var{outdir} is defined the compressed versions +## is created. The original files are not touched. Existing compressed files +## are silently overwritten.If @var{outdir} is defined the compressed versions ## of the files are placed in this directory. ## @seealso{bunzip2, gzip, zip, tar} ## @end deftypefn @@ -35,7 +35,7 @@ __xzip__ ("bzip2", "bz2", "bzip2 %s", varargin{:}); else entries = __xzip__ ("bzip2", "bz2", "bzip2 %s", varargin{:}); - endif + endif else print_usage (); endif
--- a/scripts/miscellaneous/computer.m +++ b/scripts/miscellaneous/computer.m @@ -68,7 +68,7 @@ endian = "L"; else endian = "?"; - endif + endif endif endfunction
--- a/scripts/miscellaneous/copyfile.m +++ b/scripts/miscellaneous/copyfile.m @@ -74,7 +74,7 @@ if (length(f1) > 1 && ! isdir) error ("copyfile: when copying multiple files, second argument must be a directory"); endif - + ## Protect the file name(s). f1 = glob (f1); if (isempty (f1)) @@ -88,11 +88,11 @@ while (! isempty(f1)) p1 = sprintf ("\"%s\" ", f1{1}); f1(1) = []; - while (!isempty (f1) && (length(p1) + length(f1{1}) + l2 < + while (!isempty (f1) && (length(p1) + length(f1{1}) + l2 < max_cmd_line)) p1 = sprintf ("%s\"%s\" ", p1, f1{1}); f1(1) = []; - endwhile + endwhile if (ispc () && ! isunix () && ! isempty (file_in_path (getenv ("PATH"), "cp.exe")))
--- a/scripts/miscellaneous/debug.m +++ b/scripts/miscellaneous/debug.m @@ -64,7 +64,7 @@ ## ## @item debug_on_interrupt ## Flag whether to enter debug mode in case Octave encounters an interupt. -## +## ## @end table ## ## @noindent
--- a/scripts/miscellaneous/edit.m +++ b/scripts/miscellaneous/edit.m @@ -24,22 +24,22 @@ ## ## If @code{edit} is called with the name of a file or function as ## its argument it will be opened in a text editor. -## +## ## @itemize @bullet ## @item ## If the function @var{name} is available in a file on your path and -## that file is modifiable, then it will be edited in place. If it +## that file is modifiable, then it will be edited in place. If it ## is a system function, then it will first be copied to the directory -## @env{HOME} (see further down) and then edited. -## If no file is found, then the m-file +## @env{HOME} (see further down) and then edited. +## If no file is found, then the m-file ## variant, ending with ".m", will be considered. If still no file ## is found, then variants with a leading "@@" and then with both a ## leading "@@" and trailing ".m" will be considered. ## ## @item -## If @var{name} is the name of a function defined in the interpreter but +## If @var{name} is the name of a function defined in the interpreter but ## not in an m-file, then an m-file will be created in @env{HOME} -## to contain that function along with its current definition. +## to contain that function along with its current definition. ## ## @item ## If @code{name.cc} is specified, then it will search for @code{name.cc} @@ -63,7 +63,7 @@ ## the value of the control field @var{field} will be @var{value}. ## If an output argument is requested and the first argument is @code{get} ## then @code{edit} will return the value of the control field @var{field}. -## If the control field does not exist, edit will return a structure +## If the control field does not exist, edit will return a structure ## containing all fields and values. Thus, @code{edit get all} returns ## a complete control structure. ## The following control fields are used: @@ -71,22 +71,22 @@ ## @table @samp ## @item editor ## This is the editor to use to modify the functions. By default it uses -## Octave's @env{EDITOR} built-in function, which comes from +## Octave's @env{EDITOR} built-in function, which comes from ## @code{getenv("EDITOR")} and defaults to @code{emacs}. Use @code{%s} ## In place of the function name. For example, ## @table @samp ## @item [EDITOR, " %s"] ## Use the editor which Octave uses for @code{bug_report}. ## -## @item "xedit %s &" +## @item "xedit %s &" ## pop up simple X11 editor in a separate window ## -## @item "gnudoit -q \"(find-file \\\"%s\\\")\"" +## @item "gnudoit -q \"(find-file \\\"%s\\\")\"" ## Send it to current Emacs; must have @code{(gnuserv-start)} in @file{.emacs}. ## @end table ## ## See also field 'mode', which controls how the editor is run by Octave. -## +## ## On Cygwin, you will need to convert the Cygwin path to a Windows ## path if you are using a native Windows editor. For example: ## @c Set example in small font to prevent overfull line in TeX @@ -102,7 +102,7 @@ ## @item author ## This is the name to put after the "## Author:" field of new functions. ## By default it guesses from the @code{gecos} field of password database. -## +## ## @item email ## This is the e-mail address to list after the name in the author field. ## By default it guesses @code{<$LOGNAME@@$HOSTNAME>}, and if @code{$HOSTNAME} @@ -123,10 +123,10 @@ ## @item "text" ## Your own default copyright and license. ## @end table -## -## Unless you specify @samp{pd}, edit will prepend the copyright statement +## +## Unless you specify @samp{pd}, edit will prepend the copyright statement ## with "Copyright (C) yyyy Function Author". -## +## ## @item mode ## This value determines whether the editor should be started in async mode ## (editor is started in the background and Octave continues) or sync mode @@ -134,7 +134,7 @@ ## in async mode. The default is "sync" (see also "system"). ## ## @item editinplace -## Determines whether files should be edited in place, without regard to +## Determines whether files should be edited in place, without regard to ## whether they are modifiable or not. The default is @code{false}. ## @end table ## @end deftypefn @@ -235,7 +235,7 @@ ## This functionality is needed for other functions as well (at least ## help and type; there may be more). So the place to fix that is in ## file_in_loadpath, possibly with some help from the load_path class. - + ## The code below includes a portion that serves as a place-holder for ## the changes suggested above.
--- a/scripts/miscellaneous/getappdata.m +++ b/scripts/miscellaneous/getappdata.m @@ -1,15 +1,15 @@ ## Copyright (C) 2010-2011 Ben Abbott -## +## ## This program 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 2 of the License, or ## (at your option) any later version. -## +## ## This program 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 ## <http://www.gnu.org/licenses/>.
--- a/scripts/miscellaneous/getfield.m +++ b/scripts/miscellaneous/getfield.m @@ -18,7 +18,7 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{v1}, @dots{}] =} getfield (@var{s}, @var{key}, @dots{}) +## @deftypefn {Function File} {[@var{v1}, @dots{}] =} getfield (@var{s}, @var{key}, @dots{}) ## Extract a field from a structure (or a nested structure). For example: ## ## @example @@ -37,7 +37,7 @@ ## i1 = @{1,2@}; i2 = "fd"; i3 = @{3@}; i4= "b"; ## ss(i1@{:@}).(i2)(i3@{:@}).(i4) ## @result{} ans = 5 -## +## ## @end group ## @end example ## @seealso{setfield, rmfield, isfield, isstruct, fieldnames, struct}
--- a/scripts/miscellaneous/gunzip.m +++ b/scripts/miscellaneous/gunzip.m @@ -1,5 +1,5 @@ ## Copyright (C) 2006-2011 Bill Denney -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it
--- a/scripts/miscellaneous/gzip.m +++ b/scripts/miscellaneous/gzip.m @@ -22,7 +22,7 @@ ## Compress the list of files and/or directories specified in @var{files}. ## Each file is compressed separately and a new file with a '.gz' extension ## is created. The original files are not touched. Existing compressed -## files are silently overwritten. If @var{outdir} is defined the compressed +## files are silently overwritten. If @var{outdir} is defined the compressed ## versions of the files are placed in this directory. ## @seealso{gunzip, bzip2, zip, tar} ## @end deftypefn @@ -58,7 +58,7 @@ %! endif %! if ! exist(entry, "file") %! error("gzipped file cannot be found!"); -%! endif +%! endif %! gunzip(entry); %! if (system(sprintf("diff %s %s%c%s%s", filename, dirname, filesep, %! basename, extension)))
--- a/scripts/miscellaneous/isappdata.m +++ b/scripts/miscellaneous/isappdata.m @@ -1,15 +1,15 @@ ## Copyright (C) 2010-2011 Ben Abbott -## +## ## This program 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 2 of the License, or ## (at your option) any later version. -## +## ## This program 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 ## <http://www.gnu.org/licenses/>. @@ -17,7 +17,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{V} =} isappdata (@var{h}, @var{name}) ## Return true if the named application data, @var{name}, exists for the -## object with handle @var{h}. +## object with handle @var{h}. ## @seealso{getappdata, setappdata, rmappdata} ## @end deftypefn
--- a/scripts/miscellaneous/ls.m +++ b/scripts/miscellaneous/ls.m @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Command} {} ls options ## List directory contents. For example: -## +## ## @example ## @group ## ls -l @@ -28,7 +28,7 @@ ## @print{} -rw-r--r-- 1 jwe users 1315 Aug 17 23:14 bar.m ## @end group ## @end example -## +## ## The @code{dir} and @code{ls} commands are implemented by calling your ## system's directory listing command, so the available options may vary ## from system to system. @@ -72,7 +72,7 @@ ## we won't have to buffer all the output. system (cmd); endif - + else error ("ls: expecting all arguments to be character strings"); endif
--- a/scripts/miscellaneous/mkoctfile.m +++ b/scripts/miscellaneous/mkoctfile.m @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Command} {} mkoctfile [-options] file @dots{} -## +## ## The @code{mkoctfile} function compiles source code written in C, ## C++, or Fortran. Depending on the options used with @code{mkoctfile}, the ## compiled code can be called within Octave or can be used as a stand-alone @@ -39,12 +39,12 @@ ## ## @item -l LIB ## Add the library LIB to the link command. -## +## ## @item -L DIR ## Add the library directory DIR to the link command. ## ## @item -M -## @itemx --depend +## @itemx --depend ## Generate dependency files (.d) for C and C++ source files. ## ## @item -R DIR @@ -65,35 +65,35 @@ ## Enable debugging options for compilers. ## ## @item -o FILE -## @itemx --output FILE +## @itemx --output FILE ## Output file name. Default extension is .oct ## (or .mex if --mex is specified) unless linking ## a stand-alone executable. ## ## @item -p VAR ## @itemx --print VAR -## Print the configuration variable VAR@. Recognized variables are: +## Print the configuration variable VAR@. Recognized variables are: ## -## @example -## ALL_CFLAGS FFTW_LIBS -## ALL_CXXFLAGS FLIBS -## ALL_FFLAGS FPICFLAG -## ALL_LDFLAGS INCFLAGS -## BLAS_LIBS LDFLAGS -## CC LD_CXX +## @example +## ALL_CFLAGS FFTW_LIBS +## ALL_CXXFLAGS FLIBS +## ALL_FFLAGS FPICFLAG +## ALL_LDFLAGS INCFLAGS +## BLAS_LIBS LDFLAGS +## CC LD_CXX ## CFLAGS LD_STATIC_FLAG -## CPICFLAG LFLAGS -## CPPFLAGS LIBCRUFT -## CXX LIBOCTAVE -## CXXFLAGS LIBOCTINTERP -## CXXPICFLAG LIBREADLINE -## DEPEND_EXTRA_SED_PATTERN LIBS -## DEPEND_FLAGS OCTAVE_LIBS -## DL_LD RDYNAMIC_FLAG -## DL_LDFLAGS RLD_FLAG -## F2C SED -## F2CFLAGS XTRA_CFLAGS -## F77 XTRA_CXXFLAGS +## CPICFLAG LFLAGS +## CPPFLAGS LIBCRUFT +## CXX LIBOCTAVE +## CXXFLAGS LIBOCTINTERP +## CXXPICFLAG LIBREADLINE +## DEPEND_EXTRA_SED_PATTERN LIBS +## DEPEND_FLAGS OCTAVE_LIBS +## DL_LD RDYNAMIC_FLAG +## DL_LDFLAGS RLD_FLAG +## F2C SED +## F2CFLAGS XTRA_CFLAGS +## F77 XTRA_CXXFLAGS ## FFLAGS ## @end example ## @@ -101,7 +101,7 @@ ## Link a stand-alone executable file. ## ## @item --mex -## Assume we are creating a MEX file. Set the default output extension +## Assume we are creating a MEX file. Set the default output extension ## to ".mex". ## ## @item -s @@ -143,7 +143,7 @@ for i = 1:nargin cmd = cstrcat (cmd, " \"", varargin{i}, "\""); endfor - + status = system (cmd); if (status == 127)
--- a/scripts/miscellaneous/movefile.m +++ b/scripts/miscellaneous/movefile.m @@ -67,13 +67,13 @@ if (ischar (f1)) f1 = cellstr (f1); endif - + ## If f1 has more than 1 element f2 must be a directory isdir = (exist (f2, "dir") != 0); if (length(f1) > 1 && ! isdir) error ("movefile: when moving multiple files, second argument must be a directory"); endif - + ## Protect the file name(s). f1 = glob (f1); if (isempty (f1)) @@ -87,11 +87,11 @@ while (! isempty(f1)) p1 = sprintf ("\"%s\" ", f1{1}); f1(1) = []; - while (!isempty (f1) && (length(p1) + length(f1{1}) + l2 < + while (!isempty (f1) && (length(p1) + length(f1{1}) + l2 < max_cmd_line)) p1 = sprintf ("%s\"%s\" ", p1, f1{1}); f1(1) = []; - endwhile + endwhile if (ispc () && ! isunix () && ! isempty (file_in_path (getenv ("PATH"), "cp.exe")))
--- a/scripts/miscellaneous/namelengthmax.m +++ b/scripts/miscellaneous/namelengthmax.m @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} namelengthmax () ## Returns the @sc{matlab} compatible maximum variable name length. Octave is -## capable of storing strings up to +## capable of storing strings up to ## @tex ## $2^{31} - 1$ ## @end tex
--- a/scripts/miscellaneous/orderfields.m +++ b/scripts/miscellaneous/orderfields.m @@ -39,7 +39,7 @@ ## @group ## s = struct("d", 4, "b", 2, "a", 1, "c", 3); ## t1 = orderfields(s) -## @result{} t1 = +## @result{} t1 = ## @{ ## a = 1 ## b = 2
--- a/scripts/miscellaneous/private/__xzip__.m +++ b/scripts/miscellaneous/private/__xzip__.m @@ -22,22 +22,22 @@ ## Undocumented internal function. ## @end deftypefn -## Compress the list of files and/or directories specified in @var{files} -## with the external compression command @var{commandname}. The template +## Compress the list of files and/or directories specified in @var{files} +## with the external compression command @var{commandname}. The template ## @var{commandtemplate} is used to actually start the command. Each file -## is compressed separately and a new file with the extension @var{extension} -## is created and placed into the directory @var{outdir}. The original files -## are not touched. Existing compressed files are silently overwritten. +## is compressed separately and a new file with the extension @var{extension} +## is created and placed into the directory @var{outdir}. The original files +## are not touched. Existing compressed files are silently overwritten. ## This is an internal function. Do not use directly. -function entries = __xzip__ (commandname, extension, +function entries = __xzip__ (commandname, extension, commandtemplate, files, outdir) if (nargin == 4 || nargin == 5) if (! ischar (extension) || length (extension) == 0) error ("__xzip__: EXTENSION has to be a string with finite length"); endif - + if (nargin == 5 && ! exist (outdir, "dir")) error ("__xzip__: output directory does not exist"); endif @@ -58,8 +58,8 @@ files = glob (files); ## Ignore any file with the compress extension - files (cellfun (@(x) length(x) > length(extension) - && strcmp (x((end - length(extension) + 1):end), extension), + files (cellfun (@(x) length(x) > length(extension) + && strcmp (x((end - length(extension) + 1):end), extension), files)) = []; copyfile (files, outdir); @@ -75,14 +75,14 @@ if (nargin == 5) compressed_files = cellfun( - @(x) fullfile (outdir, sprintf ("%s.%s", x, extension)), + @(x) fullfile (outdir, sprintf ("%s.%s", x, extension)), f, "uniformoutput", false); else - movefile (cellfun(@(x) sprintf ("%s.%s", x, extension), f, + movefile (cellfun(@(x) sprintf ("%s.%s", x, extension), f, "uniformoutput", false), cwd); ## FIXME this does not work when you try to compress directories - compressed_files = cellfun(@(x) sprintf ("%s.%s", x, extension), + compressed_files = cellfun(@(x) sprintf ("%s.%s", x, extension), files, "uniformoutput", false); endif @@ -114,7 +114,7 @@ function [d, f] = myfileparts (files) [d, f, ext] = cellfun (@(x) fileparts (x), files, "uniformoutput", false); f = cellfun (@(x, y) sprintf ("%s%s", x, y), f, ext, - "uniformoutput", false); + "uniformoutput", false); idx = cellfun (@isdir, files); d(idx) = ""; f(idx) = files(idx); @@ -123,7 +123,7 @@ ## FIXME -- reinstate these tests if we invent a way to test private ## functions directly. ## -## %!error <extension has to be a string with finite length> +## %!error <extension has to be a string with finite length> ## %! __xzip__("gzip", "", "gzip -r %s", "bla"); ## %!error <no files to move> ## %! __xzip__("gzip", ".gz", "gzip -r %s", tmpnam); @@ -135,7 +135,7 @@ ## %! save(filename, "dummy"); ## %! dirname = tmpnam; ## %! mkdir(dirname); -## %! entry = __xzip__("gzip", ".gz", "xxxzipxxx -r %s 2>/dev/null", +## %! entry = __xzip__("gzip", ".gz", "xxxzipxxx -r %s 2>/dev/null", ## %! filename, dirname); ## %! unwind_protect_cleanup ## %! delete(filename);
--- a/scripts/miscellaneous/rmappdata.m +++ b/scripts/miscellaneous/rmappdata.m @@ -1,15 +1,15 @@ ## Copyright (C) 2010-2011 Ben Abbott -## +## ## This program 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 2 of the License, or ## (at your option) any later version. -## +## ## This program 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 ## <http://www.gnu.org/licenses/>.
--- a/scripts/miscellaneous/setappdata.m +++ b/scripts/miscellaneous/setappdata.m @@ -1,15 +1,15 @@ ## Copyright (C) 2010-2011 Ben Abbott -## +## ## This program 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 2 of the License, or ## (at your option) any later version. -## +## ## This program 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 ## <http://www.gnu.org/licenses/>.
--- a/scripts/miscellaneous/substruct.m +++ b/scripts/miscellaneous/substruct.m @@ -37,7 +37,7 @@ ## @} ## x = [1, 2, 3; 4, 5, 6; 7, 8, 9]; ## subsref(x, idx) -## @result{} ans = +## @result{} ans = ## 7 8 9 ## @end group ## @end example
--- a/scripts/miscellaneous/swapbytes.m +++ b/scripts/miscellaneous/swapbytes.m @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} swapbytes (@var{x}) -## Swaps the byte order on values, converting from little endian to big +## Swaps the byte order on values, converting from little endian to big ## endian and vice versa. For example: ## ## @example
--- a/scripts/miscellaneous/tar.m +++ b/scripts/miscellaneous/tar.m @@ -1,5 +1,5 @@ ## Copyright (C) 2005-2011 Søren Hauberg -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -62,7 +62,7 @@ else error ("tar: tar exited with status = %d", status); endif - + else error ("tar: expecting all arguments to be character strings"); endif
--- a/scripts/miscellaneous/unimplemented.m +++ b/scripts/miscellaneous/unimplemented.m @@ -33,7 +33,7 @@ txt = ["quad2d is not implemented. Consider using dblquad."]; case "gsvd" - txt = ["gsvd is not currently part of Octave. See the linear-algebra",... + txt = ["gsvd is not currently part of Octave. See the linear-algebra",... "package at @url{http://octave.sf.net/linear-algebra/}."]; case "linprog" @@ -46,7 +46,7 @@ "For more information try @code{help lsode}. ",... "Matlab-compatible ODE functions are provided by the odepkg package. ",... "See @url{http://octave.sf.net/odepkg/}."]; - + otherwise if (ismember (fcn, missing_functions ())) txt = sprintf ("the `%s' function is not yet implemented in Octave", fcn); @@ -71,361 +71,361 @@ function list = missing_functions () persistent list = { - "DelaunayTri", - "MException", - "RandStream", - "TriRep", - "TriScatteredInterp", - "addpref", - "align", - "alim", - "alpha", - "alphamap", - "annotation", - "audiodevinfo", - "audioplayer", - "audiorecorder", - "aufinfo", - "auread", - "auwrite", - "avifile", - "aviinfo", - "aviread", - "bar3", - "bar3h", - "bench", - "betaincinv", - "bicg", - "bicgstabl", - "brush", - "builddocsearchdb", - "bvp4c", - "bvp5c", - "bvpget", - "bvpinit", - "bvpset", - "bvpxtend", - "callSoapService", - "calllib", - "camdolly", - "cameratoolbar", - "camlight", - "camlookat", - "camorbit", - "campan", - "campos", - "camproj", - "camroll", - "camtarget", - "camup", - "camva", - "camzoom", - "cdf2rdf", - "cdfepoch", - "cdfinfo", - "cdfread", - "cdfwrite", - "cellplot", - "checkin", - "checkout", - "cholinc", - "clearvars", - "clipboard", - "cmopts", - "cmpermute", - "cmunique", - "colordef", - "colormapeditor", - "commandhistory", - "commandwindow", - "condeig", - "coneplot", - "contourslice", - "copyobj", - "createClassFromWsdl", - "createSoapMessage", - "customverctrl", - "daqread", - "datacursormode", - "datatipinfo", - "dbmex", - "dde23", - "ddeget", - "ddesd", - "ddeset", - "decic", - "depdir", - "depfun", - "deval", - "dialog", - "dither", - "docopt", - "docsearch", - "dragrect", - "dynamicprops", - "echodemo", - "ellipj", - "ellipke", - "erfcinv", - "errordlg", - "evalc", - "exifread", - "expint", - "export2wsdlg", - "figurepalette", - "filebrowser", - "fill3", - "findfigs", - "fitsinfo", - "fitsread", - "flow", - "fminsearch", - "frame2im", - "freqspace", - "funm", - "gallery", - "gammaincinv", - "gco", - "getframe", - "getpixelposition", - "getpref", - "gmres", - "grabcode", - "graymon", - "gsvd", - "guidata", - "guide", - "guihandles", - "handle", - "hdf", - "hdf5", - "hdf5info", - "hdf5read", - "hdf5write", - "hdfinfo", - "hdfread", - "hdftool", - "helpbrowser", - "helpdesk", - "helpdlg", - "helpwin", - "hgexport", - "hgload", - "hgsave", - "hgsetget", - "hgtransform", - "hostid", - "ilu", - "im2frame", - "im2java", - "imapprox", - "imformats", - "import", - "importdata", - "inmem", - "inputParser", - "inputdlg", - "inspect", - "instrfind", - "instrfindall", - "interpstreamspeed", - "iscom", - "isinterface", - "isjava", - "isocaps", - "ispref", - "isstudent", - "javaArray", - "javaMethod", - "javaMethodEDT", - "javaObject", - "javaObjectEDT", - "javaaddpath", - "javachk", - "javaclasspath", - "javarmpath", - "ldl", - "libfunctions", - "libfunctionsview", - "libisloaded", - "libpointer", - "libstruct", - "light", - "lightangle", - "lighting", - "linkaxes", - "linkdata", - "linsolve", - "listdlg", - "listfonts", - "loadlibrary", - "lscov", - "lsqr", - "makehgtform", - "material", - "matlabrc", - "maxNumCompThreads", - "memmapfile", - "memory", - "metaclass", - "methodsview", - "minres", - "mlint", - "mlintrpt", - "mmfileinfo", - "mmreader", - "movegui", - "movie", - "movie2avi", - "msgbox", - "multibandread", - "multibandwrite", - "native2unicode", - "noanimate", - "ode113", - "ode15i", - "ode15s", - "ode23", - "ode23s", - "ode23t", - "ode23tb", - "ode45", - "odefile", - "odeget", - "odeset", - "odextend", - "open", - "openfig", - "opengl", - "openvar", - "ordeig", - "ordqz", - "ordschur", - "padecoef", - "pagesetupdlg", - "pan", - "parseSoapResponse", - "path2rc", - "pathtool", - "pcode", - "pdepe", - "pdeval", - "playshow", - "plotbrowser", - "plotedit", - "plottools", - "polyeig", - "prefdir", - "preferences", - "printdlg", - "printopt", - "printpreview", - "profile", - "profsave", - "propedit", - "propertyeditor", - "publish", - "qmr", - "quad2d", - "questdlg", - "rbbox", - "rectangle", - "recycle", - "reducepatch", - "reducevolume", - "resample", - "reset", - "rgbplot", - "rmpref", - "root", - "rotate", - "rotate3d", - "rsf2csf", - "selectmoveresize", - "sendmail", - "serial", - "setpixelposition", - "setpref", - "showplottool", - "shrinkfaces", - "smooth3", - "snapnow", - "sound", - "soundsc", - "ss2tf", - "stream2", - "stream3", - "streamline", - "streamparticles", - "streamribbon", - "streamslice", - "streamtube", - "strings", - "subvolume", - "superclasses", - "support", - "surf2patch", - "symmlq", - "syntax", - "tetramesh", - "texlabel", - "textwrap", - "tfqmr", - "timer", - "timerfind", - "timerfindall", - "timeseries", - "toolboxdir", - "tscollection", - "tstool", - "uibuttongroup", - "uicontextmenu", - "uicontrol", - "uigetpref", - "uiimport", - "uiopen", - "uipanel", - "uipushtool", - "uiresume", - "uisave", - "uisetcolor", - "uisetfont", - "uisetpref", - "uistack", - "uitable", - "uitoggletool", - "uitoolbar", - "uiwait", - "undocheckout", - "unicode2native", - "unloadlibrary", - "unmesh", - "usejava", - "userpath", - "validateattributes", - "verLessThan", - "viewmtx", - "visdiff", - "volumebounds", - "waitbar", - "waitfor", - "warndlg", - "waterfall", - "wavfinfo", - "wavplay", - "wavrecord", - "web", - "whatsnew", - "wk1finfo", - "wk1read", - "wk1write", - "workspace", - "xlsfinfo", - "xlsread", - "xlswrite", - "xmlread", - "xmlwrite", - "xslt", + "DelaunayTri", + "MException", + "RandStream", + "TriRep", + "TriScatteredInterp", + "addpref", + "align", + "alim", + "alpha", + "alphamap", + "annotation", + "audiodevinfo", + "audioplayer", + "audiorecorder", + "aufinfo", + "auread", + "auwrite", + "avifile", + "aviinfo", + "aviread", + "bar3", + "bar3h", + "bench", + "betaincinv", + "bicg", + "bicgstabl", + "brush", + "builddocsearchdb", + "bvp4c", + "bvp5c", + "bvpget", + "bvpinit", + "bvpset", + "bvpxtend", + "callSoapService", + "calllib", + "camdolly", + "cameratoolbar", + "camlight", + "camlookat", + "camorbit", + "campan", + "campos", + "camproj", + "camroll", + "camtarget", + "camup", + "camva", + "camzoom", + "cdf2rdf", + "cdfepoch", + "cdfinfo", + "cdfread", + "cdfwrite", + "cellplot", + "checkin", + "checkout", + "cholinc", + "clearvars", + "clipboard", + "cmopts", + "cmpermute", + "cmunique", + "colordef", + "colormapeditor", + "commandhistory", + "commandwindow", + "condeig", + "coneplot", + "contourslice", + "copyobj", + "createClassFromWsdl", + "createSoapMessage", + "customverctrl", + "daqread", + "datacursormode", + "datatipinfo", + "dbmex", + "dde23", + "ddeget", + "ddesd", + "ddeset", + "decic", + "depdir", + "depfun", + "deval", + "dialog", + "dither", + "docopt", + "docsearch", + "dragrect", + "dynamicprops", + "echodemo", + "ellipj", + "ellipke", + "erfcinv", + "errordlg", + "evalc", + "exifread", + "expint", + "export2wsdlg", + "figurepalette", + "filebrowser", + "fill3", + "findfigs", + "fitsinfo", + "fitsread", + "flow", + "fminsearch", + "frame2im", + "freqspace", + "funm", + "gallery", + "gammaincinv", + "gco", + "getframe", + "getpixelposition", + "getpref", + "gmres", + "grabcode", + "graymon", + "gsvd", + "guidata", + "guide", + "guihandles", + "handle", + "hdf", + "hdf5", + "hdf5info", + "hdf5read", + "hdf5write", + "hdfinfo", + "hdfread", + "hdftool", + "helpbrowser", + "helpdesk", + "helpdlg", + "helpwin", + "hgexport", + "hgload", + "hgsave", + "hgsetget", + "hgtransform", + "hostid", + "ilu", + "im2frame", + "im2java", + "imapprox", + "imformats", + "import", + "importdata", + "inmem", + "inputParser", + "inputdlg", + "inspect", + "instrfind", + "instrfindall", + "interpstreamspeed", + "iscom", + "isinterface", + "isjava", + "isocaps", + "ispref", + "isstudent", + "javaArray", + "javaMethod", + "javaMethodEDT", + "javaObject", + "javaObjectEDT", + "javaaddpath", + "javachk", + "javaclasspath", + "javarmpath", + "ldl", + "libfunctions", + "libfunctionsview", + "libisloaded", + "libpointer", + "libstruct", + "light", + "lightangle", + "lighting", + "linkaxes", + "linkdata", + "linsolve", + "listdlg", + "listfonts", + "loadlibrary", + "lscov", + "lsqr", + "makehgtform", + "material", + "matlabrc", + "maxNumCompThreads", + "memmapfile", + "memory", + "metaclass", + "methodsview", + "minres", + "mlint", + "mlintrpt", + "mmfileinfo", + "mmreader", + "movegui", + "movie", + "movie2avi", + "msgbox", + "multibandread", + "multibandwrite", + "native2unicode", + "noanimate", + "ode113", + "ode15i", + "ode15s", + "ode23", + "ode23s", + "ode23t", + "ode23tb", + "ode45", + "odefile", + "odeget", + "odeset", + "odextend", + "open", + "openfig", + "opengl", + "openvar", + "ordeig", + "ordqz", + "ordschur", + "padecoef", + "pagesetupdlg", + "pan", + "parseSoapResponse", + "path2rc", + "pathtool", + "pcode", + "pdepe", + "pdeval", + "playshow", + "plotbrowser", + "plotedit", + "plottools", + "polyeig", + "prefdir", + "preferences", + "printdlg", + "printopt", + "printpreview", + "profile", + "profsave", + "propedit", + "propertyeditor", + "publish", + "qmr", + "quad2d", + "questdlg", + "rbbox", + "rectangle", + "recycle", + "reducepatch", + "reducevolume", + "resample", + "reset", + "rgbplot", + "rmpref", + "root", + "rotate", + "rotate3d", + "rsf2csf", + "selectmoveresize", + "sendmail", + "serial", + "setpixelposition", + "setpref", + "showplottool", + "shrinkfaces", + "smooth3", + "snapnow", + "sound", + "soundsc", + "ss2tf", + "stream2", + "stream3", + "streamline", + "streamparticles", + "streamribbon", + "streamslice", + "streamtube", + "strings", + "subvolume", + "superclasses", + "support", + "surf2patch", + "symmlq", + "syntax", + "tetramesh", + "texlabel", + "textwrap", + "tfqmr", + "timer", + "timerfind", + "timerfindall", + "timeseries", + "toolboxdir", + "tscollection", + "tstool", + "uibuttongroup", + "uicontextmenu", + "uicontrol", + "uigetpref", + "uiimport", + "uiopen", + "uipanel", + "uipushtool", + "uiresume", + "uisave", + "uisetcolor", + "uisetfont", + "uisetpref", + "uistack", + "uitable", + "uitoggletool", + "uitoolbar", + "uiwait", + "undocheckout", + "unicode2native", + "unloadlibrary", + "unmesh", + "usejava", + "userpath", + "validateattributes", + "verLessThan", + "viewmtx", + "visdiff", + "volumebounds", + "waitbar", + "waitfor", + "warndlg", + "waterfall", + "wavfinfo", + "wavplay", + "wavrecord", + "web", + "whatsnew", + "wk1finfo", + "wk1read", + "wk1write", + "workspace", + "xlsfinfo", + "xlsread", + "xlswrite", + "xmlread", + "xmlwrite", + "xslt", "zoom", }; endfunction
--- a/scripts/miscellaneous/unpack.m +++ b/scripts/miscellaneous/unpack.m @@ -1,5 +1,5 @@ ## Copyright (C) 2006-2011 Bill Denney -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -140,7 +140,7 @@ endif nodotext = ext(! ismember (ext, ".")); - + origdir = pwd (); if (isfield (commandlist, nodotext))
--- a/scripts/miscellaneous/untar.m +++ b/scripts/miscellaneous/untar.m @@ -1,5 +1,5 @@ ## Copyright (C) 2005-2011 Søren Hauberg -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it
--- a/scripts/miscellaneous/unzip.m +++ b/scripts/miscellaneous/unzip.m @@ -1,5 +1,5 @@ ## Copyright (C) 2005-2011 Søren Hauberg -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it
--- a/scripts/miscellaneous/ver.m +++ b/scripts/miscellaneous/ver.m @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} ver () ## Display a header containing the current Octave version -## number, license string and operating system, followed by +## number, license string and operating system, followed by ## the installed package names, versions, and installation ## directories. ## @deftypefnx {Function File} {v =} ver ()
--- a/scripts/miscellaneous/warning_ids.m +++ b/scripts/miscellaneous/warning_ids.m @@ -23,84 +23,84 @@ ## warn when an implicit conversion from an array to a scalar value is ## attempted. By default, the @code{Octave:array-to-scalar} warning is ## disabled. -## +## ## @item Octave:array-to-vector ## If the @code{Octave:array-to-vector} warning is enabled, Octave will ## warn when an implicit conversion from an array to a vector value is ## attempted. By default, the @code{Octave:array-to-vector} warning is ## disabled. -## +## ## @item Octave:assign-as-truth-value ## If the @code{Octave:assign-as-truth-value} warning is ## enabled, a warning is issued for statements like -## +## ## @example ## @group ## if (s = t) ## @dots{} ## @end group ## @end example -## +## ## @noindent ## since such statements are not common, and it is likely that the intent ## was to write -## +## ## @example ## @group ## if (s == t) ## @dots{} ## @end group ## @end example -## +## ## @noindent ## instead. -## +## ## There are times when it is useful to write code that contains ## assignments within the condition of a @code{while} or @code{if} ## statement. For example, statements like -## +## ## @example ## @group ## while (c = getc()) ## @dots{} ## @end group ## @end example -## +## ## @noindent ## are common in C programming. -## +## ## It is possible to avoid all warnings about such statements by ## disabling the @code{Octave:assign-as-truth-value} warning, ## but that may also let real errors like -## +## ## @example ## @group ## if (x = 1) # intended to test (x == 1)! ## @dots{} ## @end group ## @end example -## +## ## @noindent ## slip by. -## +## ## In such cases, it is possible suppress errors for specific statements by ## writing them with an extra set of parentheses. For example, writing the ## previous example as -## +## ## @example ## @group ## while ((c = getc())) ## @dots{} ## @end group ## @end example -## +## ## @noindent ## will prevent the warning from being printed for this statement, while ## allowing Octave to warn about other assignments used in conditional ## contexts. -## +## ## By default, the @code{Octave:assign-as-truth-value} warning is enabled. -## +## ## @item Octave:associativity-change ## If the @code{Octave:associativity-change} warning is ## enabled, Octave will warn about possible changes in the meaning of @@ -108,75 +108,75 @@ ## Associativity changes have typically been made for @sc{matlab} ## compatibility. By default, the @code{Octave:associativity-change} ## warning is enabled. -## +## ## @item Octave:divide-by-zero ## If the @code{Octave:divide-by-zero} warning is enabled, a ## warning is issued when Octave encounters a division by zero. By ## default, the @code{Octave:divide-by-zero} warning is enabled. -## +## ## @item Octave:empty-list-elements ## If the @code{Octave:empty-list-elements} warning is enabled, a ## warning is issued when an empty matrix is found in a matrix list. ## For example: -## +## ## @example ## a = [1, [], 3, [], 5] ## @end example -## +## ## @noindent ## By default, the @code{Octave:empty-list-elements} warning is enabled. -## +## ## @item Octave:fortran-indexing ## If the @code{Octave:fortran-indexing} warning is enabled, a warning is ## printed for expressions which select elements of a two-dimensional matrix ## using a single index. By default, the @code{Octave:fortran-indexing} ## warning is disabled. -## +## ## @item Octave:function-name-clash ## If the @code{Octave:function-name-clash} warning is enabled, a ## warning is issued when Octave finds that the name of a function ## defined in a function file differs from the name of the file. (If ## the names disagree, the name declared inside the file is ignored.) ## By default, the @code{Octave:function-name-clash} warning is enabled. -## +## ## @item Octave:future-time-stamp ## If the @code{Octave:future-time-stamp} warning is enabled, Octave ## will print a warning if it finds a function file with a time stamp ## that is in the future. By default, the ## @code{Octave:future-time-stamp} warning is enabled. -## +## ## @item Octave:imag-to-real ## If the @code{Octave:imag-to-real} warning is enabled, a warning is ## printed for implicit conversions of complex numbers to real numbers. ## By default, the @code{Octave:imag-to-real} warning is disabled. -## +## ## @item Octave:matlab-incompatible ## Print warnings for Octave language features that may cause ## compatibility problems with @sc{matlab}. -## +## ## @item Octave:missing-semicolon ## If the @code{Octave:missing-semicolon} warning is enabled, Octave ## will warn when statements in function definitions don't end in ## semicolons. By default the @code{Octave:missing-semicolon} warning ## is disabled. -## +## ## @item Octave:neg-dim-as-zero ## If the @code{Octave:neg-dim-as-zero} warning is enabled, print a warning ## for expressions like -## +## ## @example ## eye (-1) ## @end example -## +## ## @noindent ## By default, the @code{Octave:neg-dim-as-zero} warning is disabled. -## +## ## @item Octave:num-to-str ## If the @code{Octave:num-to-str} warning is enable, a warning is ## printed for implicit conversions of numbers to their ASCII character ## equivalents when strings are constructed using a mixture of strings and ## numbers in matrix notation. For example, -## +## ## @example ## @group ## [ "f", 111, 111 ] @@ -187,14 +187,14 @@ ## @noindent ## elicits a warning if the @code{Octave:num-to-str} warning is ## enabled. By default, the @code{Octave:num-to-str} warning is enabled. -## +## ## @item Octave:precedence-change ## If the @code{Octave:precedence-change} warning is enabled, Octave ## will warn about possible changes in the meaning of some code due to ## changes in precedence for some operators. Precedence changes have ## typically been made for @sc{matlab} compatibility. By default, the ## @code{Octave:precedence-change} warning is enabled. -## +## ## @item Octave:reload-forces-clear ## If several functions have been loaded from the same file, Octave must ## clear all the functions before any one of them can be reloaded. If @@ -202,21 +202,21 @@ ## warn you when this happens, and print a list of the additional ## functions that it is forced to clear. By default, the ## @code{Octave:reload-forces-clear} warning is enabled. -## +## ## @item Octave:resize-on-range-error ## If the @code{Octave:resize-on-range-error} warning is enabled, print a ## warning when a matrix is resized by an indexed assignment with ## indices outside the current bounds. By default, the ## @code{Octave:resize-on-range-error} warning is disabled. -## +## ## @item Octave:separator-insert ## Print warning if commas or semicolons might be inserted ## automatically in literal matrices. -## +## ## @item Octave:single-quote-string ## Print warning if a single quote character is used to introduce a ## string constant. -## +## ## @item Octave:str-to-num ## If the @code{Octave:str-to-num} warning is enabled, a warning is printed ## for implicit conversions of strings to their numeric ASCII equivalents. @@ -232,18 +232,18 @@ ## @noindent ## elicits a warning if the @code{Octave:str-to-num} warning is enabled. ## By default, the @code{Octave:str-to-num} warning is disabled. -## +## ## @item Octave:string-concat ## If the @code{Octave:string-concat} warning is enabled, print a ## warning when concatenating a mixture of double and single quoted strings. ## By default, the @code{Octave:string-concat} warning is disabled. -## +## ## @item Octave:undefined-return-values ## If the @code{Octave:undefined-return-values} warning is disabled, ## print a warning if a function does not define all the values in ## the return list which are expected. By default, the ## @code{Octave:undefined-return-values} warning is enabled. -## +## ## @item Octave:variable-switch-label ## If the @code{Octave:variable-switch-label} warning is enabled, Octave ## will print a warning if a switch label is not a constant or constant
--- a/scripts/miscellaneous/what.m +++ b/scripts/miscellaneous/what.m @@ -17,12 +17,12 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Command} {} what +## @deftypefn {Command} {} what ## @deftypefnx {Command} {} what @var{dir} ## @deftypefnx {Function File} {w =} what (@var{dir}) ## List the Octave specific files in a directory. If the variable @var{dir} ## is given then check that directory rather than the current directory. If -## a return argument is requested, the files found are returned in the +## a return argument is requested, the files found are returned in the ## structure @var{w}. ## @seealso{which} ## @end deftypefn @@ -63,13 +63,13 @@ ## Ignore mdl and p files [dummy, f, e] = fileparts (n); if (strcmp (e, ".m")) - w.m{end+1} = n; + w.m{end+1} = n; elseif (strcmp (e, mexext ())) - w.mex{end+1} = n; + w.mex{end+1} = n; elseif (strcmp (e, ".oct")) w.oct{end+1} = n; elseif (strcmp (e, ".mat")) - w.mat{end+1} = n; + w.mat{end+1} = n; elseif(strcmp (n(1), "@")) w.classes{end+1} = n; endif @@ -90,7 +90,7 @@ function __display_filenames__ (msg, p, f) if (length (f) > 0) printf ("%s %s:\n\n", msg, p) - + maxlen = max (cellfun (@length, f)); ncols = max (1, floor (terminal_size()(2) / (maxlen + 3))); fmt = ""; @@ -99,7 +99,7 @@ endfor fmt = [fmt, "\n"]; - nrows = ceil (length (f) / ncols); + nrows = ceil (length (f) / ncols); for i = 1 : nrows args = f(i:nrows:end); if (length (args) < ncols)
--- a/scripts/miscellaneous/zip.m +++ b/scripts/miscellaneous/zip.m @@ -19,9 +19,9 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{entries} =} zip (@var{zipfile}, @var{files}) ## @deftypefnx {Function File} {@var{entries} =} zip (@var{zipfile}, @var{files}, @var{rootdir}) -## Compress the list of files and/or directories specified in @var{files} -## into the archive @var{zipfiles} in the same directory. If @var{rootdir} -## is defined the @var{files} is located relative to @var{rootdir} rather +## Compress the list of files and/or directories specified in @var{files} +## into the archive @var{zipfiles} in the same directory. If @var{rootdir} +## is defined the @var{files} is located relative to @var{rootdir} rather ## than the current directory ## @seealso{unzip,tar} ## @end deftypefn @@ -64,7 +64,7 @@ else error ("zip: zip failed with exit status = %d", status); endif - + else error ("zip: expecting all arguments to be character strings"); endif
--- a/scripts/optimization/__all_opts__.m +++ b/scripts/optimization/__all_opts__.m @@ -25,7 +25,7 @@ ## list of possible values. function names = __all_opts__ (varargin) - + persistent saved_names = {}; ## do not clear this function
--- a/scripts/optimization/fminbnd.m +++ b/scripts/optimization/fminbnd.m @@ -26,9 +26,9 @@ ## is a ## structure specifying additional options. Currently, @code{fminbnd} ## recognizes these options: @code{"FunValCheck"}, @code{"OutputFcn"}, -## @code{"TolX"}, @code{"MaxIter"}, @code{"MaxFunEvals"}. +## @code{"TolX"}, @code{"MaxIter"}, @code{"MaxFunEvals"}. ## For description of these options, see @ref{doc-optimset,,optimset}. -## +## ## On exit, the function returns @var{x}, the approximate minimum point ## and @var{fval}, the function value thereof. ## @var{info} is an exit flag that can have these values: @@ -43,7 +43,7 @@ ## @item -1 ## The algorithm has been terminated from user output function. ## @end itemize -## @seealso{optimset, fzero, fminunc} +## @seealso{optimset, fzero, fminunc} ## @end deftypefn ## This is patterned after opt/fmin.f from Netlib, which in turn is taken from @@ -141,7 +141,7 @@ ## f must not be evaluated too close to x. u = x + max (abs (d), tol) * (sign (d) + (d == 0)); - + fu = fun (u); nfev++; niter++; @@ -198,9 +198,9 @@ fx = fun (x); fx = fx(1); if (! isreal (fx)) - error ("fminbnd:notreal", "fminbnd: non-real value encountered"); + error ("fminbnd:notreal", "fminbnd: non-real value encountered"); elseif (isnan (fx)) - error ("fminbnd:isnan", "fminbnd: NaN value encountered"); + error ("fminbnd:isnan", "fminbnd: NaN value encountered"); endif endfunction
--- a/scripts/optimization/fminunc.m +++ b/scripts/optimization/fminunc.m @@ -26,29 +26,29 @@ ## @var{fcn}. ## @var{fcn} should accepts a vector (array) defining the unknown variables, ## and return the objective function value, optionally with gradient. -## In other words, this function attempts to determine a vector @var{x} such +## In other words, this function attempts to determine a vector @var{x} such ## that @code{@var{fcn} (@var{x})} is a local minimum. ## @var{x0} determines a starting guess. The shape of @var{x0} is preserved ## in all calls to @var{fcn}, but otherwise is treated as a column vector. ## @var{options} is a structure specifying additional options. ## Currently, @code{fminunc} recognizes these options: ## @code{"FunValCheck"}, @code{"OutputFcn"}, @code{"TolX"}, -## @code{"TolFun"}, @code{"MaxIter"}, @code{"MaxFunEvals"}, +## @code{"TolFun"}, @code{"MaxIter"}, @code{"MaxFunEvals"}, ## @code{"GradObj"}, @code{"FinDiffType"}, ## @code{"TypicalX"}, @code{"AutoScaling"}. ## ## If @code{"GradObj"} is @code{"on"}, it specifies that @var{fcn}, ## called with 2 output arguments, also returns the Jacobian matrix ## of right-hand sides at the requested point. @code{"TolX"} specifies -## the termination tolerance in the unknown variables, while +## the termination tolerance in the unknown variables, while ## @code{"TolFun"} is a tolerance for equations. Default is @code{1e-7} ## for both @code{"TolX"} and @code{"TolFun"}. -## +## ## For description of the other options, see @code{optimset}. ## ## On return, @var{fval} contains the value of the function @var{fcn} ## evaluated at @var{x}, and @var{info} may be one of the following values: -## +## ## @table @asis ## @item 1 ## Converged to a solution point. Relative gradient error is less than @@ -59,20 +59,20 @@ ## Last relative step size was less that TolX. ## ## @item 3 -## Last relative decrease in func value was less than TolF. +## Last relative decrease in func value was less than TolF. ## ## @item 0 ## Iteration limit exceeded. ## ## @item -3 -## The trust region radius became excessively small. +## The trust region radius became excessively small. ## @end table ## ## Optionally, fminunc can also yield a structure with convergence statistics ## (@var{output}), the output gradient (@var{grad}) and approximate Hessian ## (@var{hess}). ## -## Note: If you only have a single nonlinear equation of one variable, using +## Note: If you only have a single nonlinear equation of one variable, using ## @code{fminbnd} is usually a much better idea. ## @seealso{fminbnd, optimset} ## @end deftypefn @@ -93,7 +93,7 @@ if (nargin < 2 || nargin > 3 || ! ismatrix (x0)) print_usage (); - endif + endif if (ischar (fcn)) fcn = str2func (fcn, "global"); @@ -182,7 +182,7 @@ endif if (niter == 1) - ## Initialize by identity matrix. + ## Initialize by identity matrix. hesr = eye (n); else ## Use the damped BFGS formula. @@ -304,7 +304,7 @@ ## Tests for termination conditions. A mysterious place, anything ## can happen if you change something here... - + ## The rule of thumb (which I'm not sure M*b is quite following) ## is that for a tolerance that depends on scaling, only 0 makes ## sense as a default value. But 0 usually means uselessly long @@ -350,11 +350,11 @@ endif if (! (isreal (fx) && isreal (jx))) - error ("fminunc:notreal", "fminunc: non-real value encountered"); + error ("fminunc:notreal", "fminunc: non-real value encountered"); elseif (complexeqn && ! (isnumeric (fx) && isnumeric(jx))) error ("fminunc:notnum", "fminunc: non-numeric value encountered"); elseif (any (isnan (fx(:)))) - error ("fminunc:isnan", "fminunc: NaN value encountered"); + error ("fminunc:isnan", "fminunc: NaN value encountered"); endif endfunction
--- a/scripts/optimization/fsolve.m +++ b/scripts/optimization/fsolve.m @@ -25,21 +25,21 @@ ## @var{fcn} should accept a vector (array) defining the unknown variables, ## and return a vector of left-hand sides of the equations. Right-hand sides ## are defined to be zeros. -## In other words, this function attempts to determine a vector @var{x} such +## In other words, this function attempts to determine a vector @var{x} such ## that @code{@var{fcn} (@var{x})} gives (approximately) all zeros. ## @var{x0} determines a starting guess. The shape of @var{x0} is preserved ## in all calls to @var{fcn}, but otherwise it is treated as a column vector. ## @var{options} is a structure specifying additional options. ## Currently, @code{fsolve} recognizes these options: ## @code{"FunValCheck"}, @code{"OutputFcn"}, @code{"TolX"}, -## @code{"TolFun"}, @code{"MaxIter"}, @code{"MaxFunEvals"}, +## @code{"TolFun"}, @code{"MaxIter"}, @code{"MaxFunEvals"}, ## @code{"Jacobian"}, @code{"Updating"}, @code{"ComplexEqn"} ## @code{"TypicalX"}, @code{"AutoScaling"} and @code{"FinDiffType"}. ## ## If @code{"Jacobian"} is @code{"on"}, it specifies that @var{fcn}, ## called with 2 output arguments, also returns the Jacobian matrix ## of right-hand sides at the requested point. @code{"TolX"} specifies -## the termination tolerance in the unknown variables, while +## the termination tolerance in the unknown variables, while ## @code{"TolFun"} is a tolerance for equations. Default is @code{1e-7} ## for both @code{"TolX"} and @code{"TolFun"}. ## @@ -47,17 +47,17 @@ ## according to the column norms of the (estimated) Jacobian. As a result, ## TolF becomes scaling-independent. By default, this option is off, because ## it may sometimes deliver unexpected (though mathematically correct) results. -## +## ## If @code{"Updating"} is "on", the function will attempt to use Broyden ## updates to update the Jacobian, in order to reduce the amount of Jacobian ## calculations. ## If your user function always calculates the Jacobian (regardless of number ## of output arguments), this option provides no advantage and should be set to ## false. -## +## ## @code{"ComplexEqn"} is @code{"on"}, @code{fsolve} will attempt to solve ## complex equations in complex variables, assuming that the equations possess a -## complex derivative (i.e., are holomorphic). If this is not what you want, +## complex derivative (i.e., are holomorphic). If this is not what you want, ## should unpack the real and imaginary parts of the system to get a real ## system. ## @@ -65,7 +65,7 @@ ## ## On return, @var{fval} contains the value of the function @var{fcn} ## evaluated at @var{x}, and @var{info} may be one of the following values: -## +## ## @table @asis ## @item 1 ## Converged to a solution point. Relative residual error is less than @@ -75,16 +75,16 @@ ## Last relative step size was less that TolX. ## ## @item 3 -## Last relative decrease in residual was less than TolF. +## Last relative decrease in residual was less than TolF. ## ## @item 0 ## Iteration limit exceeded. ## ## @item -3 -## The trust region radius became excessively small. +## The trust region radius became excessively small. ## @end table -## -## Note: If you only have a single nonlinear equation of one variable, using +## +## Note: If you only have a single nonlinear equation of one variable, using ## @code{fzero} is usually a much better idea. ## @seealso{fzero, optimset} ## @@ -122,7 +122,7 @@ ## endfunction ## ## ## @dots{}. -## +## ## fsolve (@@user_func, x0, optimset ("OutputFcn", @@user_func, @dots{})) ## @end example ## @end deftypefn @@ -143,7 +143,7 @@ if (nargin < 2 || nargin > 3 || ! ismatrix (x0)) print_usage (); - endif + endif if (ischar (fcn)) fcn = str2func (fcn, "global"); @@ -375,7 +375,7 @@ ## Tests for termination conditions. A mysterious place, anything ## can happen if you change something here... - + ## The rule of thumb (which I'm not sure M*b is quite following) ## is that for a tolerance that depends on scaling, only 0 makes ## sense as a default value. But 0 usually means uselessly long @@ -408,7 +408,7 @@ ## Compute the scaled Broyden update. if (useqr) - u = (fvec1 - q*w) / sn; + u = (fvec1 - q*w) / sn; v = dg .* ((dg .* s) / sn); ## Update the QR factorization. @@ -444,11 +444,11 @@ endif if (! complexeqn && ! (isreal (fx) && isreal (jx))) - error ("fsolve:notreal", "fsolve: non-real value encountered"); + error ("fsolve:notreal", "fsolve: non-real value encountered"); elseif (complexeqn && ! (isnumeric (fx) && isnumeric(jx))) error ("fsolve:notnum", "fsolve: non-numeric value encountered"); elseif (any (isnan (fx(:)))) - error ("fsolve:isnan", "fsolve: NaN value encountered"); + error ("fsolve:isnan", "fsolve: NaN value encountered"); endif endfunction @@ -459,7 +459,7 @@ endif endfunction -%!function retval = f (p) +%!function retval = f (p) %! x = p(1); %! y = p(2); %! z = p(3); @@ -495,7 +495,7 @@ %! assert (norm (x - x_opt, Inf) < tol); %! assert (norm (fval) < tol); -%!function retval = f (p) +%!function retval = f (p) %! x = p(1); %! y = p(2); %! z = p(3); @@ -514,7 +514,7 @@ %! assert (norm (x - x_opt, Inf) < tol); %! assert (norm (fval) < tol); -%!function retval = f (p) +%!function retval = f (p) %! x = p(1); %! y = p(2); %! z = p(3); @@ -541,7 +541,7 @@ %! y = exp (-a0*x) + b0 + noise; %! c_opt = [a0, b0]; %! tol = 1e-5; -%! +%! %! [c, fval, info, output] = fsolve (@(c) (exp(-c(1)*x) + c(2) - y), [0, 0]); %! assert (info > 0); %! assert (norm (c - c_opt, Inf) < tol); @@ -556,7 +556,7 @@ %!test %! x_opt = [-1+i, 1-i, 2+i]; %! x = [i, 1, 1+i]; -%! +%! %! [x, f, info] = fsolve (@cfun, x, optimset ("ComplexEqn", "on")); %! tol = 1e-5; %! assert (norm (f) < tol);
--- a/scripts/optimization/fzero.m +++ b/scripts/optimization/fzero.m @@ -22,9 +22,9 @@ ## @deftypefn {Function File} {} fzero (@var{fun}, @var{x0}) ## @deftypefnx {Function File} {} fzero (@var{fun}, @var{x0}, @var{options}) ## @deftypefnx {Function File} {[@var{x}, @var{fval}, @var{info}, @var{output}] =} fzero (@dots{}) -## Find a zero of a univariate function. +## Find a zero of a univariate function. ## -## @var{fun} should be a function handle or name. @var{x0} should be a +## @var{fun} should be a function handle or name. @var{x0} should be a ## two-element vector specifying two points which bracket a zero. In ## other words, there must be a change in sign of the function between ## @var{x0}(1) and @var{x0}(2). More mathematically, the following must hold @@ -36,12 +36,12 @@ ## If @var{x0} is a single scalar then several nearby and distant ## values are probed in an attempt to obtain a valid bracketing. If this ## is not successful, the function fails. -## @var{options} is a structure specifying additional options. +## @var{options} is a structure specifying additional options. ## Currently, @code{fzero} ## recognizes these options: @code{"FunValCheck"}, @code{"OutputFcn"}, -## @code{"TolX"}, @code{"MaxIter"}, @code{"MaxFunEvals"}. +## @code{"TolX"}, @code{"MaxIter"}, @code{"MaxFunEvals"}. ## For a description of these options, see @ref{doc-optimset,,optimset}. -## +## ## On exit, the function returns @var{x}, the approximate zero point ## and @var{fval}, the function value thereof. ## @var{info} is an exit flag that can have these values: @@ -59,7 +59,7 @@ ## @item -5 ## The algorithm may have converged to a singular point. ## @end itemize -## +## ## @var{output} is a structure containing runtime information about the ## @code{fzero} algorithm. Fields in the structure are: ## @@ -76,7 +76,7 @@ ## @item brackety ## A two-element vector with the final bracketing of the zero along the y-axis. ## @end itemize -## @seealso{optimset, fsolve} +## @seealso{optimset, fsolve} ## @end deftypefn ## This is essentially the ACM algorithm 748: Enclosing Zeros of @@ -135,7 +135,7 @@ ## Prepare... a = x0(1); - fa = fun (a); + fa = fun (a); nfev = 1; if (length (x0) > 1) b = x0(2); @@ -160,7 +160,7 @@ u = a; a = b; b = u; - + fu = fa; fa = fb; fb = fu; @@ -244,7 +244,7 @@ endfor endif endif - itype += 1; + itype += 1; case 4 ## Double secant step. c = u - 2*(b - a)/(fb - fa)*fu; @@ -269,13 +269,13 @@ ## Calculate new point. x = c; - fval = fc = fun (c); + fval = fc = fun (c); niter ++; nfev ++; ## Modification 2: skip inverse cubic interpolation if ## nonmonotonicity is detected. if (sign (fc - fa) * sign (fc - fb) >= 0) - ## The new point broke monotonicity. + ## The new point broke monotonicity. ## Disable inverse cubic. fe = fc; else @@ -348,9 +348,9 @@ fx = fun (x); fx = fx(1); if (! isreal (fx)) - error ("fzero:notreal", "fzero: non-real value encountered"); + error ("fzero:notreal", "fzero: non-real value encountered"); elseif (isnan (fx)) - error ("fzero:isnan", "fzero: NaN value encountered"); + error ("fzero:isnan", "fzero: NaN value encountered"); endif endfunction
--- a/scripts/optimization/glpk.m +++ b/scripts/optimization/glpk.m @@ -78,30 +78,30 @@ ## @end example ## ## @end ifnottex -## +## ## Input arguments: -## +## ## @table @var ## @item c ## A column array containing the objective function coefficients. -## +## ## @item A ## A matrix containing the constraints coefficients. -## +## ## @item b ## A column array containing the right-hand side value for each constraint ## in the constraint matrix. -## +## ## @item lb ## An array containing the lower bound on each of the variables. If ## @var{lb} is not supplied, the default lower bound for the variables is ## zero. -## +## ## @item ub ## An array containing the upper bound on each of the variables. If ## @var{ub} is not supplied, the default upper bound is assumed to be ## infinite. -## +## ## @item ctype ## An array of characters containing the sense of each constraint in the ## constraint matrix. Each element of the array may be one of the @@ -123,7 +123,7 @@ ## An inequality constraint with both upper and lower bounds ## (@code{A(i,:)*x >= -b(i)} @emph{and} (@code{A(i,:)*x <= b(i)}). ## @end table -## +## ## @item vartype ## A column array containing the types of the variables. ## @table @code @@ -133,19 +133,19 @@ ## @item "I" ## An integer variable. ## @end table -## +## ## @item sense ## If @var{sense} is 1, the problem is a minimization. If @var{sense} is ## -1, the problem is a maximization. The default value is 1. -## +## ## @item param ## A structure containing the following parameters used to define the ## behavior of solver. Missing elements in the structure take on default ## values, so you only need to set the elements that you wish to change ## from the default. -## +## ## Integer parameters: -## +## ## @table @code ## @item msglev (@w{@code{LPX_K_MSGLEV}}, default: 1) ## Level of messages output by solver routines: @@ -162,9 +162,9 @@ ## @item 3 ## Full output (includes informational messages). ## @end table -## +## ## @item scale (@w{@code{LPX_K_SCALE}}, default: 1) -## Scaling option: +## Scaling option: ## @table @asis ## @item 0 ## No scaling. @@ -175,7 +175,7 @@ ## @item 2 ## Geometric mean scaling, then equilibration scaling. ## @end table -## +## ## @item dual (@w{@code{LPX_K_DUAL}}, default: 0) ## Dual simplex option: ## @table @asis @@ -185,7 +185,7 @@ ## @item 1 ## If initial basic solution is dual feasible, use the dual simplex. ## @end table -## +## ## @item price (@w{@code{LPX_K_PRICE}}, default: 1) ## Pricing option (for both primal and dual simplex): ## @table @asis @@ -195,7 +195,7 @@ ## @item 1 ## Steepest edge pricing. ## @end table -## +## ## @item round (@w{@code{LPX_K_ROUND}}, default: 0) ## Solution rounding option: ## @table @asis @@ -205,18 +205,18 @@ ## @item 1 ## Replace tiny primal and dual values by exact zero. ## @end table -## +## ## @item itlim (@w{@code{LPX_K_ITLIM}}, default: -1) ## Simplex iterations limit. If this value is positive, it is decreased by ## one each time when one simplex iteration has been performed, and ## reaching zero value signals the solver to stop the search. Negative ## value means no iterations limit. -## +## ## @item itcnt (@w{@code{LPX_K_OUTFRQ}}, default: 200) ## Output frequency, in iterations. This parameter specifies how ## frequently the solver sends information about the solution to the ## standard output. -## +## ## @item branch (@w{@code{LPX_K_BRANCH}}, default: 2) ## Branching heuristic option (for MIP only): ## @table @asis @@ -229,7 +229,7 @@ ## @item 2 ## Branch using a heuristic by Driebeck and Tomlin. ## @end table -## +## ## @item btrack (@w{@code{LPX_K_BTRACK}}, default: 2) ## Backtracking heuristic option (for MIP only): ## @table @asis @@ -241,12 +241,12 @@ ## ## @item 2 ## Backtrack using the best projection heuristic. -## @end table -## +## @end table +## ## @item presol (@w{@code{LPX_K_PRESOL}}, default: 1) ## If this flag is set, the routine lpx_simplex solves the problem using ## the built-in LP presolver. Otherwise the LP presolver is not used. -## +## ## @item lpsolver (default: 1) ## Select which solver to use. If the problem is a MIP problem this flag ## will be ignored. @@ -263,9 +263,9 @@ ## CPLEX LP format to the file @file{"outpb.lp"}. There is currently no ## way to change the name of the output file. ## @end table -## +## ## Real parameters: -## +## ## @table @code ## @item relax (@w{@code{LPX_K_RELAX}}, default: 0.07) ## Relaxation parameter used in the ratio test. If it is zero, the textbook @@ -276,48 +276,48 @@ ## to slightly violate their bounds, but not more than ## @code{relax*tolbnd} or @code{relax*toldj (thus, @code{relax} is a ## percentage of @code{tolbnd} or @code{toldj}}. -## +## ## @item tolbnd (@w{@code{LPX_K_TOLBND}}, default: 10e-7) ## Relative tolerance used to check if the current basic solution is primal ## feasible. It is not recommended that you change this parameter unless you ## have a detailed understanding of its purpose. -## +## ## @item toldj (@w{@code{LPX_K_TOLDJ}}, default: 10e-7) ## Absolute tolerance used to check if the current basic solution is dual ## feasible. It is not recommended that you change this parameter unless you ## have a detailed understanding of its purpose. -## +## ## @item tolpiv (@w{@code{LPX_K_TOLPIV}}, default: 10e-9) ## Relative tolerance used to choose eligible pivotal elements of the ## simplex table. It is not recommended that you change this parameter unless ## you have a detailed understanding of its purpose. -## +## ## @item objll (@w{@code{LPX_K_OBJLL}}, default: -DBL_MAX) ## Lower limit of the objective function. If on the phase II the objective ## function reaches this limit and continues decreasing, the solver stops ## the search. This parameter is used in the dual simplex method only. -## +## ## @item objul (@w{@code{LPX_K_OBJUL}}, default: +DBL_MAX) ## Upper limit of the objective function. If on the phase II the objective ## function reaches this limit and continues increasing, the solver stops ## the search. This parameter is used in the dual simplex only. -## +## ## @item tmlim (@w{@code{LPX_K_TMLIM}}, default: -1.0) ## Searching time limit, in seconds. If this value is positive, it is ## decreased each time when one simplex iteration has been performed by the ## amount of time spent for the iteration, and reaching zero value signals ## the solver to stop the search. Negative value means no time limit. -## +## ## @item outdly (@w{@code{LPX_K_OUTDLY}}, default: 0.0) ## Output delay, in seconds. This parameter specifies how long the solver ## should delay sending information about the solution to the standard ## output. Non-positive value means no delay. -## +## ## @item tolint (@w{@code{LPX_K_TOLINT}}, default: 10e-5) ## Relative tolerance used to check if the current basic solution is integer ## feasible. It is not recommended that you change this parameter unless ## you have a detailed understanding of its purpose. -## +## ## @item tolobj (@w{@code{LPX_K_TOLOBJ}}, default: 10e-7) ## Relative tolerance used to check if the value of the objective function ## is not better than in the best known integer feasible solution. It is @@ -325,9 +325,9 @@ ## detailed understanding of its purpose. ## @end table ## @end table -## +## ## Output values: -## +## ## @table @var ## @item xopt ## The optimizer (the value of the decision variables at the optimum). @@ -337,7 +337,7 @@ ## ## @item status ## Status of the optimization. -## +## ## Simplex Method: ## @table @asis ## @item 180 (@w{@code{LPX_OPT}}) @@ -413,13 +413,13 @@ ## Time (in seconds) used for solving LP/MIP problem. ## ## @item mem -## Memory (in bytes) used for solving LP/MIP problem (this is not +## Memory (in bytes) used for solving LP/MIP problem (this is not ## available if the version of @sc{glpk} is 4.15 or later). ## @end table ## @end table -## +## ## Example: -## +## ## @example ## @group ## c = [10, 6, 4]'; @@ -432,10 +432,10 @@ ## ctype = "UUU"; ## vartype = "CCC"; ## s = -1; -## +## ## param.msglev = 1; ## param.itlim = 100; -## +## ## [xmin, fmin, status, extra] = ... ## glpk (c, A, b, lb, ub, ctype, vartype, s, param); ## @end group
--- a/scripts/optimization/lsqnonneg.m +++ b/scripts/optimization/lsqnonneg.m @@ -26,7 +26,7 @@ ## @deftypefnx {Function File} {[@var{x}, @var{resnorm}, @var{residual}, @var{exitflag}] =} lsqnonneg (@dots{}) ## @deftypefnx {Function File} {[@var{x}, @var{resnorm}, @var{residual}, @var{exitflag}, @var{output}] =} lsqnonneg (@dots{}) ## @deftypefnx {Function File} {[@var{x}, @var{resnorm}, @var{residual}, @var{exitflag}, @var{output}, @var{lambda}] =} lsqnonneg (@dots{}) -## Minimize @code{norm (@var{c}*@var{x} - d)} subject to +## Minimize @code{norm (@var{c}*@var{x} - d)} subject to ## @code{@var{x} >= 0}. @var{c} and @var{d} must be real. @var{x0} is an ## optional initial guess for @var{x}. ## @@ -116,7 +116,7 @@ endif idx = find (xtmp < 0); - if (isempty (idx)) + if (isempty (idx)) ## LH7: tmp solution found, iterate. x(:) = 0; x(p) = xtmp; @@ -140,7 +140,7 @@ endif endif endwhile - + ## compute the gradient. w = c'*(d - c*x); w(p) = [];
--- a/scripts/optimization/optimget.m +++ b/scripts/optimization/optimget.m @@ -20,9 +20,9 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} optimget (@var{options}, @var{parname}) ## @deftypefnx {Function File} {} optimget (@var{options}, @var{parname}, @var{default}) -## Return a specific option from a structure created by +## Return a specific option from a structure created by ## @code{optimset}. If @var{parname} is not a field of the @var{options} -## structure, return @var{default} if supplied, otherwise return an +## structure, return @var{default} if supplied, otherwise return an ## empty matrix. ## @end deftypefn
--- a/scripts/optimization/pqpnonneg.m +++ b/scripts/optimization/pqpnonneg.m @@ -60,7 +60,7 @@ ## PKG_ADD: __all_opts__ ("pqpnonneg"); -## This is analogical to the lsqnonneg implementation, which is +## This is analogical to the lsqnonneg implementation, which is ## implemented from Lawson and Hanson's 1973 algorithm on page ## 161 of Solving Least Squares Problems. ## It shares the convergence guarantees. @@ -115,7 +115,7 @@ endif idx = find (xtmp < 0); - if (isempty (idx)) + if (isempty (idx)) ## LH7: tmp solution found, iterate. x(:) = 0; x(p) = xtmp; @@ -139,7 +139,7 @@ endif endif endwhile - + ## compute the gradient. w = -(d + c*x); w(p) = [];
--- a/scripts/optimization/qp.m +++ b/scripts/optimization/qp.m @@ -87,7 +87,7 @@ ## ## @item info ## An integer indicating the status of the solution. -## +## ## @table @asis ## @item 0 ## The problem is feasible and convex. Global solution found. @@ -223,7 +223,7 @@ bin = [bin; -ub]; endif endif - + if (! isempty (lb) && ! isempty (ub)) rtol = sqrt (eps); for i = 1:n @@ -267,7 +267,7 @@ bin = [bin; -A_ub]; endif endif - + if (! isempty (A_lb) && ! isempty (A_ub)) rtol = sqrt (eps); for i = 1:dimA_in
--- a/scripts/optimization/sqp.m +++ b/scripts/optimization/sqp.m @@ -114,14 +114,14 @@ ## ## @noindent ## in which @var{x} is a vector and @var{r} is a vector. -## +## ## The third and fourth arguments may also be 2-element cell arrays of ## function handles. The first element should point to the constraint ## function and the second should point to a function that computes the ## gradient of the constraint function: ## @tex ## $$ -## \Bigg( {\partial f(x) \over \partial x_1}, +## \Bigg( {\partial f(x) \over \partial x_1}, ## {\partial f(x) \over \partial x_2}, \ldots, ## {\partial f(x) \over \partial x_N} \Bigg)^T ## $$ @@ -142,7 +142,7 @@ ## 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 of @var{x} will share the same -## bound. If only one bound (lb, ub) is specified then the other will +## bound. If only one bound (lb, ub) is specified then the other will ## default to (-@var{realmax}, +@var{realmax}). ## ## The seventh argument specifies the maximum number of iterations. @@ -155,7 +155,7 @@ ## ## @table @asis ## @item 101 -## The algorithm terminated normally. +## The algorithm terminated normally. ## Either all constraints meet the requested tolerance, or the stepsize, ## @tex ## $\Delta x,$ @@ -164,12 +164,12 @@ ## delta @var{x}, ## @end ifnottex ## is less than @code{tol * norm (x)}. -## +## ## @item 102 ## The BFGS update failed. -## +## ## @item 103 -## The maximum number of iterations was reached. +## The maximum number of iterations was reached. ## @end table ## ## An example of calling @code{sqp}: @@ -177,7 +177,7 @@ ## @example ## function r = g (x) ## r = [ sumsq(x)-10; -## x(2)*x(3)-5*x(4)*x(5); +## x(2)*x(3)-5*x(4)*x(5); ## x(1)^3+x(2)^3+1 ]; ## endfunction ## @@ -190,19 +190,19 @@ ## [x, obj, info, iter, nf, lambda] = sqp (x0, @@phi, @@g, []) ## ## x = -## +## ## -1.71714 ## 1.59571 ## 1.82725 ## -0.76364 ## -0.76364 -## +## ## obj = 0.053950 ## info = 101 ## iter = 8 ## nf = 10 ## lambda = -## +## ## -0.0401627 ## 0.0379578 ## -0.0052227 @@ -378,7 +378,7 @@ ## ce_fun -- equality constraint functions ## ci_fun -- inequality constraint functions ## A == [grad_{x_1} cx_fun, grad_{x_2} cx_fun, ..., grad_{x_n} cx_fun]^T - x = x0; + x = x0; obj = feval (obj_fun, x0); __sqp_nfun__ = 1; @@ -728,7 +728,7 @@ if (iscell (__sqp_cif__) && length (__sqp_cif__) > 1) cigradfcn = __sqp_cif__{2}; endif - + if (isempty (cigradfcn)) res = bgrad; else
--- a/scripts/path/pathdef.m +++ b/scripts/path/pathdef.m @@ -64,7 +64,7 @@ endfunction ## Extact the path information from the script/function @var{file}, -## created by @file{savepath.m}. If @var{file} is omitted, +## created by @file{savepath.m}. If @var{file} is omitted, ## @file{~/.octaverc} is used. If successful, @code{__extractpath__} ## returns the path specified in @var{file}. @@ -133,4 +133,4 @@ specifiedpath = ""; endif -endfunction +endfunction
--- a/scripts/path/savepath.m +++ b/scripts/path/savepath.m @@ -204,8 +204,8 @@ if (nargout == 1) varargout{1} = retval; endif - -endfunction + +endfunction function path_elements = parsepath (p) pat = sprintf ('([^%s]+[%s$])', pathsep, pathsep);
--- a/scripts/pkg/pkg.m +++ b/scripts/pkg/pkg.m @@ -1,6 +1,6 @@ ## Copyright (C) 2005-2011 S�ren Hauberg ## Copyright (C) 2010 VZLU Prague, a.s. -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -40,16 +40,16 @@ ## ## @table @code ## @item -nodeps -## The package manager will disable the dependency checking. That way it -## is possible to install a package even if it depends on another package +## The package manager will disable the dependency checking. That way it +## is possible to install a package even if it depends on another package ## that's not installed on the system. @strong{Use this option with care.} ## ## @item -noauto -## The package manager will not automatically load the installed package +## The package manager will not automatically load the installed package ## when starting Octave, even if the package requests that it is. ## ## @item -auto -## The package manager will automatically load the installed package when +## The package manager will automatically load the installed package when ## starting Octave, even if the package requests that it isn't. ## ## @item -local @@ -60,7 +60,7 @@ ## system privileges ## ## @item -verbose -## The package manager will print the output of all of the commands that are +## The package manager will print the output of all of the commands that are ## performed. ## @end table ## @@ -204,7 +204,7 @@ ## @end example ## ## @item rebuild -## Rebuilds the package database from the installed directories. This can +## Rebuilds the package database from the installed directories. This can ## be used in cases where for some reason the package database is corrupted. ## It can also take the @option{-auto} and @option{-noauto} options to allow the ## autoloading state of a package to be changed. For example, @@ -228,7 +228,7 @@ ## @noindent ## where @code{builddir} is the name of a directory where the temporary ## installation will be produced and the binary packages will be found. -## The options @option{-verbose} and @option{-nodeps} are respected, while +## The options @option{-verbose} and @option{-nodeps} are respected, while ## the other options are ignored. ## @end table ## @end deftypefn @@ -260,7 +260,7 @@ available_actions = {"list", "install", "uninstall", "load", ... "unload", "prefix", "local_list", ... - "global_list", "rebuild", "build","describe"}; + "global_list", "rebuild", "build","describe"}; ## Handle input if (length (varargin) == 0 || ! iscellstr (varargin)) print_usage (); @@ -351,7 +351,7 @@ endif endif - install (files, deps, auto, prefix, archprefix, verbose, local_list, + install (files, deps, auto, prefix, archprefix, verbose, local_list, global_list, global_install); unwind_protect_cleanup @@ -362,7 +362,7 @@ if (length (files) == 0) error ("you must specify at least one package when calling 'pkg uninstall'"); endif - uninstall (files, deps, verbose, local_list, + uninstall (files, deps, verbose, local_list, global_list, global_install); case "load" @@ -440,7 +440,7 @@ case "rebuild" if (global_install) - global_packages = rebuild (prefix, archprefix, global_list, files, + global_packages = rebuild (prefix, archprefix, global_list, files, auto, verbose); global_packages = save_order (global_packages); save (global_list, "global_packages"); @@ -448,7 +448,7 @@ local_packages = global_packages; endif else - local_packages = rebuild (prefix, archprefix, local_list, files, auto, + local_packages = rebuild (prefix, archprefix, local_list, files, auto, verbose); local_packages = save_order (local_packages); save (local_list, "local_packages"); @@ -484,7 +484,7 @@ otherwise error ("you can request at most two outputs when calling 'pkg describe'"); endswitch - + otherwise error ("you must specify a valid action for 'pkg'. See 'help pkg' for details"); endswitch @@ -563,7 +563,7 @@ endfor if (! isempty (dup)) descriptions (dup) = []; - endif + endif endif endfunction @@ -589,7 +589,7 @@ endif files(1) = []; buildlist = fullfile (builddir, "octave_packages"); - install (files, handle_deps, autoload, installdir, installdir, verbose, + install (files, handle_deps, autoload, installdir, installdir, verbose, buildlist, "", false); unwind_protect repackage (builddir, buildlist); @@ -604,7 +604,7 @@ end_unwind_protect endfunction -function install (files, handle_deps, autoload, prefix, archprefix, verbose, +function install (files, handle_deps, autoload, prefix, archprefix, verbose, local_list, global_list, global_install) ## Check that the directory in prefix exist. If it doesn't: create it! @@ -617,10 +617,10 @@ endif ## Get the list of installed packages. - [local_packages, global_packages] = installed_packages (local_list, + [local_packages, global_packages] = installed_packages (local_list, global_list); - installed_pkgs_lst = {local_packages{:}, global_packages{:}}; + installed_pkgs_lst = {local_packages{:}, global_packages{:}}; if (global_install) packages = global_packages; @@ -633,7 +633,7 @@ try ## Warn about non existent files. for i = 1:length (files) - if (isempty (glob(files{i}))) + if (isempty (glob(files{i}))) warning ("file %s does not exist", files{i}); endif endfor @@ -686,32 +686,32 @@ packdir = fullfile (pwd(), dirlist{3}); endif packdirs{end+1} = packdir; - + ## Make sure the package contains necessary files. verify_directory (packdir); - + ## Read the DESCRIPTION file. filename = fullfile (packdir, "DESCRIPTION"); desc = get_description (filename); - + ## Verify that package name corresponds with filename. - [dummy, nm] = fileparts (tgz); + [dummy, nm] = fileparts (tgz); if ((length (nm) >= length (desc.name)) && ! strcmp (desc.name, nm(1:length(desc.name)))) - error ("package name '%s' doesn't correspond to its filename '%s'", + error ("package name '%s' doesn't correspond to its filename '%s'", desc.name, nm); endif - + ## Set default installation directory. desc.dir = fullfile (prefix, cstrcat (desc.name, "-", desc.version)); - + ## Set default architectire dependent installation directory. desc.archprefix = fullfile (archprefix, cstrcat (desc.name, "-", desc.version)); - + ## Save desc. descriptions{end+1} = desc; - + ## Are any of the new packages already installed? ## If so we'll remove the old version. for j = 1:length (packages) @@ -744,7 +744,7 @@ descriptions{idx2}}; else idx1 = setdiff (1:length(local_packages), packages_to_uninstall); - pseudo_installed_packages = {local_packages{idx1}, ... + pseudo_installed_packages = {local_packages{idx1}, ... global_packages{:}, ... descriptions{idx2}}; endif @@ -787,10 +787,10 @@ try for i = packages_to_uninstall if (global_install) - uninstall ({global_packages{i}.name}, false, verbose, local_list, + uninstall ({global_packages{i}.name}, false, verbose, local_list, global_list, global_install); else - uninstall ({local_packages{i}.name}, false, verbose, local_list, + uninstall ({local_packages{i}.name}, false, verbose, local_list, global_list, global_install); endif endfor @@ -841,7 +841,7 @@ ## requested that it is, then mark the package as autoloaded. for i = length (descriptions):-1:1 if (autoload > 0 || (autoload == 0 && isautoload (descriptions(i)))) - fclose (fopen (fullfile (descriptions{i}.dir, "packinfo", + fclose (fopen (fullfile (descriptions{i}.dir, "packinfo", ".autoload"), "wt")); descriptions{i}.autoload = 1; endif @@ -904,10 +904,10 @@ endif endfunction -function uninstall (pkgnames, handle_deps, verbose, local_list, +function uninstall (pkgnames, handle_deps, verbose, local_list, global_list, global_install) ## Get the list of installed packages. - [local_packages, global_packages] = installed_packages(local_list, + [local_packages, global_packages] = installed_packages(local_list, global_list); if (global_install) installed_pkgs_lst = {local_packages{:}, global_packages{:}}; @@ -1028,13 +1028,13 @@ endfunction -function [pkg_desc_list, flag] = describe (pkgnames, verbose, +function [pkg_desc_list, flag] = describe (pkgnames, verbose, local_list, global_list) ## Get the list of installed packages. installed_pkgs_lst = installed_packages(local_list, global_list); num_packages = length (installed_pkgs_lst); - + describe_all = false; if (any (strcmp ("all", pkgnames))) @@ -1075,7 +1075,7 @@ non_inst_str = sprintf (" %s ", pkgnames{non_inst}); error ("some packages are not installed: %s", non_inst_str); else - pkg_desc_list{non_inst} = struct ("name", {}, "description", + pkg_desc_list{non_inst} = struct ("name", {}, "description", {}, "provides", {}); endif endif @@ -1084,7 +1084,7 @@ for i = 1:num_pkgnames print_package_description (pkg_desc_list{i}.name, pkg_desc_list{i}.version, - pkg_desc_list{i}.provides, + pkg_desc_list{i}.provides, pkg_desc_list{i}.description, flag{i}, verbose); endfor @@ -1101,12 +1101,12 @@ if (! exist (index_file, "file")) error ("could not find any INDEX file in directory %s, try 'pkg rebuild all' to generate missing INDEX files", packdir); - endif + endif - + [fid, msg] = fopen (index_file, "r"); if (fid == -1) - error ("the INDEX file %s could not be read: %s", + error ("the INDEX file %s could not be read: %s", index_file, msg); endif @@ -1121,7 +1121,7 @@ while (! feof (fid) || line != -1) if (! any (! isspace (line)) || line(1) == "#" || any (line == "=")) - ## Comments, blank lines or comments about unimplemented + ## Comments, blank lines or comments about unimplemented ## functions: do nothing ## FIXME: probably comments and pointers to external functions ## could be treated better when printing to screen? @@ -1146,7 +1146,7 @@ fclose (fid); endfunction -function print_package_description (pkg_name, pkg_ver, pkg_idx_struct, +function print_package_description (pkg_name, pkg_ver, pkg_idx_struct, pkg_desc, status, verbose) printf ("---\nPackage name:\n\t%s\n", pkg_name); @@ -1154,7 +1154,7 @@ printf ("Short description:\n\t%s\n", pkg_desc); printf ("Status:\n\t%s\n", status); if (verbose) - printf ("---\nProvides:\n"); + printf ("---\nProvides:\n"); for i = 1:length(pkg_idx_struct) if (! isempty (pkg_idx_struct{i}.functions)) printf ("%s\n", pkg_idx_struct{i}.category); @@ -1209,26 +1209,26 @@ unlink (fullfile (pack.name, "inst", "PKG_DEL")); endif if (exist (fullfile (archdir, "PKG_ADD"), "file")) - movefile (fullfile (archdir, "PKG_ADD"), + movefile (fullfile (archdir, "PKG_ADD"), fullfile (pack.name, "PKG_ADD")); endif if (exist (fullfile (archdir, "PKG_DEL"), "file")) - movefile (fullfile (archdir, "PKG_DEL"), - fullfile (pack.name, "PKG_DEL")); + movefile (fullfile (archdir, "PKG_DEL"), + fullfile (pack.name, "PKG_DEL")); endif else if (exist (fullfile (pack.name, "inst", "PKG_ADD"), "file")) - movefile (fullfile (pack.name, "inst", "PKG_ADD"), + movefile (fullfile (pack.name, "inst", "PKG_ADD"), fullfile (pack.name, "PKG_ADD")); - endif + endif if (exist (fullfile (pack.name, "inst", "PKG_DEL"), "file")) - movefile (fullfile (pack.name, "inst", "PKG_DEL"), - fullfile (pack.name, "PKG_DEL")); - endif - endif + movefile (fullfile (pack.name, "inst", "PKG_DEL"), + fullfile (pack.name, "PKG_DEL")); + endif + endif tfile = cstrcat (pack.name, "-", pack.version, ".tar"); tar (tfile, pack.name); - try + try gzip (tfile); unlink (tfile); catch @@ -1263,7 +1263,7 @@ wd = pwd (); try cd (packdir); - pre_install (desc); + pre_install (desc); cd (wd); catch cd (wd); @@ -1277,13 +1277,13 @@ [status, msg] = mkdir (inst_dir); if (status != 1) rm_rf (desc.dir); - error ("the 'inst' directory did not exist and could not be created: %s", + error ("the 'inst' directory did not exist and could not be created: %s", msg); endif endif endfunction -function configure_make (desc, packdir, verbose) +function configure_make (desc, packdir, verbose) ## Perform ./configure, make, make install in "src". if (exist (fullfile (packdir, "src"), "dir")) src = fullfile (packdir, "src"); @@ -1373,7 +1373,7 @@ ## Copy the files. if (! all (isspace ([filenames{:}]))) - if (! exist (instdir, "dir")) + if (! exist (instdir, "dir")) mkdir (instdir); endif if (! all (isspace ([archindependent{:}]))) @@ -1394,7 +1394,7 @@ printf (" %s", archdependent{:}); printf (" %s\n", archdir); endif - if (! exist (archdir, "dir")) + if (! exist (archdir, "dir")) mkdir (archdir); endif [status, output] = copyfile (archdependent, archdir); @@ -1430,8 +1430,8 @@ function create_pkgadddel (desc, packdir, nm, global_install) instpkg = fullfile (desc.dir, nm); instfid = fopen (instpkg, "wt"); - ## If it is exists, most of the PKG_* file should go into the - ## architecture dependent directory so that the autoload/mfilename + ## If it is exists, most of the PKG_* file should go into the + ## architecture dependent directory so that the autoload/mfilename ## commands work as expected. The only part that doesn't is the ## part in the main directory. archdir = fullfile (getarchprefix (desc), cstrcat (desc.name, "-", @@ -1497,7 +1497,7 @@ if (! exist (desc.dir, "dir")) [status, output] = mkdir (desc.dir); if (status != 1) - error ("couldn't create installation directory %s : %s", + error ("couldn't create installation directory %s : %s", desc.dir, output); endif endif @@ -1525,32 +1525,32 @@ [status, output] = mkdir (octm3); if (status != 1) rm_rf (desc.dir); - error ("couldn't create installation directory %s : %s", + error ("couldn't create installation directory %s : %s", octm3, output); endif endif [status, output] = mkdir (octm2); if (status != 1) rm_rf (desc.dir); - error ("couldn't create installation directory %s : %s", + error ("couldn't create installation directory %s : %s", octm2, output); endif endif [status, output] = mkdir (octm1); if (status != 1) rm_rf (desc.dir); - error ("couldn't create installation directory %s : %s", + error ("couldn't create installation directory %s : %s", octm1, output); endif endif [status, output] = mkdir (octfiledir); if (status != 1) rm_rf (desc.dir); - error ("couldn't create installation directory %s : %s", + error ("couldn't create installation directory %s : %s", octfiledir, output); endif endif - [status, output] = movefile (fullfile (desc.dir, getarch (), "*"), + [status, output] = movefile (fullfile (desc.dir, getarch (), "*"), octfiledir); rm_rf (fullfile (desc.dir, getarch ())); @@ -1785,7 +1785,7 @@ version = fix_version (parts{2}); ## If no version is specified for the dependency - ## we say that the version should be greater than + ## we say that the version should be greater than ## or equal to "0.0.0". else package = tolower (strip (dep)); @@ -1849,7 +1849,7 @@ error ("couldn't read directory %s: %s", class_dir, msg); endif files2 = strcat (class_name, filesep (), files2); - files = [files; files2]; + files = [files; files2]; endif endfor @@ -1860,7 +1860,7 @@ if (err) error ("couldn't read directory %s: %s", tmpdir, msg); endif - files = [files; files2]; + files = [files; files2]; endif functions = {}; @@ -1957,7 +1957,7 @@ endfor if (! isempty(dup)) installed_pkgs_lst(dup) = []; - endif + endif ## Now check if the package is loaded. tmppath = strrep (path(), "\\", "/"); @@ -2004,9 +2004,9 @@ h1 = "Package Name"; h2 = "Version"; h3 = "Installation directory"; - max_name_length = length (h1); + max_name_length = length (h1); max_version_length = length (h2); - names = cell (num_packages, 1); + names = cell (num_packages, 1); for i = 1:num_packages max_name_length = max (max_name_length, length (installed_pkgs_lst{i}.name)); @@ -2043,7 +2043,7 @@ first_char = length (cur_dir) - max_dir_length + 4; first_filesep = strfind (cur_dir(first_char:end), filesep()); if (! isempty (first_filesep)) - cur_dir = cstrcat ("...", + cur_dir = cstrcat ("...", cur_dir((first_char + first_filesep(1) - 1):end)); else cur_dir = cstrcat ("...", cur_dir(first_char:end)); @@ -2073,7 +2073,7 @@ if (length (files) == 1 && strcmp (files{1}, "all")) idx = [1:length(installed_pkgs_lst)]; ## Load auto. - elseif (length (files) == 1 && strcmp (files{1}, "auto")) + elseif (length (files) == 1 && strcmp (files{1}, "auto")) idx = []; for i = 1:length (installed_pkgs_lst) if (exist (fullfile (pdirs{i}, "packinfo", ".autoload"), "file")) @@ -2209,7 +2209,7 @@ function archprefix = getarchprefix (desc, global_install) if ((nargin == 2 && global_install) || (nargin < 2 && issuperuser ())) - archprefix = fullfile (octave_config_info ("libexecdir"), "octave", + archprefix = fullfile (octave_config_info ("libexecdir"), "octave", "packages", cstrcat(desc.name, "-", desc.version)); else archprefix = desc.dir; @@ -2267,7 +2267,7 @@ endif endfor endfor - if (! isempty (tmpdesc)) + if (! isempty (tmpdesc)) newdesc = {newdesc{:}, save_order(tmpdesc){:}, desc{i}}; else newdesc{end+1} = desc{i}; @@ -2336,7 +2336,7 @@ endif endfor endfor - idx = load_package_dirs (tmplidx, idx, handle_deps, + idx = load_package_dirs (tmplidx, idx, handle_deps, installed_pkgs_lst); endif endif
--- a/scripts/plot/__fltk_ginput__.m +++ b/scripts/plot/__fltk_ginput__.m @@ -39,10 +39,10 @@ orig_ginput_keypressfcn = get (f, "keypressfcn"); set (f, "keypressfcn", @ginput_keypressfcn); - + while (true) __fltk_redraw__ (); - + ## release CPU sleep (0.01); @@ -51,7 +51,7 @@ break; endif endwhile - + ## FIXME -- got to get the buttons somehow button = ones (size (x)); unwind_protect_cleanup
--- a/scripts/plot/__gnuplot_ginput__.m +++ b/scripts/plot/__gnuplot_ginput__.m @@ -127,12 +127,12 @@ if (nargin > 1) ## Input argument n was given => stop when k == n. - if (k == n) - break; + if (k == n) + break; endif else ## Input argument n not given => stop when hitting a return key. - ## if (button(k) == 0x0D || button(k) == 0x0A) + ## if (button(k) == 0x0D || button(k) == 0x0A) ## ## hit Return or Enter if (button(k) == 0x0D) ## hit Return
--- a/scripts/plot/__gnuplot_has_feature__.m +++ b/scripts/plot/__gnuplot_has_feature__.m @@ -1,5 +1,5 @@ ## Copyright (C) 2009-2011 Ben Abbott -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it
--- a/scripts/plot/__gnuplot_open_stream__.m +++ b/scripts/plot/__gnuplot_open_stream__.m @@ -1,5 +1,5 @@ ## Copyright (C) 2009-2011 Ben Abbott -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it
--- a/scripts/plot/__gnuplot_print__.m +++ b/scripts/plot/__gnuplot_print__.m @@ -115,7 +115,7 @@ opts.ghostscript.output = opts.name; opts.ghostscript.source = strcat (tmpnam (), ".eps"); eps_drawnow (opts, opts.ghostscript.source, gp_opts); - [cmd_gs, cmd_cleanup] = __ghostscript__ (opts.ghostscript); + [cmd_gs, cmd_cleanup] = __ghostscript__ (opts.ghostscript); if (opts.send_to_printer || isempty (opts.name)) cmd_lpr = opts.lpr_cmd (opts); cmd = sprintf ("%s | %s", cmd_gs, cmd_lpr); @@ -151,7 +151,7 @@ endif [status, output] = system (pipeline{n}); if (status) - fprintf ("%s\n%s\n%s\n", + fprintf ("%s\n%s\n%s\n", "---------- output begin ----------", output, "----------- output end -----------"); @@ -204,7 +204,7 @@ f = sprintf ("%d", opts.fontsize); endif case {"eps", "eps2", "epsc", "epsc2"} - ## Gnuplot renders fonts as half their specification, which + ## Gnuplot renders fonts as half their specification, which ## results in a tight spacing for the axes-labels and tick-labels. ## Compensate for the half scale. This will produce the proper ## spacing for the requested fontsize.
--- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -23,7 +23,7 @@ ## Author: jwe -function __go_draw_axes__ (h, plot_stream, enhanced, mono, +function __go_draw_axes__ (h, plot_stream, enhanced, mono, bg_is_set, fg_is_set, hlgnd) if (nargin >= 4 && nargin <= 7) @@ -48,7 +48,7 @@ nd = __calc_dimensions__ (h); - if (strcmp (axis_obj.dataaspectratiomode, "manual") + if (strcmp (axis_obj.dataaspectratiomode, "manual") && strcmp (axis_obj.xlimmode, "manual") && strcmp (axis_obj.ylimmode, "manual")) ## All can't be "manual" @@ -106,9 +106,9 @@ pos(3:4) = pos(3:4) * 1.4; pos(1:2) = pos(1:2) - pos(3:4) * 0.125; endif - + fprintf (plot_stream, "set origin %.15g, %.15g;\n", pos(1), pos(2)); - + if (strcmpi (axis_obj.dataaspectratiomode, "manual")) sz_str = sprintf ("set size ratio %.15g", -dr); else @@ -525,7 +525,7 @@ rows(xdat), xaxisloc_using, yaxisloc_using); endif - style = do_linestyle_command (obj, obj.color, data_idx, mono, + style = do_linestyle_command (obj, obj.color, data_idx, mono, plot_stream, errbars); withclause{data_idx} = sprintf ("with %s linestyle %d", @@ -533,7 +533,7 @@ if (length (style) > 1) data_idx++; - is_image_data(data_idx) = is_image_data(data_idx - 1); + is_image_data(data_idx) = is_image_data(data_idx - 1); parametric(data_idx) = parametric(data_idx - 1); have_cdata(data_idx) = have_cdata(data_idx - 1); have_3d_patch(data_idx) = have_3d_patch(data_idx - 1); @@ -545,7 +545,7 @@ endif if (length (style) > 2) data_idx++; - is_image_data(data_idx) = is_image_data(data_idx - 1); + is_image_data(data_idx) = is_image_data(data_idx - 1); parametric(data_idx) = parametric(data_idx - 1); have_cdata(data_idx) = have_cdata(data_idx - 1); have_3d_patch(data_idx) = have_3d_patch(data_idx - 1); @@ -583,7 +583,7 @@ if (! isnan (xcol) && ! isnan (ycol)) ## Is the patch closed or not - if (strncmp (obj.facecolor, "none", 4)) + if (strncmp (obj.facecolor, "none", 4)) hidden_removal = false; else @@ -596,7 +596,7 @@ else if (isnan (data_3d_idx)) data_idx++; - data_3d_idx = data_idx; + data_3d_idx = data_idx; is_image_data(data_idx) = false; parametric(data_idx) = false; have_cdata(data_idx) = true; @@ -657,7 +657,7 @@ if (nd == 3 && numel (xcol) == 3) ccdat = ccol; if (! isvector (ccdat)) - tmp = rows(cmap) + rows(addedcmap) + ... + tmp = rows(cmap) + rows(addedcmap) + ... [1 : rows(ccdat)]; addedcmap = [addedcmap; ccdat]; ccdat = tmp(:); @@ -711,7 +711,7 @@ ## patch outline if (!(strncmp (obj.edgecolor, "none", 4) - && (strncmp (obj.marker, "none", 4) + && (strncmp (obj.marker, "none", 4) || (strncmp (obj.markeredgecolor, "none", 4) && strncmp (obj.markerfacecolor, "none", 4))))) @@ -846,11 +846,11 @@ tmpwith = {}; facesame = true; - if (! isequal (pt, pt2) && isfield (obj, "markerfacecolor") + if (! isequal (pt, pt2) && isfield (obj, "markerfacecolor") && !strncmp (obj.markerfacecolor, "none", 4)) if (strncmp (obj.markerfacecolor, "auto", 4) - || ! isnumeric (obj.markerfacecolor) - || (isnumeric (obj.markerfacecolor) + || ! isnumeric (obj.markerfacecolor) + || (isnumeric (obj.markerfacecolor) && isequal (color, obj.markerfacecolor))) style = strcat (style, "points"); if (isfield (obj, "markersize")) @@ -865,13 +865,13 @@ endif tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s", - style, lw, pt2, lt, ps, + style, lw, pt2, lt, ps, colorspec); else facesame = false; - if (! isempty (style)) + if (! isempty (style)) tmpwith{sidx} = sprintf ("with %s %s %s %s", - style, lw, lt, + style, lw, lt, colorspec); sidx ++; endif @@ -891,20 +891,20 @@ ps = ""; endif tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s", - style, lw, pt2, lt, ps, + style, lw, pt2, lt, ps, colorspec); endif endif - if (isfield (obj, "markeredgecolor") + if (isfield (obj, "markeredgecolor") && !strncmp (obj.markeredgecolor, "none", 4)) - if (facesame && !isempty (pt) + if (facesame && !isempty (pt) && (strncmp (obj.markeredgecolor, "auto", 4) - || ! isnumeric (obj.markeredgecolor) - || (isnumeric (obj.markeredgecolor) + || ! isnumeric (obj.markeredgecolor) + || (isnumeric (obj.markeredgecolor) && isequal (color, obj.markeredgecolor)))) - if (sidx == 1 && ((length (style) == 5 - && strncmp (style, "lines", 5)) + if (sidx == 1 && ((length (style) == 5 + && strncmp (style, "lines", 5)) || isempty (style))) style = strcat (style, "points"); if (isfield (obj, "markersize")) @@ -918,20 +918,20 @@ ps = ""; endif tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s", - style, lw, pt, lt, ps, + style, lw, pt, lt, ps, colorspec); endif else - if (!isempty (style)) + if (!isempty (style)) if (length(tmpwith) < sidx || isempty (tmpwith{sidx})) tmpwith{sidx} = sprintf ("with %s %s %s %s", - style, lw, lt, + style, lw, lt, colorspec); endif sidx ++; endif - if (!isempty (pt)) + if (!isempty (pt)) if (! mono) if (strncmp (obj.markeredgecolor, "auto", 4)) colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"", @@ -953,7 +953,7 @@ ps = ""; endif tmpwith{sidx} = sprintf ("with %s %s %s %s %s %s", - style, lw, pt, lt, ps, + style, lw, pt, lt, ps, colorspec); endif endif @@ -961,7 +961,7 @@ if (isempty (tmpwith)) withclause{data_idx} = sprintf ("with %s %s %s %s %s", - style, lw, pt, lt, + style, lw, pt, lt, colorspec); else withclause{data_idx} = tmpwith{1}; @@ -1005,7 +1005,7 @@ if (length (tmpwith) > 1) data_idx++; - is_image_data(data_idx) = is_image_data(data_idx - 1); + is_image_data(data_idx) = is_image_data(data_idx - 1); parametric(data_idx) = parametric(data_idx - 1); have_cdata(data_idx) = have_cdata(data_idx - 1); have_3d_patch(data_idx) = have_3d_patch(data_idx - 1); @@ -1016,7 +1016,7 @@ endif if (length (tmpwith) > 2) data_idx++; - is_image_data(data_idx) = is_image_data(data_idx - 1); + is_image_data(data_idx) = is_image_data(data_idx - 1); parametric(data_idx) = parametric(data_idx - 1); have_cdata(data_idx) = have_cdata(data_idx - 1); have_3d_patch(data_idx) = have_3d_patch(data_idx - 1); @@ -1038,7 +1038,7 @@ have_cdata(data_idx) = true; have_3d_patch(data_idx) = false; style = do_linestyle_command (obj, obj.edgecolor, - data_idx, mono, + data_idx, mono, plot_stream); if (isempty (obj.displayname)) @@ -1127,7 +1127,7 @@ fputs(plot_stream,"unset pm3d;\n"); fputs(plot_stream,"set style increment user;\n"); withpm3d = false; - withclause{data_idx} = sprintf("with %s linestyle %d", + withclause{data_idx} = sprintf("with %s linestyle %d", style{1}, data_idx); fputs (plot_stream, "unset pm3d\n"); endif @@ -1140,23 +1140,23 @@ endif if (flat_interp_face && strncmp (obj.edgecolor, "flat", 4)) - fprintf (plot_stream, "set pm3d explicit at s %s %s corners2color c3;\n", + fprintf (plot_stream, "set pm3d explicit at s %s %s corners2color c3;\n", interp_str, dord); elseif (!facecolor_none_or_white) if (strncmp (obj.edgecolor, "none", 4)) - if (__gnuplot_has_feature__ ("transparent_surface") + if (__gnuplot_has_feature__ ("transparent_surface") && isscalar (obj.facealpha)) fprintf (plot_stream, "set style fill transparent solid %f;\n", obj.facealpha); endif - fprintf (plot_stream, "set pm3d explicit at s %s corners2color c3;\n", + fprintf (plot_stream, "set pm3d explicit at s %s corners2color c3;\n", interp_str, dord); else - fprintf (plot_stream, "set pm3d explicit at s hidden3d %d %s %s corners2color c3;\n", + fprintf (plot_stream, "set pm3d explicit at s hidden3d %d %s %s corners2color c3;\n", data_idx, interp_str, dord); - if (__gnuplot_has_feature__ ("transparent_surface") + if (__gnuplot_has_feature__ ("transparent_surface") && isscalar (obj.facealpha)) fprintf (plot_stream, "set style fill transparent solid %f;\n", @@ -1164,7 +1164,7 @@ endif endif endif - + zz = []; if (length (style) > 1) len = 3 * xlen; @@ -1179,7 +1179,7 @@ zz = zz.'; data_idx++; - is_image_data(data_idx) = is_image_data(data_idx - 1); + is_image_data(data_idx) = is_image_data(data_idx - 1); parametric(data_idx) = parametric(data_idx - 1); have_cdata(data_idx) = false; have_3d_patch(data_idx) = have_3d_patch(data_idx - 1); @@ -1192,7 +1192,7 @@ endif if (length (style) > 2) data_idx++; - is_image_data(data_idx) = is_image_data(data_idx - 1); + is_image_data(data_idx) = is_image_data(data_idx - 1); parametric(data_idx) = parametric(data_idx - 1); have_cdata(data_idx) = false; have_3d_patch(data_idx) = have_3d_patch(data_idx - 1); @@ -1216,7 +1216,7 @@ zz = zz.'; endif data_idx++; - is_image_data(data_idx) = is_image_data(data_idx - 1); + is_image_data(data_idx) = is_image_data(data_idx - 1); parametric(data_idx) = parametric(data_idx - 1); have_cdata(data_idx) = false; have_3d_patch(data_idx) = have_3d_patch(data_idx - 1); @@ -1245,7 +1245,7 @@ else units = ""; endif - + if (isnumeric (color)) colorspec = get_text_colorspec (color, mono); endif @@ -1354,7 +1354,7 @@ fprintf (plot_stream, "set zrange [%.15e:%.15e] %s;\n", zlim, zdir); endif - cmap = parent_figure_obj.colormap; + cmap = parent_figure_obj.colormap; cmap_sz = rows(cmap); if (! any (isinf (clim))) if (truecolor || ! cdatadirect) @@ -1364,13 +1364,13 @@ data{i}(end,:) = clim(2) * (data{i}(end, :) - 0.5) / cmap_sz; endif endfor - fprintf (plot_stream, "set cbrange [%g:%g];\n", clim(1), clim(2) * + fprintf (plot_stream, "set cbrange [%g:%g];\n", clim(1), clim(2) * (cmap_sz + rows(addedcmap)) / cmap_sz); else fprintf (plot_stream, "set cbrange [%g:%g];\n", clim); endif else - fprintf (plot_stream, "set cbrange [1:%d];\n", cmap_sz + + fprintf (plot_stream, "set cbrange [1:%d];\n", cmap_sz + rows (addedcmap)); endif endif @@ -1463,7 +1463,7 @@ pos = "right bottom"; case "southwest" pos = "left bottom"; - case "best" + case "best" pos = ""; warning ("legend: 'Best' not yet implemented for location specifier.\n"); ## Least conflict with data in plot. @@ -1477,7 +1477,7 @@ else fontspec = ""; endif - fprintf (plot_stream, "set key %s %s;\nset key %s %s %s %s;\n", + fprintf (plot_stream, "set key %s %s;\nset key %s %s %s %s;\n", inout, pos, box, reverse, horzvert, fontspec); else fputs (plot_stream, "unset key;\n"); @@ -1534,7 +1534,7 @@ elseif (is_image_data (i)) if (! is_image_data (i-1)) fputs (plot_stream, "; "); - if (bg_is_set) + if (bg_is_set) fputs (plot_stream, "unset obj 1; \\\n"); bg_is_set = false; endif @@ -1546,7 +1546,7 @@ fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd, usingclause{i}, titlespec{i}, withclause{i}); elseif (is_image_data (i-1)) - if (bg_is_set) + if (bg_is_set) fputs (plot_stream, "unset obj 1; \\\n"); bg_is_set = false; endif @@ -1564,7 +1564,7 @@ fputs (plot_stream, ";\n"); for i = 1:data_idx if (have_3d_patch (i)) - ## Can't write 3d patch data as binary as can't plot more than + ## Can't write 3d patch data as binary as can't plot more than ## a single patch at a time and have to plot all patches together ## so that the gnuplot depth ordering is done correctly for j = 1 : 4 : columns(data{i}) @@ -1580,7 +1580,7 @@ elseif (is_image_data(i)) fwrite (plot_stream, data{i}, "float32"); else - __gnuplot_write_data__ (plot_stream, data{i}, nd, parametric(i), + __gnuplot_write_data__ (plot_stream, data{i}, nd, parametric(i), have_cdata(i)); endif endfor @@ -1592,8 +1592,8 @@ if (view_map) fputs (plot_stream, "unset view;\n"); endif - - if (bg_is_set) + + if (bg_is_set) fputs (plot_stream, "unset obj 1;\n"); bg_is_set = false; endif @@ -1679,11 +1679,11 @@ endif facesame = true; - if (! isequal (pt, pt2) && isfield (obj, "markerfacecolor") + if (! isequal (pt, pt2) && isfield (obj, "markerfacecolor") && !strncmp (obj.markerfacecolor, "none", 4)) if (strncmp (obj.markerfacecolor, "auto", 4) - || ! isnumeric (obj.markerfacecolor) - || (isnumeric (obj.markerfacecolor) + || ! isnumeric (obj.markerfacecolor) + || (isnumeric (obj.markerfacecolor) && isequal (color, obj.markerfacecolor))) if (! isempty (pt2)) fprintf (plot_stream, " pointtype %s", pt2); @@ -1698,7 +1698,7 @@ fputs (plot_stream, " default"); endif fputs (plot_stream, ";\n"); - if (! isempty (style {sidx})) + if (! isempty (style {sidx})) sidx ++; idx ++; else @@ -1719,14 +1719,14 @@ endif endif endif - if (isfield (obj, "markeredgecolor") + if (isfield (obj, "markeredgecolor") && !strncmp (obj.markeredgecolor, "none", 4)) if (facesame && !isempty (pt) && (strncmp (obj.markeredgecolor, "auto", 4) - || ! isnumeric (obj.markeredgecolor) - || (isnumeric (obj.markeredgecolor) + || ! isnumeric (obj.markeredgecolor) + || (isnumeric (obj.markeredgecolor) && isequal (color, obj.markeredgecolor)))) - if (sidx == 1 && ((length (style {sidx}) == 5 + if (sidx == 1 && ((length (style {sidx}) == 5 && strncmp (style {sidx}, "lines", 5)) || isempty (style {sidx}))) if (! isempty (pt)) style {sidx} = strcat (style{sidx}, "points"); @@ -1741,7 +1741,7 @@ fputs (plot_stream, " default"); endif fputs (plot_stream, ";\n"); - if (!isempty (style {sidx})) + if (!isempty (style {sidx})) sidx ++; idx ++; else @@ -1842,7 +1842,7 @@ endfunction function __gnuplot_write_data__ (plot_stream, data, nd, parametric, cdata) - + ## DATA is already transposed. ## FIXME -- this may need to be converted to C++ for speed. @@ -1994,13 +1994,13 @@ nlabels = numel (labels); fprintf (plot_stream, "set format %s \"%%s\";\n", ax); if (mirror) - fprintf (plot_stream, "set %stics %s %s %s mirror (", ax, + fprintf (plot_stream, "set %stics %s %s %s mirror (", ax, tickdir, ticklength, axispos); else fprintf (plot_stream, "set %stics %s %s %s nomirror (", ax, tickdir, ticklength, axispos); endif - + labels = regexprep(labels, '%', "%%"); for i = 1:ntics fprintf (plot_stream, " \"%s\" %.15g", labels{k++}, tics(i)); @@ -2040,10 +2040,10 @@ else fprintf (plot_stream, "set format %s \"%s\";\n", ax, fmt); if (mirror) - fprintf (plot_stream, "set %stics %s %s %s mirror %s %s;\n", ax, + fprintf (plot_stream, "set %stics %s %s %s mirror %s %s;\n", ax, axispos, tickdir, ticklength, colorspec, fontspec); else - fprintf (plot_stream, "set %stics %s %s %s nomirror %s %s;\n", ax, + fprintf (plot_stream, "set %stics %s %s %s nomirror %s %s;\n", ax, tickdir, ticklength, axispos, colorspec, fontspec); endif if (strcmp (mtics, "on")) @@ -2174,19 +2174,19 @@ elseif (strncmp (f, "it", 2) || strncmp (f, "sl", 2)) it = true; if (bld) - str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ', + str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ', str(s(i) + 3:end)); else - str = cstrcat (str(1:s(i) - 1), '/', fnt, '-italic ', + str = cstrcat (str(1:s(i) - 1), '/', fnt, '-italic ', str(s(i) + 3:end)); endif elseif (strncmp (f, "bf", 2)) bld = true; if (it) - str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ', + str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ', str(2(i) + 3:end)); else - str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bold ', + str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bold ', str(s(i) + 3:end)); endif elseif (strcmpi (f, "color")) @@ -2203,7 +2203,7 @@ if (isempty(b1) || isempty(b2)) warning ('syntax error in \fontname argument'); else - str = cstrcat (str(1:s(i) - 1), '/', + str = cstrcat (str(1:s(i) - 1), '/', str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}', str(e(i) + b2(1) + 1:end)); endif @@ -2213,7 +2213,7 @@ if (isempty(b1) || isempty(b2)) warning ('syntax error in \fontname argument'); else - str = cstrcat (str(1:s(i) - 1), '/=', + str = cstrcat (str(1:s(i) - 1), '/=', str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}', str(e(i) + b2(1) + 1:end)); endif @@ -2233,7 +2233,7 @@ ##elseif (it) ## g = regexprep (g, '/Symbol', '/Symbol-italic'); ##endif - str = cstrcat (str(1:s(i) - 1), g, + str = cstrcat (str(1:s(i) - 1), g, str(s(i) + length (flds{j}) + 1:end)); break; endif
--- a/scripts/plot/__go_draw_figure__.m +++ b/scripts/plot/__go_draw_figure__.m @@ -60,7 +60,7 @@ continue; else ca = lh(1); - ## Rely upon listener to convert axes position + ## Rely upon listener to convert axes position ## to "normalized" units. legend_axes_units = get (kids(i), "units"); legend_axes_position = get (kids(i), "position"); @@ -72,11 +72,11 @@ unwind_protect set (ca, "units", "normalized"); - set (kids(i), "units", "normalized", "box", "off", + set (kids(i), "units", "normalized", "box", "off", "ylim", [-2, -1], "position", get (ca(1), "position"), "outerposition", get (ca(1), "outerposition")); - ## Create a new set of lines with the appropriate + ## Create a new set of lines with the appropriate ## displaynames, etc toberm = []; hobj = get (kids(i), "children"); @@ -91,7 +91,7 @@ if (! strcmp (get (hobj(k), "type"), "line")) continue; endif - if (get (hobj(j), "userdata") + if (get (hobj(j), "userdata") != get (hobj(k), "userdata")) continue; endif @@ -122,9 +122,9 @@ ## Return axes "units" and "position" back to ## their original values. set (ca, "units", orig_axes_units); - set (kids(i), "units", legend_axes_units, - "box", legend_axes_box, - "ylim", legend_axes_ylim, + set (kids(i), "units", legend_axes_units, + "box", legend_axes_box, + "ylim", legend_axes_ylim, "position", legend_axes_position, "outerposition", legend_axes_outerposition); delete (toberm); @@ -132,7 +132,7 @@ end_unwind_protect endif else - ## Rely upon listener to convert axes position + ## Rely upon listener to convert axes position ## to "normalized" units. orig_axes_units = get (kids(i), "units"); orig_axes_position = get (kids(i), "position"); @@ -153,11 +153,11 @@ hlegend = []; fkids = get (h, "children"); for j = 1 : numel(fkids) - if (ishandle (fkids (j)) - && strcmp (get (fkids (j), "type"), "axes") + if (ishandle (fkids (j)) + && strcmp (get (fkids (j), "type"), "axes") && (strcmp (get (fkids (j), "tag"), "legend"))) udata = get (fkids (j), "userdata"); - if (isscalar(udata.handle) + if (isscalar(udata.handle) && ! isempty (intersect (udata.handle, kids (i)))) hlegend = get (fkids (j)); break; @@ -192,7 +192,7 @@ endif else print_usage (); - endif + endif endfunction
--- a/scripts/plot/__marching_cube__.m +++ b/scripts/plot/__marching_cube__.m @@ -83,7 +83,7 @@ ## Author: Martin Helm <martin@mhelm.de> function [T, p, col] = __marching_cube__ (xx, yy, zz, c, iso, colors) - + persistent edge_table=[]; persistent tri_table=[]; @@ -93,24 +93,24 @@ if (isempty (tri_table) || isempty (edge_table)) [edge_table, tri_table] = init_mc (); endif - + if ((nargin != 5 && nargin != 6) || (nargout != 2 && nargout != 3)) print_usage (); endif - + if (!ismatrix (xx) || !ismatrix (yy) || !ismatrix (zz) || !ismatrix (c) || ... ndims (xx) != 3 || ndims (yy) != 3 || ndims (zz) != 3 || ndims (c) != 3) error ("__marching_cube__: XX, YY, ZZ, C must be matrices of dim 3"); endif - + if (!size_equal (xx, yy, zz, c)) error ("__marching_cube__: XX, YY, ZZ, C must be of equal size"); endif - + if (any (size (xx) < [2 2 2])) error ("__marching_cube__: grid size must be at least 2x2x2"); endif - + if (!isscalar (iso)) error ("__marching_cube__: ISO must be scalar value"); endif @@ -122,14 +122,14 @@ calc_cols = true; lindex = 5; endif - + n = size (c) - 1; - + ## phase I: assign information to each voxel which edges are intersected by ## the isosurface cc = zeros (n(1), n(2), n(3), "uint16"); cedge = zeros (size (cc), "uint16"); - + vertex_idx = {1:n(1), 1:n(2), 1:n(3); ... 2:n(1)+1, 1:n(2), 1:n(3); ... 2:n(1)+1, 2:n(2)+1, 1:n(3); ... @@ -138,20 +138,20 @@ 2:n(1)+1, 1:n(2), 2:n(3)+1; ... 2:n(1)+1, 2:n(2)+1, 2:n(3)+1; ... 1:n(1), 2:n(2)+1, 2:n(3)+1 }; - + ## calculate which vertices have values higher than iso for ii=1:8 idx = c(vertex_idx{ii, :}) > iso; cc(idx) = bitset (cc(idx), ii); - endfor - + endfor + cedge = edge_table(cc+1); # assign the info about intersected edges id = find (cedge); # select only voxels which are intersected if (isempty (id)) T = p = col = []; return endif - + ## phase II: calculate the list of intersection points xyz_off = [1, 1, 1; 2, 1, 1; 2, 2, 1; 1, 2, 1; 1, 1, 2; 2, 1, 2; 2, 2, 2; 1, 2, 2]; edges = [1 2; 2 3; 3 4; 4 1; 5 6; 6 7; 7 8; 8 5; 1 5; 2 6; 3 7; 4 8]; @@ -177,8 +177,8 @@ endif ix_offset += size (id_, 1); endfor - - ## phase III: calculate the triangulation from the point list + + ## phase III: calculate the triangulation from the point list T = []; tri = tri_table(cc(id)+1, :); for jj=1:3:15 @@ -191,7 +191,7 @@ T = [T; pp(p1), pp(p2), pp(p3)]; endif endfor - + p = []; col = []; for jj = 1:12 @@ -207,12 +207,12 @@ function p = vertex_interp(isolevel,p1x, p1y, p1z,... p2x, p2y, p2z,valp1,valp2, col1, col2) - + if (nargin == 9) p = zeros (length (p1x), 3); elseif (nargin == 11) p = zeros (length (p1x), 4); - else + else error ("__marching_cube__: wrong number of arguments"); endif mu = zeros (length (p1x), 1); @@ -269,8 +269,8 @@ 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99 , 0x190, ... 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, ... 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0 ]; - - tri_table =[ + + tri_table =[ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1; 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1; 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;
--- a/scripts/plot/__next_line_color__.m +++ b/scripts/plot/__next_line_color__.m @@ -32,7 +32,7 @@ persistent color_index; if (nargin < 2) - if (nargin == 1) + if (nargin == 1) if (reset || isempty (color_rotation)) color_rotation = get (gca (), "colororder"); num_colors = rows (color_rotation);
--- a/scripts/plot/__next_line_style__.m +++ b/scripts/plot/__next_line_style__.m @@ -44,10 +44,10 @@ style_index = 1; endif elseif (! isempty (style_rotation)) - options = __pltopt__ ("__next_line_style__", + options = __pltopt__ ("__next_line_style__", style_rotation (style_index)); linestyle = options.linestyle; - marker = options.marker; + marker = options.marker; else error ("__next_line_style__: style_rotation not initialized"); endif
--- a/scripts/plot/__plt_get_axis_arg__.m +++ b/scripts/plot/__plt_get_axis_arg__.m @@ -35,12 +35,12 @@ ## 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)) + if (nargin > 1 && length (varargin) > 0 && isnumeric (varargin{1}) + && numel (varargin{1}) == 1 && ishandle (varargin{1}(1)) && varargin{1}(1) != 0 && ! isfigure (varargin{1}(1))) tmp = varargin{1}; obj = get (tmp); - if ((strcmp (obj.type, "axes") && ! strcmp (obj.tag, "legend")) + if ((strcmp (obj.type, "axes") && ! strcmp (obj.tag, "legend")) || strcmp (obj.type, "hggroup")) h = ancestor (tmp, "axes"); varargin(1) = [];
--- a/scripts/plot/__print_parse_opts__.m +++ b/scripts/plot/__print_parse_opts__.m @@ -70,7 +70,7 @@ arg_st.lpr_options = ""; endif arg_st.unlink = {}; - + if (nargin > 0 && isfigure (varargin{1})) arg_st.figure = varargin{1}; varargin(1) = []; @@ -254,7 +254,7 @@ "ps", "ps2", "psc", "psc2", "pdf"}))) have_ghostscript = ! isempty (__ghostscript_binary__ ()); if (have_ghostscript) - file_exists = ((numel (dir (arg_st.name)) == 1) + file_exists = ((numel (dir (arg_st.name)) == 1) && (! isdir (arg_st.name))); if (! file_exists) arg_st.append_to_file = false; @@ -593,7 +593,7 @@ ## Aliases for other devices: "bmp", "png", "tiff", "tiffn", "pdf", ## "ps", "ps2", "psc", "psc2" ## - ## eps, epsc, eps2, epsc2 are not included here because those are + ## eps, epsc, eps2, epsc2 are not included here because those are ## are generated by the graphics toolkit. aliases.bmp = "bmp32b"; aliases.pdf = "pdfwrite";
--- a/scripts/plot/area.m +++ b/scripts/plot/area.m @@ -25,16 +25,16 @@ ## @deftypefnx {Function File} {} area (@var{h}, @dots{}) ## @deftypefnx {Function File} {@var{h} =} area (@dots{}) ## Area plot of cumulative sum of the columns of @var{y}. This shows the -## contributions of a value to a sum, and is functionally similar to -## @code{plot (@var{x}, cumsum (@var{y}, 2))}, except that the area under +## contributions of a value to a sum, and is functionally similar to +## @code{plot (@var{x}, cumsum (@var{y}, 2))}, except that the area under ## the curve is shaded. ## ## If the @var{x} argument is omitted it is assumed to be given by ## @code{1 : rows (@var{y})}. A value @var{lvl} can be defined that determines ## where the base level of the shading under the curve should be defined. ## -## Additional arguments to the @code{area} function are passed to the -## @code{patch}. The optional return value @var{h} provides a handle to +## Additional arguments to the @code{area} function are passed to the +## @code{patch}. The optional return value @var{h} provides a handle to ## area series object representing the patches of the areas. ## @seealso{plot, patch} ## @end deftypefn @@ -130,7 +130,7 @@ y0 = y1; addproperty ("basevalue", hg, "data", bv); - addlistener (hg, "basevalue", @move_baseline); + addlistener (hg, "basevalue", @move_baseline); addproperty ("edgecolor", hg, "patchedgecolor", get (h, "edgecolor")); addproperty ("linewidth", hg, "patchlinewidth", get (h, "linewidth")); @@ -138,9 +138,9 @@ addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor")); addlistener (hg, "edgecolor", @update_props); - addlistener (hg, "linewidth", @update_props); - addlistener (hg, "linestyle", @update_props); - addlistener (hg, "facecolor", @update_props); + addlistener (hg, "linewidth", @update_props); + addlistener (hg, "linestyle", @update_props); + addlistener (hg, "facecolor", @update_props); addproperty ("areagroup", hg, "data"); set (retval, "areagroup", retval); @@ -154,7 +154,7 @@ function update_props (h, d) kids = get (h, "children"); - set (kids, "edgecolor", get (h, "edgecolor"), + set (kids, "edgecolor", get (h, "edgecolor"), "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle"), "facecolor", get (h, "facecolor")); @@ -199,7 +199,7 @@ else y1 = y0 + y1; set (get (hh, "children"), "ydata", [y0(1); y1; flipud(y0)]); - endif + endif y0 = y1; endfor
--- a/scripts/plot/axis.m +++ b/scripts/plot/axis.m @@ -32,7 +32,7 @@ ## x-axis. The third and fourth specify the limits for the y-axis, and the ## fifth and sixth specify the limits for the z-axis. ## -## Without any arguments, @code{axis} turns autoscaling on. +## Without any arguments, @code{axis} turns autoscaling on. ## ## With one output argument, @code{x = axis} returns the current axes. ## @@ -73,11 +73,11 @@ ## The following options control the way axis limits are interpreted. ## ## @table @asis -## @item "auto" +## @item "auto" ## Set the specified axes to have nice limits around the data ## or all if no axes are specified. ## -## @item "manual" +## @item "manual" ## Fix the current axes limits. ## ## @item "tight" @@ -92,7 +92,7 @@ ## The following options affect the appearance of tic marks. ## ## @table @asis -## @item "on" +## @item "on" ## Turn tic marks and labels on for all axes. ## ## @item "off" @@ -103,7 +103,7 @@ ## specified axes and off for the remainder. ## ## @item "label[xyz]" -## Turn tic labels on for all axes, or turn them on for the +## Turn tic labels on for all axes, or turn them on for the ## specified axes and off for the remainder. ## ## @item "nolabel" @@ -119,10 +119,10 @@ ## @item "ij" ## Reverse y-axis, so lower values are nearer the top. ## -## @item "xy" -## Restore y-axis, so higher values are nearer the top. +## @item "xy" +## Restore y-axis, so higher values are nearer the top. ## @end table -## +## ## If an axes handle is passed as the first argument, then operate on ## this axes rather than the current axes. ## @end deftypefn @@ -184,7 +184,7 @@ if (strcmp (get (get (ca, "parent"), "__graphics_toolkit__"), "gnuplot")) ## FIXME - gnuplot applies the aspect ratio activepostionproperty. set (ca, "activepositionproperty", "position"); - ## The following line is a trick used to trigger the recalculation of + ## The following line is a trick used to trigger the recalculation of ## aspect related magnitudes even if the aspect ratio is the same ## (useful with the x11 gnuplot terminal after a window resize) set (ca, "dataaspectratiomode", "auto"); @@ -325,9 +325,9 @@ if (iscell (data)) data = data (find (! cellfun (@isempty, data))); if (! isempty (data)) - lims_min = min (cellfun (@min, cellfun (@min, data, 'uniformoutput', false)(:))); - lims_max = max (cellfun (@max, cellfun (@max, data, 'uniformoutput', false)(:))); - lims = [lims_min, lims_max]; + lims_min = min (cellfun (@min, cellfun (@min, data, 'uniformoutput', false)(:))); + lims_max = max (cellfun (@max, cellfun (@max, data, 'uniformoutput', false)(:))); + lims = [lims_min, lims_max]; else lims = [0, 1]; endif @@ -365,7 +365,7 @@ %! plot(t, x); %! title("equal plot"); %! axis("equal"); -%! +%! %! subplot(224); %! plot(t, x); %! title("normal plot again");
--- a/scripts/plot/bar.m +++ b/scripts/plot/bar.m @@ -28,7 +28,7 @@ ## If only one argument is given, @var{y}, it is taken as a vector of y-values ## and the x coordinates are taken to be the indices of the elements. ## -## The default width of 0.8 for the bars can be changed using @var{w}. +## The default width of 0.8 for the bars can be changed using @var{w}. ## ## If @var{y} is a matrix, then each column of @var{y} is taken to be a ## separate bar graph plotted on the same graph. By default the columns @@ -84,7 +84,7 @@ ## @end group ## @end example ## -## @seealso{barh, plot} +## @seealso{barh, plot} ## @end deftypefn ## Author: jwe
--- a/scripts/plot/barh.m +++ b/scripts/plot/barh.m @@ -28,7 +28,7 @@ ## If only one argument is given, it is taken as a vector of y-values ## and the x coordinates are taken to be the indices of the elements. ## -## The default width of 0.8 for the bars can be changed using @var{w}. +## The default width of 0.8 for the bars can be changed using @var{w}. ## ## If @var{y} is a matrix, then each column of @var{y} is taken to be a ## separate bar graph plotted on the same graph. By default the columns
--- a/scripts/plot/caxis.m +++ b/scripts/plot/caxis.m @@ -21,10 +21,10 @@ ## @deftypefnx {Function File} {} caxis (@var{h}, @dots{}) ## Set color axis limits for plots. ## -## The argument @var{limits} should be a 2-element vector specifying the +## The argument @var{limits} should be a 2-element vector specifying the ## lower and upper limits to assign to the first and last value in the ## colormap. Values outside this range are clamped to the first and last -## colormap entries. +## colormap entries. ## ## If @var{limits} is 'auto', then automatic colormap scaling is applied, ## whereas if @var{limits} is 'manual' the colormap scaling is set to manual. @@ -85,4 +85,4 @@ endif endfunction - +
--- a/scripts/plot/cla.m +++ b/scripts/plot/cla.m @@ -1,5 +1,5 @@ ## Copyright (C) 2008-2011 Ben Abbott -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it
--- a/scripts/plot/clabel.m +++ b/scripts/plot/clabel.m @@ -107,7 +107,7 @@ if (have_hg) if (! isempty (v)) if (have_labelspacing) - set (hg, "textlistmode", "manual", "textlist", v, + set (hg, "textlistmode", "manual", "textlist", v, "labelspacing", label_spacing, "showtext", "on"); else set (hg, "textlistmode", "manual", "textlist", v, "showtext", "on");
--- a/scripts/plot/colorbar.m +++ b/scripts/plot/colorbar.m @@ -123,9 +123,9 @@ __position_colorbox__ (loc, obj, ancestor (ax, "figure")); set (ax, "position", pos); - cax = __go_axes__ (get (ax, "parent"), "tag", "colorbar", - "handlevisibility", "on", - "activepositionproperty", "position", + cax = __go_axes__ (get (ax, "parent"), "tag", "colorbar", + "handlevisibility", "on", + "activepositionproperty", "position", "position", cpos); addproperty ("location", cax, "radio", "eastoutside|east|westoutside|west|northoutside|north|southoutside|south", @@ -156,8 +156,8 @@ endif endif - ctext = text (0, 0, "", "tag", "colorbar","visible", "off", - "handlevisibility", "off", "xliminclude", "off", + ctext = text (0, 0, "", "tag", "colorbar","visible", "off", + "handlevisibility", "off", "xliminclude", "off", "yliminclude", "off", "zliminclude", "off", "deletefcn", {@deletecolorbar, cax, obj}); @@ -363,25 +363,25 @@ %!demo %! clf -%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); +%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); %! imagesc(x) %! colorbar(); %!demo %! clf -%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); +%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); %! imagesc(x) %! colorbar("westoutside"); %!demo %! clf -%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); +%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); %! imagesc(x) %! colorbar("peer", gca (), "northoutside"); %!demo %! clf -%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); +%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); %! imagesc(x) %! colorbar("southoutside"); @@ -407,7 +407,7 @@ %!demo %! clf -%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); +%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); %! subplot(2,2,1) %! imagesc(x) %! colorbar(); @@ -423,7 +423,7 @@ %!demo %! clf -%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); +%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); %! subplot(1,2,1) %! imagesc(x) %! axis square; @@ -435,7 +435,7 @@ %!demo %! clf -%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); +%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); %! subplot(1,2,1) %! imagesc(x) %! axis square; @@ -447,7 +447,7 @@ %!demo %! clf -%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); +%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); %! subplot(2,1,1) %! imagesc(x) %! axis square; @@ -459,7 +459,7 @@ %!demo %! clf -%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); +%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); %! subplot(2,1,1) %! imagesc(x) %! axis square; @@ -471,7 +471,7 @@ %!demo %! clf -%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); +%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); %! subplot(1,2,1) %! imagesc(x) %! colorbar(); @@ -481,7 +481,7 @@ %!demo %! clf -%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); +%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); %! subplot(1,2,1) %! imagesc(x) %! colorbar("northoutside"); @@ -491,7 +491,7 @@ %!demo %! clf -%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); +%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); %! subplot(2,1,1) %! imagesc(x) %! colorbar(); @@ -501,7 +501,7 @@ %!demo %! clf -%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); +%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); %! subplot(2,1,1) %! imagesc(x) %! colorbar("northoutside"); @@ -511,7 +511,7 @@ %!demo %! clf -%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); +%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); %! subplot(1,2,1) %! contour(x) %! axis square; @@ -526,7 +526,7 @@ %!demo %! clf -%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); +%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); %! contour (x) %! xlim ([1, 64]) %! ylim ([1, 64]) @@ -535,7 +535,7 @@ %!demo %! clf -%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); +%! n = 64; x = kron (1:n,ones(n,1)); x = abs(x - x.'); %! contour (x) %! xlim ([1, 64]) %! ylim ([1, 64]) @@ -557,17 +557,17 @@ %!demo %! clf -%! n=5;x=linspace(0,5,n);y=linspace(0,1,n); -%! imagesc(1./hilb(n)); axis equal; colorbar +%! n=5;x=linspace(0,5,n);y=linspace(0,1,n); +%! imagesc(1./hilb(n)); axis equal; colorbar %!demo %! clf -%! n=5;x=linspace(0,5,n);y=linspace(0,1,n); -%! imagesc(x,y,1./hilb(n)); axis equal; colorbar +%! n=5;x=linspace(0,5,n);y=linspace(0,1,n); +%! imagesc(x,y,1./hilb(n)); axis equal; colorbar %!demo %! clf -%! n=5;x=linspace(0,5,n);y=linspace(0,1,n); +%! n=5;x=linspace(0,5,n);y=linspace(0,1,n); %! imagesc(y,x,1./hilb(n)); axis equal; colorbar ## This requires that the axes position be properly determined for "axes equal"
--- a/scripts/plot/comet.m +++ b/scripts/plot/comet.m @@ -1,5 +1,5 @@ ## Copyright (C) 2008-2011 Ben Abbott -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ ## @deftypefnx {Function File} {} comet (@var{x}, @var{y}) ## @deftypefnx {Function File} {} comet (@var{x}, @var{y}, @var{p}) ## @deftypefnx {Function File} {} comet (@var{ax}, @dots{}) -## Produce a simple comet style animation along the trajectory provided by +## Produce a simple comet style animation along the trajectory provided by ## the input coordinate vectors (@var{x}, @var{y}), where @var{x} will default ## to the indices of @var{y}. ## @@ -55,7 +55,7 @@ y = varargin{2}; p = varargin{3}; endif - + oldh = gca (); unwind_protect axes (h);
--- a/scripts/plot/comet3.m +++ b/scripts/plot/comet3.m @@ -1,5 +1,5 @@ ## Copyright (C) 2010-2011 Ben Abbott and John W. Eaton -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -20,7 +20,7 @@ ## @deftypefn {Function File} {} comet3 (@var{z}) ## @deftypefnx {Function File} {} comet3 (@var{x}, @var{y}, @var{z}, @var{p}) ## @deftypefnx {Function File} {} comet3 (@var{ax}, @dots{}) -## Produce a simple comet style animation along the trajectory provided by +## Produce a simple comet style animation along the trajectory provided by ## the input coordinate vectors (@var{x}, @var{y}), where @var{x} will default ## to the indices of @var{y}. ## @@ -56,7 +56,7 @@ z = varargin{3}; p = varargin{4}; endif - + oldh = gca (); unwind_protect axes (h);
--- a/scripts/plot/compass.m +++ b/scripts/plot/compass.m @@ -24,14 +24,14 @@ ## @deftypefnx {Function File} {@var{h} =} compass (@dots{}) ## ## Plot the @code{(@var{u}, @var{v})} components of a vector field emanating -## from the origin of a polar plot. If a single complex argument @var{z} is -## given, then @code{@var{u} = real (@var{z})} and @code{@var{v} = imag +## from the origin of a polar plot. If a single complex argument @var{z} is +## given, then @code{@var{u} = real (@var{z})} and @code{@var{v} = imag ## (@var{z})}. ## ## The style to use for the plot can be defined with a line style @var{style} ## in a similar manner to the line styles used with the @code{plot} command. ## -## The optional return value @var{h} provides a list of handles to the +## The optional return value @var{h} provides a list of handles to the ## the parts of the vector field (body, arrow and marker). ## ## @example @@ -81,8 +81,8 @@ endif endwhile - ## Matlab draws compass plots, with the arrow head as one continous - ## line, and each arrow separately. This is completely different than + ## Matlab draws compass plots, with the arrow head as one continous + ## line, and each arrow separately. This is completely different than ## quiver and quite ugly. n = length (u); xend = u;
--- a/scripts/plot/contour.m +++ b/scripts/plot/contour.m @@ -42,7 +42,7 @@ ## in a similar manner to the line styles used with the @code{plot} command. ## Any markers defined by @var{style} are ignored. ## -## The optional input and output argument @var{h} allows an axis handle to +## The optional input and output argument @var{h} allows an axis handle to ## be passed to @code{contour} and the handles to the contour objects to be ## returned. ## @seealso{contourc, patch, plot}
--- a/scripts/plot/contour3.m +++ b/scripts/plot/contour3.m @@ -43,7 +43,7 @@ ## in a similar manner to the line styles used with the @code{plot} command. ## Any markers defined by @var{style} are ignored. ## -## The optional input and output argument @var{h} allows an axis handle to +## The optional input and output argument @var{h} allows an axis handle to ## be passed to @code{contour} and the handles to the contour objects to be ## returned. ## @seealso{contourc, patch, plot}
--- a/scripts/plot/contourc.m +++ b/scripts/plot/contourc.m @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {[@var{c}, @var{lev}] =} contourc (@var{x}, @var{y}, @var{z}, @var{vn}) -## Compute isolines (contour lines) of the matrix @var{z}. +## Compute isolines (contour lines) of the matrix @var{z}. ## Parameters @var{x}, @var{y} and @var{vn} are optional. ## ## The return value @var{lev} is a vector of the contour levels. @@ -27,7 +27,7 @@ ## ## @example ## @group -## @var{c} = [lev1, x1, x2, @dots{}, levn, x1, x2, ... +## @var{c} = [lev1, x1, x2, @dots{}, levn, x1, x2, ... ## len1, y1, y2, @dots{}, lenn, y1, y2, @dots{}] ## @end group ## @end example @@ -35,10 +35,10 @@ ## @noindent ## in which contour line @var{n} has a level (height) of @var{levn} and ## length of @var{lenn}. -## -## If @var{x} and @var{y} are omitted they are taken as the row/column -## index of @var{z}. @var{vn} is either a scalar denoting the number of lines -## to compute or a vector containing the values of the lines. If only one +## +## If @var{x} and @var{y} are omitted they are taken as the row/column +## index of @var{z}. @var{vn} is either a scalar denoting the number of lines +## to compute or a vector containing the values of the lines. If only one ## value is wanted, set @code{@var{vn} = [val, val]}; ## If @var{vn} is omitted it defaults to 10. ## @@ -101,19 +101,19 @@ if (isvector (x) && isvector (y)) c = __contourc__ (x(:)', y(:)', z, vv); else - ## Indexes x,y for the purpose of __contourc__. + ## Indexes x,y for the purpose of __contourc__. ii = 1:size (z,2); jj = 1:size (z,1); - + ## Now call __contourc__ for the real work... c = __contourc__ (ii, jj, z, vv); - - ## Map the contour lines from index space (i,j) back + + ## Map the contour lines from index space (i,j) back ## to the original grid (x,y) i = 1; while (i < size (c,2)) - clen = c(2, i); + clen = c(2, i); ind = i + [1 : clen]; ci = c(1, ind); @@ -121,19 +121,19 @@ ## due to rounding errors some elements of ci and cj ## can fall out of the range of ii and jj and interp2 would - ## return NA for those values. - ## The permitted range is enforced here: - + ## return NA for those values. + ## The permitted range is enforced here: + ci = max (ci, 1); ci = min (ci, size (z, 2)); cj = max (cj, 1); cj = min (cj, size (z, 1)); - + c(1, ind) = interp2 (ii, jj, x, ci, cj); c(2, ind) = interp2 (ii, jj, y, ci, cj); - + i = i + clen + 1; endwhile endif - + if (nargout > 0) cout = c; lev = vv;
--- a/scripts/plot/cylinder.m +++ b/scripts/plot/cylinder.m @@ -24,7 +24,7 @@ ## @deftypefnx {Function File} {} cylinder (@var{ax}, @dots{}) ## Generates three matrices in @code{meshgrid} format, such that ## @code{surf (@var{x}, @var{y}, @var{z})} generates a unit cylinder. -## The matrices are of size @code{@var{n}+1}-by-@code{@var{n}+1}. +## The matrices are of size @code{@var{n}+1}-by-@code{@var{n}+1}. ## @var{r} is a vector containing the radius along the z-axis. ## If @var{n} or @var{r} are omitted then default values of 20 or [1 1] ## are assumed. @@ -48,7 +48,7 @@ function [xx, yy, zz] = cylinder (varargin) - [ax, args, nargs] = __plt_get_axis_arg__ ((nargout > 0), "cylinder", + [ax, args, nargs] = __plt_get_axis_arg__ ((nargout > 0), "cylinder", varargin{:}); if (nargs == 0)
--- a/scripts/plot/daspect.m +++ b/scripts/plot/daspect.m @@ -1,5 +1,5 @@ ## Copyright (C) 2010-2011 Ben Abbott -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} daspect (@var{data_aspect_ratio}) ## Set the data aspect ratio of the current axes. The aspect ratio is -## a normalized 3-element vector representing the span of the x, y, and +## a normalized 3-element vector representing the span of the x, y, and ## z-axes limits. ## @deftypefnx {Function File} {@var{data_aspect_ratio} =} daspect ( ) ## Return the data aspect ratio of the current axes.
--- a/scripts/plot/diffuse.m +++ b/scripts/plot/diffuse.m @@ -19,10 +19,10 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} diffuse (@var{sx}, @var{sy}, @var{sz}, @var{lv}) ## Calculate diffuse reflection strength of a surface defined by the normal -## vector elements @var{sx}, @var{sy}, @var{sz}. +## vector elements @var{sx}, @var{sy}, @var{sz}. ## The light vector can be specified using parameter @var{lv}. It can be ## given as 2-element vector [azimuth, elevation] in degrees or as 3-element -## vector [lx, ly, lz]. +## vector [lx, ly, lz]. ## @seealso{specular, surfl} ## @end deftypefn @@ -38,7 +38,7 @@ if (!size_equal (sx, sy, sz)) error ("diffuse: SX, SY, and SZ must have same size"); endif - + ## check for light vector (lv) argument if (length (lv) < 2 || length (lv) > 3) error ("diffuse: light vector LV must be a 2- or 3-element vector"); @@ -54,5 +54,5 @@ ns = sqrt (sx.^2 + sy.^2 + sz.^2); retval = (sx * lv(1) + sy * lv(2) + sz * lv(3)) ./ ns; retval(retval < 0) = 0; - + endfunction
--- a/scripts/plot/ellipsoid.m +++ b/scripts/plot/ellipsoid.m @@ -31,7 +31,7 @@ function [xx, yy, zz] = ellipsoid (varargin) - [h, varargin, nargin] = __plt_get_axis_arg__ ((nargout > 0), "ellipsoid", + [h, varargin, nargin] = __plt_get_axis_arg__ ((nargout > 0), "ellipsoid", varargin{:}); if (nargin != 6 && nargin != 7)
--- a/scripts/plot/errorbar.m +++ b/scripts/plot/errorbar.m @@ -148,24 +148,24 @@ %! errorbar(0:10, rand_1x11_data3, rand_1x11_data4, ">"); %!demo -%! x = 0:0.5:2*pi; -%! err = x/100; -%! y1 = sin (x); -%! y2 = cos (x); +%! x = 0:0.5:2*pi; +%! err = x/100; +%! y1 = sin (x); +%! y2 = cos (x); %! hg = errorbar (x, y1, err, "~", x, y2, err, ">"); %!demo -%! x = 0:0.5:2*pi; -%! err = x/100; -%! y1 = sin (x); -%! y2 = cos (x); +%! x = 0:0.5:2*pi; +%! err = x/100; +%! y1 = sin (x); +%! y2 = cos (x); %! hg = errorbar (x, y1, err, err, "#r", x, y2, err, err, "#~"); %!demo -%! x = 0:0.5:2*pi; -%! err = x/100; -%! y1 = sin (x); -%! y2 = cos (x); +%! x = 0:0.5:2*pi; +%! err = x/100; +%! y1 = sin (x); +%! y2 = cos (x); %! hg = errorbar (x, y1, err, err, err, err, "~>", ... %! x, y2, err, err, err, err, "#~>-*");
--- a/scripts/plot/ezcontour.m +++ b/scripts/plot/ezcontour.m @@ -25,8 +25,8 @@ ## ## Plots the contour lines of a function. @var{f} is a string, inline function ## or function handle with two arguments defining the function. By default the -## plot is over the domain @code{-2*pi < @var{x} < 2*pi} and @code{-2*pi < -## @var{y} < 2*pi} with 60 points in each dimension. +## plot is over the domain @code{-2*pi < @var{x} < 2*pi} and @code{-2*pi < +## @var{y} < 2*pi} with 60 points in each dimension. ## ## If @var{dom} is a two element vector, it represents the minimum and maximum ## value of both @var{x} and @var{y}. If @var{dom} is a four element vector, @@ -35,7 +35,7 @@ ## ## @var{n} is a scalar defining the number of points to use in each dimension. ## -## The optional return value @var{h} provides a list of handles to the +## The optional return value @var{h} provides a list of handles to the ## the parts of the vector field (body, arrow and marker). ## ## @example
--- a/scripts/plot/ezcontourf.m +++ b/scripts/plot/ezcontourf.m @@ -23,10 +23,10 @@ ## @deftypefnx {Function File} {} ezcontourf (@var{h}, @dots{}) ## @deftypefnx {Function File} {@var{h} =} ezcontourf (@dots{}) ## -## Plots the filled contour lines of a function. @var{f} is a string, inline -## function or function handle with two arguments defining the function. By -## default the plot is over the domain @code{-2*pi < @var{x} < 2*pi} and -## @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension. +## Plots the filled contour lines of a function. @var{f} is a string, inline +## function or function handle with two arguments defining the function. By +## default the plot is over the domain @code{-2*pi < @var{x} < 2*pi} and +## @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension. ## ## If @var{dom} is a two element vector, it represents the minimum and maximum ## value of both @var{x} and @var{y}. If @var{dom} is a four element vector, @@ -35,7 +35,7 @@ ## ## @var{n} is a scalar defining the number of points to use in each dimension. ## -## The optional return value @var{h} provides a list of handles to the +## The optional return value @var{h} provides a list of handles to the ## the parts of the vector field (body, arrow and marker). ## ## @example
--- a/scripts/plot/ezmesh.m +++ b/scripts/plot/ezmesh.m @@ -26,9 +26,9 @@ ## @deftypefnx {Function File} {@var{h} =} ezmesh (@dots{}) ## ## Plots the mesh defined by a function. @var{f} is a string, inline -## function or function handle with two arguments defining the function. By +## function or function handle with two arguments defining the function. By ## default the plot is over the domain @code{-2*pi < @var{x} < 2*pi} and -## @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension. +## @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension. ## ## If @var{dom} is a two element vector, it represents the minimum and maximum ## value of both @var{x} and @var{y}. If @var{dom} is a four element vector, @@ -37,14 +37,14 @@ ## ## @var{n} is a scalar defining the number of points to use in each dimension. ## -## If three functions are passed, then plot the parametrically defined -## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}), -## @var{fz} (@var{s}, @var{t})]}. +## If three functions are passed, then plot the parametrically defined +## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}), +## @var{fz} (@var{s}, @var{t})]}. ## ## If the argument 'circ' is given, then the function is plotted over a disk ## centered on the middle of the domain @var{dom}. ## -## The optional return value @var{h} provides a list of handles to the +## The optional return value @var{h} provides a list of handles to the ## the parts of the vector field (body, arrow and marker). ## ## @example
--- a/scripts/plot/ezmeshc.m +++ b/scripts/plot/ezmeshc.m @@ -28,7 +28,7 @@ ## Plots the mesh and contour lines defined by a function. @var{f} is a string, ## inline function or function handle with two arguments defining the function. ## By default the plot is over the domain @code{-2*pi < @var{x} < 2*pi} and -## @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension. +## @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension. ## ## If @var{dom} is a two element vector, it represents the minimum and maximum ## value of both @var{x} and @var{y}. If @var{dom} is a four element vector, @@ -37,14 +37,14 @@ ## ## @var{n} is a scalar defining the number of points to use in each dimension. ## -## If three functions are passed, then plot the parametrically defined -## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}), -## @var{fz} (@var{s}, @var{t})]}. +## If three functions are passed, then plot the parametrically defined +## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}), +## @var{fz} (@var{s}, @var{t})]}. ## ## If the argument 'circ' is given, then the function is plotted over a disk ## centered on the middle of the domain @var{dom}. ## -## The optional return value @var{h} provides a list of handles to the +## The optional return value @var{h} provides a list of handles to the ## the parts of the vector field (body, arrow and marker). ## ## @example
--- a/scripts/plot/ezplot.m +++ b/scripts/plot/ezplot.m @@ -26,9 +26,9 @@ ## ## Plots in two-dimensions the curve defined by @var{f}. The function ## @var{f} may be a string, inline function or function handle and can -## have either one or two variables. If @var{f} has one variable, then -## the function is plotted over the domain @code{-2*pi < @var{x} < 2*pi} -## with 500 points. +## have either one or two variables. If @var{f} has one variable, then +## the function is plotted over the domain @code{-2*pi < @var{x} < 2*pi} +## with 500 points. ## ## If @var{f} has two variables then @code{@var{f}(@var{x},@var{y}) = 0} ## is calculated over the meshed domain @code{-2*pi < @var{x} | @var{y} @@ -50,7 +50,7 @@ ## ## @noindent ## is plotted over the domain @code{-2*pi < @var{t} < 2*pi} with 500 -## points. +## points. ## ## If @var{dom} is a two element vector, it represents the minimum and maximum ## value of @var{x}, @var{y} and @var{t}. If it is a four element @@ -61,7 +61,7 @@ ## @var{n} is a scalar defining the number of points to use in plotting ## the function. ## -## The optional return value @var{h} provides a list of handles to the +## The optional return value @var{h} provides a list of handles to the ## the line objects plotted. ## ## @seealso{plot, ezplot3}
--- a/scripts/plot/ezplot3.m +++ b/scripts/plot/ezplot3.m @@ -23,16 +23,16 @@ ## @deftypefnx {Function File} {} ezplot3 (@var{h}, @dots{}) ## @deftypefnx {Function File} {@var{h} =} ezplot3 (@dots{}) ## -## Plots in three-dimensions the curve defined parametrically. +## Plots in three-dimensions the curve defined parametrically. ## @var{fx}, @var{fy}, and @var{fz} are strings, inline functions -## or function handles with one arguments defining the function. By -## default the plot is over the domain @code{-2*pi < @var{x} < 2*pi} -## with 60 points. +## or function handles with one arguments defining the function. By +## default the plot is over the domain @code{-2*pi < @var{x} < 2*pi} +## with 60 points. ## ## If @var{dom} is a two element vector, it represents the minimum and maximum ## value of @var{t}. @var{n} is a scalar defining the number of points to use. ## -## The optional return value @var{h} provides a list of handles to the +## The optional return value @var{h} provides a list of handles to the ## the parts of the vector field (body, arrow and marker). ## ## @example
--- a/scripts/plot/ezpolar.m +++ b/scripts/plot/ezpolar.m @@ -24,15 +24,15 @@ ## @deftypefnx {Function File} {@var{h} =} ezpolar (@dots{}) ## ## Plots in polar plot defined by a function. The function @var{f} is either -## a string, inline function or function handle with one arguments defining -## the function. By default the plot is over the domain @code{0 < @var{x} < -## 2*pi} with 60 points. +## a string, inline function or function handle with one arguments defining +## the function. By default the plot is over the domain @code{0 < @var{x} < +## 2*pi} with 60 points. ## ## If @var{dom} is a two element vector, it represents the minimum and maximum -## value of both @var{t}. @var{n} is a scalar defining the number of points to +## value of both @var{t}. @var{n} is a scalar defining the number of points to ## use. ## -## The optional return value @var{h} provides a list of handles to the +## The optional return value @var{h} provides a list of handles to the ## the parts of the vector field (body, arrow and marker). ## ## @example
--- a/scripts/plot/ezsurf.m +++ b/scripts/plot/ezsurf.m @@ -26,9 +26,9 @@ ## @deftypefnx {Function File} {@var{h} =} ezsurf (@dots{}) ## ## Plots the surface defined by a function. @var{f} is a string, inline -## function or function handle with two arguments defining the function. By +## function or function handle with two arguments defining the function. By ## default the plot is over the domain @code{-2*pi < @var{x} < 2*pi} and -## @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension. +## @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension. ## ## If @var{dom} is a two element vector, it represents the minimum and maximum ## value of both @var{x} and @var{y}. If @var{dom} is a four element vector, @@ -37,14 +37,14 @@ ## ## @var{n} is a scalar defining the number of points to use in each dimension. ## -## If three functions are passed, then plot the parametrically defined -## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}), -## @var{fz} (@var{s}, @var{t})]}. +## If three functions are passed, then plot the parametrically defined +## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}), +## @var{fz} (@var{s}, @var{t})]}. ## ## If the argument 'circ' is given, then the function is plotted over a disk ## centered on the middle of the domain @var{dom}. ## -## The optional return value @var{h} provides a list of handles to the +## The optional return value @var{h} provides a list of handles to the ## the parts of the vector field (body, arrow and marker). ## ## @example
--- a/scripts/plot/ezsurfc.m +++ b/scripts/plot/ezsurfc.m @@ -28,7 +28,7 @@ ## Plots the surface and contour lines defined by a function. @var{f} is a ## string, inline function or function handle with two arguments defining the ## function. By default the plot is over the domain @code{-2*pi < @var{x} < -## 2*pi} and @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension. +## 2*pi} and @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension. ## ## If @var{dom} is a two element vector, it represents the minimum and maximum ## value of both @var{x} and @var{y}. If @var{dom} is a four element vector, @@ -37,14 +37,14 @@ ## ## @var{n} is a scalar defining the number of points to use in each dimension. ## -## If three functions are passed, then plot the parametrically defined -## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}), -## @var{fz} (@var{s}, @var{t})]}. +## If three functions are passed, then plot the parametrically defined +## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}), +## @var{fz} (@var{s}, @var{t})]}. ## ## If the argument 'circ' is given, then the function is plotted over a disk ## centered on the middle of the domain @var{dom}. ## -## The optional return value @var{h} provides a list of handles to the +## The optional return value @var{h} provides a list of handles to the ## the parts of the vector field (body, arrow and marker). ## ## @example
--- a/scripts/plot/feather.m +++ b/scripts/plot/feather.m @@ -31,7 +31,7 @@ ## The style to use for the plot can be defined with a line style @var{style} ## in a similar manner to the line styles used with the @code{plot} command. ## -## The optional return value @var{h} provides a list of handles to the +## The optional return value @var{h} provides a list of handles to the ## the parts of the vector field (body, arrow and marker). ## ## @example @@ -81,8 +81,8 @@ endif endwhile - ## Matlab draws feather plots, with the arrow head as one continous - ## line, and each arrow separately. This is completely different than + ## Matlab draws feather plots, with the arrow head as one continous + ## line, and each arrow separately. This is completely different than ## quiver and quite ugly. n = length (u); xend = [1 : n] + u;
--- a/scripts/plot/findobj.m +++ b/scripts/plot/findobj.m @@ -31,10 +31,10 @@ ## @end example ## ## @noindent -## which returns all of the handles to the objects with the name +## which returns all of the handles to the objects with the name ## @var{prop_name} and the name @var{prop_Value}. The search can be limited -## to a particular object or set of objects and their descendants by -## passing a handle or set of handles @var{h} as the first argument to +## to a particular object or set of objects and their descendants by +## passing a handle or set of handles @var{h} as the first argument to ## @code{findobj}. ## ## The depth of hierarchy of objects to which to search to can be limited @@ -47,15 +47,15 @@ ## ## Specifying a depth @var{d} of 0, limits the search to the set of object ## passed in @var{h}. A depth @var{d} of 0 is equivalent to the '-flat' -## argument. +## argument. ## ## A specified logical operator may be applied to the pairs of @var{prop_Name} -## and @var{prop_Value}. The supported logical operators are '-and', '-or', +## and @var{prop_Value}. The supported logical operators are '-and', '-or', ## '-xor', '-not'. ## -## The objects may also be matched by comparing a regular expression to the -## property values, where property values that match @code{regexp -## (@var{prop_Value}, @var{pattern})} are returned. Finally, objects may be +## The objects may also be matched by comparing a regular expression to the +## property values, where property values that match @code{regexp +## (@var{prop_Value}, @var{pattern})} are returned. Finally, objects may be ## matched by property name only, using the '-property' option. ## @seealso{get, set} ## @end deftypefn @@ -185,7 +185,7 @@ endwhile numpairs = np - 1; - + ## Load all objects which qualify for being searched. idepth = 0; h = handles; @@ -193,7 +193,7 @@ children = []; for n = 1 : numel (handles) children = union (children, get(handles(n), "children")); - endfor + endfor handles = children; h = union (h, children); idepth = idepth + 1;
--- a/scripts/plot/fplot.m +++ b/scripts/plot/fplot.m @@ -26,7 +26,7 @@ ## The limits of the plot are given by @var{limits} of the form ## @code{[@var{xlo}, @var{xhi}]} or @code{[@var{xlo}, @var{xhi}, ## @var{ylo}, @var{yhi}]}. @var{tol} is the default tolerance to use for the -## plot, and if @var{tol} is an integer it is assumed that it defines the +## plot, and if @var{tol} is an integer it is assumed that it defines the ## number points to use in the plot. The @var{fmt} argument is passed ## to the plot command. ## @@ -50,12 +50,12 @@ error ("fplot: second input argument must be a real vector with 2 or 4 elements"); endif - if (nargin < 3) - n = 0.002; + if (nargin < 3) + n = 0.002; endif have_linespec = true; - if (nargin < 4) + if (nargin < 4) have_linespec = false; endif @@ -100,7 +100,7 @@ n = 2 * (n - 1) + 1; x = linspace (limits(1), limits(2), n)'; y = feval (fn, x); - endwhile + endwhile else x = linspace (limits(1), limits(2), n)'; y = feval (fn, x); @@ -112,7 +112,7 @@ plot (x, y); endif - if (length (limits) > 2) + if (length (limits) > 2) axis (limits); endif
--- a/scripts/plot/gnuplot_drawnow.m +++ b/scripts/plot/gnuplot_drawnow.m @@ -123,11 +123,11 @@ else ## Get the one word terminal id and save the remaining as options to ## be passed on to gnuplot. The terminal may respect the graphics - ## toolkit. + ## toolkit. [term, opts_str] = gnuplot_trim_term (term); term = lower (term); if (strcmpi (term, "lua")) - ## Replace "lau tikz" with + ## Replace "lau tikz" with term = "tikz"; opts_str = strrep (opts_str, "tikz", ""); endif @@ -169,7 +169,7 @@ endif if (strcmp (term, "aqua")) ## Adjust axes-label and tick-label spacing. - opts_str = sprintf ("%s font \"%s,%d\"", opts_str, + opts_str = sprintf ("%s font \"%s,%d\"", opts_str, get (0, "defaultaxesfontname"), get (0, "defaultaxesfontsize") / 1.5); endif @@ -177,7 +177,7 @@ title_str = ""; endif - if (! (any (strfind (opts_str, " size ") > 0) + if (! (any (strfind (opts_str, " size ") > 0) || any (strfind (opts_str, "size ") == 1))) ## Get figure size in pixels. Rely on listener to handle coversion. units = get (h, "units"); @@ -245,7 +245,7 @@ ## gnuplot position is UL, Octave's is LL (same for screen/window) gnuplot_pos(2) = screen_size(2) - gnuplot_pos(2) - gnuplot_size(2); gnuplot_pos = max (gnuplot_pos, 1); - size_str = sprintf ("%s position %d,%d", size_str, + size_str = sprintf ("%s position %d,%d", size_str, gnuplot_pos(1), gnuplot_pos(2)); endif endif
--- a/scripts/plot/gtext.m +++ b/scripts/plot/gtext.m @@ -44,7 +44,7 @@ endif else error ("gtext: expecting a string or cell array of strings"); - endif + endif else print_usage (); endif
--- a/scripts/plot/hist.m +++ b/scripts/plot/hist.m @@ -26,13 +26,13 @@ ## ## Produce histogram counts or plots. ## -## With one vector input argument, @var{y}, plot a histogram of the values -## with 10 bins. The range of the histogram bins is determined by the +## With one vector input argument, @var{y}, plot a histogram of the values +## with 10 bins. The range of the histogram bins is determined by the ## range of the data. With one matrix input argument, @var{y}, plot a ## histogram where each bin contains a bar per input column. ## ## Given a second vector argument, @var{x}, use that as the centers of -## the bins, with the width of the bins determined from the adjacent +## the bins, with the width of the bins determined from the adjacent ## values in the vector. ## ## If scalar, the second argument, @var{nbins}, defines the number of bins. @@ -46,7 +46,7 @@ ## that @code{bar (@var{xx}, @var{nn})} will plot the histogram. ## ## The histogram's appearance may be modified by specifying property/value -## pairs, @var{prop} and @var{val} pairs. For example the face and edge +## pairs, @var{prop} and @var{val} pairs. For example the face and edge ## color may be modified. ## ## @example
--- a/scripts/plot/hold.m +++ b/scripts/plot/hold.m @@ -22,8 +22,8 @@ ## @deftypefnx {Function File} {} hold (@var{hax}, @dots{}) ## Toggle or set the 'hold' state of the plotting engine which determines ## whether new graphic objects are added to the plot or replace the existing -## objects. -## +## objects. +## ## @table @code ## @item hold on ## Retain plot data and settings so that subsequent plot commands are displayed @@ -41,7 +41,7 @@ ## @item hold ## Toggle the current 'hold' state. ## @end table -## +## ## When given the additional argument @var{hax}, the hold state is modified ## only for the given axis handle. ##
--- a/scripts/plot/ishghandle.m +++ b/scripts/plot/ishghandle.m @@ -22,7 +22,7 @@ ## @end deftypefn function retval = ishghandle (h) - ## This function is just included for compatibility as Octave has + ## This function is just included for compatibility as Octave has ## no simulink equivalent. retval = ishandle (h); endfunction
--- a/scripts/plot/isocolors.m +++ b/scripts/plot/isocolors.m @@ -28,7 +28,7 @@ ## @var{c} is a three--dimensional array that contains color values and ## the second input argument @var{v} keeps the vertices of a geometry ## then return a matrix @var{cd} with color data information for the -## geometry at computed points +## geometry at computed points ## @command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}. The output argument ## @var{cd} can be taken to manually set FaceVertexCData of a patch. ## @@ -56,35 +56,35 @@ ## ## set (p, "FaceLighting", "flat"); ## ## light ("Position", [1 1 5]); ## Available with JHandles ## endfunction -## +## ## N = 15; ## Increase number of vertices in each direction ## iso = .4; ## Change isovalue to .1 to display a sphere ## lin = linspace (0, 2, N); ## [x, y, z] = meshgrid (lin, lin, lin); -## c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2); +## c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2); ## figure (); ## Open another figure window ## -## subplot (2, 2, 1); view (-38, 20); +## subplot (2, 2, 1); view (-38, 20); ## [f, v] = isosurface (x, y, z, c, iso); ## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none"); ## cdat = rand (size (c)); ## Compute random patch color data ## isocolors (x, y, z, cdat, p); ## Directly set colors of patch ## isofinish (p); ## Call user function isofinish ## -## subplot (2, 2, 2); view (-38, 20); +## subplot (2, 2, 2); view (-38, 20); ## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none"); ## [r, g, b] = meshgrid (lin, 2-lin, 2-lin); ## cdat = isocolors (x, y, z, c, v); ## Compute color data vertices ## set (p, "FaceVertexCData", cdat); ## Set color data manually ## isofinish (p); ## -## subplot (2, 2, 3); view (-38, 20); +## subplot (2, 2, 3); view (-38, 20); ## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none"); ## cdat = isocolors (r, g, b, c, p); ## Compute color data patch ## set (p, "FaceVertexCData", cdat); ## Set color data manually ## isofinish (p); ## -## subplot (2, 2, 4); view (-38, 20); +## subplot (2, 2, 4); view (-38, 20); ## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none"); ## r = g = b = repmat ([1:N] / N, [N, 1, N]); ## Black to white ## cdat = isocolors (x, y, z, r, g, b, v); @@ -131,7 +131,7 @@ G = varargin{5}; B = varargin{6}; vp = varargin{7}; - otherwise + otherwise print_usage (); endswitch if (ismatrix (vp) && size (vp,2) == 3) @@ -165,7 +165,7 @@ %!test %! [x, y, z] = meshgrid (0:.5:2, 0:.5:2, 0:.5:2); -%! c = (x-.5).^2 + (y-.5).^2 + (z-.5).^2; +%! c = (x-.5).^2 + (y-.5).^2 + (z-.5).^2; %! [f, v] = isosurface (x, y, z, c, .4); %! cdat = isocolors (x, y, z, c, v); %! assert (size (cdat, 1) == size (v, 1));
--- a/scripts/plot/isonormals.m +++ b/scripts/plot/isonormals.m @@ -118,7 +118,7 @@ z = varargin{3}; c = varargin{4}; vp = varargin{5}; - otherwise + otherwise print_usage (); endswitch if (ismatrix (vp) && size (vp,2) == 3) @@ -149,13 +149,13 @@ %!test %! [x, y, z] = meshgrid (0:.5:2, 0:.5:2, 0:.5:2); -%! c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2); +%! c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2); %! [f, v, cdat] = isosurface (x, y, z, c, .4, y); %! n = isonormals (x, y, z, c, v); %! assert (size (v), size (n)); %!test %! [x, y, z] = meshgrid (0:.5:2, 0:.5:2, 0:.5:2); -%! c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2); +%! c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2); %! [f, v, cdat] = isosurface (x, y, z, c, .4, y); %! np = isonormals (x, y, z, c, v); %! nn = isonormals (x, y, z, c, v, "negate");
--- a/scripts/plot/isosurface.m +++ b/scripts/plot/isosurface.m @@ -31,7 +31,7 @@ ## isovalue as a scalar value then return a structure array @var{fv} ## that contains the fields @var{Faces} and @var{Vertices} at computed ## points @command{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}. The output -## argument @var{fv} can directly be taken as an input argument for the +## argument @var{fv} can directly be taken as an input argument for the ## @command{patch} function. ## ## If called with further input arguments @var{x}, @var{y} and @var{z} @@ -76,10 +76,10 @@ ## iso = .4; ## Change isovalue to .1 to display a sphere ## lin = linspace (0, 2, N); ## [x, y, z] = meshgrid (lin, lin, lin); -## c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2); +## c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2); ## figure (); ## Open another figure window ## -## subplot (2, 2, 1); view (-38, 20); +## subplot (2, 2, 1); view (-38, 20); ## [f, v] = isosurface (x, y, z, c, iso); ## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none"); ## set (gca, "PlotBoxAspectRatioMode","manual", "PlotBoxAspectRatio", [1 1 1]); @@ -152,7 +152,7 @@ else [fvc.faces, fvc.vertices] = __marching_cube__ (x, y, z, val, iso); endif - + if (isempty (fvc.vertices) || isempty (fvc.faces)) warning ( "The resulting triangulation is empty" ); endif @@ -163,10 +163,10 @@ newplot (); if (calc_colors) pa = patch ("Faces", fvc.faces, "Vertices", fvc.vertices, - "FaceVertexCData", fvc.facevertexcdata, + "FaceVertexCData", fvc.facevertexcdata, "FaceColor", "flat", "EdgeColor", "none"); else - pa = patch ("Faces", fvc.faces, "Vertices", fvc.vertices, + pa = patch ("Faces", fvc.faces, "Vertices", fvc.vertices, "FaceColor", "g", "EdgeColor", "k"); endif if (! ishold ()) @@ -218,4 +218,4 @@ %! clf %! [x,y,z] = meshgrid(-2:0.5:2, -2:0.5:2, -2:0.5:2); %! v = x.^2 + y.^2 + z.^2; -%! isosurface (x, y, z, v, 1) +%! isosurface (x, y, z, v, 1)
--- a/scripts/plot/isprop.m +++ b/scripts/plot/isprop.m @@ -29,7 +29,7 @@ if (nargin < 1 || nargin > 2) print_usage (); endif - + if (! ishandle (h)) error ("isprop: first input argument must be a handle"); elseif (! ischar (prop))
--- a/scripts/plot/legend.m +++ b/scripts/plot/legend.m @@ -28,7 +28,7 @@ ## @deftypefnx {Function File} {} legend ("@var{option}") ## ## Display a legend for the axes with handle @var{hax}, or the current axes, -## using the specified strings as labels. Legend entries may be specified +## using the specified strings as labels. Legend entries may be specified ## as individual character string arguments, a character array, or a cell ## array of character strings. If the handles, @var{hobjs}, are not specified ## then the legend's strings will be associated with the axes' descendants. @@ -64,7 +64,7 @@ ## @item @tab southwest @tab ## left bottom ## -## @item +## @item ## ## @item @tab outside @tab ## can be appended to any location string @@ -118,7 +118,7 @@ plty = get(ca (strcmp (get (ca, "tag"), "plotyy")), "userdata"); if (isscalar (plty)) ca = [ca, plty]; - else + else ca = [ca, plty{:}]; endif endif @@ -156,7 +156,7 @@ endif endif endif - + while (nargs > 1) pos = varargin{nargs-1}; str = varargin{nargs}; @@ -171,7 +171,7 @@ endif endwhile - ## Validate the orientation + ## Validate the orientation switch (orientation) case {"vertical", "horizontal","default"} otherwise @@ -201,7 +201,7 @@ hlegend = []; fkids = get (fig, "children"); for i = 1 : numel(fkids) - if (ishandle (fkids (i)) && strcmp (get (fkids (i), "type"), "axes") + if (ishandle (fkids (i)) && strcmp (get (fkids (i), "type"), "axes") && (strcmp (get (fkids (i), "tag"), "legend"))) udata = get (fkids (i), "userdata"); if (! isempty (intersect (udata.handle, ca))) @@ -360,7 +360,7 @@ hgkids = get (kids(k), "children"); for j = 1 : length (hgkids) hgobj = get (hgkids (j)); - if (isfield (hgobj, "displayname") + if (isfield (hgobj, "displayname") && ! isempty (hgobj.displayname)) hplots = [hplots, hgkids(j)]; text_strings = {text_strings{:}, hbobj.displayname}; @@ -422,8 +422,8 @@ endif box = "off"; endif - - ## Get axis size and fontsize in points. + + ## Get axis size and fontsize in points. ## Rely on listener to handle coversion. units = get (ca(1), "units"); fontunits = get (ca(1), "fontunits"); @@ -458,7 +458,7 @@ hlegend = axes ("tag", "legend", "userdata", struct ("handle", ud), "box", box, "outerposition", [0, 0, 0, 0], "xtick", [], "ytick", [], "xticklabel", "", - "yticklabel", "", "zticklabel", "", + "yticklabel", "", "zticklabel", "", "xlim", [0, 1], "ylim", [0, 1], "visible", "off", "activepositionproperty", "position"); else @@ -474,7 +474,7 @@ maxheight = 0; for k = 1 : nentries if (strcmp (textpos, "right")) - texthandle = [texthandle, text(0, 0, text_strings {k}, + texthandle = [texthandle, text(0, 0, text_strings {k}, "horizontalalignment", "left", "userdata", hplots(k))]; else @@ -612,7 +612,7 @@ endif case "southeast" if (outside) - lpos = [ca_outpos(1) + ca_outpos(3) - lpos(3), ca_outpos(2), + lpos = [ca_outpos(1) + ca_outpos(3) - lpos(3), ca_outpos(2), lpos(3), lpos(4)]; new_pos = [ca_pos(1), ca_pos(2) + lpos(4), ... ca_pos(3) - lpos(3), ca_pos(4) - lpos(4)]; @@ -653,7 +653,7 @@ style = get (hplots(k), "linestyle"); if (! strcmp (style, "none")) l1 = line ("xdata", ([xoffset, xoffset + linelength] + xk * xstep) / lpos(3), - "ydata", [1, 1] .* (lpos(4) - yoffset - yk * ystep) / lpos(4), + "ydata", [1, 1] .* (lpos(4) - yoffset - yk * ystep) / lpos(4), "color", color, "linestyle", style, "marker", "none", "userdata", hplots (k)); hobjects = [hobjects, l1]; @@ -661,7 +661,7 @@ marker = get (hplots(k), "marker"); if (! strcmp (marker, "none")) l1 = line ("xdata", (xoffset + 0.5 * linelength + xk * xstep) / lpos(3), - "ydata", (lpos(4) - yoffset - yk * ystep) / lpos(4), + "ydata", (lpos(4) - yoffset - yk * ystep) / lpos(4), "color", color, "linestyle", "none", "marker", marker, "markeredgecolor", get (hplots (k), "markeredgecolor"), "markerfacecolor", get (hplots (k), "markerfacecolor"), @@ -699,14 +699,14 @@ ## Add an invisible text object to original axis ## that when it is destroyed will remove the legend - t1 = text (0, 0, "", "parent", ca(1), "tag", "legend", + t1 = text (0, 0, "", "parent", ca(1), "tag", "legend", "handlevisibility", "off", "visible", "off", "xliminclude", "off", "yliminclude", "off"); set (t1, "deletefcn", {@deletelegend1, hlegend}); ## Resize the axis the legend is attached to if the - ## legend is "outside" the plot and create listener to - ## resize axis to original size if the legend is deleted, + ## legend is "outside" the plot and create listener to + ## resize axis to original size if the legend is deleted, ## hidden or shown if (outside) for i = 1 : numel (ca) @@ -732,7 +732,7 @@ addproperty ("edgecolor", hlegend, "color", [0, 0, 0]); addproperty ("textcolor", hlegend, "color", [0, 0, 0]); addproperty ("location", hlegend, "radio", "north|south|east|west|{northeast}|southeast|northwest|southwest|northoutside|southoutside|eastoutside|westoutside|northeastoutside|southeastoutside|northwestoutside|southwestoutside"); - addproperty ("orientation", hlegend, "radio", + addproperty ("orientation", hlegend, "radio", "{vertical}|horizontal"); addproperty ("string", hlegend, "any", text_strings); addproperty ("textposition", hlegend, "radio", "{left}|right"); @@ -741,7 +741,7 @@ endif if (outside) - set (hlegend, "location", strcat (position, "outside"), + set (hlegend, "location", strcat (position, "outside"), "orientation", orientation, "textposition", textpos); else set (hlegend, "location", position, "orientation", orientation, @@ -876,7 +876,7 @@ ll = []; kids = get (hlegend, "children"); for i = 1 : numel (kids) - if (get (kids (i), "userdata") == h + if (get (kids (i), "userdata") == h && strcmp (get (kids(i), "type"), "line")) if (strcmp (get (kids (i), "marker"), "none")) ll = kids (i); @@ -890,7 +890,7 @@ marker = get (h, "marker"); displayname = get (h, "displayname"); - if ((isempty (displayname) + if ((isempty (displayname) || (strcmp (marker, "none") && strcmp (linestyle, "none"))) && (! isempty (lm) || isempty (ll))) ## An element was removed from the legend. Need to recall the @@ -904,7 +904,7 @@ endif endfor legend (hplots, text_strings); - elseif ((!isempty (displayname) + elseif ((!isempty (displayname) && (! strcmp (marker, "none") || ! strcmp (linestyle, "none"))) && isempty (lm) && isempty (ll)) ## An element was added to the legend. Need to recall the @@ -931,12 +931,12 @@ delete (lm); endif if (! strcmp (linestyle, "none")) - line ("xdata", xpos1, "ydata", ypos1, "color", get (h, "color"), + line ("xdata", xpos1, "ydata", ypos1, "color", get (h, "color"), "linestyle", get (h, "linestyle"), "marker", "none", "userdata", h, "parent", hlegend); endif if (! strcmp (marker, "none")) - line ("xdata", xpos2, "ydata", ypos2, "color", get (h, "color"), + line ("xdata", xpos2, "ydata", ypos2, "color", get (h, "color"), "marker", marker, "markeredgecolor", get (h, "markeredgecolor"), "markerfacecolor", get (h, "markerfacecolor"), "markersize", get (h, "markersize"), "linestyle", "none", @@ -966,7 +966,7 @@ hgkids = get (kids(k), "children"); for j = 1 : length (hgkids) hgobj = get (hgkids (j)); - if (isfield (hgobj, "displayname") + if (isfield (hgobj, "displayname") && ! isempty (hgobj.displayname)) hplots = [hplots, hgkids(j)]; text_strings = {text_strings{:}, hbobj.displayname};
--- a/scripts/plot/loglog.m +++ b/scripts/plot/loglog.m @@ -36,7 +36,7 @@ [h, varargin, nargs] = __plt_get_axis_arg__ ("loglog", varargin{:}); if (nargs < 1) - print_usage(); + print_usage(); endif oldh = gca ();
--- a/scripts/plot/loglogerr.m +++ b/scripts/plot/loglogerr.m @@ -27,9 +27,9 @@ ## @end example ## ## @noindent -## which produces a double logarithm plot of @var{y} versus @var{x} +## which produces a double logarithm plot of @var{y} versus @var{x} ## with errors in the @var{y}-scale defined by @var{ey} and the plot -## format defined by @var{fmt}. See errorbar for available formats and +## format defined by @var{fmt}. See errorbar for available formats and ## additional information. ## @seealso{errorbar, semilogxerr, semilogyerr} ## @end deftypefn
--- a/scripts/plot/meshc.m +++ b/scripts/plot/meshc.m @@ -18,11 +18,11 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} meshc (@var{x}, @var{y}, @var{z}) -## Plot a mesh and contour given matrices @var{x}, and @var{y} from -## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and -## @var{y} coordinates of the mesh. If @var{x} and @var{y} are vectors, -## then a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)). Thus, -## columns of @var{z} correspond to different @var{x} values and rows of +## Plot a mesh and contour given matrices @var{x}, and @var{y} from +## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and +## @var{y} coordinates of the mesh. If @var{x} and @var{y} are vectors, +## then a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)). Thus, +## columns of @var{z} correspond to different @var{x} values and rows of ## @var{z} correspond to different @var{y} values. ## @seealso{meshgrid, mesh, contour} ## @end deftypefn
--- a/scripts/plot/meshz.m +++ b/scripts/plot/meshz.m @@ -18,15 +18,15 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} meshz (@var{x}, @var{y}, @var{z}) -## Plot a curtain mesh given matrices @var{x}, and @var{y} from -## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and -## @var{y} coordinates of the mesh. If @var{x} and @var{y} are vectors, -## then a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)). Thus, -## columns of @var{z} correspond to different @var{x} values and rows of +## Plot a curtain mesh given matrices @var{x}, and @var{y} from +## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and +## @var{y} coordinates of the mesh. If @var{x} and @var{y} are vectors, +## then a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)). Thus, +## columns of @var{z} correspond to different @var{x} values and rows of ## @var{z} correspond to different @var{y} values. ## @seealso{meshgrid, mesh, contour} ## @end deftypefn - + function retval = meshz (varargin) [h, varargin, nargin] = __plt_get_axis_arg__ ("meshz", varargin{:}); @@ -62,15 +62,15 @@ else x = [x(1, 1), x(1, :), x(1, end); x(:, 1), x, x(:, end); - x(end, 1), x(end, :), x(end, end)]; + x(end, 1), x(end, :), x(end, end)]; y = [y(1, 1), y(1, :), y(1, end); y(:, 1), y, y(:, end); - y(end, 1), y(end, :), y(end, end)]; + y(end, 1), y(end, :), y(end, end)]; endif zref = min(z(isfinite(z))); z = [zref .* ones(1, size(z, 2) + 2); - zref .* ones(size(z, 1), 1), z, zref .* ones(size(z, 1), 1); + zref .* ones(size(z, 1), 1), z, zref .* ones(size(z, 1), 1); zref.* ones(1, size(z, 2) + 2)]; oldh = gca ();
--- a/scripts/plot/ndgrid.m +++ b/scripts/plot/ndgrid.m @@ -35,17 +35,17 @@ function varargout = ndgrid (varargin) if (nargin == 1) - n = max ([nargout, 2]); + n = max ([nargout, 2]); ## If only one input argument is given, repeat it n-times varargin(1:n) = varargin(1); elseif (nargin >= nargout) - n = max ([nargin, 2]); + n = max ([nargin, 2]); else error ("ndgrid: wrong number of input arguments"); endif ## Determine the size of the output arguments - + shape = zeros (1, n); for i = 1:n
--- a/scripts/plot/orient.m +++ b/scripts/plot/orient.m @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} orient (@var{orientation}) ## Set the default print orientation. Valid values for -## @var{orientation} include @code{"landscape"}, @code{"portrait"}, +## @var{orientation} include @code{"landscape"}, @code{"portrait"}, ## and @code{"tall"}. ## ## The @code{"tall"} option sets the orientation to portait and fills
--- a/scripts/plot/pareto.m +++ b/scripts/plot/pareto.m @@ -22,18 +22,18 @@ ## @deftypefnx {Function File} {} pareto (@var{x}, @var{y}) ## @deftypefnx {Function File} {} pareto (@var{h}, @dots{}) ## @deftypefnx {Function File} {@var{h} =} pareto (@dots{}) -## Draw a Pareto chart, also called ABC chart. A Pareto chart is a bar graph -## used to arrange information in such a way that priorities for process -## improvement can be established. It organizes and displays information -## to show the relative importance of data. The chart is similar to the -## histogram or bar chart, except that the bars are arranged in decreasing +## Draw a Pareto chart, also called ABC chart. A Pareto chart is a bar graph +## used to arrange information in such a way that priorities for process +## improvement can be established. It organizes and displays information +## to show the relative importance of data. The chart is similar to the +## histogram or bar chart, except that the bars are arranged in decreasing ## order from left to right along the abscissa. -## -## The fundamental idea (Pareto principle) behind the use of Pareto +## +## The fundamental idea (Pareto principle) behind the use of Pareto ## diagrams is that the majority of an effect is due to a small subset of the -## causes, so for quality improvement the first few (as presented on the -## diagram) contributing causes to a problem usually account for the majority -## of the result. Thus, targeting these "major causes" for elimination +## causes, so for quality improvement the first few (as presented on the +## diagram) contributing causes to a problem usually account for the majority +## of the result. Thus, targeting these "major causes" for elimination ## results in the most cost-effective improvement scheme. ## ## The data are passed as @var{x} and the abscissa as @var{y}. If @var{y} is @@ -70,7 +70,7 @@ endif endif else - y = cellfun (@int2str, num2cell (1 : numel(x)), + y = cellfun (@int2str, num2cell (1 : numel(x)), "uniformoutput", false); endif @@ -82,13 +82,13 @@ cdf95 = cdf - 0.95; idx95 = find(sign(cdf95(1:end-1)) != sign(cdf95(2:end)))(1); - [ax, hbar, hline] = plotyy (1 : idx95, x (1 : idx95), - 1 : length(cdf), 100 .* cdf, + [ax, hbar, hline] = plotyy (1 : idx95, x (1 : idx95), + 1 : length(cdf), 100 .* cdf, @bar, @plot); axis (ax(1), [1 - 0.6, idx95 + 0.6, 0, maxcdf]); axis (ax(2), [1 - 0.6, idx95 + 0.6, 0, 100]); - set (ax(2), "ytick", [0, 20, 40, 60, 80, 100], + set (ax(2), "ytick", [0, 20, 40, 60, 80, 100], "yticklabel", {"0%", "20%", "40%", "60%", "80%", "100%"}); set (ax(1), "xtick", 1 : idx95, "xticklabel", y (1: idx95)); set (ax(2), "xtick", 1 : idx95, "xticklabel", y (1: idx95)); @@ -96,7 +96,7 @@ if (nargout > 0) h = [hbar; hline]; endif - + endfunction %!demo
--- a/scripts/plot/patch.m +++ b/scripts/plot/patch.m @@ -33,7 +33,7 @@ ## example, "r" or "red"). ## ## If passed a structure @var{fv} contain the fields "vertices", "faces" -## and optionally "facevertexcdata", create the patch based on these +## and optionally "facevertexcdata", create the patch based on these ## properties. ## @end deftypefn
--- a/scripts/plot/pbaspect.m +++ b/scripts/plot/pbaspect.m @@ -1,5 +1,5 @@ ## Copyright (C) 2010-2011 Ben Abbott -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it
--- a/scripts/plot/pcolor.m +++ b/scripts/plot/pcolor.m @@ -33,7 +33,7 @@ ## parent axis. ## ## The face color of each cell of the mesh is determined by interpolating -## the values of @var{c} for the cell's vertices. Contrast this with +## the values of @var{c} for the cell's vertices. Contrast this with ## @code{imagesc} which renders one cell for each element of @var{c}. ## ## @code{shading} modifies an attribute determining the manner by which the @@ -70,7 +70,7 @@ set (tmp, "facecolor", "flat"); set (ax, "box", "on"); - + if (! ishold ()) set (ax, "view", [0, 90]); endif
--- a/scripts/plot/peaks.m +++ b/scripts/plot/peaks.m @@ -36,13 +36,13 @@ ## @end verbatim ## @end ifnottex ## -## Called without a return argument, @code{peaks} plots the surface of the +## Called without a return argument, @code{peaks} plots the surface of the ## above function using @code{mesh}. If @var{n} is a scalar, the @code{peaks} ## returns the values of the above function on a @var{n}-by-@var{n} mesh over ## the range @code{[-3,3]}. The default value for @var{n} is 49. ## ## If @var{n} is a vector, then it represents the @var{x} and @var{y} values -## of the grid on which to calculate the above function. The @var{x} and +## of the grid on which to calculate the above function. The @var{x} and ## @var{y} values can be specified separately. ## @seealso{surf, mesh, meshgrid} ## @end deftypefn
--- a/scripts/plot/pie.m +++ b/scripts/plot/pie.m @@ -22,7 +22,7 @@ ## @deftypefnx {Function File} {} pie (@dots{}, @var{labels}) ## @deftypefnx {Function File} {} pie (@var{h}, @dots{}); ## @deftypefnx {Function File} {@var{h} =} pie (@dots{}); -## Produce a pie chart. +## Produce a pie chart. ## ## Called with a single vector argument, produces a pie chart of the ## elements in @var{x}, with the size of the slice determined by percentage @@ -32,7 +32,7 @@ ## if non zero 'explodes' the slice from the pie chart. ## ## If given @var{labels} is a cell array of strings of the same length as -## @var{x}, giving the labels of each of the slices of the pie chart. +## @var{x}, giving the labels of each of the slices of the pie chart. ## ## The optional return value @var{h} provides a handle to the patch object. ##
--- a/scripts/plot/pie3.m +++ b/scripts/plot/pie3.m @@ -23,7 +23,7 @@ ## @deftypefnx {Function File} {} pie3 (@dots{}, @var{labels}) ## @deftypefnx {Function File} {} pie3 (@var{h}, @dots{}); ## @deftypefnx {Function File} {@var{h} =} pie3 (@dots{}); -## Draw a a 3-D pie chart. +## Draw a a 3-D pie chart. ## ## Called with a single vector argument, produces a 3-D pie chart of the ## elements in @var{x}, with the size of the slice determined by percentage @@ -33,7 +33,7 @@ ## if non zero 'explodes' the slice from the pie chart. ## ## If given @var{labels} is a cell array of strings of the same length as -## @var{x}, giving the labels of each of the slices of the pie chart. +## @var{x}, giving the labels of each of the slices of the pie chart. ## ## The optional return value @var{h} provides a handle list to patch, surface ## and text objects generating this plot.
--- a/scripts/plot/plot.m +++ b/scripts/plot/plot.m @@ -23,8 +23,8 @@ ## @deftypefnx {Function File} {} plot (@var{x}, @var{y}, @var{fmt}) ## @deftypefnx {Function File} {} plot (@var{h}, @dots{}) ## @deftypefnx {Function File} {@var{h} =} plot (@dots{}) -## Produce two-dimensional plots. -## +## Produce two-dimensional plots. +## ## Many different combinations of arguments are possible. The simplest ## form is ## @@ -170,9 +170,9 @@ ## This will plot the cosine and sine functions and label them accordingly ## in the key. ## -## If the first argument is an axis handle, then plot into these axes, -## rather than the current axis handle returned by @code{gca}. -## +## If the first argument is an axis handle, then plot into these axes, +## rather than the current axis handle returned by @code{gca}. +## ## @seealso{semilogx, semilogy, loglog, polar, mesh, contour, bar, ## stairs, errorbar, xlabel, ylabel, title, print} ## @end deftypefn @@ -184,7 +184,7 @@ [h, varargin, nargs] = __plt_get_axis_arg__ ("plot", varargin{:}); if (nargs < 1) - print_usage(); + print_usage(); endif oldh = gca ();
--- a/scripts/plot/plot3.m +++ b/scripts/plot/plot3.m @@ -58,7 +58,7 @@ ## @example ## plot3 (@var{x1}, @var{y1}, @var{z1}, @var{x2}, @var{y2}, @var{z2}, @dots{}) ## @end example -## +## ## @noindent ## in which each set of three arguments is treated as a separate line or ## set of lines in three dimensions.
--- a/scripts/plot/plotmatrix.m +++ b/scripts/plot/plotmatrix.m @@ -30,7 +30,7 @@ ## plot (@var{x} (:, i), @var{y} (:, j) ## @end example ## -## Given a single argument @var{x}, then this is equivalent to +## Given a single argument @var{x}, then this is equivalent to ## ## @example ## plotmatrix (@var{x}, @var{x}) @@ -40,7 +40,7 @@ ## except that the diagonal of the set of axes will be replaced with the ## histogram @code{hist (@var{x} (:, i))}. ## -## The marker to use can be changed with the @var{style} argument, that is a +## The marker to use can be changed with the @var{style} argument, that is a ## string defining a marker in the same manner as the @code{plot} ## command. If a leading axes handle @var{h} is passed to ## @code{plotmatrix}, then this axis will be used for the plot. @@ -48,7 +48,7 @@ ## The optional return value @var{h} provides handles to the individual ## graphics objects in the scatter plots, whereas @var{ax} returns the ## handles to the scatter plot axis objects. @var{bigax} is a hidden -## axis object that surrounds the other axes, such that the commands +## axis object that surrounds the other axes, such that the commands ## @code{xlabel}, @code{title}, etc., will be associated with this hidden ## axis. Finally @var{p} returns the graphics objects associated with ## the histogram and @var{pax} the corresponding axes objects. @@ -84,8 +84,8 @@ pax = pax2; endif axes (bigax2); - ctext = text (0, 0, "", "visible", "off", - "handlevisibility", "off", "xliminclude", "off", + ctext = text (0, 0, "", "visible", "off", + "handlevisibility", "off", "xliminclude", "off", "yliminclude", "off", "zliminclude", "off", "deletefcn", {@plotmatrixdelete, [ax2; pax2]}); set (bigax2, "visible", "off"); @@ -122,7 +122,7 @@ if (ischar (arg) || iscell (arg)) [linespec, valid] = __pltopt__ ("plotmatrix", varargin{i}, false); if (valid) - have_line_spec = true; + have_line_spec = true; linespec = varargin(i); varargin(i) = []; nargin = nargin - 1;
--- a/scripts/plot/plotyy.m +++ b/scripts/plot/plotyy.m @@ -24,15 +24,15 @@ ## @deftypefnx {Function File} {[@var{ax}, @var{h1}, @var{h2}] =} plotyy (@dots{}) ## Plots two sets of data with independent y-axes. The arguments @var{x1} and ## @var{y1} define the arguments for the first plot and @var{x1} and @var{y2} -## for the second. +## for the second. ## -## By default the arguments are evaluated with +## By default the arguments are evaluated with ## @code{feval (@@plot, @var{x}, @var{y})}. However the type of plot can be ## modified with the @var{fun} argument, in which case the plots are -## generated by @code{feval (@var{fun}, @var{x}, @var{y})}. @var{fun} can be +## generated by @code{feval (@var{fun}, @var{x}, @var{y})}. @var{fun} can be ## a function handle, an inline function or a string of a function name. ## -## The function to use for each of the plots can be independently defined +## The function to use for each of the plots can be independently defined ## with @var{fun1} and @var{fun2}. ## ## If given, @var{h} defines the principal axis in which to plot the @var{x1} @@ -42,7 +42,7 @@ ## ## @example ## @group -## x = 0:0.1:2*pi; +## x = 0:0.1:2*pi; ## y1 = sin (x); ## y2 = exp (x - 1); ## ax = plotyy (x, y1, x - 1, y2, @@plot, @@semilogy); @@ -56,7 +56,7 @@ function [Ax, H1, H2] = plotyy (varargin) ## Don't use __plt_get_axis_arg__ here as ax is a two vector for plotyy - if (nargin > 1 && length (varargin{1}) == 2 && ishandle(varargin{1}(1)) + if (nargin > 1 && length (varargin{1}) == 2 && ishandle(varargin{1}(1)) && ishandle(varargin{1}(2)) && all (floor (varargin{1}) != varargin{1})) obj1 = get (varargin{1}(1)); @@ -97,7 +97,7 @@ if (nargin < 2) varargin = {}; endif - endif + endif if (nargin < 4) print_usage (); @@ -169,12 +169,12 @@ set (ax(2), "xlim", xlim); set (ax(2), "color", "none"); - ## Add invisible text objects that when destroyed, + ## Add invisible text objects that when destroyed, ## also remove the other axis - t1 = text (0, 0, "", "parent", ax(1), "tag", "plotyy", + t1 = text (0, 0, "", "parent", ax(1), "tag", "plotyy", "handlevisibility", "off", "visible", "off", "xliminclude", "off", "yliminclude", "off"); - t2 = text (0, 0, "", "parent", ax(2), "tag", "plotyy", + t2 = text (0, 0, "", "parent", ax(2), "tag", "plotyy", "handlevisibility", "off", "visible", "off", "xliminclude", "off", "yliminclude", "off"); @@ -199,12 +199,12 @@ set (ax(2), "userdata", ax(1)); ## Store the axes handles for the sister axes. - try + try addproperty ("__plotyy_axes__", ax(1), "data", ax); catch set (ax(1), "__plotyy_axes__", ax); end_try_catch - try + try addproperty ("__plotyy_axes__", ax(2), "data", ax); catch set (ax(2), "__plotyy_axes__", ax); @@ -213,7 +213,7 @@ %!demo %! clf -%! x = 0:0.1:2*pi; +%! x = 0:0.1:2*pi; %! y1 = sin (x); %! y2 = exp (x - 1); %! ax = plotyy (x, y1, x - 1, y2, @plot, @semilogy); @@ -267,7 +267,7 @@ if (! (isequal (position, oldposition) && isequal (view, oldview))) set (ax2, "position", position, "view", view) endif - if (! (isequal (plotboxaspectratio, oldplotboxaspectratio) + if (! (isequal (plotboxaspectratio, oldplotboxaspectratio) && isequal (plotboxaspectratiomode, oldplotboxaspectratiomode))) set (ax2, "plotboxaspectratio", plotboxaspectratio); set (ax2, "plotboxaspectratiomode", plotboxaspectratiomode); @@ -275,7 +275,7 @@ unwind_protect_cleanup recursion = false; end_unwind_protect - endif + endif endfunction function color = getcolor (ax)
--- a/scripts/plot/polar.m +++ b/scripts/plot/polar.m @@ -35,7 +35,7 @@ [h, varargin, nargs] = __plt_get_axis_arg__ ("polar", varargin{:}); if (nargs < 1) - print_usage(); + print_usage(); endif oldh = gca (); @@ -76,7 +76,7 @@ set (h, "xlim", [-maxr, maxr], "ylim", [-maxr, maxr], "xaxislocation", "zero", "yaxislocation", "zero", - "plotboxaspectratio", [1, 1, 1]); + "plotboxaspectratio", [1, 1, 1]); if (nargout > 0) retval = tmp;
--- a/scripts/plot/print.m +++ b/scripts/plot/print.m @@ -115,7 +115,7 @@ ## XFig. For the Gnuplot graphics toolkit, the additional options ## @option{-textspecial} or @option{-textnormal} can be used to control ## whether the special flag should be set for the text in -## the figure (default is @option{-textnormal}). +## the figure (default is @option{-textnormal}). ## ## @item hpgl ## HP plotter language @@ -151,10 +151,10 @@ ## Some examples are; ## ## @table @code -## @item ljet2p +## @item ljet2p ## HP LaserJet IIP ## -## @item ljet3 +## @item ljet3 ## HP LaserJet III ## ## @item deskjet @@ -180,16 +180,16 @@ ## and devices are available. ## ## When Ghostscript output is sent to a printer the size is determined -## by the figure's "papersize" property. When the output +## by the figure's "papersize" property. When the output ## is sent to a file the size is determined by the plot box defined by ## the figure's "paperposition" property. ## ## @itemx -append -## Appends the PS, or PDF output to a pre-existing file of the +## Appends the PS, or PDF output to a pre-existing file of the ## same type. ## ## @itemx -r@var{NUM} -## Resolution of bitmaps in pixels per inch. For both metafiles and +## Resolution of bitmaps in pixels per inch. For both metafiles and ## SVG the default is the screen resolution, for other it is 150 dpi. ## To specify screen resolution, use "-r0". ##
--- a/scripts/plot/private/__actual_axis_position__.m +++ b/scripts/plot/private/__actual_axis_position__.m @@ -50,7 +50,7 @@ else pos_in_pixels = axis_obj.position .* fig_position([3, 4, 3, 4]); endif - + nd = __calc_dimensions__ (h); if (strcmp (axis_obj.plotboxaspectratiomode, "manual")
--- a/scripts/plot/private/__axis_label__.m +++ b/scripts/plot/private/__axis_label__.m @@ -1,4 +1,4 @@ -## Copyright (C) 1996-2011 John W. Eaton +## Copyright (C) 1996-2011 John W. Eaton ## ## This file is part of Octave. ##
--- a/scripts/plot/private/__bar__.m +++ b/scripts/plot/private/__bar__.m @@ -28,7 +28,7 @@ [h, varargin] = __plt_get_axis_arg__ ((nargout > 1), func, varargin{:}); ## Slightly smaller than 0.8 to avoid clipping issue in gnuplot 4.0 - width = 0.8 - 10 * eps; + width = 0.8 - 10 * eps; group = true; bv = 0; @@ -66,7 +66,7 @@ x = [1:size(y,1)]'; idx = 2; endif - + newargs = {}; have_line_spec = false; while (idx <= nargin - 2) @@ -186,7 +186,7 @@ hg = hggroup (); tmp = [tmp; hg]; args = __add_datasource__ ("bar", hg, {"x", "y"}, varargin{:}); - + if (vertical) if (! have_color_spec) if (ycols == 1) @@ -194,7 +194,7 @@ else lev = (i - 1) * (clim(2) - clim(1)) / (ycols - 1) - clim(1); endif - h = patch(xb(:,:,i), yb(:,:,i), "FaceColor", "flat", + h = patch(xb(:,:,i), yb(:,:,i), "FaceColor", "flat", "cdata", lev, "parent", hg); else h = patch(xb(:,:,i), yb(:,:,i), "parent", hg); @@ -206,7 +206,7 @@ else lev = (i - 1) * (clim(2) - clim(1)) / (ycols - 1) - clim(1); endif - h = patch(yb(:,:,i), xb(:,:,i), "FaceColor", "flat", + h = patch(yb(:,:,i), xb(:,:,i), "FaceColor", "flat", "cdata", lev, "parent", hg); else h = patch(yb(:,:,i), xb(:,:,i), "parent", hg); @@ -229,7 +229,7 @@ addproperty ("baseline", hg, "data", h_baseline); addlistener (hg, "showbaseline", @show_baseline); - addlistener (hg, "basevalue", @move_baseline); + addlistener (hg, "basevalue", @move_baseline); addproperty ("barwidth", hg, "data", width); if (group) @@ -253,9 +253,9 @@ addproperty ("facecolor", hg, "patchfacecolor", get (h, "facecolor")); addlistener (hg, "edgecolor", @update_props); - addlistener (hg, "linewidth", @update_props); - addlistener (hg, "linestyle", @update_props); - addlistener (hg, "facecolor", @update_props); + addlistener (hg, "linewidth", @update_props); + addlistener (hg, "linestyle", @update_props); + addlistener (hg, "facecolor", @update_props); if (isvector (x)) addproperty ("xdata", hg, "data", x); @@ -263,7 +263,7 @@ addproperty ("xdata", hg, "data", x(:, i)); endif addproperty ("ydata", hg, "data", y(:, i)); - + addlistener (hg, "xdata", @update_data); addlistener (hg, "ydata", @update_data); @@ -301,7 +301,7 @@ kids = get (get (h, "parent"), "children"); for i = 1 : length (kids) obj = get (kids (i)); - if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline") + if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline") && obj.baseline == h) ## Only alter if changed to avoid recursion of the listener functions if (! strcmpi (get (kids(i), "showbaseline"), visible)) @@ -350,7 +350,7 @@ function update_props (h, d) kids = get (h, "children"); - set (kids, "edgecolor", get (h, "edgecolor"), + set (kids, "edgecolor", get (h, "edgecolor"), "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle"), "facecolor", get (h, "facecolor"));
--- a/scripts/plot/private/__clabel__.m +++ b/scripts/plot/private/__clabel__.m @@ -41,7 +41,7 @@ while (i1 < length (c)) clev = c(1,i1); clen = c(2,i1); - p = c(:, i1+1:i1+clen) + p = c(:, i1+1:i1+clen) xmin = min (c(1,:)); xmax = max (c(1,:)); @@ -83,7 +83,7 @@ tlabel = sprintf ("%g", clev); for i = 1 : ntag tagpos = pos(i); - + while (j1 < clen && cumd(j1) < tagpos) j1++; endwhile @@ -95,11 +95,11 @@ diff (c(1,i1+j1-1:i1+j1))); if (ischar (z)) - ht = text (tpos(1), tpos(2), clev, tlabel, "rotation", trot, + ht = text (tpos(1), tpos(2), clev, tlabel, "rotation", trot, "parent", hparent, "horizontalalignment", "center", "userdata", clev, varargin{:}); elseif (!isempty (z)) - ht = text (tpos(1), tpos(2), z, tlabel, "rotation", trot, + ht = text (tpos(1), tpos(2), z, tlabel, "rotation", trot, "parent", hparent, "horizontalalignment", "center", "userdata", clev, varargin{:}); else @@ -112,4 +112,4 @@ endfor i1 += clen+1; endwhile -endfunction \ No newline at end of file +endfunction \ No newline at end of file
--- a/scripts/plot/private/__contour__.m +++ b/scripts/plot/private/__contour__.m @@ -96,11 +96,11 @@ vnauto = false; else vnauto = true; - vn = 10; + vn = 10; endif if (isscalar (vn)) - lvl = linspace (min (z1(!isinf(z1))), max (z1(!isinf(z1))), + lvl = linspace (min (z1(!isinf(z1))), max (z1(!isinf(z1))), vn + 2)(1:end-1); else lvl = vn; @@ -140,8 +140,8 @@ addproperty ("fill", hg, "radio", "on|{off}", filled); ## The properties zlevel and zlevelmode don't exist in matlab, but - ## allow the use of contourgroups with the contour3, meshc and surfc - ## functions. + ## allow the use of contourgroups with the contour3, meshc and surfc + ## functions. if (isnumeric (zlevel)) addproperty ("zlevelmode", hg, "radio", "{none}|auto|manual", "manual"); addproperty ("zlevel", hg, "data", zlevel); @@ -319,11 +319,11 @@ else ## Special case unclosed contours endif - h = [h; __go_patch__(ca, "xdata", ctmp(1, :)(:), "ydata", ctmp(2, :)(:), + h = [h; __go_patch__(ca, "xdata", ctmp(1, :)(:), "ydata", ctmp(2, :)(:), "vertices", ctmp.', "faces", 1:(cont_len(idx)-1), "facevertexcdata", cont_lev(idx), "facecolor", "flat", "cdata", cont_lev(idx), - "edgecolor", lc, "linestyle", ls, + "edgecolor", lc, "linestyle", ls, "linewidth", lw, "parent", hg)]; endfor @@ -349,25 +349,25 @@ switch (zmode) case "none" h = [h; __go_patch__(ca, "xdata", p(:,1), "ydata", p(:,2), - "zdata", [], "facecolor", "none", + "zdata", [], "facecolor", "none", "vertices", p, "faces", 1:rows(p), "facevertexcdata", clev, "edgecolor", lc, "linestyle", ls, "linewidth", lw, - "cdata", clev, "parent", hg)]; + "cdata", clev, "parent", hg)]; case "auto" h = [h; __go_patch__(ca, "xdata", p(:,1), "ydata", p(:,2), "zdata", clev * ones(rows(p),1), - "vertices", [p, clev * ones(rows(p),1)], + "vertices", [p, clev * ones(rows(p),1)], "faces", 1:rows(p), "facevertexcdata", clev, - "facecolor", "none", "edgecolor", lc, + "facecolor", "none", "edgecolor", lc, "linestyle", ls, "linewidth", lw, "cdata", clev, "parent", hg)]; otherwise h = [h; __go_patch__(ca, "xdata", p(:,1), "ydata", p(:,2), "zdata", zlev * ones (rows(p), 1), - "vertices", [p, zlev * ones(rows(p),1)], + "vertices", [p, zlev * ones(rows(p),1)], "faces", 1:rows(p), "facevertexcdata", clev, "facecolor", "none", "edgecolor", lc, @@ -390,7 +390,7 @@ set (kids, "zdata", []); case "auto" for i = 1 : length (kids) - set (kids(i), "zdata", get (kids (i), "cdata") .* + set (kids(i), "zdata", get (kids (i), "cdata") .* ones (size (get (kids (i), "xdata")))); endfor otherwise @@ -460,8 +460,8 @@ Z0(2:nr+1, 2:nc+1) = Z; [c, lev] = contourc (X0, Y0, Z0, lvl); else - [c, lev] = contourc (get (h, "xdata"), get (h, "ydata"), - get (h, "zdata"), lvl); + [c, lev] = contourc (get (h, "xdata"), get (h, "ydata"), + get (h, "zdata"), lvl); endif set (h, "contourmatrix", c); @@ -510,7 +510,7 @@ if (strcmpi (get (h, "showtext"), "on")) switch (get (h, "zlevelmode")) case "manual" - __clabel__ (get (h, "contourmatrix"), lvl, h, + __clabel__ (get (h, "contourmatrix"), lvl, h, get (h, "labelspacing"), get (h, "zlevel")); case "auto" __clabel__ (get (h, "contourmatrix"), lvl, h, @@ -533,7 +533,7 @@ lvl_eps = abs (lev) * sqrt (eps); else tmp = min (abs (diff (lev))); - if (tmp < 10*eps) + if (tmp < 10*eps) lvl_eps = sqrt (eps); else lvl_eps = tmp / 1000.0;
--- a/scripts/plot/private/__errplot__.m +++ b/scripts/plot/private/__errplot__.m @@ -57,7 +57,7 @@ hg = hggroup ("parent", p); h = [h; hg]; - args = __add_datasource__ ("__errplot__", hg, + args = __add_datasource__ ("__errplot__", hg, {"x", "y", "l", "u", "xl", "xu"}); if (isempty (fmt.color)) @@ -144,7 +144,7 @@ udata = varargin{6}(:,i); else error ("errorbar: error plot with 6 columns only valid for boxxy and xyerr"); - endif + endif otherwise error ("errorbar: error plot requires 2, 3, 4 or 6 arguments."); endswitch @@ -161,19 +161,19 @@ addproperty ("linewidth", hg, "linelinewidth", get (hl(1), "linewidth")) addproperty ("linestyle", hg, "linelinestyle", get (hl(1), "linestyle")) addproperty ("marker", hg, "linemarker", get (hl(1), "marker")) - addproperty ("markerfacecolor", hg, "linemarkerfacecolor", + addproperty ("markerfacecolor", hg, "linemarkerfacecolor", get (hl(1), "markerfacecolor")) - addproperty ("markeredgecolor", hg, "linemarkerfacecolor", + addproperty ("markeredgecolor", hg, "linemarkerfacecolor", get (hl(1), "markeredgecolor")) - addproperty ("markersize", hg, "linemarkersize", + addproperty ("markersize", hg, "linemarkersize", get (hl(1), "markersize")) fcn = {@update_props, hl}; addlistener (hg, "color", fcn); - addlistener (hg, "linewidth", fcn); - addlistener (hg, "linestyle", fcn); - addlistener (hg, "marker", fcn); - addlistener (hg, "markerfacecolor", fcn); + addlistener (hg, "linewidth", fcn); + addlistener (hg, "linestyle", fcn); + addlistener (hg, "marker", fcn); + addlistener (hg, "markerfacecolor", fcn); addlistener (hg, "markersize", fcn); fcn = {@update_data, hl}; @@ -195,7 +195,7 @@ endfunction -function [xdata, ydata] = errorbar_data (xdata, ydata, ldata, udata, +function [xdata, ydata] = errorbar_data (xdata, ydata, ldata, udata, xldata, xudata, ifmt, xscale, yscale) if (strcmp (xscale, "linear")) @@ -249,9 +249,9 @@ ydata = [ydata-ldata, ydata-ldata, ydata+udata, ydata+udata, ... ydata-ldata, nans]; elseif (strcmp (ifmt, "xyerr")) - [x1, y1] = errorbar_data (xdata, ydata, ldata, udata, + [x1, y1] = errorbar_data (xdata, ydata, ldata, udata, xldata, xudata, "xerr", xscale, yscale); - [x2, y2] = errorbar_data (xdata, ydata, ldata, udata, + [x2, y2] = errorbar_data (xdata, ydata, ldata, udata, xldata, xudata, "yerr", xscale, yscale); xdata = [x1; x2]; ydata = [y1; y2]; @@ -264,9 +264,9 @@ endfunction function update_props (hg, dummy, hl) - set (hl, "color", get (hg, "color"), + set (hl, "color", get (hg, "color"), "linewidth", get (hg, "linewidth"));, - set (hl(1), "linestyle", get (hg, "linestyle"), + set (hl(1), "linestyle", get (hg, "linestyle"), "marker", get (hg, "marker"), "markersize", get (hg, "markersize"), "markerfacecolor", get (hg, "markerfacecolor"),
--- a/scripts/plot/private/__ezplot__.m +++ b/scripts/plot/private/__ezplot__.m @@ -118,7 +118,7 @@ elseif (isa (fun, "function_handle")) fstr = func2str (fun); if (length (findstr (fstr, ")")) != 0) - args = regexp (substr (fstr, 3, findstr (fstr, ")")(1) - 3), + args = regexp (substr (fstr, 3, findstr (fstr, ")")(1) - 3), '(\w+)', 'tokens'); fstr = substr (fstr, findstr (fstr, ")")(1) + 1); else @@ -176,7 +176,7 @@ parametric = true; fstry = func2str (funy); if (length (findstr (fstry, ")")) != 0) - args = regexp (substr (fstry, 3, findstr (fstry, ")")(1) - 3), + args = regexp (substr (fstry, 3, findstr (fstry, ")")(1) - 3), '(\w+)', 'tokens'); fstry = substr (fstry, findstr (fstry, ")")(1) + 1); else @@ -216,7 +216,7 @@ fstrz = formula (funz); elseif (isa (funz, "function_handle")) fstrz = func2str (funz); - args = regexp (substr (fstrz, 3, findstr (fstrz, ")")(1) - 3), + args = regexp (substr (fstrz, 3, findstr (fstrz, ")")(1) - 3), '(\w+)', 'tokens'); if (length (args) != nargs) error ("%s: excepting a function of %d arguments", func, nargs); @@ -229,7 +229,7 @@ endif if (isplot && nargs != 2) - n = 500; + n = 500; else n = 60; endif @@ -276,7 +276,7 @@ return; endif if (parametric) - error ("%s: can not have both circular domain and parametric function", + error ("%s: can not have both circular domain and parametric function", func); endif cent = [domain(1) + domain(2), domain(3) + domain(4)] / 2; @@ -330,14 +330,14 @@ Z = __eliminate_sing__ (Z); endif - fstrx = regexprep (regexprep (regexprep (fstrx,'\s*\.?\^\s*','^'), + fstrx = regexprep (regexprep (regexprep (fstrx,'\s*\.?\^\s*','^'), '\./', '/'), '\.?\*', ''); - fstry = regexprep (regexprep (regexprep (fstry,'\s*\.?\^\s*','^'), + fstry = regexprep (regexprep (regexprep (fstry,'\s*\.?\^\s*','^'), '\./', '/'), '\.?\*', ''); if (isplot) fstr = cstrcat ("x = ",fstrx,", y = ",fstry); else - fstrz = regexprep (regexprep (regexprep (fstrz,'\s*\.?\^\s*','^'), + fstrz = regexprep (regexprep (regexprep (fstrz,'\s*\.?\^\s*','^'), '\./', '/'), '\.?\*', ''); fstr = cstrcat ("x = ",fstrx,",y = ",fstry,", z = ",fstrz); endif @@ -347,7 +347,7 @@ return; endif - fstr = regexprep (regexprep (regexprep (fstr,'\s*\.?\^\s*','^'), '\./', '/'), + fstr = regexprep (regexprep (regexprep (fstr,'\s*\.?\^\s*','^'), '\./', '/'), '\.?\*', ''); if (isplot && nargs == 2) if (strcmp (typeinfo (fun), "inline function") @@ -359,7 +359,7 @@ Z = feval (fun, X, Y); - ## Matlab returns line objects for this case and so can't call + ## Matlab returns line objects for this case and so can't call ## contour directly as it returns patch objects to allow colormaps ## to work with contours. Therefore recreate the lines from the ## output for contourc, and store in cell arrays. @@ -375,7 +375,7 @@ YY = [YY, {c(2, i1+1:i1+clen)}]; i1 += clen+1; endwhile - else + else if (ispolar) Z = feval (fun, X); elseif (isplot) @@ -396,7 +396,7 @@ idx = find (((Z(idx) > yrange(2) / 2) & (Z(idx-1) < yrange(1) / 2)) | ((Z(idx) < yrange(1) / 2) & (Z(idx-1) > yrange (2) / 2))); if (any(idx)) - Z(idx) = NaN; + Z(idx) = NaN; endif else Z = feval (fun, X, Y); @@ -407,7 +407,7 @@ endif endif - oldax = gca (); + oldax = gca (); unwind_protect axes (ax); if (iscontour)
--- a/scripts/plot/private/__fltk_file_filter__.m +++ b/scripts/plot/private/__fltk_file_filter__.m @@ -34,7 +34,7 @@ fltk_str = ""; for idx = 1 : r - curr_ext = file_filter{idx, 1}; + curr_ext = file_filter{idx, 1}; curr_ext = strsplit (curr_ext, ";"); if (length (curr_ext) > 1) @@ -68,5 +68,5 @@ retval = strcat ("*", fext, "\t*"); endif endif - endif + endif endfunction
--- a/scripts/plot/private/__ghostscript__.m +++ b/scripts/plot/private/__ghostscript__.m @@ -1,5 +1,5 @@ ## Copyright (C) 2010-2011 Ben Abbott -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it
--- a/scripts/plot/private/__gnuplot_has_terminal__.m +++ b/scripts/plot/private/__gnuplot_has_terminal__.m @@ -1,5 +1,5 @@ ## Copyright (C) 2010-2011 Ben Abbott -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it
--- a/scripts/plot/private/__patch__.m +++ b/scripts/plot/private/__patch__.m @@ -208,7 +208,7 @@ if (any (t1(:))) t2 = find (t1 != t1([2:end,end],:)); idx (t1) = idx (t2 (cell2mat (cellfun (@(x) x(1)*ones(1,x(2)), - mat2cell ([1 : nc; sum(t1)], 2, ones(1,nc)), + mat2cell ([1 : nc; sum(t1)], 2, ones(1,nc)), "uniformoutput", false)))); endif x = reshape (vert(:,1)(idx), size (idx)); @@ -288,7 +288,7 @@ else fvc = c(:).'; endif - + args = {"faces", faces, "vertices", vert, "facevertexcdata", fvc, args{:}}; endfunction
--- a/scripts/plot/private/__pie__.m +++ b/scripts/plot/private/__pie__.m @@ -64,7 +64,7 @@ normalize = true; if (sum (x(:)) < 1) normalize = false; - endif + endif if (! have_labels) if (normalize) @@ -86,7 +86,7 @@ xphi = cumsum (x * 360); endif - for i = 1:len + for i = 1:len if (i == 1) xn = 0 : 360 / refinement : xphi(i); else @@ -107,7 +107,7 @@ endif xt = - 1.2 * sind (xn2); yt = 1.2 * cosd (xn2); - + if (len == 1) set (h, "clim", [1, 2]); else @@ -123,7 +123,7 @@ sc = i * ones (size (sz)); hlist = [hlist; - patch(xoff + [0, - sind(xn)], yoff + [0, cosd(xn)], zeros (1, ln + 1), i); + patch(xoff + [0, - sind(xn)], yoff + [0, cosd(xn)], zeros (1, ln + 1), i); surface(sx, sy, sz, sc); patch(xoff + [0, - sind(xn)], yoff + [0, cosd(xn)], zlvl * ones (1, ln + 1), i); text(xt, yt, zlvl, labels{i})]; @@ -145,7 +145,7 @@ addlistener(gca, "view", {@update_text_pos, hlist}); - if (strncmp (caller, "pie3", 4)) + if (strncmp (caller, "pie3", 4)) axis ([-1.25, 1.25, -1.25, 1.25, -0.05, 0.4], "equal", "off") view (-37.5, 30); elseif (strncmp (caller, "pie", 3))
--- a/scripts/plot/private/__pltopt__.m +++ b/scripts/plot/private/__pltopt__.m @@ -150,7 +150,7 @@ n = 3; elseif (strncmp (opt, "#~", 2) || strncmp (opt, "~>", 2)) n = 2; - elseif (strncmp (opt, "~", 1) || strncmp (opt, ">", 1) + elseif (strncmp (opt, "~", 1) || strncmp (opt, ">", 1) || strncmp (opt, "#", 1)) n = 1; else
--- a/scripts/plot/private/__quiver__.m +++ b/scripts/plot/private/__quiver__.m @@ -58,7 +58,7 @@ z = varargin{ioff++}; endif u = varargin{ioff++}; - v = varargin{ioff++}; + v = varargin{ioff++}; if (is3d) w = varargin{ioff++}; if (isvector (x) && isvector (y) && isvector (z) @@ -118,7 +118,7 @@ dz = 0; endif if (len > 0) - s = 2 * autoscale / sqrt (2) * sqrt (dx.^2 + dy.^2 + dz.^2) / len; + s = 2 * autoscale / sqrt (2) * sqrt (dx.^2 + dy.^2 + dz.^2) / len; uu = s * u; vv = s * v; if (is3d) @@ -137,10 +137,10 @@ unwind_protect hg = hggroup (); if (is3d) - args = __add_datasource__ ("quiver3", hg, + args = __add_datasource__ ("quiver3", hg, {"x", "y", "z", "u", "v", "w"}, args{:}); else - args = __add_datasource__ ("quiver", hg, + args = __add_datasource__ ("quiver", hg, {"x", "y", "z", "u", "v", "w"}, args{:}); endif hold on; @@ -179,12 +179,12 @@ h1 = plot3 ([x.'; xend.'; NaN(1, length (x))](:), [y.'; yend.'; NaN(1, length (y))](:), [z.'; zend.'; NaN(1, length (z))](:), - "linestyle", linespec.linestyle, + "linestyle", linespec.linestyle, "color", linespec.color, "parent", hg); else h1 = plot ([x.'; xend.'; NaN(1, length (x))](:), [y.'; yend.'; NaN(1, length (y))](:), - "linestyle", linespec.linestyle, + "linestyle", linespec.linestyle, "color", linespec.color, "parent", hg); endif else @@ -252,7 +252,7 @@ || (isfield (linespec, "marker") && strncmp (linespec.marker, "none", 4))) if (is3d) - h3 = plot3 (x, y, z, "linestyle", "none", "marker", "none", + h3 = plot3 (x, y, z, "linestyle", "none", "marker", "none", "parent", hg); else h3 = plot (x, y, "linestyle", "none", "marker", "none", "parent", hg); @@ -269,7 +269,7 @@ endif if (have_filled) ## FIXME gnuplot doesn't respect the markerfacecolor field - set (h3, "markerfacecolor", get (h1, "color")); + set (h3, "markerfacecolor", get (h1, "color")); endif ## Set up the hggroup properties and listeners @@ -298,10 +298,10 @@ addproperty ("markersize", hg, "linemarkersize", get (h3, "markersize")); addlistener (hg, "color", @update_props); - addlistener (hg, "linewidth", @update_props); - addlistener (hg, "linestyle", @update_props); - addlistener (hg, "marker", @update_props); - addlistener (hg, "markerfacecolor", @update_props); + addlistener (hg, "linewidth", @update_props); + addlistener (hg, "linestyle", @update_props); + addlistener (hg, "marker", @update_props); + addlistener (hg, "markerfacecolor", @update_props); addlistener (hg, "markersize", @update_props); if (! isempty (args)) @@ -346,7 +346,7 @@ dz = 0; endif if (len > 0) - s = 2 * s / sqrt (2) * sqrt (dx.^2 + dy.^2 + dz.^2) / len; + s = 2 * s / sqrt (2) * sqrt (dx.^2 + dy.^2 + dz.^2) / len; u = s * u; v = s * v; if (is3d) @@ -403,10 +403,10 @@ function update_props (h, d) kids = get (h, "children"); - set (kids(3), "color", get (h, "color"), + set (kids(3), "color", get (h, "color"), "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle")); - set (kids(2), "color", get (h, "color"), + set (kids(2), "color", get (h, "color"), "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle")); if (strcmpi (get (h, "showarrowhead"), "on")) @@ -414,7 +414,7 @@ else set (kids (2), "visible", "off"); endif - set (kids(1), "color", get (h, "color"), + set (kids(1), "color", get (h, "color"), "marker", get (h, "marker"), "markerfacecolor", get (h, "markerfacecolor"), "markersize", get (h, "markersize"));
--- a/scripts/plot/private/__scatter__.m +++ b/scripts/plot/private/__scatter__.m @@ -114,7 +114,7 @@ endif hg = hggroup (); - newargs = __add_datasource__ (fcn, hg, {"x", "y", "z", "c", "size"}, + newargs = __add_datasource__ (fcn, hg, {"x", "y", "z", "c", "size"}, newargs{:}); addproperty ("xdata", hg, "data", x); @@ -144,16 +144,16 @@ for i = 1 : numel (x) if (filled) h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:), - "faces", 1, "vertices", [x(i), y(i), z(i,:)], - "facecolor", "none", "edgecolor", "none", - "marker", marker, "markersize", s(i), + "faces", 1, "vertices", [x(i), y(i), z(i,:)], + "facecolor", "none", "edgecolor", "none", + "marker", marker, "markersize", s(i), "markeredgecolor", c, "markerfacecolor", c, "linestyle", "none"); else h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:), - "faces", 1, "vertices", [x(i), y(i), z(i,:)], - "facecolor", "none", "edgecolor", "none", - "marker", marker, "markersize", s(i), + "faces", 1, "vertices", [x(i), y(i), z(i,:)], + "facecolor", "none", "edgecolor", "none", + "marker", marker, "markersize", s(i), "markeredgecolor", c, "markerfacecolor", "none", "linestyle", "none"); endif @@ -162,18 +162,18 @@ for i = 1 : numel (x) if (filled) h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:), - "faces", 1, "vertices", [x(i), y(i), z(i,:)], - "facecolor", "none", "edgecolor", "none", - "marker", marker, "markersize", s(i), - "markeredgecolor", "none", + "faces", 1, "vertices", [x(i), y(i), z(i,:)], + "facecolor", "none", "edgecolor", "none", + "marker", marker, "markersize", s(i), + "markeredgecolor", "none", "markerfacecolor", "flat", "cdata", c(i,:), "linestyle", "none"); else h = __go_patch__ (hg, "xdata", x(i), "ydata", y(i), "zdata", z(i,:), - "faces", 1, "vertices", [x(i), y(i), z(i,:)], - "facecolor", "none", "edgecolor", "none", - "marker", marker, "markersize", s(i), - "markeredgecolor", "flat", + "faces", 1, "vertices", [x(i), y(i), z(i,:)], + "facecolor", "none", "edgecolor", "none", + "marker", marker, "markersize", s(i), + "markeredgecolor", "flat", "markerfacecolor", "none", "cdata", c(i,:), "linestyle", "none"); @@ -188,19 +188,19 @@ vert = [x, y, z]; if (ischar (c) || rows (c) == 1) - h = render_size_color (hg, vert, s, c, marker, filled, false); + h = render_size_color (hg, vert, s, c, marker, filled, false); elseif (columns (c) == 1) - h = render_size_color (hg, vert, s, c, marker, filled, true); + h = render_size_color (hg, vert, s, c, marker, filled, true); else [cc, idx] = unique_idx (c, "rows"); if (isscalar (s)) for i = 1:rows (x) - h = render_size_color (hg, vert(idx{i},:), s, cc(i,:), + h = render_size_color (hg, vert(idx{i},:), s, cc(i,:), marker, filled, true); endfor else for i = 1:rows (x) - h = render_size_color (hg, vert(idx{i},:), s(idx{i}), cc(i,:), + h = render_size_color (hg, vert(idx{i},:), s(idx{i}), cc(i,:), marker, filled, true); endfor endif @@ -236,9 +236,9 @@ addproperty ("markeredgecolor", hg, "patchmarkeredgecolor", "flat"); endif endif - addlistener (hg, "linewidth", @update_props); - addlistener (hg, "marker", @update_props); - addlistener (hg, "markerfacecolor", @update_props); + addlistener (hg, "linewidth", @update_props); + addlistener (hg, "marker", @update_props); + addlistener (hg, "markerfacecolor", @update_props); addlistener (hg, "markeredgecolor", @update_props); if (! isempty (newargs)) @@ -277,18 +277,18 @@ if (ischar (c) || !isflat) if (filled) h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z, - "faces", 1, "vertices", vert, - "facecolor", "none", "edgecolor", "none", - "marker", marker, - "markeredgecolor", "none", + "faces", 1, "vertices", vert, + "facecolor", "none", "edgecolor", "none", + "marker", marker, + "markeredgecolor", "none", "markerfacecolor", c, "markersize", s, "linestyle", "none"); else h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z, - "faces", 1, "vertices", vert, - "facecolor", "none", "edgecolor", "none", - "marker", marker, - "markeredgecolor", c, + "faces", 1, "vertices", vert, + "facecolor", "none", "edgecolor", "none", + "marker", marker, + "markeredgecolor", c, "markerfacecolor", "none", "markersize", s, "linestyle", "none"); endif @@ -296,17 +296,17 @@ if (filled) h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z, "faces", 1, "vertices", vert, - "facecolor", "none", "edgecolor", "none", - "marker", marker, "markersize", s, - "markeredgecolor", "none", + "facecolor", "none", "edgecolor", "none", + "marker", marker, "markersize", s, + "markeredgecolor", "none", "markerfacecolor", "flat", "cdata", c, "linestyle", "none"); else h = __go_patch__ (hg, "xdata", x, "ydata", y, "zdata", z, "faces", 1, "vertices", vert, - "facecolor", "none", "edgecolor", "none", - "marker", marker, "markersize", s, - "markeredgecolor", "flat", + "facecolor", "none", "edgecolor", "none", + "marker", marker, "markersize", s, + "markeredgecolor", "flat", "markerfacecolor", "none", "cdata", c, "linestyle", "none"); endif @@ -315,7 +315,7 @@ ## FIXME: round the size to one decimal place. It's not quite right, though. [ss, idx] = unique_idx (ceil (s*10) / 10); for i = 1:rows (ss) - h = render_size_color (hg, vert(idx{i},:), ss(i), c, + h = render_size_color (hg, vert(idx{i},:), ss(i), c, marker, filled, isflat); endfor endif @@ -329,7 +329,7 @@ kids = get (h, "children"); for i = 1 : numel (kids) - set (kids (i), "linewidth", lw, "marker", m, "markerfacecolor", fc, + set (kids (i), "linewidth", lw, "marker", m, "markerfacecolor", fc, "edgecolor", ec) endfor endfunction @@ -362,12 +362,12 @@ else if (isempty (z1)) for i = 1 : length (hlist) - set (hlist(i), "vertices", [x1(i), y1(i)], "cdata", + set (hlist(i), "vertices", [x1(i), y1(i)], "cdata", reshape(c1(i,:),[1, size(c1)(2:end)]), "markersize", size1(i)); endfor else for i = 1 : length (hlist) - set (hlist(i), "vertices", [x1(i), y1(i), z1(i)], "cdata", + set (hlist(i), "vertices", [x1(i), y1(i), z1(i)], "cdata", reshape(c1(i,:),[1, size(c1)(2:end)]), "markersize", size1(i)); endfor endif
--- a/scripts/plot/private/__stem__.m +++ b/scripts/plot/private/__stem__.m @@ -63,7 +63,7 @@ hg = hggroup (); h = [h; hg]; args = __add_datasource__ (caller, hg, {"x", "y", "z"}, varargin{:}); - + if (i == 1) set (ax, "nextplot", "add"); endif @@ -87,7 +87,7 @@ endif if (have_z) - h_stems = plot3 (xt, yt, zt, "color", lc, "linestyle", ls, + h_stems = plot3 (xt, yt, zt, "color", lc, "linestyle", ls, "parent", hg, x, y, z, "color", mc, "marker", ms, "linestyle", "none", "markerfacecolor", fc, "parent", hg); @@ -97,7 +97,7 @@ h_stems = plot (xt, yt, "color", lc, "linestyle", ls, "parent", hg, x(:,i), y(:, i), "color", mc, "marker", ms, "linestyle", "none", "markerfacecolor", - fc, "parent", hg); + fc, "parent", hg); x_axis_range = get (ax, "xlim"); h_baseline = line (x_axis_range, [0, 0], "color", [0, 0, 0]); @@ -115,7 +115,7 @@ if (!have_z) addlistener (hg, "showbaseline", @show_baseline); - addlistener (hg, "basevalue", @move_baseline); + addlistener (hg, "basevalue", @move_baseline); endif addproperty ("color", hg, "linecolor", lc); @@ -126,10 +126,10 @@ addproperty ("markersize", hg, "linemarkersize", 6); addlistener (hg, "color", @update_props); - addlistener (hg, "linewidth", @update_props); - addlistener (hg, "linestyle", @update_props); - addlistener (hg, "marker", @update_props); - addlistener (hg, "markerfacecolor", @update_props); + addlistener (hg, "linewidth", @update_props); + addlistener (hg, "linestyle", @update_props); + addlistener (hg, "marker", @update_props); + addlistener (hg, "markerfacecolor", @update_props); addlistener (hg, "markersize", @update_props); addproperty ("xdata", hg, "data", x(:, i)); @@ -205,7 +205,7 @@ x = 1:length (y); elseif (ismatrix (y)) x = 1:rows (y); - else + else error ("stem: Y must be a matrix"); endif # in each case, x & y will be defined endif @@ -482,7 +482,7 @@ kids = get (get (h, "parent"), "children"); for i = 1 : length (kids) obj = get (kids (i)); - if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline") + if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline") && obj.baseline == h) ## Only alter if changed to avoid recursion of the listener functions if (! strcmpi (get (kids(i), "showbaseline"), visible)) @@ -516,10 +516,10 @@ function update_props (h, d) kids = get (h, "children"); - set (kids(2), "color", get (h, "color"), + set (kids(2), "color", get (h, "color"), "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle")); - set (kids(1), "color", get (h, "color"), + set (kids(1), "color", get (h, "color"), "marker", get (h, "marker"), "markerfacecolor", get (h, "markerfacecolor"), "markersize", get (h, "markersize"));
--- a/scripts/plot/private/__tight_eps_bbox__.m +++ b/scripts/plot/private/__tight_eps_bbox__.m @@ -1,5 +1,5 @@ ## Copyright (C) 2010-2011 Ben Abbott -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it
--- a/scripts/plot/quiver.m +++ b/scripts/plot/quiver.m @@ -25,16 +25,16 @@ ## @deftypefnx {Function File} {} quiver (@var{h}, @dots{}) ## @deftypefnx {Function File} {@var{h} =} quiver (@dots{}) ## -## Plot the @code{(@var{u}, @var{v})} components of a vector field in -## an @code{(@var{x}, @var{y})} meshgrid. If the grid is uniform, you can +## Plot the @code{(@var{u}, @var{v})} components of a vector field in +## an @code{(@var{x}, @var{y})} meshgrid. If the grid is uniform, you can ## specify @var{x} and @var{y} as vectors. ## ## If @var{x} and @var{y} are undefined they are assumed to be -## @code{(1:@var{m}, 1:@var{n})} where @code{[@var{m}, @var{n}] = +## @code{(1:@var{m}, 1:@var{n})} where @code{[@var{m}, @var{n}] = ## size(@var{u})}. ## ## The variable @var{s} is a scalar defining a scaling factor to use for -## the arrows of the field relative to the mesh spacing. A value of 0 +## the arrows of the field relative to the mesh spacing. A value of 0 ## disables all scaling. The default value is 1. ## ## The style to use for the plot can be defined with a line style @var{style}
--- a/scripts/plot/quiver3.m +++ b/scripts/plot/quiver3.m @@ -25,16 +25,16 @@ ## @deftypefnx {Function File} {} quiver3 (@var{h}, @dots{}) ## @deftypefnx {Function File} {@var{h} =} quiver3 (@dots{}) ## -## Plot the @code{(@var{u}, @var{v}, @var{w})} components of a vector field in -## an @code{(@var{x}, @var{y}), @var{z}} meshgrid. If the grid is uniform, you +## Plot the @code{(@var{u}, @var{v}, @var{w})} components of a vector field in +## an @code{(@var{x}, @var{y}), @var{z}} meshgrid. If the grid is uniform, you ## can specify @var{x}, @var{y} @var{z} as vectors. ## ## If @var{x}, @var{y} and @var{z} are undefined they are assumed to be -## @code{(1:@var{m}, 1:@var{n}, 1:@var{p})} where @code{[@var{m}, @var{n}] = +## @code{(1:@var{m}, 1:@var{n}, 1:@var{p})} where @code{[@var{m}, @var{n}] = ## size(@var{u})} and @code{@var{p} = max (size (@var{w}))}. ## ## The variable @var{s} is a scalar defining a scaling factor to use for -## the arrows of the field relative to the mesh spacing. A value of 0 +## the arrows of the field relative to the mesh spacing. A value of 0 ## disables all scaling. The default value is 1. ## ## The style to use for the plot can be defined with a line style @var{style} @@ -87,12 +87,12 @@ %!demo %! clf %! colormap (jet (64)) -%! [x,y]=meshgrid (-1:0.1:1); -%! z=sin(2*pi*sqrt(x.^2+y.^2)); +%! [x,y]=meshgrid (-1:0.1:1); +%! z=sin(2*pi*sqrt(x.^2+y.^2)); %! theta=2*pi*sqrt(x.^2+y.^2)+pi/2; %! quiver3(x,y,z,sin(theta),cos(theta),ones(size(z))); -%! hold on; -%! mesh(x,y,z); +%! hold on; +%! mesh(x,y,z); %! hold off; %!demo
--- a/scripts/plot/refreshdata.m +++ b/scripts/plot/refreshdata.m @@ -65,7 +65,7 @@ if (nargin < 2) workspace = "base"; else - if ( !ischar (workspace) + if ( !ischar (workspace) || !(strcmpi (workspace, "base") || strcmpi (workspace, "caller"))) error ("refreshdata: expecting WORKSPACE to be \"base\" or ""caller\"");
--- a/scripts/plot/rose.m +++ b/scripts/plot/rose.m @@ -27,14 +27,14 @@ ## of @var{th} produces a separate histogram. ## ## If @var{r} is given and is a scalar, then the histogram is produced with -## @var{r} bins. If @var{r} is a vector, then the center of each bin are +## @var{r} bins. If @var{r} is a vector, then the center of each bin are ## defined by the values of @var{r}. ## -## The optional return value @var{h} provides a list of handles to the +## The optional return value @var{h} provides a list of handles to the ## the parts of the vector field (body, arrow and marker). ## -## If two output arguments are requested, then rather than plotting the -## histogram, the polar vectors necessary to plot the histogram are +## If two output arguments are requested, then rather than plotting the +## histogram, the polar vectors necessary to plot the histogram are ## returned. ## ## @example @@ -50,7 +50,7 @@ function [thout, rout] = rose (varargin) - [h, varargin, nargin] = __plt_get_axis_arg__ ((nargout > 1), "rose", + [h, varargin, nargin] = __plt_get_axis_arg__ ((nargout > 1), "rose", varargin{:}); if (nargin < 1) @@ -64,7 +64,7 @@ if (nargin > 1) x = varargin {2}; if (isscalar (x)) - x = [0.5/x : 1/x : 1] * 2 * pi; + x = [0.5/x : 1/x : 1] * 2 * pi; else ## Force theta to [0,2*pi] range x = atan2 (sin (x), cos (x)) + pi;
--- a/scripts/plot/saveas.m +++ b/scripts/plot/saveas.m @@ -20,8 +20,8 @@ ## @deftypefn {Function File} {} saveas (@var{h}, @var{filename}) ## @deftypefnx {Function File} {} saveas (@var{h}, @var{filename}, @var{fmt}) ## Save graphic object @var{h} to the file @var{filename} in graphic -## format @var{fmt}. -## +## format @var{fmt}. +## ## @var{fmt} should be one of the following formats: ## ## @table @code @@ -77,7 +77,7 @@ else error ("saveas: first argument H must be a graphics handle"); endif - + if (!ischar (filename)) error ("saveas: FILENAME must be a string"); endif @@ -102,7 +102,7 @@ endif prt_opt = strcat ("-d", tolower (fmt)); - + print (filename, prt_opt); endfunction
--- a/scripts/plot/scatter.m +++ b/scripts/plot/scatter.m @@ -27,21 +27,21 @@ ## @deftypefnx {Function File} {} scatter (@var{h}, @dots{}) ## @deftypefnx {Function File} {@var{h} =} scatter (@dots{}) ## -## Plot a scatter plot of the data. A marker is plotted at each point +## Plot a scatter plot of the data. A marker is plotted at each point ## defined by the points in the vectors @var{x} and @var{y}. The size of -## the markers used is determined by the @var{s}, which can be a scalar, -## a vector of the same length of @var{x} and @var{y}. If @var{s} is not +## the markers used is determined by the @var{s}, which can be a scalar, +## a vector of the same length of @var{x} and @var{y}. If @var{s} is not ## given or is an empty matrix, then the default value of 8 points is used. ## ## The color of the markers is determined by @var{c}, which can be a string -## defining a fixed color; a 3-element vector giving the red, green,and blue +## defining a fixed color; a 3-element vector giving the red, green,and blue ## components of the color; a vector of the same length as @var{x} that gives ## a scaled index into the current colormap; or a @var{n}-by-3 matrix defining ## the colors of each of the markers individually. ## -## The marker to use can be changed with the @var{style} argument, that is a -## string defining a marker in the same manner as the @code{plot} command. -## If the argument 'filled' is given then the markers as filled. All +## The marker to use can be changed with the @var{style} argument, that is a +## string defining a marker in the same manner as the @code{plot} command. +## If the argument 'filled' is given then the markers as filled. All ## additional arguments are passed to the underlying patch command. ## ## The optional return value @var{h} provides a handle to the patch object @@ -100,7 +100,7 @@ %! h = scatter (x, y, s, s, "s", "filled"); %!demo -%! rand_10x1_data3 = [0.42262, 0.51623, 0.65992, 0.14999, 0.68385, 0.55929, 0.52251, 0.92204, 0.19762, 0.93726]; +%! rand_10x1_data3 = [0.42262, 0.51623, 0.65992, 0.14999, 0.68385, 0.55929, 0.52251, 0.92204, 0.19762, 0.93726]; %! rand_10x1_data4 = [0.020207, 0.527193, 0.443472, 0.061683, 0.370277, 0.947349, 0.249591, 0.666304, 0.134247, 0.920356]; %! x = rand_10x1_data3; %! y = rand_10x1_data4;
--- a/scripts/plot/scatter3.m +++ b/scripts/plot/scatter3.m @@ -24,21 +24,21 @@ ## @deftypefnx {Function File} {} scatter3 (@var{h}, @dots{}) ## @deftypefnx {Function File} {@var{h} =} scatter3 (@dots{}) ## -## Plot a scatter plot of the data in 3D@. A marker is plotted at each point +## Plot a scatter plot of the data in 3D@. A marker is plotted at each point ## defined by the points in the vectors @var{x}, @var{y} and @var{z}. The size ## of the markers used is determined by @var{s}, which can be a scalar or ## a vector of the same length of @var{x}, @var{y} and @var{z}. If @var{s} is ## not given or is an empty matrix, then the default value of 8 points is used. ## ## The color of the markers is determined by @var{c}, which can be a string -## defining a fixed color; a 3-element vector giving the red, green, and blue +## defining a fixed color; a 3-element vector giving the red, green, and blue ## components of the color; a vector of the same length as @var{x} that gives ## a scaled index into the current colormap; or a @var{n}-by-3 matrix defining ## the colors of each of the markers individually. ## -## The marker to use can be changed with the @var{style} argument, that is a -## string defining a marker in the same manner as the @code{plot} command. -## If the argument 'filled' is given then the markers as filled. All +## The marker to use can be changed with the @var{style} argument, that is a +## string defining a marker in the same manner as the @code{plot} command. +## If the argument 'filled' is given then the markers as filled. All ## additional arguments are passed to the underlying patch command. ## ## The optional return value @var{h} provides a handle to the patch object
--- a/scripts/plot/semilogx.m +++ b/scripts/plot/semilogx.m @@ -36,7 +36,7 @@ [h, varargin, nargs] = __plt_get_axis_arg__ ("semilogx", varargin{:}); if (nargs < 1) - print_usage(); + print_usage(); endif oldh = gca ();
--- a/scripts/plot/semilogxerr.m +++ b/scripts/plot/semilogxerr.m @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} semilogxerr (@var{args}) ## Produce two-dimensional plots using a logarithmic scale for the @var{x} -## axis and errorbars at each data point. Many different combinations of +## axis and errorbars at each data point. Many different combinations of ## arguments are possible. The most used form is ## ## @example @@ -29,7 +29,7 @@ ## @noindent ## which produces a semi-logarithmic plot of @var{y} versus @var{x} ## with errors in the @var{y}-scale defined by @var{ey} and the plot -## format defined by @var{fmt}. See @code{errorbar} for available formats and +## format defined by @var{fmt}. See @code{errorbar} for available formats and ## additional information. ## @seealso{errorbar, loglogerr semilogyerr} ## @end deftypefn
--- a/scripts/plot/semilogy.m +++ b/scripts/plot/semilogy.m @@ -36,7 +36,7 @@ [h, varargin, nargs] = __plt_get_axis_arg__ ("semilogy", varargin{:}); if (nargs < 1) - print_usage(); + print_usage(); endif oldh = gca ();
--- a/scripts/plot/semilogyerr.m +++ b/scripts/plot/semilogyerr.m @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} semilogyerr (@var{args}) ## Produce two-dimensional plots using a logarithmic scale for the @var{y} -## axis and errorbars at each data point. Many different combinations of +## axis and errorbars at each data point. Many different combinations of ## arguments are possible. The most used form is ## ## @example @@ -29,7 +29,7 @@ ## @noindent ## which produces a semi-logarithmic plot of @var{y} versus @var{x} ## with errors in the @var{y}-scale defined by @var{ey} and the plot -## format defined by @var{fmt}. See @code{errorbar} for available formats and +## format defined by @var{fmt}. See @code{errorbar} for available formats and ## additional information. ## @seealso{errorbar, loglogerr semilogxerr} ## @end deftypefn
--- a/scripts/plot/shading.m +++ b/scripts/plot/shading.m @@ -56,7 +56,7 @@ obj = [h1(:); h2(:)]; for n = 1:numel(obj) - h = obj(n); + h = obj(n); if (strcmpi (mode, "flat")) set (h, "facecolor", "flat"); set (h, "edgecolor", "none");
--- a/scripts/plot/slice.m +++ b/scripts/plot/slice.m @@ -23,7 +23,7 @@ ## @deftypefnx {Function File} {} slice (@var{v}, @var{xi}, @var{yi}, @var{zi}) ## @deftypefnx {Function File} {@var{h} =} slice (@dots{}) ## @deftypefnx {Function File} {@var{h} =} slice (@dots{}, @var{method}) -## Plot slices of 3-D data/scalar fields. Each element of the 3-dimensional +## Plot slices of 3-D data/scalar fields. Each element of the 3-dimensional ## array @var{v} represents a scalar value at a location given by the ## parameters @var{x}, @var{y}, and @var{z}. The parameters @var{x}, ## @var{x}, and @var{z} are either 3-dimensional arrays of the same size @@ -33,9 +33,9 @@ ## interpolated using interp3. The vectors @var{sx}, @var{sy}, and ## @var{sz} contain points of orthogonal slices of the respective axes. ## -## If @var{x}, @var{y}, @var{z} are omitted, they are assumed to be +## If @var{x}, @var{y}, @var{z} are omitted, they are assumed to be ## @code{x = 1:size (@var{v}, 2)}, @code{y = 1:size (@var{v}, 1)} and -## @code{z = 1:size (@var{v}, 3)}. +## @code{z = 1:size (@var{v}, 3)}. ## ## @var{Method} is one of: ##
--- a/scripts/plot/specular.m +++ b/scripts/plot/specular.m @@ -20,7 +20,7 @@ ## @deftypefn {Function File} {} specular (@var{sx}, @var{sy}, @var{sz}, @var{lv}, @var{vv}) ## @deftypefnx {Function File} {} specular (@var{sx}, @var{sy}, @var{sz}, @var{lv}, @var{vv}, @var{se}) ## Calculate specular reflection strength of a surface defined by the normal -## vector elements @var{sx}, @var{sy}, @var{sz} using Phong's approximation. +## vector elements @var{sx}, @var{sy}, @var{sz} using Phong's approximation. ## The light and view vectors can be specified using parameter @var{lv} and ## @var{vv} respectively. ## Both can be given as 2-element vectors [azimuth, elevation] in degrees or as @@ -51,7 +51,7 @@ if (!size_equal (sx, sy, sz)) error ("specular: SX, SY, and SZ must have same size"); endif - + ## Check for light vector (lv) argument. if (length (lv) < 2 || length (lv) > 3) error ("specular: light vector LV must be a 2- or 3-element vector"); @@ -81,12 +81,12 @@ ## Calculate specular reflection using Phong's approximation. retval = 2 * l_dot_n .* v_dot_n - dot (lv, vv); - + ## Set zero if light is on the other side. retval(l_dot_n < 0) = 0; ## Allow postive values only. retval(retval < 0) = 0; retval = retval .^ se; - + endfunction
--- a/scripts/plot/sphere.m +++ b/scripts/plot/sphere.m @@ -19,12 +19,12 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {[@var{x}, @var{y}, @var{z}] =} sphere (@var{n}) ## @deftypefnx {Function File} {} sphere (@var{h}, @dots{}) -## Generates three matrices in @code{meshgrid} format, such that -## @code{surf (@var{x}, @var{y}, @var{z})} generates a unit sphere. -## The matrices of @code{@var{n}+1}-by-@code{@var{n}+1}. If @var{n} is +## Generates three matrices in @code{meshgrid} format, such that +## @code{surf (@var{x}, @var{y}, @var{z})} generates a unit sphere. +## The matrices of @code{@var{n}+1}-by-@code{@var{n}+1}. If @var{n} is ## omitted then a default value of 20 is assumed. ## -## Called with no return arguments, @code{sphere} call directly +## Called with no return arguments, @code{sphere} call directly ## @code{surf (@var{x}, @var{y}, @var{z})}. If an axes handle is passed ## as the first argument, the surface is plotted to this set of axes. ## @seealso{peaks} @@ -32,7 +32,7 @@ function [xx, yy, zz] = sphere (varargin) - [h, varargin, nargin] = __plt_get_axis_arg__ ((nargout > 0), "sphere", + [h, varargin, nargin] = __plt_get_axis_arg__ ((nargout > 0), "sphere", varargin{:}); if (nargin > 1) print_usage ();
--- a/scripts/plot/stairs.m +++ b/scripts/plot/stairs.m @@ -150,7 +150,7 @@ break; endif endif - endfor + endfor if (doplot) h = []; @@ -188,12 +188,12 @@ get (tmp, "markersize")); addlistener (hg, "color", @update_props); - addlistener (hg, "linewidth", @update_props); - addlistener (hg, "linestyle", @update_props); - addlistener (hg, "marker", @update_props); - addlistener (hg, "markerfacecolor", @update_props); - addlistener (hg, "markeredgecolor", @update_props); - addlistener (hg, "markersize", @update_props); + addlistener (hg, "linewidth", @update_props); + addlistener (hg, "linestyle", @update_props); + addlistener (hg, "marker", @update_props); + addlistener (hg, "markerfacecolor", @update_props); + addlistener (hg, "markeredgecolor", @update_props); + addlistener (hg, "markersize", @update_props); if (! isempty (args)) set (hg, args{:}); @@ -231,7 +231,7 @@ function update_props (h, d) - set (get (h, "children"), "color", get (h, "color"), + set (get (h, "children"), "color", get (h, "color"), "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle"), "marker", get (h, "marker"),
--- a/scripts/plot/stem.m +++ b/scripts/plot/stem.m @@ -46,7 +46,7 @@ ## ## @noindent ## plots 10 stems with heights from 2 to 20 in red; -## +## ## The return value of @code{stem} is a vector of "stem series" graphics ## handles, with one handle per column of the variable @var{y}. This ## handle regroups the elements of the stem graph together as the
--- a/scripts/plot/stem3.m +++ b/scripts/plot/stem3.m @@ -27,13 +27,13 @@ ## ## @example ## @group -## theta = 0:0.2:6; -## stem3 (cos (theta), sin (theta), theta) +## theta = 0:0.2:6; +## stem3 (cos (theta), sin (theta), theta) ## @end group ## @end example ## ## @noindent -## plots 31 stems with heights from 0 to 6 lying on a circle. Color +## plots 31 stems with heights from 0 to 6 lying on a circle. Color ## definitions with RGB-triples are not valid! ## @seealso{bar, barh, stem, plot} ## @end deftypefn @@ -53,5 +53,5 @@ endfunction %!demo -%! theta = 0:0.2:6; -%! stem3 (cos (theta), sin (theta), theta) +%! theta = 0:0.2:6; +%! stem3 (cos (theta), sin (theta), theta)
--- a/scripts/plot/subplot.m +++ b/scripts/plot/subplot.m @@ -147,7 +147,7 @@ x0 = pos(1); x1 = x0 + pos(3); y0 = pos(2); - y1 = y0 + pos(4); + y1 = y0 + pos(4); objx0 = objpos(1); objx1 = objx0 + objpos(3); objy0 = objpos(2);
--- a/scripts/plot/surface.m +++ b/scripts/plot/surface.m @@ -24,11 +24,11 @@ ## @deftypefnx {Function File} {} surface (@dots{}, @var{prop}, @var{val}) ## @deftypefnx {Function File} {} surface (@var{h}, @dots{}) ## @deftypefnx {Function File} {@var{h} =} surface (@dots{}) -## Plot a surface graphic object given matrices @var{x}, and @var{y} from -## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and +## Plot a surface graphic object given matrices @var{x}, and @var{y} from +## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and ## @var{y} coordinates of the surface. If @var{x} and @var{y} are vectors, -## then a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)). Thus, -## columns of @var{z} correspond to different @var{x} values and rows of +## then a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)). Thus, +## columns of @var{z} correspond to different @var{x} values and rows of ## @var{z} correspond to different @var{y} values. If @var{x} and @var{y} ## are missing, they are constructed from size of the matrix @var{z}. ## @@ -116,7 +116,7 @@ else error ("surface: X and Y must be vectors and Z must be a matrix"); endif - elseif (firststring == 3) + elseif (firststring == 3) z = varargin{1}; c = varargin{2}; if (ismatrix (z) && !isvector (z) && !isscalar (z)) @@ -126,7 +126,7 @@ else error ("surface: Z argument must be a matrix"); endif - elseif (firststring == 2) + elseif (firststring == 2) z = varargin{1}; c = z; if (ismatrix (z) && !isvector (z) && !isscalar (z))
--- a/scripts/plot/surfc.m +++ b/scripts/plot/surfc.m @@ -18,11 +18,11 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} surfc (@var{x}, @var{y}, @var{z}) -## Plot a surface and contour given matrices @var{x}, and @var{y} from -## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and -## @var{y} coordinates of the mesh. If @var{x} and @var{y} are vectors, -## then a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)). Thus, -## columns of @var{z} correspond to different @var{x} values and rows of +## Plot a surface and contour given matrices @var{x}, and @var{y} from +## @code{meshgrid} and a matrix @var{z} corresponding to the @var{x} and +## @var{y} coordinates of the mesh. If @var{x} and @var{y} are vectors, +## then a typical vertex is (@var{x}(j), @var{y}(i), @var{z}(i,j)). Thus, +## columns of @var{z} correspond to different @var{x} values and rows of ## @var{z} correspond to different @var{y} values. ## @seealso{meshgrid, surf, contour} ## @end deftypefn
--- a/scripts/plot/surfl.m +++ b/scripts/plot/surfl.m @@ -37,7 +37,7 @@ ## ## The material properties of the surface can specified using a 4-element vector ## @var{P} = [@var{AM} @var{D} @var{SP} @var{exp}] which defaults to -## @var{p} = [0.55 0.6 0.4 10]. +## @var{p} = [0.55 0.6 0.4 10]. ## @table @code ## @item "AM" strength of ambient light ## @@ -47,7 +47,7 @@ ## ## @item "EXP" specular exponent ## @end table -## +## ## The default lighting mode "cdata", changes the cdata property to give the ## impression ## of a lighted surface. Please note: the alternative "light" mode, which @@ -98,7 +98,7 @@ ## r = [ambient light strength, ## diffuse reflection strength, ## specular reflection strength, - ## specular shine] + ## specular shine] if (length (varargin{end}) == 4 && isnumeric (varargin{end})) r = varargin{end}; varargin(end) = []; @@ -122,7 +122,7 @@ have_lv = true; endif endif - + tmp = surface (varargin{:}); if (! ishold ()) set (h, "view", [-37.5, 30], @@ -160,7 +160,7 @@ + r(3) * specular (vn(:,:,1), vn(:,:,2), vn(:,:,3), lv, vv, r(4))); set (tmp, "cdata", cdata ./ sum (r(1:3))); - + unwind_protect_cleanup axes (oldh); end_unwind_protect
--- a/scripts/plot/surfnorm.m +++ b/scripts/plot/surfnorm.m @@ -21,26 +21,26 @@ ## @deftypefnx {Function File} {} surfnorm (@var{z}) ## @deftypefnx {Function File} {[@var{nx}, @var{ny}, @var{nz}] =} surfnorm (@dots{}) ## @deftypefnx {Function File} {} surfnorm (@var{h}, @dots{}) -## Find the vectors normal to a meshgridded surface. The meshed gridded -## surface is defined by @var{x}, @var{y}, and @var{z}. If @var{x} and +## Find the vectors normal to a meshgridded surface. The meshed gridded +## surface is defined by @var{x}, @var{y}, and @var{z}. If @var{x} and ## @var{y} are not defined, then it is assumed that they are given by ## ## @example ## @group -## [@var{x}, @var{y}] = meshgrid (1:size(@var{z}, 1), +## [@var{x}, @var{y}] = meshgrid (1:size(@var{z}, 1), ## 1:size(@var{z}, 2)); ## @end group ## @end example ## -## If no return arguments are requested, a surface plot with the normal +## If no return arguments are requested, a surface plot with the normal ## vectors to the surface is plotted. Otherwise the components of the normal ## vectors at the mesh gridded points are returned in @var{nx}, @var{ny}, ## and @var{nz}. ## -## The normal vectors are calculated by taking the cross product of the -## diagonals of each of the quadrilaterals in the meshgrid to find the +## The normal vectors are calculated by taking the cross product of the +## diagonals of each of the quadrilaterals in the meshgrid to find the ## normal vectors of the centers of these quadrilaterals. The four nearest -## normal vectors to the meshgrid points are then averaged to obtain the +## normal vectors to the meshgrid points are then averaged to obtain the ## normal to the surface at the meshgridded points. ## ## An example of the use of @code{surfnorm} is @@ -53,7 +53,7 @@ function [Nx, Ny, Nz] = surfnorm (varargin) - [h, varargin, nargin] = __plt_get_axis_arg__ ((nargout != 0), "surfnorm", + [h, varargin, nargin] = __plt_get_axis_arg__ ((nargout != 0), "surfnorm", varargin{:}); if (nargin != 1 && nargin != 3) @@ -76,7 +76,7 @@ endif if (! size_equal (x, y, z)) error ("surfnorm: X, Y, and Z must have the same dimensions"); - endif + endif ## Make life easier, and avoid having to do the extrapolation later, do ## a simpler linear extrapolation here. This is approximative, and works @@ -102,11 +102,11 @@ ## Create normal vectors as mesh vectices from normals at mesh centers nx = (w.x(1:end-1,1:end-1) + w.x(1:end-1,2:end) + - w.x(2:end,1:end-1) + w.x(2:end,2:end)) ./ 4; + w.x(2:end,1:end-1) + w.x(2:end,2:end)) ./ 4; ny = (w.y(1:end-1,1:end-1) + w.y(1:end-1,2:end) + - w.y(2:end,1:end-1) + w.y(2:end,2:end)) ./ 4; + w.y(2:end,1:end-1) + w.y(2:end,2:end)) ./ 4; nz = (w.z(1:end-1,1:end-1) + w.z(1:end-1,2:end) + - w.z(2:end,1:end-1) + w.z(2:end,2:end)) ./ 4; + w.z(2:end,1:end-1) + w.z(2:end,2:end)) ./ 4; ## Normalize the normal vectors len = sqrt (nx.^2 + ny.^2 + nz.^2); @@ -125,7 +125,7 @@ set (h, "nextplot", "add"); plot3 ([x(:)'; x(:).' + nx(:).' ; NaN(size(x(:).'))](:), [y(:)'; y(:).' + ny(:).' ; NaN(size(y(:).'))](:), - [z(:)'; z(:).' + nz(:).' ; NaN(size(z(:).'))](:), + [z(:)'; z(:).' + nz(:).' ; NaN(size(z(:).'))](:), varargin{ioff:end}); unwind_protect_cleanup set (h, "nextplot", old_hold_state);
--- a/scripts/plot/uigetdir.m +++ b/scripts/plot/uigetdir.m @@ -36,7 +36,7 @@ if (!ischar(init_path) || !ischar(dialog_name)) error ("uigetdir: INIT_PATH and DIALOG_NAME must be string arguments"); endif - + if (any (strcmp (available_graphics_toolkits (), "fltk"))) if (!isdir (init_path)) init_path = fileparts (init_path);
--- a/scripts/plot/uigetfile.m +++ b/scripts/plot/uigetfile.m @@ -51,9 +51,9 @@ ## @end table ## ## @var{dialog_name} can be used to customize the dialog title. -## If @var{default_file} is given it is selected in the GUI dialog. +## If @var{default_file} is given it is selected in the GUI dialog. ## If in addtion a path is given it is also used as current path. -## +## ## The screen position of the GUI dialog can be set using the "Position" key ## and a 2-element vector containing the pixel coordinates. ## Two or more files can be selected when setting the "Multiselect" key to "on". @@ -109,7 +109,7 @@ outargs{3} = file_filter; endif endif - + if (len > 1) outargs{2} = args{2}; endif @@ -158,5 +158,5 @@ endfunction -%!demo +%!demo %! uigetfile({"*.gif;*.png;*.jpg", "Supported Picture Formats"})
--- a/scripts/plot/uimenu.m +++ b/scripts/plot/uimenu.m @@ -22,7 +22,7 @@ ## Create an uimenu object and return a handle to it. If @var{h} is ommited ## then a top level menu entry for the current figure is created. If @var{h} ## is given then a submenu relative to @var{h} is created. -## +## ## Uimenu objects have the following specific properties: ## ## @table @code @@ -31,7 +31,7 @@ ## menu entry (e.g., "x" for CTRL+x). ## ## @item "callback" -## Is the function called when this menu entry is executed. It can be either a +## Is the function called when this menu entry is executed. It can be either a ## function string (e.g., "myfun"), a function handle (e.g., @@myfun) or a cell ## array containing the function handle and arguments for the callback ## function (e.g., @{@@myfun, arg1, arg2@}). @@ -42,7 +42,7 @@ ## @item "enable" ## Can be set "on" or "off". If disabled the menu entry cannot be selected ## and it is grayed out. -## +## ## @item "foregroundcolor" ## A color value setting the text color for this menu entry. ##
--- a/scripts/plot/uiputfile.m +++ b/scripts/plot/uiputfile.m @@ -26,14 +26,14 @@ ## ## @table @code ## @item "/path/to/filename.ext" -## If a filename is given the file extension is +## If a filename is given the file extension is ## extracted and used as filter. ## In addtion the path is selected as current path and the filname is selected ## as default file. ## Example: uiputfile("myfun.m"); ## ## @item "*.ext" -## A single file extension. +## A single file extension. ## Example: uiputfile("*.ext"); ## ## @item @{"*.ext","My Description"@} @@ -41,13 +41,13 @@ ## a brief description in the 2nd column. ## Example: uiputfile(@{"*.ext","My Description";"*.xyz","XYZ-Format"@}); ## @end table -## +## ## The filter string can also contain a semicolon separated list of filter ## extensions. ## Example: uiputfile(@{"*.gif;*.png;*.jpg", "Supported Picture Formats"@}); ## ## @var{dialog_name} can be used to customize the dialog title. -## If @var{default_file} is given it is preselected in the GUI dialog. +## If @var{default_file} is given it is preselected in the GUI dialog. ## If in addtion a path is given it is also used as current path. ## @end deftypefn
--- a/scripts/plot/view.m +++ b/scripts/plot/view.m @@ -23,11 +23,11 @@ ## @deftypefnx {Function File} {} view ([@var{x}, @var{y}, @var{z}]) ## @deftypefnx {Function File} {} view (@var{dims}) ## @deftypefnx {Function File} {} view (@var{ax}, @dots{}) -## Query or set set the viewpoint for the current axes. The parameters +## Query or set set the viewpoint for the current axes. The parameters ## @var{azimuth} and @var{elevation} can be given as two arguments or as -## 2-element vector. -## The viewpoint can also be given with Cartesian coordinates @var{x}, -## @var{y}, and @var{z}. +## 2-element vector. +## The viewpoint can also be given with Cartesian coordinates @var{x}, +## @var{y}, and @var{z}. ## The call @code{view (2)} sets the viewpoint to @var{azimuth} = 0 ## and @var{elevation} = 90, which is the default for 2-D graphs. ## The call @code{view (3)} sets the viewpoint to @var{azimuth} = -37.5
--- a/scripts/plot/waitforbuttonpress.m +++ b/scripts/plot/waitforbuttonpress.m @@ -37,9 +37,9 @@ [x, y, k] = ginput (1); if (nargout == 1) - if (k <= 5) + if (k <= 5) a = 0; - else + else a = 1; endif endif
--- a/scripts/plot/whitebg.m +++ b/scripts/plot/whitebg.m @@ -27,7 +27,7 @@ ## If defined, @var{fig} is the handle to the figure to be inverted. In ## this case only this figure has its color properties changed ## -## The background colors of the figure and its children can be set +## The background colors of the figure and its children can be set ## specifically if @var{color} is defined. @var{color} must be a valid ## color set as a string or an RGB triplet, or the value "none". ## @@ -94,7 +94,7 @@ children = []; for n = 1 : numel (handles) children = union (children, get(handles(n), "children")); - endfor + endfor handles = children; h = union (h, children); endwhile @@ -134,7 +134,7 @@ set (findall (fig, "type", "axes"), "color", color); if (isroot) defs = get (0, "defaults"); - if (isfield (defs, "defaultaxescolor") + if (isfield (defs, "defaultaxescolor") && strcmp (defs.defaultaxescolor, "none")) set (0, "defaultaxescolor", color); endif
--- a/scripts/plot/xlim.m +++ b/scripts/plot/xlim.m @@ -28,8 +28,8 @@ ## to this value. ## ## The current mode for calculation of the x-axis can be returned with a -## call @code{xlim ('mode')}, and can be either 'auto' or 'manual'. The -## current plotting mode can be set by passing either 'auto' or 'manual' +## call @code{xlim ('mode')}, and can be either 'auto' or 'manual'. The +## current plotting mode can be set by passing either 'auto' or 'manual' ## as the argument. ## ## If passed a handle as the first argument, then operate on this handle
--- a/scripts/plot/ylim.m +++ b/scripts/plot/ylim.m @@ -28,8 +28,8 @@ ## to this value. ## ## The current mode for calculation of the y-axis can be returned with a -## call @code{ylim ('mode')}, and can be either 'auto' or 'manual'. The -## current plotting mode can be set by passing either 'auto' or 'manual' +## call @code{ylim ('mode')}, and can be either 'auto' or 'manual'. The +## current plotting mode can be set by passing either 'auto' or 'manual' ## as the argument. ## ## If passed a handle as the first argument, then operate on this handle
--- a/scripts/plot/zlim.m +++ b/scripts/plot/zlim.m @@ -28,8 +28,8 @@ ## to this value. ## ## The current mode for calculation of the z-axis can be returned with a -## call @code{zlim ('mode')}, and can be either 'auto' or 'manual'. The -## current plotting mode can be set by passing either 'auto' or 'manual' +## call @code{zlim ('mode')}, and can be either 'auto' or 'manual'. The +## current plotting mode can be set by passing either 'auto' or 'manual' ## as the argument. ## ## If passed a handle as the first argument, then operate on this handle
--- a/scripts/polynomial/mkpp.m +++ b/scripts/polynomial/mkpp.m @@ -19,13 +19,13 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{pp} =} mkpp (@var{x}, @var{p}) ## @deftypefnx {Function File} {@var{pp} =} mkpp (@var{x}, @var{p}, @var{d}) -## +## ## Construct a piecewise polynomial structure from sample points ## @var{x} and coefficients @var{p}. The i-th row of @var{p}, ## @code{@var{p} (@var{i},:)}, contains the coefficients for the polynomial -## over the @var{i}-th interval, ordered from highest to -## lowest. There must be one row for each interval in @var{x}, so -## @code{rows (@var{p}) == length (@var{x}) - 1}. +## over the @var{i}-th interval, ordered from highest to +## lowest. There must be one row for each interval in @var{x}, so +## @code{rows (@var{p}) == length (@var{x}) - 1}. ## ## @var{p} may also be a multi-dimensional array, specifying a vector-valued ## or array-valued polynomial. The shape is determined by @var{d}. If @var{d} @@ -64,9 +64,9 @@ endfunction %!demo # linear interpolation -%! x=linspace(0,pi,5)'; +%! x=linspace(0,pi,5)'; %! t=[sin(x),cos(x)]; -%! m=diff(t)./(x(2)-x(1)); +%! m=diff(t)./(x(2)-x(1)); %! b=t(1:4,:); %! pp = mkpp(x, [m(:),b(:)]); %! xi=linspace(0,pi,50);
--- a/scripts/polynomial/mpoles.m +++ b/scripts/polynomial/mpoles.m @@ -22,7 +22,7 @@ ## @deftypefnx {Function File} {[@var{multp}, @var{indx}] =} mpoles (@var{p}, @var{tol}, @var{reorder}) ## Identify unique poles in @var{p} and associates their multiplicity, ## ordering them from largest to smallest. -## +## ## If the relative difference of the poles is less than @var{tol}, then ## they are considered to be multiples. The default value for @var{tol} ## is 0.001.
--- a/scripts/polynomial/pchip.m +++ b/scripts/polynomial/pchip.m @@ -37,7 +37,7 @@ ## @code{[@var{s1}, @var{s2}, @dots{}, @var{sk}, @var{n}]} ## @end ifnottex ## The array is then reshaped internally to a matrix where the leading -## dimension is given by +## dimension is given by ## @tex ## $$s_1 s_2 \cdots s_k$$ ## @end tex @@ -48,7 +48,7 @@ ## is exactly the opposite treatment than @code{interp1} and is done ## for compatibility. ## -## Called with a third input argument, @code{pchip} evaluates the +## Called with a third input argument, @code{pchip} evaluates the ## piecewise polynomial at the points @var{xi}. There is an equivalence ## between @code{ppval (pchip (@var{x}, @var{y}), @var{xi})} and ## @code{pchip (@var{x}, @var{y}, @var{xi})}. @@ -105,7 +105,7 @@ d1 = d(:,1:n-1); d2 = d(:,2:n); - ## This is taken from SLATEC. + ## This is taken from SLATEC. h = diag (h); delta = diff (y, 1, 2) / h; @@ -127,9 +127,9 @@ endfunction %!demo -%! x = 0:8; +%! x = 0:8; %! y = [1, 1, 1, 1, 0.5, 0, 0, 0, 0]; -%! xi = 0:0.01:8; +%! xi = 0:0.01:8; %! yspline = spline(x,y,xi); %! ypchip = pchip(x,y,xi); %! title("pchip and spline fit to discontinuous function"); @@ -139,7 +139,7 @@ %! % confirm that pchip agreed better to discontinuous data than spline %!shared x,y -%! x = 0:8; +%! x = 0:8; %! y = [1, 1, 1, 1, 0.5, 0, 0, 0, 0]; %!assert (pchip(x,y,x), y); %!assert (pchip(x,y,x'), y');
--- a/scripts/polynomial/poly.m +++ b/scripts/polynomial/poly.m @@ -21,8 +21,8 @@ ## @deftypefnx {Function File} {} poly (@var{x}) ## If @var{A} is a square @math{N}-by-@math{N} matrix, @code{poly (@var{A})} ## is the row vector of the coefficients of @code{det (z * eye (N) - A)}, -## the characteristic polynomial of @var{A}. For example, -## the following code finds the eigenvalues of @var{A} which are the roots of +## the characteristic polynomial of @var{A}. For example, +## the following code finds the eigenvalues of @var{A} which are the roots of ## @code{poly (@var{A})}. ## ## @example @@ -34,13 +34,13 @@ ## @end group ## @end example ## -## In fact, all three eigenvalues are exactly 1 which emphasizes that for +## In fact, all three eigenvalues are exactly 1 which emphasizes that for ## numerical performance the @code{eig} function should be used to compute ## eigenvalues. ## ## If @var{x} is a vector, @code{poly (@var{x})} is a vector of the coefficients ## of the polynomial whose roots are the elements of @var{x}. That is, -## if @var{c} is a polynomial, then the elements of +## if @var{c} is a polynomial, then the elements of ## @code{@var{d} = roots (poly (@var{c}))} are contained in @var{c}. ## The vectors @var{c} and @var{d} are not identical, however, due to sorting ## and numerical errors.
--- a/scripts/polynomial/polyaffine.m +++ b/scripts/polynomial/polyaffine.m @@ -26,7 +26,7 @@ ## @example ## g(x) = f((x-@var{mu}(1))/@var{mu}(2)). ## @end example -## +## ## @seealso{polyval} ## @end deftypefn
--- a/scripts/polynomial/polyderiv.m +++ b/scripts/polynomial/polyderiv.m @@ -23,8 +23,8 @@ ## Return the coefficients of the derivative of the polynomial whose ## coefficients are given by the vector @var{p}. If a pair of polynomials ## is given, return the derivative of the product @math{@var{a}*@var{b}}. -## If two inputs and two outputs are given, return the derivative of the -## polynomial quotient @math{@var{b}/@var{a}}. The quotient numerator is +## If two inputs and two outputs are given, return the derivative of the +## polynomial quotient @math{@var{b}/@var{a}}. The quotient numerator is ## in @var{q} and the denominator in @var{d}. ## @seealso{poly, polyint, polyreduce, roots, conv, deconv, residue, ## filter, polygcd, polyval, polyvalm} @@ -44,7 +44,7 @@ if (! isvector (a)) error ("polyderiv: argument must be a vector"); endif - if (nargout == 1) + if (nargout == 1) ## derivative of p*a returns a single polynomial q = polyderiv (conv (p, a)); else
--- a/scripts/polynomial/polyfit.m +++ b/scripts/polynomial/polyfit.m @@ -44,10 +44,10 @@ ## The values of the polynomial for each value of @var{x}. ## @end table ## -## The second output may be used by @code{polyval} to calculate the +## The second output may be used by @code{polyval} to calculate the ## statistical error limits of the predicted values. ## -## When the third output, @var{mu}, is present the +## When the third output, @var{mu}, is present the ## coefficients, @var{p}, are associated with a polynomial in ## @var{xhat} = (@var{x}-@var{mu}(1))/@var{mu}(2). ## Where @var{mu}(1) = mean (@var{x}), and @var{mu}(2) = std (@var{x}).
--- a/scripts/polynomial/polyreduce.m +++ b/scripts/polynomial/polyreduce.m @@ -43,9 +43,9 @@ index = find (c != 0); if (isempty (index)) - + p = 0; - + else p = c(index (1):length (c));
--- a/scripts/polynomial/polyval.m +++ b/scripts/polynomial/polyval.m @@ -19,14 +19,14 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{y} =} polyval (@var{p}, @var{x}) ## @deftypefnx {Function File} {@var{y} =} polyval (@var{p}, @var{x}, [], @var{mu}) -## Evaluate the polynomial @var{p} at the specified values of @var{x}. When -## @var{mu} is present evaluate the polynomial for +## Evaluate the polynomial @var{p} at the specified values of @var{x}. When +## @var{mu} is present evaluate the polynomial for ## (@var{x}-@var{mu}(1))/@var{mu}(2). ## If @var{x} is a vector or matrix, the polynomial is evaluated for each of ## the elements of @var{x}. ## @deftypefnx {Function File} {[@var{y}, @var{dy}] =} polyval (@var{p}, @var{x}, @var{s}) ## @deftypefnx {Function File} {[@var{y}, @var{dy}] =} polyval (@var{p}, @var{x}, @var{s}, @var{mu}) -## In addition to evaluating the polynomial, the second output +## In addition to evaluating the polynomial, the second output ## represents the prediction interval, @var{y} +/- @var{dy}, which ## contains at least 50% of the future predictions. To calculate the ## prediction interval, the structured variable @var{s}, originating
--- a/scripts/polynomial/ppder.m +++ b/scripts/polynomial/ppder.m @@ -1,17 +1,17 @@ ## Copyright (C) 2008-2011 VZLU Prague, a.s., Czech Republic -## +## ## 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. -## +## ## This program 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 this software; see the file COPYING. If not, see ## <http://www.gnu.org/licenses/>.
--- a/scripts/polynomial/ppint.m +++ b/scripts/polynomial/ppint.m @@ -1,17 +1,17 @@ ## Copyright (C) 2008-2011 VZLU Prague, a.s., Czech Republic -## +## ## 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. -## +## ## This program 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 this software; see the file COPYING. If not, see ## <http://www.gnu.org/licenses/>. @@ -34,7 +34,7 @@ [x, p, n, k, d] = unmkpp (pp); p = reshape (p, [], k); - + ## Get piecewise antiderivatives pi = p / diag (k:-1:1); k += 1;
--- a/scripts/polynomial/ppjumps.m +++ b/scripts/polynomial/ppjumps.m @@ -1,17 +1,17 @@ ## Copyright (C) 2008-2011 VZLU Prague, a.s., Czech Republic -## +## ## 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. -## +## ## This program 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 this software; see the file COPYING. If not, see ## <http://www.gnu.org/licenses/>.
--- a/scripts/polynomial/ppval.m +++ b/scripts/polynomial/ppval.m @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{yi} =} ppval (@var{pp}, @var{xi}) -## Evaluate piecewise polynomial @var{pp} at the points @var{xi}. +## Evaluate piecewise polynomial @var{pp} at the points @var{xi}. ## If @var{pp} is scalar-valued, the result is an array of the same shape as ## @var{xi}. ## Otherwise, the size of the result is @code{[pp.d, length(@var{xi})]} if @@ -28,7 +28,7 @@ ## @code{[pp.d, length(@var{xi})]} and @code{[pp.d, size(@var{xi})]} ## respectively. ## @seealso{mkpp, unmkpp, spline} -## @end deftypefn +## @end deftypefn function yi = ppval (pp, xi)
--- a/scripts/polynomial/residue.m +++ b/scripts/polynomial/residue.m @@ -196,7 +196,7 @@ p = p (indx); ## For each group of pole multiplicity, set the value of each - ## pole to the average of the group. This reduces the error in + ## pole to the average of the group. This reduces the error in ## the resulting poles. p_group = cumsum (e == 1); @@ -284,7 +284,7 @@ if (nargin < 3) k = []; endif - + if numel (e) indx = 1:numel(p); else
--- a/scripts/polynomial/roots.m +++ b/scripts/polynomial/roots.m @@ -128,11 +128,11 @@ %!assert(isempty (roots ([]))); %!error roots ([1, 2; 3, 4]); - + %!assert(isempty (roots (1))); %!error roots ([1, 2; 3, 4]); - + %!error roots ([1 Inf 1]); %!error roots ([1 NaN 1]);
--- a/scripts/polynomial/spline.m +++ b/scripts/polynomial/spline.m @@ -21,11 +21,11 @@ ## @deftypefn {Function File} {@var{pp} =} spline (@var{x}, @var{y}) ## @deftypefnx {Function File} {@var{yi} =} spline (@var{x}, @var{y}, @var{xi}) ## -## Return the cubic spline interpolant of @var{y} at points @var{x}. +## Return the cubic spline interpolant of @var{y} at points @var{x}. ## If called with two arguments, @code{spline} returns the piecewise ## polynomial @var{pp} that may later be used with @code{ppval} to ## evaluate the polynomial at specific points. -## If called with a third input argument, @code{spline} evaluates the +## If called with a third input argument, @code{spline} evaluates the ## spline at the points @var{xi}. There is an equivalence ## between @code{ppval (spline (@var{x}, @var{y}), @var{xi})} and ## @code{spline (@var{x}, @var{y}, @var{xi})}. @@ -53,7 +53,7 @@ ## @code{[@var{s1}, @var{s2}, @dots{}, @var{sk}, @var{n} + 2]}. ## @end ifnottex ## The array is then reshaped internally to a matrix where the leading -## dimension is given by +## dimension is given by ## @tex ## $$s_1 s_2 \cdots s_k$$ ## @end tex @@ -77,7 +77,7 @@ x = x(:); n = length (x); if (n < 3) - error ("spline: requires at least 3 points"); + error ("spline: requires at least 3 points"); endif ## Check the size and shape of y @@ -93,12 +93,12 @@ else a = reshape (y, [prod(szy(1:end-1)), szy(end)]).'; endif - - for k = (1:columns (a))(any (isnan (a))) - ok = ! isnan (a(:,k)); - a(!ok,k) = spline (x(ok), a(ok,k), x(!ok)); - endfor - + + for k = (1:columns (a))(any (isnan (a))) + ok = ! isnan (a(:,k)); + a(!ok,k) = spline (x(ok), a(ok,k), x(!ok)); + endfor + complete = false; if (size (a, 1) == n + 2) complete = true;
--- a/scripts/polynomial/unmkpp.m +++ b/scripts/polynomial/unmkpp.m @@ -30,7 +30,7 @@ ## Polynomial coefficients for points in sample interval. @code{@var{p} ## (@var{i}, :)} contains the coefficients for the polynomial over ## interval @var{i} ordered from highest to lowest. If @code{@var{d} > -## 1}, @code{@var{p} (@var{r}, @var{i}, :)} contains the coefficients for +## 1}, @code{@var{p} (@var{r}, @var{i}, :)} contains the coefficients for ## the r-th polynomial defined on interval @var{i}. ## ## @item @var{n}
--- a/scripts/set/ismember.m +++ b/scripts/set/ismember.m @@ -18,13 +18,13 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {@var{tf} =} ismember (@var{A}, @var{s}) -## @deftypefnx {Function File} {[@var{tf}, @var{S_idx}] =} ismember (@var{A}, @var{s}) +## @deftypefn {Function File} {@var{tf} =} ismember (@var{A}, @var{s}) +## @deftypefnx {Function File} {[@var{tf}, @var{S_idx}] =} ismember (@var{A}, @var{s}) ## @deftypefnx {Function File} {[@var{tf}, @var{S_idx}] =} ismember (@var{A}, @var{s}, "rows") -## Return a logical matrix @var{tf} with the same shape as @var{A} which is +## Return a logical matrix @var{tf} with the same shape as @var{A} which is ## true (1) if @code{A(i,j)} is in @var{s} and false (0) if it is not. If a ## second output argument is requested, the index into @var{s} of each of the -## matching elements is also returned. +## matching elements is also returned. ## ## @example ## @group @@ -48,7 +48,7 @@ ## @end group ## @end example ## -## With the optional third argument @code{"rows"}, and matrices +## With the optional third argument @code{"rows"}, and matrices ## @var{A} and @var{s} with the same number of columns, compare rows in ## @var{A} with the rows in @var{s}. ## @@ -71,7 +71,7 @@ ## Adapted-by: jwe ## Reimplemented using lookup & unique: Jaroslav Hajek <highegg@gmail.com> -function [tf, a_idx] = ismember (A, s, varargin) +function [tf, a_idx] = ismember (A, s, varargin) if (nargin < 2 || nargin > 3) print_usage (); @@ -92,7 +92,7 @@ if (isreal (s) && ! isempty (s) && isnan (s(end))) s = s(1:end - sum (isnan (s))); endif - + if (nargout > 1) a_idx = lookup (s, A, "m"); tf = logical (a_idx);
--- a/scripts/set/private/validargs.m +++ b/scripts/set/private/validargs.m @@ -32,14 +32,14 @@ error ("%s: cell array of strings cannot be combined with a nonstring value", caller); endif elseif (! (ismatrix (x) && ismatrix (y))) - error ("%s: input arguments must be arrays or cell arrays of strings", caller); + error ("%s: input arguments must be arrays or cell arrays of strings", caller); endif elseif (nargin == 4) if (strcmpi (byrows_arg, "rows")) if (iscell (x) || iscell (y)) error ("%s: cells not supported with ""rows"""); elseif (! (ismatrix (x) && ismatrix (y))) - error ("%s: input arguments must be arrays or cell arrays of strings", caller); + error ("%s: input arguments must be arrays or cell arrays of strings", caller); else if (ndims (x) > 2 || ndims (y) > 2) error ("%s: need 2-dimensional matrices for ""rows""", caller);
--- a/scripts/set/setdiff.m +++ b/scripts/set/setdiff.m @@ -87,9 +87,9 @@ endif endif endif - + endfunction - + %!assert(setdiff(["bb";"zz";"bb";"zz"],["bb";"cc";"bb"],"rows"), "zz") %!assert(setdiff(["b";"z";"b";"z"],["b";"c";"b"],"rows"), "z") %!assert(setdiff(["b";"z";"b";"z"],["b";"c";"b"]), "z")
--- a/scripts/set/setxor.m +++ b/scripts/set/setxor.m @@ -31,7 +31,7 @@ ## Return index vectors @var{ia} and @var{ib} such that @code{a(ia)} and ## @code{b(ib)} are ## disjoint sets whose union is @var{c}. -## +## ## @seealso{unique, union, intersect, setdiff, ismember} ## @end deftypefn @@ -72,7 +72,7 @@ [c, i] = sort ([a(:); b(:)]); n = length (c); if (iscell (c)) - idx = find (strcmp (c(1:n-1), c(2:n))); + idx = find (strcmp (c(1:n-1), c(2:n))); else idx = find (c(1:n-1) == c(2:n)); endif
--- a/scripts/set/union.m +++ b/scripts/set/union.m @@ -49,7 +49,7 @@ ## Return index vectors @var{ia} and @var{ib} such that @code{a(ia)} and ## @code{b(ib)} are ## disjoint sets whose union is @var{c}. -## +## ## @seealso{intersect, setdiff, unique} ## @end deftypefn
--- a/scripts/set/unique.m +++ b/scripts/set/unique.m @@ -25,7 +25,7 @@ ## @deftypefnx {Function File} {[@var{y}, @var{i}, @var{j}] =} unique (@dots{}) ## Return the unique elements of @var{x}, sorted in ascending order. ## If the input @var{x} is a vector then the output is also a vector with the -## same orientation (row or column) as the input. For a matrix input the +## same orientation (row or column) as the input. For a matrix input the ## output is always a column vector. @var{x} may also be a cell array of ## strings. ## @@ -36,7 +36,7 @@ ## @code{x(i)==y} and @code{y(j)==x}. ## ## Additionally, if @var{i} is a requested output then one of @code{"first"} or -## @code{"last"} may be given as an input. If @code{"last"} is specified, +## @code{"last"} may be given as an input. If @code{"last"} is specified, ## return the highest possible indices in @var{i}, otherwise, if @code{"first"} ## is specified, return the lowest. The default is @code{"last"}. ## @seealso{union, intersect, setdiff, setxor, ismember} @@ -83,7 +83,7 @@ ## sparse array as long as we are not operating on rows. if (issparse (x) && ! optrows && nargout <= 1) - if (nnz (x) < numel (x)) + if (nnz (x) < numel (x)) y = unique ([0; (full (nonzeros (x)))], varargin{:}); else ## Corner case where sparse matrix is actually full
--- a/scripts/signal/arma_rnd.m +++ b/scripts/signal/arma_rnd.m @@ -35,7 +35,7 @@ ## The optional parameter @var{n} gives the number of dummy ## @var{x}(@var{i}) used for initialization, i.e., a sequence of length ## @var{t}+@var{n} is generated and @var{x}(@var{n}+1:@var{t}+@var{n}) -## is returned. If @var{n} is omitted, @var{n} = 100 is used. +## is returned. If @var{n} is omitted, @var{n} = 100 is used. ## @end deftypefn ## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at>
--- a/scripts/signal/fftconv.m +++ b/scripts/signal/fftconv.m @@ -20,7 +20,7 @@ ## @deftypefn {Function File} {} fftconv (@var{x}, @var{y}) ## @deftypefnx {Function File} {} fftconv (@var{x}, @var{y}, @var{n}) ## Convolve two vectors using the FFT for computation. -## +## ## @code{c = fftconv (@var{x}, @var{y})} returns a vector of length equal to ## @code{length (@var{x}) + length (@var{y}) - 1}. ## If @var{x} and @var{y} are the coefficient vectors of two polynomials, the @@ -103,4 +103,4 @@ %!error fftconv (1,2,3,4); %!error fftconv ([1, 2; 3, 4], 3); %!error fftconv (2, []); -%!error fftconv ([1,1], [2,2] , [3, 4]); +%!error fftconv ([1,1], [2,2] , [3, 4]);
--- a/scripts/signal/fftshift.m +++ b/scripts/signal/fftshift.m @@ -31,7 +31,7 @@ ## f = ((1:N) - ceil(N/2)) / N / Dt ## @end example ## -## If @var{x} is a matrix, the same holds for rows and columns. If +## 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. ## ## The optional @var{dim} argument can be used to limit the dimension
--- a/scripts/signal/filter2.m +++ b/scripts/signal/filter2.m @@ -21,7 +21,7 @@ ## @deftypefnx {Function File} {@var{y} =} filter2 (@var{b}, @var{x}, @var{shape}) ## Apply the 2-D FIR filter @var{b} to @var{x}. If the argument ## @var{shape} is specified, return an array of the desired shape. -## Possible values are: +## Possible values are: ## ## @table @asis ## @item 'full' @@ -40,7 +40,7 @@ ## @end deftypefn ## Author: Paul Kienzle <pkienzle@users.sf.net> -## 2001-02-08 +## 2001-02-08 ## * initial release function y = filter2 (b, x, shape)
--- a/scripts/signal/freqz.m +++ b/scripts/signal/freqz.m @@ -55,7 +55,7 @@ ## ## @deftypefnx {Function File} {[@dots{}] =} freqz (@dots{}, @var{Fs}) ## Return frequencies in Hz instead of radians assuming a sampling rate -## @var{Fs}. If you are evaluating the response at specific frequencies +## @var{Fs}. If you are evaluating the response at specific frequencies ## @var{w}, those frequencies should be requested in Hz rather than radians. ## ## @deftypefnx {Function File} {} freqz (@dots{}) @@ -80,7 +80,7 @@ elseif (nargin == 4) Fs = []; if (! ischar (region) && ! isempty (region)) - Fs = region; + Fs = region; region = []; endif endif @@ -88,11 +88,11 @@ if (isempty (b)) b = 1; endif - if (isempty (a)) - a = 1; + if (isempty (a)) + a = 1; endif if (isempty (n)) - n = 512; + n = 512; endif if (isempty (region)) if (isreal (b) && isreal (a)) @@ -101,11 +101,11 @@ region = "whole"; endif endif - if (isempty (Fs)) - if (nargout == 0) - Fs = 2; - else - Fs = 2*pi; + if (isempty (Fs)) + if (nargout == 0) + Fs = 2; + else + Fs = 2*pi; endif endif
--- a/scripts/signal/ifftshift.m +++ b/scripts/signal/ifftshift.m @@ -19,8 +19,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} ifftshift (@var{x}) ## @deftypefnx {Function File} {} ifftshift (@var{x}, @var{dim}) -## Undo the action of the @code{fftshift} function. For even length -## @var{x}, @code{fftshift} is its own inverse, but odd lengths differ +## Undo the action of the @code{fftshift} function. For even length +## @var{x}, @code{fftshift} is its own inverse, but odd lengths differ ## slightly. ## @end deftypefn
--- a/scripts/signal/unwrap.m +++ b/scripts/signal/unwrap.m @@ -20,7 +20,7 @@ ## @deftypefn {Function File} {@var{b} =} unwrap (@var{x}) ## @deftypefnx {Function File} {@var{b} =} unwrap (@var{x}, @var{tol}) ## @deftypefnx {Function File} {@var{b} =} unwrap (@var{x}, @var{tol}, @var{dim}) -## +## ## Unwrap radian phases by adding multiples of 2*pi as appropriate to ## remove jumps greater than @var{tol}. @var{tol} defaults to pi. ## @@ -31,7 +31,7 @@ ## Author: Bill Lash <lash@tellabs.com> function retval = unwrap (x, tol, dim) - + if (nargin < 1 || nargin > 3) print_usage (); endif @@ -67,9 +67,9 @@ ## Handle case where we are trying to unwrap a scalar, or only have ## one sample in the specified dimension. - if (m == 1) - retval = x; - return; + if (m == 1) + retval = x; + return; endif ## Take first order difference to see so that wraps will show up @@ -112,26 +112,26 @@ %! endif %! %!test -%! +%! %! i = 0; %! t = []; -%! +%! %! r = [0:100]; # original vector %! w = r - 2*pi*floor((r+pi)/(2*pi)); # wrapped into [-pi,pi] %! tol = 1e3*eps; # maximum expected deviation -%! +%! %! t(++i) = xassert(r, unwrap(w), tol); #unwrap single row %! t(++i) = xassert(r', unwrap(w'), tol); #unwrap single column %! t(++i) = xassert([r',r'], unwrap([w',w']), tol); #unwrap 2 columns %! t(++i) = xassert([r;r], unwrap([w;w],[],2), tol); #verify that dim works %! t(++i) = xassert(r+10, unwrap(10+w), tol); #verify that r(1)>pi works -%! +%! %! t(++i) = xassert(w', unwrap(w',[],2)); #unwrap col by rows should not change it %! t(++i) = xassert(w, unwrap(w,[],1)); #unwrap row by cols should not change it %! t(++i) = xassert([w;w], unwrap([w;w])); #unwrap 2 rows by cols should not change them -%! +%! %! ## verify that setting tolerance too low will cause bad results. %! t(++i) = xassert(any(abs(r - unwrap(w,0.8)) > 100)); -%! +%! %! assert(all(t));
--- a/scripts/sparse/bicgstab.m +++ b/scripts/sparse/bicgstab.m @@ -131,7 +131,7 @@ shat = precon (s); - t = A * shat; + t = A * shat; omega = (t' * s) / (t' * t); x = x + alpha * phat + omega * shat; res = s - omega * t; @@ -144,7 +144,7 @@ ## We reach tolerance tol within maxit iterations. flag = 0; break; - elseif (resvec (end) == resvec (end - 1)) + elseif (resvec (end) == resvec (end - 1)) ## The method stagnates. flag = 3; break; @@ -152,7 +152,7 @@ endfor if (nargout < 2) - if (flag == 0) + if (flag == 0) printf (["bicgstab converged at iteration %i ", "to a solution with relative residual %e\n"],iter,relres); elseif (flag == 3)
--- a/scripts/sparse/cgs.m +++ b/scripts/sparse/cgs.m @@ -131,7 +131,7 @@ endfor; if (nargout < 1) - if ( flag == 0 ) + if ( flag == 0 ) printf (["cgs converged at iteration %i ", "to a solution with relative residual %e\n"],iter,relres); elseif (flag == 3)
--- a/scripts/sparse/gplot.m +++ b/scripts/sparse/gplot.m @@ -47,7 +47,7 @@ ycoord = [xy(i,2), xy(j,2), NaN(length(i),1) ]'(:); if (nargout == 0) - plot (xcoord, ycoord, line_style); + plot (xcoord, ycoord, line_style); else x = xcoord; y = ycoord;
--- a/scripts/sparse/pcg.m +++ b/scripts/sparse/pcg.m @@ -32,23 +32,23 @@ ## @var{A} should be symmetric and positive definite; if @code{pcg} ## finds @var{A} to not be positive definite, you will get a warning ## message and the @var{flag} output parameter will be set. -## +## ## @item ## @var{b} is the right hand side vector. -## +## ## @item ## @var{tol} is the required relative tolerance for the residual error, ## @code{@var{b} - @var{A} * @var{x}}. The iteration stops if -## @code{norm (@var{b} - @var{A} * @var{x}) <= +## @code{norm (@var{b} - @var{A} * @var{x}) <= ## @var{tol} * norm (@var{b} - @var{A} * @var{x0})}. ## If @var{tol} is empty or is omitted, the function sets ## @code{@var{tol} = 1e-6} by default. -## +## ## @item ## @var{maxit} is the maximum allowable number of iterations; if ## @code{[]} is supplied for @code{maxit}, or @code{pcg} has less ## arguments, a default value equal to 20 is used. -## +## ## @item ## @var{m} = @var{m1} * @var{m2} is the (left) preconditioning matrix, so that ## the iteration is (theoretically) equivalent to solving by @code{pcg} @@ -56,18 +56,18 @@ ## @var{x} = @var{m} \ @var{b}}, with @code{@var{P} = @var{m} \ @var{A}}. ## Note that a proper choice of the preconditioner may dramatically ## improve the overall performance of the method. Instead of matrices -## @var{m1} and @var{m2}, the user may pass two functions which return -## the results of applying the inverse of @var{m1} and @var{m2} to -## a vector (usually this is the preferred way of using the preconditioner). -## If @code{[]} is supplied for @var{m1}, or @var{m1} is omitted, no +## @var{m1} and @var{m2}, the user may pass two functions which return +## the results of applying the inverse of @var{m1} and @var{m2} to +## a vector (usually this is the preferred way of using the preconditioner). +## If @code{[]} is supplied for @var{m1}, or @var{m1} is omitted, no ## preconditioning is applied. If @var{m2} is omitted, @var{m} = @var{m1} ## will be used as preconditioner. -## +## ## @item -## @var{x0} is the initial guess. If @var{x0} is empty or omitted, the +## @var{x0} is the initial guess. If @var{x0} is empty or omitted, the ## function sets @var{x0} to a zero vector by default. ## @end itemize -## +## ## The arguments which follow @var{x0} are treated as parameters, and ## passed in a proper way to any of the functions (@var{A} or @var{m}) ## which are passed to @code{pcg}. See the examples below for further @@ -77,22 +77,22 @@ ## @item ## @var{x} is the computed approximation to the solution of ## @code{@var{A} * @var{x} = @var{b}}. -## +## ## @item ## @var{flag} reports on the convergence. @code{@var{flag} = 0} means ## the solution converged and the tolerance criterion given by @var{tol} ## is satisfied. @code{@var{flag} = 1} means that the @var{maxit} limit ## for the iteration count was reached. @code{@var{flag} = 3} reports that ## the (preconditioned) matrix was found not positive definite. -## +## ## @item ## @var{relres} is the ratio of the final residual to its initial value, ## measured in the Euclidean norm. -## +## ## @item ## @var{iter} is the actual number of iterations performed. ## -## @item +## @item ## @var{resvec} describes the convergence history of the method. ## @code{@var{resvec} (i,1)} is the Euclidean norm of the residual, and ## @code{@var{resvec} (i,2)} is the preconditioned residual norm, @@ -103,47 +103,47 @@ ## @code{@var{r} = @var{b} - @var{A} * @var{x}}, see also the ## description of @var{m}. If @var{eigest} is not required, only ## @code{@var{resvec} (:,1)} is returned. -## +## ## @item ## @var{eigest} returns the estimate for the smallest @code{@var{eigest} ## (1)} and largest @code{@var{eigest} (2)} eigenvalues of the -## preconditioned matrix @code{@var{P} = @var{m} \ @var{A}}. In +## preconditioned matrix @code{@var{P} = @var{m} \ @var{A}}. In ## particular, if no preconditioning is used, the estimates for the ## extreme eigenvalues of @var{A} are returned. @code{@var{eigest} (1)} -## is an overestimate and @code{@var{eigest} (2)} is an underestimate, +## is an overestimate and @code{@var{eigest} (2)} is an underestimate, ## so that @code{@var{eigest} (2) / @var{eigest} (1)} is a lower bound ## for @code{cond (@var{P}, 2)}, which nevertheless in the limit should -## theoretically be equal to the actual value of the condition number. +## theoretically be equal to the actual value of the condition number. ## The method which computes @var{eigest} works only for symmetric positive ## definite @var{A} and @var{m}, and the user is responsible for -## verifying this assumption. +## verifying this assumption. ## @end itemize -## +## ## Let us consider a trivial problem with a diagonal matrix (we exploit the -## sparsity of A) -## +## sparsity of A) +## ## @example ## @group -## n = 10; +## n = 10; ## A = diag (sparse (1:n)); ## b = rand (n, 1); ## [l, u, p, q] = luinc (A, 1.e-3); ## @end group ## @end example -## +## ## @sc{Example 1:} Simplest use of @code{pcg} -## +## ## @example ## x = pcg(A,b) ## @end example -## +## ## @sc{Example 2:} @code{pcg} with a function which computes ## @code{@var{A} * @var{x}} -## +## ## @example ## @group ## function y = apply_a (x) -## y = [1:N]'.*x; +## y = [1:N]'.*x; ## endfunction ## ## x = pcg ("apply_a", b) @@ -157,7 +157,7 @@ ## @end example ## ## @sc{Example 4:} @code{pcg} with a preconditioner: @var{l} * @var{u}. -## Faster than @sc{Example 3} since lower and upper triangular matrices +## Faster than @sc{Example 3} since lower and upper triangular matrices ## are easier to invert ## ## @example @@ -167,7 +167,7 @@ ## @sc{Example 5:} Preconditioned iteration, with full diagnostics. The ## preconditioner (quite strange, because even the original matrix ## @var{A} is trivial) is defined as a function -## +## ## @example ## @group ## function y = apply_m (x) @@ -175,36 +175,36 @@ ## y = x; ## y(1:k) = x(1:k)./[1:k]'; ## endfunction -## +## ## [x, flag, relres, iter, resvec, eigest] = ... ## pcg (A, b, [], [], "apply_m"); ## semilogy (1:iter+1, resvec); ## @end group ## @end example -## +## ## @sc{Example 6:} Finally, a preconditioner which depends on a ## parameter @var{k}. -## +## ## @example ## @group ## function y = apply_M (x, varargin) -## K = varargin@{1@}; +## K = varargin@{1@}; ## y = x; ## y(1:K) = x(1:K)./[1:K]'; ## endfunction -## +## ## [x, flag, relres, iter, resvec, eigest] = ... ## pcg (A, b, [], [], "apply_m", [], [], 3) ## @end group ## @end example -## +## ## References: -## +## ## @enumerate ## @item ## C.T. Kelley, @cite{Iterative Methods for Linear and Nonlinear Equations}, ## SIAM, 1995. (the base PCG algorithm) -## +## ## @item ## Y. Saad, @cite{Iterative Methods for Sparse Linear Systems}, PWS 1996. ## (condition number estimate from PCG) Revised version of this book is @@ -261,10 +261,10 @@ matrix_positive_definite = true; p = zeros (size (b)); - oldtau = 1; + oldtau = 1; if (isnumeric (A)) ## A is a matrix. - r = b - A*x; + r = b - A*x; else ## A should be a function. r = b - feval (A, x, varargin{:}); @@ -293,7 +293,7 @@ else z = y; endif - tau = z' * r; + tau = z' * r; resvec (iter-1,2) = sqrt (tau); beta = tau / oldtau; oldtau = tau; @@ -393,20 +393,20 @@ %! %! # Simplest usage of pcg (see also 'help pcg') %! -%! N = 10; +%! N = 10; %! A = diag ([1:N]); b = rand (N, 1); y = A \ b; #y is the true solution %! x = pcg (A, b); %! printf('The solution relative error is %g\n', norm (x - y) / norm (y)); %! %! # You shouldn't be afraid if pcg issues some warning messages in this -%! # example: watch out in the second example, why it takes N iterations +%! # example: watch out in the second example, why it takes N iterations %! # of pcg to converge to (a very accurate, by the way) solution %!demo %! %! # Full output from pcg, except for the eigenvalue estimates -%! # We use this output to plot the convergence history +%! # We use this output to plot the convergence history %! -%! N = 10; +%! N = 10; %! A = diag ([1:N]); b = rand (N, 1); X = A \ b; #X is the true solution %! [x, flag, relres, iter, resvec] = pcg (A, b); %! printf('The solution relative error is %g\n', norm (x - X) / norm (X)); @@ -418,7 +418,7 @@ %! # Full output from pcg, including the eigenvalue estimates %! # Hilbert matrix is extremely ill conditioned, so pcg WILL have problems %! -%! N = 10; +%! N = 10; %! A = hilb (N); b = rand (N, 1); X = A \ b; #X is the true solution %! [x, flag, relres, iter, resvec, eigest] = pcg (A, b, [], 200); %! printf('The solution relative error is %g\n', norm (x - X) / norm (X)); @@ -432,10 +432,10 @@ %! # Full output from pcg, including the eigenvalue estimates %! # We use the 1-D Laplacian matrix for A, and cond(A) = O(N^2) %! # and that's the reasone we need some preconditioner; here we take -%! # a very simple and not powerful Jacobi preconditioner, +%! # a very simple and not powerful Jacobi preconditioner, %! # which is the diagonal of A %! -%! N = 100; +%! N = 100; %! A = zeros (N, N); %! for i=1 : N - 1 # form 1-D Laplacian matrix %! A (i:i+1, i:i+1) = [2 -1; -1 2]; @@ -480,7 +480,7 @@ %! %! #solve small diagonal system %! -%! N = 10; +%! N = 10; %! A = diag ([1:N]); b = rand (N, 1); X = A \ b; #X is the true solution %! [x, flag] = pcg (A, b, [], N+1); %! assert(norm (x - X) / norm (X), 0, 1e-10); @@ -492,7 +492,7 @@ %! #despite A is indefinite, the iteration continues and converges %! #indefiniteness of A is detected %! -%! N = 10; +%! N = 10; %! A = diag([1:N] .* (-ones(1, N) .^ 2)); b = rand (N, 1); X = A \ b; #X is the true solution %! [x, flag] = pcg (A, b, [], N+1); %! assert(norm (x - X) / norm (X), 0, 1e-10); @@ -502,7 +502,7 @@ %! %! #solve tridiagonal system, do not converge in default 20 iterations %! -%! N = 100; +%! N = 100; %! A = zeros (N, N); %! for i = 1 : N - 1 # form 1-D Laplacian matrix %! A (i:i+1, i:i+1) = [2 -1; -1 2]; @@ -519,7 +519,7 @@ %! #converges in one iteration, so the eigest does not work %! #and issues a warning %! -%! N = 100; +%! N = 100; %! A = zeros (N, N); %! for i = 1 : N - 1 # form 1-D Laplacian matrix %! A (i:i+1, i:i+1) = [2 -1; -1 2];
--- a/scripts/sparse/pcr.m +++ b/scripts/sparse/pcr.m @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{x} =} pcr (@var{A}, @var{b}, @var{tol}, @var{maxit}, @var{m}, @var{x0}, @dots{}) ## @deftypefnx {Function File} {[@var{x}, @var{flag}, @var{relres}, @var{iter}, @var{resvec}] =} pcr (@dots{}) -## +## ## Solves the linear system of equations @code{@var{A} * @var{x} = @var{b}} ## by means of the Preconditioned Conjugate Residuals iterative ## method. The input arguments are @@ -32,18 +32,18 @@ ## @var{A} should be symmetric and non-singular; if @code{pcr} ## finds @var{A} to be numerically singular, you will get a warning ## message and the @var{flag} output parameter will be set. -## +## ## @item ## @var{b} is the right hand side vector. -## +## ## @item ## @var{tol} is the required relative tolerance for the residual error, -## @code{@var{b} - @var{A} * @var{x}}. The iteration stops if -## @code{norm (@var{b} - @var{A} * @var{x}) <= +## @code{@var{b} - @var{A} * @var{x}}. The iteration stops if +## @code{norm (@var{b} - @var{A} * @var{x}) <= ## @var{tol} * norm (@var{b} - @var{A} * @var{x0})}. ## If @var{tol} is empty or is omitted, the function sets ## @code{@var{tol} = 1e-6} by default. -## +## ## @item ## @var{maxit} is the maximum allowable number of iterations; if ## @code{[]} is supplied for @code{maxit}, or @code{pcr} has less @@ -55,16 +55,16 @@ ## @var{x} = @var{m} \ @var{b}}, with @code{@var{P} = @var{m} \ @var{A}}. ## Note that a proper choice of the preconditioner may dramatically ## improve the overall performance of the method. Instead of matrix -## @var{m}, the user may pass a function which returns the results of +## @var{m}, the user may pass a function which returns the results of ## applying the inverse of @var{m} to a vector (usually this is the ## preferred way of using the preconditioner). If @code{[]} is supplied ## for @var{m}, or @var{m} is omitted, no preconditioning is applied. -## +## ## @item -## @var{x0} is the initial guess. If @var{x0} is empty or omitted, the +## @var{x0} is the initial guess. If @var{x0} is empty or omitted, the ## function sets @var{x0} to a zero vector by default. ## @end itemize -## +## ## The arguments which follow @var{x0} are treated as parameters, and ## passed in a proper way to any of the functions (@var{A} or @var{m}) ## which are passed to @code{pcr}. See the examples below for further @@ -74,70 +74,70 @@ ## @item ## @var{x} is the computed approximation to the solution of ## @code{@var{A} * @var{x} = @var{b}}. -## +## ## @item ## @var{flag} reports on the convergence. @code{@var{flag} = 0} means ## the solution converged and the tolerance criterion given by @var{tol} ## is satisfied. @code{@var{flag} = 1} means that the @var{maxit} limit ## for the iteration count was reached. @code{@var{flag} = 3} reports t ## @code{pcr} breakdown, see [1] for details. -## +## ## @item ## @var{relres} is the ratio of the final residual to its initial value, ## measured in the Euclidean norm. -## +## ## @item ## @var{iter} is the actual number of iterations performed. ## -## @item +## @item ## @var{resvec} describes the convergence history of the method, -## so that @code{@var{resvec} (i)} contains the Euclidean norms of the +## so that @code{@var{resvec} (i)} contains the Euclidean norms of the ## residual after the (@var{i}-1)-th iteration, @code{@var{i} = ## 1,2, @dots{}, @var{iter}+1}. ## @end itemize -## +## ## Let us consider a trivial problem with a diagonal matrix (we exploit the -## sparsity of A) -## +## sparsity of A) +## ## @example ## @group -## n = 10; +## n = 10; ## A = sparse (diag (1:n)); ## b = rand (N, 1); ## @end group ## @end example -## +## ## @sc{Example 1:} Simplest use of @code{pcr} -## +## ## @example ## x = pcr(A, b) ## @end example -## +## ## @sc{Example 2:} @code{pcr} with a function which computes ## @code{@var{A} * @var{x}}. ## ## @example ## @group -## function y = apply_a (x) -## y = [1:10]'.*x; +## function y = apply_a (x) +## y = [1:10]'.*x; ## endfunction -## +## ## x = pcr ("apply_a", b) ## @end group ## @end example -## +## ## @sc{Example 3:} Preconditioned iteration, with full diagnostics. The ## preconditioner (quite strange, because even the original matrix ## @var{A} is trivial) is defined as a function -## +## ## @example ## @group -## function y = apply_m (x) -## k = floor (length(x)-2); -## y = x; -## y(1:k) = x(1:k)./[1:k]'; +## function y = apply_m (x) +## k = floor (length(x)-2); +## y = x; +## y(1:k) = x(1:k)./[1:k]'; ## endfunction -## +## ## [x, flag, relres, iter, resvec] = ... ## pcr (A, b, [], [], "apply_m") ## semilogy([1:iter+1], resvec); @@ -146,21 +146,21 @@ ## ## @sc{Example 4:} Finally, a preconditioner which depends on a ## parameter @var{k}. -## +## ## @example ## @group ## function y = apply_m (x, varargin) -## k = varargin@{1@}; -## y = x; y(1:k) = x(1:k)./[1:k]'; +## k = varargin@{1@}; +## y = x; y(1:k) = x(1:k)./[1:k]'; ## endfunction -## +## ## [x, flag, relres, iter, resvec] = ... ## pcr (A, b, [], [], "apply_m"', [], 3) ## @end group ## @end example -## +## ## References: -## +## ## [1] W. Hackbusch, @cite{Iterative Solution of Large Sparse Systems of ## Equations}, section 9.5.4; Springer, 1994 ## @@ -224,8 +224,8 @@ else # then A should be a function! q = feval (A, p, varargin{:}); endif - - resvec(1) = abs (norm (r)); + + resvec(1) = abs (norm (r)); ## iteration while (resvec(iter-1) > tol*resvec(1) && iter < maxit) @@ -241,36 +241,36 @@ endif b_top = r' * s; b_bot = q' * s; - + if (b_bot == 0.0) breakdown = true; break; endif lambda = b_top / b_bot; - + x += lambda*p; r -= lambda*q; - + if (isnumeric(A)) # is A a matrix? t = A*s; else # then A should be a function! t = feval (A, s, varargin{:}); endif - + alpha0 = (t'*s) / b_bot; alpha1 = (t'*s_old) / b_bot_old; - + p_temp = p; q_temp = q; p = s - alpha0*p - alpha1*p_old; q = t - alpha0*q - alpha1*q_old; - + s_old = s; p_old = p_temp; q_old = q_temp; b_bot_old = b_bot; - + resvec(iter) = abs (norm (r)); iter++; endwhile @@ -304,20 +304,20 @@ %! %! # Simplest usage of PCR (see also 'help pcr') %! -%! N = 20; +%! N = 20; %! A = diag(linspace(-3.1,3,N)); b = rand(N,1); y = A\b; #y is the true solution %! x = pcr(A,b); %! printf('The solution relative error is %g\n', norm(x-y)/norm(y)); %! %! # You shouldn't be afraid if PCR issues some warning messages in this -%! # example: watch out in the second example, why it takes N iterations +%! # example: watch out in the second example, why it takes N iterations %! # of PCR to converge to (a very accurate, by the way) solution %!demo %! %! # Full output from PCR -%! # We use this output to plot the convergence history +%! # We use this output to plot the convergence history %! -%! N = 20; +%! N = 20; %! A = diag(linspace(-3.1,30,N)); b = rand(N,1); X = A\b; #X is the true solution %! [x, flag, relres, iter, resvec] = pcr(A,b); %! printf('The solution relative error is %g\n', norm(x-X)/norm(X)); @@ -328,10 +328,10 @@ %! # Full output from PCR %! # We use indefinite matrix based on the Hilbert matrix, with one %! # strongly negative eigenvalue -%! # Hilbert matrix is extremely ill conditioned, so is ours, +%! # Hilbert matrix is extremely ill conditioned, so is ours, %! # and that's why PCR WILL have problems %! -%! N = 10; +%! N = 10; %! A = hilb(N); A(1,1)=-A(1,1); b = rand(N,1); X = A\b; #X is the true solution %! printf('Condition number of A is %g\n', cond(A)); %! [x, flag, relres, iter, resvec] = pcr(A,b,[],200); @@ -343,15 +343,15 @@ %!demo %! %! # Full output from PCR -%! # We use an indefinite matrix based on the 1-D Laplacian matrix for A, +%! # We use an indefinite matrix based on the 1-D Laplacian matrix for A, %! # and here we have cond(A) = O(N^2) %! # That's the reason we need some preconditioner; here we take -%! # a very simple and not powerful Jacobi preconditioner, +%! # a very simple and not powerful Jacobi preconditioner, %! # which is the diagonal of A %! %! # Note that we use here indefinite preconditioners! %! -%! N = 100; +%! N = 100; %! A = zeros(N,N); %! for i=1:N-1 # form 1-D Laplacian matrix %! A(i:i+1,i:i+1) = [2 -1; -1 2]; @@ -390,7 +390,7 @@ %! %! #solve small indefinite diagonal system %! -%! N = 10; +%! N = 10; %! A = diag(linspace(-10.1,10,N)); b = ones(N,1); X = A\b; #X is the true solution %! [x, flag] = pcr(A,b,[],N+1); %! assert(norm(x-X)/norm(X)<1e-10); @@ -401,7 +401,7 @@ %! #solve tridiagonal system, do not converge in default 20 iterations %! #should perform max allowable default number of iterations %! -%! N = 100; +%! N = 100; %! A = zeros(N,N); %! for i=1:N-1 # form 1-D Laplacian matrix %! A(i:i+1,i:i+1) = [2 -1; -1 2]; @@ -417,7 +417,7 @@ %! #solve tridiagonal system with 'prefect' preconditioner %! #converges in one iteration %! -%! N = 100; +%! N = 100; %! A = zeros(N,N); %! for i=1:N-1 # form 1-D Laplacian matrix %! A(i:i+1,i:i+1) = [2 -1; -1 2];
--- a/scripts/sparse/spaugment.m +++ b/scripts/sparse/spaugment.m @@ -28,9 +28,9 @@ ## @end example ## ## @noindent -## This is related to the least squares solution of +## This is related to the least squares solution of ## @code{@var{A} \\ @var{b}}, by -## +## ## @example ## @group ## @var{s} * [ @var{r} / @var{c}; x] = [@var{b}, zeros(@var{n}, @@ -49,7 +49,7 @@ ## with @code{lu}, and the minimum norm solution can therefore be found ## without the need for a @code{qr} factorization. As the residual ## error will be @code{zeros (@var{m}, @var{m})} for under determined -## problems, and example can be +## problems, and example can be ## ## @example ## @group
--- a/scripts/sparse/spdiags.m +++ b/scripts/sparse/spdiags.m @@ -23,7 +23,7 @@ ## @deftypefnx {Function File} {@var{b} =} spdiags (@var{v}, @var{c}, @var{m}, @var{n}) ## A generalization of the function @code{diag}. Called with a single ## input argument, the non-zero diagonals @var{c} of @var{A} are extracted. -## With two arguments the diagonals to extract are given by the vector +## With two arguments the diagonals to extract are given by the vector ## @var{c}. ## ## The other two forms of @code{spdiags} modify the input matrix by
--- a/scripts/sparse/speye.m +++ b/scripts/sparse/speye.m @@ -26,7 +26,7 @@ ## ## Called with a single argument a square matrix of size @var{m} by ## @var{m} is created. Otherwise a matrix of @var{m} by @var{n} is -## created. If called with a single vector argument, this argument +## created. If called with a single vector argument, this argument ## is taken to be the size of the matrix to create. ## @end deftypefn
--- a/scripts/sparse/spfun.m +++ b/scripts/sparse/spfun.m @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{y} =} spfun (@var{f}, @var{S}) ## Compute @code{f(@var{S})} for the non-zero values of @var{S}. -## This results in a sparse matrix with the same structure as +## This results in a sparse matrix with the same structure as ## @var{S}. The function @var{f} can be passed as a string, a ## function handle, or an inline function. ## @seealso{arrayfun, cellfun, structfun}
--- a/scripts/sparse/sprand.m +++ b/scripts/sparse/sprand.m @@ -27,7 +27,7 @@ ## @var{d} should be between 0 and 1. Values will be uniformly ## distributed between 0 and 1. ## -## Note: sometimes the actual density may be a bit smaller than @var{d}. +## Note: sometimes the actual density may be a bit smaller than @var{d}. ## This is unlikely to happen for large, truly sparse, matrices. ## ## If called with a single matrix argument, a random sparse matrix is @@ -42,8 +42,8 @@ ## Piotr Krzyzanowski <przykry2004@users.sf.net> ## 2004-09-27 use Paul's hint to allow larger random matrices ## at the price of sometimes lower density than desired -## David Bateman -## 2004-10-20 Texinfo help and copyright message +## David Bateman +## 2004-10-20 Texinfo help and copyright message function S = sprand (m, n, d) @@ -73,7 +73,7 @@ mn = m*n; ## how many entries in S would be satisfactory? k = round (d*mn); - idx = unique (fix (rand (min (k*1.01, k+10), 1) * mn)) + 1; + idx = unique (fix (rand (min (k*1.01, k+10), 1) * mn)) + 1; ## idx contains random numbers in [1,mn] ## generate 1% or 10 more random values than necessary in order to ## reduce the probability that there are less than k distinct
--- a/scripts/sparse/sprandn.m +++ b/scripts/sparse/sprandn.m @@ -27,7 +27,7 @@ ## @var{d} should be between 0 and 1. Values will be normally ## distributed with mean of zero and variance 1. ## -## Note: sometimes the actual density may be a bit smaller than @var{d}. +## Note: sometimes the actual density may be a bit smaller than @var{d}. ## This is unlikely to happen for large really sparse matrices. ## ## If called with a single matrix argument, a random sparse matrix is @@ -45,7 +45,7 @@ elseif (nargin == 3) mn = m*n; k = round (d*mn); - idx = unique (fix (rand (min (k*1.01, k+10), 1) * mn)) + 1; + idx = unique (fix (rand (min (k*1.01, k+10), 1) * mn)) + 1; ## idx contains random numbers in [1,mn] ## generate 1% or 10 more random values than necessary in order to ## reduce the probability that there are less than k distinct
--- a/scripts/sparse/sprandsym.m +++ b/scripts/sparse/sprandsym.m @@ -24,7 +24,7 @@ ## @var{d} should be between 0 and 1. Values will be normally ## distributed with mean of zero and variance 1. ## -## Note: sometimes the actual density may be a bit smaller than @var{d}. +## Note: sometimes the actual density may be a bit smaller than @var{d}. ## This is unlikely to happen for large really sparse matrices. ## ## If called with a single matrix argument, a random sparse matrix is @@ -44,7 +44,7 @@ n1 = m1 + rem (n, 2); mn1 = m1*n1; k1 = round (d*mn1); - idx1 = unique (fix (rand (min (k1*1.01, k1+10), 1) * mn1)) + 1; + idx1 = unique (fix (rand (min (k1*1.01, k1+10), 1) * mn1)) + 1; ## idx contains random numbers in [1,mn] generate 1% or 10 more ## random values than necessary in order to reduce the probability ## that there are less than k distinct values; maybe a better @@ -58,7 +58,7 @@ n2 = ceil (n/2); nn2 = n2*n2; k2 = round (d*nn2); - idx2 = unique (fix (rand (min (k2*1.01, k1+10), 1) * nn2)) + 1; + idx2 = unique (fix (rand (min (k2*1.01, k1+10), 1) * nn2)) + 1; k2 = min (length (idx2), k2); j2 = floor ((idx2(1:k2)-1)/n2); i2 = idx2(1:k2) - j2*n2;
--- a/scripts/sparse/spstats.m +++ b/scripts/sparse/spstats.m @@ -21,12 +21,12 @@ ## @deftypefnx {Function File} {[@var{count}, @var{mean}, @var{var}] =} spstats (@var{S}, @var{j}) ## Return the stats for the non-zero elements of the sparse matrix @var{S}. ## @var{count} is the number of non-zeros in each column, @var{mean} -## is the mean of the non-zeros in each column, and @var{var} is the +## is the mean of the non-zeros in each column, and @var{var} is the ## variance of the non-zeros in each column. ## ## Called with two input arguments, if @var{S} is the data and @var{j} -## is the bin number for the data, compute the stats for each bin. In -## this case, bins can contain data values of zero, whereas with +## is the bin number for the data, compute the stats for each bin. In +## this case, bins can contain data values of zero, whereas with ## @code{spstats (@var{S})} the zeros may disappear. ## @end deftypefn @@ -39,19 +39,19 @@ if (nargin == 1) [i, j, v] = find (S); else - v = S; + v = S; i = 1:length (v); S = sparse (i, j, v); - endif + endif [n, m] = size (S); count = sum (sparse (i, j, 1, n, m)); - if (nargout > 1) - mean = sum (S) ./ count; + if (nargout > 1) + mean = sum (S) ./ count; endif - if (nargout > 2) + if (nargout > 2) ## FIXME Variance with count = 0 or 1? - diff = S - sparse (i, j, mean(j), n, m); + diff = S - sparse (i, j, mean(j), n, m); var = sum (diff .* diff) ./ (count - 1); endif
--- a/scripts/sparse/spy.m +++ b/scripts/sparse/spy.m @@ -27,7 +27,7 @@ ## @seealso{plot} ## @end deftypefn -function spy (x, varargin) +function spy (x, varargin) if (nargin < 1) print_usage ();
--- a/scripts/sparse/svds.m +++ b/scripts/sparse/svds.m @@ -25,7 +25,7 @@ ## @deftypefnx {Function File} {[@var{u}, @var{s}, @var{v}, @var{flag}] =} svds (@dots{}) ## ## Find a few singular values of the matrix @var{A}. The singular values -## are calculated using +## are calculated using ## ## @example ## @group @@ -35,33 +35,33 @@ ## @end group ## @end example ## -## The eigenvalues returned by @code{eigs} correspond to the singular values +## The eigenvalues returned by @code{eigs} correspond to the singular values ## of @var{A}. The number of singular values to calculate is given by @var{k} ## and defaults to 6. -## -## The argument @var{sigma} specifies which singular values to find. When -## @var{sigma} is the string 'L', the default, the largest singular values of -## @var{A} are found. Otherwise, @var{sigma} must be a real scalar and the -## singular values closest to @var{sigma} are found. As a corollary, -## @code{@var{sigma} = 0} finds the smallest singular values. Note that for +## +## The argument @var{sigma} specifies which singular values to find. When +## @var{sigma} is the string 'L', the default, the largest singular values of +## @var{A} are found. Otherwise, @var{sigma} must be a real scalar and the +## singular values closest to @var{sigma} are found. As a corollary, +## @code{@var{sigma} = 0} finds the smallest singular values. Note that for ## relatively small values of @var{sigma}, there is a chance that the requested -## number of singular values will not be found. In that case @var{sigma} +## number of singular values will not be found. In that case @var{sigma} ## should be increased. ## ## @var{opts} is a structure defining options that @code{svds} will pass -## to @code{eigs}. The possible fields of this structure are documented in +## to @code{eigs}. The possible fields of this structure are documented in ## @code{eigs}. By default, @code{svds} sets the following three fields: ## ## @table @code ## @item tol -## The required convergence tolerance for the singular values. The default +## The required convergence tolerance for the singular values. The default ## value is 1e-10. @code{eigs} is passed @code{@var{tol} / sqrt(2)}. ## ## @item maxit ## The maximum number of iterations. The default is 300. ## ## @item disp -## The level of diagnostic printout (0|1|2). If @code{disp} is 0 then +## The level of diagnostic printout (0|1|2). If @code{disp} is 0 then ## diagnostics are disabled. The default value is 0. ## @end table ## @@ -74,8 +74,8 @@ ## ## @noindent ## where @var{A}_approx is a matrix of size @var{A} but only rank @var{k}. -## -## @var{flag} returns 0 if the algorithm has succesfully converged, and 1 +## +## @var{flag} returns 0 if the algorithm has succesfully converged, and 1 ## otherwise. The test for convergence is ## ## @example @@ -158,14 +158,14 @@ if (b_sigma == 0) ## Find the smallest eigenvalues - ## The eigenvalues returns by eigs for sigma=0 are symmetric about 0. + ## The eigenvalues returns by eigs for sigma=0 are symmetric about 0. ## As we are only interested in the positive eigenvalues, we have to - ## double k and then throw out the k negative eigenvalues. - ## Separately, if sigma is non-zero, but smaller than the smallest - ## singular value, ARPACK may not return k eigenvalues. However, as - ## computation scales with k we'd like to avoid doubling k for all + ## double k and then throw out the k negative eigenvalues. + ## Separately, if sigma is non-zero, but smaller than the smallest + ## singular value, ARPACK may not return k eigenvalues. However, as + ## computation scales with k we'd like to avoid doubling k for all ## scalar values of sigma. - b_k = 2 * k; + b_k = 2 * k; else b_k = k; # Normal case, find just the k largest eigenvalues endif @@ -184,9 +184,9 @@ norma = normest (A); endif ## We wish to exclude all eigenvalues that are less than zero as these - ## are artifacts of the way the matrix passed to eigs is formed. There - ## is also the possibility that the value of sigma chosen is exactly - ## a singular value, and in that case we're dead!! So have to rely on + ## are artifacts of the way the matrix passed to eigs is formed. There + ## is also the possibility that the value of sigma chosen is exactly + ## a singular value, and in that case we're dead!! So have to rely on ## the warning from eigs. We exclude the singular values which are ## less than or equal to zero to within some tolerance scaled by the ## norm since if we don't we might end up with too many singular @@ -194,7 +194,7 @@ tol = norma * opts.tol; ind = find(s > tol); if (length (ind) < k) - ## Too few eigenvalues returned. Add in any zero eigenvalues of B, + ## Too few eigenvalues returned. Add in any zero eigenvalues of B, ## including the nominally negative ones. zind = find (abs (s) <= tol); p = min (length (zind), k - length (ind)); @@ -251,26 +251,26 @@ %! v = v(:,idx); %! randn('state',42); % Initialize to make normest function reproducible %! rand('state',42) -%! opts.v0 = rand (2*n,1); % Initialize eigs ARPACK starting vector +%! opts.v0 = rand (2*n,1); % Initialize eigs ARPACK starting vector %! % to guarantee reproducible results %!testif HAVE_ARPACK %! [u2,s2,v2,flag] = svds(A,k); %! s2 = diag(s2); %! assert(flag,!1); -%! assert(s2, s(end:-1:end-k+1), 1e-10); +%! assert(s2, s(end:-1:end-k+1), 1e-10); %!testif HAVE_ARPACK %! [u2,s2,v2,flag] = svds(A,k,0,opts); %! s2 = diag(s2); %! assert(flag,!1); -%! assert(s2, s(k:-1:1), 1e-10); +%! assert(s2, s(k:-1:1), 1e-10); %!testif HAVE_ARPACK %! idx = floor(n/2); -%! % Don't put sigma right on a singular value or there are convergence issues -%! sigma = 0.99*s(idx) + 0.01*s(idx+1); +%! % Don't put sigma right on a singular value or there are convergence issues +%! sigma = 0.99*s(idx) + 0.01*s(idx+1); %! [u2,s2,v2,flag] = svds(A,k,sigma,opts); %! s2 = diag(s2); %! assert(flag,!1); -%! assert(s2, s((idx+floor(k/2)):-1:(idx-floor(k/2))), 1e-10); +%! assert(s2, s((idx+floor(k/2)):-1:(idx-floor(k/2))), 1e-10); %!testif HAVE_ARPACK %! [u2,s2,v2,flag] = svds(zeros (10), k); %! assert (isequal(u2, eye (10, k)) && isequal (s2, zeros(k)) && isequal (v2, eye(10, 7)))
--- a/scripts/sparse/treelayout.m +++ b/scripts/sparse/treelayout.m @@ -31,7 +31,7 @@ function [x_coordinate, y_coordinate, height, s] = treelayout (tree, permutation) if (nargin < 1 || nargin > 2 || nargout > 4) print_usage (); - elseif (! isvector (tree) || rows (tree) != 1 || ! isnumeric (tree) + elseif (! isvector (tree) || rows (tree) != 1 || ! isnumeric (tree) || any (tree > length (tree)) || any (tree < 0)) error ("treelayout: the first input argument must be a vector of predecessors"); else @@ -98,7 +98,7 @@ if (nargin == 1) for i = 1:num_nodes - vec_of_child(xhelp(tree(i)+1)) = i; + vec_of_child(xhelp(tree(i)+1)) = i; xhelp(tree(i)+1) = xhelp(tree(i)+1) + 1; endfor else @@ -150,7 +150,7 @@ ## If there is not any descendant of "parent node": if (stk(end,2) != par_number) left_most++; - x_coordinate_r(par_number) = left_most; + x_coordinate_r(par_number) = left_most; max_ht = min (max_ht, level); if (length(stk) > 1 && find ((shift(stk,1)-stk) == 0) > 1 && stk(end,2) != stk(end-1,2)) @@ -171,7 +171,7 @@ x_coordinate_r(par_number_vec) = left_most; stk(position:end,:) = []; - endif + endif ## Remove the next node from "searched branch". @@ -180,7 +180,7 @@ par_number = stk(end,1); ## If there is another branch start to search it. if (par_number != -1) - y_coordinate(par_number) = level; + y_coordinate(par_number) = level; x_coordinate_l(par_number) = left_most + 1; endif else @@ -189,7 +189,7 @@ ## them and go on through it. level--; par_number = stk(end,1); - y_coordinate(par_number) = level; + y_coordinate(par_number) = level; x_coordinate_l(par_number) = left_most + 1; endif endwhile @@ -203,9 +203,9 @@ endfunction %!demo -%! % Compute a simple tree layout +%! % Compute a simple tree layout %! [x,y,h,s]=treelayout([0 1 2 2]) %!demo %! % Compute a simple tree layout with defined postorder permutation -%! [x,y,h,s]=treelayout([0 1 2 2],[1 2 3 4]) +%! [x,y,h,s]=treelayout([0 1 2 2],[1 2 3 4])
--- a/scripts/sparse/treeplot.m +++ b/scripts/sparse/treeplot.m @@ -31,16 +31,16 @@ if (nargin < 1 || nargin > 3 || nargout > 0) print_usage (); else - if (! ismatrix (tree) || rows (tree) != 1 || ! isnumeric (tree) + if (! ismatrix (tree) || rows (tree) != 1 || ! isnumeric (tree) || ! isvector (tree) || any (tree > length (tree))) error ("treeplot: the first input argument must be a vector of predecessors"); else ## The initialization of node end edge style. node_style = "k*"; - edge_style = "r"; + edge_style = "r"; if (nargin > 2) edge_style = edge_s; - if (nargin > 1) + if (nargin > 1) if (length (findstr (node_s, "*")) == 0 && length (findstr (node_s, "+")) == 0 && length (findstr (node_s, "x")) == 0) @@ -59,7 +59,7 @@ ## The number of children. num_children = zeros (1, num_nodes+1); - + for i = 1:num_nodes ## VEC_OF_CHILD is helping vector which is used to speed up the ## choose of descendant nodes. @@ -76,8 +76,8 @@ pos += num_children(i); stop(i) = pos; endfor - for i = 1:num_nodes - vec_of_child(xhelp(tree(i)+1)) = i; + for i = 1:num_nodes + vec_of_child(xhelp(tree(i)+1)) = i; xhelp(tree(i)+1) = xhelp(tree(i)+1)+1; endfor @@ -121,7 +121,7 @@ ## If there is not any descendant of "parent node": if (stk(end,2) != par_number) left_most++; - x_coordinate_r(par_number) = left_most; + x_coordinate_r(par_number) = left_most; max_ht = min (max_ht, level); if (length(stk) > 1 && find ((shift(stk,1)-stk) == 0) > 1 && stk(end,2) != stk(end-1,2)) @@ -138,7 +138,7 @@ ## The level have to be decreased. x_coordinate_r(par_number_vec) = left_most; stk(position:end,:) = []; - endif + endif ## Remove the next node from "searched branch". stk(end,:) = []; ## Choose new "parent node". @@ -146,7 +146,7 @@ ## If there is another branch start to search it. if (par_number != -1) skelet = [skelet; stk(end,2); par_number]; - y_coordinate(par_number) = level; + y_coordinate(par_number) = level; x_coordinate_l(par_number) = left_most + 1; endif else @@ -154,7 +154,7 @@ ## them and go on through it. level--; par_number = stk(end,1); - y_coordinate(par_number) = level; + y_coordinate(par_number) = level; x_coordinate_l(par_number) = left_most + 1; endif endwhile @@ -186,7 +186,7 @@ istart = idx(i-1) + 1; ## Tree component end. istop = idx(i) - 1; - if (istop - istart < 1) + if (istop - istart < 1) continue; endif plot (x_coordinate(skelet(istart:istop)), @@ -201,15 +201,15 @@ hold ("off"); endif end_unwind_protect - + endif endif endfunction %!demo -%! % Plot a simple tree plot +%! % Plot a simple tree plot %! treeplot([2 4 2 0 6 4 6]) %!demo %! % Plot a simple tree plot defining the edge and node styles -%! treeplot([2 4 2 0 6 4 6], "b+", "g") +%! treeplot([2 4 2 0 6 4 6], "b+", "g")
--- a/scripts/specfun/bessel.m +++ b/scripts/specfun/bessel.m @@ -23,10 +23,10 @@ ## @deftypefnx {Loadable Function} {[@var{k}, @var{ierr}] =} besselk (@var{alpha}, @var{x}, @var{opt}) ## @deftypefnx {Loadable Function} {[@var{h}, @var{ierr}] =} besselh (@var{alpha}, @var{k}, @var{x}, @var{opt}) ## Compute Bessel or Hankel functions of various kinds: -## +## ## @table @code ## @item besselj -## Bessel functions of the first kind. If the argument @var{opt} is supplied, +## Bessel functions of the first kind. If the argument @var{opt} is supplied, ## the result is multiplied by @code{exp(-abs(imag(x)))}. ## ## @item bessely @@ -50,20 +50,20 @@ ## @code{exp (-I*@var{x})} for @var{k} = 1 or @code{exp (I*@var{x})} for ## @var{k} = 2. ## @end table -## +## ## If @var{alpha} is a scalar, the result is the same size as @var{x}. ## If @var{x} is a scalar, the result is the same size as @var{alpha}. ## If @var{alpha} is a row vector and @var{x} is a column vector, the ## result is a matrix with @code{length (@var{x})} rows and ## @code{length (@var{alpha})} columns. Otherwise, @var{alpha} and ## @var{x} must conform and the result will be the same size. -## +## ## The value of @var{alpha} must be real. The value of @var{x} may be ## complex. -## +## ## If requested, @var{ierr} contains the following status information ## and is the same size as the result. -## +## ## @enumerate 0 ## @item ## Normal return.
--- a/scripts/specfun/betaln.m +++ b/scripts/specfun/betaln.m @@ -29,7 +29,7 @@ ## @example ## betaln (a, b) = gammaln (a) + gammaln (b) - gammaln (a + b) ## @end example -## +## ## @end ifnottex ## @seealso{beta, betainc, gammaln} ## @end deftypefn
--- a/scripts/specfun/factor.m +++ b/scripts/specfun/factor.m @@ -20,9 +20,9 @@ ## @deftypefn {Function File} {@var{p} =} factor (@var{q}) ## @deftypefnx {Function File} {[@var{p}, @var{n}] =} factor (@var{q}) ## -## Return prime factorization of @var{q}. That is, +## Return prime factorization of @var{q}. That is, ## @code{prod (@var{p}) == @var{q}} and every element of @var{p} is a prime -## number. If @code{@var{q} == 1}, return 1. +## number. If @code{@var{q} == 1}, return 1. ## ## With two output arguments, return the unique primes @var{p} and ## their multiplicities. That is, @code{prod (@var{p} .^ @var{n}) == @@ -52,7 +52,7 @@ x = q; n = 1; return; - endif + endif x = []; ## There is at most one prime greater than sqrt(q), and if it exists,
--- a/scripts/specfun/legendre.m +++ b/scripts/specfun/legendre.m @@ -20,11 +20,11 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{l} =} legendre (@var{n}, @var{x}) ## @deftypefnx {Function File} {@var{l} =} legendre (@var{n}, @var{x}, @var{normalization}) -## Compute the Legendre function of degree @var{n} and order -## @var{m} = 0 @dots{} N@. The optional argument, @var{normalization}, +## Compute the Legendre function of degree @var{n} and order +## @var{m} = 0 @dots{} N@. The optional argument, @var{normalization}, ## may be one of @code{"unnorm"}, @code{"sch"}, or @code{"norm"}. -## The default is @code{"unnorm"}. The value of @var{n} must be a -## non-negative scalar integer. +## The default is @code{"unnorm"}. The value of @var{n} must be a +## non-negative scalar integer. ## ## If the optional argument @var{normalization} is missing or is ## @code{"unnorm"}, compute the Legendre function of degree @var{n} and @@ -80,11 +80,11 @@ ## m=0 | -1.00000 | -0.47250 | -0.08000 ## m=1 | 0.00000 | -1.99420 | -1.98000 ## m=2 | 0.00000 | -2.56500 | -4.32000 -## m=3 | 0.00000 | -1.24229 | -3.24000 +## m=3 | 0.00000 | -1.24229 | -3.24000 ## @end group ## @end example ## -## If the optional argument @code{normalization} is @code{"sch"}, +## If the optional argument @code{normalization} is @code{"sch"}, ## compute the Schmidt semi-normalized associated Legendre function. ## The Schmidt semi-normalized associated Legendre function is related ## to the unnormalized Legendre functions by the following: @@ -127,7 +127,7 @@ ## ## @end ifnottex ## -## If the optional argument @var{normalization} is @code{"norm"}, +## If the optional argument @var{normalization} is @code{"norm"}, ## compute the fully normalized associated Legendre function. ## The fully normalized associated Legendre function is related ## to the unnormalized Legendre functions by the following: @@ -145,7 +145,7 @@ ## @group ## m m m (n+0.5)(n-m)! 0.5 ## NP (x) = P (x) * (-1) * [-------------] -## n n (n+m)! +## n n (n+m)! ## @end group ## @end example ## @@ -201,7 +201,7 @@ overflow = false; for m = 1:n lpm1 = scale; - lpm2 = (2*m-1) .* x .* scale; + lpm2 = (2*m-1) .* x .* scale; lpm3 = lpm2; for k = m+1:n lpm3a = (2*k-1) .* x .* lpm2;
--- a/scripts/specfun/nchoosek.m +++ b/scripts/specfun/nchoosek.m @@ -44,8 +44,8 @@ ## @end ifnottex ## ## If @var{n} is a vector generate all combinations of the elements -## of @var{n}, taken @var{k} at a time, one row per combination. The -## resulting @var{c} has size @code{[nchoosek (length (@var{n}), +## of @var{n}, taken @var{k} at a time, one row per combination. The +## resulting @var{c} has size @code{[nchoosek (length (@var{n}), ## @var{k}), @var{k}]}. ## ## @code{nchoosek} works only for non-negative integer arguments; use
--- a/scripts/specfun/nthroot.m +++ b/scripts/specfun/nthroot.m @@ -22,8 +22,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} nthroot (@var{x}, @var{n}) -## -## Compute the n-th root of @var{x}, returning real results for real +## +## Compute the n-th root of @var{x}, returning real results for real ## components of @var{x}. For example: ## ## @example @@ -34,7 +34,7 @@ ## @result{} 0.50000 - 0.86603i ## @end group ## @end example -## +## ## @var{n} must be a scalar. If @var{n} is not an even integer and @var{X} has ## negative entries, an error is produced. ## @seealso{realsqrt, sqrt, cbrt}
--- a/scripts/specfun/primes.m +++ b/scripts/specfun/primes.m @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} primes (@var{n}) ## -## Return all primes up to @var{n}. +## Return all primes up to @var{n}. ## ## The algorithm used is the Sieve of Eratosthenes. ##
--- a/scripts/specfun/reallog.m +++ b/scripts/specfun/reallog.m @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} reallog (@var{x}) -## Return the real-valued natural logarithm of each element of @var{x}. Report +## Return the real-valued natural logarithm of each element of @var{x}. Report ## an error if any element results in a complex return value. ## @seealso{log, realpow, realsqrt} ## @end deftypefn @@ -28,7 +28,7 @@ print_usage (); elseif (iscomplex (x) || any (x(:) < 0)) error ("reallog: produced complex result"); - else + else y = log (x); endif endfunction
--- a/scripts/specfun/realpow.m +++ b/scripts/specfun/realpow.m @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} realpow (@var{x}, @var{y}) -## Compute the real-valued, element-by-element power operator. This is +## Compute the real-valued, element-by-element power operator. This is ## equivalent to @w{@code{@var{x} .^ @var{y}}}, except that @code{realpow} ## reports an error if any return value is complex. ## @seealso{reallog, realsqrt}
--- a/scripts/specfun/realsqrt.m +++ b/scripts/specfun/realsqrt.m @@ -28,7 +28,7 @@ print_usage (); elseif (iscomplex (x) || any (x(:) < 0)) error ("realsqrt: produced complex result"); - else + else y = sqrt (x); endif endfunction
--- a/scripts/special-matrix/hadamard.m +++ b/scripts/special-matrix/hadamard.m @@ -21,7 +21,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} hadamard (@var{n}) -## Construct a Hadamard matrix @var{Hn} of size @var{n}-by-@var{n}. The +## Construct a Hadamard matrix @var{Hn} of size @var{n}-by-@var{n}. The ## size @var{n} must be of the form @code{2 ^ @var{k} * @var{p}} in which ## @var{p} is one of 1, 12, 20 or 28. The returned matrix is normalized, ## meaning @code{Hn(:,1) == 1} and @code{Hn(1,:) == 1}. @@ -30,7 +30,7 @@ ## ## @itemize @bullet ## @item -## @code{kron (@var{Hm}, @var{Hn})} is a Hadamard matrix of size +## @code{kron (@var{Hm}, @var{Hn})} is a Hadamard matrix of size ## @var{m}-by-@var{n}. ## ## @item @@ -49,17 +49,17 @@ ## ## @end deftypefn - + ## Reference [1] contains a list of Hadamard matrices up to n=256. ## See code for h28 in hadamard.m for an example of how to extend ## this function for additional p. ## ## References: -## [1] A Library of Hadamard Matrices, N. J. A. Sloane +## [1] A Library of Hadamard Matrices, N. J. A. Sloane ## http://www.research.att.com/~njas/hadamard/ function h = hadamard (n) - + if (nargin != 1) print_usage (); endif @@ -67,14 +67,14 @@ ## Find k if n = 2^k*p. k = 0; while (n > 1 && floor (n/2) == n/2) - k++; - n = n/2; + k++; + n = n/2; endwhile - + ## Find base hadamard. ## Except for n=2^k, need a multiple of 4. if (n != 1) - k -= 2; + k -= 2; endif ## Trigger error if not a multiple of 4. @@ -99,11 +99,11 @@ h2 = [1,1;1,-1]; while (true) if (floor (k/2) != k/2) - h = kron (h2, h); + h = kron (h2, h); endif k = floor (k/2); - if (k == 0) - break; + if (k == 0) + break; endif h2 = kron (h2, h2); endwhile
--- a/scripts/special-matrix/invhilb.m +++ b/scripts/special-matrix/invhilb.m @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} invhilb (@var{n}) -## Return the inverse of the Hilbert matrix of order @var{n}. This can be +## Return the inverse of the Hilbert matrix of order @var{n}. This can be ## computed exactly using ## @tex ## $$\eqalign{ @@ -60,9 +60,9 @@ ## @end example ## ## @end ifnottex -## The validity of this formula can easily be checked by expanding -## the binomial coefficients in both formulas as factorials. It can -## be derived more directly via the theory of Cauchy matrices. +## The validity of this formula can easily be checked by expanding +## the binomial coefficients in both formulas as factorials. It can +## be derived more directly via the theory of Cauchy matrices. ## See J. W. Demmel, @cite{Applied Numerical Linear Algebra}, p. 92. ## ## Compare this with the numerical calculation of @code{inverse (hilb (n))}, @@ -83,7 +83,7 @@ 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 + ## 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 @@ -92,12 +92,12 @@ ## (-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 + ## 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]; + 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) @@ -120,7 +120,7 @@ %! -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)));
--- a/scripts/special-matrix/magic.m +++ b/scripts/special-matrix/magic.m @@ -71,7 +71,7 @@ A([I,I+m],1) = A([I+m,I],1); I = k + 1; A([I,I+m],I) = A([I+m,I],I); - + endif endfunction
--- a/scripts/special-matrix/pascal.m +++ b/scripts/special-matrix/pascal.m @@ -21,7 +21,7 @@ ## @deftypefn {Function File} {} pascal (@var{n}) ## @deftypefnx {Function File} {} pascal (@var{n}, @var{t}) ## Return the Pascal matrix of order @var{n} if @code{@var{t} = 0}. -## @var{t} defaults to 0. Return lower triangular Cholesky factor of +## @var{t} defaults to 0. Return lower triangular Cholesky factor of ## the Pascal matrix if @code{@var{t} = 1}. This matrix is its own ## inverse, that is @code{pascal (@var{n}, 1) ^ 2 == eye (@var{n})}. ## If @code{@var{t} = -1}, return its absolute value. This is the
--- a/scripts/special-matrix/toeplitz.m +++ b/scripts/special-matrix/toeplitz.m @@ -102,7 +102,7 @@ ## Form matrix. retval = spdiags(repmat(c(cidx),nr,1),1-cidx,nr,nc)+... spdiags(repmat(r(ridx),nr,1),ridx-1,nr,nc); - else + else ## Concatenate data into a single column vector. data = [r(end:-1:2)(:); c(:)];
--- a/scripts/startup/__finish__.m +++ b/scripts/startup/__finish__.m @@ -21,7 +21,7 @@ ## Undocumented internal function. ## @end deftypefn -## Check for the existence of the function/script, @file{finish}, in the +## Check for the existence of the function/script, @file{finish}, in the ## path or current working directory and execute it. This function is ## intended to be excecuted upon a clean exit form Octave. This is ## accomplished in the system script @file{startup/octaverc} by use of
--- a/scripts/statistics/base/cov.m +++ b/scripts/statistics/base/cov.m @@ -44,7 +44,7 @@ ## If called with one argument, compute @code{cov (@var{x}, @var{x})}, the ## covariance between the columns of @var{x}. ## -## The argument @var{opt} determines the type of normalization to use. +## The argument @var{opt} determines the type of normalization to use. ## Valid values are ## ## @table @asis @@ -92,7 +92,7 @@ x = x'; endif n = rows (x); - + if (nargin == 1 || isscalar(y)) x = center (x, 1); c = conj (x' * x / (n - 1 + opt));
--- a/scripts/statistics/base/histc.m +++ b/scripts/statistics/base/histc.m @@ -85,7 +85,7 @@ nsz = sz; nsz(dim) = num_edges; - + ## the splitting point is 3 bins if (num_edges <= 3) @@ -99,7 +99,7 @@ if (nargout > 1) idx = zeros (sz); endif - + ## Prepare indices idx1 = cell (1, dim-1); for k = 1:length (idx1) @@ -109,7 +109,7 @@ for k = 1:length (idx2) idx2 {k} = 1:sz(k+dim); endfor - + ## Compute the histograms for k = 1:num_edges-1 b = (edges (k) <= x & x < edges (k+1)); @@ -130,7 +130,7 @@ ## Look-up indices. idx = lookup (edges, x); - ## Zero invalid ones (including NaNs). x < edges(1) are already zero. + ## Zero invalid ones (including NaNs). x < edges(1) are already zero. idx(! (x <= edges(end))) = 0; iidx = idx;
--- a/scripts/statistics/base/iqr.m +++ b/scripts/statistics/base/iqr.m @@ -21,7 +21,7 @@ ## @deftypefnx {Function File} {} iqr (@var{x}, @var{dim}) ## Return the interquartile range, i.e., the difference between the upper ## and lower quartile of the input data. If @var{x} is a matrix, do the -## above for first non-singleton dimension of @var{x}. +## above for first non-singleton dimension of @var{x}. ## ## If the optional argument @var{dim} is given, operate along this dimension. ## @@ -59,7 +59,7 @@ endif endif - ## This code is a bit heavy, but is needed until empirical_inv + ## This code is a bit heavy, but is needed until empirical_inv ## takes other than vector arguments. c = sz(dim); sz(dim) = 1;
--- a/scripts/statistics/base/kendall.m +++ b/scripts/statistics/base/kendall.m @@ -34,7 +34,7 @@ ## ## @example ## @group -## 1 +## 1 ## tau = ------- SUM sign (q(i) - q(j)) * sign (r(i) - r(j)) ## n (n-1) i,j ## @end group @@ -59,7 +59,7 @@ ## @ifnottex ## @code{(2 * (2@var{n}+5)) / (9 * @var{n} * (@var{n}-1))}. ## @end ifnottex -## +## ## @code{kendall (@var{x})} is equivalent to @code{kendall (@var{x}, ## @var{x})}. ## @seealso{ranks, spearman}
--- a/scripts/statistics/base/kurtosis.m +++ b/scripts/statistics/base/kurtosis.m @@ -36,9 +36,9 @@ ## If @var{x} is a matrix, return the kurtosis over the ## first non-singleton dimension of the matrix. If the optional ## @var{dim} argument is given, operate along this dimension. -## +## ## Note: The definition of kurtosis above yields a kurtosis of zero for the -## stdnormal distribution and is sometimes referred to as "excess kurtosis". +## stdnormal distribution and is sometimes referred to as "excess kurtosis". ## To calculate kurtosis without the normalization factor of @math{-3} use ## @code{moment (@var{x}, 4, 'c') / std (@var{x})^4}. ## @seealso{var,skewness,moment} @@ -72,7 +72,7 @@ error ("kurtosis: DIM must be an integer and a valid dimension"); endif endif - + c = sz(dim); sz(dim) = 1; idx = ones (1, nd);
--- a/scripts/statistics/base/mean.m +++ b/scripts/statistics/base/mean.m @@ -113,7 +113,7 @@ if (dim > nd) n = 1; - else + else n = sz(dim); endif
--- a/scripts/statistics/base/meansq.m +++ b/scripts/statistics/base/meansq.m @@ -37,7 +37,7 @@ ## ## @end ifnottex ## For matrix arguments, return a row vector containing the mean square -## of each column. +## of each column. ## ## If the optional argument @var{dim} is given, operate along this dimension. ## @seealso{var,std,moment} @@ -57,7 +57,7 @@ endif nd = ndims (x); - sz = size (x); + sz = size (x); if (nargin < 2) ## Find the first non-singleton dimension. dim = find (sz > 1, 1);
--- a/scripts/statistics/base/median.m +++ b/scripts/statistics/base/median.m @@ -95,7 +95,7 @@ %! x2 = x'; %! y = [1, 2, 3, 4, 5, 6, 7]; %! y2 = y'; -%! +%! %! assert(median (x) == median (x2) && median (x) == 3.5); %! assert(median (y) == median (y2) && median (y) == 4); %! assert(median ([x2, 2*x2]) == [3.5, 7]);
--- a/scripts/statistics/base/mode.m +++ b/scripts/statistics/base/mode.m @@ -20,11 +20,11 @@ ## @deftypefn {Function File} {} mode (@var{x}) ## @deftypefnx {Function File} {} mode (@var{x}, @var{dim}) ## @deftypefnx {Function File} {[@var{m}, @var{f}, @var{c}] =} mode (@dots{}) -## Compute the most frequently occurring value in a dataset (mode). +## Compute the most frequently occurring value in a dataset (mode). ## @code{mode} determines the frequency of values along the first non-singleton -## dimension and returns the value with the highest frequency. If two, or +## dimension and returns the value with the highest frequency. If two, or ## more, values have the same frequency @code{mode} returns the smallest. -## +## ## If the optional argument @var{dim} is given, operate along this dimension. ## ## The return variable @var{f} is the number of occurrences of the mode in
--- a/scripts/statistics/base/moment.m +++ b/scripts/statistics/base/moment.m @@ -156,7 +156,7 @@ dim = 1; endif else - if (!(isscalar (dim) && dim == fix (dim)) || + if (!(isscalar (dim) && dim == fix (dim)) || !(1 <= dim && dim <= nd)) error ("moment: DIM must be an integer and a valid dimension"); endif
--- a/scripts/statistics/base/ols.m +++ b/scripts/statistics/base/ols.m @@ -56,7 +56,7 @@ ## @var{beta} is calculated directly via @code{inv (x'*x) * x' * y} if the ## matrix @code{x'*x} is of full rank. ## @end ifnottex -## Otherwise, @code{@var{beta} = pinv (@var{x}) * @var{y}} where +## Otherwise, @code{@var{beta} = pinv (@var{x}) * @var{y}} where ## @code{pinv (@var{x})} denotes the pseudoinverse of @var{x}. ## ## @item sigma
--- a/scripts/statistics/base/prctile.m +++ b/scripts/statistics/base/prctile.m @@ -22,15 +22,15 @@ ## For a sample @var{x}, compute the quantiles, @var{y}, corresponding ## to the cumulative probability values, @var{p}, in percent. All non-numeric ## values (NaNs) of @var{x} are ignored. -## +## ## If @var{x} is a matrix, compute the percentiles for each column and -## return them in a matrix, such that the i-th row of @var{y} contains the +## return them in a matrix, such that the i-th row of @var{y} contains the ## @var{p}(i)th percentiles of each column of @var{x}. -## +## ## The optional argument @var{dim} determines the dimension along which ## the percentiles are calculated. If @var{dim} is omitted, and @var{x} is ## a vector or matrix, it defaults to 1 (column-wise quantiles). When -## @var{x} is an N-d array, @var{dim} defaults to the first non-singleton +## @var{x} is an N-d array, @var{dim} defaults to the first non-singleton ## dimension. ## @seealso{quantile} ## @end deftypefn @@ -60,7 +60,7 @@ if (nd == 2) ## If a matrix or vector, use the 1st dimension. dim = 1; - else + else ## If an N-d array, find the first non-singleton dimension. dim = find (size(v) > 1, 1); if (isempty (dim)) @@ -68,7 +68,7 @@ endif endif else - if (!(isscalar (dim) && dim == fix (dim)) || + if (!(isscalar (dim) && dim == fix (dim)) || !(1 <= dim && dim <= nd)) error ("prctile: DIM must be an integer and a valid dimension"); endif
--- a/scripts/statistics/base/qqplot.m +++ b/scripts/statistics/base/qqplot.m @@ -82,10 +82,10 @@ q = feval (f, t, varargin{:}); if (nargin > 3) tmp = sprintf (", %g", varargin{2:end}); - else + else tmp = ""; endif - q_label = sprintf ("%s with parameter(s) %g%s", + q_label = sprintf ("%s with parameter(s) %g%s", func2str (f), varargin{1}, tmp); endif
--- a/scripts/statistics/base/quantile.m +++ b/scripts/statistics/base/quantile.m @@ -1,5 +1,5 @@ ## Copyright (C) 2008-2011 Ben Abbott and Jaroslav Hajek -## +## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it @@ -27,18 +27,18 @@ ## If @var{x} is a matrix, compute the quantiles for each column and ## return them in a matrix, such that the i-th row of @var{q} contains ## the @var{p}(i)th quantiles of each column of @var{x}. -## -## The optional argument @var{dim} determines the dimension along which +## +## The optional argument @var{dim} determines the dimension along which ## the quantiles are calculated. If @var{dim} is omitted, and @var{x} is -## a vector or matrix, it defaults to 1 (column-wise quantiles). If -## @var{x} is an N-d array, @var{dim} defaults to the first non-singleton +## a vector or matrix, it defaults to 1 (column-wise quantiles). If +## @var{x} is an N-d array, @var{dim} defaults to the first non-singleton ## dimension. -## +## ## The methods available to calculate sample quantiles are the nine methods ## used by R (http://www.r-project.org/). The default value is METHOD = 5. -## +## ## Discontinuous sample quantile methods 1, 2, and 3 -## +## ## @enumerate 1 ## @item Method 1: Inverse of empirical distribution function. ## @@ -46,37 +46,37 @@ ## ## @item Method 3: SAS definition: nearest even order statistic. ## @end enumerate -## +## ## Continuous sample quantile methods 4 through 9, where p(k) is the linear ## interpolation function respecting each methods' representative cdf. -## +## ## @enumerate 4 ## @item Method 4: p(k) = k / n. That is, linear interpolation of the ## empirical cdf. ## -## @item Method 5: p(k) = (k - 0.5) / n. That is a piecewise linear function -## where the knots are the values midway through the steps of the empirical -## cdf. +## @item Method 5: p(k) = (k - 0.5) / n. That is a piecewise linear function +## where the knots are the values midway through the steps of the empirical +## cdf. ## ## @item Method 6: p(k) = k / (n + 1). ## ## @item Method 7: p(k) = (k - 1) / (n - 1). ## -## @item Method 8: p(k) = (k - 1/3) / (n + 1/3). The resulting quantile -## estimates are approximately median-unbiased regardless of the distribution +## @item Method 8: p(k) = (k - 1/3) / (n + 1/3). The resulting quantile +## estimates are approximately median-unbiased regardless of the distribution ## of @var{x}. ## -## @item Method 9: p(k) = (k - 3/8) / (n + 1/4). The resulting quantile -## estimates are approximately unbiased for the expected order statistics if +## @item Method 9: p(k) = (k - 3/8) / (n + 1/4). The resulting quantile +## estimates are approximately unbiased for the expected order statistics if ## @var{x} is normally distributed. ## @end enumerate -## +## ## Hyndman and Fan (1996) recommend method 8. Maxima, S, and R ## (versions prior to 2.0.0) use 7 as their default. Minitab and SPSS ## use method 6. @sc{matlab} uses method 5. -## +## ## References: -## +## ## @itemize @bullet ## @item Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New ## S Language. Wadsworth & Brooks/Cole. @@ -103,7 +103,7 @@ p = [0.00 0.25, 0.50, 0.75, 1.00]; endif - if (!(isscalar (dim) && dim == fix (dim)) || + if (!(isscalar (dim) && dim == fix (dim)) || !(1 <= dim && dim <= ndims (x))) error ("quantile: DIM must be an integer and a valid dimension"); endif @@ -276,11 +276,11 @@ %!error quantile (1, 1, 0) %!error quantile (1, 1, 3) -## For the cumulative probability values in @var{p}, compute the +## For the cumulative probability values in @var{p}, compute the ## quantiles, @var{q} (the inverse of the cdf), for the sample, @var{x}. ## ## The optional input, @var{method}, refers to nine methods available in R -## (http://www.r-project.org/). The default is @var{method} = 7. For more +## (http://www.r-project.org/). The default is @var{method} = 7. For more ## detail, see `help quantile'. ## @seealso{prctile, quantile, statistics}
--- a/scripts/statistics/base/ranks.m +++ b/scripts/statistics/base/ranks.m @@ -77,10 +77,10 @@ len = diff (find (diff ([Inf; eq_el; -Inf]) != 1)) + 1; [eq_el, y] = sort (xi); for i = 1 : length(runs) - y (xi (runs (i) + [0:(len(i)-1)]) + floor (runs (i) ./ sz(1)) + y (xi (runs (i) + [0:(len(i)-1)]) + floor (runs (i) ./ sz(1)) * sz(1)) = eq_el(runs(i)) + (len(i) - 1) / 2; endfor - endif + endif if (dim != 1) y = permute (y, perm); endif
--- a/scripts/statistics/base/run_count.m +++ b/scripts/statistics/base/run_count.m @@ -20,8 +20,8 @@ ## @deftypefn {Function File} {} run_count (@var{x}, @var{n}) ## @deftypefnx {Function File} {} run_count (@var{x}, @var{n}, @var{dim}) ## Count the upward runs along the first non-singleton dimension of -## @var{x} of length 1, 2, @dots{}, @var{n}-1 and greater than or equal -## to @var{n}. +## @var{x} of length 1, 2, @dots{}, @var{n}-1 and greater than or equal +## to @var{n}. ## ## If the optional argument @var{dim} is given then operate ## along this dimension. @@ -43,7 +43,7 @@ if (!(isscalar (n) && n == fix (n) && n > 0)) error ("run_count: N must be a positive integer"); endif - + nd = ndims (x); sz = size (x); if (nargin != 3) @@ -71,7 +71,7 @@ for i = 1 : nd idx{i} = 1 : sz(i); endfor - c = sz(1); + c = sz(1); tmp = zeros ([c + 1, sz(2 : end)]); infvec = Inf ([1, sz(2 : end)]);
--- a/scripts/statistics/base/skewness.m +++ b/scripts/statistics/base/skewness.m @@ -80,7 +80,7 @@ ind = find (s > 0); x = sum (x .^ 3, dim); retval(ind) = x(ind) ./ (c * s(ind) .^ 3); - + endfunction %!assert(skewness ([-1,0,1]), 0);
--- a/scripts/statistics/base/statistics.m +++ b/scripts/statistics/base/statistics.m @@ -23,7 +23,7 @@ ## maximum, mean, standard deviation, skewness, and kurtosis of the elements of ## the vector @var{x}. ## -## If @var{x} is a matrix, calculate statistics over the first +## If @var{x} is a matrix, calculate statistics over the first ## non-singleton dimension. ## If the optional argument @var{dim} is given, operate along this dimension. ## @seealso{min,max,median,mean,std,skewness,kurtosis} @@ -56,10 +56,10 @@ error ("statistics: DIM must be an integer and a valid dimension"); endif endif - + if (sz(dim) < 2) error ("statistics: dimension of X is too small (<2)"); - endif + endif emp_inv = quantile (x, [0.25; 0.5; 0.75], dim, 7);
--- a/scripts/statistics/base/std.m +++ b/scripts/statistics/base/std.m @@ -38,20 +38,20 @@ ## @noindent ## where @math{N} is the number of elements. ## @end ifnottex -## +## ## If @var{x} is a matrix, compute the standard deviation for ## each column and return them in a row vector. ## -## The argument @var{opt} determines the type of normalization to use. +## The argument @var{opt} determines the type of normalization to use. ## Valid values are ## ## @table @asis ## @item 0: -## normalize with @math{N-1}, provides the square root of the best unbiased +## normalize with @math{N-1}, provides the square root of the best unbiased ## estimator of the variance [default] ## ## @item 1: -## normalize with @math{N}, this provides the square root of the second +## normalize with @math{N}, this provides the square root of the second ## moment around the mean ## @end table ##
--- a/scripts/statistics/base/studentize.m +++ b/scripts/statistics/base/studentize.m @@ -23,7 +23,7 @@ ## deviation. ## ## If @var{x} is a matrix, do the above along the first non-singleton -## dimension. +## dimension. ## If the optional argument @var{dim} is given, operate along this dimension. ## @seealso{center} ## @end deftypefn
--- a/scripts/statistics/base/var.m +++ b/scripts/statistics/base/var.m @@ -38,11 +38,11 @@ ## @end ifnottex ## If @var{x} is a matrix, compute the variance for each column ## and return them in a row vector. -## +## ## The argument @var{opt} determines the type of normalization to use. ## Valid values are ## -## @table @asis +## @table @asis ## @item 0: ## normalize with @math{N-1}, provides the best unbiased estimator of the ## variance [default]
--- a/scripts/statistics/distributions/betainv.m +++ b/scripts/statistics/distributions/betainv.m @@ -38,7 +38,7 @@ error ("betainv: X, A and B must be of common size or scalars"); endif endif - + sz = size (x); inv = zeros (sz);
--- a/scripts/statistics/distributions/betapdf.m +++ b/scripts/statistics/distributions/betapdf.m @@ -31,7 +31,7 @@ if (nargin != 3) print_usage (); endif - + if (!isscalar (a) || !isscalar(b)) [retval, x, a, b] = common_size (x, a, b); if (retval > 0) @@ -51,11 +51,11 @@ if (any (k)) if (isscalar(a) && isscalar(b)) pdf(k) = exp ((a - 1) .* log (x(k)) - + (b - 1) .* log (1 - x(k)) + + (b - 1) .* log (1 - x(k)) + lgamma(a + b) - lgamma(a) - lgamma(b)); else pdf(k) = exp ((a(k) - 1) .* log (x(k)) - + (b(k) - 1) .* log (1 - x(k)) + + (b(k) - 1) .* log (1 - x(k)) + lgamma(a(k) + b(k)) - lgamma(a(k)) - lgamma(b(k))); endif endif
--- a/scripts/statistics/distributions/betarnd.m +++ b/scripts/statistics/distributions/betarnd.m @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} betarnd (@var{a}, @var{b}, @var{r}, @var{c}) ## @deftypefnx {Function File} {} betarnd (@var{a}, @var{b}, @var{sz}) -## Return an @var{r} by @var{c} or @code{size (@var{sz})} matrix of +## Return an @var{r} by @var{c} or @code{size (@var{sz})} matrix of ## random samples from the Beta distribution with parameters @var{a} and ## @var{b}. Both @var{a} and @var{b} must be scalar or of size @var{r} ## by @var{c}. @@ -34,7 +34,7 @@ function rnd = betarnd (a, b, r, c) if (nargin > 1) - if (!isscalar(a) || !isscalar(b)) + if (!isscalar(a) || !isscalar(b)) [retval, a, b] = common_size (a, b); if (retval > 0) error ("betarnd: A and B must be of common size or scalar"); @@ -78,7 +78,7 @@ if (find (!(a > 0) | !(a < Inf) | !(b > 0) | !(b < Inf))) rnd = NaN (sz); else - r1 = randg(a,sz); + r1 = randg(a,sz); rnd = r1 ./ (r1 + randg(b,sz)); endif else @@ -91,7 +91,7 @@ k = find ((a > 0) & (a < Inf) & (b > 0) & (b < Inf)); if (any (k)) - r1 = randg(a(k),size(k)); + r1 = randg(a(k),size(k)); rnd(k) = r1 ./ (r1 + randg(b(k),size(k))); endif endif
--- a/scripts/statistics/distributions/binoinv.m +++ b/scripts/statistics/distributions/binoinv.m @@ -37,7 +37,7 @@ error ("binoinv: X, N and P must be of common size or scalars"); endif endif - + sz = size (x); inv = zeros (sz); @@ -61,7 +61,7 @@ break; endif endwhile - else + else cdf = binopdf (0, n(k), p(k)); while (any (inv(k) < n(k))) m = find (cdf < x(k));
--- a/scripts/statistics/distributions/binornd.m +++ b/scripts/statistics/distributions/binornd.m @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} binornd (@var{n}, @var{p}, @var{r}, @var{c}) ## @deftypefnx {Function File} {} binornd (@var{n}, @var{p}, @var{sz}) -## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of +## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of ## random samples from the binomial distribution with parameters @var{n} ## and @var{p}. Both @var{n} and @var{p} must be scalar or of size ## @var{r} by @var{c}. @@ -34,7 +34,7 @@ function rnd = binornd (n, p, r, c) if (nargin > 1) - if (!isscalar(n) || !isscalar(p)) + if (!isscalar(n) || !isscalar(p)) [retval, n, p] = common_size (n, p); if (retval > 0) error ("binornd: N and P must be of common size or scalar");
--- a/scripts/statistics/distributions/cauchy_cdf.m +++ b/scripts/statistics/distributions/cauchy_cdf.m @@ -21,7 +21,7 @@ ## For each element of @var{x}, compute the cumulative distribution ## function (CDF) at @var{x} of the Cauchy distribution with location ## parameter @var{location} and scale parameter @var{scale}. Default -## values are @var{location} = 0, @var{scale} = 1. +## values are @var{location} = 0, @var{scale} = 1. ## @end deftypefn ## Author: KH <Kurt.Hornik@wu-wien.ac.at> @@ -38,7 +38,7 @@ scale = 1; endif - if (!isscalar (location) || !isscalar (scale)) + if (!isscalar (location) || !isscalar (scale)) [retval, x, location, scale] = common_size (x, location, scale); if (retval > 0) error ("cauchy_cdf: X, LOCATION and SCALE must be of common size or scalar"); @@ -51,7 +51,7 @@ k = find ((x > -Inf) & (x < Inf) & (location > -Inf) & (location < Inf) & (scale > 0) & (scale < Inf)); if (any (k)) - if (isscalar (location) && isscalar (scale)) + if (isscalar (location) && isscalar (scale)) cdf(k) = 0.5 + atan ((x(k) - location) ./ scale) / pi; else cdf(k) = 0.5 + atan ((x(k) - location(k)) ./ scale(k)) / pi;
--- a/scripts/statistics/distributions/cauchy_inv.m +++ b/scripts/statistics/distributions/cauchy_inv.m @@ -21,7 +21,7 @@ ## For each element of @var{x}, compute the quantile (the inverse of the ## CDF) at @var{x} of the Cauchy distribution with location parameter ## @var{location} and scale parameter @var{scale}. Default values are -## @var{location} = 0, @var{scale} = 1. +## @var{location} = 0, @var{scale} = 1. ## @end deftypefn ## Author: KH <Kurt.Hornik@wu-wien.ac.at> @@ -38,7 +38,7 @@ scale = 1; endif - if (!isscalar (location) || !isscalar (scale)) + if (!isscalar (location) || !isscalar (scale)) [retval, x, location, scale] = common_size (x, location, scale); if (retval > 0) error ("cauchy_inv: X, LOCATION and SCALE must be of common size or scalar"); @@ -58,7 +58,7 @@ k = find ((x > 0) & (x < 1) & ok); if (any (k)) - if (isscalar (location) && isscalar (scale)) + if (isscalar (location) && isscalar (scale)) inv(k) = location - scale .* cot (pi * x(k)); else inv(k) = location(k) - scale(k) .* cot (pi * x(k));
--- a/scripts/statistics/distributions/cauchy_pdf.m +++ b/scripts/statistics/distributions/cauchy_pdf.m @@ -21,7 +21,7 @@ ## For each element of @var{x}, compute the probability density function ## (PDF) at @var{x} of the Cauchy distribution with location parameter ## @var{location} and scale parameter @var{scale} > 0. Default values are -## @var{location} = 0, @var{scale} = 1. +## @var{location} = 0, @var{scale} = 1. ## @end deftypefn ## Author: KH <Kurt.Hornik@wu-wien.ac.at> @@ -38,7 +38,7 @@ scale = 1; endif - if (!isscalar (location) || !isscalar (scale)) + if (!isscalar (location) || !isscalar (scale)) [retval, x, location, scale] = common_size (x, location, scale); if (retval > 0) error ("cauchy_pdf: X, LOCATION and SCALE must be of common size or scalar"); @@ -51,7 +51,7 @@ k = find ((x > -Inf) & (x < Inf) & (location > -Inf) & (location < Inf) & (scale > 0) & (scale < Inf)); if (any (k)) - if (isscalar (location) && isscalar (scale)) + if (isscalar (location) && isscalar (scale)) pdf(k) = ((1 ./ (1 + ((x(k) - location) ./ scale) .^ 2)) / pi ./ scale); else
--- a/scripts/statistics/distributions/cauchy_rnd.m +++ b/scripts/statistics/distributions/cauchy_rnd.m @@ -19,8 +19,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} cauchy_rnd (@var{location}, @var{scale}, @var{r}, @var{c}) ## @deftypefnx {Function File} {} cauchy_rnd (@var{location}, @var{scale}, @var{sz}) -## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of -## random samples from the Cauchy distribution with parameters @var{location} +## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of +## random samples from the Cauchy distribution with parameters @var{location} ## and @var{scale} which must both be scalar or of size @var{r} by @var{c}. ## ## If @var{r} and @var{c} are omitted, the size of the result matrix is @@ -33,7 +33,7 @@ function rnd = cauchy_rnd (location, scale, r, c) if (nargin > 1) - if (!isscalar (location) || !isscalar (scale)) + if (!isscalar (location) || !isscalar (scale)) [retval, location, scale] = common_size (location, scale); if (retval > 0) error ("cauchy_rnd: LOCATION and SCALE must be of common size or scalar"); @@ -75,7 +75,7 @@ print_usage (); endif - if (isscalar (location) && isscalar (scale)) + if (isscalar (location) && isscalar (scale)) if (find (!(location > -Inf) | !(location < Inf) | !(scale > 0) | !(scale < Inf))) rnd = NaN (sz); @@ -84,7 +84,7 @@ endif else rnd = NaN (sz); - k = find ((location > -Inf) & (location < Inf) + k = find ((location > -Inf) & (location < Inf) & (scale > 0) & (scale < Inf)); if (any (k)) rnd(k) = location(k)(:) - cot (pi * rand (size (k))) .* scale(k)(:);
--- a/scripts/statistics/distributions/chi2rnd.m +++ b/scripts/statistics/distributions/chi2rnd.m @@ -19,8 +19,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} chi2rnd (@var{n}, @var{r}, @var{c}) ## @deftypefnx {Function File} {} chi2rnd (@var{n}, @var{sz}) -## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of -## random samples from the chisquare distribution with @var{n} degrees +## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of +## random samples from the chisquare distribution with @var{n} degrees ## of freedom. @var{n} must be a scalar or of size @var{r} by @var{c}. ## ## If @var{r} and @var{c} are omitted, the size of the result matrix is
--- a/scripts/statistics/distributions/discrete_rnd.m +++ b/scripts/statistics/distributions/discrete_rnd.m @@ -73,5 +73,5 @@ error ("discrete_rnd: P must be a nonzero, nonnegative vector"); endif - rnd = v (lookup (cumsum (p (1 : end-1)) / sum(p), rand (sz)) + 1); + rnd = v (lookup (cumsum (p (1 : end-1)) / sum(p), rand (sz)) + 1); endfunction
--- a/scripts/statistics/distributions/exprnd.m +++ b/scripts/statistics/distributions/exprnd.m @@ -21,7 +21,7 @@ ## @deftypefnx {Function File} {} exprnd (@var{lambda}, @var{sz}) ## Return an @var{r} by @var{c} matrix of random samples from the ## exponential distribution with mean @var{lambda}, which must be a -## scalar or of size @var{r} by @var{c}. Or if @var{sz} is a vector, +## scalar or of size @var{r} by @var{c}. Or if @var{sz} is a vector, ## create a matrix of size @var{sz}. ## ## If @var{r} and @var{c} are omitted, the size of the result matrix is
--- a/scripts/statistics/distributions/fcdf.m +++ b/scripts/statistics/distributions/fcdf.m @@ -20,7 +20,7 @@ ## @deftypefn {Function File} {} fcdf (@var{x}, @var{m}, @var{n}) ## For each element of @var{x}, compute the CDF at @var{x} of the F ## distribution with @var{m} and @var{n} degrees of freedom, i.e., -## PROB (F (@var{m}, @var{n}) @leq{} @var{x}). +## PROB (F (@var{m}, @var{n}) @leq{} @var{x}). ## @end deftypefn ## Author: KH <Kurt.Hornik@wu-wien.ac.at> @@ -57,7 +57,7 @@ if (isscalar (m) && isscalar (n)) cdf(k) = 1 - betainc (1 ./ (1 + m .* x(k) ./ n), n / 2, m / 2); else - cdf(k) = 1 - betainc (1 ./ (1 + m(k) .* x(k) ./ n(k)), n(k) / 2, + cdf(k) = 1 - betainc (1 ./ (1 + m(k) .* x(k) ./ n(k)), n(k) / 2, m(k) / 2); endif endif
--- a/scripts/statistics/distributions/frnd.m +++ b/scripts/statistics/distributions/frnd.m @@ -22,7 +22,7 @@ ## Return an @var{r} by @var{c} matrix of random samples from the F ## distribution with @var{m} and @var{n} degrees of freedom. Both ## @var{m} and @var{n} must be scalar or of size @var{r} by @var{c}. -## If @var{sz} is a vector the random samples are in a matrix of +## If @var{sz} is a vector the random samples are in a matrix of ## size @var{sz}. ## ## If @var{r} and @var{c} are omitted, the size of the result matrix is @@ -35,7 +35,7 @@ function rnd = frnd (m, n, r, c) if (nargin > 1) - if (!isscalar(m) || !isscalar(n)) + if (!isscalar(m) || !isscalar(n)) [retval, m, n] = common_size (m, n); if (retval > 0) error ("frnd: M and N must be of common size or scalar"); @@ -85,7 +85,7 @@ rnd = 2 ./ m .* randg(m / 2, sz); endif if (! isinf (n)) - rnd = 0.5 .* n .* rnd ./ randg (n / 2, sz); + rnd = 0.5 .* n .* rnd ./ randg (n / 2, sz); endif elseif ((m > 0) && (m < Inf) && (n > 0) && (n < Inf)) rnd = n ./ m .* randg (m / 2, sz) ./ randg (n / 2, sz);
--- a/scripts/statistics/distributions/gamrnd.m +++ b/scripts/statistics/distributions/gamrnd.m @@ -19,9 +19,9 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} gamrnd (@var{a}, @var{b}, @var{r}, @var{c}) ## @deftypefnx {Function File} {} gamrnd (@var{a}, @var{b}, @var{sz}) -## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of +## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of ## random samples from the Gamma distribution with parameters @var{a} -## and @var{b}. Both @var{a} and @var{b} must be scalar or of size +## and @var{b}. Both @var{a} and @var{b} must be scalar or of size ## @var{r} by @var{c}. ## ## If @var{r} and @var{c} are omitted, the size of the result matrix is @@ -35,7 +35,7 @@ function rnd = gamrnd (a, b, r, c) if (nargin > 1) - if (!isscalar(a) || !isscalar(b)) + if (!isscalar(a) || !isscalar(b)) [retval, a, b] = common_size (a, b); if (retval > 0) error ("gamrnd: A and B must be of common size or scalar"); @@ -83,7 +83,7 @@ else rnd = b .* randg(a, sz); endif - else + else k = find (!(a > 0) | !(a < Inf) | !(b > 0) | !(b < Inf)); if (any (k)) rnd(k) = NaN;
--- a/scripts/statistics/distributions/lognrnd.m +++ b/scripts/statistics/distributions/lognrnd.m @@ -34,7 +34,7 @@ function rnd = lognrnd (mu, sigma, r, c) if (nargin > 1) - if (!isscalar(mu) || !isscalar(sigma)) + if (!isscalar(mu) || !isscalar(sigma)) [retval, mu, sigma] = common_size (mu, sigma); if (retval > 0) error ("lognrnd: MU and SIGMA must be of common size or scalar"); @@ -79,7 +79,7 @@ if (!(sigma > 0) || !(sigma < Inf)) rnd = NaN (sz); else - rnd = exp(mu + sigma .* randn (sz)); + rnd = exp(mu + sigma .* randn (sz)); endif else rnd = exp (mu + sigma .* randn (sz));
--- a/scripts/statistics/distributions/nbincdf.m +++ b/scripts/statistics/distributions/nbincdf.m @@ -35,13 +35,13 @@ print_usage (); endif - if (!isscalar(n) || !isscalar(p)) + if (!isscalar(n) || !isscalar(p)) [retval, x, n, p] = common_size (x, n, p); if (retval > 0) error ("nbincdf: X, N and P must be of common size or scalar"); endif endif - + cdf = zeros (size (x)); k = find (isnan (x) | (n < 1) | (n == Inf) | (n != round (n))
--- a/scripts/statistics/distributions/nbininv.m +++ b/scripts/statistics/distributions/nbininv.m @@ -36,7 +36,7 @@ print_usage (); endif - if (!isscalar(n) || !isscalar(p)) + if (!isscalar(n) || !isscalar(p)) [retval, x, n, p] = common_size (x, n, p); if (retval > 0) error ("nbininv: X, N and P must be of common size or scalar");
--- a/scripts/statistics/distributions/nbinpdf.m +++ b/scripts/statistics/distributions/nbinpdf.m @@ -24,7 +24,7 @@ ## ## The number of failures in a Bernoulli experiment with success ## probability @var{p} before the @var{n}-th success follows this -## distribution. +## distribution. ## @end deftypefn ## Author: KH <Kurt.Hornik@wu-wien.ac.at> @@ -36,7 +36,7 @@ print_usage (); endif - if (!isscalar(n) || !isscalar(p)) + if (!isscalar(n) || !isscalar(p)) [retval, x, n, p] = common_size (x, n, p); if (retval > 0) error ("nbinpdf: X, N and P must be of common size or scalar");
--- a/scripts/statistics/distributions/nbinrnd.m +++ b/scripts/statistics/distributions/nbinrnd.m @@ -24,7 +24,7 @@ ## Both @var{n} and @var{p} must be scalar or of size @var{r} by @var{c}. ## ## If @var{r} and @var{c} are omitted, the size of the result matrix is -## the common size of @var{n} and @var{p}. Or if @var{sz} is a vector, +## the common size of @var{n} and @var{p}. Or if @var{sz} is a vector, ## create a matrix of size @var{sz}. ## @end deftypefn @@ -34,7 +34,7 @@ function rnd = nbinrnd (n, p, r, c) if (nargin > 1) - if (!isscalar(n) || !isscalar(p)) + if (!isscalar(n) || !isscalar(p)) [retval, n, p] = common_size (n, p); if (retval > 0) error ("nbinrnd: N and P must be of common size or scalar");
--- a/scripts/statistics/distributions/normrnd.m +++ b/scripts/statistics/distributions/normrnd.m @@ -20,8 +20,8 @@ ## @deftypefn {Function File} {} normrnd (@var{m}, @var{s}, @var{r}, @var{c}) ## @deftypefnx {Function File} {} normrnd (@var{m}, @var{s}, @var{sz}) ## Return an @var{r} by @var{c} or @code{size (@var{sz})} matrix of -## random samples from the normal distribution with parameters mean @var{m} -## and standard deviation @var{s}. Both @var{m} and @var{s} must be scalar +## random samples from the normal distribution with parameters mean @var{m} +## and standard deviation @var{s}. Both @var{m} and @var{s} must be scalar ## or of size @var{r} by @var{c}. ## ## If @var{r} and @var{c} are omitted, the size of the result matrix is @@ -34,7 +34,7 @@ function rnd = normrnd (m, s, r, c) if (nargin > 1) - if (!isscalar (m) || !isscalar (s)) + if (!isscalar (m) || !isscalar (s)) [retval, m, s] = common_size (m, s); if (retval > 0) error ("normrnd: M and S must be of common size or scalar");
--- a/scripts/statistics/distributions/poissrnd.m +++ b/scripts/statistics/distributions/poissrnd.m @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} poissrnd (@var{lambda}, @var{r}, @var{c}) ## Return an @var{r} by @var{c} matrix of random samples from the -## Poisson distribution with parameter @var{lambda}, which must be a +## Poisson distribution with parameter @var{lambda}, which must be a ## scalar or of size @var{r} by @var{c}. ## ## If @var{r} and @var{c} are omitted, the size of the result matrix is
--- a/scripts/statistics/distributions/stdnormal_rnd.m +++ b/scripts/statistics/distributions/stdnormal_rnd.m @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} stdnormal_rnd (@var{r}, @var{c}) ## @deftypefnx {Function File} {} stdnormal_rnd (@var{sz}) -## Return an @var{r} by @var{c} or @code{size (@var{sz})} matrix of +## Return an @var{r} by @var{c} or @code{size (@var{sz})} matrix of ## random numbers from the standard normal distribution. ## @end deftypefn
--- a/scripts/statistics/distributions/tpdf.m +++ b/scripts/statistics/distributions/tpdf.m @@ -20,7 +20,7 @@ ## @deftypefn {Function File} {} tpdf (@var{x}, @var{n}) ## For each element of @var{x}, compute the probability density function ## (PDF) at @var{x} of the @var{t} (Student) distribution with @var{n} -## degrees of freedom. +## degrees of freedom. ## @end deftypefn ## Author: KH <Kurt.Hornik@wu-wien.ac.at>
--- a/scripts/statistics/distributions/trnd.m +++ b/scripts/statistics/distributions/trnd.m @@ -69,7 +69,7 @@ if (!(n > 0) || !(n < Inf)) rnd = NaN (sz); elseif ((n > 0) && (n < Inf)) - rnd = randn(sz) ./ sqrt(2*randg(n/2,sz)./n); + rnd = randn(sz) ./ sqrt(2*randg(n/2,sz)./n); else rnd = zeros (size (n)); endif @@ -83,7 +83,7 @@ k = find ((n > 0) & (n < Inf)); if (any (k)) - rnd(k) = randn(size(k)) ./ sqrt(2*randg(n(k)/2,size(k))./n(k)); + rnd(k) = randn(size(k)) ./ sqrt(2*randg(n(k)/2,size(k))./n(k)); endif endif
--- a/scripts/statistics/distributions/unifcdf.m +++ b/scripts/statistics/distributions/unifcdf.m @@ -57,7 +57,7 @@ if (any (k)) cdf(k) = 1; endif - + k = find ((x > a) & (x < b)); if (any (k)) if (isscalar (a) && isscalar(b))
--- a/scripts/statistics/distributions/unifrnd.m +++ b/scripts/statistics/distributions/unifrnd.m @@ -19,8 +19,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} unifrnd (@var{a}, @var{b}, @var{r}, @var{c}) ## @deftypefnx {Function File} {} unifrnd (@var{a}, @var{b}, @var{sz}) -## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of -## random samples from the uniform distribution on [@var{a}, @var{b}]. +## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of +## random samples from the uniform distribution on [@var{a}, @var{b}]. ## Both @var{a} and @var{b} must be scalar or of size @var{r} by @var{c}. ## ## If @var{r} and @var{c} are omitted, the size of the result matrix is @@ -33,7 +33,7 @@ function rnd = unifrnd (a, b, r, c) if (nargin > 1) - if (!isscalar(a) || !isscalar(b)) + if (!isscalar(a) || !isscalar(b)) [retval, a, b] = common_size (a, b); if (retval > 0) error ("unifrnd: A and B must be of common size or scalar");
--- a/scripts/statistics/distributions/wblrnd.m +++ b/scripts/statistics/distributions/wblrnd.m @@ -34,7 +34,7 @@ function rnd = wblrnd (scale, shape, r, c) if (nargin > 1) - if (!isscalar(scale) || !isscalar(shape)) + if (!isscalar(scale) || !isscalar(shape)) [retval, scale, shape] = common_size (scale, shape); if (retval > 0) error ("wblrnd: SCALE and SHAPE must be of common size or scalar");
--- a/scripts/statistics/tests/bartlett_test.m +++ b/scripts/statistics/tests/bartlett_test.m @@ -17,7 +17,7 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{pval}, @var{chisq}, @var{df}] =} bartlett_test (@var{x1}, @dots{}) +## @deftypefn {Function File} {[@var{pval}, @var{chisq}, @var{df}] =} bartlett_test (@var{x1}, @dots{}) ## Perform a Bartlett test for the homogeneity of variances in the data ## vectors @var{x1}, @var{x2}, @dots{}, @var{xk}, where @var{k} > 1. ##
--- a/scripts/statistics/tests/kolmogorov_smirnov_test_2.m +++ b/scripts/statistics/tests/kolmogorov_smirnov_test_2.m @@ -80,7 +80,7 @@ elems = [find(ds); n_x+n_y]; z = z(elems); endif - + if (strcmp (alt, "!=") || strcmp (alt, "<>")) d = max (abs (z)); ks = sqrt (n) * d;
--- a/scripts/statistics/tests/kruskal_wallis_test.m +++ b/scripts/statistics/tests/kruskal_wallis_test.m @@ -30,7 +30,7 @@ ## ## If the data contains ties (some value appears more than once) ## @var{k} is divided by -## +## ## 1 - @var{sum_ties} / (@var{n}^3 - @var{n}) ## ## where @var{sum_ties} is the sum of @var{t}^2 - @var{t} over each group
--- a/scripts/statistics/tests/t_test_regression.m +++ b/scripts/statistics/tests/t_test_regression.m @@ -31,7 +31,7 @@ ## @code{@var{rr} * @var{b} != @var{r}}. If @var{alt} is @code{">"}, the ## one-sided alternative @code{@var{rr} * @var{b} > @var{r}} is used. ## Similarly for @var{"<"}, the one-sided alternative @code{@var{rr} * -## @var{b} < @var{r}} is used. The default is the two-sided case. +## @var{b} < @var{r}} is used. The default is the two-sided case. ## ## The p-value of the test is returned in @var{pval}. ##
--- a/scripts/strings/blanks.m +++ b/scripts/strings/blanks.m @@ -26,7 +26,7 @@ ## whos ans; ## @result{} ## Attr Name Size Bytes Class -## ==== ==== ==== ===== ===== +## ==== ==== ==== ===== ===== ## ans 1x10 10 char ## @end group ## @end example
--- a/scripts/strings/dec2base.m +++ b/scripts/strings/dec2base.m @@ -81,7 +81,7 @@ elseif (base < 2 || base > length (symbols)) error ("dec2base: BASE must be between 2 and 36, or a string of symbols"); endif - + ## determine number of digits required to handle all numbers, can overflow ## by 1 digit max_len = round (log (max (max (d), 1)) ./ log (base)) + 1; @@ -89,7 +89,7 @@ if (nargin == 3) max_len = max (max_len, len); endif - + ## determine digits for each number digits = zeros (length (d), max_len); for k = max_len:-1:1
--- a/scripts/strings/dec2hex.m +++ b/scripts/strings/dec2hex.m @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} dec2hex (@var{d}, @var{len}) -## Return the hexadecimal string corresponding to the non-negative +## Return the hexadecimal string corresponding to the non-negative ## integer @var{d}. For example: ## ## @example
--- a/scripts/strings/findstr.m +++ b/scripts/strings/findstr.m @@ -60,22 +60,22 @@ s = t; t = tmp; endif - + l_s = length (s); l_t = length (t); - + if (l_t == 0) ## zero length target: return empty set v = []; - + elseif (l_t == 1) ## length one target: simple find v = find (s == t); - + elseif (l_t == 2) ## length two target: find first at i and second at i+1 v = find (s(1:l_s-1) == t(1) & s(2:l_s) == t(2)); - + else ## length three or more: match the first three by find then go through ## the much smaller list to determine which of them are real matches @@ -96,7 +96,7 @@ if (all (size (s) != size (t))) t = t.'; endif - + ## determine which ones to keep keep = zeros (size (v)); ind = 0:l_t-1; @@ -127,7 +127,7 @@ endif ## Always return a column vector, because that's what the old one did. - if (rows (v) > 1) + if (rows (v) > 1) v = v.'; endif
--- a/scripts/strings/index.m +++ b/scripts/strings/index.m @@ -82,7 +82,7 @@ %!assert(index("astringbstringcstring", "st"), 2) %!assert(index("astringbstringcstring", "str"), 2) %!assert(index("astringbstringcstring", "string"), 2) -%!assert(index("abc---", "abc+++"), 0) +%!assert(index("abc---", "abc+++"), 0) ## test everything out in reverse %!assert(index("astringbstringcstring", "s", "last"), 16)
--- a/scripts/strings/isstrprop.m +++ b/scripts/strings/isstrprop.m @@ -26,7 +26,7 @@ ## @result{} [1, 1, 1, 0, 0, 0] ## @end group ## @end example -## +## ## If @var{str} is a cell array, @code{isstrpop} is applied recursively ## to each element of the cell array. ## @@ -47,7 +47,7 @@ ## ## @item "upper" ## True for upper-case letters. -## +## ## @item "digit" ## True for decimal digits (0-9). ## @@ -58,7 +58,7 @@ ## @itemx "wspace" ## True for whitespace characters (space, formfeed, newline, carriage ## return, tab, vertical tab). -## +## ## @item "punct" ## True for punctuation characters (printing characters except space ## or letter or digit). @@ -75,7 +75,7 @@ ## ## @item "ascii" ## True for characters that are in the range of ASCII encoding. -## +## ## @end table ## ## @seealso{isalpha, isalnum, islower, isupper, isdigit, isxdigit,
--- a/scripts/strings/mat2str.m +++ b/scripts/strings/mat2str.m @@ -71,7 +71,7 @@ if (nargin < 1 || nargin > 3 || ! (isnumeric (x) || islogical (x))) print_usage (); endif - + if (ndims (x) > 2) error ("mat2str: X must be two dimensional"); endif
--- a/scripts/strings/regexptranslate.m +++ b/scripts/strings/regexptranslate.m @@ -26,7 +26,7 @@ ## @table @asis ## @item "wildcard" ## The wildcard characters @code{.}, @code{*} and @code{?} are replaced -## with wildcards that are appropriate for a regular expression. +## with wildcards that are appropriate for a regular expression. ## For example: ## ## @example @@ -35,7 +35,7 @@ ## @result{} ".*\.m" ## @end group ## @end example -## +## ## @item "escape" ## The characters @code{$.?[]}, that have special meaning for regular ## expressions are escaped so that they are treated literally. For example: @@ -52,11 +52,11 @@ ## @end deftypefn function y = regexptranslate (op, s) - + if nargin != 2 print_usage (); - endif - + endif + if (ischar (op)) op = tolower (op); if (strcmp ("wildcard", op))
--- a/scripts/strings/str2num.m +++ b/scripts/strings/str2num.m @@ -19,24 +19,24 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} str2num (@var{s}) ## Convert the string (or character array) @var{s} to a number (or an -## array). Examples: +## array). Examples: ## ## @example ## @group ## str2num("3.141596") ## @result{} 3.141596 -## +## ## str2num(["1, 2, 3"; "4, 5, 6"]); ## @result{} ans = ## 1 2 3 ## 4 5 6 ## @end group ## @end example -## +## ## @strong{Caution:} As @code{str2num} uses the @code{eval} function ## to do the conversion, @code{str2num} will execute any code contained ## in the string @var{s}. Use @code{str2double} instead if you want to -## avoid the use of @code{eval}. +## avoid the use of @code{eval}. ## @seealso{str2double, eval} ## @end deftypefn
--- a/scripts/strings/strchr.m +++ b/scripts/strings/strchr.m @@ -56,7 +56,7 @@ varargout = cell (1, nargout); varargout{1} = []; [varargout{:}] = find (mask, varargin{:}); -endfunction +endfunction %!assert(strchr("Octave is the best software",""),zeros(1,0)) %!assert(strchr("Octave is the best software","best"),[3, 6, 9, 11, 13, 15, 16, 17, 18, 20, 23, 27])
--- a/scripts/strings/strjust.m +++ b/scripts/strings/strjust.m @@ -21,7 +21,7 @@ ## @deftypefn {Function File} {} strjust (@var{s}, @var{pos}) ## Return the text, @var{s}, justified according to @var{pos}, which may ## be @samp{"left"}, @samp{"center"}, or @samp{"right"}. If @var{pos} -## is omitted, @samp{"right"} is assumed. +## is omitted, @samp{"right"} is assumed. ## ## Null characters are replaced by spaces. All other character ## data are treated as non-white space. @@ -88,7 +88,7 @@ mins(flipud (idx(:))) = flipud (jdx(:)); maxs = nc * ones (nr, 1); maxs(idx) = jdx; - shift = floor ((nc + 1 - maxs - mins) / 2); + shift = floor ((nc + 1 - maxs - mins) / 2); endif ## Adjust the column indices.
--- a/scripts/strings/strmatch.m +++ b/scripts/strings/strmatch.m @@ -25,7 +25,7 @@ ## strings. If the third argument @code{"exact"} is not given, then ## @var{s} only needs to match @var{A} up to the length of @var{s}. ## Trailing whitespace is ignored. -## Results are returned as a column vector. +## Results are returned as a column vector. ## For example: ## ## @example @@ -55,7 +55,7 @@ if (! ischar (s)) error ("strmatch: S must be a string"); endif - + ## Truncate trailing whitespace. s = strtrimr (s); @@ -89,8 +89,8 @@ else error ("strmatch: A must be a string or cell array of strings"); endif - -endfunction + +endfunction ## Removes nuls and blanks from the end of the array function s = strtrimr (s)
--- a/scripts/strings/strsplit.m +++ b/scripts/strings/strsplit.m @@ -51,10 +51,10 @@ sizes = [idx(1)-1, diff(idx)-1, numel(p)-idx(end)]; endif ## Remove separators. - p(idx) = []; + p(idx) = []; if (strip_empty) ## Omit zero lengths. - sizes = sizes (sizes != 0); + sizes = sizes (sizes != 0); endif ## Convert! s = mat2cell (p, 1, sizes);
--- a/scripts/strings/strtok.m +++ b/scripts/strings/strtok.m @@ -18,12 +18,12 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {[@var{tok}, @var{rem}] =} strtok (@var{str}, @var{delim}) -## +## ## Find all characters up to but not including the first character which ## is in the string delim. If @var{rem} is requested, it contains the ## remainder of the string, starting at the first delimiter. Leading ## delimiters are ignored. If @var{delim} is not specified, space is -## assumed. For example: +## assumed. For example: ## ## @example ## @group @@ -48,7 +48,7 @@ endif if (nargin < 2 || isempty (delim)) - delim = "\t\n\v\f\r "; + delim = "\t\n\v\f\r "; endif if (isempty (str)) @@ -58,14 +58,14 @@ len = length (str); while (start <= len) if (all (str(start) != delim)) - break; + break; endif start++; endwhile stop = start; while (stop <= len) if (any (str(stop) == delim)) - break; + break; endif stop++; endwhile @@ -112,7 +112,7 @@ %! printf("\n"); %! % ---------------------------------------------------- %! % Demonstrates processing of an entire string split on -%! % a variety of delimiters. Tokens and delimiters are +%! % a variety of delimiters. Tokens and delimiters are %! % printed one after another in angle brackets. The %! % string is: @@ -138,7 +138,7 @@ %!assert(strtok("this is", "i "), "th"); %!assert(strtok("this is", "ij "), "th"); -%!# test all cases for 4 delimiters since a different +%!# test all cases for 4 delimiters since a different %!# algorithm is used when more than 3 delimiters %!assert(strtok("","jkl "), ""); %!assert(strtok("this","jkl "), "this");
--- a/scripts/strings/untabify.m +++ b/scripts/strings/untabify.m @@ -1,17 +1,17 @@ ## Copyright (C) 2010-2011 Ben Abbott -## +## ## 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 2 of the License, or (at +## the Free Software Foundation; either version 2 of the License, or (at ## your option) any later version. -## +## ## This program 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 ## <http://www.gnu.org/licenses/>.
--- a/scripts/testfun/assert.m +++ b/scripts/testfun/assert.m @@ -36,12 +36,12 @@ ## arguments are passed to the @code{error} function. ## ## @item assert (@var{observed}, @var{expected}) -## Produce an error if observed is not the same as expected. Note that -## observed and expected can be strings, scalars, vectors, matrices, +## Produce an error if observed is not the same as expected. Note that +## observed and expected can be strings, scalars, vectors, matrices, ## lists or structures. ## ## @item assert(@var{observed}, @var{expected}, @var{tol}) -## Accept a tolerance when comparing numbers. +## Accept a tolerance when comparing numbers. ## If @var{tol} is positive use it as an absolute tolerance, will produce an ## error if ## @code{abs(@var{observed} - @var{expected}) > abs(@var{tol})}. @@ -75,7 +75,7 @@ else error (varargin{:}); endif - endif + endif else if (nargin < 2 || nargin > 3) print_usage (); @@ -197,7 +197,7 @@ elseif (tol >= 0) err = max (abs (A - B)); errtype = "maximum absolute error %g exceeds tolerance %g"; - else + else abserr = max (abs (A(B == 0))); A = A(B != 0); B = B(B != 0); @@ -285,9 +285,9 @@ %!error assert(3, 3+2*eps, eps); ## must give a little space for floating point errors on relative -%!assert(100+100*eps, 100, -2*eps); +%!assert(100+100*eps, 100, -2*eps); %!assert(100, 100+100*eps, -2*eps); -%!error assert(100+300*eps, 100, -2*eps); +%!error assert(100+300*eps, 100, -2*eps); %!error assert(100, 100+300*eps, -2*eps); %!error assert(3, [3,3]); %!error assert(3,4);
--- a/scripts/testfun/demo.m +++ b/scripts/testfun/demo.m @@ -19,12 +19,12 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} demo ('@var{name}', @var{n}) ## -## Runs any examples associated with the function '@var{name}'. -## Examples are stored in the script file, or in a file with the same -## name but no extension somewhere on your path. To keep them separate +## Runs any examples associated with the function '@var{name}'. +## Examples are stored in the script file, or in a file with the same +## name but no extension somewhere on your path. To keep them separate ## from the usual script code, all lines are prefixed by @code{%!}. Each ## example is introduced by the keyword 'demo' flush left to the prefix, -## with no intervening spaces. The remainder of the example can contain +## with no intervening spaces. The remainder of the example can contain ## arbitrary Octave code. For example: ## ## @example
--- a/scripts/testfun/example.m +++ b/scripts/testfun/example.m @@ -20,12 +20,12 @@ ## @deftypefn {Function File} {} example ('@var{name}', @var{n}) ## @deftypefnx {Function File} {[@var{x}, @var{idx}] =} example ('@var{name}', @var{n}) ## -## Display the code for example @var{n} associated with the function -## '@var{name}', but do not run it. If @var{n} is not given, all examples +## Display the code for example @var{n} associated with the function +## '@var{name}', but do not run it. If @var{n} is not given, all examples ## are displayed. ## ## Called with output arguments, the examples are returned in the form of -## a string @var{x}, with @var{idx} indicating the ending position of the +## a string @var{x}, with @var{idx} indicating the ending position of the ## various examples. ## ## See @code{demo} for a complete explanation. @@ -86,7 +86,7 @@ %!assert (example('example',1), "\n example('example');"); %!test %! [code, idx] = example('example'); -%! assert (code, ... +%! assert (code, ... %! "\n example('example');\n t=0:0.01:2*pi; x=sin(t);\n plot(t,x)") %! assert (idx, [1, 22, 59]);
--- a/scripts/testfun/fail.m +++ b/scripts/testfun/fail.m @@ -28,7 +28,7 @@ ## is a string and if @var{code} runs successfully, the error produced is: ## ## @example -## expected error but got none +## expected error but got none ## @end example ## ## If the code fails with a different error, the message produced is: @@ -42,8 +42,8 @@ ## ## The angle brackets are not part of the output. ## -## Called with three arguments, the behavior is similar to -## @code{fail(@var{code}, @var{pattern})}, but produces an error if no +## Called with three arguments, the behavior is similar to +## @code{fail(@var{code}, @var{pattern})}, but produces an error if no ## warning is given during code execution or if the code fails. ## ## @end deftypefn @@ -72,7 +72,7 @@ ## allow assert(fail()) if (nargout) ret = 1; - endif + endif if (test_warning) ## Perform the warning test. @@ -89,7 +89,7 @@ err = lastwarn (); warning (state.state, "quiet"); if (isempty (err)) - msg = sprintf ("expected warning <%s> but got none", pattern); + msg = sprintf ("expected warning <%s> but got none", pattern); else ## Transform "warning: ...\n" to "...". err([1:9, end]) = []; @@ -105,7 +105,7 @@ err([1:7, end]) = []; msg = sprintf ("expected warning <%s> but got error <%s>", pattern, err); end_try_catch - + else ## Perform the error test. try
--- a/scripts/testfun/speed.m +++ b/scripts/testfun/speed.m @@ -20,9 +20,9 @@ ## @deftypefn {Function File} {} speed (@var{f}, @var{init}, @var{max_n}, @var{f2}, @var{tol}) ## @deftypefnx {Function File} {[@var{order}, @var{n}, @var{T_f}, @var{T_f2}] =} speed (@dots{}) ## -## Determine the execution time of an expression (@var{f}) for various input +## Determine the execution time of an expression (@var{f}) for various input ## values (@var{n}). The @var{n} are log-spaced from 1 to @var{max_n}. For -## each @var{n}, an initialization expression (@var{init}) is computed to +## each @var{n}, an initialization expression (@var{init}) is computed to ## create any data needed for the test. If a second expression (@var{f2}) is ## given then the execution times of the two expressions are compared. When ## called without output arguments the results are displayed graphically. @@ -33,15 +33,15 @@ ## ## @item @var{max_n} ## The maximum test length to run. Default value is 100. Alternatively, -## use @code{[min_n, max_n]} or specify the @var{n} exactly with +## use @code{[min_n, max_n]} or specify the @var{n} exactly with ## @code{[n1, n2, @dots{}, nk]}. ## ## @item @var{init} -## Initialization expression for function argument values. Use @var{k} +## Initialization expression for function argument values. Use @var{k} ## for the test number and @var{n} for the size of the test. This should ## compute values for all variables used by @var{f}. Note that @var{init} will ## be evaluated first for @math{k = 0}, so things which are constant throughout -## the test series can be computed once. The default value is +## the test series can be computed once. The default value is ## @code{@var{x} = randn (@var{n}, 1)}. ## ## @item @var{f2} @@ -76,9 +76,9 @@ ## power is plotted for the region over which it is approximated ## (the latter half of the graph). The estimated power is not ## very accurate, but should be sufficient to determine the -## general order of an algorithm. It should indicate if, for -## example, the implementation is unexpectedly @math{O(n^2)} -## rather than @math{O(n)} because it extends a vector each +## general order of an algorithm. It should indicate if, for +## example, the implementation is unexpectedly @math{O(n^2)} +## rather than @math{O(n)} because it extends a vector each ## time through the loop rather than pre-allocating storage. ## In the current version of Octave, the following is not the ## expected @math{O(n)}. @@ -97,7 +97,7 @@ ## @end group ## @end example ## -## An attempt is made to approximate the cost of individual +## An attempt is made to approximate the cost of individual ## operations, but it is wildly inaccurate. You can improve the ## stability somewhat by doing more work for each @code{n}. For ## example: @@ -108,8 +108,8 @@ ## ## When comparing two different expressions (@var{f}, @var{f2}), the slope ## of the line on the speedup ratio graph should be larger than 1 if the new -## expression is faster. Better algorithms have a shallow slope. Generally, -## vectorizing an algorithm will not change the slope of the execution +## expression is faster. Better algorithms have a shallow slope. Generally, +## vectorizing an algorithm will not change the slope of the execution ## time graph, but will shift it relative to the original. For ## example: ## @@ -119,9 +119,9 @@ ## "v = 0; for i = 1:length (x), v += x(i); end") ## @end group ## @end example -## +## ## The following is a more complex example. If there was an original version -## of @code{xcorr} using for loops and a second version using an FFT, then +## of @code{xcorr} using for loops and a second version using an FFT, then ## one could compare the run speed for various lags as follows, or for a fixed ## lag with varying vector lengths as follows: ## @@ -138,11 +138,11 @@ ## would compare their speed and their output values. Note that the ## FFT version is not exact, so we specify an acceptable tolerance on ## the comparison @code{100*eps}, and that the errors should be computed -## relatively, as @code{abs ((@var{x} - @var{y}) ./ @var{y})} rather than +## relatively, as @code{abs ((@var{x} - @var{y}) ./ @var{y})} rather than ## absolutely as @code{abs (@var{x} - @var{y})}. ## -## Type @code{example('speed')} to see some real examples. Note that for -## obscure reasons, examples 1 and 2 can not be run directly using +## Type @code{example('speed')} to see some real examples. Note that for +## obscure reasons, examples 1 and 2 can not be run directly using ## @code{demo('speed')}. Instead use, @code{eval ( example('speed', 1) )} ## or @code{eval ( example('speed', 2) )}. ## @end deftypefn @@ -207,7 +207,7 @@ for k = 1:length (__test_n) n = __test_n(k); eval (cstrcat (__init, ";")); - + printf ("n%i = %i ",k, n); fflush (stdout); eval (cstrcat ("__t = time();", __f1, "; __v1=ans; __t = time()-__t;")); @@ -230,7 +230,7 @@ endif endif endfor - + ## Drop times of zero. if (! isempty (__f2)) zidx = (__tnew < 100*eps | __torig < 100*eps); @@ -246,21 +246,21 @@ ## Approximate time complexity and return it if requested. tailidx = ceil(length(__test_n)/2):length(__test_n); p = polyfit (log (__test_n(tailidx)), log (__tnew(tailidx)), 1); - if (nargout > 0) + if (nargout > 0) __order.p = p(1); __order.a = exp (p(2)); endif ## Plot the data if no output is requested. doplot = (nargout == 0); - + if (doplot) figure; endif if (doplot && ! isempty (__f2)) subplot (1, 2, 1); - semilogx (__test_n, __torig./__tnew, + semilogx (__test_n, __torig./__tnew, cstrcat ("-*r;", strrep (__f1, ";", "."), "/", strrep (__f2, ";", "."), ";"), __test_n, __tnew./__torig, @@ -272,10 +272,10 @@ subplot (1, 2, 2); loglog (__test_n, __tnew*1000, - cstrcat ("*-g;", strrep (__f1, ";", "."), ";"), + cstrcat ("*-g;", strrep (__f1, ";", "."), ";"), __test_n, __torig*1000, cstrcat ("*-r;", strrep (__f2,";","."), ";")); - + xlabel ("test length"); ylabel ("best execution time (ms)"); title (cstrcat ("init: ", __init)); @@ -299,7 +299,7 @@ order = sprintf ("O(n^%g)", round (10*p(1))/10); v = polyval (p, log (__test_n(tailidx))); - loglog (__test_n(tailidx), exp(v)*1000, sprintf ("b;%s;", order)); + loglog (__test_n(tailidx), exp(v)*1000, sprintf ("b;%s;", order)); ## Get base time to 1 digit of accuracy. dt = exp (p(2)); @@ -317,7 +317,7 @@ ## Display nicely formatted complexity. printf ("\nFor %s:\n", __f1); printf (" asymptotic power: %s\n", order); - printf (" approximate time per operation: %s\n", time); + printf (" approximate time per operation: %s\n", time); endif
--- a/scripts/testfun/test.m +++ b/scripts/testfun/test.m @@ -26,7 +26,7 @@ ## @deftypefnx {Function File} {[@var{code}, @var{idx}] =} test ('@var{name}', 'grabdemo') ## ## Perform tests from the first file in the loadpath matching @var{name}. -## @code{test} can be called as a command or as a function. Called with +## @code{test} can be called as a command or as a function. Called with ## a single argument @var{name}, the tests are run interactively and stop ## after the first error is encountered. ## @@ -38,7 +38,7 @@ ## Don't report all the tests as they happen, just the errors. ## ## @item 'normal' -## Report all tests as they happen, but don't do tests which require +## Report all tests as they happen, but don't do tests which require ## user interaction. ## ## @item 'verbose' @@ -46,11 +46,11 @@ ## @end table ## ## The argument @var{fid} can be used to allow batch processing. Errors -## can be written to the already open file defined by @var{fid}, and +## can be written to the already open file defined by @var{fid}, and ## hopefully when Octave crashes this file will tell you what was happening ## when it did. You can use @code{stdout} if you want to see the results as ## they happen. You can also give a file name rather than an @var{fid}, in -## which case the contents of the file will be replaced with the log from +## which case the contents of the file will be replaced with the log from ## the current test. ## ## Called with a single output argument @var{success}, @code{test} returns @@ -88,7 +88,7 @@ __flag = "quiet"; endif if (nargin < 3) - __fid = []; + __fid = []; endif if (nargin < 1 || nargin > 3 || (! ischar (__name) && ! isempty (__name)) || ! ischar (__flag)) @@ -206,9 +206,9 @@ else ## Add a dummy comment block to the end for ease of indexing. if (__body (length(__body)) == "\n") - __body = sprintf ("\n%s#", __body); + __body = sprintf ("\n%s#", __body); else - __body = sprintf ("\n%s\n#", __body); + __body = sprintf ("\n%s\n#", __body); endif endif @@ -289,7 +289,7 @@ endif ## Code already processed. __code = ""; - + ### SHARED elseif (strcmp (__type, "shared")) @@ -304,13 +304,13 @@ __vars = __code (1:__idx(1)-1); __code = __code (__idx(1):length(__code)); endif - + ## Strip comments off the variables. __idx = find (__vars == "%" | __vars == "#"); if (! isempty (__idx)) __vars = __vars(1:__idx(1)-1); endif - + ## Assign default values to variables. try __vars = deblank (__vars); @@ -333,9 +333,9 @@ ## Clear shared function definitions. eval (__clear, ""); __clear = ""; - + ## Initialization code will be evaluated below. - + ### FUNCTION elseif (strcmp (__type, "function")) @@ -359,7 +359,7 @@ end_try_catch endif __code = ""; - + ### ASSERT/FAIL elseif (strcmp (__type, "assert") || strcmp (__type, "fail")) @@ -367,7 +367,7 @@ ## Put the keyword back on the code. __code = __block; ## The code will be evaluated below as a test block. - + ### ERROR/WARNING elseif (strcmp (__type, "error") || strcmp(__type, "warning")) @@ -387,7 +387,7 @@ __msg = sprintf ("%stest failed: syntax error\n%s", __signal_fail, __error_text__); end_try_catch - + if (__success) __success = 0; __warnstate = warning ("query", "quiet"); @@ -440,7 +440,7 @@ endif ## Code already processed. __code = ""; - + ### TESTIF elseif (strcmp (__type, "testif")) @@ -491,12 +491,12 @@ __success = 0; endif if (isempty (__error_text__)) - error ("empty error text, probably Ctrl-C --- aborting"); + error ("empty error text, probably Ctrl-C --- aborting"); endif end_try_catch clear __test__; endif - + ## All done. Remember if we were successful and print any messages. if (! isempty (__msg)) ## Make sure the user knows what caused the error. @@ -511,7 +511,7 @@ if (! strcmp (__type, "error") && ! strcmp (__type, "testif") && ! all (__shared == " ")) fputs (__fid, "shared variables "); - eval (sprintf ("fdisp(__fid,bundle(%s));", __shared)); + eval (sprintf ("fdisp(__fid,bundle(%s));", __shared)); fflush (__fid); endif endif @@ -551,7 +551,7 @@ __ret1 = __demo_code; __ret2 = __demo_idx; elseif (nargout == 1) - __ret1 = __all_success; + __ret1 = __all_success; else __ret1 = __successes; __ret2 = __tests; @@ -595,7 +595,7 @@ function [pattern, id, rest] = getpattern (str) pattern = "."; id = []; - rest = str; + rest = str; str = trimleft (str); if (! isempty (str) && str(1) == "<") close = index (str, ">"); @@ -685,14 +685,14 @@ %!test assert (isempty (kron ([], []))) %!shared A, B %!test -%! A = [1, 2, 3; 4, 5, 6]; +%! A = [1, 2, 3; 4, 5, 6]; %! B = [1, -1; 2, -2]; %!assert (size (kron (zeros (3, 0), A)), [ 3*rows(A), 0 ]) %!assert (size (kron (zeros (0, 3), A)), [ 0, 3*columns(A) ]) %!assert (size (kron (A, zeros (3, 0))), [ 3*rows(A), 0 ]) %!assert (size (kron (A, zeros (0, 3))), [ 0, 3*columns(A) ]) %!assert (kron (pi, e), pi*e) -%!assert (kron (pi, A), pi*A) +%!assert (kron (pi, A), pi*A) %!assert (kron (A, e), e*A) %!assert (kron ([1, 2, 3], A), [ A, 2*A, 3*A ]) %!assert (kron ([1; 2; 3], A), [ A; 2*A; 3*A ]) @@ -702,7 +702,7 @@ %! assert (kron (A, B), res) ### an extended demo from specgram -%!#demo +%!#demo %! ## Speech spectrogram %! [x, Fs] = auload(file_in_loadpath("sample.wav")); # audio file %! step = fix(5*Fs/1000); # one spectral slice every 5 ms @@ -740,7 +740,7 @@ %!## test of shared variables %!shared a # create a shared variable %!test a=3; # assign to a shared variable -%!test assert(a,3) # variable should equal 3 +%!test assert(a,3) # variable should equal 3 %!shared b,c # replace shared variables %!test assert (!exist("a")); # a no longer exists %!test assert (isempty(b)); # variables start off empty @@ -769,7 +769,7 @@ %! z = 3*y; %!test # Test a test function with multiple returns %! [x,z] = __test_a(3); -%! assert(x,6); +%! assert(x,6); %! assert(z,9); %!## test of assert block @@ -801,12 +801,12 @@ % !error "succeeds."; # error test fails if code succeeds % !error <wrong pattern> error("message") # error pattern must match % !demo with syntax error # syntax errors in demo fail properly -% !shared a,b,c +% !shared a,b,c % !demo # shared variables not available in demo % ! assert(exist("a")) -% !error +% !error % ! test('/etc/passwd'); % ! test("nonexistent file"); -% ! ## These don't signal an error, so the test for an error fails. Note +% ! ## These don't signal an error, so the test for an error fails. Note % ! ## that the call doesn't reference the current fid (it is unavailable), % ! ## so of course the informational message is not printed in the log.
--- a/scripts/time/datenum.m +++ b/scripts/time/datenum.m @@ -24,7 +24,7 @@ ## @deftypefnx {Function File} {} datenum (@code{"date"}) ## @deftypefnx {Function File} {} datenum (@code{"date"}, @var{p}) ## Returns the specified local time as a day number, with Jan 1, 0000 -## being day 1. By this reckoning, Jan 1, 1970 is day number 719529. +## being day 1. By this reckoning, Jan 1, 1970 is day number 719529. ## The fractional portion, @var{p}, corresponds to the portion of the ## specified day. ## @@ -53,8 +53,8 @@ ## @strong{Warning:} this function does not attempt to handle Julian ## calendars so dates before Octave 15, 1582 are wrong by as much ## as eleven days. Also be aware that only Roman Catholic countries -## adopted the calendar in 1582. It took until 1924 for it to be -## adopted everywhere. See the Wikipedia entry on the Gregorian +## adopted the calendar in 1582. It took until 1924 for it to be +## adopted everywhere. See the Wikipedia entry on the Gregorian ## calendar for more details. ## ## @strong{Warning:} leap seconds are ignored. A table of leap seconds @@ -94,7 +94,7 @@ day = year(:,3); month = year(:,2); year = year(:,1); - endif + endif endif month(month<1) = 1; ## For compatibility. Otherwise allow negative months.
--- a/scripts/time/datestr.m +++ b/scripts/time/datestr.m @@ -236,7 +236,7 @@ df = strrep (df, "HH", "%H"); else df = strrep (df, "HH", sprintf ("%2d", v(i,4))); - endif + endif df = regexprep (df, '[Yy][Yy][Yy][Yy]', "%Y");
--- a/scripts/time/datetick.m +++ b/scripts/time/datetick.m @@ -151,7 +151,7 @@ N = 3; if (xmax - xmin < N) ## Day scale or less - if (xmax - xmin < N / 24 / 60 / 60) + if (xmax - xmin < N / 24 / 60 / 60) scl = 1 / 24 / 60 / 60; elseif (xmax - xmin < N / 24 / 6) scl = 1 / 24 / 60; @@ -167,10 +167,10 @@ else [ymin, mmin, dmin] = datevec (xmin); [ymax, mmax, dmax] = datevec (xmax); - minyear = ymin + (mmin - 1) / 12 + (dmin - 1) / 12 / 30; - maxyear = ymax + (mmax - 1) / 12 + (dmax - 1) / 12 / 30; - minmonth = mmin + (dmin - 1) / 30; - maxmonth = (ymax - ymin) * 12 + mmax + (dmax - 1) / 30; + minyear = ymin + (mmin - 1) / 12 + (dmin - 1) / 12 / 30; + maxyear = ymax + (mmax - 1) / 12 + (dmax - 1) / 12 / 30; + minmonth = mmin + (dmin - 1) / 30; + maxmonth = (ymax - ymin) * 12 + mmax + (dmax - 1) / 30; if (maxmonth - minmonth < N) sep = __calc_tick_sep__ (xmin, xmax); @@ -223,7 +223,7 @@ sticks = strvcat (datestr (ticks(1:end-1) - ticks(1) + startdate, form), datestr (ticks(end) - ticks(1) + startdate, form)); else - sticks = strvcat (datestr (ticks(1:end-1), form), + sticks = strvcat (datestr (ticks(1:end-1), form), datestr (ticks(end), form)); endif else @@ -240,7 +240,7 @@ if (keeplimits) set (gca(), strcat (ax, "ticklabel"), sticks); else - set (gca(), strcat (ax, "ticklabel"), sticks, strcat (ax, "lim"), + set (gca(), strcat (ax, "ticklabel"), sticks, strcat (ax, "lim"), [min(ticks), max(ticks)]); endif else
--- a/scripts/time/datevec.m +++ b/scripts/time/datevec.m @@ -62,7 +62,7 @@ std_formats{++nfmt} = "HH:MM"; # 15 std_formats{++nfmt} = "HH:MM PM"; # 16 std_formats{++nfmt} = "mm/dd/yyyy"; # 23 - std_formats{++nfmt} = "mmm-dd-yyyy HH:MM:SS"; + std_formats{++nfmt} = "mmm-dd-yyyy HH:MM:SS"; std_formats{++nfmt} = "mmm-dd-yyyy"; std_formats{++nfmt} = "dd mmm yyyy HH:MM:SS"; std_formats{++nfmt} = "dd mmm yyyy";