Home > wafo > trgauss > initoptions.m

initoptions

PURPOSE ^

Initializes RIND options according to speed.

SYNOPSIS ^

options = initoptions(speed,options)

DESCRIPTION ^

 INITOPTIONS Initializes RIND options according to speed. 
                                     
  CALL options = initoptions(speed,options)     
  
      speed = integer defining accuracy of calculations.  
              Valid numbers:  1,2,...,10  
             (1=slowest and most accurate,10=fastest, but less accuracy) 
    options = rind-options structure, see RINDOPTSET fort details. 
  
  RIND OPTIONS parameters initialized according to speed: 
  SPEED    = Integer defining accuracy of calculations.  
  ABSEPS   = Absolute error tolerance. 
  RELEPS   = Relative error tolerance. 
  COVEPS   = Error tolerance in Cholesky factorization. 
  XCUTOFF  = Truncation limit of the normal CDF  
  MAXPTS   = Maximum number of function values allowed. 
  QUADNO   = Quadrature formulae used in integration of Xd(i) 
             implicitly determining # nodes  
  
  Example: 
   opt = initoptions(3);  
      
  See also  rindoptset, rind

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function options = initoptions(speed,options) 
002 %INITOPTIONS Initializes RIND options according to speed. 
003 %                                    
004 % CALL options = initoptions(speed,options)     
005 % 
006 %     speed = integer defining accuracy of calculations.  
007 %             Valid numbers:  1,2,...,10  
008 %            (1=slowest and most accurate,10=fastest, but less accuracy) 
009 %   options = rind-options structure, see RINDOPTSET fort details. 
010 % 
011 % RIND OPTIONS parameters initialized according to speed: 
012 % SPEED    = Integer defining accuracy of calculations.  
013 % ABSEPS   = Absolute error tolerance. 
014 % RELEPS   = Relative error tolerance. 
015 % COVEPS   = Error tolerance in Cholesky factorization. 
016 % XCUTOFF  = Truncation limit of the normal CDF  
017 % MAXPTS   = Maximum number of function values allowed. 
018 % QUADNO   = Quadrature formulae used in integration of Xd(i) 
019 %            implicitly determining # nodes  
020 % 
021 % Example: 
022 %  opt = initoptions(3);  
023 %     
024 % See also  rindoptset, rind 
025    
026   error(nargchk(1,2,nargin)) 
027   if nargin<2|isempty(options) 
028     options = rindoptset; 
029   end 
030   options.speed =  min(max(speed,1),11); 
031   if isempty(speed) 
032     return 
033   end 
034   
035   MAXPTS = 10000; 
036   options.quadno = (1:3)+ (10-min(options.speed,9)) + (options.speed==1); 
037   switch options.speed 
038    case 11, 
039     abseps = 1d-1; 
040    case (10) 
041     abseps = 1d-2; 
042    case {7,8,9}  
043     abseps = 1d-2; 
044    case {4,5,6} 
045     MAXPTS = 20000; 
046     abseps = 1d-3; 
047    case {1,2,3} 
048     MAXPTS = 30000; 
049     abseps = 1d-4; 
050   end   
051   TMP = max(11-abs(options.speed),1); 
052   TMP = mod(TMP+1,3)+1; 
053         
054   options.releps = min(abseps ,1.d-2); 
055   options.coveps = abseps*((1.d-1)^TMP); 
056   options.maxpts = MAXPTS;     
057    
058   if (options.method==0)  
059      % This gives approximately the same accuracy as when using  
060      % RINDDND and RINDNIT     
061       
062      %    xCutOff= MIN(MAX(xCutOff+0.5d0,4.d0),5.d0) 
063      abseps = abseps*1.d-1; 
064   end 
065   options.abseps  = abseps; 
066   truncError      = 0.05 * max(0,options.abseps); 
067   options.xcutoff = max(min(abs(wnorminv(truncError)),7),1.2); 
068   options.abseps  = max(options.abseps - truncError,0); 
069    
070  return  
071

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group


Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003