Mercurial > hg > octave-lyh
changeset 6630:0fcc8d65b571
[project @ 2007-05-16 15:32:09 by jwe]
author | jwe |
---|---|
date | Wed, 16 May 2007 15:32:09 +0000 |
parents | 7e2b5d0cf7ad |
children | 1b8daf8c0397 |
files | liboctave/CRowVector.cc liboctave/dRowVector.cc scripts/general/logspace.m src/data.cc src/load-path.cc src/load-path.h |
diffstat | 6 files changed, 15 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/CRowVector.cc +++ b/liboctave/CRowVector.cc @@ -524,14 +524,11 @@ retval.elem (i) = x1 + 1.0 * i * delta; retval.elem (n-1) = x2; } - else if (n == 1) + else { retval.resize (1); retval.elem (0) = x2; } - else - (*current_liboctave_error_handler) - ("linspace: npoints must be greater than 0"); return retval; }
--- a/liboctave/dRowVector.cc +++ b/liboctave/dRowVector.cc @@ -333,14 +333,11 @@ retval.elem (i) = x1 + i * delta; retval.elem (n-1) = x2; } - else if (n == 1) + else { retval.resize (1); retval.elem (0) = x2; } - else - (*current_liboctave_error_handler) - ("linspace: npoints must be greater than 0"); return retval; }
--- a/scripts/general/logspace.m +++ b/scripts/general/logspace.m @@ -57,7 +57,11 @@ ## @ifinfo ## 10^base and 10^pi, ## @end ifinfo -## in order to be compatible with the corresponding @sc{Matlab} function. +## in order to be compatible with the corresponding @sc{Matlab} +## function. +## +## Also for compatibility, return the second argument if fewer than two +## values are requested. ## @seealso{linspace} ## @end deftypefn
--- a/src/data.cc +++ b/src/data.cc @@ -2325,13 +2325,16 @@ "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} linspace (@var{base}, @var{limit}, @var{n})\n\ Return a row vector with @var{n} linearly spaced elements between\n\ -@var{base} and @var{limit}. The number of elements, @var{n}, must be\n\ -greater than 1. The @var{base} and @var{limit} are always included in\n\ +@var{base} and @var{limit}. If the number of elements is greater than one,\n\ +then the @var{base} and @var{limit} are always included in\n\ the range. If @var{base} is greater than @var{limit}, the elements are\n\ stored in decreasing order. If the number of points is not specified, a\n\ value of 100 is used.\n\ \n\ The @code{linspace} function always returns a row vector.\n\ +\n\ +For compatibility with @sc{Matlab}, return the second argument if\n\ +fewer than two values are requested.\n\ @end deftypefn") { octave_value retval;
--- a/src/load-path.cc +++ b/src/load-path.cc @@ -47,6 +47,7 @@ load_path::hook_function_ptr load_path::add_hook = execute_pkg_add; load_path::hook_function_ptr load_path::remove_hook = execute_pkg_del; std::string load_path::command_line_path; +std::string load_path::sys_path; void load_path::dir_info::update (void) @@ -1287,7 +1288,7 @@ @seealso{path, addpath, rmpath, genpath, savepath, pathsep}\n\ @end deftypefn") { - return load_path::system_path (); + return octave_value (load_path::system_path ()); } DEFUN (path, args, nargout,