Mercurial > hg > octave-avbm
changeset 5717:34cda7d94c08
[project @ 2006-03-27 22:26:18 by jwe]
author | jwe |
---|---|
date | Mon, 27 Mar 2006 22:26:21 +0000 |
parents | 7f79a99e273e |
children | 3f80480016c5 |
files | ChangeLog configure.in doc/ChangeLog doc/interpreter/images/sparseimages.m liboctave/CMatrix.cc liboctave/CMatrix.h liboctave/ChangeLog liboctave/dMatrix.cc liboctave/dMatrix.h liboctave/dSparse.cc scripts/ChangeLog scripts/plot/meshgrid.m scripts/time/toc.m src/ChangeLog src/DLD-FUNCTIONS/spchol.cc src/ov-cell.cc src/ov-list.cc src/toplev.cc |
diffstat | 18 files changed, 144 insertions(+), 176 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-03-27 John W. Eaton <jwe@octave.org> + + * configure.in: Downcase ac_cv_header_mach_o_dyld_h. + From Martin Costabel <costabel@wanadoo.fr>. + 2006-03-22 John W. Eaton <jwe@octave.org> * Makeconf.in: (TEXINFO_COLAMD, TEXINFO_CHOLMOD, TEXINFO_UMFPACK):
--- a/configure.in +++ b/configure.in @@ -29,7 +29,7 @@ EXTERN_CXXFLAGS="$CXXFLAGS" AC_INIT -AC_REVISION($Revision: 1.503 $) +AC_REVISION($Revision: 1.504 $) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -1290,7 +1290,7 @@ ### Check for dyld first since OS X can have a non-standard libdl AC_CHECK_HEADER(mach-o/dyld.h) - if test "$ac_cv_header_Mach_O_dyld_h" = yes; then + if test "$ac_cv_header_mach_o_dyld_h" = yes; then dyld_api=true else AC_CHECK_LIB(dld, shl_load)
--- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2006-03-24 John W. Eaton <jwe@octave.org> + + * interpreter/images/sparseimages.m: + Avoid some unnecessary calculations. + 2006-03-22 John W. Eaton <jwe@octave.org> * interpreter/sparse.txi: Undo previous change.
--- a/doc/interpreter/images/sparseimages.m +++ b/doc/interpreter/images/sparseimages.m @@ -2,12 +2,12 @@ if (strcmp(typ,"txt")) txtimages(nm,15,typ); else - otherimages(nm,200,typ); if (strcmp (nm, "gplot")) gplotimages("gplot",typ); - endif - if (strcmp (nm, "grid")) + elseif (strcmp (nm, "grid")) femimages("grid",typ); + else + otherimages(nm,200,typ); endif endif ## Kluge to give gnuplot enough time to process last figure before we @@ -47,21 +47,20 @@ fputs (fid, "| Image unavailable in text mode. |\n"); fputs (fid, "+---------------------------------+\n"); fclose (fid); - endif - if (strcmp (nm, "spmatrix")) + elseif (strcmp (nm, "spmatrix")) printsparse(a,strcat("spmatrix.",typ)); - endif - if (!isempty(findstr(octave_config_info ("DEFS"),"HAVE_COLAMD")) && - !isempty(findstr(octave_config_info ("DEFS"),"HAVE_CHOLMOD"))) - r1 = chol(a); - if (strcmp (nm, "spchol")) - printsparse(r1,strcat("spchol.",typ)); + else + if (!isempty(findstr(octave_config_info ("DEFS"),"HAVE_COLAMD")) && + !isempty(findstr(octave_config_info ("DEFS"),"HAVE_CHOLMOD"))) + if (strcmp (nm, "spchol")) + r1 = chol(a); + printsparse(r1,strcat("spchol.",typ)); + elseif (strcmp (nm, "spcholperm")) + [r2,p2,q2]=chol(a); + printsparse(r2,strcat("spcholperm.",typ)); + endif + ## printf("Text NNZ: Matrix %d, Chol %d, PermChol %d\n",nnz(a),nnz(r1),nnz(r2)); endif - [r2,p2,q2]=chol(a); - if (strcmp (nm, "spcholperm")) - printsparse(r2,strcat("spcholperm.",typ)); - endif - ## printf("Text NNZ: Matrix %d, Chol %d, PermChol %d\n",nnz(a),nnz(r1),nnz(r2)); endif endfunction @@ -69,30 +68,29 @@ bury_output (); a = 10*speye(n) + sparse(1:n,ceil([1:n]/2),1,n,n) + ... sparse(ceil([1:n]/2),1:n,1,n,n); - spy(a); - axis("ij") if (strcmp (nm, "spmatrix")) + spy(a); + axis("ij") print(strcat("spmatrix.",typ),strcat("-d",typ)) bury_output (); - endif - if (!isempty(findstr(octave_config_info ("DEFS"),"HAVE_COLAMD")) && - !isempty(findstr(octave_config_info ("DEFS"),"HAVE_CHOLMOD"))) - r1 = chol(a); - spy(r1); - axis("ij") - if (strcmp (nm, "spchol")) - print(strcat("spchol.",typ),strcat("-d",typ)) - bury_output (); - endif - [r2,p2,q2]=chol(a); - spy(r2); - axis("ij") - if (strcmp (nm, "spcholperm")) - print(strcat("spcholperm.",typ),strcat("-d",typ)) - bury_output (); - endif - ## printf("Image NNZ: Matrix %d, Chol %d, PermChol %d\n",nnz(a),nnz(r1),nnz(r2)); - axis("xy") + else + if (!isempty(findstr(octave_config_info ("DEFS"),"HAVE_COLAMD")) && + !isempty(findstr(octave_config_info ("DEFS"),"HAVE_CHOLMOD"))) + if (strcmp (nm, "spchol")) + r1 = chol(a); + spy(r1); + axis("ij") + print(strcat("spchol.",typ),strcat("-d",typ)) + bury_output (); + elseif (strcmp (nm, "spcholperm")) + [r2,p2,q2]=chol(a); + spy(r2); + axis("ij") + print(strcat("spcholperm.",typ),strcat("-d",typ)) + bury_output (); + endif + ## printf("Image NNZ: Matrix %d, Chol %d, PermChol %d\n",nnz(a),nnz(r1),nnz(r2)); + axis("xy") endif endfunction
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -889,27 +889,6 @@ return retval; } -ComplexRowVector -ComplexMatrix::row (char *s) const -{ - if (! s) - { - (*current_liboctave_error_handler) ("invalid row selection"); - return ComplexRowVector (); - } - - char c = *s; - if (c == 'f' || c == 'F') - return row (static_cast<octave_idx_type>(0)); - else if (c == 'l' || c == 'L') - return row (rows () - 1); - else - { - (*current_liboctave_error_handler) ("invalid row selection"); - return ComplexRowVector (); - } -} - ComplexColumnVector ComplexMatrix::column (octave_idx_type i) const { @@ -927,27 +906,6 @@ return retval; } -ComplexColumnVector -ComplexMatrix::column (char *s) const -{ - if (! s) - { - (*current_liboctave_error_handler) ("invalid column selection"); - return ComplexColumnVector (); - } - - char c = *s; - if (c == 'f' || c == 'F') - return column (static_cast<octave_idx_type>(0)); - else if (c == 'l' || c == 'L') - return column (cols () - 1); - else - { - (*current_liboctave_error_handler) ("invalid column selection"); - return ComplexColumnVector (); - } -} - ComplexMatrix ComplexMatrix::inverse (void) const {
--- a/liboctave/CMatrix.h +++ b/liboctave/CMatrix.h @@ -130,10 +130,8 @@ // extract row or column i. ComplexRowVector row (octave_idx_type i) const; - ComplexRowVector row (char *s) const; ComplexColumnVector column (octave_idx_type i) const; - ComplexColumnVector column (char *s) const; ComplexMatrix inverse (void) const; ComplexMatrix inverse (octave_idx_type& info) const;
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,14 @@ +2006-03-24 John W. Eaton <jwe@octave.org> + + * dSparse.cc (SparseMatrix::bsolve): Integer work vector is + Array<octave_idx_type>, so fortran_vec returns pointer to + octave_idx_type, not pointer to int. + + * CMatrix.cc, CMatrix.h (ComplexMatrix::row (char*), + ComplexMatrix::column (char*)): Delete. + * dMatrix.cc, dMatrix.h (Matrix::row (char*), + Matrix::column (char*)): Delete. + 2006-03-21 David Bateman <dbateman@free.fr> * SparseQR.h: Publish externally used friends.
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -559,27 +559,6 @@ return retval; } -RowVector -Matrix::row (char *s) const -{ - if (! s) - { - (*current_liboctave_error_handler) ("invalid row selection"); - return RowVector (); - } - - char c = *s; - if (c == 'f' || c == 'F') - return row ( static_cast<octave_idx_type>(0) ); - else if (c == 'l' || c == 'L') - return row (rows () - 1); - else - { - (*current_liboctave_error_handler) ("invalid row selection"); - return RowVector (); - } -} - ColumnVector Matrix::column (octave_idx_type i) const { @@ -597,27 +576,6 @@ return retval; } -ColumnVector -Matrix::column (char *s) const -{ - if (! s) - { - (*current_liboctave_error_handler) ("invalid column selection"); - return ColumnVector (); - } - - char c = *s; - if (c == 'f' || c == 'F') - return column (static_cast<octave_idx_type> (0)); - else if (c == 'l' || c == 'L') - return column (cols () - 1); - else - { - (*current_liboctave_error_handler) ("invalid column selection"); - return ColumnVector (); - } -} - Matrix Matrix::inverse (void) const {
--- a/liboctave/dMatrix.h +++ b/liboctave/dMatrix.h @@ -102,10 +102,8 @@ // extract row or column i. RowVector row (octave_idx_type i) const; - RowVector row (char *s) const; ColumnVector column (octave_idx_type i) const; - ColumnVector column (char *s) const; Matrix inverse (void) const; Matrix inverse (octave_idx_type& info) const;
--- a/liboctave/dSparse.cc +++ b/liboctave/dSparse.cc @@ -4404,7 +4404,7 @@ Array<double> z (3 * nr); double *pz = z.fortran_vec (); Array<octave_idx_type> iz (nr); - int *piz = iz.fortran_vec (); + octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpbcon, DGBCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -4540,7 +4540,7 @@ Array<double> z (3 * nr); double *pz = z.fortran_vec (); Array<octave_idx_type> iz (nr); - int *piz = iz.fortran_vec (); + octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgbcon, DGBCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -4678,7 +4678,7 @@ Array<double> z (3 * nr); double *pz = z.fortran_vec (); Array<octave_idx_type> iz (nr); - int *piz = iz.fortran_vec (); + octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpbcon, DGBCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -4851,7 +4851,7 @@ Array<double> z (3 * nr); double *pz = z.fortran_vec (); Array<octave_idx_type> iz (nr); - int *piz = iz.fortran_vec (); + octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgbcon, DGBCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -5031,7 +5031,7 @@ Array<double> z (3 * nr); double *pz = z.fortran_vec (); Array<octave_idx_type> iz (nr); - int *piz = iz.fortran_vec (); + octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpbcon, DGBCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -5208,7 +5208,7 @@ Array<double> z (3 * nr); double *pz = z.fortran_vec (); Array<octave_idx_type> iz (nr); - int *piz = iz.fortran_vec (); + octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpbcon, DGBCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -5379,7 +5379,7 @@ Array<double> z (3 * nr); double *pz = z.fortran_vec (); Array<octave_idx_type> iz (nr); - int *piz = iz.fortran_vec (); + octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpbcon, DGBCON, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -5586,7 +5586,7 @@ Array<double> z (3 * nr); double *pz = z.fortran_vec (); Array<octave_idx_type> iz (nr); - int *piz = iz.fortran_vec (); + octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgbcon, DGBCON, (F77_CONST_CHAR_ARG2 (&job, 1),
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,12 @@ +2006-03-27 Don Bindner <dbindner@truman.edu> + + * plot/meshgrid.m: If nargout == 3 and vectors are supplied, + return 3d matrices. + +2006-03-27 Keith Goodman <kwgoodman@gmail.com> + + * time/toc.m: Don't print "Elapsed time..." if tic has not been set. + 2006-03-22 John W. Eaton <jwe@octave.org> * plot/print.m: Don't replot after popping terminal setting.
--- a/scripts/plot/meshgrid.m +++ b/scripts/plot/meshgrid.m @@ -21,13 +21,14 @@ ## @deftypefn {Function File} {[@var{xx}, @var{yy}, @var{zz}] =} meshgrid (@var{x}, @var{y}, @var{z}) ## @deftypefnx {Function File} {[@var{xx}, @var{yy}] =} meshgrid (@var{x}, @var{y}) ## @deftypefnx {Function File} {[@var{xx}, @var{yy}] =} meshgrid (@var{x}) -## Given vectors of @var{x}, @var{y}, and @var{z} coordinates, return -## three dimensional arrays corresponding to the @var{x}, @var{y}, and -## @var{z} coordinates of a mesh. Given only @var{x} and @var{y}, -## return matrices corresponding to the @var{x} and @var{y} coordinates -## of a mesh. The rows of @var{xx} are copies of @var{x}, and the -## columns of @var{yy} are copies of @var{y}. If @var{y} is omitted, -## then it is assumed to be the same as @var{x}. +## Given vectors of @var{x} and @var{y} and @var{z} coordinates, and +## returning 3 arguments, return three dimensional arrays corresponding +## to the @var{x}, @var{y}, and @var{z} coordinates of a mesh. When +## returning only 2 arguments, return matrices corresponding to the +## @var{x} and @var{y} coordinates of a mesh. The rows of @var{xx} are +## copies of @var{x}, and the columns of @var{yy} are copies of @var{y}. +## If @var{y} is omitted, then it is assumed to be the same as @var{x}, +## and @var{z} is assumed the same as @var{y}. ## @seealso{mesh, contour} ## @end deftypefn @@ -35,29 +36,35 @@ function [xx, yy, zz] = meshgrid (x, y, z) - if (nargin == 1) + if (nargin == 0 || nargin > 3) + usage ("[xx, yy, zz] = meshgrid (x, y, z)"); + endif + + if (nargin < 2) y = x; endif - if (nargin > 0 && nargin < 3) + + if (nargout < 3) if (isvector (x) && isvector (y)) xx = ones (length (y), 1) * x(:).'; yy = y(:) * ones (1, length (x)); else error ("meshgrid: arguments must be vectors"); endif - elseif (nargin == 3) - if (isvector (x) && isvector (y) && isvector (z)) - lenx = length (x); - leny = length (y); - lenz = length (z); - xx = repmat (ones (leny, 1) * x(:).', [1, 1, lenz]); - yy = repmat (y(:) * ones (1, lenx), [1, 1, lenz]); - zz = reshape (repmat (z(:).', lenx*leny, 1)(:), leny, lenx, lenz); - else - error ("meshgrid: arguments must be vectors"); - endif else - usage ("[xx, yy, zz] = meshgrid (x, y, z)"); + if (nargin < 3) + z = y; + endif + if (isvector (x) && isvector (y) && isvector (z)) + lenx = length (x); + leny = length (y); + lenz = length (z); + xx = repmat (ones (leny, 1) * x(:).', [1, 1, lenz]); + yy = repmat (y(:) * ones (1, lenx), [1, 1, lenz]); + zz = reshape (repmat (z(:).', lenx*leny, 1)(:), leny, lenx, lenz); + else + error ("meshgrid: arguments must be vectors"); + endif endif endfunction
--- a/scripts/time/toc.m +++ b/scripts/time/toc.m @@ -37,12 +37,11 @@ secs0 = []; else secs0 = etime (clock (), __tic_toc_timestamp__); + if (nargout != 0) + secs = secs0; + else + printf ("Elapsed time is %f seconds.\n", secs0); + endif endif - - if (nargout != 0) - secs = secs0; - else - printf ("Elapsed time is %f seconds.\n", secs0); - endif endfunction
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2006-03-24 John W. Eaton <jwe@octave.org> + * DLD-FUNCTIONS/spchol.cc (Fsymbfact): Use CHOLMOD_NAME to select + proper version of row_subtree function. + + * ov-cell.cc (octave_cell::save_hdf5): Use OSSTREAM instead of + fixed character buffer and sprintf. + * ov-list.cc (octave_list::save_hdf5, octave_list::save_ascii, + octave_list::save_binary): Likewise. + * ov-cell.h (octave_cell::convert_to_str_internal): Undo previous change for pad arg. * ov-cell.cc (octave_cell::all_strings): Reinstate pad arg, pass
--- a/src/DLD-FUNCTIONS/spchol.cc +++ b/src/DLD-FUNCTIONS/spchol.cc @@ -607,7 +607,7 @@ for (octave_idx_type k = 0 ; k < n ; k++) { // get the kth row of L and store in the columns of L - cholmod_row_subtree (A1, A2, k, Parent, R, cm) ; + CHOLMOD_NAME (row_subtree) (A1, A2, k, Parent, R, cm) ; for (octave_idx_type p = 0 ; p < Rp [1] ; p++) L.xridx (W [Ri [p]]++) = k ;
--- a/src/ov-cell.cc +++ b/src/ov-cell.cc @@ -783,10 +783,12 @@ for (octave_idx_type i = 0; i < dv.numel (); i++) { - char s[20]; - sprintf (s, "_%d", i); + OSSTREAM buf; + buf << "_" << i << OSSTREAM_ENDS; + std::string s = OSSTREAM_STR (buf); + OSSTREAM_FREEZE (buf); - if (! add_hdf5_data(data_hid, tmp.elem (i), s, "", false, + if (! add_hdf5_data(data_hid, tmp.elem (i), s.c_str (), "", false, save_as_floats)) { H5Gclose (data_hid);
--- a/src/ov-list.cc +++ b/src/ov-list.cc @@ -536,9 +536,13 @@ for (int i = 0; i < lst.length (); ++i) { // should we use lst.name_tags () to label the elements? - char s[20]; - sprintf (s, "_%d", i); - bool b = save_ascii_data (os, lst (i), s, infnan_warned, + + OSSTREAM buf; + buf << "_" << i << OSSTREAM_ENDS; + std::string s = OSSTREAM_STR (buf); + OSSTREAM_FREEZE (buf); + + bool b = save_ascii_data (os, lst (i), s.c_str (), infnan_warned, strip_nan_and_inf, 0, 0); if (! b) @@ -607,11 +611,15 @@ for (int i = 0; i < lst.length (); i++) { // should we use lst.name_tags () to label the elements? - char s[20]; - sprintf (s, "_%d", i); + + OSSTREAM buf; + buf << "_" << i << OSSTREAM_ENDS; + std::string s = OSSTREAM_STR (buf); + OSSTREAM_FREEZE (buf); // Recurse to print sub-value. - bool b = save_binary_data (os, lst(i), s, "", 0, save_as_floats); + bool b = save_binary_data (os, lst(i), s.c_str (), "", 0, + save_as_floats); if (! b) return false; @@ -683,9 +691,13 @@ for (octave_idx_type i = 0; i < lst.length (); ++i) { // should we use lst.name_tags () to label the elements? - char s[20]; - sprintf (s, "_%d", i); - bool retval2 = add_hdf5_data (data_hid, lst (i), s, "", + + OSSTREAM buf; + buf << "_" << i << OSSTREAM_ENDS; + std::string s = OSSTREAM_STR (buf); + OSSTREAM_FREEZE (buf); + + bool retval2 = add_hdf5_data (data_hid, lst (i), s.c_str (), "", false, save_as_floats); if (! retval2) break;