Mercurial > hg > octave-lojdl
changeset 3136:af7ec9d3a5e6
[project @ 1998-02-01 20:11:06 by jwe]
author | jwe |
---|---|
date | Sun, 01 Feb 1998 20:11:08 +0000 |
parents | 267b3a5c6b28 |
children | bfc3b71002c9 |
files | ChangeLog Makeconf.in PROJECTS acconfig.h libcruft/ChangeLog libcruft/quadpack/dqagp.f libcruft/quadpack/dqk15i.f libcruft/quadpack/dqk21.f liboctave/ChangeLog liboctave/Quad.cc liboctave/chMatrix.cc liboctave/chMatrix.h octMakefile.in scripts/ChangeLog scripts/plot/contour.m src/ChangeLog src/error.cc src/load-save.cc src/ov-ch-mat.cc src/ov-ch-mat.h src/ov-str-mat.cc src/ov-str-mat.h src/toplev.cc test/octave.test/prefer/prefer-39.m |
diffstat | 24 files changed, 285 insertions(+), 70 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Jan 31 19:29:56 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * acconfig.h: Add #undefs for HAVE_GAMMA and HAVE_LGAMMA to avoid + bug in autoconf, but #if 0 them out to avoid warning messages + about redefining them. + Mon Jan 26 13:26:09 1998 John W. Eaton <jwe@bevo.che.wisc.edu> * Makeconf.in (do-subst-config-vals): Substitute XTRA_CFLAGS and
--- a/Makeconf.in +++ b/Makeconf.in @@ -241,7 +241,7 @@ imagepath = @imagepath@ # The type of computer we are running on. -target_host_type = @target_host_type@ +canonical_host_type = @canonical_host_type@ # The following pattern rules and the substitution functions require # GNU make. If you don't have it, get it! @@ -332,7 +332,7 @@ -e "s;%RLD_FLAG%;\"${RLD_FLAG}\";" \ -e "s;%SH_LD%;\"${SH_LD}\";" \ -e "s;%SH_LDFLAGS%;\"${SH_LDFLAGS}\";" \ - -e "s;%TARGET_HOST_TYPE%;\"${target_host_type}\";" \ + -e "s;%TARGET_HOST_TYPE%;\"${canonical_host_type}\";" \ -e "s;%TERMLIBS%;\"${TERMLIBS}\";" \ -e "s;%VERSION%;\"${version}\";" \ -e "s;%XTRA_CFLAGS%;\"${XTRA_CFLAGS}\";" \ @@ -362,7 +362,7 @@ -e "s;%OCTAVE_LOCALOCTFILEPATH%;\"${localoctfilepath}\";" \ -e "s;%OCTAVE_OCTFILEDIR%;\"${octfiledir}\";" \ -e "s;%OCTAVE_PREFIX%;\"${prefix}\";" \ - -e "s;%TARGET_HOST_TYPE%;\"${target_host_type}\";" + -e "s;%TARGET_HOST_TYPE%;\"${canonical_host_type}\";" $(top_srcdir)/move-if-change $@.tmp $@ endef
--- a/PROJECTS +++ b/PROJECTS @@ -119,6 +119,9 @@ before octave returns a prompt. Possible by implementing two way communication between gnuplot and Octave. + * Handle gnuplot ranges correctly for parametric modes (accept 3 + ranges for 2d plots and 5 ranges for 3d plots). + * Make gsave (and possibly gload) work. Implement gsave by having it also alter the plot command to not use temporary files (perhaps with some user-specified template for naming them) and then @@ -709,6 +712,27 @@ Perhaps this can be done entirely with a library of M-files. + * An interface to gdb. + + Michael Smolsky <fnsiguc@weizmann.weizmann.ac.il> wrote: + + I was thinking about a tool, which could be very useful for me + in my numerical simulation work. It is an interconnection + between gdb and octave. We are often managing very large arrays + of data in our fortran or c codes, which might be studied with + the help of octave at the algorithm development stages. Assume + you're coding, say, wave equation. And want to debug the + code. It would be great to pick some array from the memory of + the code you're develloping, fft it and see the image as a + log-log plot of the spectral density. I'm facing similar + problems now. To avoid high c-development cost, I develop in + matlab/octave, and then rewrite into c. It might be so much + easier, if I could off-load a c array right from the debugger + into octave, study it, and, perhaps, change some [many] values + with a convenient matlab/octave syntax, similar to + a(:,50:250)=zeros(100,200), and then store it back into the + memory of my c code. + * Add a function like strptime() which is the opposite of strftime(). A C version is apparently in recent releases of the Linux C library.
--- a/acconfig.h +++ b/acconfig.h @@ -36,6 +36,13 @@ /* Define if your system's struct group has a gr_passwd field. */ #undef HAVE_GR_PASSWD +#if 0 +/* These are just here to keep autoheader from thinking that they are + missing even though they really aren't. */ +#undef HAVE_GAMMA +#undef HAVE_LGAMMA +#endif + /* Define if you have isinf(). */ #undef HAVE_ISINF
--- a/libcruft/ChangeLog +++ b/libcruft/ChangeLog @@ -1,3 +1,9 @@ +Sun Feb 1 12:39:10 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * quadpack/dqagi.f, quadpack/dqagie.f, quadpack/dqagp.f, + quadpack/dqagpe.f, quadpack/dqk15i.f, quadpack/dqk21.f: + Make user-supplied code a subroutine instead of a function. + Mon Jan 19 23:11:21 1998 John W. Eaton <jwe@bevo.che.wisc.edu> * lapack/xdlange.f, lapack/xzlange.f: New files.
--- a/libcruft/quadpack/dqagp.f +++ b/libcruft/quadpack/dqagp.f @@ -184,7 +184,7 @@ C***ROUTINES CALLED DQAGPE,XERROR C***END PROLOGUE DQAGP C - DOUBLE PRECISION A,ABSERR,B,EPSABS,EPSREL,F,POINTS,RESULT,WORK + DOUBLE PRECISION A,ABSERR,B,EPSABS,EPSREL,POINTS,RESULT,WORK INTEGER IER,IWORK,LAST,LENIW,LENW,LIMIT,LVL,L1,L2,L3,L4,NEVAL, * NPTS2 C
--- a/libcruft/quadpack/dqk15i.f +++ b/libcruft/quadpack/dqk15i.f @@ -70,7 +70,7 @@ C***END PROLOGUE DQK15I C DOUBLE PRECISION A,ABSC,ABSC1,ABSC2,ABSERR,B,BOUN,CENTR,DABS,DINF, - * DMAX1,DMIN1,D1MACH,EPMACH,F,FC,FSUM,FVAL1,FVAL2,FV1,FV2,HLGTH, + * DMAX1,DMIN1,D1MACH,EPMACH,FC,FSUM,FVAL1,FVAL2,FV1,FV2,HLGTH, * RESABS,RESASC,RESG,RESK,RESKH,RESULT,TABSC1,TABSC2,UFLOW,WG,WGK, * XGK,FVALT INTEGER INF,J
--- a/libcruft/quadpack/dqk21.f +++ b/libcruft/quadpack/dqk21.f @@ -50,7 +50,7 @@ C***END PROLOGUE DQK21 C DOUBLE PRECISION A,ABSC,ABSERR,B,CENTR,DABS,DHLGTH,DMAX1,DMIN1, - * D1MACH,EPMACH,F,FC,FSUM,FVAL1,FVAL2,FV1,FV2,HLGTH,RESABS,RESASC, + * D1MACH,EPMACH,FC,FSUM,FVAL1,FVAL2,FV1,FV2,HLGTH,RESABS,RESASC, * RESG,RESK,RESKH,RESULT,UFLOW,WG,WGK,XGK INTEGER J,JTW,JTWM1 EXTERNAL F @@ -139,7 +139,7 @@ C RESG = 0.0D+00 IERR = 0 - CALL F (CENTR,IERR,FC) + CALL F(CENTR,IERR,FC) IF (IERR .LT. 0) RETURN RESK = WGK(11)*FC RESABS = DABS(RESK)
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +Fri Jan 30 23:48:43 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * chMatrix.cc (charMatrix::all, charMatrix::any): New functions. + Tue Jan 20 16:30:00 1998 John W. Eaton <jwe@bevo.che.wisc.edu> * dMatrix.cc (Matrix::expm): Skip trace normalization step if the
--- a/liboctave/Quad.cc +++ b/liboctave/Quad.cc @@ -43,22 +43,22 @@ extern "C" { - int F77_FCN (dqagp, DQAGP) (const double (*)(double*, int&), + int F77_FCN (dqagp, DQAGP) (int (*)(double*, int&, double*), const double&, const double&, const int&, const double*, const double&, const double&, double&, double&, int&, int&, const int&, const int&, int&, int*, double*); - int F77_FCN (dqagi, DQAGI) (const double (*)(double*, int&), + int F77_FCN (dqagi, DQAGI) (int (*)(double*, int&, double*), const double&, const int&, const double&, const double&, double&, double&, int&, int&, const int&, const int&, int&, int*, double*); } -static double -user_function (double *x, int& ierr) +static int +user_function (double *x, int& ierr, double *result) { #if defined (sun) && defined (__GNUC__) double xx = access_double (x); @@ -68,12 +68,18 @@ quad_integration_error = 0; - double retval = (*user_fcn) (xx); + double xresult = (*user_fcn) (xx); + +#if defined (sun) && defined (__GNUC__) + assign_double (result, xresult); +#else + *result = xresult; +#endif if (quad_integration_error) ierr = -1; - return retval; + return 0; } double
--- a/liboctave/chMatrix.cc +++ b/liboctave/chMatrix.cc @@ -176,6 +176,117 @@ return result; } +// XXX FIXME XXX -- these should probably return a boolMatrix type +// instead, but that will have to wait for a future version... + +Matrix +charMatrix::all (void) const +{ + int nr = rows (); + int nc = cols (); + Matrix retval; + if (nr > 0 && nc > 0) + { + if (nr == 1) + { + retval.resize (1, 1); + retval.elem (0, 0) = 1.0; + for (int j = 0; j < nc; j++) + { + if (elem (0, j) == 0) + { + retval.elem (0, 0) = 0.0; + break; + } + } + } + else if (nc == 1) + { + retval.resize (1, 1); + retval.elem (0, 0) = 1.0; + for (int i = 0; i < nr; i++) + { + if (elem (i, 0) == 0) + { + retval.elem (0, 0) = 0.0; + break; + } + } + } + else + { + retval.resize (1, nc); + for (int j = 0; j < nc; j++) + { + retval.elem (0, j) = 1.0; + for (int i = 0; i < nr; i++) + { + if (elem (i, j) == 0) + { + retval.elem (0, j) = 0.0; + break; + } + } + } + } + } + return retval; +} + +Matrix +charMatrix::any (void) const +{ + int nr = rows (); + int nc = cols (); + Matrix retval; + if (nr > 0 && nc > 0) + { + if (nr == 1) + { + retval.resize (1, 1); + retval.elem (0, 0) = 0.0; + for (int j = 0; j < nc; j++) + { + if (elem (0, j) != 0) + { + retval.elem (0, 0) = 1.0; + break; + } + } + } + else if (nc == 1) + { + retval.resize (1, 1); + retval.elem (0, 0) = 0.0; + for (int i = 0; i < nr; i++) + { + if (elem (i, 0) != 0) + { + retval.elem (0, 0) = 1.0; + break; + } + } + } + else + { + retval.resize (1, nc); + for (int j = 0; j < nc; j++) + { + retval.elem (0, j) = 0.0; + for (int i = 0; i < nr; i++) + { + if (elem (i, j) != 0) + { + retval.elem (0, j) = 1.0; + break; + } + } + } + } + } + return retval; +} + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/liboctave/chMatrix.h +++ b/liboctave/chMatrix.h @@ -68,6 +68,9 @@ charMatrix transpose (void) const; + Matrix all (void) const; + Matrix any (void) const; + #if 0 // i/o
--- a/octMakefile.in +++ b/octMakefile.in @@ -217,11 +217,11 @@ .PHONY: VERSION ARCH: - echo $(target_host_type) > ARCH + echo $(canonical_host_type) > ARCH .PHONY: ARCH binary-dist: VERSION ARCH octave-bug dist-info-files - echo octave-$(version)-$(target_host_type) > .fname + echo octave-$(version)-$(canonical_host_type) > .fname rm -rf `cat .fname` mkdir `cat .fname` ln $(BINDISTFILES) `cat .fname`
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,17 @@ +Sat Jan 31 01:09:32 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * signal/fftshift.m: New file. + + * plot/contour.m: Fix for non-square case. + + * general/randperm.m: New file. + +Fri Jan 30 15:20:39 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * specfun/betai.m: Restore file for compatibility with previous + versions. Call betainc with reordered args. + * specfun/gammai.m: Likewise, call gammainc with reordered args. + Wed Jan 28 22:44:59 1998 John W. Eaton <jwe@bevo.che.wisc.edu> * plot/contour.m: Handle discrete contour levels.
--- a/scripts/plot/contour.m +++ b/scripts/plot/contour.m @@ -69,7 +69,7 @@ for i = 1:3:len zz(:,i) = x; zz(:,i+1) = y(k) * ones (xlen, 1); - zz(:,i+2) = z(k,:)'; + zz(:,i+2) = z(:,k); k++; endfor gset nosurface;
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,26 @@ +Sat Jan 31 00:00:26 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * ov-ch-mat.cc (octave_char_matrix::is_true): Make it work. + * ov-str-mat.h, ov-str-mat.cc (octave_char_matrix_str::is_true): + Delete. + + * load-save.cc (read_ascii_data): Allow strings of length 0. + If we don't find data on the first call, fail with error message. + (do_load): Pass count of items read to read_ascii_data. + Allow `load foo xyz' to work when foo contains only numbers. + +Fri Jan 30 23:46:42 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * ov-str-mat.h (octave_char_matrix_str::all): Delete. + (octave_char_matrix_str::any): Delete. + * ov-ch-mat.h (octave_char_matrix::all, octave_char_matrix::any): + Call charMatrix::all, charMatrix::any. + +Thu Jan 29 16:25:46 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * load-save.cc (read_mat_binary_data): Handle third digit of MOPT + as flag indicating row or column major ordering. + Wed Jan 28 00:18:17 1998 John W. Eaton <jwe@bevo.che.wisc.edu> * DLD-FUNCTIONS/dassl.cc (lsode_option_table):
--- a/src/error.cc +++ b/src/error.cc @@ -49,7 +49,7 @@ // Tell the error handler whether to print messages, or just store // them for later. Used for handling errors in eval() and // the `unwind_protect' statement. -bool buffer_error_messages; +bool buffer_error_messages = false; // The message buffer ostrstream *error_message_buffer = 0;
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -464,14 +464,19 @@ static char * read_ascii_data (istream& is, const string& filename, bool& global, - octave_value& tc) + octave_value& tc, int count) { // Read name for this entry or break on EOF. char *name = extract_keyword (is, "name"); if (! name) - return 0; + { + if (count == 0) + error ("load: no data found in file `%s'", filename.c_str ()); + + return 0; + } if (! *name) { @@ -584,10 +589,10 @@ for (int i = 0; i < elements; i++) { int len; - if (extract_keyword (is, "length", len) && len > 0) + if (extract_keyword (is, "length", len) && len >= 0) { char *tmp = new char [len+1]; - if (! is.read (tmp, len)) + if (len > 0 && ! is.read (tmp, len)) { error ("load: failed to load string constant"); break; @@ -1263,6 +1268,7 @@ bool swap = false; int type = 0; int prec = 0; + int order = 0; int mach = 0; int dlen = 0; @@ -1277,11 +1283,13 @@ return 0; } - type = mopt % 10; // Full, sparse, etc. - mopt /= 10; // Eliminate first digit. - prec = mopt % 10; // double, float, int, etc. - mopt /= 100; // Skip unused third digit too. - mach = mopt % 10; // IEEE, VAX, etc. + type = mopt % 10; // Full, sparse, etc. + mopt /= 10; // Eliminate first digit. + prec = mopt % 10; // double, float, int, etc. + mopt /= 10; // Eliminate second digit. + order = mopt % 10; // Row or column major ordering. + mopt /= 10; // Eliminate third digit. + mach = mopt % 10; // IEEE, VAX, etc. flt_fmt = mopt_digit_to_float_format (mach); @@ -1316,6 +1324,13 @@ if (dlen < 0) goto data_read_error; + if (order) + { + int tmp = nr; + nr = nc; + nc = tmp; + } + re.resize (nr, nc); read_mat_binary_data (is, re.fortran_vec (), prec, dlen, swap, flt_fmt); @@ -1344,10 +1359,10 @@ for (int i = 0; i < nr; i++) ctmp (i, j) = Complex (re (i, j), im (i, j)); - tc = ctmp; + tc = order ? ctmp.transpose () : ctmp; } else - tc = re; + tc = order ? re.transpose () : re; if (type == 1) tc = tc.convert_to_str (); @@ -1497,7 +1512,7 @@ switch (format) { case LS_ASCII: - name = read_ascii_data (stream, orig_fname, global, tc); + name = read_ascii_data (stream, orig_fname, global, tc, count); break; case LS_BINARY: @@ -1529,7 +1544,12 @@ { if (tc.is_defined ()) { - if (argv_idx == argc + if (format == LS_MAT_ASCII && argv_idx < argc) + warning ("load: loaded ASCII file `%s' -- ignoring extra args", + orig_fname.c_str()); + + if (format == LS_MAT_ASCII + || argv_idx == argc || matches_patterns (argv, argv_idx, argc, name)) { count++;
--- a/src/ov-ch-mat.cc +++ b/src/ov-ch-mat.cc @@ -49,22 +49,41 @@ bool octave_char_matrix::valid_as_scalar_index (void) const { - // XXX FIXME XXX - return false; + bool retval = false; + error ("octave_char_matrix::valid_as_scalar_index(): not implemented"); + return retval; } bool octave_char_matrix::valid_as_zero_index (void) const { - // XXX FIXME XXX - return false; + bool retval = false; + error ("octave_char_matrix::valid_as_zero_index(): not implemented"); + return retval; } bool octave_char_matrix::is_true (void) const { - // XXX FIXME XXX - return false; + bool retval = false; + + if (rows () == 0 || columns () == 0) + { + int flag = Vpropagate_empty_matrices; + + if (flag < 0) + warning ("empty matrix used in conditional expression"); + else if (flag == 0) + error ("empty matrix used in conditional expression"); + } + else + { + Matrix m = (matrix.all ()) . all (); + + retval = (m.rows () == 1 && m.columns () == 1 && m (0, 0) != 0.0); + } + + return retval; } double
--- a/src/ov-ch-mat.h +++ b/src/ov-ch-mat.h @@ -90,9 +90,8 @@ bool is_char_matrix (void) const { return true; } - // XXX FIXME XXX - octave_value all (void) const { return 0.0; } - octave_value any (void) const { return 0.0; } + octave_value all (void) const { return matrix.all (); } + octave_value any (void) const { return matrix.any (); } bool is_real_type (void) const { return true; }
--- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -140,22 +140,6 @@ } } -octave_value -octave_char_matrix_str::all (void) const -{ - octave_value retval; - error ("octave_char_matrix_str::all(): not implemented"); - return retval; -} - -octave_value -octave_char_matrix_str::any (void) const -{ - octave_value retval; - error ("octave_char_matrix_str::any(): not implemented"); - return retval; -} - bool octave_char_matrix_str::valid_as_scalar_index (void) const { @@ -171,14 +155,6 @@ return retval; } -bool -octave_char_matrix_str::is_true (void) const -{ - bool retval = false; - error ("octave_char_matrix_str::is_true(): not implemented"); - return retval; -} - Matrix octave_char_matrix_str::matrix_value (bool force_string_conv) const {
--- a/src/ov-str-mat.h +++ b/src/ov-str-mat.h @@ -84,9 +84,6 @@ void assign (const octave_value_list& idx, const charMatrix& rhs); - octave_value all (void) const; - octave_value any (void) const; - bool is_string (void) const { return true; } bool is_real_type (void) const { return true; } @@ -94,8 +91,6 @@ bool valid_as_scalar_index (void) const; bool valid_as_zero_index (void) const; - bool is_true (void) const; - Matrix matrix_value (bool = false) const; string_vector all_strings (void) const;
--- a/src/toplev.cc +++ b/src/toplev.cc @@ -560,7 +560,7 @@ m ["localoctfilepath"] = OCTAVE_LOCALOCTFILEPATH; m ["fcnfilepath"] = OCTAVE_FCNFILEPATH; m ["imagepath"] = OCTAVE_IMAGEPATH; - m ["target_host_type"] = TARGET_HOST_TYPE; + m ["canonical_host_type"] = TARGET_HOST_TYPE; m ["configure_options"] = config_opts; m ["F77"] = F77; m ["FFLAGS"] = FFLAGS;