Mercurial > hg > octave-lojdl
changeset 3427:e098ebb77023
[project @ 2000-01-13 09:25:53 by jwe]
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2000-01-13 John W. Eaton <jwe@bevo.che.wisc.edu> + + * gethelp.cc (extract_help_text): Discard first space character + after consecutive comment characters. + Thu Jan 13 00:56:57 2000 John W. Eaton <jwe@bahaha.che.wisc.edu> * control/obsolete: New directory
--- a/scripts/control/bddemo.m +++ b/scripts/control/bddemo.m @@ -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
--- a/scripts/control/buildssic.m +++ b/scripts/control/buildssic.m @@ -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));
--- a/scripts/control/c2d.m +++ b/scripts/control/c2d.m @@ -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");
--- a/scripts/control/com2str.m +++ b/scripts/control/com2str.m @@ -45,7 +45,7 @@ endif if(flg != 0 & flg != 1) - error(["Illegal flg value: ",num2str(flg)]); + error(["invalid flg value: ",num2str(flg)]); endif sgns = "+-";
--- a/scripts/control/d2c.m +++ b/scripts/control/d2c.m @@ -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")
--- a/scripts/control/is_digital.m +++ b/scripts/control/is_digital.m @@ -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})");
--- a/scripts/control/is_sample.m +++ b/scripts/control/is_sample.m @@ -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
--- a/scripts/control/is_signal_list.m +++ b/scripts/control/is_signal_list.m @@ -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
--- a/scripts/control/obsolete/dlqg.m +++ b/scripts/control/obsolete/dlqg.m @@ -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) ) )
--- a/scripts/control/sortcom.m +++ b/scripts/control/sortcom.m @@ -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);
--- a/scripts/control/ss2sys.m +++ b/scripts/control/ss2sys.m @@ -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
--- a/scripts/control/stepimp.m +++ b/scripts/control/stepimp.m @@ -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");
--- a/scripts/control/sysdimensions.m +++ b/scripts/control/sysdimensions.m @@ -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
--- a/scripts/control/sysgetsignals.m +++ b/scripts/control/sysgetsignals.m @@ -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
--- a/scripts/control/sysidx.m +++ b/scripts/control/sysidx.m @@ -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
--- a/scripts/control/sysmin.m +++ b/scripts/control/sysmin.m @@ -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);
--- a/scripts/control/sysprune.m +++ b/scripts/control/sysprune.m @@ -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);
--- a/scripts/control/syssetsignals.m +++ b/scripts/control/syssetsignals.m @@ -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)
--- a/scripts/control/tzero2.m +++ b/scripts/control/tzero2.m @@ -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);
--- a/scripts/gethelp.cc +++ b/scripts/gethelp.cc @@ -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) {
--- a/scripts/linear-algebra/housh.m +++ b/scripts/linear-algebra/housh.m @@ -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
--- a/scripts/linear-algebra/krylov.m +++ b/scripts/linear-algebra/krylov.m @@ -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)
--- a/scripts/linear-algebra/krylovb.m +++ b/scripts/linear-algebra/krylovb.m @@ -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
--- a/scripts/quaternion/demoquat.m +++ b/scripts/quaternion/demoquat.m @@ -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
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2000-01-13 John W. Eaton <jwe@bevo.che.wisc.edu> + + * 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 <jwe@bevo.che.wisc.edu> * ov.h, ov.cc (octave_value::column_vector_value,
--- a/src/DLD-FUNCTIONS/qz.cc +++ b/src/DLD-FUNCTIONS/qz.cc @@ -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;
--- a/src/lex.l +++ b/src/lex.l @@ -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 {
--- a/src/parse.y +++ b/src/parse.y @@ -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) {