annotate scripts/general/logspace.m @ 30875:5d3faba0342e

doc: Ensure documentation lists output argument when it exists for all m-files. For new users of Octave it is best to show explicit calling forms in the documentation and to show a return argument when it exists. * bp-table.cc, shift.m, accumarray.m, accumdim.m, bincoeff.m, bitcmp.m, bitget.m, bitset.m, blkdiag.m, celldisp.m, cplxpair.m, dblquad.m, flip.m, fliplr.m, flipud.m, idivide.m, int2str.m, interpft.m, logspace.m, num2str.m, polyarea.m, postpad.m, prepad.m, randi.m, repmat.m, rng.m, rot90.m, rotdim.m, structfun.m, triplequad.m, uibuttongroup.m, uicontrol.m, uipanel.m, uipushtool.m, uitoggletool.m, uitoolbar.m, waitforbuttonpress.m, help.m, __additional_help_message__.m, hsv.m, im2double.m, im2frame.m, javachk.m, usejava.m, argnames.m, char.m, formula.m, inline.m, __vectorize__.m, findstr.m, flipdim.m, strmatch.m, vectorize.m, commutation_matrix.m, cond.m, cross.m, duplication_matrix.m, expm.m, orth.m, rank.m, rref.m, trace.m, vech.m, cast.m, compare_versions.m, delete.m, dir.m, fileattrib.m, grabcode.m, gunzip.m, inputname.m, license.m, list_primes.m, ls.m, mexext.m, movefile.m, namelengthmax.m, nargoutchk.m, nthargout.m, substruct.m, swapbytes.m, ver.m, verLessThan.m, what.m, fminunc.m, fsolve.m, fzero.m, optimget.m, __fdjac__.m, matlabroot.m, savepath.m, campos.m, camroll.m, camtarget.m, camup.m, camva.m, camzoom.m, clabel.m, diffuse.m, legend.m, orient.m, rticks.m, specular.m, thetaticks.m, xlim.m, xtickangle.m, xticklabels.m, xticks.m, ylim.m, ytickangle.m, yticklabels.m, yticks.m, zlim.m, ztickangle.m, zticklabels.m, zticks.m, ellipsoid.m, isocolors.m, isonormals.m, stairs.m, surfnorm.m, __actual_axis_position__.m, __pltopt__.m, close.m, graphics_toolkit.m, pan.m, print.m, printd.m, __ghostscript__.m, __gnuplot_print__.m, __opengl_print__.m, rotate3d.m, subplot.m, zoom.m, compan.m, conv.m, poly.m, polyaffine.m, polyder.m, polyint.m, polyout.m, polyreduce.m, polyvalm.m, roots.m, prefdir.m, prefsfile.m, profexplore.m, profexport.m, profshow.m, powerset.m, unique.m, arch_rnd.m, arma_rnd.m, autoreg_matrix.m, bartlett.m, blackman.m, detrend.m, durbinlevinson.m, fftconv.m, fftfilt.m, fftshift.m, fractdiff.m, hamming.m, hanning.m, hurst.m, ifftshift.m, rectangle_lw.m, rectangle_sw.m, triangle_lw.m, sinc.m, sinetone.m, sinewave.m, spectral_adf.m, spectral_xdf.m, spencer.m, ilu.m, __sprand__.m, sprand.m, sprandn.m, sprandsym.m, treelayout.m, beta.m, betainc.m, betaincinv.m, betaln.m, cosint.m, expint.m, factorial.m, gammainc.m, gammaincinv.m, lcm.m, nthroot.m, perms.m, reallog.m, realpow.m, realsqrt.m, sinint.m, hadamard.m, hankel.m, hilb.m, invhilb.m, magic.m, pascal.m, rosser.m, toeplitz.m, vander.m, wilkinson.m, center.m, corr.m, cov.m, discrete_cdf.m, discrete_inv.m, discrete_pdf.m, discrete_rnd.m, empirical_cdf.m, empirical_inv.m, empirical_pdf.m, empirical_rnd.m, kendall.m, kurtosis.m, mad.m, mean.m, meansq.m, median.m, mode.m, moment.m, range.m, ranks.m, run_count.m, skewness.m, spearman.m, statistics.m, std.m, base2dec.m, bin2dec.m, blanks.m, cstrcat.m, deblank.m, dec2base.m, dec2bin.m, dec2hex.m, hex2dec.m, index.m, regexptranslate.m, rindex.m, strcat.m, strjust.m, strtrim.m, strtrunc.m, substr.m, untabify.m, __have_feature__.m, __prog_output_assert__.m, __run_test_suite__.m, example.m, fail.m, asctime.m, calendar.m, ctime.m, date.m, etime.m: Add return arguments to @deftypefn macros where they were missing. Rename variables in functions (particularly generic "retval") to match documentation. Rename some return variables for (hopefully) better clarity (e.g., 'ax' to 'hax' to indicate it is a graphics handle to an axes object).
author Rik <rik@octave.org>
date Wed, 30 Mar 2022 20:40:27 -0700
parents 796f54d4ddbf
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30379
diff changeset
3 ## Copyright (C) 1993-2022 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27898
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
7 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
8 ## This file is part of Octave.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24505
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24505
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
13 ## (at your option) any later version.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
14 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
18 ## GNU General Public License for more details.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
19 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2311
diff changeset
20 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6630
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24505
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
245
16a24e76d6e0 [project @ 1993-12-03 02:00:15 by jwe]
jwe
parents: 4
diff changeset
25
3369
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
26 ## -*- texinfo -*-
30875
5d3faba0342e doc: Ensure documentation lists output argument when it exists for all m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
27 ## @deftypefn {} {@var{y} =} logspace (@var{a}, @var{b})
5d3faba0342e doc: Ensure documentation lists output argument when it exists for all m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
28 ## @deftypefnx {} {@var{y} =} logspace (@var{a}, @var{b}, @var{n})
5d3faba0342e doc: Ensure documentation lists output argument when it exists for all m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
29 ## @deftypefnx {} {@var{y} =} logspace (@var{a}, pi, @var{n})
12639
4d777e05d47c doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
30 ## Return a row vector with @var{n} elements logarithmically spaced from
3369
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
31 ## @tex
12639
4d777e05d47c doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
32 ## $10^{a}$ to $10^{b}$.
3369
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
33 ## @end tex
8517
81d6ab3ac93c Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents: 7411
diff changeset
34 ## @ifnottex
12639
4d777e05d47c doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
35 ## 10^@var{a} to 10^@var{b}.
8517
81d6ab3ac93c Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents: 7411
diff changeset
36 ## @end ifnottex
20158
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
37 ##
12639
4d777e05d47c doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
38 ## If @var{n} is unspecified it defaults to 50.
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3407
diff changeset
39 ##
12639
4d777e05d47c doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
40 ## If @var{b} is equal to
3369
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
41 ## @tex
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
42 ## $\pi$,
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
43 ## @end tex
8517
81d6ab3ac93c Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents: 7411
diff changeset
44 ## @ifnottex
3369
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
45 ## pi,
8517
81d6ab3ac93c Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents: 7411
diff changeset
46 ## @end ifnottex
3369
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
47 ## the points are between
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
48 ## @tex
12639
4d777e05d47c doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
49 ## $10^{a}$ and $\pi$,
3369
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
50 ## @end tex
8517
81d6ab3ac93c Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents: 7411
diff changeset
51 ## @ifnottex
12639
4d777e05d47c doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
52 ## 10^@var{a} and pi,
8517
81d6ab3ac93c Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents: 7411
diff changeset
53 ## @end ifnottex
3369
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
54 ## @emph{not}
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
55 ## @tex
12639
4d777e05d47c doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
56 ## $10^{a}$ and $10^{\pi}$,
3369
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
57 ## @end tex
8517
81d6ab3ac93c Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents: 7411
diff changeset
58 ## @ifnottex
12639
4d777e05d47c doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
59 ## 10^@var{a} and 10^pi,
8517
81d6ab3ac93c Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents: 7411
diff changeset
60 ## @end ifnottex
12639
4d777e05d47c doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
61 ## in order to be compatible with the corresponding @sc{matlab} function.
6630
0fcc8d65b571 [project @ 2007-05-16 15:32:09 by jwe]
jwe
parents: 6629
diff changeset
62 ##
24504
5188d936c79a doc: Documentation fixes for linspace, logspace, lookup (bug #52785).
Rik <rik@octave.org>
parents: 23219
diff changeset
63 ## Also for compatibility with @sc{matlab}, return the right-hand side of
5188d936c79a doc: Documentation fixes for linspace, logspace, lookup (bug #52785).
Rik <rik@octave.org>
parents: 23219
diff changeset
64 ## the range
5188d936c79a doc: Documentation fixes for linspace, logspace, lookup (bug #52785).
Rik <rik@octave.org>
parents: 23219
diff changeset
65 ## @tex
5188d936c79a doc: Documentation fixes for linspace, logspace, lookup (bug #52785).
Rik <rik@octave.org>
parents: 23219
diff changeset
66 ## ($10^{b}$)
5188d936c79a doc: Documentation fixes for linspace, logspace, lookup (bug #52785).
Rik <rik@octave.org>
parents: 23219
diff changeset
67 ## @end tex
5188d936c79a doc: Documentation fixes for linspace, logspace, lookup (bug #52785).
Rik <rik@octave.org>
parents: 23219
diff changeset
68 ## @ifnottex
5188d936c79a doc: Documentation fixes for linspace, logspace, lookup (bug #52785).
Rik <rik@octave.org>
parents: 23219
diff changeset
69 ## (10^@var{b})
5188d936c79a doc: Documentation fixes for linspace, logspace, lookup (bug #52785).
Rik <rik@octave.org>
parents: 23219
diff changeset
70 ## @end ifnottex
5188d936c79a doc: Documentation fixes for linspace, logspace, lookup (bug #52785).
Rik <rik@octave.org>
parents: 23219
diff changeset
71 ## when just a single value is requested.
5642
2618a0750ae6 [project @ 2006-03-06 21:26:48 by jwe]
jwe
parents: 5307
diff changeset
72 ## @seealso{linspace}
3369
f37ca3017116 [project @ 1999-11-21 16:26:02 by jwe]
jwe
parents: 2847
diff changeset
73 ## @end deftypefn
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
74
30875
5d3faba0342e doc: Ensure documentation lists output argument when it exists for all m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
75 function y = logspace (a, b, n = 50)
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
76
28789
28de41192f3c Eliminate unneeded verification of nargin, nargout in m-files.
Rik <rik@octave.org>
parents: 27923
diff changeset
77 if (nargin < 2)
6046
34f96dd5441b [project @ 2006-10-10 16:10:25 by jwe]
jwe
parents: 5642
diff changeset
78 print_usage ();
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
79 endif
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
80
25039
40a65b30fadf maint: Match variable names in documentation to those in function prototype.
Rik <rik@octave.org>
parents: 24534
diff changeset
81 if (! (isscalar (a) && isscalar (b) && isscalar (n)))
40a65b30fadf maint: Match variable names in documentation to those in function prototype.
Rik <rik@octave.org>
parents: 24534
diff changeset
82 error ("logspace: arguments A, B, and N must be scalars");
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
83 endif
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
84
13288
497bb1cf7b15 logspace.m: Simplify function by using default values for arguments
Rik <octave@nomad.inbox5.com>
parents: 12639
diff changeset
85 npoints = fix (n);
497bb1cf7b15 logspace.m: Simplify function by using default values for arguments
Rik <octave@nomad.inbox5.com>
parents: 12639
diff changeset
86
25039
40a65b30fadf maint: Match variable names in documentation to those in function prototype.
Rik <rik@octave.org>
parents: 24534
diff changeset
87 if (b == pi)
40a65b30fadf maint: Match variable names in documentation to those in function prototype.
Rik <rik@octave.org>
parents: 24534
diff changeset
88 b = log10 (pi);
13288
497bb1cf7b15 logspace.m: Simplify function by using default values for arguments
Rik <octave@nomad.inbox5.com>
parents: 12639
diff changeset
89 endif
497bb1cf7b15 logspace.m: Simplify function by using default values for arguments
Rik <octave@nomad.inbox5.com>
parents: 12639
diff changeset
90
30875
5d3faba0342e doc: Ensure documentation lists output argument when it exists for all m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
91 y = 10 .^ (linspace (a, b, npoints));
13288
497bb1cf7b15 logspace.m: Simplify function by using default values for arguments
Rik <octave@nomad.inbox5.com>
parents: 12639
diff changeset
92
4
b4df021f796c [project @ 1993-08-08 01:26:08 by jwe]
jwe
parents:
diff changeset
93 endfunction
7411
83a8781b529d [project @ 2008-01-22 21:52:25 by jwe]
jwe
parents: 7017
diff changeset
94
30379
363fb10055df maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30330
diff changeset
95
7411
83a8781b529d [project @ 2008-01-22 21:52:25 by jwe]
jwe
parents: 7017
diff changeset
96 %!test
83a8781b529d [project @ 2008-01-22 21:52:25 by jwe]
jwe
parents: 7017
diff changeset
97 %! x1 = logspace (1, 2);
13288
497bb1cf7b15 logspace.m: Simplify function by using default values for arguments
Rik <octave@nomad.inbox5.com>
parents: 12639
diff changeset
98 %! x2 = logspace (1, 2, 10.1);
7411
83a8781b529d [project @ 2008-01-22 21:52:25 by jwe]
jwe
parents: 7017
diff changeset
99 %! x3 = logspace (1, -2, 10);
83a8781b529d [project @ 2008-01-22 21:52:25 by jwe]
jwe
parents: 7017
diff changeset
100 %! x4 = logspace (1, pi, 10);
30330
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
101 %! assert (size (x1) == [1, 50]);
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
102 %! assert (abs (x1(1) - 10) < eps);
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
103 %! assert (abs (x1(50) - 100) < eps);
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
104 %! assert (size (x2) == [1, 10]);
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
105 %! assert (abs (x2(1) - 10) < eps);
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
106 %! assert (abs (x2(10) - 100) < eps);
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
107 %! assert (size (x3) == [1, 10]);
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
108 %! assert (abs (x3(1) - 10) < eps);
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
109 %! assert (abs (x3(10) - 0.01) < eps);
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
110 %! assert (size (x4) == [1, 10]);
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
111 %! assert (abs (x4(1) - 10) < eps);
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
112 %! assert (abs (x4(10) - pi) < sqrt (eps));
27435
a8a5d2e8807f Produce symmetric sequences for linspace (bug #56659).
Rik <rik@octave.org>
parents: 26376
diff changeset
113
a8a5d2e8807f Produce symmetric sequences for linspace (bug #56659).
Rik <rik@octave.org>
parents: 26376
diff changeset
114 ## Edge cases
25237
ca022a8c4015 linspace: handle ranges with equal Inf endpoints (bug #53489)
Maor Shutman <maorus12@gmail.com>
parents: 25054
diff changeset
115 %!assert (logspace (Inf, Inf, 3), [Inf, Inf, Inf])
27435
a8a5d2e8807f Produce symmetric sequences for linspace (bug #56659).
Rik <rik@octave.org>
parents: 26376
diff changeset
116 %!assert (logspace (-Inf, Inf, 3), [0, 1, Inf])
29790
10292fb30c8f logspace.m: Mark tests as known to fail on macOS (bug #55538).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29358
diff changeset
117 %!testif ; ! ismac ()
30330
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
118 %! assert (logspace (Inf + 1i, Inf + 1i, 3),
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
119 %! repmat (complex (-Inf,Inf), [1, 3]))
29790
10292fb30c8f logspace.m: Mark tests as known to fail on macOS (bug #55538).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29358
diff changeset
120 %!testif ; ismac () <55538>
30330
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
121 %! assert (logspace (Inf + 1i, Inf + 1i, 3),
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
122 %! repmat (complex (-Inf,Inf), [1, 3]))
29790
10292fb30c8f logspace.m: Mark tests as known to fail on macOS (bug #55538).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29358
diff changeset
123 %!testif ; ! ismac ()
30330
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
124 %! assert (logspace (-Inf + 1i, Inf + 1i, 3),
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
125 %! [0, NaN + NaN * 1i, complex(-Inf, Inf)])
29790
10292fb30c8f logspace.m: Mark tests as known to fail on macOS (bug #55538).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29358
diff changeset
126 %!testif ; ismac () <55538>
30330
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
127 %! assert (logspace (-Inf + 1i, Inf + 1i, 3),
01de0045b2e3 maint: Shorten some long lines to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29791
diff changeset
128 %! [0, NaN + NaN * 1i, complex(-Inf, Inf)])
25237
ca022a8c4015 linspace: handle ranges with equal Inf endpoints (bug #53489)
Maor Shutman <maorus12@gmail.com>
parents: 25054
diff changeset
129 %!assert (logspace (0, Inf, 3), [1, Inf, Inf])
ca022a8c4015 linspace: handle ranges with equal Inf endpoints (bug #53489)
Maor Shutman <maorus12@gmail.com>
parents: 25054
diff changeset
130 %!assert (logspace (0, -Inf, 3), [1, 0, 0])
27435
a8a5d2e8807f Produce symmetric sequences for linspace (bug #56659).
Rik <rik@octave.org>
parents: 26376
diff changeset
131 %!assert (logspace (Inf, -Inf, 3), [Inf, 1, 0])
a8a5d2e8807f Produce symmetric sequences for linspace (bug #56659).
Rik <rik@octave.org>
parents: 26376
diff changeset
132
a8a5d2e8807f Produce symmetric sequences for linspace (bug #56659).
Rik <rik@octave.org>
parents: 26376
diff changeset
133 ## FIXME: These are bizarre corner cases for Matlab compatibility. See
a8a5d2e8807f Produce symmetric sequences for linspace (bug #56659).
Rik <rik@octave.org>
parents: 26376
diff changeset
134 ## bug #56933. This is marked as "Won't Fix", but if linspace is updated at
a8a5d2e8807f Produce symmetric sequences for linspace (bug #56659).
Rik <rik@octave.org>
parents: 26376
diff changeset
135 ## some point then these tests can be re-instated.
a8a5d2e8807f Produce symmetric sequences for linspace (bug #56659).
Rik <rik@octave.org>
parents: 26376
diff changeset
136 ##%!assert (logspace (-Inf, 0, 3), [0, NaN, 1])
a8a5d2e8807f Produce symmetric sequences for linspace (bug #56659).
Rik <rik@octave.org>
parents: 26376
diff changeset
137 ##%!assert (logspace (Inf, 0, 3), [Inf, NaN, 1])
7411
83a8781b529d [project @ 2008-01-22 21:52:25 by jwe]
jwe
parents: 7017
diff changeset
138
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
139 ## Test input validation
28886
d8318c12d903 test: remove unnecessary BIST tests in m-files checking for excessive number of inputs.
Rik <rik@octave.org>
parents: 28789
diff changeset
140 %!error <Invalid call> logspace ()
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
141 %!error logspace ([1, 2; 3, 4], 5, 6)
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
142 %!error logspace (1, [1, 2; 3, 4], 6)
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
143 %!error logspace (1, 2, [1, 2; 3, 4])