Mercurial > hg > octave-lyh
changeset 5989:e049385342f6
[project @ 2006-09-14 02:10:46 by jwe]
author | jwe |
---|---|
date | Thu, 14 Sep 2006 02:10:46 +0000 |
parents | d9ce802628e6 |
children | d90d089a9d32 |
files | ChangeLog run-octave.in scripts/ChangeLog scripts/general/blkdiag.m src/ChangeLog src/DLD-FUNCTIONS/cellfun.cc src/DLD-FUNCTIONS/spkron.cc src/ov-complex.h src/ov-scalar.h |
diffstat | 9 files changed, 89 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-09-13 Christopher Hulbert <cchgroupmail@gmail.com> + + * run-octave.in (LD_LIBRARY_PATH): Also append LD_LIBRARY_PATH + from environment. + 2006-08-25 Alexander Barth <abarth@marine.usf.edu> * mkoctfile.in: Accept .f90 and .F90 as Fortran files.
--- a/run-octave.in +++ b/run-octave.in @@ -28,6 +28,6 @@ fi fi OCTAVE_SITE_INITFILE=$top_srcdir/scripts/startup/main-rcfile \ -LD_LIBRARY_PATH="$builddir/src:$builddir/liboctave:$builddir/libcruft" \ +LD_LIBRARY_PATH="$builddir/src:$builddir/liboctave:$builddir/libcruft:$LD_LIBRARY_PATH" \ exec $driver $builddir/src/octave $args "$@"
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2006-09-13 John W. Eaton <jwe@octave.org> + + * general/blkdiag.m: Adjust to new cellfun rules. + 2006-08-30 David Bateman <dbateman@free.fr> * pkg/pkg.m (install): Disallow bundles of packages. More verbose
--- a/scripts/general/blkdiag.m +++ b/scripts/general/blkdiag.m @@ -32,7 +32,7 @@ usage ("blkdiag (a, b, c, ...)"); endif - if (! all (cell2mat (cellfun (@isnumeric, varargin)))) + if (! all (cellfun (@isnumeric, varargin))) error ("blkdiag: all arguments must be numeric"); endif @@ -43,7 +43,8 @@ ## size is an option for cellfun, but it's a bit different from ## calling size directly. - csz = cumsum ([0 0; (cell2mat (cellfun (@size, varargin')))], 1); + tmp = cell2mat (cellfun (@size, varargin', "UniformOutput", false)); + csz = cumsum ([0 0; tmp], 1); retval = zeros (csz(end,:)); for p = 1:nargin
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,11 +1,28 @@ -2006-08-22 David Bateman <dbateman@free.fr> +2006-09-13 John W. Eaton <jwe@octave.org> + + * DLD-FUNCTIONS/cellfun.cc: Improve error message for uniform + output case when results are not scalars. Avoid shadow decls. + +2006-09-13 David Bateman <dbateman@free.fr> + + * ov-scalar.h (octave_scalar::sparse_matrix_value, + octave_scalar::sparse_complex_matrix_value): New extractor functions. + * ov-complex.h (octave_complex::sparse_matrix_value, + octave_complex::sparse_complex_matrix_value): Ditto. + * DLD-FUNCTIONS/spkron.cc (Fspkron): Change example in help. + +2006-09-12 John W. Eaton <jwe@octave.org> + + * error.cc (warning_1): Call error_2, not error. + +2006-09-12 David Bateman <dbateman@free.fr> * DLD-FUNCTIONS/cellfun.cc (Fcellfun): Allow matlab compatiable - 'UniformOutput' and 'ErrorHandler' options. Change output when + 'UniformOutput' and 'ErrorHandler' options. Change output when called with function handler or inline function to by default have - 'UniformOutput' set to true. Allow functions with multiple inputs - and outputs. Add test code. Replace some int with octave_idx_type. - (Fnum2cell): Replace some int with octave_idx_type. Add test code. + 'UniformOutput' set to true. Allow functions with multiple inputs + and outputs. Add test code. Replace some int with octave_idx_type. + (Fnum2cell): Replace some int with octave_idx_type. Add test code. 2006-09-11 Yozo Hida <yozo@cs.berkeley.edu>
--- a/src/DLD-FUNCTIONS/cellfun.cc +++ b/src/DLD-FUNCTIONS/cellfun.cc @@ -274,7 +274,6 @@ { octave_value_list idx; octave_value_list inputlist; - octave_value_list errlist; bool UniformOutput = true; bool haveErrorHandler = false; std::string err_name; @@ -358,8 +357,8 @@ for (octave_idx_type count = 0; count < k ; count++) { - for (int i = 0; i < nargin-offset; i++) - inputlist(i) = inputs[i](count); + for (int j = 0; j < nargin-offset; j++) + inputlist(j) = inputs[j](count); octave_value_list tmp = feval (func, inputlist, nargout); @@ -394,26 +393,36 @@ if (count == 0) { - for (int i = 0; i < nargout; i++) + for (int j = 0; j < nargout; j++) { octave_value val; - val = tmp(i); + val = tmp(j); if (error_state) goto cellfun_err; val.resize(f_args.dims()); - retval(i) = val; + retval(j) = val; } } else { idx(0) = octave_value (static_cast<double>(count+1)); - for (int i = 0; i < nargout; i++) - retval(i) = - retval(i).subsasgn ("(", - std::list<octave_value_list> - (1, idx(0)), tmp(i)); + for (int j = 0; j < nargout; j++) + { + // FIXME -- need an easier way to express + // this test. + octave_value val = tmp(j); + + if (val.ndims () == 2 + && val.rows () == 1 && val.columns () == 1) + retval(j) = + retval(j).subsasgn ("(", + std::list<octave_value_list> + (1, idx(0)), val); + else + error ("cellfun: expecting all values to be scalars for UniformOutput = true"); + } } if (error_state) @@ -423,13 +432,13 @@ else { OCTAVE_LOCAL_BUFFER (Cell, results, nargout); - for (int i = 0; i < nargout; i++) - results[i].resize(f_args.dims()); + for (int j = 0; j < nargout; j++) + results[j].resize(f_args.dims()); for (octave_idx_type count = 0; count < k ; count++) { - for (int i = 0; i < nargin-offset; i++) - inputlist(i) = inputs[i](count); + for (int j = 0; j < nargin-offset; j++) + inputlist(j) = inputs[j](count); octave_value_list tmp = feval (func, inputlist, nargout); @@ -463,13 +472,13 @@ break; - for (int i = 0; i < nargout; i++) - results[i](count) = tmp(i); + for (int j = 0; j < nargout; j++) + results[j](count) = tmp(j); } retval.resize(nargout); - for (int i = 0; i < nargout; i++) - retval(i) = results[i]; + for (int j = 0; j < nargout; j++) + retval(j) = results[j]; } cellfun_err:
--- a/src/DLD-FUNCTIONS/spkron.cc +++ b/src/DLD-FUNCTIONS/spkron.cc @@ -95,10 +95,19 @@ \n\ @example\n\ @group\n\ -kron (1:4, ones (3, 1))\n\ - @result{} 1 2 3 4\n\ - 1 2 3 4\n\ - 1 2 3 4\n\ +kron(speye(3),spdiag([1,2,3]))\n\ +@result{}\n\ +Compressed Column Sparse (rows = 9, cols = 9, nnz = 9)\n\ +\n\ + (1, 1) -> 1\n\ + (2, 2) -> 2\n\ + (3, 3) -> 3\n\ + (4, 4) -> 1\n\ + (5, 5) -> 2\n\ + (6, 6) -> 3\n\ + (7, 7) -> 1\n\ + (8, 8) -> 2\n\ + (9, 9) -> 3\n\ @end group\n\ @end example\n\ @end deftypefn")
--- a/src/ov-complex.h +++ b/src/ov-complex.h @@ -104,6 +104,12 @@ NDArray array_value (bool = false) const; + SparseMatrix sparse_matrix_value (bool = false) const + { return SparseMatrix (matrix_value ()); } + + SparseComplexMatrix sparse_complex_matrix_value (bool = false) const + { return SparseComplexMatrix (complex_matrix_value ()); } + octave_value resize (const dim_vector& dv, bool fill = false) const; Complex complex_value (bool = false) const;
--- a/src/ov-scalar.h +++ b/src/ov-scalar.h @@ -142,6 +142,13 @@ NDArray array_value (bool = false) const { return NDArray (dim_vector (1, 1), scalar); } + SparseMatrix sparse_matrix_value (bool = false) const + { return SparseMatrix (Matrix (1, 1, scalar)); } + + // XXX FIXME XXX Need SparseComplexMatrix (Matrix) constructor!!! + SparseComplexMatrix sparse_complex_matrix_value (bool = false) const + { return SparseComplexMatrix (sparse_matrix_value ()); } + octave_value resize (const dim_vector& dv, bool fill = false) const; Complex complex_value (bool = false) const { return scalar; }