*** octave/src/data.cc Tue Jul 29 13:00:22 2003 --- ../ver1/src/data.cc Tue Jul 29 16:04:08 2003 *************** fill_matrix (const octave_value_list& ar *** 935,942 **** octave_value retval; int nargin = args.length (); ! switch (nargin) { case 0: retval = val; --- 935,977 ---- octave_value retval; int nargin = args.length (); + int ndim = 0; + int type = 0; + Array dims; + + // check for type information + if (nargin>0 && args(nargin-1).is_string ()) + { + nargin--; + // XXX FIXME XXX + // allow to specify a type for the resulting matrix, e.g. + // zeros(n1, n2, ..., 'real') + // zeros(n1, n2, ..., 'complex') + // type = get_type( args(nargin).string_value () ); + } + // determine matrix dimension + switch (nargin) { + case 0: + ndim = 0; + type = 0; + break; + case 1: + get_dimensions(args(0), fcn, dims); + default: + dims.resize(nargin); + for (int i=0; i (dims, val)); ! } break; } *************** DEFUN (ones, args, , *** 974,981 **** "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} ones (@var{x})\n\ @deftypefnx {Built-in Function} {} ones (@var{n}, @var{m})\n\ ! Return a matrix whose elements are all 1. The arguments are handled\n\ ! the same as the arguments for @code{eye}.\n\ \n\ If you need to create a matrix whose values are all the same, you should\n\ use an expression like\n\ --- 1007,1015 ---- "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} ones (@var{x})\n\ @deftypefnx {Built-in Function} {} ones (@var{n}, @var{m})\n\ ! @deftypefnx {Built-in Function} {} ones (@var{n}, @var{m}, @var{k},...)\n\ ! Return a matrix or nd-array whose elements are all 1. The arguments are\n\ ! handled the same as the arguments for @code{eye}.\n\ \n\ If you need to create a matrix whose values are all the same, you should\n\ use an expression like\n\ *************** DEFUN (zeros, args, , *** 992,999 **** "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} zeros (@var{x})\n\ @deftypefnx {Built-in Function} {} zeros (@var{n}, @var{m})\n\ ! Return a matrix whose elements are all 0. The arguments are handled\n\ ! the same as the arguments for @code{eye}.\n\ @end deftypefn") { return fill_matrix (args, 0.0, "zeros"); --- 1026,1034 ---- "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} zeros (@var{x})\n\ @deftypefnx {Built-in Function} {} zeros (@var{n}, @var{m})\n\ ! @deftypefnx {Built-in Function} {} zeros (@var{n}, @var{m}, @var{k},...)\n\ ! Return a matrix or nd-array whose elements are all 0. The arguments are\n\ ! handled the same as the arguments for @code{eye}.\n\ @end deftypefn") { return fill_matrix (args, 0.0, "zeros");