Mercurial > hg > octave-nkf
changeset 14337:a8a2d5def558
maint: merge away extra head on default branch
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 05 Feb 2012 23:37:36 -0500 |
parents | 34af9f9ff98b (diff) 82a3127af11c (current diff) |
children | 4687ecec0586 |
files | |
diffstat | 129 files changed, 720 insertions(+), 500 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/general/accumarray.m +++ b/scripts/general/accumarray.m @@ -68,11 +68,11 @@ ## @var{x} = [91, 92, 90, 92, 90, 89, 91, 89, 90, 100, 100, 100]; ## [@var{u}, ~, @var{j}] = unique (@var{x}); ## [accumarray(@var{j}', 1), @var{u}'] -## @result{} 2 89 -## 3 90 -## 2 91 -## 2 92 -## 3 100 +## @result{} 2 89 +## 3 90 +## 2 91 +## 2 92 +## 3 100 ## @end group ## @end example ## @@ -87,7 +87,7 @@ ## 2, 1, 2; ## 2, 3, 2], 101:105) ## @result{} ans(:,:,1) = [101, 0, 0; 0, 0, 0] -## ans(:,:,2) = [0, 0, 0; 206, 0, 208] +## @result{} ans(:,:,2) = [0, 0, 0; 206, 0, 208] ## @end group ## @end example ##
--- a/scripts/general/accumdim.m +++ b/scripts/general/accumdim.m @@ -50,7 +50,7 @@ ## -12, 2, 8; ## -10, 9, -3; ## -5, -3, -13]) -## @result{} ans = [-10,-11,-1;-15,-3,5] +## @result{} [-10,-11,-1;-15,-3,5] ## @end group ## @end example ##
--- a/scripts/general/bitcmp.m +++ b/scripts/general/bitcmp.m @@ -23,12 +23,12 @@ ## ## @example ## @group -## bitcmp(7,4) -## @result{} 8 -## dec2bin(11) -## @result{} 1011 -## dec2bin(bitcmp(11, 6)) -## @result{} 110100 +## bitcmp (7,4) +## @result{} 8 +## dec2bin (11) +## @result{} 1011 +## dec2bin (bitcmp (11, 6)) +## @result{} 110100 ## @end group ## @end example ## @seealso{bitand, bitor, bitxor, bitset, bitget, bitcmp, bitshift, bitmax}
--- a/scripts/general/bitset.m +++ b/scripts/general/bitset.m @@ -26,7 +26,7 @@ ## @example ## @group ## dec2bin (bitset (10, 1)) -## @result{} 1011 +## @result{} 1011 ## @end group ## @end example ## @seealso{bitand, bitor, bitxor, bitget, bitcmp, bitshift, bitmax}
--- a/scripts/general/celldisp.m +++ b/scripts/general/celldisp.m @@ -25,16 +25,16 @@ ## @example ## @group ## c = @{1, 2, @{31, 32@}@}; -## celldisp(c, "b") -## @result{} -## b@{1@} = -## 1 -## b@{2@} = -## 2 -## b@{3@}@{1@} = -## 31 -## b@{3@}@{2@} = -## 32 +## celldisp (c, "b") +## @result{} +## b@{1@} = +## 1 +## b@{2@} = +## 2 +## b@{3@}@{1@} = +## 31 +## b@{3@}@{2@} = +## 32 ## @end group ## @end example ##
--- a/scripts/general/chop.m +++ b/scripts/general/chop.m @@ -25,9 +25,9 @@ ## @example ## @group ## chop (-pi, 5, 10) -## @result{} -3.14200000000000 +## @result{} -3.14200000000000 ## chop (-pi, 5, 5) -## @result{} -3.14150000000000 +## @result{} -3.14150000000000 ## @end group ## @end example ## @end deftypefn
--- a/scripts/general/colon.m +++ b/scripts/general/colon.m @@ -24,8 +24,8 @@ ## ## @example ## @group -## a = myclass (@dots{}) -## b = myclass (@dots{}) +## a = myclass (@dots{}); +## b = myclass (@dots{}); ## c = a : b ## @end group ## @end example
--- a/scripts/general/flipdim.m +++ b/scripts/general/flipdim.m @@ -27,8 +27,8 @@ ## @example ## @group ## flipdim ([1, 2; 3, 4], 2) -## @result{} 2 1 -## 4 3 +## @result{} 2 1 +## 4 3 ## @end group ## @end example ## @seealso{fliplr, flipud, rot90, rotdim}
--- a/scripts/general/genvarname.m +++ b/scripts/general/genvarname.m @@ -30,7 +30,7 @@ ## @group ## x = 3.141; ## genvarname ("x", who ()) -## @result{} x1 +## @result{} x1 ## @end group ## @end example ## @@ -40,11 +40,11 @@ ## @example ## @group ## genvarname (@{"foo", "foo"@}) -## @result{} -## @{ -## [1,1] = foo -## [1,2] = foo1 -## @} +## @result{} +## @{ +## [1,1] = foo +## [1,2] = foo1 +## @} ## @end group ## @end example ## @@ -55,8 +55,8 @@ ## @example ## @group ## name = genvarname ("x"); -## eval([name " = 42"]); -## @result{} x = 42 +## eval ([name " = 42"]); +## @result{} x = 42 ## @end group ## @end example ## @@ -68,13 +68,12 @@ ## for i = 1:3 ## x.(genvarname ("a", fieldnames (x))) = i; ## endfor -## @result{} -## x = -## @{ -## a = 1 -## a1 = 2 -## a2 = 3 -## @} +## @result{} x = +## @{ +## a = 1 +## a1 = 2 +## a2 = 3 +## @} ## @end group ## @end example ##
--- a/scripts/general/idivide.m +++ b/scripts/general/idivide.m @@ -52,13 +52,13 @@ ## @example ## @group ## idivide (int8 ([-3, 3]), int8 (4), "fix") -## @result{} int8 ([0, 0]) +## @result{} int8 ([0, 0]) ## idivide (int8 ([-3, 3]), int8 (4), "round") -## @result{} int8 ([-1, 1]) +## @result{} int8 ([-1, 1]) ## idivide (int8 ([-3, 3]), int8 (4), "floor") -## @result{} int8 ([-1, 0]) +## @result{} int8 ([-1, 0]) ## idivide (int8 ([-3, 3]), int8 (4), "ceil") -## @result{} int8 ([0, 1]) +## @result{} int8 ([0, 1]) ## @end group ## @end example ##
--- a/scripts/general/int2str.m +++ b/scripts/general/int2str.m @@ -23,7 +23,6 @@ ## ## @example ## @group -## ## int2str (123) ## @result{} "123" ##
--- a/scripts/general/interp1.m +++ b/scripts/general/interp1.m @@ -87,7 +87,7 @@ ## near = interp1 (xp, yp, xf, "nearest"); ## plot (xf, yf, "r", xf, lin, "g", xf, spl, "b", ## xf, cub, "c", xf, near, "m", xp, yp, "r*"); -## legend ("original", "linear", "spline", "cubic", "nearest") +## legend ("original", "linear", "spline", "cubic", "nearest"); ## @end group ## @end example ##
--- a/scripts/general/quadgk.m +++ b/scripts/general/quadgk.m @@ -42,7 +42,7 @@ ## weaken the singularities. For example: ## ## @example -## quadgk(@@(x) 1 ./ (sqrt (x) .* (x + 1)), 0, Inf) +## quadgk (@@(x) 1 ./ (sqrt (x) .* (x + 1)), 0, Inf) ## @end example ## ## @noindent @@ -89,7 +89,7 @@ ## computation, or both. For example, ## ## @example -## quadgk (@@(x) abs (1 - x.^2), 0, 2, 'Waypoints', 1) +## quadgk (@@(x) abs (1 - x.^2), 0, 2, "Waypoints", 1) ## @end example ## ## @noindent
--- a/scripts/general/randi.m +++ b/scripts/general/randi.m @@ -40,7 +40,7 @@ ## The following example returns 150 integers in the range 1-10. ## ## @example -## ri = randi (10, 150, 1); +## ri = randi (10, 150, 1) ## @end example ## ## Implementation Note: @code{randi} relies internally on @code{rand} which
--- a/scripts/general/rat.m +++ b/scripts/general/rat.m @@ -25,9 +25,9 @@ ## ## @example ## @group -## rat(pi) = 3 + 1/(7 + 1/16) = 355/113 -## rat(e) = 3 + 1/(-4 + 1/(2 + 1/(5 + 1/(-2 + 1/(-7))))) -## = 1457/536 +## rat (pi) = 3 + 1/(7 + 1/16) = 355/113 +## rat (e) = 3 + 1/(-4 + 1/(2 + 1/(5 + 1/(-2 + 1/(-7))))) +## = 1457/536 ## @end group ## @end example ##
--- a/scripts/general/rot90.m +++ b/scripts/general/rot90.m @@ -28,8 +28,8 @@ ## @example ## @group ## rot90 ([1, 2; 3, 4], -1) -## @result{} 3 1 -## 4 2 +## @result{} 3 1 +## 4 2 ## @end group ## @end example ##
--- a/scripts/general/saveobj.m +++ b/scripts/general/saveobj.m @@ -30,7 +30,7 @@ ## function b = saveobj (a) ## b = a; ## if (isempty (b.field)) -## b.field = initfield(b); +## b.field = initfield (b); ## endif ## endfunction ## @end group
--- a/scripts/general/shiftdim.m +++ b/scripts/general/shiftdim.m @@ -36,12 +36,12 @@ ## @group ## x = ones (1, 2, 3); ## size (shiftdim (x, -1)) -## @result{} [1, 1, 2, 3] +## @result{} [1, 1, 2, 3] ## size (shiftdim (x, 1)) -## @result{} [2, 3] -## [b, ns] = shiftdim (x); -## @result{} b = [1, 1, 1; 1, 1, 1] -## @result{} ns = 1 +## @result{} [2, 3] +## [b, ns] = shiftdim (x) +## @result{} b = [1, 1, 1; 1, 1, 1] +## @result{} ns = 1 ## @end group ## @end example ## @seealso {reshape, permute, ipermute, circshift, squeeze}
--- a/scripts/general/structfun.m +++ b/scripts/general/structfun.m @@ -47,7 +47,7 @@ ## s.name2 = "Jill Jones"; ## structfun (@@(x) regexp (x, '(\w+)$', "matches")@{1@}, s, ## "UniformOutput", false) -## @result{} +## @result{} ## @{ ## name1 = Smith ## name2 = Jones
--- a/scripts/general/subsindex.m +++ b/scripts/general/subsindex.m @@ -28,7 +28,7 @@ ## @example ## @group ## function b = myclass (a) -## b = class (struct ("a", a), "myclass"); +## b = class (struct ("a", a), "myclass"); ## endfunction ## @end group ## @end example @@ -39,7 +39,7 @@ ## @example ## @group ## function idx = subsindex (a) -## idx = double (a.a) - 1.0; +## idx = double (a.a) - 1.0; ## endfunction ## @end group ## @end example
--- a/scripts/geometry/voronoi.m +++ b/scripts/geometry/voronoi.m @@ -42,12 +42,12 @@ ## ## @example ## @group -## x = rand (10, 1); -## y = rand (size (x)); -## h = convhull (x, y); -## [vx, vy] = voronoi (x, y); -## plot (vx, vy, "-b", x, y, "o", x(h), y(h), "-g") -## legend ("", "points", "hull"); +## x = rand (10, 1); +## y = rand (size (x)); +## h = convhull (x, y); +## [vx, vy] = voronoi (x, y); +## plot (vx, vy, "-b", x, y, "o", x(h), y(h), "-g"); +## legend ("", "points", "hull"); ## @end group ## @end example ##
--- a/scripts/help/__makeinfo__.m +++ b/scripts/help/__makeinfo__.m @@ -41,7 +41,7 @@ ## will be expanded to the text ## ## @example -## See also: arg1, arg2@, ... +## See also: arg1, arg2, ... ## @end example ## ## @noindent
--- a/scripts/io/dlmwrite.m +++ b/scripts/io/dlmwrite.m @@ -40,6 +40,7 @@ ## ## In addition, the following keyword value pairs may appear at the end ## of the argument list: +## ## @table @asis ## @item "append" ## Either @samp{"on"} or @samp{"off"}. See @samp{"-append"} above. @@ -49,9 +50,9 @@ ## ## @item "newline" ## The character(s) to use to separate each row. Three special cases -## exist for this option. @samp{"unix"} is changed into '\n', -## @samp{"pc"} is changed into '\r\n', and @samp{"mac"} is changed -## into '\r'. Other values for this option are kept as is. +## exist for this option. @samp{"unix"} is changed into "\n", +## @samp{"pc"} is changed into "\r\n", and @samp{"mac"} is changed +## into "\r". Other values for this option are kept as is. ## ## @item "roffset" ## See @var{r} above.
--- a/scripts/io/strread.m +++ b/scripts/io/strread.m @@ -34,6 +34,7 @@ ## The string @var{format} describes how the words in @var{str} should be ## parsed. ## It may contain any combination of the following specifiers: +## ## @table @code ## @item %s ## The word is parsed as a string. @@ -84,6 +85,7 @@ ## ## Optional numeric argument @var{format_repeat} can be used for ## limiting the number of items read: +## ## @table @asis ## @item -1 ## (default) read all of the string until the end. @@ -91,7 +93,6 @@ ## @item N ## Read N times @var{nargout} items. 0 (zero) is an acceptable ## value for @var{format_repeat}. -## ## @end table ## ## The behavior of @code{strread} can be changed via property-value @@ -439,14 +440,13 @@ iwrd = 1; iwrdp = 0; iwrdl = length (words{iwrd}); for ii = 1:numel (fmt_words) + nxt_wrd = 0; + if (idf(ii)) ## Literal expected if (isempty (strfind (fmt_words{ii}, words(iwrd)))) ## Not found in current word; supposed to be in next word - ++iwrd; iwrdp = 0; - if (ii < numel (fmt_words)) - iwrdl = length (words{iwrd}); - endif + nxt_wrd = 1; else ## Found it in current word. Subtract literal length iwrdp += length (fmt_words{ii}); @@ -455,34 +455,28 @@ warning ("strread: literal '%s' (fmt spec # %d) does not match data", ... fmt_words{ii}, ii); ## Word assumed to be completely "used up". Next word - ++iwrd; iwrdp = 0; - if (ii < numel (fmt_words)) - iwrdl = length (words{iwrd}); - endif + nxt_wrd = 1; elseif (iwrdp == iwrdl) ## Word completely "used up". Next word - ++iwrd; iwrdp = 0; - if (ii < numel (fmt_words)) - iwrdl = length (words{iwrd}); - endif + nxt_wrd = 1; endif endif elseif (idg(ii)) ## Fixed width specifier (%N or %*N): read just a part of word - iwrdp += floor ... - (str2double (fmt_words{ii}(regexp(fmt_words{ii}, '\d') : end-1))); - if (iwrdp > iwrdl) - ## Match error. Field extends beyond word boundary. - warning ... - ("strread: field width '%s' (fmt spec # %d) extends beyond actual word limit", ... - fmt_words{ii}, ii); - ## Assume word to be completely "used up". Next word - ++iwrd; iwrdp = 0; iwrdl = length (words{iwrd}); - elseif (iwrdp == iwrdl) - ## Word completely "used up". Next word - ++iwrd; iwrdp = 0; iwrdl = length (words{iwrd}); - endif + iwrdp += floor ... + (str2double (fmt_words{ii}(regexp(fmt_words{ii}, '\d') : end-1))); + if (iwrdp > iwrdl) + ## Match error. Field extends beyond word boundary. + warning ... + ("strread: field width '%s' (fmt spec # %d) extends beyond actual word limit", ... + fmt_words{ii}, ii); + ## Assume word to be completely "used up". Next word + nxt_wrd = 1; + elseif (iwrdp == iwrdl) + ## Word completely "used up". Next word + nxt_wrd = 1; + endif else ## A simple format conv. specifier. Either (1) uses rest of word, or @@ -492,20 +486,25 @@ ## Next fmt_word is a literal... if (! index (words{iwrd}(iwrdp+1:end), fmt_words{ii+1})) ## ...but not found in current word => field uses rest of word - ++iwrd; iwrdp = 0; iwrdl = length (words{iwrd}); + nxt_wrd = 1; else ## ..or it IS found. Add inferred width of current conversion field iwrdp += index (words{iwrd}(iwrdp+1:end), fmt_words{ii+1}) - 1; endif elseif (iwrdp < iwrdl) ## No bordering literal to the right => field occupies (rest of) word - ++iwrd; iwrdp = 0; - if (ii < numel (fmt_words)) - iwrdl = length (words{iwrd}); - endif + nxt_wrd = 1; endif endif + + if (nxt_wrd) + ++iwrd; iwrdp = 0; + if (ii < numel (fmt_words)) + iwrdl = length (words{iwrd}); + endif + endif + endfor ## Done words_period = max (iwrd - 1, 1); @@ -670,7 +669,7 @@ k++; case "s" if (pad_out) - data(end+1:num_lines) = {""} + data(end+1:num_lines) = {""}; endif varargout{k} = strtrunc (data, swidth)'; k++;
--- a/scripts/linear-algebra/expm.m +++ b/scripts/linear-algebra/expm.m @@ -28,7 +28,7 @@ ## @ifnottex ## ## @example -## expm(A) = I + A + A^2/2! + A^3/3! + @dots{} +## expm (A) = I + A + A^2/2! + A^3/3! + @dots{} ## @end example ## ## @end ifnottex
--- a/scripts/linear-algebra/logm.m +++ b/scripts/linear-algebra/logm.m @@ -26,7 +26,7 @@ ## implementation utilizes a Pad@'e approximant and the identity ## ## @example -## logm(@var{A}) = 2^k * logm(@var{A}^(1 / 2^k)) +## logm (@var{A}) = 2^k * logm (@var{A}^(1 / 2^k)) ## @end example ## ## The optional argument @var{opt_iters} is the maximum number of square roots
--- a/scripts/linear-algebra/qzhess.m +++ b/scripts/linear-algebra/qzhess.m @@ -37,8 +37,8 @@ ## The Hessenberg-triangular decomposition is the first step in ## Moler and Stewart's QZ@tie{}decomposition algorithm. ## -## Algorithm taken from Golub and Van Loan, @cite{Matrix Computations, 2nd -## edition}. +## Algorithm taken from Golub and Van Loan, +## @cite{Matrix Computations, 2nd edition}. ## @end deftypefn ## Author: A. S. Hodel <scotte@eng.auburn.edu>
--- a/scripts/miscellaneous/bincoeff.m +++ b/scripts/miscellaneous/bincoeff.m @@ -42,7 +42,7 @@ ## @example ## @group ## bincoeff (5, 2) -## @result{} 10 +## @result{} 10 ## @end group ## @end example ##
--- a/scripts/miscellaneous/computer.m +++ b/scripts/miscellaneous/computer.m @@ -27,10 +27,10 @@ ## @example ## @group ## computer () -## @print{} i586-pc-linux-gnu +## @print{} i586-pc-linux-gnu ## ## x = computer () -## @result{} x = "i586-pc-linux-gnu" +## @result{} x = "i586-pc-linux-gnu" ## @end group ## @end example ##
--- a/scripts/miscellaneous/dir.m +++ b/scripts/miscellaneous/dir.m @@ -33,7 +33,7 @@ ## @end example ## ## @noindent -## in which @code{statinfo} is the structure returned from @code{stat}. +## where @code{statinfo} is the structure returned from @code{stat}. ## ## If @var{directory} is not a directory, return information about the ## named @var{filename}. @var{directory} may be a list of directories @@ -41,7 +41,7 @@ ## which will be expanded with glob. ## ## Note that for symbolic links, @code{dir} returns information about -## the file that a symbolic link points to instead of the link itself. +## the file that the symbolic link points to instead of the link itself. ## However, if the link points to a nonexistent file, @code{dir} returns ## information about the link. ## @seealso{ls, stat, lstat, readdir, glob, filesep}
--- a/scripts/miscellaneous/getfield.m +++ b/scripts/miscellaneous/getfield.m @@ -25,7 +25,7 @@ ## @group ## ss(1,2).fd(3).b = 5; ## getfield (ss, @{1,2@}, "fd", @{3@}, "b") -## @result{} ans = 5 +## @result{} 5 ## @end group ## @end example ## @@ -36,7 +36,7 @@ ## @group ## i1 = @{1,2@}; i2 = "fd"; i3 = @{3@}; i4= "b"; ## ss(i1@{:@}).(i2)(i3@{:@}).(i4) -## @result{} ans = 5 +## @result{} 5 ## ## @end group ## @end example
--- a/scripts/miscellaneous/mkoctfile.m +++ b/scripts/miscellaneous/mkoctfile.m @@ -124,16 +124,16 @@ ## ## @example ## @group -## .c C source -## .cc C++ source -## .C C++ source -## .cpp C++ source -## .f Fortran source (fixed form) -## .F Fortran source (fixed form) -## .f90 Fortran source (free form) -## .F90 Fortran source (free form) -## .o object file -## .a library file +## .c C source +## .cc C++ source +## .C C++ source +## .cpp C++ source +## .f Fortran source (fixed form) +## .F Fortran source (fixed form) +## .f90 Fortran source (free form) +## .F90 Fortran source (free form) +## .o object file +## .a library file ## @end group ## @end example ##
--- a/scripts/miscellaneous/orderfields.m +++ b/scripts/miscellaneous/orderfields.m @@ -38,7 +38,7 @@ ## @example ## @group ## s = struct("d", 4, "b", 2, "a", 1, "c", 3); -## t1 = orderfields(s) +## t1 = orderfields (s) ## @result{} t1 = ## @{ ## a = 1 @@ -49,7 +49,7 @@ ## @end group ## @group ## t = struct("d", @{@}, "c", @{@}, "b", "a", @{@}); -## t2 = orderfields(s, t) +## t2 = orderfields (s, t) ## @result{} t2 = ## @{ ## d = 4 @@ -59,7 +59,7 @@ ## @} ## @end group ## @group -## t3 = orderfields(s, [3, 2, 4, 1]); +## t3 = orderfields (s, [3, 2, 4, 1]); ## @result{} t3 = ## @{ ## a = 1 @@ -69,18 +69,19 @@ ## @} ## @end group ## @group -## [t4, p] = orderfields(s, @{"d", "c", "b", "a"@}) -## @result{} t4 = @{ +## [t4, p] = orderfields (s, @{"d", "c", "b", "a"@}) +## @result{} t4 = +## @{ ## d = 4 ## c = 3 ## b = 2 ## a = 1 ## @} -## p = -## 1 -## 4 -## 2 -## 3 +## p = +## 1 +## 4 +## 2 +## 3 ## @end group ## @end example ##
--- a/scripts/miscellaneous/substruct.m +++ b/scripts/miscellaneous/substruct.m @@ -24,7 +24,7 @@ ## ## @example ## @group -## idx = substruct("()", @{3, ":"@}) +## idx = substruct ("()", @{3, ":"@}) ## @result{} ## idx = ## @{ @@ -36,9 +36,8 @@ ## @} ## @} ## x = [1, 2, 3; 4, 5, 6; 7, 8, 9]; -## subsref(x, idx) -## @result{} ans = -## 7 8 9 +## subsref (x, idx) +## @result{} 7 8 9 ## @end group ## @end example ## @seealso{subsref, subsasgn}
--- a/scripts/miscellaneous/warning_ids.m +++ b/scripts/miscellaneous/warning_ids.m @@ -65,7 +65,7 @@ ## ## @example ## @group -## while (c = getc()) +## while (c = getc ()) ## @dots{} ## @end group ## @end example @@ -93,7 +93,7 @@ ## ## @example ## @group -## while ((c = getc())) +## while ((c = getc ())) ## @dots{} ## @end group ## @end example @@ -213,7 +213,7 @@ ## @example ## @group ## [ "f", 111, 111 ] -## @result{} "foo" +## @result{} "foo" ## @end group ## @end example ## @@ -231,7 +231,7 @@ ## ## @example ## @group -## do_braindead_shortcircuit_evaluation(1) +## do_braindead_shortcircuit_evaluation (1) ## @end group ## @end example ## @@ -295,7 +295,7 @@ ## @example ## @group ## "abc" + 0 -## @result{} 97 98 99 +## @result{} 97 98 99 ## @end group ## @end example ##
--- a/scripts/optimization/qp.m +++ b/scripts/optimization/qp.m @@ -33,8 +33,8 @@ ## ## @example ## @group -## min 0.5 x'*H*x + x'*q -## x +## min 0.5 x'*H*x + x'*q +## x ## @end group ## @end example ## @@ -49,9 +49,9 @@ ## ## @example ## @group -## A*x = b -## lb <= x <= ub -## A_lb <= A_in*x <= A_ub +## A*x = b +## lb <= x <= ub +## A_lb <= A_in*x <= A_ub ## @end group ## @end example ##
--- a/scripts/optimization/sqp.m +++ b/scripts/optimization/sqp.m @@ -33,8 +33,8 @@ ## ## @example ## @group -## min phi (x) -## x +## min phi (x) +## x ## @end group ## @end example ## @@ -49,9 +49,9 @@ ## ## @example ## @group -## g(x) = 0 -## h(x) >= 0 -## lb <= x <= ub +## g(x) = 0 +## h(x) >= 0 +## lb <= x <= ub ## @end group ## @end example ## @@ -102,9 +102,9 @@ ## ## @example ## @group -## [ d f(x) d f(x) d f(x) ] -## transpose ( [ ------ ----- ... ------ ] ) -## [ dx_1 dx_2 dx_N ] +## [ d f(x) d f(x) d f(x) ] +## transpose ( [ ------ ----- ... ------ ] ) +## [ dx_1 dx_2 dx_N ] ## @end group ## @end example ## @@ -155,7 +155,7 @@ ## endfunction ## ## function obj = phi (x) -## obj = exp(prod(x)) - 0.5*(x(1)^3+x(2)^3+1)^2; +## obj = exp (prod (x)) - 0.5*(x(1)^3+x(2)^3+1)^2; ## endfunction ## ## x0 = [-1.8; 1.7; 1.9; -0.8; -0.8];
--- a/scripts/plot/bar.m +++ b/scripts/plot/bar.m @@ -66,8 +66,8 @@ ## ## @example ## @group -## bar (rand(10,3)) -## colormap (summer ()) +## bar (rand (10, 3)); +## colormap (summer (64)); ## @end group ## @end example ## @@ -77,7 +77,7 @@ ## ## @example ## @group -## h = bar (rand(10,3)) +## h = bar (rand (10, 3)); ## set (h(1), "facecolor", "r") ## set (h(2), "facecolor", "g") ## set (h(3), "facecolor", "b")
--- a/scripts/plot/clabel.m +++ b/scripts/plot/clabel.m @@ -48,8 +48,8 @@ ## ## @example ## @group -## [c, h] = contour (peaks(), -4 : 6); -## clabel (c, h, -4 : 2 : 6, 'fontsize', 12); +## [c, h] = contour (peaks (), -4 : 6); +## clabel (c, h, -4:2:6, "fontsize", 12); ## @end group ## @end example ##
--- a/scripts/plot/compass.m +++ b/scripts/plot/compass.m @@ -37,7 +37,7 @@ ## @example ## @group ## a = toeplitz ([1;randn(9,1)], [1,randn(1,9)]); -## compass (eig (a)) +## compass (eig (a)); ## @end group ## @end example ##
--- a/scripts/plot/contour3.m +++ b/scripts/plot/contour3.m @@ -34,8 +34,8 @@ ## @group ## contour3 (peaks (19)); ## hold on -## surface (peaks (19), "facecolor", "none", "EdgeColor", "black") -## colormap hot +## surface (peaks (19), "facecolor", "none", "EdgeColor", "black"); +## colormap hot; ## @end group ## @end example ##
--- a/scripts/plot/contourc.m +++ b/scripts/plot/contourc.m @@ -50,9 +50,8 @@ ## y = x; ## z = x' * y; ## contourc (x, y, z, 2:3) -## @result{} 2.0000 2.0000 1.0000 3.0000 1.5000 2.0000 -## 2.0000 1.0000 2.0000 2.0000 2.0000 1.5000 -## +## @result{} 2.0000 2.0000 1.0000 3.0000 1.5000 2.0000 +## 2.0000 1.0000 2.0000 2.0000 2.0000 1.5000 ## @end group ## @end example ## @seealso{contour}
--- a/scripts/plot/cylinder.m +++ b/scripts/plot/cylinder.m @@ -38,9 +38,9 @@ ## ## @example ## @group -## [x, y, z] = cylinder (10:-1:0,50); +## [x, y, z] = cylinder (10:-1:0, 50); ## surf (x, y, z); -## title ("a cone") +## title ("a cone"); ## @end group ## @end example ## @seealso{sphere}
--- a/scripts/plot/ezcontour.m +++ b/scripts/plot/ezcontour.m @@ -39,7 +39,7 @@ ## ## @example ## @group -## f = @@(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2); +## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2); ## ezcontour (f, [-3, 3]); ## @end group ## @end example
--- a/scripts/plot/ezcontourf.m +++ b/scripts/plot/ezcontourf.m @@ -39,7 +39,7 @@ ## ## @example ## @group -## f = @@(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2); +## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2); ## ezcontourf (f, [-3, 3]); ## @end group ## @end example
--- a/scripts/plot/ezmesh.m +++ b/scripts/plot/ezmesh.m @@ -49,7 +49,7 @@ ## ## @example ## @group -## f = @@(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2); +## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2); ## ezmesh (f, [-3, 3]); ## @end group ## @end example
--- a/scripts/plot/ezmeshc.m +++ b/scripts/plot/ezmeshc.m @@ -50,7 +50,7 @@ ## ## @example ## @group -## f = @@(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2); +## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2); ## ezmeshc (f, [-3, 3]); ## @end group ## @end example
--- a/scripts/plot/ezplot.m +++ b/scripts/plot/ezplot.m @@ -35,7 +35,7 @@ ## < 2*pi} with 60 by 60 in the mesh. For example: ## ## @example -## ezplot (@@(@var{x}, @var{y}) @var{x} .^ 2 - @var{y} .^ 2 - 1) +## ezplot (@@(@var{x}, @var{y}) @var{x}.^2 - @var{y}.^2 - 1) ## @end example ## ## If two functions are passed as strings, inline functions or function
--- a/scripts/plot/ezsurf.m +++ b/scripts/plot/ezsurf.m @@ -49,7 +49,7 @@ ## ## @example ## @group -## f = @@(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2); +## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2); ## ezsurf (f, [-3, 3]); ## @end group ## @end example @@ -58,9 +58,9 @@ ## ## @example ## @group -## fx = @@(s,t) cos (s) .* cos(t); -## fy = @@(s,t) sin (s) .* cos(t); -## fz = @@(s,t) sin(t); +## fx = @@(s,t) cos (s) .* cos (t); +## fy = @@(s,t) sin (s) .* cos (t); +## fz = @@(s,t) sin (t); ## ezsurf (fx, fy, fz, [-pi, pi, -pi/2, pi/2], 20); ## @end group ## @end example
--- a/scripts/plot/ezsurfc.m +++ b/scripts/plot/ezsurfc.m @@ -50,7 +50,7 @@ ## ## @example ## @group -## f = @@(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2); +## f = @@(x,y) sqrt (abs (x .* y)) ./ (1 + x.^2 + y.^2); ## ezsurfc (f, [-3, 3]); ## @end group ## @end example
--- a/scripts/plot/feather.m +++ b/scripts/plot/feather.m @@ -36,8 +36,8 @@ ## ## @example ## @group -## phi = [0 : 15 : 360] * pi / 180; -## feather (sin (phi), cos (phi)) +## phi = [0 : 15 : 360] * pi/180; +## feather (sin (phi), cos (phi)); ## @end group ## @end example ##
--- a/scripts/plot/findobj.m +++ b/scripts/plot/findobj.m @@ -19,44 +19,44 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{h} =} findobj () ## @deftypefnx {Function File} {@var{h} =} findobj (@var{prop_name}, @var{prop_value}) -## @deftypefnx {Function File} {@var{h} =} findobj ('-property', @var{prop_name}) -## @deftypefnx {Function File} {@var{h} =} findobj ('-regexp', @var{prop_name}, @var{pattern}) -## @deftypefnx {Function File} {@var{h} =} findobj ('flat', @dots{}) +## @deftypefnx {Function File} {@var{h} =} findobj ("-property", @var{prop_name}) +## @deftypefnx {Function File} {@var{h} =} findobj ("-regexp", @var{prop_name}, @var{pattern}) +## @deftypefnx {Function File} {@var{h} =} findobj ("flat", @dots{}) ## @deftypefnx {Function File} {@var{h} =} findobj (@var{h}, @dots{}) -## @deftypefnx {Function File} {@var{h} =} findobj (@var{h}, '-depth', @var{d}, @dots{}) +## @deftypefnx {Function File} {@var{h} =} findobj (@var{h}, "-depth", @var{d}, @dots{}) ## Find graphics object with specified property values. The simplest form is ## ## @example -## findobj (@var{prop_name}, @var{prop_Value}) +## findobj (@var{prop_name}, @var{prop_value}) ## @end example ## ## @noindent ## 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 +## @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 ## @code{findobj}. ## ## The depth of hierarchy of objects to which to search to can be limited -## with the '-depth' argument. To limit the number depth of the hierarchy +## with the "-depth" argument. To limit the number depth of the hierarchy ## to search to @var{d} generations of children, and example is ## ## @example -## findobj (@var{h}, '-depth', @var{d}, @var{prop_Name}, @var{prop_Value}) +## findobj (@var{h}, "-depth", @var{d}, @var{prop_name}, @var{prop_value}) ## @end example ## ## 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' +## passed in @var{h}. A depth @var{d} of 0 is equivalent to the "-flat" ## 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', -## '-xor', '-not'. +## 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", +## "-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 -## matched by property name only, using the '-property' option. +## (@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
--- a/scripts/plot/fplot.m +++ b/scripts/plot/fplot.m @@ -33,8 +33,8 @@ ## ## @example ## @group -## fplot ("cos", [0, 2*pi]) -## fplot ("[cos(x), sin(x)]", [0, 2*pi]) +## fplot ("cos", [0, 2*pi]) +## fplot ("[cos(x), sin(x)]", [0, 2*pi]) ## @end group ## @end example ## @seealso{plot}
--- a/scripts/plot/hist.m +++ b/scripts/plot/hist.m @@ -51,7 +51,7 @@ ## ## @example ## @group -## hist (randn (1, 100), 25, "facecolor", "r", "edgecolor", "b") +## hist (randn (1, 100), 25, "facecolor", "r", "edgecolor", "b"); ## @end group ## @end example ## @@ -60,8 +60,8 @@ ## ## @example ## @group -## hist (rand (10, 3)) -## colormap (summer ()) +## hist (rand (10, 3)); +## colormap (summer ()); ## @end group ## @end example ##
--- a/scripts/plot/isocolors.m +++ b/scripts/plot/isocolors.m @@ -50,43 +50,43 @@ ## ## @example ## function [] = isofinish (p) -## set (gca, "PlotBoxAspectRatioMode", "manual", \ -## "PlotBoxAspectRatio", [1 1 1]); +## set (gca, "PlotBoxAspectRatioMode", "manual", ... +## "PlotBoxAspectRatio", [1 1 1]); ## set (p, "FaceColor", "interp"); ## ## 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 +## 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); -## figure (); ## Open another figure window +## 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 +## 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 +## 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 +## 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 +## r = g = b = repmat ([1:N] / N, [N, 1, N]); # Black to white ## cdat = isocolors (x, y, z, r, g, b, v); ## set (p, "FaceVertexCData", cdat); ## isofinish (p);
--- a/scripts/plot/isonormals.m +++ b/scripts/plot/isonormals.m @@ -50,8 +50,8 @@ ## @smallexample ## function [] = isofinish (p) ## set (gca, "PlotBoxAspectRatioMode", "manual", ... -## "PlotBoxAspectRatio",[1 1 1]); -## set (p, "VertexNormals", -get(p,"VertexNormals")); # Revert normals +## "PlotBoxAspectRatio", [1 1 1]); +## set (p, "VertexNormals", -get (p,"VertexNormals")); # Revert normals ## set (p, "FaceColor", "interp"); ## ## set (p, "FaceLighting", "phong"); ## ## light ("Position", [1 1 5]); # Available with JHandles @@ -64,27 +64,27 @@ ## 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, cdat] = isosurface (x, y, z, c, iso, y); -## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, \ +## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ... ## "FaceColor", "interp", "EdgeColor", "none"); ## isofinish (p); ## Call user function isofinish ## -## subplot (2, 2, 2); view (-38, 20); -## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, \ +## subplot (2,2,2); view (-38, 20); +## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ... ## "FaceColor", "interp", "EdgeColor", "none"); ## isonormals (x, y, z, c, p); # Directly modify patch ## isofinish (p); ## -## subplot (2, 2, 3); view (-38, 20); -## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, \ +## subplot (2,2,3); view (-38, 20); +## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ... ## "FaceColor", "interp", "EdgeColor", "none"); ## n = isonormals (x, y, z, c, v); # Compute normals of isosurface ## set (p, "VertexNormals", n); # Manually set vertex normals ## isofinish (p); ## -## subplot (2, 2, 4); view (-38, 20); -## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, \ +## subplot (2,2,4); view (-38, 20); +## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", cdat, ... ## "FaceColor", "interp", "EdgeColor", "none"); ## isonormals (x, y, z, c, v, "negate"); # Use reverse directly ## isofinish (p);
--- a/scripts/plot/isosurface.m +++ b/scripts/plot/isosurface.m @@ -80,34 +80,34 @@ ## 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", ... +## set (gca, "PlotBoxAspectRatioMode", "manual", ... ## "PlotBoxAspectRatio", [1 1 1]); ## # set (p, "FaceColor", "green", "FaceLighting", "phong"); ## # light ("Position", [1 1 5]); # Available with the JHandles package ## -## subplot (2, 2, 2); view (-38, 20); +## subplot (2,2,2); view (-38, 20); ## p = patch ("Faces", f, "Vertices", v, "EdgeColor", "blue"); -## set (gca, "PlotBoxAspectRatioMode","manual", ... +## set (gca, "PlotBoxAspectRatioMode", "manual", ... ## "PlotBoxAspectRatio", [1 1 1]); ## # set (p, "FaceColor", "none", "FaceLighting", "phong"); ## # light ("Position", [1 1 5]); ## -## subplot (2, 2, 3); view (-38, 20); +## subplot (2,2,3); view (-38, 20); ## [f, v, c] = isosurface (x, y, z, c, iso, y); -## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", c, \ +## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", c, ... ## "FaceColor", "interp", "EdgeColor", "none"); -## set (gca, "PlotBoxAspectRatioMode","manual", ... +## set (gca, "PlotBoxAspectRatioMode", "manual", ... ## "PlotBoxAspectRatio", [1 1 1]); ## # set (p, "FaceLighting", "phong"); ## # light ("Position", [1 1 5]); ## -## subplot (2, 2, 4); view (-38, 20); -## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", c, \ +## subplot (2,2,4); view (-38, 20); +## p = patch ("Faces", f, "Vertices", v, "FaceVertexCData", c, ... ## "FaceColor", "interp", "EdgeColor", "blue"); -## set (gca, "PlotBoxAspectRatioMode","manual", ... +## set (gca, "PlotBoxAspectRatioMode", "manual", ... ## "PlotBoxAspectRatio", [1 1 1]); ## # set (p, "FaceLighting", "phong"); ## # light ("Position", [1 1 5]);
--- a/scripts/plot/linkprop.m +++ b/scripts/plot/linkprop.m @@ -28,9 +28,9 @@ ## @example ## @group ## x = 0:0.1:10; -## subplot (1, 2, 1); +## subplot (1,2,1); ## h1 = plot (x, sin (x)); -## subplot (1, 2, 2); +## subplot (1,2,2); ## h2 = plot (x, cos (x)); ## hlink = linkprop ([h1, h2], @{"color","linestyle"@}); ## set (h1, "color", "green");
--- a/scripts/plot/plot3.m +++ b/scripts/plot/plot3.m @@ -74,9 +74,9 @@ ## ## @example ## @group -## z = [0:0.05:5]; -## plot3 (cos(2*pi*z), sin(2*pi*z), z, ";helix;"); -## plot3 (z, exp(2i*pi*z), ";complex sinusoid;"); +## z = [0:0.05:5]; +## plot3 (cos (2*pi*z), sin (2*pi*z), z, ";helix;"); +## plot3 (z, exp (2i*pi*z), ";complex sinusoid;"); ## @end group ## @end example ## @seealso{plot, xlabel, ylabel, zlabel, title, print}
--- a/scripts/plot/plotmatrix.m +++ b/scripts/plot/plotmatrix.m @@ -54,9 +54,7 @@ ## the histogram and @var{pax} the corresponding axes objects. ## ## @example -## @group -## plotmatrix (randn (100, 3), 'g+') -## @end group +## plotmatrix (randn (100, 3), "g+") ## @end example ## ## @end deftypefn
--- a/scripts/plot/print.m +++ b/scripts/plot/print.m @@ -234,9 +234,9 @@ ## ## @example ## @group -## figure (1) -## clf () -## surf (peaks) +## figure (1); +## clf (); +## surf (peaks); ## print -dsvg figure1.svg ## @end group ## @end example @@ -245,9 +245,9 @@ ## ## @example ## @group -## figure (1) -## clf () -## surf (peaks) +## figure (1); +## clf (); +## surf (peaks); ## print -dcdj550 ## @end group ## @end example
--- a/scripts/plot/private/__marching_cube__.m +++ b/scripts/plot/private/__marching_cube__.m @@ -49,7 +49,7 @@ ## @example ## @group ## N = 20; -## lin = linspace(0, 2, N); +## lin = linspace (0, 2, N); ## [x, y, z] = meshgrid (lin, lin, lin); ## ## c = (x-.5).^2 + (y-.5).^2 + (z-.5).^2; @@ -70,11 +70,11 @@ ## "FaceColor", "interp", "EdgeColor", "none"); ## ## ## Revert normals -## set (pa, "VertexNormals", -get(pa, "VertexNormals")); +## set (pa, "VertexNormals", -get (pa, "VertexNormals")); ## ## ## Set lightning (available with the JHandles package) ## # set (pa, "FaceLighting", "gouraud"); -## # light( "Position", [1 1 5]); +## # light ( "Position", [1 1 5]); ## @end group ## @end example ##
--- a/scripts/plot/refreshdata.m +++ b/scripts/plot/refreshdata.m @@ -42,8 +42,8 @@ ## y = sin (x); ## plot (x, y, "ydatasource", "y"); ## for i = 1 : 100 -## pause (0.1) -## y = sin (x + 0.1 * i); +## pause (0.1); +## y = sin (x + 0.1*i); ## refreshdata (); ## endfor ## @end group
--- a/scripts/plot/rose.m +++ b/scripts/plot/rose.m @@ -39,7 +39,7 @@ ## ## @example ## @group -## [r, t] = rose ([2*randn(1e5,1), pi + 2 * randn(1e5,1)]); +## [r, t] = rose ([2*randn(1e5,1), pi + 2*randn(1e5,1)]); ## polar (r, t); ## @end group ## @end example
--- a/scripts/plot/saveas.m +++ b/scripts/plot/saveas.m @@ -50,10 +50,9 @@ ## ## @example ## @group -## figure (1); ## clf (); ## surf (peaks); -## saveas(1, "figure1.png"); +## saveas (1, "figure1.png"); ## @end group ## @end example ##
--- a/scripts/plot/semilogx.m +++ b/scripts/plot/semilogx.m @@ -112,11 +112,11 @@ %!test %! hf = figure ("visible", "off"); %! unwind_protect -%! a = logspace (-5, 1, 10); -%! b =-logspace (-5, 1, 10); +%! a =-logspace (-5, 1, 10); +%! b = logspace (-5, 1, 10); %! semilogx (a, b); %! axis tight; -%! assert (all (get (gca, "ytick") < 0)); +%! assert (all (get (gca, "xtick") < 0)); %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect
--- a/scripts/plot/stem.m +++ b/scripts/plot/stem.m @@ -39,7 +39,7 @@ ## @example ## @group ## x = 1:10; -## y = ones (1, length (x))*2.*x; +## y = 2*x; ## stem (x, y, "r"); ## @end group ## @end example @@ -55,7 +55,7 @@ ## ## @example ## @group -## x = [0 : 10]'; +## x = [0:10]'; ## y = [sin(x), cos(x)] ## h = stem (x, y); ## set (h(2), "color", "g"); @@ -64,7 +64,7 @@ ## @end example ## ## @noindent -## changes the color of the second "stem series" and moves the base line +## changes the color of the second "stem series" and moves the base line ## of the first. ## @seealso{bar, barh, plot} ## @end deftypefn
--- a/scripts/plot/subplot.m +++ b/scripts/plot/subplot.m @@ -56,7 +56,7 @@ ## the grid locations specified. The first demo illustrates an example: ## ## @example -## @code{demo ("subplot", 1)} +## demo ("subplot", 1) ## @end example ## ## @end ifnottex
--- a/scripts/plot/surfl.m +++ b/scripts/plot/surfl.m @@ -57,7 +57,7 @@ ## ## @example ## @group -## colormap (bone); +## colormap (bone (64)); ## surfl (peaks); ## shading interp; ## @end group
--- a/scripts/plot/surfnorm.m +++ b/scripts/plot/surfnorm.m @@ -27,8 +27,8 @@ ## ## @example ## @group -## [@var{x}, @var{y}] = meshgrid (1:size(@var{z}, 1), -## 1:size(@var{z}, 2)); +## [@var{x}, @var{y}] = meshgrid (1:size (@var{z}, 1), +## 1:size (@var{z}, 2)); ## @end group ## @end example ##
--- a/scripts/plot/uimenu.m +++ b/scripts/plot/uimenu.m @@ -64,12 +64,12 @@ ## ## @example ## @group -## f = uimenu("label", "&File", "accelerator", "f"); -## e = uimenu("label", "&Edit", "accelerator", "e"); -## uimenu(f, "label", "Close", "accelerator", "q", ... -## "callback", "close (gcf)"); -## uimenu(e, "label", "Toggle &Grid", "accelerator", "g", ... -## "callback", "grid (gca)"); +## f = uimenu ("label", "&File", "accelerator", "f"); +## e = uimenu ("label", "&Edit", "accelerator", "e"); +## uimenu (f, "label", "Close", "accelerator", "q", ... +## "callback", "close (gcf)"); +## uimenu (e, "label", "Toggle &Grid", "accelerator", "g", ... +## "callback", "grid (gca)"); ## @end group ## @end example ## @seealso{figure}
--- a/scripts/polynomial/mpoles.m +++ b/scripts/polynomial/mpoles.m @@ -38,10 +38,10 @@ ## @example ## @group ## p = [2 3 1 1 2]; -## [m, n] = mpoles(p); -## @result{} m = [1; 1; 2; 1; 2] -## @result{} n = [2; 5; 1; 4; 3] -## @result{} p(n) = [3, 2, 2, 1, 1] +## [m, n] = mpoles (p) +## @result{} m = [1; 1; 2; 1; 2] +## @result{} n = [2; 5; 1; 4; 3] +## @result{} p(n) = [3, 2, 2, 1, 1] ## @end group ## @end example ##
--- a/scripts/polynomial/poly.m +++ b/scripts/polynomial/poly.m @@ -27,10 +27,10 @@ ## ## @example ## @group -## roots(poly(eye(3))) -## @result{} 1.00001 + 0.00001i -## @result{} 1.00001 - 0.00001i -## @result{} 0.99999 + 0.00000i +## roots (poly (eye (3))) +## @result{} 1.00001 + 0.00001i +## 1.00001 - 0.00001i +## 0.99999 + 0.00000i ## @end group ## @end example ##
--- a/scripts/polynomial/polyaffine.m +++ b/scripts/polynomial/polyaffine.m @@ -24,7 +24,7 @@ ## representing: ## ## @example -## g(x) = f((x-@var{mu}(1))/@var{mu}(2)). +## g(x) = f( (x - @var{mu}(1)) / @var{mu}(2) ) ## @end example ## ## @seealso{polyval, polyfit}
--- a/scripts/polynomial/polygcd.m +++ b/scripts/polynomial/polygcd.m @@ -25,16 +25,16 @@ ## Together with deconv, you can reduce a ratio of two polynomials. ## The tolerance @var{tol} defaults to @code{sqrt(eps)}. ## -## @strong{Caution:} This is a numerically unstable algorithm and should not be used on large polynomials. +## @strong{Caution:} This is a numerically unstable algorithm and should not +## be used on large polynomials. ## ## Example code: ## ## @example ## @group -## polygcd (poly(1:8), poly(3:12)) - poly(3:8) +## polygcd (poly (1:8), poly (3:12)) - poly (3:8) ## @result{} [ 0, 0, 0, 0, 0, 0, 0 ] -## deconv (poly(1:8), polygcd (poly(1:8), poly(3:12))) ... -## - poly(1:2) +## deconv (poly (1:8), polygcd (poly (1:8), poly (3:12))) - poly(1:2) ## @result{} [ 0, 0, 0 ] ## @end group ## @end example
--- a/scripts/polynomial/polyout.m +++ b/scripts/polynomial/polyout.m @@ -27,7 +27,7 @@ ## @ifnottex ## ## @example -## c(x) = c(1) * x^n + @dots{} + c(n) x + c(n+1) +## c(x) = c(1) * x^n + @dots{} + c(n) x + c(n+1) ## @end example ## ## @end ifnottex
--- a/scripts/polynomial/residue.m +++ b/scripts/polynomial/residue.m @@ -33,9 +33,9 @@ ## ## @example ## @group -## B(s) M r(m) N -## ---- = SUM ------------- + SUM k(i)*s^(N-i) -## A(s) m=1 (s-p(m))^e(m) i=1 +## B(s) M r(m) N +## ---- = SUM ------------- + SUM k(i)*s^(N-i) +## A(s) m=1 (s-p(m))^e(m) i=1 ## @end group ## @end example ## @@ -52,11 +52,11 @@ ## @group ## b = [1, 1, 1]; ## a = [1, -5, 8, -4]; -## [r, p, k, e] = residue (b, a); -## @result{} r = [-2; 7; 3] -## @result{} p = [2; 2; 1] -## @result{} k = [](0x0) -## @result{} e = [1; 2; 1] +## [r, p, k, e] = residue (b, a) +## @result{} r = [-2; 7; 3] +## @result{} p = [2; 2; 1] +## @result{} k = [](0x0) +## @result{} e = [1; 2; 1] ## @end group ## @end example ## @@ -95,12 +95,11 @@ ## r = [-2; 7; 3]; ## p = [2; 2; 1]; ## k = [1, 0]; -## [b, a] = residue (r, p, k); -## @result{} b = [1, -5, 9, -3, 1] -## @result{} a = [1, -5, 8, -4] +## [b, a] = residue (r, p, k) +## @result{} b = [1, -5, 9, -3, 1] +## @result{} a = [1, -5, 8, -4] ## ## where mpoles is used to determine e = [1; 2; 1] -## ## @end group ## @end example ## @@ -112,9 +111,9 @@ ## p = [2; 1; 2]; ## k = [1, 0]; ## e = [2; 1; 1]; -## [b, a] = residue (r, p, k, e); -## @result{} b = [1, -5, 9, -3, 1] -## @result{} a = [1, -5, 8, -4] +## [b, a] = residue (r, p, k, e) +## @result{} b = [1, -5, 9, -3, 1] +## @result{} a = [1, -5, 8, -4] ## @end group ## @end example ## @@ -129,9 +128,9 @@ ## ## @example ## @group -## -2 7 3 s^4 - 5s^3 + 9s^2 - 3s + 1 -## ----- + ------- + ----- + s = -------------------------- -## (s-2) (s-2)^2 (s-1) s^3 - 5s^2 + 8s - 4 +## -2 7 3 s^4 - 5s^3 + 9s^2 - 3s + 1 +## ----- + ------- + ----- + s = -------------------------- +## (s-2) (s-2)^2 (s-1) s^3 - 5s^2 + 8s - 4 ## @end group ## @end example ##
--- a/scripts/set/ismember.m +++ b/scripts/set/ismember.m @@ -30,7 +30,7 @@ ## @group ## a = [3, 10, 1]; ## s = [0:9]; -## [tf, s_idx] = ismember (a, s); +## [tf, s_idx] = ismember (a, s) ## @result{} tf = [1, 0, 1] ## @result{} s_idx = [4, 0, 2] ## @end group @@ -42,7 +42,7 @@ ## @group ## a = @{'abc'@}; ## s = @{'abc', 'def'@}; -## [tf, s_idx] = ismember (a, s); +## [tf, s_idx] = ismember (a, s) ## @result{} tf = [1, 0] ## @result{} s_idx = [1, 0] ## @end group @@ -56,7 +56,7 @@ ## @group ## a = [1:3; 5:7; 4:6]; ## s = [0:2; 1:3; 2:4; 3:5; 4:6]; -## [tf, s_idx] = ismember(a, s, 'rows'); +## [tf, s_idx] = ismember(a, s, "rows") ## @result{} tf = logical ([1; 0; 1]) ## @result{} s_idx = [2; 0; 5]; ## @end group
--- a/scripts/set/union.m +++ b/scripts/set/union.m @@ -27,7 +27,7 @@ ## @example ## @group ## union ([1, 2, 4], [2, 3, 5]) -## @result{} [1, 2, 3, 4, 5] +## @result{} [1, 2, 3, 4, 5] ## @end group ## @end example ## @@ -37,18 +37,17 @@ ## ## @example ## @group -## union([1, 2; 2, 3], [1, 2; 3, 4], "rows") -## @result{} 1 2 -## 2 3 -## 3 4 +## union ([1, 2; 2, 3], [1, 2; 3, 4], "rows") +## @result{} 1 2 +## 2 3 +## 3 4 ## @end group ## @end example ## ## @deftypefnx {Function File} {[@var{c}, @var{ia}, @var{ib}] =} union (@var{a}, @var{b}) ## ## 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}. +## @code{b(ib)} are disjoint sets whose union is @var{c}. ## ## @seealso{intersect, setdiff, unique} ## @end deftypefn
--- a/scripts/sparse/pcg.m +++ b/scripts/sparse/pcg.m @@ -124,17 +124,17 @@ ## ## @example ## @group -## n = 10; -## A = diag (sparse (1:n)); -## b = rand (n, 1); -## [l, u, p, q] = luinc (A, 1.e-3); +## 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) +## x = pcg (A,b) ## @end example ## ## @sc{Example 2:} @code{pcg} with a function which computes @@ -142,18 +142,18 @@ ## ## @example ## @group -## function y = apply_a (x) -## y = [1:N]'.*x; -## endfunction +## function y = apply_a (x) +## y = [1:N]' .* x; +## endfunction ## -## x = pcg ("apply_a", b) +## x = pcg ("apply_a", b) ## @end group ## @end example ## ## @sc{Example 3:} @code{pcg} with a preconditioner: @var{l} * @var{u} ## ## @example -## x = pcg (A, b, 1.e-6, 500, l*u); +## x = pcg (A, b, 1.e-6, 500, l*u) ## @end example ## ## @sc{Example 4:} @code{pcg} with a preconditioner: @var{l} * @var{u}. @@ -161,7 +161,7 @@ ## are easier to invert ## ## @example -## x = pcg (A, b, 1.e-6, 500, l, u); +## x = pcg (A, b, 1.e-6, 500, l, u) ## @end example ## ## @sc{Example 5:} Preconditioned iteration, with full diagnostics. The @@ -170,15 +170,15 @@ ## ## @example ## @group -## function y = apply_m (x) -## k = floor (length (x) - 2); -## y = x; -## y(1:k) = x(1:k)./[1:k]'; -## endfunction +## 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, eigest] = ... -## pcg (A, b, [], [], "apply_m"); -## semilogy (1:iter+1, resvec); +## [x, flag, relres, iter, resvec, eigest] = ... +## pcg (A, b, [], [], "apply_m"); +## semilogy (1:iter+1, resvec); ## @end group ## @end example ## @@ -187,14 +187,14 @@ ## ## @example ## @group -## function y = apply_M (x, varargin) +## function y = apply_M (x, varargin) ## K = varargin@{1@}; ## y = x; -## y(1:K) = x(1:K)./[1:K]'; -## endfunction +## y(1:K) = x(1:K) ./ [1:K]'; +## endfunction ## -## [x, flag, relres, iter, resvec, eigest] = ... -## pcg (A, b, [], [], "apply_m", [], [], 3) +## [x, flag, relres, iter, resvec, eigest] = ... +## pcg (A, b, [], [], "apply_m", [], [], 3) ## @end group ## @end example ## @@ -216,8 +216,7 @@ ## Author: Piotr Krzyzanowski <piotr.krzyzanowski@mimuw.edu.pl> ## Modified by: Vittoria Rezzonico <vittoria.rezzonico@epfl.ch> -## - Add the ability to provide the pre-conditioner as two separate -## matrices +## - Add the ability to provide the pre-conditioner as two separate matrices function [x, flag, relres, iter, resvec, eigest] = pcg (A, b, tol, maxit, m1, m2, x0, varargin)
--- a/scripts/sparse/pcr.m +++ b/scripts/sparse/pcr.m @@ -101,16 +101,16 @@ ## ## @example ## @group -## n = 10; -## A = sparse (diag (1:n)); -## b = rand (N, 1); +## 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) +## x = pcr (A, b) ## @end example ## ## @sc{Example 2:} @code{pcr} with a function which computes @@ -118,11 +118,11 @@ ## ## @example ## @group -## function y = apply_a (x) -## y = [1:10]'.*x; -## endfunction +## function y = apply_a (x) +## y = [1:10]' .* x; +## endfunction ## -## x = pcr ("apply_a", b) +## x = pcr ("apply_a", b) ## @end group ## @end example ## @@ -132,15 +132,15 @@ ## ## @example ## @group -## function y = apply_m (x) -## k = floor (length(x)-2); -## y = x; -## y(1:k) = x(1:k)./[1:k]'; -## endfunction +## 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); +## [x, flag, relres, iter, resvec] = ... +## pcr (A, b, [], [], "apply_m") +## semilogy ([1:iter+1], resvec); ## @end group ## @end example ## @@ -149,13 +149,14 @@ ## ## @example ## @group -## function y = apply_m (x, varargin) -## k = varargin@{1@}; -## y = x; y(1:k) = x(1:k)./[1:k]'; -## endfunction +## function y = apply_m (x, varargin) +## 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) +## [x, flag, relres, iter, resvec] = ... +## pcr (A, b, [], [], "apply_m"', [], 3) ## @end group ## @end example ##
--- a/scripts/sparse/spaugment.m +++ b/scripts/sparse/spaugment.m @@ -22,19 +22,18 @@ ## ## @example ## @group -## [@var{c} * eye(@var{m}, @var{m}),@var{A}; @var{A}', zeros(@var{n}, -## @var{n})] +## [@var{c} * eye(@var{m}, @var{m}), @var{A}; +## @var{A}', zeros(@var{n}, @var{n})] ## @end group ## @end example ## ## @noindent ## This is related to the least squares solution of -## @code{@var{A} \\ @var{b}}, by +## @code{@var{A} \ @var{b}}, by ## ## @example ## @group -## @var{s} * [ @var{r} / @var{c}; x] = [@var{b}, zeros(@var{n}, -## columns(@var{b})] +## @var{s} * [ @var{r} / @var{c}; x] = [ @var{b}, zeros(@var{n}, columns(@var{b})) ] ## @end group ## @end example ## @@ -53,7 +52,7 @@ ## ## @example ## @group -## m = 11; n = 10; mn = max(m ,n); +## m = 11; n = 10; mn = max (m, n); ## A = spdiags ([ones(mn,1), 10*ones(mn,1), -ones(mn,1)], ## [-1, 0, 1], m, n); ## x0 = A \ ones (m,1);
--- a/scripts/sparse/spdiags.m +++ b/scripts/sparse/spdiags.m @@ -42,7 +42,7 @@ ## @example ## @group ## spdiags (reshape (1:12, 4, 3), [-1 0 1], 5, 4) -## @result{} 5 10 0 0 +## @result{} 5 10 0 0 ## 1 6 11 0 ## 0 2 7 12 ## 0 0 3 8
--- a/scripts/sparse/svds.m +++ b/scripts/sparse/svds.m @@ -29,9 +29,9 @@ ## ## @example ## @group -## [@var{m}, @var{n}] = size(@var{A}) -## @var{s} = eigs([sparse(@var{m}, @var{m}), @var{A}; -## @var{A}', sparse(@var{n}, @var{n})]) +## [@var{m}, @var{n}] = size (@var{A}); +## @var{s} = eigs ([sparse(@var{m}, @var{m}), @var{A}; +## @var{A}', sparse(@var{n}, @var{n})]) ## @end group ## @end example ##
--- a/scripts/specfun/legendre.m +++ b/scripts/specfun/legendre.m @@ -43,7 +43,7 @@ ## @example ## @group ## m m 2 m/2 d^m -## P(x) = (-1) * (1-x ) * ---- P (x) +## P(x) = (-1) * (1-x ) * ---- P(x) ## n dx^m n ## @end group ## @end example @@ -62,9 +62,9 @@ ## ## @example ## @group -## 1 d^n 2 n -## P (x) = ------ [----(x - 1) ] -## n 2^n n! dx^n +## 1 d^n 2 n +## P(x) = ------ [----(x - 1) ] +## n 2^n n! dx^n ## @end group ## @end example ## @@ -75,7 +75,7 @@ ## ## @example ## @group -## x | -1.0 | -0.9 | -0.8 +## x | -1.0 | -0.9 | -0.8 ## ------------------------------------ ## m=0 | -1.00000 | -0.47250 | -0.08000 ## m=1 | 0.00000 | -1.99420 | -1.98000 @@ -100,9 +100,9 @@ ## ## @example ## @group -## 0 0 -## SP (x) = P (x) -## n n +## 0 0 +## SP(x) = P(x) +## n n ## @end group ## @end example ## @@ -119,9 +119,9 @@ ## ## @example ## @group -## m m m 2(n-m)! 0.5 -## SP (x) = P (x) * (-1) * [-------] -## n n (n+m)! +## m m m 2(n-m)! 0.5 +## SP(x) = P(x) * (-1) * [-------] +## n n (n+m)! ## @end group ## @end example ## @@ -143,9 +143,9 @@ ## ## @example ## @group -## m m m (n+0.5)(n-m)! 0.5 -## NP (x) = P (x) * (-1) * [-------------] -## n n (n+m)! +## m m m (n+0.5)(n-m)! 0.5 +## NP(x) = P(x) * (-1) * [-------------] +## n n (n+m)! ## @end group ## @end example ##
--- a/scripts/special-matrix/hankel.m +++ b/scripts/special-matrix/hankel.m @@ -29,7 +29,7 @@ ## @var{r}, has the elements ## @tex ## $$ -## H (i, j) = \cases{c_{i+j-1},&$i+j-1\le m$;\cr r_{i+j-m},&otherwise.\cr} +## H(i, j) = \cases{c_{i+j-1},&$i+j-1\le m$;\cr r_{i+j-m},&otherwise.\cr} ## $$ ## @end tex ## @ifnottex
--- a/scripts/special-matrix/hilb.m +++ b/scripts/special-matrix/hilb.m @@ -22,13 +22,13 @@ ## of a Hilbert matrix is defined as ## @tex ## $$ -## H (i, j) = {1 \over (i + j - 1)} +## H(i, j) = {1 \over (i + j - 1)} ## $$ ## @end tex ## @ifnottex ## ## @example -## H (i, j) = 1 / (i + j - 1) +## H(i, j) = 1 / (i + j - 1) ## @end example ## ## @end ifnottex @@ -41,9 +41,9 @@ ## @example ## @group ## cond (rand (5)) -## @result{} 14.392 +## @result{} 14.392 ## cond (hilb (5)) -## @result{} 4.7661e+05 +## @result{} 4.7661e+05 ## @end group ## @end example ##
--- a/scripts/statistics/base/center.m +++ b/scripts/statistics/base/center.m @@ -70,7 +70,7 @@ %!assert(center (int8 ([1,2,3])), [-1,0,1]) %!assert(center (logical ([1, 0, 0, 1])), [0.5, -0.5, -0.5, 0.5]) %!assert(center (ones (3,2,0,2)), zeros (3,2,0,2)) -%!assert(center (ones (3,2,0,2, 'single')), zeros (3,2,0,2, 'single')) +%!assert(center (ones (3,2,0,2, "single")), zeros (3,2,0,2, "single")) %!assert(center (magic (3)), [3,-4,1;-2,0,2;-1,4,-3]) %!assert(center ([1 2 3; 6 5 4], 2), [-1 0 1; 1 0 -1])
--- a/scripts/statistics/base/cloglog.m +++ b/scripts/statistics/base/cloglog.m @@ -27,7 +27,7 @@ ## @ifnottex ## ## @example -## cloglog(x) = - log (- log (@var{x})) +## cloglog (x) = - log (- log (@var{x})) ## @end example ## ## @end ifnottex
--- a/scripts/statistics/base/corr.m +++ b/scripts/statistics/base/corr.m @@ -33,7 +33,7 @@ ## @ifnottex ## ## @example -## corr(x,y) = cov(x,y)/(std(x)*std(y)) +## corr (x,y) = cov (x,y) / (std (x) * std (y)) ## @end example ## ## @end ifnottex @@ -56,7 +56,7 @@ ## Special case, scalar is always 100% correlated with itself if (isscalar (x)) - if (isa (x, 'single')) + if (isa (x, "single")) retval = single (1); else retval = 1;
--- a/scripts/statistics/base/cov.m +++ b/scripts/statistics/base/cov.m @@ -86,7 +86,7 @@ ## Special case, scalar has zero covariance if (isscalar (x)) - if (isa (x, 'single')) + if (isa (x, "single")) c = single (0); else c = 0;
--- a/scripts/statistics/base/iqr.m +++ b/scripts/statistics/base/iqr.m @@ -60,8 +60,8 @@ ## can take a matrix, rather than just a vector argument. n = sz(dim); sz(dim) = 1; - if (isa (x, 'single')) - y = zeros (sz, 'single'); + if (isa (x, "single")) + y = zeros (sz, "single"); else y = zeros (sz); endif
--- a/scripts/statistics/base/kendall.m +++ b/scripts/statistics/base/kendall.m @@ -99,10 +99,10 @@ endif endif - if (isa (x, 'single') || isa (y, 'single')) - cls = 'single'; + if (isa (x, "single") || isa (y, "single")) + cls = "single"; else - cls = 'double'; + cls = "double"; endif r = ranks (x); m = sign (kron (r, ones (n, 1, cls)) - kron (ones (n, 1, cls), r));
--- a/scripts/statistics/base/kurtosis.m +++ b/scripts/statistics/base/kurtosis.m @@ -29,7 +29,7 @@ ## @ifnottex ## ## @example -## kurtosis (x) = N^(-1) std(x)^(-4) sum ((x - mean(x)).^4) - 3 +## kurtosis (x) = 1/N std(x)^(-4) sum ((x - mean(x)).^4) - 3 ## @end example ## ## @end ifnottex
--- a/scripts/statistics/base/logit.m +++ b/scripts/statistics/base/logit.m @@ -27,7 +27,7 @@ ## @ifnottex ## ## @example -## logit(@var{p}) = log (@var{p} / (1-@var{p})) +## logit (@var{p}) = log (@var{p} / (1-@var{p})) ## @end example ## ## @end ifnottex
--- a/scripts/statistics/base/median.m +++ b/scripts/statistics/base/median.m @@ -34,9 +34,9 @@ ## ## @example ## @group -## x(ceil(N/2)), N odd -## median(x) = -## (x(N/2) + x((N/2)+1))/2, N even +## x(ceil(N/2)) N odd +## median (x) = +## (x(N/2) + x((N/2)+1))/2 N even ## @end group ## @end example ##
--- a/scripts/statistics/base/moment.m +++ b/scripts/statistics/base/moment.m @@ -43,6 +43,7 @@ ## ## The optional string @var{type} specifies the type of moment to be computed. ## Valid options are: +## ## @table @asis ## @item "c" ## Central Moment. The moment about the mean defined as @@ -72,7 +73,7 @@ ## ## @example ## @group -## 1/N SUM_i ( abs(x(i)) )^p +## 1/N SUM_i ( abs (x(i)) )^p ## @end group ## @end example ## @@ -89,7 +90,7 @@ ## ## @example ## @group -## 1/N SUM_i ( abs(x(i) - mean(x)) )^p +## 1/N SUM_i ( abs (x(i) - mean(x)) )^p ## @end group ## @end example ##
--- a/scripts/statistics/base/skewness.m +++ b/scripts/statistics/base/skewness.m @@ -29,7 +29,7 @@ ## @ifnottex ## ## @example -## skewness (x) = N^(-1) std(x)^(-3) sum ((x - mean(x)).^3) +## skewness (x) = 1/N std(x)^(-3) sum ((x - mean(x)).^3) ## @end example ## ## @end ifnottex
--- a/scripts/statistics/base/spearman.m +++ b/scripts/statistics/base/spearman.m @@ -69,7 +69,7 @@ endif ## Restore class cleared by ranks - if (isa (x, 'single') || isa (y, 'single')) + if (isa (x, "single") || isa (y, "single")) rho = single (rho); endif
--- a/scripts/statistics/base/std.m +++ b/scripts/statistics/base/std.m @@ -92,8 +92,8 @@ n = sz(dim); if (n == 1 || isempty (x)) - if (isa (x, 'single')) - retval = zeros (sz, 'single'); + if (isa (x, "single")) + retval = zeros (sz, "single"); else retval = zeros (sz); endif
--- a/scripts/statistics/base/var.m +++ b/scripts/statistics/base/var.m @@ -92,8 +92,8 @@ n = sz(dim); if (n == 1) - if (isa (x, 'single')) - retval = zeros (sz, 'single'); + if (isa (x, "single")) + retval = zeros (sz, "single"); else retval = zeros (sz); endif
--- a/scripts/statistics/distributions/wblpdf.m +++ b/scripts/statistics/distributions/wblpdf.m @@ -30,7 +30,7 @@ ## @ifnottex ## ## @example -## shape * scale^(-shape) * x^(shape-1) * exp (-(x/scale)^shape) +## shape * scale^(-shape) * x^(shape-1) * exp (-(x/scale)^shape) ## @end example ## ## @end ifnottex
--- a/scripts/strings/base2dec.m +++ b/scripts/strings/base2dec.m @@ -24,7 +24,7 @@ ## @example ## @group ## base2dec ("11120", 3) -## @result{} 123 +## @result{} 123 ## @end group ## @end example ## @@ -42,7 +42,7 @@ ## @example ## @group ## base2dec ("yyyzx", "xyz") -## @result{} 123 +## @result{} 123 ## @end group ## @end example ## @seealso{dec2base, bin2dec, hex2dec}
--- a/scripts/strings/cstrcat.m +++ b/scripts/strings/cstrcat.m @@ -24,7 +24,7 @@ ## @example ## @group ## cstrcat ("ab ", "cd") -## @result{} "ab cd" +## @result{} "ab cd" ## @end group ## @end example ## @@ -32,8 +32,7 @@ ## @group ## s = [ "ab"; "cde" ]; ## cstrcat (s, s, s) -## @result{} ans = -## "ab ab ab " +## @result{} "ab ab ab " ## "cdecdecde" ## @end group ## @end example
--- a/scripts/strings/dec2base.m +++ b/scripts/strings/dec2base.m @@ -25,7 +25,7 @@ ## @example ## @group ## dec2base (123, 3) -## @result{} "11120" +## @result{} "11120" ## @end group ## @end example ## @@ -40,7 +40,7 @@ ## @example ## @group ## dec2base (123, "aei") -## @result{} "eeeia" +## @result{} "eeeia" ## @end group ## @end example ##
--- a/scripts/strings/index.m +++ b/scripts/strings/index.m @@ -28,7 +28,7 @@ ## @example ## @group ## index ("Teststring", "t") -## @result{} 4 +## @result{} 4 ## @end group ## @end example ##
--- a/scripts/strings/str2num.m +++ b/scripts/strings/str2num.m @@ -27,9 +27,8 @@ ## str2num ("3.141596") ## @result{} 3.141596 ## -## str2num (["1, 2, 3"; "4, 5, 6"]); -## @result{} ans = -## 1 2 3 +## str2num (["1, 2, 3"; "4, 5, 6"]) +## @result{} 1 2 3 ## 4 5 6 ## @end group ## @end example
--- a/scripts/strings/strcat.m +++ b/scripts/strings/strcat.m @@ -30,7 +30,7 @@ ## @group ## s = [ "ab"; "cde" ]; ## strcat (s, s, s) -## @result{} ans = +## @result{} ## "ab ab ab " ## "cdecdecde" ## @end group @@ -40,7 +40,7 @@ ## @group ## s = @{ "ab"; "cde" @}; ## strcat (s, s, s) -## @result{} ans = +## @result{} ## @{ ## [1,1] = ababab ## [2,1] = cdecdecde
--- a/scripts/strings/strjust.m +++ b/scripts/strings/strjust.m @@ -32,11 +32,11 @@ ## @example ## @group ## strjust (["a"; "ab"; "abc"; "abcd"]) -## @result{} ans = -## a -## ab -## abc -## abcd +## @result{} +## " a" +## " ab" +## " abc" +## "abcd" ## @end group ## @end example ## @seealso{deblank, strrep, strtrim, untabify}
--- a/scripts/strings/strsplit.m +++ b/scripts/strings/strsplit.m @@ -32,7 +32,7 @@ ## @example ## @group ## strsplit ("a,b,c", ",") -## @result{} +## @result{} ## @{ ## [1,1] = a ## [1,2] = b @@ -40,7 +40,7 @@ ## @} ## ## strsplit (["a,b" ; "cde"], ",") -## @result{} +## @result{} ## @{ ## [1,1] = a ## [1,2] = b
--- a/scripts/testfun/demo.m +++ b/scripts/testfun/demo.m @@ -34,12 +34,12 @@ ## ## @example ## @group -## %!demo -## %! t = 0:0.01:2*pi; -## %! x = sin (t); -## %! plot (t,x); -## %! %------------------------------------------------- -## %! % the figure window shows one cycle of a sine wave +## %!demo +## %! t = 0:0.01:2*pi; +## %! x = sin (t); +## %! plot (t, x); +## %! %------------------------------------------------- +## %! % the figure window shows one cycle of a sine wave ## @end group ## @end example ## @@ -53,7 +53,7 @@ ## with the code ## ## @example -## %! input("Press <enter> to continue: ","s"); +## %! input("Press <enter> to continue: ","s"); ## @end example ## ## @noindent @@ -72,12 +72,12 @@ ## ## @example ## @group -## %!demo if 1 -## %! function y=f(x) -## %! y=x; -## %! endfunction -## %! f(3) -## %! endif +## %!demo if 1 +## %! function y=f(x) +## %! y=x; +## %! endfunction +## %! f(3) +## %! endif ## @end group ## @end example ##
--- a/scripts/time/ctime.m +++ b/scripts/time/ctime.m @@ -26,7 +26,7 @@ ## @example ## @group ## ctime (time ()) -## @result{} "Mon Feb 17 01:15:06 1997" +## @result{} "Mon Feb 17 01:15:06 1997" ## @end group ## @end example ## @seealso{asctime, time, localtime}
--- a/scripts/time/date.m +++ b/scripts/time/date.m @@ -25,7 +25,7 @@ ## @example ## @group ## date () -## @result{} "20-Aug-1993" +## @result{} "20-Aug-1993" ## @end group ## @end example ## @seealso{now, clock, datestr, localtime}
--- a/scripts/time/is_leap_year.m +++ b/scripts/time/is_leap_year.m @@ -26,7 +26,7 @@ ## @example ## @group ## is_leap_year (2000) -## @result{} 1 +## @result{} 1 ## @end group ## @end example ## @seealso{weekday, eomday, calendar}
--- a/src/Makefile.am +++ b/src/Makefile.am @@ -284,6 +284,7 @@ ops.h \ pager.h \ parse.h \ + parse-private.h \ pr-output.h \ procstream.h \ profiler.h \
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -5995,7 +5995,7 @@ ticks = tmp_ticks; - int n = is_logscale ? 9 : 4; + int n = is_logscale ? 8 : 4; Matrix tmp_mticks (1, n * (tmp_ticks.numel () - 1)); for (int i = 0; i < tmp_ticks.numel ()-1; i++)
--- a/src/graphics.h.in +++ b/src/graphics.h.in @@ -222,10 +222,7 @@ { Matrix retval (m.rows (), m.cols ()); - if (m.any_element_is_positive ()) - do_scale (m.data (), retval.fortran_vec (), m.numel ()); - else - do_neg_scale (m.data (), retval.fortran_vec (), m.numel ()); + do_scale (m.data (), retval.fortran_vec (), m.numel ()); return retval; } @@ -234,10 +231,7 @@ { NDArray retval (m.dims ()); - if (m.any_element_is_positive ()) - do_scale (m.data (), retval.fortran_vec (), m.numel ()); - else - do_neg_scale (m.data (), retval.fortran_vec (), m.numel ()); + do_scale (m.data (), retval.fortran_vec (), m.numel ()); return retval; } @@ -255,13 +249,47 @@ void do_scale (const double *src, double *dest, int n) const { for (int i = 0; i < n; i++) - dest[i] = log10(src[i]); + dest[i] = log10 (src[i]); + } +}; + +class neg_log_scaler : public base_scaler +{ +public: + neg_log_scaler (void) { } + + Matrix scale (const Matrix& m) const + { + Matrix retval (m.rows (), m.cols ()); + + do_scale (m.data (), retval.fortran_vec (), m.numel ()); + + return retval; } - void do_neg_scale (const double *src, double *dest, int n) const + NDArray scale (const NDArray& m) const + { + NDArray retval (m.dims ()); + + do_scale (m.data (), retval.fortran_vec (), m.numel ()); + + return retval; + } + + double scale (double d) const + { return -log10 (-d); } + + double unscale (double d) const + { return -pow (10.0, -d); } + + base_scaler* clone (void) const + { return new neg_log_scaler (); } + +private: + void do_scale (const double *src, double *dest, int n) const { for (int i = 0; i < n; i++) - dest[i] = -log10(-src[i]); + dest[i] = -log10 (-src[i]); } }; @@ -275,7 +303,8 @@ scaler (const std::string& s) : rep (s == "log" ? new log_scaler () - : (s == "linear" ? new lin_scaler () : new base_scaler ())) + : (s == "neglog" ? new neg_log_scaler () + : (s == "linear" ? new lin_scaler () : new base_scaler ()))) { } ~scaler (void) { delete rep; } @@ -318,6 +347,8 @@ if (s == "log") rep = new log_scaler (); + else if (s == "neglog") + rep = new neg_log_scaler (); else if (s == "linear") rep = new lin_scaler (); else @@ -3814,9 +3845,32 @@ void init (void); private: - void update_xscale (void) { sx = get_xscale (); } - void update_yscale (void) { sy = get_yscale (); } - void update_zscale (void) { sz = get_zscale (); } + + std::string + get_scale (const std::string& scale, const Matrix& lims) + { + std::string retval = scale; + + if (scale == "log" && lims.numel () > 1 && lims(0) < 0 && lims(1) < 0) + retval = "neglog"; + + return retval; + } + + void update_xscale (void) + { + sx = get_scale (get_xscale (), xlim.get ().matrix_value ()); + } + + void update_yscale (void) + { + sy = get_scale (get_yscale (), ylim.get ().matrix_value ()); + } + + void update_zscale (void) + { + sz = get_scale (get_zscale (), zlim.get ().matrix_value ()); + } void update_view (void) { sync_positions (); } void update_dataaspectratio (void) { sync_positions (); } @@ -3968,6 +4022,8 @@ fix_limits (xlim); + update_xscale (); + if (do_clr_zoom) zoom_stack.clear (); @@ -3983,6 +4039,8 @@ fix_limits (ylim); + update_yscale (); + if (do_clr_zoom) zoom_stack.clear (); @@ -3998,6 +4056,8 @@ fix_limits (zlim); + update_zscale (); + zoom_stack.clear (); update_axes_layout ();
--- a/src/lex.ll +++ b/src/lex.ll @@ -68,6 +68,7 @@ #include "lex.h" #include "ov.h" #include "parse.h" +#include "parse-private.h" #include "pt-all.h" #include "symtab.h" #include "token.h" @@ -1113,8 +1114,7 @@ parser_end_of_input = false; - while (! symtab_context.empty ()) - symtab_context.pop (); + parser_symtab_context.clear (); // We do want a prompt by default. promptflag = 1;
--- a/src/oct-parse.yy +++ b/src/oct-parse.yy @@ -68,6 +68,7 @@ #include "toplev.h" #include "pager.h" #include "parse.h" +#include "parse-private.h" #include "pt-all.h" #include "pt-eval.h" #include "symtab.h" @@ -126,7 +127,7 @@ static bool endfunction_found = false; // Keep track of symbol table information when parsing functions. -std::stack<symbol_table::scope_id> symtab_context; +symtab_context parser_symtab_context; // Name of the current class when we are parsing class methods or // constructors. @@ -365,11 +366,8 @@ { \ global_command = 0; \ yyerrok; \ - if (! symtab_context.empty ()) \ - { \ - symbol_table::set_scope (symtab_context.top ()); \ - symtab_context.pop (); \ - } \ + if (! parser_symtab_context.empty ()) \ + parser_symtab_context.pop (); \ if (interactive || forced_interactive) \ YYACCEPT; \ else \ @@ -1224,7 +1222,8 @@ if (max_function_depth < current_function_depth) max_function_depth = current_function_depth; - symtab_context.push (symbol_table::current_scope ()); + parser_symtab_context.push (); + symbol_table::set_scope (symbol_table::alloc_scope ()); if (! reading_script_file && current_function_depth == 1 @@ -1246,7 +1245,7 @@ if (lexer_flags.looking_at_function_handle) { - symtab_context.push (symbol_table::current_scope ()); + parser_symtab_context.push (); symbol_table::set_scope (symbol_table::alloc_scope ()); lexer_flags.looking_at_function_handle--; lexer_flags.looking_at_anon_fcn_args = true; @@ -2124,12 +2123,10 @@ symbol_table::scope_id fcn_scope = symbol_table::current_scope (); - if (symtab_context.empty ()) + if (parser_symtab_context.empty ()) panic_impossible (); - symbol_table::set_scope (symtab_context.top ()); - - symtab_context.pop (); + parser_symtab_context.pop (); stmt->set_print_flag (false); @@ -2972,11 +2969,10 @@ static void recover_from_parsing_function (void) { - if (symtab_context.empty ()) + if (parser_symtab_context.empty ()) panic_impossible (); - symbol_table::set_scope (symtab_context.top ()); - symtab_context.pop (); + parser_symtab_context.pop (); if (reading_fcn_file && current_function_depth == 1 && ! parsing_subfunctions)
--- a/src/ov-usr-fcn.cc +++ b/src/ov-usr-fcn.cc @@ -387,10 +387,12 @@ // Save old and set current symbol table context, for // eval_undefined_error(). - octave_call_stack::push (this, local_scope, call_depth); + int context = is_anonymous_function () ? 0 : call_depth; + + octave_call_stack::push (this, local_scope, context); frame.add_fcn (octave_call_stack::pop); - if (call_depth > 0) + if (call_depth > 0 && ! is_anonymous_function ()) { symbol_table::push_context ();
new file mode 100644 --- /dev/null +++ b/src/parse-private.h @@ -0,0 +1,96 @@ +/* + +Copyright (C) 2012 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#if !defined (octave_parse_private_h) +#define octave_parse_private_h 1 + +#include <stack> + +#include "symtab.h" + +// Keep track of symbol table information when parsing functions. +class symtab_context +{ +private: + + class frame + { + public: + frame (symbol_table::scope_id s, symbol_table::scope_id c) + : m_scope (s), m_context (c) { } + + frame (const frame& f) : m_scope (f.m_scope), m_context (f.m_context) { } + + frame& operator = (const frame& f) + { + if (&f != this) + { + m_scope = f.m_scope; + m_context = f.m_context; + } + + return *this; + } + + ~frame (void) { } + + symbol_table::scope_id scope (void) const { return m_scope; } + symbol_table::scope_id context (void) const { return m_context; } + + private: + + symbol_table::scope_id m_scope; + symbol_table::scope_id m_context; + }; + + std::stack<frame> frame_stack; + +public: + symtab_context (void) : frame_stack () { } + + void clear (void) + { + while (! frame_stack.empty ()) + frame_stack.pop (); + } + + bool empty (void) const { return frame_stack.empty (); } + + void pop (void) + { + frame tmp = frame_stack.top (); + + symbol_table::set_scope_and_context (tmp.scope (), tmp.context ()); + + frame_stack.pop (); + } + + void push (void) + { + frame_stack.push (frame (symbol_table::current_scope (), + symbol_table::current_context ())); + } +}; + +extern symtab_context parser_symtab_context; + +#endif
--- a/src/parse.h +++ b/src/parse.h @@ -62,9 +62,6 @@ // TRUE means input is coming from startup file. extern bool input_from_startup_file; -// Keep track of symbol table information when parsing functions. -extern std::stack<symbol_table::scope_id> symtab_context; - // Name of the current class when we are parsing class methods or // constructors. extern std::string current_class_name;
--- a/test/Makefile.am +++ b/test/Makefile.am @@ -23,6 +23,7 @@ FCN_FILES = \ fntests.m \ test_args.m \ + test_bug_31371.m \ test_diag_perm.m \ test_error.m \ test_eval-catch.m \ @@ -49,6 +50,7 @@ test_unwind.m \ test_while.m +include bug-35448/module.mk include classes/module.mk include class-concat/module.mk include ctor-vs-method/module.mk
new file mode 100644 --- /dev/null +++ b/test/bug-35448/fA.m @@ -0,0 +1,10 @@ +# fA.m +function y = fA (x, f) + global gfun + if nargin < 2 + y = fA (x, gfun); + else + w = feval (f, x); + y = feval (@fB, w); + endif +endfunction
new file mode 100644 --- /dev/null +++ b/test/bug-35448/fB.m @@ -0,0 +1,4 @@ +# fB.m +function y = fB (x) + y = x; +endfunction
new file mode 100644 --- /dev/null +++ b/test/bug-35448/fC.m @@ -0,0 +1,4 @@ +# fC.m +function y = fC (x) + y = x; +endfunction
new file mode 100644 --- /dev/null +++ b/test/bug-35448/module.mk @@ -0,0 +1,7 @@ +bug_35448_FCN_FILES = \ + bug-35448/fA.m \ + bug-35448/fB.m \ + bug-35448/fC.m \ + class-concat/test_bug_35448.m + +FCN_FILES += $(bug_35448_FCN_FILES)
new file mode 100644 --- /dev/null +++ b/test/bug-35448/test_bug_35448.m @@ -0,0 +1,11 @@ +%!test +%! global gfun +%! gfun = @fB; +%! y = fA (e); +%! assert (y, e); + +%!test +%! global gfun +%! gfun = @fC; +%! y = fA (e); +%! assert (y, e);
new file mode 100644 --- /dev/null +++ b/test/test_bug_31371.m @@ -0,0 +1,40 @@ +%!test +%! % Work around MATLAB bug where f(x)(y) is invalid syntax +%! % (This bug does not apply to Octave) +%! C = @(f,x) f(x); +%! C2 = @(f,x,y) f(x,y); +%! +%! % Church Booleans +%! T = @(t,f) t; +%! F = @(t,f) f; +%! +%! % Church Numerals +%! Zero = @(f,x) x; +%! One = @(f,x) f(x); +%! Two = @(f,x) f(f(x)); +%! Three = @(f,x) f(f(f(x))); +%! Four = @(f,x) f(f(f(f(x)))); +%! +%! % Arithmetic Operations +%! Inc = @(a) @(f,x) f(a(f,x)); % Increment +%! Add = @(a,b) @(f,x) a(f,b(f,x)); +%! Mult = @(a,b) @(f,x) a(@(x) b(f,x),x); +%! Dec = @(a) @(f,x) C(a(@(g) @(h) h(g(f)), @(u) x), @(u) u); % Decrement +%! Sub = @(a,b) b(Dec, a); +%! +%! % Renderer - Convert church numeral to "real" number +%! render = @(n) n(@(n) n+1,0); +%! +%! % Predicates +%! iszero = @(n) n(@(x) F, T); +%! +%! % Y combinator implements recursion +%! Y = @(f) C(@(g) f(@(x) C(g(g), x)), ... +%! @(g) f(@(x) C(g(g), x))); +%! +%! Factorial = Y(@(f) @(n) C(C2(iszero(n), ... +%! @(d) One, @(d) Mult(n, f(Dec(n)))),0)); +%! +%! assert (render(Factorial(Two), 2)) +%! assert (render(Factorial(Three), 3)) +%! assert (render(Factorial(Four), 12))