Home > tt2 > solve > tt_iterchk.m

tt_iterchk

PURPOSE ^

Checks arguments to iterative methods. A is a TT object.

SYNOPSIS ^

function [atype,afun,afcnstr] = tt_iterchk(A)

DESCRIPTION ^

Checks arguments to iterative methods. A is a TT object.
   [ATYPE,AFUN,AFCNSTR] = TT_ITERCHK(A) returns the following:
   ATYPE is either 'matrix', 'function', 'expression' or 'inline object'.
   AFUN is the function name or inline object.
   AFUN is '' if ATYPE is 'matrix'.
   AFCNSTR is the function name if ATYPE is 'function'.
   AFCNSTR is the formula of the function if ATYPE is 'expression' or
   'inline object'.  AFCNSTR is '' if ATYPE is 'matrix'.

   See also BICG, BICGSTAB, CGS, GMRES, LSQR, MINRES, PCG, QMR, SYMMLQ.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [atype,afun,afcnstr] = tt_iterchk(A)
0002 %Checks arguments to iterative methods. A is a TT object.
0003 %   [ATYPE,AFUN,AFCNSTR] = TT_ITERCHK(A) returns the following:
0004 %   ATYPE is either 'matrix', 'function', 'expression' or 'inline object'.
0005 %   AFUN is the function name or inline object.
0006 %   AFUN is '' if ATYPE is 'matrix'.
0007 %   AFCNSTR is the function name if ATYPE is 'function'.
0008 %   AFCNSTR is the formula of the function if ATYPE is 'expression' or
0009 %   'inline object'.  AFCNSTR is '' if ATYPE is 'matrix'.
0010 %
0011 %   See also BICG, BICGSTAB, CGS, GMRES, LSQR, MINRES, PCG, QMR, SYMMLQ.
0012 
0013 %   Copyright 1984-2004 The MathWorks, Inc.
0014 %   $Revision: 1.8.4.2 $ $Date: 2004/12/06 16:35:56 $
0015 
0016 
0017 [afun,afunmsg] = fcnchk(A);
0018 if isempty(afunmsg)
0019    if isa(afun,'inline')      
0020       if isa(A,'inline')
0021          atype = 'inline object';
0022       else
0023          atype = 'expression';
0024       end
0025       afcnstr = formula(afun);
0026    else % both function_handles @fun and function names 'fun'
0027       atype = 'function';
0028       if isa(A,'function_handle')
0029           afcnstr = func2str(A);
0030       else
0031           afcnstr = A;
0032       end
0033    end
0034 elseif isa(A,'cell')
0035    afun = A;
0036    atype = 'matrix';
0037    afcnstr = '';
0038 else
0039    error('MATLAB:iterchk:InvalidInput',...
0040          'Argument must be a TT matrix in cell or a function handle.');
0041 end

Generated on Wed 08-Feb-2012 18:20:24 by m2html © 2005