MEXMVNPRB Computes multivariate normal probability by Genz' algorithm using randomized Korobov rules for the first 20 variables, while the remaining variables are integrated using Richtmeyer rules. CALL: [value,error,inform] = mexmvnprb(correl,A,B,abseps,releps,maxpoints); CORREL = vector of correlation coefficients; the correlation coefficient in row I column J of the correlation matrix should be stored in CORREL( J + ((I-2)*(I-1))/2 ), for J < I. (Note: If S is a correlation matrix then CORREL = S(find(tril(S,-1)));) The correlation matrix must be positive semidefinite. A REAL, array of lower integration limits. B REAL, array of upper integration limits. NOTE: any values greater than 37, are considered as infinite values. ABSEPS = absolute error tolerance. RELEPS = relative error tolerance. MAXPTS = maximum number of function values allowed. This parameter can be used to limit the time. A sensible strategy is to start with MAXPTS = 1000*N, and then increase MAXPTS if ERROR is too large. ERROR = estimated absolute error, with 99% confidence level. VALUE = estimated value for the integral INFORM = termination status parameter: if INFORM = 0, normal completion with ERROR < EPS; if INFORM = 1, completion with ERROR > EPS and MAXPTS function vaules used; increase MAXPTS to decrease ERROR; if INFORM = 2, N > 100 or N < 1.
Display message and abort function. |
Multivariate Normal probability by Genz' algorithm. |
001 function [value,error1,inform]=mexmvnprb(correl,A,B,abseps,releps,maxpoints) 002 %MEXMVNPRB Computes multivariate normal probability by Genz' algorithm 003 % using randomized Korobov rules for the first 20 variables, 004 % while the remaining variables are integrated using Richtmeyer rules. 005 % 006 % CALL: [value,error,inform] = mexmvnprb(correl,A,B,abseps,releps,maxpoints); 007 % 008 % CORREL = vector of correlation coefficients; the correlation 009 % coefficient in row I column J of the correlation matrix 010 % should be stored in CORREL( J + ((I-2)*(I-1))/2 ), for J < I. 011 % (Note: If S is a correlation matrix then CORREL = S(find(tril(S,-1)));) 012 % The correlation matrix must be positive semidefinite. 013 % A REAL, array of lower integration limits. 014 % B REAL, array of upper integration limits. 015 % NOTE: any values greater than 37, are considered as infinite values. 016 % ABSEPS = absolute error tolerance. 017 % RELEPS = relative error tolerance. 018 % MAXPTS = maximum number of function values allowed. This 019 % parameter can be used to limit the time. A sensible 020 % strategy is to start with MAXPTS = 1000*N, and then 021 % increase MAXPTS if ERROR is too large. 022 % ERROR = estimated absolute error, with 99% confidence level. 023 % VALUE = estimated value for the integral 024 % INFORM = termination status parameter: 025 % if INFORM = 0, normal completion with ERROR < EPS; 026 % if INFORM = 1, completion with ERROR > EPS and MAXPTS 027 % function vaules used; increase MAXPTS to 028 % decrease ERROR; 029 % if INFORM = 2, N > 100 or N < 1. 030 % 031 032 % The corresponding mex-file was successfully compiled for matlab 5.3 033 % using Compaq Visual Fortran 6.1, and Windows 2000 and XP. 034 % The example here uses Fortran77 source. 035 % First, you will need to modify your mexopts.bat file. 036 % To find it, issue the command prefdir(1) from the Matlab command line, 037 % the directory it answers with will contain your mexopts.bat file. 038 % Open it for editing. The first section will look like: 039 % 040 %rem ******************************************************************** 041 %rem General parameters 042 %rem ******************************************************************** 043 %set MATLAB=%MATLAB% 044 %set DF_ROOT=C:\Program Files\Microsoft Visual Studio 045 %set VCDir=%DF_ROOT%\VC98 046 %set MSDevDir=%DF_ROOT%\Common\msdev98 047 %set DFDir=%DF_ROOT%\DF98 048 %set PATH=%MSDevDir%\bin;%DFDir%\BIN;%VCDir%\BIN;%PATH% 049 %set INCLUDE=%DFDir%\INCLUDE;%DFDir%\IMSL\INCLUDE;%INCLUDE% 050 %set LIB=%DFDir%\LIB;%VCDir%\LIB 051 % 052 % then you are ready to compile this file at the matlab prompt using the following command: 053 % mex -O mexmvnprb.f 054 055 disp('mexmvnprb is not implemented as a m-function') 056 disp(' compile the mexfile mexmvnprb.f before you try again.') 057 error('mexmvnprb error') 058 return 059 060
Comments or corrections to the WAFO group