# HG changeset patch # User jwe # Date 912813626 0 # Node ID 7aae2c3636a7863a9cff7273fa192e3c807952cb # Parent 1e7532b9173b48ffc43367f1c0f15cff0d1a0e0b [project @ 1998-12-04 23:20:12 by jwe] diff -r 1e7532b9173b -r 7aae2c3636a7 ChangeLog --- a/ChangeLog Fri Dec 04 22:08:23 1998 +0000 +++ b/ChangeLog Fri Dec 04 23:20:26 1998 +0000 @@ -1,3 +1,14 @@ +Fri Dec 4 18:05:51 1998 Kurt Hornik + + * emacs/octave-mod.el (octave-abbrev-start): Use the correct name + of the abbrev table, and provide support for XEmacs. + (octave-xemacs-p): New variable. + +Tue Nov 24 23:31:50 1998 John W. Eaton + + * configure.in: Check for strftime too. + Avoid checking for termios.h on NeXT systems. + Thu Nov 19 16:07:57 1998 John W. Eaton * aclocal.m4 (OCTAVE_CXX_PREPENDS_UNDERSCORE): New macro. diff -r 1e7532b9173b -r 7aae2c3636a7 configure.in --- a/configure.in Fri Dec 04 22:08:23 1998 +0000 +++ b/configure.in Fri Dec 04 23:20:26 1998 +0000 @@ -21,7 +21,7 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. -AC_REVISION($Revision: 1.312 $) +AC_REVISION($Revision: 1.313 $) AC_PREREQ(2.9) AC_INIT(src/octave.cc) AC_CONFIG_HEADER(config.h) @@ -689,11 +689,20 @@ AC_HEADER_TIME AC_HEADER_SYS_WAIT +### I'm told that termios.h is broken on NeXT systems. + +TERMIOS_H=termios.h +case "$canonical_host_type" in + *-*-nextstep*) + TERMIOS_H= + ;; +esac + AC_CHECK_HEADERS(assert.h curses.h dlfcn.h fcntl.h float.h floatingpoint.h \ fnmatch.h glob.h grp.h ieeefp.h limits.h memory.h nan.h ncurses.h \ pwd.h sgtty.h stdlib.h string.h sys/param.h sys/resource.h \ sys/select.h sys/stat.h sys/time.h sys/times.h sys/types.h \ - sys/utsname.h termcap.h termio.h termios.h unistd.h varargs.h) + sys/utsname.h termcap.h termio.h $TERMIOS_H unistd.h varargs.h) if test "$ac_cv_header_termios_h" = yes \ || test "$ac_cv_header_termio_h" = yes \ @@ -751,7 +760,7 @@ gettimeofday getuid getwd lstat memmove mkdir mkfifo on_exit pipe \ putenv rename rindex rmdir setgrent setpwent setvbuf sigaction \ sigpending sigprocmask sigsuspend stat strcasecmp strdup strerror \ - stricmp strncasecmp strnicmp tempnam umask unlink usleep \ + strftime stricmp strncasecmp strnicmp tempnam umask unlink usleep \ vfprintf vsprintf waitpid) OCTAVE_SMART_PUTENV diff -r 1e7532b9173b -r 7aae2c3636a7 doc/interpreter/emacs.texi --- a/doc/interpreter/emacs.texi Fri Dec 04 22:08:23 1998 +0000 +++ b/doc/interpreter/emacs.texi Fri Dec 04 23:20:26 1998 +0000 @@ -337,6 +337,13 @@ There is also rudimentary support for Imenu (currently, function names can be indexed). +@cindex TAGS +@cindex Emacs TAGS files +@cindex @code{otags} +You can generate TAGS files for Emacs from Octave @file{.m} files using +the shell script @code{otags} that is installed alongside your copy of +Octave. + Customization of Octave mode can be performed by modification of the variable @code{octave-mode-hook}. It the value of this variable is non-@code{nil}, turning on Octave mode calls its value. diff -r 1e7532b9173b -r 7aae2c3636a7 doc/interpreter/func.texi --- a/doc/interpreter/func.texi Fri Dec 04 22:08:23 1998 +0000 +++ b/doc/interpreter/func.texi Fri Dec 04 23:20:26 1998 +0000 @@ -630,15 +630,23 @@ @c XXX FIXME XXX -- note about time stamps on files in NFS environments? +@defvr {Built-in Variable} DEFAULT_LOADPATH +A colon separated list of directories in which to search for function +files by default. The value of this variable is also automatically +substituted for leading, trailing, or doubled colons that appear in the +built-in variable @code{LOADPATH}. +@end defvr + @defvr {Built-in Variable} LOADPATH A colon separated list of directories in which to search for function files. @xref{Functions and Scripts}. The value of @code{LOADPATH} overrides the environment variable @code{OCTAVE_PATH}. @xref{Installation}. @code{LOADPATH} is now handled in the same way as @TeX{} handles -@code{TEXINPUTS}. If the path starts with @samp{:}, the standard path -is prepended to the value of @code{LOADPATH}. If it ends with @samp{:} -the standard path is appended to the value of @code{LOADPATH}. +@code{TEXINPUTS}. Leading, trailing, or doubled colons that appear in +@code{LOADPATH} are replaced by the value of @code{DEFAULT_LOADPATH}. +The default value of @code{LOADPATH} is @code{":"}, which tells Octave +to search in the directories specified by @code{DEFAULT_LOADPATH}. In addition, if any path element ends in @samp{//}, that directory and all subdirectories it contains are searched recursively for function diff -r 1e7532b9173b -r 7aae2c3636a7 doc/interpreter/var.texi --- a/doc/interpreter/var.texi Fri Dec 04 22:08:23 1998 +0000 +++ b/doc/interpreter/var.texi Fri Dec 04 23:20:26 1998 +0000 @@ -307,6 +307,11 @@ Octave was compiled (for example, @code{@value{TARGETHOSTTYPE}}). @vtable @code +@item DEFAULT_LOADPATH +@xref{Function Files}. + +Default value: @code{".:@var{octave-home}/lib/@var{version}"}. + @item EDITOR @xref{Commands For History}. @@ -330,7 +335,8 @@ @item LOADPATH @xref{Function Files}. -Default value: @code{".:@var{octave-home}/lib/@var{version}"}. +Default value: @code{":"}, which tells Octave to use the directories +specified by the built-in variable @code{DEFAULT_LOADPATH}. @item OCTAVE_HOME diff -r 1e7532b9173b -r 7aae2c3636a7 emacs/octave-mod.el --- a/emacs/octave-mod.el Fri Dec 04 22:08:23 1998 +0000 +++ b/emacs/octave-mod.el Fri Dec 04 23:20:26 1998 +0000 @@ -599,6 +599,9 @@ (delete-horizontal-space) (insert (concat " " octave-continuation-string)))) +(defvar octave-xemacs-p + (string-match "XEmacs\\|Lucid" emacs-version)) + ;;; Comments (defun octave-comment-region (beg end &optional arg) "Comment or uncomment each line in the region as Octave code. @@ -1310,9 +1313,12 @@ (self-insert-command 1) (let (c) (insert last-command-char) - (if (or (eq (setq c (read-event)) ??) - (eq c help-char)) - (let ((abbrev-table-name-list '(octave-mode-abbrev-table))) + (if (if octave-xemacs-p + (or (eq (event-to-character (setq c (next-event))) ??) + (eq (event-to-character c) help-char)) + (or (eq (setq c (read-event)) ??) + (eq c help-char))) + (let ((abbrev-table-name-list '(octave-abbrev-table))) (list-abbrevs)) (setq unread-command-events (list c)))))) diff -r 1e7532b9173b -r 7aae2c3636a7 liboctave/Array2.cc --- a/liboctave/Array2.cc Fri Dec 04 22:08:23 1998 +0000 +++ b/liboctave/Array2.cc Fri Dec 04 23:20:26 1998 +0000 @@ -188,6 +188,20 @@ return false; } +template +Array2 +Array2::transpose (void) const +{ + Array2 result (d2, d1); + + if (d1 > 0 && d2 > 0) + for (int j = 0; j < d2; j++) + for (int i = 0; i < d1; i++) + result.elem (j, i) = elem (i, j); + + return result; +} + /* ;;; Local Variables: *** ;;; mode: C++ *** diff -r 1e7532b9173b -r 7aae2c3636a7 liboctave/Array2.h --- a/liboctave/Array2.h Fri Dec 04 22:08:23 1998 +0000 +++ b/liboctave/Array2.h Fri Dec 04 23:20:26 1998 +0000 @@ -177,6 +177,8 @@ bool is_symmetric (void) const; + Array2 transpose (void) const; + #ifdef HEAVYWEIGHT_INDEXING void maybe_delete_elements (idx_vector& i, idx_vector& j); diff -r 1e7532b9173b -r 7aae2c3636a7 liboctave/CMatrix.cc --- a/liboctave/CMatrix.cc Fri Dec 04 22:08:23 1998 +0000 +++ b/liboctave/CMatrix.cc Fri Dec 04 23:20:26 1998 +0000 @@ -728,21 +728,6 @@ } ComplexMatrix -ComplexMatrix::transpose (void) const -{ - int nr = rows (); - int nc = cols (); - ComplexMatrix result (nc, nr); - if (length () > 0) - { - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) - result.elem (j, i) = elem (i, j); - } - return result; -} - -ComplexMatrix conj (const ComplexMatrix& a) { int a_len = a.length (); diff -r 1e7532b9173b -r 7aae2c3636a7 liboctave/CMatrix.h --- a/liboctave/CMatrix.h Fri Dec 04 22:08:23 1998 +0000 +++ b/liboctave/CMatrix.h Fri Dec 04 23:20:26 1998 +0000 @@ -114,7 +114,8 @@ ComplexMatrix stack (const ComplexDiagMatrix& a) const; ComplexMatrix hermitian (void) const; // complex conjugate transpose - ComplexMatrix transpose (void) const; + ComplexMatrix transpose (void) const + { return MArray2::transpose (); } friend ComplexMatrix conj (const ComplexMatrix& a); diff -r 1e7532b9173b -r 7aae2c3636a7 liboctave/ChangeLog --- a/liboctave/ChangeLog Fri Dec 04 22:08:23 1998 +0000 +++ b/liboctave/ChangeLog Fri Dec 04 23:20:26 1998 +0000 @@ -1,3 +1,17 @@ +Tue Nov 24 23:38:19 1998 Eric Norum + + * statdefs.h: Only define mode_t if not already defined. + +Tue Nov 24 17:24:52 1998 john + + * lo-specfun.cc (airy, biry): Set imaginary part of result to zero + when appropriate. + +Mon Nov 23 09:57:05 1998 John W. Eaton + + * cmd-edit.cc (gnu_readline::gnu_readline): Set terminal name + before calling rl_initialize. + Tue Nov 17 23:47:24 1998 John W. Eaton * lo-specfun.cc (besselh, airy, biry): New functions. diff -r 1e7532b9173b -r 7aae2c3636a7 liboctave/MArray2.h --- a/liboctave/MArray2.h Fri Dec 04 22:08:23 1998 +0000 +++ b/liboctave/MArray2.h Fri Dec 04 23:20:26 1998 +0000 @@ -120,6 +120,14 @@ return *this; } + MArray2& insert (const Array2& a, int r, int c) + { + Array2::insert (a, r, c); + return *this; + } + + MArray2 transpose (void) const { return Array2::transpose (); } + // element by element MArray2 by scalar ops friend MArray2& operator += LTGT (MArray2& a, const T& s); diff -r 1e7532b9173b -r 7aae2c3636a7 liboctave/boolMatrix.cc --- a/liboctave/boolMatrix.cc Fri Dec 04 22:08:23 1998 +0000 +++ b/liboctave/boolMatrix.cc Fri Dec 04 23:20:26 1998 +0000 @@ -60,21 +60,6 @@ return *this; } -boolMatrix -boolMatrix::transpose (void) const -{ - int nr = rows (); - int nc = cols (); - boolMatrix result (nc, nr); - if (length () > 0) - { - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) - result.elem (j, i) = elem (i, j); - } - return result; -} - // unary operations boolMatrix diff -r 1e7532b9173b -r 7aae2c3636a7 liboctave/boolMatrix.h --- a/liboctave/boolMatrix.h Fri Dec 04 22:08:23 1998 +0000 +++ b/liboctave/boolMatrix.h Fri Dec 04 23:20:26 1998 +0000 @@ -51,12 +51,12 @@ bool operator == (const boolMatrix& a) const; bool operator != (const boolMatrix& a) const; + boolMatrix transpose (void) const { return Array2::transpose (); } + // destructive insert/delete/reorder operations boolMatrix& insert (const boolMatrix& a, int r, int c); - boolMatrix transpose (void) const; - // unary operations boolMatrix operator ! (void) const; diff -r 1e7532b9173b -r 7aae2c3636a7 liboctave/chMatrix.cc --- a/liboctave/chMatrix.cc Fri Dec 04 22:08:23 1998 +0000 +++ b/liboctave/chMatrix.cc Fri Dec 04 23:20:26 1998 +0000 @@ -173,21 +173,6 @@ } charMatrix -charMatrix::transpose (void) const -{ - int nr = rows (); - int nc = cols (); - charMatrix result (nc, nr); - if (length () > 0) - { - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) - result.elem (j, i) = elem (i, j); - } - return result; -} - -charMatrix charMatrix::extract (int r1, int c1, int r2, int c2) const { if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; } diff -r 1e7532b9173b -r 7aae2c3636a7 liboctave/chMatrix.h --- a/liboctave/chMatrix.h Fri Dec 04 22:08:23 1998 +0000 +++ b/liboctave/chMatrix.h Fri Dec 04 23:20:26 1998 +0000 @@ -67,8 +67,6 @@ string row_as_string (int r, bool strip_trailing_whitespace = false) const; - charMatrix transpose (void) const; - // resize is the destructive equivalent for this one charMatrix extract (int r1, int c1, int r2, int c2) const; diff -r 1e7532b9173b -r 7aae2c3636a7 liboctave/cmd-edit.cc --- a/liboctave/cmd-edit.cc Fri Dec 04 22:08:23 1998 +0000 +++ b/liboctave/cmd-edit.cc Fri Dec 04 23:20:26 1998 +0000 @@ -24,6 +24,7 @@ #include #endif +#include #include #include @@ -139,6 +140,8 @@ : command_editor (), previous_startup_hook (0), previous_event_hook (0), completion_function (0) { + rl_terminal_name = ::getenv ("TERM"); + rl_initialize (); do_blink_matching_paren (true); diff -r 1e7532b9173b -r 7aae2c3636a7 liboctave/dMatrix.cc --- a/liboctave/dMatrix.cc Fri Dec 04 22:08:23 1998 +0000 +++ b/liboctave/dMatrix.cc Fri Dec 04 23:20:26 1998 +0000 @@ -401,21 +401,6 @@ } Matrix -Matrix::transpose (void) const -{ - int nr = rows (); - int nc = cols (); - Matrix result (nc, nr); - if (length () > 0) - { - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) - result.elem (j, i) = elem (i, j); - } - return result; -} - -Matrix real (const ComplexMatrix& a) { int a_len = a.length (); diff -r 1e7532b9173b -r 7aae2c3636a7 liboctave/dMatrix.h --- a/liboctave/dMatrix.h Fri Dec 04 22:08:23 1998 +0000 +++ b/liboctave/dMatrix.h Fri Dec 04 23:20:26 1998 +0000 @@ -93,11 +93,11 @@ Matrix stack (const ColumnVector& a) const; Matrix stack (const DiagMatrix& a) const; - Matrix transpose (void) const; - friend Matrix real (const ComplexMatrix& a); friend Matrix imag (const ComplexMatrix& a); + Matrix transpose (void) const { return MArray2::transpose (); } + // resize is the destructive equivalent for this one Matrix extract (int r1, int c1, int r2, int c2) const; diff -r 1e7532b9173b -r 7aae2c3636a7 liboctave/lo-specfun.cc --- a/liboctave/lo-specfun.cc Fri Dec 04 22:08:23 1998 +0000 +++ b/liboctave/lo-specfun.cc Fri Dec 04 23:20:26 1998 +0000 @@ -612,6 +612,9 @@ F77_FCN (zairy, ZAIRY) (zr, zi, id, kode, ar, ai, nz, ierr); + if (zi == 0.0 && (! scaled || zr > 0.0)) + ai = 0.0; + return bessel_return_value (Complex (ar, ai), ierr); } @@ -630,6 +633,9 @@ F77_FCN (zbiry, ZBIRY) (zr, zi, id, kode, ar, ai, ierr); + if (zi == 0.0 && (! scaled || zr > 0.0)) + ai = 0.0; + return bessel_return_value (Complex (ar, ai), ierr); } diff -r 1e7532b9173b -r 7aae2c3636a7 liboctave/statdefs.h --- a/liboctave/statdefs.h Fri Dec 04 22:08:23 1998 +0000 +++ b/liboctave/statdefs.h Fri Dec 04 23:20:26 1998 +0000 @@ -32,8 +32,10 @@ #endif #ifndef S_ISREG /* Doesn't have POSIX.1 stat stuff. */ +#ifndef mode_t #define mode_t unsigned short #endif +#endif #if !defined(S_ISBLK) && defined(S_IFBLK) #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) #endif diff -r 1e7532b9173b -r 7aae2c3636a7 scripts/ChangeLog --- a/scripts/ChangeLog Fri Dec 04 22:08:23 1998 +0000 +++ b/scripts/ChangeLog Fri Dec 04 23:20:26 1998 +0000 @@ -1,3 +1,30 @@ +Fri Dec 4 16:08:42 1998 John W. Eaton + + * quaternion: New directory of functions from A. S. Hodel, + . + * Makefile.in (SUBDIRS): Add it to the list. + +Tue Nov 24 21:41:31 1998 John W. Eaton + + * image/saveimage.m: Make it work again for black and white colormaps. + + * image/imagesc.m: Use rows (colormap), not length (colormap), + since there can be fewer rows than columns. Round values to + nearest position in colormap instead of truncating. Correct usage + message. + +Tue Nov 24 14:50:52 1998 A Scott Hodel + + * linear-algebra/krylov.m: New arg pflg. If nonzero, avoid using + zero rows of [A,v] as householder pivots; this avoids spurious + non-zero entries in returned orthogonal matrix U, but destroys the + Householder matrix structure of H. + +Fri Nov 20 12:46:46 1998 John W. Eaton + + * general/logical.m: Just copy input to output if argument is + already a logical object. + Fri Nov 6 10:17:00 1998 John W. Eaton * New files from OCST, in control subdiretory: diff -r 1e7532b9173b -r 7aae2c3636a7 scripts/Makefile.in --- a/scripts/Makefile.in Fri Dec 04 22:08:23 1998 +0000 +++ b/scripts/Makefile.in Fri Dec 04 23:20:26 1998 +0000 @@ -26,7 +26,7 @@ configure mkinstalldirs SUBDIRS = audio control elfun finance general image io linear-algebra \ - miscellaneous plot polynomial set signal specfun \ + miscellaneous plot polynomial quaternion set signal specfun \ special-matrix startup statistics strings time DISTSUBDIRS = $(SUBDIRS) diff -r 1e7532b9173b -r 7aae2c3636a7 scripts/general/logical.m --- a/scripts/general/logical.m Fri Dec 04 22:08:23 1998 +0000 +++ b/scripts/general/logical.m Fri Dec 04 23:20:26 1998 +0000 @@ -32,7 +32,11 @@ function y = logical (x) if (nargin == 1) - y = x != 0; + if (! islogical (x)) + y = x != 0; + else + y = x; + endif else usage ("logical (x)"); endif diff -r 1e7532b9173b -r 7aae2c3636a7 scripts/image/imagesc.m --- a/scripts/image/imagesc.m Fri Dec 04 22:08:23 1998 +0000 +++ b/scripts/image/imagesc.m Fri Dec 04 23:20:26 1998 +0000 @@ -31,10 +31,10 @@ ## Created: July 1994 ## Adapted-By: jwe -function x = imagesc (x, zoom) +function y = imagesc (x, zoom) if (nargin < 1 || nargin > 2) - usage ("image (matrix, [zoom])"); + usage ("imagesc (matrix, [zoom])"); elseif (nargin == 1) zoom = 4; endif @@ -48,12 +48,12 @@ ## length (colormap) inclusive. if (maxval == minval) - x = ones (high, wide); + y = ones (high, wide); else ## Rescale values to between 1 and length (colormap) inclusive. - x = fix ((x - minval) / (maxval - minval) * (length (colormap) - 1)) + 1; + y = round ((x - minval) / (maxval - minval) * (rows (colormap) - 1)) + 1; endif - image (x, zoom); + image (y, zoom); endfunction diff -r 1e7532b9173b -r 7aae2c3636a7 scripts/image/saveimage.m --- a/scripts/image/saveimage.m Fri Dec 04 22:08:23 1998 +0000 +++ b/scripts/image/saveimage.m Fri Dec 04 23:20:26 1998 +0000 @@ -150,31 +150,33 @@ if (strcmp (img_form, "ppm")) if (grey && map_nr == 2 && bw) - map = map(:,1); - if (map(1) != 0) - map(1) = 1; + map = [1; 0]; else - map(2) = 1; + map = [0; 1]; endif - img = map(img); - n_long = rem (img_sz, 8); - if (n_long == 0) - n_long = 8; - else - n_long++; - endif + n_long = rem (img_nc, 8); + tmp = zeros (ceil (img_nc/8), img_nr); - idx = 1:8:img_sz; - s_len = length (idx) - 1; - - tmp = img (1:8:img_sz) * 128; - for i = 2:n_long - tmp = tmp + img (i:8:img_sz) * 2^(8-i); - endfor - for i = (n_long+1):8 - tmp(1:s_len) = tmp(1:s_len) + img (i:8:img_sz) * 2^(8-i); + for i = 1:img_nr + idx = (i-1)*img_nc+1:i*img_nc; + if (n_long > 0) + img_row = [map(img(idx)); zeros (8-n_long, 1)]; + else + img_row = map(img(idx)); + endif + img_row + tmp + if (img_nc < 8) + for j = 1:8 + tmp(:,i) = tmp(:,i) + img_row (j) * 2^(8-j); + endfor + else + for j = 1:8 + tmp(:,i) = tmp(:,i) + img_row (j:8:img_nc) * 2^(8-j); + endfor + endif endfor fid = fopen (filename, "w"); diff -r 1e7532b9173b -r 7aae2c3636a7 scripts/linear-algebra/krylov.m --- a/scripts/linear-algebra/krylov.m Fri Dec 04 22:08:23 1998 +0000 +++ b/scripts/linear-algebra/krylov.m Fri Dec 04 23:20:26 1998 +0000 @@ -16,47 +16,63 @@ # along with Octave; see the file COPYING. If not, write to the Free # Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. -function [U,H,k1] = krylov(A,v,k,eps1); +function [U,H,k1] = krylov(A,v,k,eps1,pflg); # function [U,H,k1] = krylov(A,v,k{,eps1}); # construct orthogonal basis U of Krylov subspace; - # span([v Av A^2*v ... A^(k+1)*v]); + # span([v Av A^2*v ... A^(k+1)*v]); # via householder reflections; reflections are multiplied to obtain U - # eps1: threshhold for 0 relative to norm of current column (default: 1e-12) - # method used: householder reflections to guard against loss of - # orthogonality - # + # inputs: + # A: square matrix + # v: column vector + # k: desired krylov subspace dimension (as above) + # eps1: threshhold for 0 relative to norm of current column (default: 1e-12) + # pflg: permutation flag (default 0): avoid using zero rows of + # [A,v] as householder pivots; this avoids spurious non-zero entries + # in returned orthogonal matrix U, but destroys the Householder matrix + # structure of H. # outputs: - # returned basis U is n x k+1; A*U(:,1:k) = U*H + # U: (n x k+1) orthogonal basis of Krylov subspace. A*U(:,1:k) = U*H + # H: (pflg=0): Hessenberg matrix satisfying A*U(:,1:k) = U*H + # (pflg=1): Workspace; does not satisfy above equation. # k1: dimension of span of krylov subspace (based on eps1) # if k > m-1, krylov returns the Hessenberg decompostion of A. - + # Written by A. S. Hodel 1992 # $Revision: 1.2 $ # $Log$ - if(nargin == 3) - eps1 = 1e-12; + if (nargin > 5) usage("[U,H,k1] = krylov(A,v,k{,eps1,pflg})"); + elseif(nargin < 5) pflg = 0; + elseif(nargin < 4) eps1 = 1e-12; endif + na = is_square(A); + if(!na) error("krylov: A(%dx%d) must be square",na,na); endif + [m,n] = size(v); + if(!is_vector(v)) error("krylov: v(%dx%d) must be a vector",m,n); + elseif(length(v) != na) + error("krylov: A(%dx%d), v(%dx1); mismatch",na,na,length(v)); + endif + v = vec(v); # make sure it's a column vector + if(!is_scalar(k)) + error("krylov: k(%dx%d) must be a scalar",rows(k), columns(k)); + elseif( k > m) + warning("krylov: k is too large; reducing to %d",m-1); + k = m-1; endif - if( !is_square(A) ) - error("first argument must be a square matrix") - else - [m,n] = size(v); - if(m != is_square(A)) - error("krylov: argument dimensions do not match") - elseif( !is_sample(k) ) - error("krylov: third argument must be a scalar integer") - elseif( k > m) - warning(["krylov: k is too large; reducing to ",num2str(m)]); - k = m-1; - endif - endif + # check for zero input vector + if(norm(v) == 0) U = []; H = []; k1 = 0; return endif + + # indices of legal pivot points (identifies trivial null space). + abm = max(abs([A,v]')); nzidx = find(abm != 0); zidx = find(abm == 0); - if(norm(v) == 0) - U = []; - H = []; - k1 = 0; - return + # check permutation flag + if(pflg) + # permute zero rows of [A,v] to trailing rows + permvec = [vec(nzidx); vec(zidx)]; + pmat = eye(na); pmat = pmat(permvec,:); + ipermvec = pmat'*vec(1:na); + A = A(permvec,permvec); + v = v(permvec); endif k1 = k+1; # Assume subspace basis has full rank @@ -127,4 +143,15 @@ U(i:n,i:j1) = U(i:n,i:j1)-av*hv*(hv'*U(i:n,i:j1)); endfor + # check permutation flag + if(pflg) + # permute rows of U back to original coordinates + U = U(ipermvec,:); + endif + + # check for spurious nonzero entries + if( max(max( abs(U(zidx,:)) )) > eps1 ) + warning("krylov: trivial null space corrupted; set pflg=1 or eps1>%e",eps1); + endif + endfunction diff -r 1e7532b9173b -r 7aae2c3636a7 src/ChangeLog --- a/src/ChangeLog Fri Dec 04 22:08:23 1998 +0000 +++ b/src/ChangeLog Fri Dec 04 23:20:26 1998 +0000 @@ -1,5 +1,33 @@ +Wed Dec 2 22:38:40 1998 John W. Eaton + + * utils.cc (file_in_loadpath): Expect argc == 2, not 3. + +Tue Nov 24 23:38:19 1998 Eric Norum + + * mkbuiltins: Also strip off leading `./' from file names. + * mkops: Ditto. + +Tue Nov 24 23:24:26 1998 John W. Eaton + + * strftime.c: Surround everything with #ifdef HAVE_STRFTIME / #endif. + + * lex.h (YY_FATAL_ERROR): Call yy_falta_error after + jump_to_top_level to avoid gcc warning. + +Fri Nov 20 13:34:47 1998 John W. Eaton + + * ov-bool.h, ov-bool.cc (class octave_bool): Derive from + octave_base_scalar and get common functions via derivation. + * ov-scalar.h, ov-scalar.cc (class octave_scalar): Ditto. + * ov-complex.h, ov-complex.cc (class octave_complex): Ditto. + + * ov-base-scalar.h, ov-base-scalar.cc (class octave_base_scalar): + New files for new class definition. Put common scalar data type + stuff here. + * Makefile.in (OV_INCLUDES, OV_SRC): Add them to the lists. + Thu Nov 19 14:30:25 1998 John W. Eaton - + * dynamic-ld.cc (octave_dynamic_loader::mangle_name): Prepend underscore here. (octave_dynamic_loader::load_fcn_from_dot_oct_file): Not here. diff -r 1e7532b9173b -r 7aae2c3636a7 src/lex.h --- a/src/lex.h Fri Dec 04 22:08:23 1998 +0000 +++ b/src/lex.h Fri Dec 04 23:20:26 1998 +0000 @@ -33,6 +33,8 @@ YY_FATAL_ERROR ("octave_read () in flex scanner failed"); // Try to avoid crashing out completely on fatal scanner errors. +// The call to yy_fatal_error should never happen, but it avoids a +// `static function defined but not used' warning from gcc. #ifdef YY_FATAL_ERROR #undef YY_FATAL_ERROR @@ -42,6 +44,7 @@ { \ error (msg); \ jump_to_top_level (); \ + yy_fatal_error (msg); \ } \ while (0) diff -r 1e7532b9173b -r 7aae2c3636a7 src/mkbuiltins --- a/src/mkbuiltins Fri Dec 04 22:08:23 1998 +0000 +++ b/src/mkbuiltins Fri Dec 04 23:20:26 1998 +0000 @@ -32,7 +32,7 @@ EOF for file in $DEF_FILES; do - fcn=`echo $file | sed 's/\.df//; s/-/_/g'` + fcn=`echo $file | sed 's,^\./,,; s/\.df//; s/-/_/g'` echo "static void" echo "install_${fcn}_fcns (void)" echo "{" @@ -42,7 +42,7 @@ done for file in $VAR_FILES; do - f=`echo $file | sed 's/-/_/g'` + f=`echo $file | sed 's,^\./,,; s/-/_/g'` echo "extern void symbols_of_${f} (void);" done @@ -54,7 +54,7 @@ EOF for file in $VAR_FILES; do - f=`echo $file | sed 's/-/_/g'` + f=`echo $file | sed 's,^\./,,; s/-/_/g'` echo " symbols_of_${f} ();" done @@ -67,7 +67,7 @@ EOF for file in $DEF_FILES; do - fcn=`echo $file | sed 's/\.df//; s/-/_/g'` + fcn=`echo $file | sed 's,^\./,,; s/\.df//; s/-/_/g'` echo " install_${fcn}_fcns ();" done diff -r 1e7532b9173b -r 7aae2c3636a7 src/mkops --- a/src/mkops Fri Dec 04 22:08:23 1998 +0000 +++ b/src/mkops Fri Dec 04 23:20:26 1998 +0000 @@ -12,7 +12,7 @@ EOF for file in "$@"; do - f=`echo $file | sed 's%^OPERATORS/op-%%; s%\.cc%%; s%-%_%g'` + f=`echo $file | sed 's,^\./,,; s%^OPERATORS/op-%%; s%\.cc%%; s%-%_%g'` echo "extern void install_${f}_ops (void);" done @@ -26,7 +26,7 @@ EOF for file in "$@"; do - f=`echo $file | sed 's%^OPERATORS/op-%%; s%\.cc%%; s%-%_%g'` + f=`echo $file | sed 's,^\./,,; s%^OPERATORS/op-%%; s%\.cc%%; s%-%_%g'` echo " install_${f}_ops ();" done diff -r 1e7532b9173b -r 7aae2c3636a7 src/ov-bool-mat.h --- a/src/ov-bool-mat.h Fri Dec 04 22:08:23 1998 +0000 +++ b/src/ov-bool-mat.h Fri Dec 04 23:20:26 1998 +0000 @@ -59,6 +59,9 @@ octave_bool_matrix (const boolMatrix& bm) : octave_base_matrix (bm) { } + octave_bool_matrix (const Array2& a) + : octave_base_matrix (a) { } + octave_bool_matrix (const octave_bool_matrix& bm) : octave_base_matrix (bm) { } diff -r 1e7532b9173b -r 7aae2c3636a7 src/strftime.c --- a/src/strftime.c Fri Dec 04 22:08:23 1998 +0000 +++ b/src/strftime.c Fri Dec 04 23:20:26 1998 +0000 @@ -21,6 +21,8 @@ # include #endif +#ifndef HAVE_STRFTIME + #ifdef _LIBC # define HAVE_LIMITS_H 1 # define HAVE_MBLEN 1 @@ -889,3 +891,5 @@ *p = '\0'; return i; } + +#endif diff -r 1e7532b9173b -r 7aae2c3636a7 src/utils.cc --- a/src/utils.cc Fri Dec 04 22:08:23 1998 +0000 +++ b/src/utils.cc Fri Dec 04 23:20:26 1998 +0000 @@ -249,7 +249,7 @@ if (error_state) return retval; - if (argc == 3) + if (argc == 2) retval = octave_env::make_absolute (Vload_path_dir_path.find (argv[1]), octave_env::getcwd ()); else diff -r 1e7532b9173b -r 7aae2c3636a7 src/version.h --- a/src/version.h Fri Dec 04 22:08:23 1998 +0000 +++ b/src/version.h Fri Dec 04 23:20:26 1998 +0000 @@ -23,7 +23,7 @@ #if !defined (octave_version_h) #define octave_version_h 1 -#define OCTAVE_VERSION "2.1.10" +#define OCTAVE_VERSION "2.1.11" #define OCTAVE_COPYRIGHT \ "Copyright (C) 1996, 1997, 1998 John W. Eaton."