# HG changeset patch # User jwe # Date 947755559 0 # Node ID e098ebb770239cf52f7b13cb4522eeeaa5f9f623 # Parent f8dde1807dee9796b72785c6cdbad93b020d2b43 [project @ 2000-01-13 09:25:53 by jwe] diff -r f8dde1807dee -r e098ebb77023 scripts/ChangeLog --- a/scripts/ChangeLog Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/ChangeLog Thu Jan 13 09:25:59 2000 +0000 @@ -1,3 +1,8 @@ +2000-01-13 John W. Eaton + + * gethelp.cc (extract_help_text): Discard first space character + after consecutive comment characters. + Thu Jan 13 00:56:57 2000 John W. Eaton * control/obsolete: New directory diff -r f8dde1807dee -r e098ebb77023 scripts/control/bddemo.m --- a/scripts/control/bddemo.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/bddemo.m Thu Jan 13 09:25:59 2000 +0000 @@ -599,7 +599,7 @@ disp("You can check this: PKcl = PK / (1 + PK), as expected") prompt elseif(meth != 5) - disp("Illegal selection") + disp("invalid selection") endif endwhile diff -r f8dde1807dee -r e098ebb77023 scripts/control/buildssic.m --- a/scripts/control/buildssic.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/buildssic.m Thu Jan 13 09:25:59 2000 +0000 @@ -220,7 +220,7 @@ xx = Clst(ii,:); iu = xx(1); if ((iu < 1) || (iu > m)) - error("---> Illegal value in first col of Clst."); + error("---> invalid value in first col of Clst."); endif if (inp_used(iu)) error("---> Input specified more than once."); @@ -229,7 +229,7 @@ for kk = 2:mx it = xx(kk); if (abs(it) > p) - error("---> Illegal row value in Clst."); + error("---> invalid row value in Clst."); elseif (it) K(iu,abs(it)) = sign(it); endif @@ -262,7 +262,7 @@ for ii = 1:lul it = Ulst(ii); if ((it < 1) || (it > m)) - error("---> Illegal value in Ulst."); + error("---> invalid value in Ulst."); endif C = [C; kc(it,:)]; D = [D; kdi(it,:)]; @@ -276,7 +276,7 @@ for ii = 1:lol iu = Olst(ii); if (!iu || (abs(iu) > p+lul)) - error("---> Illegal value in Olst."); + error("---> invalid value in Olst."); endif Cnew(ii,:) = sign(iu)*C(abs(iu),:); Dnew(ii,:) = sign(iu)*D(abs(iu),:); @@ -289,7 +289,7 @@ for ii = 1:lil iu = Ilst(ii); if (!iu || (abs(iu) > m)) - error("---> Illegal value in Ilst."); + error("---> invalid value in Ilst."); endif Bnew(:,ii) = sign(iu)*B(:,abs(iu)); Dnew(:,ii) = sign(iu)*D(:,abs(iu)); diff -r f8dde1807dee -r e098ebb77023 scripts/control/c2d.m --- a/scripts/control/c2d.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/c2d.m Thu Jan 13 09:25:59 2000 +0000 @@ -100,7 +100,7 @@ if (!is_sample(T)) error("sampling period T must be a postive, real scalar"); elseif( ! (strcmp(opt,"ex") | strcmp(opt,"bi") ) ) - error(["illegal option passed: ",opt]) + error(["invalid option passed: ",opt]) endif sys = sysupdate(sys,"ss"); diff -r f8dde1807dee -r e098ebb77023 scripts/control/com2str.m --- a/scripts/control/com2str.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/com2str.m Thu Jan 13 09:25:59 2000 +0000 @@ -45,7 +45,7 @@ endif if(flg != 0 & flg != 1) - error(["Illegal flg value: ",num2str(flg)]); + error(["invalid flg value: ",num2str(flg)]); endif sgns = "+-"; diff -r f8dde1807dee -r e098ebb77023 scripts/control/d2c.m --- a/scripts/control/d2c.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/d2c.m Thu Jan 13 09:25:59 2000 +0000 @@ -72,7 +72,7 @@ elseif(isstr(opt)) # all remaining cases are for nargin == 2 tol = 1e-12; if( !(strcmp(opt,"log") | strcmp(opt,"bi") ) ) - error(["d2c: illegal opt passed=",opt]); + error(["d2c: invalid opt passed=",opt]); endif elseif(!is_sample(opt)) error("tol must be a postive scalar") diff -r f8dde1807dee -r e098ebb77023 scripts/control/is_digital.m --- a/scripts/control/is_digital.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/is_digital.m Thu Jan 13 09:25:59 2000 +0000 @@ -41,7 +41,7 @@ case(1), eflg = 0; case(2), if( isempty(find(eflg == [0, 1, 2])) ) - error("Illegal value of eflg=%d (%e)",eflg,eflg); + error("invalid value of eflg=%d (%e)",eflg,eflg); endif otherwise, usage("DIGITAL = is_digital(sys{,eflg})"); diff -r f8dde1807dee -r e098ebb77023 scripts/control/is_sample.m --- a/scripts/control/is_sample.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/is_sample.m Thu Jan 13 09:25:59 2000 +0000 @@ -18,7 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{retval} =} is_sample (@var{Ts}) -## return true if @var{Ts} is a legal sampling time +## return true if @var{Ts} is a valid sampling time ## (real,scalar, > 0) ## @end deftypefn diff -r f8dde1807dee -r e098ebb77023 scripts/control/is_signal_list.m --- a/scripts/control/is_signal_list.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/is_signal_list.m Thu Jan 13 09:25:59 2000 +0000 @@ -1,32 +1,34 @@ -# Copyright (C) 1996,1998,2000 Auburn University. All rights reserved. -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +## Copyright (C) 1996, 1998, 2000 Auburn University. All rights reserved. +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by the +## Free Software Foundation; either version 2, or (at your option) any +## later version. +## +## Octave is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + +## function flg = is_signal_list (mylist) +## returns true if mylist is a list of individual strings. function flg = is_signal_list(mylist) -# function flg = is_signal_list(mylist) -# returns true if mylist is a list of individual strings. -# -flg = is_list(mylist); -if(flg) - for ii=1:length(mylist) - if(!(isstr(nth(mylist,ii)) & rows(nth(mylist,ii)) ==1) ) - flg = 0; - endif - endfor -endif + + flg = is_list(mylist); + + if (flg) + for ii = 1:length (mylist) + if (! (isstr (nth (mylist,ii)) & rows (nth (mylist,ii)) == 1)) + flg = 0; + endif + endfor + endif endfunction diff -r f8dde1807dee -r e098ebb77023 scripts/control/obsolete/dlqg.m --- a/scripts/control/obsolete/dlqg.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/obsolete/dlqg.m Thu Jan 13 09:25:59 2000 +0000 @@ -103,7 +103,7 @@ error("dlqg: G, Sigw incompatibly dimensioned"); endif else - error("dlqg: illegal number of arguments") + error ("dlqg: invalid number of arguments") endif if (! (is_square(Sigw) && is_square(Sigv) ) ) diff -r f8dde1807dee -r e098ebb77023 scripts/control/sortcom.m --- a/scripts/control/sortcom.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/sortcom.m Thu Jan 13 09:25:59 2000 +0000 @@ -57,7 +57,7 @@ if(strcmp(opt,"re")) datavec = real(xx); elseif(strcmp(opt,"im")) datavec = imag(xx); elseif(strcmp(opt,"mag")) datavec = abs(xx); - else error(["sortcom: illegal option = ", opt]) + else error(["sortcom: invalid option = ", opt]) endif [datavec,idx] = sort(datavec); diff -r f8dde1807dee -r e098ebb77023 scripts/control/ss2sys.m --- a/scripts/control/ss2sys.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/ss2sys.m Thu Jan 13 09:25:59 2000 +0000 @@ -217,8 +217,8 @@ elseif((!is_matrix(n)) | isstr(n)) error("Parameter n is not a numerical value."); elseif( (!is_scalar(n)) | (n < 0 ) | (n != round(n)) ) - if(is_scalar(n)) error("illegal value of n=%d,%e",n,n); - else error("illegal value of n=(%dx%d)", ... + if(is_scalar(n)) error("invalid value of n=%d,%e",n,n); + else error("invalid value of n=(%dx%d)", ... rows(n), columns(n)); endif endif @@ -229,16 +229,16 @@ error("Parameter nz is not a numerical value."); elseif( (!is_scalar(nz)) | (nz < 0 ) | (nz != round(nz)) ) if(is_scalar(nz)) - error(["illegal value of nz=",num2str(nz)]); + error(["invalid value of nz=",num2str(nz)]); else - error(["illegal value of nz=(",num2str(rows(nz)),"x", ... + error(["invalid value of nz=(",num2str(rows(nz)),"x", ... num2str(columns(nz)),")"]); endif endif ## check for total number of states if( (n + nz) != na ) - error(["Illegal: a is ",num2str(na),"x",num2str(na),", n=", ... + error(["invalid: a is ",num2str(na),"x",num2str(na),", n=", ... num2str(n),", nz=",num2str(nz)]); endif diff -r f8dde1807dee -r e098ebb77023 scripts/control/stepimp.m --- a/scripts/control/stepimp.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/stepimp.m Thu Jan 13 09:25:59 2000 +0000 @@ -38,7 +38,7 @@ if (sitype == 1) IMPULSE = 0; elseif (sitype == 2) IMPULSE = 1; - else error("stepimp: illegal sitype argument.") + else error("stepimp: invalid sitype argument.") endif sys = sysupdate(sys,"ss"); diff -r f8dde1807dee -r e098ebb77023 scripts/control/sysdimensions.m --- a/scripts/control/sysdimensions.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/sysdimensions.m Thu Jan 13 09:25:59 2000 +0000 @@ -80,21 +80,22 @@ m = length(sysgetsignals(sys,"in")); p = length(sysgetsignals(sys,"out")); yd = sys.yd; - legal_options = list("all","cst","dst","st","in","out"); - legal_values = list(n,n,nz,n+nz,m,p); + valid_options = list("all","cst","dst","st","in","out"); + valid_values = list(n,n,nz,n+nz,m,p); - legal_opt = 0; - for ii=1:length(legal_options) - if(strcmp(nth(legal_options,ii),opt)) - n = nth(legal_values,ii); - legal_opt = 1; + valid_opt = 0; + for ii=1:length(valid_options) + if(strcmp(nth(valid_options,ii),opt)) + n = nth(valid_values,ii); + valid_opt = 1; if(ii > 1 & nargout > 1) warning("opt=%s, %d output arguments requested",opt,nargout); endif endif endfor - if(!legal_opt) - error("illegal option passed = %s",opt); + + if (! valid_opt) + error ("invalid option passed = %s", opt); endif endfunction diff -r f8dde1807dee -r e098ebb77023 scripts/control/sysgetsignals.m --- a/scripts/control/sysgetsignals.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/sysgetsignals.m Thu Jan 13 09:25:59 2000 +0000 @@ -182,7 +182,7 @@ endif stname = nth(stname,signum); otherwise, - error("Illegal value of strflg=%e",strflg); + error ("invalid value of strflg = %e", strflg); endswitch endif diff -r f8dde1807dee -r e098ebb77023 scripts/control/sysidx.m --- a/scripts/control/sysidx.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/sysidx.m Thu Jan 13 09:25:59 2000 +0000 @@ -1,34 +1,54 @@ -function idxvec = sysidx(sys,sigtype,signamelist) -# idxvec = sysidx(sys,sigtype,signamelist) -# return indices of signals with specified signal names -# inputs: -# sys: OCST system data structure -# sigtype: signal type to be selected: "in", "out", "st" -# signamelist: list of desired signal names -# outputs: -# idxvec: vector of signal indices (appropriate for use with sysprune) +## Copyright (C) 1996, 1998 Auburn University. All rights reserved. +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by the +## Free Software Foundation; either version 2, or (at your option) any +## later version. +## +## Octave is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. -if(nargin != 3) - usage("idxvec = sysidx(sys,sigtype,signamelist)"); -elseif(!is_struct(sys)) - error("sys must be a system data structure"); -elseif(!isstr(sigtype)) - error("sigtype must be a string"); -elseif(rows(sigtype) != 1) - error("sigtype (%d x %d) must be a single string", ... - rows(sigtype),columns(sigtype)); -end +## idxvec = sysidx (sys, sigtype, signamelist) +## return indices of signals with specified signal names +## inputs: +## sys: OCST system data structure +## sigtype: signal type to be selected: "in", "out", "st" +## signamelist: list of desired signal names +## outputs: +## idxvec: vector of signal indices (appropriate for use with sysprune) + +function idxvec = sysidx (sys, sigtype, signamelist) -# extract correct set of signal names values -[idxvec,msg] = listidx( list("in","out","st","yd"), sigtype); -if(msg) - error("Illegal sigtype=%s",sigtype); -endif + if (nargin != 3) + usage ("idxvec = sysidx (sys, sigtype, signamelist)"); + elseif (! is_struct (sys)) + error ("sys must be a system data structure"); + elseif (! isstr (sigtype)) + error ("sigtype must be a string"); + elseif (rows (sigtype) != 1) + [nr, nc] = size (sigtype); + error ("sigtype (%d x %d) must be a single string", nr, nc); + endif -syssiglist = sysgetsignals(sys,sigtype); -[idxvec,msg] = listidx(syssiglist,signamelist); -if(length(msg)) - error("sysidx(sigtype=%s): %s",sigtype, strrep(msg,"strlist","signamelist")); -end + ## extract correct set of signal names values + [idxvec, msg] = listidx (list ("in", "out", "st", "yd"), sigtype); + if (msg) + error ("invalid sigtype = %s", sigtype); + endif + + syssiglist = sysgetsignals (sys, sigtype); + [idxvec, msg] = listidx (syssiglist, signamelist); + if (length (msg)) + error ("sysidx (sigtype = %s): %s", sigtype, + strrep (msg, "strlist", "signamelist")); + endif endfunction diff -r f8dde1807dee -r e098ebb77023 scripts/control/sysmin.m --- a/scripts/control/sysmin.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/sysmin.m Thu Jan 13 09:25:59 2000 +0000 @@ -165,7 +165,7 @@ if(isempty(xx)) xx = 0; endif # signal no states in reduced model retsys = sysprune(sys,[],[],xx); otherwise, - error("illegal value of flg=%d",flg); + error ("invalid value of flg = %d", flg); endswitch if(sysdimensions(retsys,"st") > 0) [cflg,Uc] = is_controllable(retsys); nc = columns(Uc); diff -r f8dde1807dee -r e098ebb77023 scripts/control/sysprune.m --- a/scripts/control/sysprune.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/sysprune.m Thu Jan 13 09:25:59 2000 +0000 @@ -117,7 +117,7 @@ [aa,bb,cc,dd,tsam,nn,nz,stnam,innam,outnam,yd] = sys2ss(sys); - ## check for legal state permutation + ## check for valid state permutation if(nn & nz) c_idx = find(state_idx <= nn); if(!isempty(c_idx)) max_c = max(c_idx); diff -r f8dde1807dee -r e098ebb77023 scripts/control/syssetsignals.m --- a/scripts/control/syssetsignals.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/syssetsignals.m Thu Jan 13 09:25:59 2000 +0000 @@ -190,7 +190,7 @@ warning("syssetsignals: opt=yd: names(%d)=%e, must be 0 or 1", ... badidx(ii), names(badidx(ii)) ); endfor - error("opt=yd: illegal values in names"); + error ("opt=yd: invalid values in names"); endif for ii=1:length(sig_idx) diff -r f8dde1807dee -r e098ebb77023 scripts/control/tzero2.m --- a/scripts/control/tzero2.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/control/tzero2.m Thu Jan 13 09:25:59 2000 +0000 @@ -34,7 +34,7 @@ if (nargin == 4) bal = "B"; elseif (nargin != 5) - error ("tzero: illegal number of arguments"); + error ("tzero: invalid number of arguments"); endif [n, m, p] = abcddim (a, b, c, d); diff -r f8dde1807dee -r e098ebb77023 scripts/gethelp.cc --- a/scripts/gethelp.cc Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/gethelp.cc Thu Jan 13 09:25:59 2000 +0000 @@ -10,9 +10,9 @@ { bool retval = false; - string t = s.substr (0, 15); + string t = s.substr (0, 14); - if (t == " Copyright (C) ") + if (t == "Copyright (C) ") { size_t pos = s.find ('\n'); @@ -24,10 +24,10 @@ { pos++; - t = s.substr (pos, 29); + t = s.substr (pos, 28); - if (t == " This file is part of Octave." - || t == " This program is free softwar") + if (t == "This file is part of Octave." + || t == "This program is free softwar") retval = true; } } @@ -48,6 +48,7 @@ bool begin_comment = false; bool have_help_text = false; bool in_comment = false; + bool discard_space = true; int c; while ((c = cin.get ()) != EOF) @@ -56,6 +57,11 @@ { if (c == '%' || c == '#') continue; + else if (discard_space && c == ' ') + { + discard_space = false; + continue; + } else begin_comment = false; } @@ -71,6 +77,7 @@ if (c == '\n') { in_comment = false; + discard_space = true; if ((c = cin.get ()) != EOF) { diff -r f8dde1807dee -r e098ebb77023 scripts/linear-algebra/housh.m --- a/scripts/linear-algebra/housh.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/linear-algebra/housh.m Thu Jan 13 09:25:59 2000 +0000 @@ -1,55 +1,54 @@ -# Copyright (C) 1995, 1998 A. Scottedward Hodel -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## Copyright (C) 1995, 1998 A. Scottedward Hodel +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by the +## Free Software Foundation; either version 2, or (at your option) any +## later version. +## +## Octave is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. -function [housv,beta,zer] = housh(x,j,z) - # function [housv,beta,zer] = housh(x,j,z) - # computes householder reflection vector housv to reflect x to be - # jth column of identity, i.e., (I - beta*housv*housv')x =e(j) - # inputs - # x: vector - # j: index into vector - # z: threshold for zero (usually should be the number 0) - # outputs: (see Golub and Van Loan) - # beta: If beta = 0, then no reflection need be applied (zer set to 0) - # housv: householder vector - # mar 6,1987 : rev dec 17,1988 - # rev sep 19,1991 (blas) - # translated from FORTRAN Aug 1995 - # A. S. Hodel +## function [housv,beta,zer] = housh(x,j,z) +## computes householder reflection vector housv to reflect x to be +## jth column of identity, i.e., (I - beta*housv*housv')x =e(j) +## inputs +## x: vector +## j: index into vector +## z: threshold for zero (usually should be the number 0) +## outputs: (see Golub and Van Loan) +## beta: If beta = 0, then no reflection need be applied (zer set to 0) +## housv: householder vector +## mar 6,1987 : rev dec 17,1988 +## rev sep 19,1991 (blas) +## translated from FORTRAN Aug 1995 - # $Revision: 1.1.1.1 $ - # $Log$ +## Author: A. S. Hodel + +function [housv, beta, zer] = housh (x, j, z) - # check for legal inputs - if( !is_vector(x) && !is_scalar(x)) - error("housh: first input must be a vector") - elseif( !is_scalar(j) ) - error("housh: second argment must be an integer scalar") + ## check for valid inputs + if (!is_vector (x) && ! is_scalar (x)) + error ("housh: first input must be a vector") + elseif (! is_scalar(j)) + error ("housh: second argment must be an integer scalar") else housv = x; - m = max(abs(housv)); - if (m ~= 0.0) - housv = housv/m; - alpha = norm(housv); + m = max (abs (housv)); + if (m != 0.0) + housv = housv / m; + alpha = norm (housv); if (alpha > z) - beta = 1.0/(alpha*(alpha+abs(housv(j)))); - sg = sign(housv(j)); - if( sg == 0) + beta = 1.0 / (alpha * (alpha + abs (housv(j)))); + sg = sign (housv(j)); + if (sg == 0) sg = 1; endif housv(j) = housv(j) + alpha*sg; @@ -61,4 +60,5 @@ endif zer = (beta == 0); endif + endfunction diff -r f8dde1807dee -r e098ebb77023 scripts/linear-algebra/krylov.m --- a/scripts/linear-algebra/krylov.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/linear-algebra/krylov.m Thu Jan 13 09:25:59 2000 +0000 @@ -1,45 +1,46 @@ -# Copyright (C) 1993, 1998, 1999 Auburn University. All rights reserved. -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## Copyright (C) 1993, 1998, 1999 Auburn University. All rights reserved. +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by the +## Free Software Foundation; either version 2, or (at your option) any +## later version. +## +## Octave is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. + +## function [U,H,nu] = krylov(A,V,k{,eps1,pflg}); +## construct orthogonal basis U of block Krylov subspace; +## [V AV A^2*V ... A^(k+1)*V]; +## method used: householder reflections to guard against loss of +## orthogonality +## eps1: threshhold for 0 (default: 1e-12) +## pflg: flag to use row pivoting (improves numerical behavior) +## 0 [default]: no pivoting; prints a warning message if trivial +## null space is corrupted +## 1 : pivoting performed +## +## outputs: +## Uret: orthogonal basis of block krylov subspace +## H: Hessenberg matrix; if V is a vector then A U = U H +## otherwise H is meaningless +## nu: dimension of span of krylov subspace (based on eps1) +## if B is a vector and k > m-1, krylov returns H = the Hessenberg +## decompostion of A. +## +## Reference: Hodel and Misra, "Partial Pivoting in the Computation of +## Krylov Subspaces", to be submitted to Linear Algebra and its +## Applications +## written by A. Scottedward Hodel a.s.hodel@eng.auburn.edu function [Uret,H,nu] = krylov(A,V,k,eps1,pflg); - # function [U,H,nu] = krylov(A,V,k{,eps1,pflg}); - # construct orthogonal basis U of block Krylov subspace; - # [V AV A^2*V ... A^(k+1)*V]; - # method used: householder reflections to guard against loss of - # orthogonality - # eps1: threshhold for 0 (default: 1e-12) - # pflg: flag to use row pivoting (improves numerical behavior) - # 0 [default]: no pivoting; prints a warning message if trivial - # null space is corrupted - # 1 : pivoting performed - # - # outputs: - # Uret: orthogonal basis of block krylov subspace - # H: Hessenberg matrix; if V is a vector then A U = U H - # otherwise H is meaningless - # nu: dimension of span of krylov subspace (based on eps1) - # if B is a vector and k > m-1, krylov returns H = the Hessenberg - # decompostion of A. - # - # Reference: Hodel and Misra, "Partial Pivoting in the Computation of - # Krylov Subspaces", to be submitted to Linear Algebra and its - # Applications - # written by A. Scottedward Hodel a.s.hodel@eng.auburn.edu defeps = 1e-12; if(nargin < 3 | nargin > 5) diff -r f8dde1807dee -r e098ebb77023 scripts/linear-algebra/krylovb.m --- a/scripts/linear-algebra/krylovb.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/linear-algebra/krylovb.m Thu Jan 13 09:25:59 2000 +0000 @@ -1,47 +1,47 @@ -# Copyright (C) 1993, 1998, 1999 A. Scottedward Hodel -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, write to the Free -# Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +## Copyright (C) 1993, 1998, 1999 A. Scottedward Hodel +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by the +## Free Software Foundation; either version 2, or (at your option) any +## later version. +## +## Octave is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. -function [Uret,Ucols] = krylovb(A,V,k,eps1,pflg); - # function [U,Ucols] = krylovb(A,V,k{,eps1,pflg}); - # construct orthogonal basis U of block Krylov subspace; - # [V AV A^2*V ... A^(k+1)*V]; - # method used: householder reflections to guard against loss of - # orthogonality - # eps1: threshhold for 0 (default: 1e-12) - # pflg: permutation flag - # outputs: - # returned basis U is orthogonal matrix; due to "zeroed" - # columns of product, may not satisfy A U = U H identity - # Ucols: dimension of span of krylov subspace (based on eps1) - # if k > m-1, krylov returns the Hessenberg decompostion of A. - # - # Note: krylovb directly calls and is superseded by krylov. +## function [U, Ucols] = krylovb (A, V, k ,eps1, pflg); +## construct orthogonal basis U of block Krylov subspace; +## [V AV A^2*V ... A^(k+1)*V]; +## method used: householder reflections to guard against loss of +## orthogonality +## eps1: threshhold for 0 (optional, default: 1e-12) +## pflg: permutation flag (optional) +## outputs: +## returned basis U is orthogonal matrix; due to "zeroed" +## columns of product, may not satisfy A U = U H identity +## Ucols: dimension of span of krylov subspace (based on eps1) +## if k > m-1, krylov returns the Hessenberg decompostion of A. +## +## Note: krylovb directly calls and is superseded by krylov. - switch(nargin) - case(3), - [Uret,H,Ucols] = krylov(A,V,k); - case(4), - [Uret,H,Ucols] = krylov(A,V,k,eps1); - case(5), - [Uret,H,Ucols] = krylov(A,V,k,eps1,pflg); - otherwise, - usage("[Uret,Ucols] = krylovb(A,V,k{,eps1,pflg}); %d arguments passed", ... - nargin); +function [Uret, Ucols] = krylovb (A, V, k, eps1, pflg) + + switch (nargin) + case (3) + [Uret, H, Ucols] = krylov (A, V, k); + case (4) + [Uret, H, Ucols] = krylov (A, V, k, eps1); + case (5) + [Uret, H, Ucols] = krylov (A, V, k, eps1, pflg); + otherwise + usage ("[Uret, Ucols] = krylovb (A, V, k ,eps1, pflg)); endswitch endfunction diff -r f8dde1807dee -r e098ebb77023 scripts/quaternion/demoquat.m --- a/scripts/quaternion/demoquat.m Thu Jan 13 08:40:53 2000 +0000 +++ b/scripts/quaternion/demoquat.m Thu Jan 13 09:25:59 2000 +0000 @@ -227,7 +227,7 @@ case(quitopt), printf("Exiting quaternion demo\n"); otherwise, - error(sprintf("Illegal option %f",opt)); + error ("invalid option %f", opt); endswitch endwhile endfunction diff -r f8dde1807dee -r e098ebb77023 src/ChangeLog --- a/src/ChangeLog Thu Jan 13 08:40:53 2000 +0000 +++ b/src/ChangeLog Thu Jan 13 09:25:59 2000 +0000 @@ -1,3 +1,9 @@ +2000-01-13 John W. Eaton + + * parse.y (gobble_leading_whitespace): Discard first space character + after consecutive comment characters. + * lex.l (grab_help_text): Ditto. + 2000-01-11 John W. Eaton * ov.h, ov.cc (octave_value::column_vector_value, diff -r f8dde1807dee -r e098ebb77023 src/DLD-FUNCTIONS/qz.cc --- a/src/DLD-FUNCTIONS/qz.cc Thu Jan 13 08:40:53 2000 +0000 +++ b/src/DLD-FUNCTIONS/qz.cc Thu Jan 13 09:25:59 2000 +0000 @@ -250,7 +250,7 @@ } else if (nargin == 3 && (nargout < 3 || nargout > 4)) { - error ("qz: Illegal number of output arguments for form [3] call"); + error ("qz: invalid number of output arguments for form [3] call"); return retval; } @@ -279,7 +279,7 @@ && ord_job[0] != '+' && ord_job[0] != '-') { - error ("qz: illegal order option"); + error ("qz: invalid order option"); return retval; } @@ -600,7 +600,7 @@ break; default: - // illegal order option (should never happen, since we + // invalid order option (should never happen, since we // checked the options at the top). panic_impossible (); break; diff -r f8dde1807dee -r e098ebb77023 src/lex.l --- a/src/lex.l Thu Jan 13 08:40:53 2000 +0000 +++ b/src/lex.l Thu Jan 13 09:25:59 2000 +0000 @@ -1173,7 +1173,7 @@ // Grab the help text from an function file. Always overwrites the // current contents of help_buf. -// XXX FIXME XXX -- gobble_leading_white_space() in variables.cc +// XXX FIXME XXX -- gobble_leading_white_space() in parse.y // duplicates some of this code! static void @@ -1183,6 +1183,7 @@ bool begin_comment = true; bool in_comment = true; + bool discard_space = true; int c = 0; while ((c = yyinput ()) != EOF) @@ -1191,6 +1192,11 @@ { if (c == '%' || c == '#') continue; + else if (discard_space && c == ' ') + { + discard_space = false; + continue; + } else begin_comment = false; } @@ -1200,7 +1206,10 @@ help_buf += (char) c; if (c == '\n') - in_comment = false; + { + in_comment = false; + discard_space = true; + } } else { diff -r f8dde1807dee -r e098ebb77023 src/parse.y --- a/src/parse.y Thu Jan 13 08:40:53 2000 +0000 +++ b/src/parse.y Thu Jan 13 09:25:59 2000 +0000 @@ -2718,9 +2718,9 @@ { bool retval = false; - string t = s.substr (0, 15); - - if (t == " Copyright (C) ") + string t = s.substr (0, 14); + + if (t == "Copyright (C) ") { size_t pos = s.find ('\n'); @@ -2732,10 +2732,10 @@ { pos++; - t = s.substr (pos, 29); - - if (t == " This file is part of Octave." - || t == " This program is free softwar") + t = s.substr (pos, 28); + + if (t == "This file is part of Octave." + || t == "This program is free softwar") retval = true; } } @@ -2762,6 +2762,7 @@ bool begin_comment = false; bool have_help_text = false; bool in_comment = false; + bool discard_space = true; int c; while ((c = getc (ffile)) != EOF) @@ -2773,6 +2774,11 @@ { if (c == '%' || c == '#') continue; + else if (discard_space && c == ' ') + { + discard_space = false; + continue; + } else begin_comment = false; } @@ -2792,7 +2798,9 @@ input_line_number++; current_input_column = 0; } + in_comment = false; + discard_space = true; if (in_parts) {