Description
Estimation Method And System For Financial Securities Trading
The United States Government has certain rights to this invention pursuant to grants CCR-91-14042 and IRI-92-12597 awarded by the National Science Foundation, and to grant AFOSR-91-0347 awarded by the U.S. Air Force.
Background of the Invention
The invention relates to financial securities trading such as, e.g., trading in stocks, bonds and financial derivative instruments, including futures, options and collateralized mortgage obligations.
In financial securities trading, which includes the initial offer for sale, the value of a security may be estimated, e.g., based on expected future cash flow. Such cash flow may depend on variable interest rates, for example, and these and other relevant variables may be viewed as stochastic variables.
It is well known that the value of a financial security which depends on stochastic variables can be estimated in terms of a multi-dimensional integral. The dimension of such an integral may be very high.
In collateralized mortgage obligations (CMO) , for example, instruments or securities variously called tranches, shares, participations, classes or contracts have cash flows which are determined by dividing and distributing the cash flow of an underlying collection or pool of mortgages on a monthly basis according to pre-specified rules. The present value of a tranche can be estimated on the basis of the expected monthly cash flows over the remaining term of the tranche, and
SUBSTTTUTESHEET(RULE26)
an estimate of the present value of a tranche can be represented as a multi-dimensional integral whose dimension is the number of payment periods of the tranche. For a typical instrument with a 30-year term and with monthly payments, this dimension is 360.
Usually, such a high-dimensional integral can be evaluated only approximately, by numerical integration. This involves the generation of points in the domain of integration, evaluating or "sampling" the integrand at the generated points, and combining the resulting integrand values, e.g., by averaging. Well known for numerical integration in securities trading is the so- called Monte Carlo method in which points in the domain of integration are generated at random. With integrands arising in financial securities trading, the computational work in combining the sampled values is negligible as compared with producing the integrand values. Thus, numerical integration methods in securities trading may be compared based on the number of samples required for obtaining a sufficiently accurate approximation to the integral.
Summary Of The Invention
A preferred method for estimating the value of a financial security involves numerical integration unlike Monte Carlo integration in that an integrand is sampled at deterministic points having a low- discrepancy property. As compared with the Monte Carlo method, significant advantages are realized with respect to speed, accuracy, and dependability.
Brief Description Of The Drawing
Fig. 1 is a schematic of a programmed computer system in accordance with a preferred embodiment of the invention.
SUBSTTTUTESHEET(RULE26)
Fig. 2 is a graphic representation of performance data obtained in computer trial runs with an exemplary embodiment of the invention as compared with two Monte Carlo computations. Further included is an Appendix with two computer algorithms in "C" source language, respectively for computing Sobol points and Halton points. For a description of C, see B.W. Kernighan et al., The Programming Language C. Prentice-Hall, 1978.
Detailed Description Of Preferred Embodiments
Fig. 1 shows a stored-program computer 11 con¬ nected to input means 12, e.g., a keyboard, for enter¬ ing financial securities data, and connected to output means 13, e.g., a visual display device, for displaying an estimated value of the financial security. The computer 11 includes a working memory M, a low- discrepancy deterministic point generator P, an inte¬ grand evaluator E, and an integrand-value combiner C. In estimating the value of a multi-dimensional integral in financial securities trading, a multivariate integrand is sampled at points corresponding to a low-discrepancy deterministic sequence of points in the multivariate unit cube as defined below. If the multivariate unit cube is also the domain of integration, the points of the low- discrepancy deterministic sequence can be used as sample points directly. In the case of a more general domain of integration, sample points correspond to points of a low-discrepancy deterministic sequence in the multivariate unit cube via a suitable transformation or mapping.
When a sufficiently large number of. sampled values has been computed, an approximation of the integral is obtained by suitably combining the computed values, e.g., by averaging or weighted averaging.
SUBSTTTUTESHEET(RULE26)
In the d-dimensional unit cube D = [0,1]d, a low- discrepancy deterministic sequence z,, z2, ... of points in D can be characterized as follows:
For a point t = [t1# ..., td] in D, define [0, t) = [0, t,) x ... x [0, td) , where [0, t{) denotes a left-closed, right-open interval, and denote with X[o,t)(-) the characteristic or indicator function of [0, t) . For points z,, ..., zn in D, define R-.U; Zi, ..., zn) = (∑k=,n χ[0,t)(2k)) n " t,t2...td, and define the discrepancy of z,, ..., zn as the La- norm of the function R-,(.; z,, ..., zn) , i.e.,
||Rn(.; z,, ..., zn) ||. = sup^R^t; zl ..., zn) | . The sequence z,, z2, ... is said to be a low- discrepancy deterministic sequence provided
i . ; z,, ..., z l = O((log n)d/n). Low-discrepancy deterministic sequences are described in the published literature; see, e.g., H. Niederreiter, "Random Number Generation and Quasi- Monte Carlo Methods", CBMS-NSF. 63, SIAM, Philadelphia, 1992 and S. Paskov, "Average Case Complexity of Multivariate Integration for Smooth Functions", Journal of Complexity. Vol. 9 (1993), pp. 291-312. Well-known examples of low-discrepancy deterministic sequences are the so-called Hammersley points, Halton points, Sobol points, and hyperbolic-cross points.
For illustration, in the case of Sobol points in a single dimension (d=l) , a constructive definition may be given as follows: Choose a primitive polynomial P(x) = x" + aj ""1 + ... + an.,x + 1
(whose coefficients a, are either 0 or 1) and define so-called direction numbers v1# i > n by the following recurrence formula:
Vj = aiVi., Θ a2v;.2 Θ ... Θ a^v^, Θ v„ Θ (v,.n/2n) , where θ denotes a bit-by-bit "exclusive or" operation.
The initial numbers v, = m,/2, ..., vn=τan/2 can be chosen freely provided rrtj is odd and 0 < n < 2' for
Using the direction numbers v; so defined, now define the one-dimensional Sobol sequence x,, j, ... by
Xk = b,v, θ b2v2 θ ... θ bwvw, k ≥ 0 where k = ∑i=0^OBk^bi2i is the binary representation of k. For higher dimensions (d > 1) , the first d primitive polynomials P,, P2, ..., Pd are used. If {xk'Jk^* denotes the one-dimensional Sobol sequence generated by the polynomial P;, the d- dimensional Sobol points are defined as x* = (x*1, Xk 2, • • • ^ •
While this definition can be implemented as a computer algorithm directly, faster techniques are known which produce these points in a "shuffled" or permuted sequence. In particular, this applies to the computer algorithm given in the Appendix.
For specificity in the following, a preferred embodiment of the invention is described as applied to a collateralized mortgage obligation known as CMO FN, 89-23. This has thirty-year maturity and consists of the following tranches:
PAC tranches 23-A, 23-B, 23-C, 23-D, 23-E supporting tranches 23-G, 23-H, 23-J residual tranche 23-R accrual tranche 23-Z The monthly cash flow is divided and distributed according to pre-specified rules which are included in a formal prospectus. Some of the basic rules may be stated as follows:
First from the monthly cash flow, the coupon is paid to the tranches. The remaining amount, called
SUBSTTTUTESHEET(RULE26)
Principal Distribution Amount, is used for repayment of the principal. Prior to a fixed date in the future, the Principal Amount will be allocated sequentially to the tranches 23-G, 23-H, 23-J and 23-Z. After that date, the Principal Distribution Amount will be allocated sequentially to the tranches 23-A, 23-B, 23- C, 23-D and 23-E according to a planned schedule. Any excess amount of the Principal Distribution Amount over the planned schedule wil be allocated sequentially to the tranches 23-G, 23-H, 23-J and 23-Z. A distribution of principal of the tranche 23-R will be made only after all other tranches have been retired.
In deriving an estimate for the present value of the security at the time of issue, the following notation is used below:
C - the monthly payment on the underlying mortgage pool; ik - the projected interest rate in month k, k = 1, 2, , 360; wk the percentage of mortgages prepaying in month k; a 36o*+ι _ tne remaining annuity after month k. A remaining annuity ak can be expressed as3 to ak = 1 + v0 + ... + Vr "1, k = l, 2, ..., 360, with v0 = l/(l+i0), where i0 is the current monthly interest rate. Thus, after k months, the remaining amount of principal borrowed is C-ak.
It is assumed that the interest rate ik can be expressed as ik = Ko exp(£k)it.,, where exp(. ) denotes exponentiation and where i/ £2/ • ■ • , ?3βo a-re independent, normally distributed random variables with mean 0 and variance σ, and Kg is a given constant. For the present example, σ = 0.0004 is chosen.
It is assumed further that wk as a function of ik can be computed as wk = K, + K2 arctan (K3ik + K , where K,, K2, K3, K4 are given constants. Under these assumptions, the cash flow in month k, k = 1, 2, , 360 is
C(l-w,( ,) ) ... (l-wk.,(flf ... ,Sk-1) ) (l-wk(£,, ... ,£k)
+ wk'sl» • • • i ζk) a360-k+l) i where w k ι» • • • £k) = K, + K2 arctan(K3Ko ki0exp(£1+...+|k) +K4) . This cash flow is distributed according to the rules of FN, 89-23. Then, the cash flow for each of the tranches is multiplied by the discount factor v,(£ι) ...vk(f1# ... ,£k) , with Vj(fi, ... , £j) = 1/(1 +
) , j-1,2, ... ,360, to find the present value for month k. Summing of the present values for every month gives the present value PVT, for each tranche T.
The expected or estimated value, E(PVT) = E(PVτ(flf ...ff3β)) f upon a change of variables is represented by
E (PVT) = JD PVτ (y! (Xj) , . . ^ yjβo fxjβo) ) dx, . . . d jβo, where x; = (2πσ)-,Λj.β yi exp(-t2/(2σ))dt. Thus, for each tranche T, a 360-variate integrand has to be integrated over the 360-dimensional unit cube, .
After generating a point
(Xj, •X2, ... , X360) of a low-discrepancy deterministic sequence in the unit cube, the point
is computed by finding the value of the inverse normal cumulative distribution function at each ^ . Then, for each tranche T, the function value
SUBSTTTUTESHEET(RULE26)
P τ(y!, y2, ..., y360) is computed. These are the function values used in numerical integration.
Fig. 2 shows results from trial runs for CMO FN, 89-23 with a preferred method using Sobol points generated by the corresponding computer algorithm given in the Appendix, as compared with Monte Carlo integration. Two Monte Carlo computations were carried out, with different "seeds" or starting values of a congruential pseudo-random number generator known as RAN2; see W. Press et al., Numerical Recipes in C. Cambridge University Press, 1992. It is apparent that the preferred method reaches a steady value more rapidly. In this and other trial runs, with typical requirements of precision and confidence, a speed-up by a factor of 3 to 5 was realized as compared with Monte Carlo integration. Much greater speed-up can be expected when higher precision or/and higher levels of confidence are sought. In a further trial -run with CMO FN, 89-23, instead of Sobol points, Halton points were used as generated by the corresponding computer algorithm given in the Appendix. It is felt that Sobol points may be preferred over Halton points for integrals of high dimension. However, this preference may not apply in the case of lower-dimensional integrals, e.g., with dimension up to 5 or so.
A computation as described may be terminated after a predetermined number of function evaluations. Alternatively, e.g., after every function evaluation or after a predetermined incremental number of function evaluations, a current approximation may be compared with one or several preceding approximations, for termination once a suitable condition depending on the difference between approximations is met. Such ter¬ mination criteria may be called automatic. Automatic
termination is particularly reliable where a sequence of approximations settles down smoothly; see, e.g., the curve in Fig. 2 corresponding to Sobol points. Advantageously in computing function values, a cluster or network of multiple parallel processors or workstations can be used. This may involve a master or host processor providing points of a low-discrepancy sequence to slave processors and combining function values returned by the slave processors into an approximate value for the integral. Thus, the compu¬ tation can be speeded up in proportion to the number of processors used.
Advantageous further, in combination with numerical integration as described above, is the use of error reduction techniques analogous to variance reduc¬ tion in Monte Carlo integration as described, e.g., by M. Kalos et al. , Monte Carlo Methods. John Wiley & Sons, 1986. This may involve a change of variables or/and variation reduction, for example.
void sobol(int n)
This is the function sobol for generating Sobol points. It returns the n-th d-dimenβional Sobol point. (The point (0,0, ..., 0) is skipped.) The point iβ implicitly returned through the array x. The function sobseq from Numerical Recipes, 1992 was used as a basis, but changed significantly to acco odate the parallel distributed approach. The unction sobol can generate Sobol points skipping an initial part of the sequence. The constant MAXDIM, see Numerical Recipes, is extended to 360 which required adding more initializing data to the arrays ip (the imitive polynomials) , deg (their degrees) , and iv (the initial direction numbers) . The polynomial x is used to generate the first coordinate of Sobol points.
#include "nrutil.h" #define MAXBIT 30 ttdefine MAXDIM 360 extern int d; /* actual dimension of the points */ extern double *x; /* This returns implicitly the n-th Sobol point in x */ void sobol (int n)
{ int j,k,l; unsigned long i,im,ipp; static double ec¬ static unsigned long in,ix(MAXDIM+l] ,*iu(MAXBIT+l] ; static unsigned long mdeg[MAXDIM*1] -{0,MAXBIT,1,2,3,3,4,4,
5,5,5,5,5,5,
Df Of DfD DrO(
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, /*16*/ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9.9,9.9.9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, /*20*/ 10.10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
12,12,12
}; /* The first coordinate is set to MAXBIT, but it is never used */ static unsigned long ip[MAXDIM+l] -{0,MAXBIT,0,1,1,2,1,4,
SUBSTTTUTE SHEET (RULE 26)
deg 5*/ 2,13,7,14,11,4,
/*deg 6*/ 1,16,13,22,19,25,
/*deg 7*/ 1,32,4,8,7,56,14,28,19,50,21,42,31,62,37,41,55,59,
/*deg 8*/ 14,56,21,22,38,47,49,50,52,67,70,84,97,103,115,122,
/*deg 9*/ 8,13 ,16 ,22 ,25,44 ,47 ,52 ,55 ,59 ,62 ,67 ,74 ,81 ,82 ,87 ,91 ,94, 103,104,109,122,124,137,138,143,145,152,157,167,173,176,181,182,185, 191,194,199,218,220,227,229,230,234,236,241,244,253,
/*deg 10*/ 4,13,19,22,50,55,64,69,98,107,115,121,127,134,140,145,152,
158,161,171,181,194,199,203,208,227,242,251,253,265,266,274,283,289,295, 301,316,319,324,346,352,361,367,382,395,398,400,412,419,422,426,428,433, 446,454,457,472,493,505,508,
/•degll*/ 2,11,21,22,35,49,50,56,61,70,74,79,84,88,103,104,112,115,117,122,134, 137,146,148,157,158,162,164,168,173,185,186,191,193,199,213,214,220,227, 236,242,251,256,259,265,266,276,292,304,310,316,319,322,328,334,339,341, 345,346,362,367,372,375,376,381,385,388,392,409,415,416,421,428,431,434, 439,446,451.453,457,458,471,475,478,484,493,494,499,502,517,518,524,527, 555,560,565,569,578,580,587,589,590,601,607,611,614,617,618,625,628,635, 641,647,654,659,662,672,675,682,684,689,695,696,713,719,724,733,734,740, 747,749,752,755,762,770,782,784,787,789,793,796,803,805,810,815,824,829, 830,832,841,847,849,861,871,878,889,892,901,908,920,923,942,949,950,954, 961,968,971,973,979,982,986,998,1001,1010,1012, degl2*/ 41,52,61,62,76,104,117,131,143,145,157,167,171,176,181,194,217,236, 239,262,283,286,307); static unsigned long iv(MAXDIM*MAXBIT+l) «{ 0, /* 40 elements in a row */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1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,1,7,5,1,3,3,7,5,1,1,5,7,7,5,1,3,3,
1,5,7,7,5,1,3,3,7,5,5,7,7,1,3,3,7,5,1,1,5,3,3,1,7,5,1,3,3,7,5,1,1,5,7,7,5,1,3,3, /*end 3
*/
1,15,11,5,3,1,7,9,13,11,1,3,7,9,5,13,13,11,3,15,5,3,15,7,9,13,9,1,11,7,5,15,1,15,11,5,3,1,7, 9,
1,15,11,5,3,1,7,9,13,11,1,3,7,9,5,13,13,11,3,15,5,3,15,7,9,13,9,1,11,7,5,15,1,15,11,5,3,1,7, 9,
SUBSTTTUTE SHEET (RULE 26)
O 97/07475
12
1.15,11,5,3,1,7,9,13,11,1,3,7,9,5,13,13,11,3,15,5,3.15.7,9,13,9,1,11,7,5,15,1,15,11,5,3,1,7,
9, 1,15,11,5,3,1,7,9,13,11,1,3,7,9,5,13,13,11,3,15,5,3,15,7,9,13,9,1,11,7,5,15,1,15,11,5,3,1,7,
9, 1,15,11,5,3,1,7,9,13,11,1,3,7,9,5,13,13,11,3,15,5,3,15,7,9,13,9,1,11,7,5,15,1,15,11,5,3,1,7,
9, 1,15,11,5,3,1,7,9,13,11,1,3,7,9,5,13,13,11,3,15,5,3,15,7,9,13,9,1,11,7,5,15,1,15,11,5,3,1,7,
9, 1,15,11,5,3,1,7,9,13,11,1,3,7,9,5,13,13,11,3,15,5,3,15,7,9,13,9,1,11,7,5,15,1,15,11,5,3,1,7,
9, 1,15,11,5,3,1,7,9,13,11,1,3,7,9,5,13,13,11,3,15,5,3,15,7,9,13,9,1,11,7,5,15,1,15,11,5,3,1,7,
9, 1,15,11,5,3,1,7,9,13,11,1,3,7,9,5,13,13,11,3,15,5,3,15,7,9,13,9,1,11,7,5,15,1,15,11,5,3,1,7,
9, /*end 4 */
1,17,13,7,15,9,31,9,3,27,15,29,21,23,19,11,25,7,13,17,1,25,29,3,31,11,5,23,27,19,21,5,1,17,1
3,7,15,9,31,9,
1,17,13,7,15,9,31,9,3,27,15,29,21,23,19,11,25,7,13,17,1,25,29,3,31,11,5,23,27,19,21,5,1,17,1
3,7,15,9,31,9,
1,17,13,7,15,9,31,9,3,27,15,29,21,23,19,11,25,7,13,17,1,25,29,3,31,11,5,23,27,19,21,5,1,17,1
3,7,15,9,31,9,
1,17,13,7,15,9,31,9,3,27,15,29,21,23,19,11,25,7,13,17,1,25,29,3,31,11,5,23,27,19.21,5,1,17,1
3,7,15,9,31,9,
1,17,13,7,15,9,31,9,3,27,15,29,21,23,19,11,25,7,13,17,1,25,29,3,31,11,5,23,27,19,21,5,1,17,1
3,7,15,9,31,9,
1,17,13,7,15,9,31,9,3,27,15,29,21,23,19,11,25,7,13,17,1,25,29,3,31,11,5,23,27,19,21,5,1,17,1
3,7,15,9,31,9,
1,17,13,7,15,9,31,9,3,27,15,29,21,23,19,11,25,7,13,17,1,25,29,3,31,11,5,23,27,19,21.5,1,17,1
3,7,15,9,31,9,
1,17,13,7,15,9,31,9,3,27,15,29,21,23,19,11,25,7,13,17.1,25,29,3,31,11,5,23,27,19,21,5,1,17,1
3,7,15,9,31,9,
1,17,13,7,15,9,31,9,3,27,15,29,21,23,19,11,25,7,13,17,1,25,29,3,31,11,5,23,27,19,21,5,1,17,1
3,7,15,9,31,9, /*eπd 5 */
1,51,61,43,51,59,47,57,35,53,19,51,61,37,33,7,5,11,39,63,27,17,15.23,29,3,21,13,31,25,9,49,3
3,19,29,11,19,27,15,25,
1.51,61,43,51,59,47,57,35,53,19,51,61,37,33,7.5.11,39,63,27,17,15,23.29,3,21,13.31,25,9,49,3
3,19,29,11,19,27,15,25,
1,51,61,43,51,59,47,57,35,53,19,51,61,37,33,7,5,11,39,63,27,17,15,23,29,3,21,13,31,25,9,49,3
3,19,29,11,19,27,15,25,
1,51,61,43,51,59,47,57,35,53,19,51,61,37,33,7,5,11,39,63,27,17,15,23,29,3,21,13,31,25,9,49,3
3,19,29,11,19,27,15,25,
1,51,61,43,51,59,47,57,35,53,19,51,61,37,33,7,5,11,39,63,27,17,15,23,29,3,21,13,31,25,9,49,3
3,19,29,11,19,27,15,25,
1,51,61,43,51,59,47,57,35,53,19,51,61,37,33,7,5,11,39,63,27,17,15,23,29,3,21,13,31,25,9,49,3
3,19,29,11,19,27,15,25,
1,51, 61, 3, 51, 59, 7, 57, 35, 53, 19, 51, 61, 37, 33, 7, 5, 11, 39, 63, 27, 17, 15, 23, 29, 3, 21, 13, 31, 25, 9, 49, 3
3,19,29,11,19,27,15,25,
1,51,61,43,51,59,47,57,35,53,19,51,61,37,33,7,5,11,39,63,27,17,15,23,29,3,21,13,31,25,9,49,3
3,19,29,11,19,27,15,25,
1,51,61,43,51,59,47,57,35,53,19,51,61,37,33,7,5,11,39,63,27,17,15,23,29,3,21,13,31,25,9,49,3
3,19,29,11,19,27,15,25, /*end 6 */
1,85,67,49,125,25,109,43,89,69,113,47,55,97,3,37,83,103,27,13,33,115,41,79,17,29,119,75,73,1
05,7,59,65,21,3,113,61,89,45,107,
1,85,67,49,125,25,109,43,89,69,113,47,55,97,3,37,83,103,27,13,33,115,41,79,17,29,119,75,73,1
05,7,59,65,21,3,113,61,89,45,107,
1,85,67,49,125,25,109,43,89,69,113,47,55,97,3,37,83,103,27,13,33,115,41,79,17,29,119,75,73,1
05,7,59,65,21,3,113,61,89,45,107,
1,85,67,49,125,25,109,43,89,69,113,47,55,97,3,37,83,103,27,13,33,115,41,79,17,29,119,75,73,1
05,7,59,65,21,3,113,61,89,45,107,
1,85,67,49,125,25,109,43,89,69,113,47,55,97,3,37,83,103,27,13,33,115,41,79,17,29,119,75,73,1 05,7,59,65,21,3,113,61,89,45,107,
1,85,67,49,125,25,109,43,89,69,113,47,55,97,3,37,83,103,27,13,33,115,41,79,17,29,119,75,73,1
05,7,59,65,21,3,113,61,89,45,107,
1,85,67,49,125,25,109,43,89,69,113,47,55,97,3,37,83,103,27,13,33,115,41,79,17,29,119,75,73,1
05,7,59,65,21,3,113,61,89,45,107,
1,85,67,49,125,25,109,43,89,69,113,47,55,97,3,37,83,103,27,13,33,115,41,79,17,29,119,75,73,1 05,7,59,65,21,3,113,61,89,45,107,
1,85,67,49,125,25,109,43,89,69,113,47,55,97,3,37,83,103,27,13,33,115,41,79,17,29,119,75,73,1 05,7,59,65,21,3,113,61,89,45,107, /*end 7 */
1,255,79,147,141,89,173,43,9,25,115,97,19,97,197,101,255,29,203,65,195,177,105,17,47,169,109
,149,15,213,135,253,191,155,175,63,47,7,23,39,
1,255,79,147,141,89,173,43,9.25,115,97,19,97,197,101,255,29,203,65,195,177,105,17,47,169,109
,149,15,213,135,253,191,155,175,63,47,7,23,39,
1,255,79,147,141.89,173,43,9,25,115,97,19,97,197,101,255,29,203,65,195,177,105,17,47,169,109
,149,15,213,135,253,191,155,175,63,47,7,23,39,
1,2S5, 79, 147, 141, 89, 173, 43, 9, 25, 115, 97, 19, 97, 197, 101, 255, 29, 203, 65, 195, 177, 105, 17, 47, 169, 109
,149,15,213,135,253,191,155,175,63,47,7,23,39,
1,255,79,147,141,89,173,43,9,25,115,97,19,97,197,101,255,29,203,65,195,177,105,17,47,169,109
,149,15,213,135,253,191,155,175,63,47,7,23,39,
1,255,79,147,141,89,173,43,9,25,115,97,19,97,197,101,255,29,203,65,195,177,105,17,47,169,109
,149,15,213,135,253,191,155,175,63,47,7,23,39,
1,255,79,147,141,89,173,43,9,25,115,97,19,97,197,101,255,29,203,65,195,177,105,17,47,169,109
,149,15,213,135,253,191,155,175,63,47,7,23,39,
1,255,79,147,141,89,173,43,9,25,115,97,19,97,197,101,255,29,203,65,195,177,105,17,47,169,109
,149,15,213,135,253,191,155,175,63,47,7,23,39,
1,255,79,147,141,89,173,43,9,25,115,97,19,97,197,101,255,29,203,65,195,177,105,17,47,169,109
,149,15,213,135,253,191,155,175,63,47,7,23,39, /*end 8 */
1,257,465,439,177,321,181,225,235,103,411,233,59,353,329,463,385,111,475,451,263,19,249,275,
369,393,167,333,473,469,101,21,451,229,247,297,403,497,61,361,
1,257,465,439,177,321,181,225,235,103,411,233,59,353,329,463,385,111,475,451,263,19,249,275,
369,393,167,333,473,469,101,21,451,229,247,297,403,497,61,361,
1,257,465,439,177,321,181,225,235,103,411,233,59,353,329,463,385,111,475,451,263,19,249,275,
369,393,167,333,473,469,101,21,451,229,247,297,403,497,61,361,
1,257,465,439,177,321,181,225,235,103,411,233,59,353,329,463,385,111,475,451,263,19,249,275,
369,393,167,333,473,469,101,21,451,229,247,297,403,497,61,361,
1,257,465,439,177,321,181,225,235,103,411,233,59,353,329,463,385,111,475,451,263,19,249,275,
369,393,167,333,473,469,101,21,451,229,247,297,403,497,61,361,
1,257,465,439,177,321,181,225,235,103,411,233,59,353,329,463,385,111.475,451,263,19,249,275,
369,393,167,333,473,469,101,21,451,229,247,297,403,497,61,361,
1,257,465,439,177,321,181,225,235,103,411,233,59,353,329,463,385,111,475,451,263,19,249,275,
369,393,167,333,473,469,101,21,451,229,247,297,403,497,61,361,
1,257,465,439,177,321,181,225,235,103,411,233,59,353,329,463,385,111,475,451,263,19,249,275,
369,393,167,333,473,469,101,21,451,229,247,297,403,497,61,361,
1,257,465,439,177,321,181,225,235,103,411,233,59,353,329,463,385,111,475,451,263,19,249,275,
369,393,167,333,473,469,101,21,451,229,247,297,403,497,61,361,
/•end 9 */
1,771,721,1013,759,835,949,113,929,615,157,39,761,169,983,657,647,581,505,833,139,147,203,81
,337,829,989,375,365,131,215,733,451,447,177,57,471,979,197,251,
1,771,721,1013,759,835,949,113,929,615,157,39,761,169,983,657,647,581,505,833,139,147,203,81
,337,829,989,375,365,131,215,733,451,447,177,57,471,979,197,251,
1,771,721,1013,759,835,949,113,929,615,157,39,761,169,983,657,647,581,505,833,139,147,203,81
,337,829,989,375,365,131,215,733,451,447,177,57,471,979,197,251,
1,771,721,1013,759,835,949,113,929,615,157,39,761,169,983,657,647,581,505,833,139,147,203,81
,337,829,989,375,365,131,215,733,451,447,177,57,471,979,197,251,
1,771,721,1013,759,835,949,113,929,615,157,39,761,169,983,657,647,581,505,833,139,147,203,81
,337,829,989,375,365,131,215,733,451,447,177,57,471,979,197,251,
1,771,721,1013,759,835,949,113,929,615,157,39,761,169,983,657,647,581,505,833,139,147,203,81
,337,829,989,375,365,131,215,733,451,447,177,57,471,979,197,251,
1,771,721,1013,759,835,949,113,929,615,157,39,761,169,983,657,647,581,505,833,139,147,203,81
,337,829,989,375,365,131,215,733,451,447,177,57,471,979,197,251,
1,771,721,1013,759,835,949,113,929,615,157,39,761,169,983,657,647,581,505,833,139,147,203,81
,337,829,989,375,365,131,215,733,451,447,177,57,471,979,197,251,
1,771,721,1013,759,835,949,113,929,615,157,39,761,169,983,657,647,581,505,833,139,147,203,81
,337,829,989,375,365,131,215,733,451,447,177,57,471,979,197,251,
/•end 10 •/
1,1285,823,727,267,833,471,1601,1341,913,1725,2021,1905,375,893,1599,415,605,819,975,915,171
5,1223,1367,663,629,525,469,981,1667,1587,1251,451,481,721,483,1209,1457,415,1435,
1,1285,823,727,267,833,471,1601,1341,913,1725,2021,1905,375,893,1599,415,605,819,975,915,171
5,1223,1367,663,629,525,469,981,1667,1587,1251,451,481,721,483,1209,1457,415,1435,
1,1285,823,727,267,833,471,1601,1341,913,1725,2021,1905,375,893,1599,415,605,819,975,915,171
5,1223,1367,663,629,525,469,981,1667,1587,1251,451,481,721,483,1209,1457,415,1435,
1,1285, 823, 727, 267, 833, 471, 1601, 1341, 913, 1725, 2021, 190S, 375, 893, 1599, 415, 605, 819, 975, 915, 171
5,1223,1367,663,629,525,469,981,1667,1587,1251,451,481,721,483,1209,1457,415,1435,
1,1285,823,727,267,833,471,1601,1341,913,1725,2021,1905,375,893,1599,415,605,819,975,915,171
5,1223,1367,663,629,525,469,981,1667,1587,1251,451,481,721,483,1209,1457,415,1435,
1,1285,823,727,267,833,471,1601,1341,913,1725,2021,1905,375,893,1599,415,605,819,975,915,171
5,1223,1367,663,629,525,469,981,1667,1587,1251,451,481,721,483,1209,1457,415,1435,
1,1285,823,727,267,833,471,1601,1341,913,1725,2021,1905,375,893,1599,415,605,819,975,915,171
5,1223,1367,663,629,525,469,981,1667,1587,1251,451,481,721,483,1209,1457,415,1435,
1,1285,823,727,267,833,471,1601,1341,913,1725,2021,1905,375,893,1599,415,605,819,975,915,171
5,1223,1367,663,629,525,469,981,1667,1587,1251,451,481,721,483,1209,1457,415,1435,
1,1285,823,727,267,833,471,1601,1341,913,1725,2021,1905,375,893,1599,415,605,819,975,915,171
5,1223,1367,663,629,525,469,981,1667,1587,1251,451,481,721,483,1209,1457,415,1435,
/•end 11 */
1,3855,4091,987,1839,4033,2515,579,3863,977,3463,2909,3379,1349,3739,347,387,2881,2821,1873,
1959,1929,2389,3251,1149,243,3609,1131,1701,143,1339,3497,2499,1571,983,4021,1625,3217,1163,
2977,
1,3855,4091,987,1839,4033,2515,579,3863,977,3463,2909,3379,1349,3739,347,387,2881,2821,1873,
1959,1929,2389,3251,1149,243,3609,1131,1701,143,1339,3497,2499,1571,983,4021,1625,3217,1163,
2977,
1,3855,4091,987,1839,4033,2515,579,3863,977,3463,2909,3379,1349,3739,347,387,2881,2821,1873,
1959,1929,2389,3251,1149,243,3609,1131,1701,143,1339,3497,2499,1571,983,4021,1625,3217,1163,
2977,
1,3855,4091,987,1839,4033,2515,579,3863,977,3463,2909,3379,1349,3739,347,387,2881,2821,1873,
1959,1929,2389,3251,1149,243,3609,1131,1701,143,1339,3497,2499,1571,983,4021,1625,3217,1163,
2977,
1,3855,4091,987,1839,4033,2515,579,3863,977,3463,2909,3379,1349,3739,347,387,2881,2821,1873,
1959,1929,2389,3251,1149,243,3609,1131,1701,143.1339,3497,2499,1571,983,4021,1625,3217,1163,
2977,
1,3855,4091,987,1839,4033,2515,579,3863,977,3463,2909,3379,1349,3739,347,387,2881,2821,1873, 1959,1929,2389,3251,1149,243,3609,1131,1701,143,1339,3497,2499,1571,983,4021,1625,3217,1163, 2977,
1,3855,4091,987,1839,4033,2515,579,3863,977,3463,2909,3379,1349,3739,347,387,2881,2821,1873, 1959,1929,2389,3251,1149,243,3609,1131,1701,143,1339,3497,2499,1571,983,4021,1625,3217,1163, 2977,
1,3855,4091,987,1839,4033,2515,579,3863,977,3463,2909,3379,1349,3739,347,387,2881,2821,1873, 1959,1929,2389,3251,1149,243,3609,1131,1701,143,1339.3497,2499,1571,983,4021,1625,3217,1163, 2977,
1,3855,4091,987,1839,4033,2515,579,3863,977,3463,2909,3379,1349,3739,347,387,2881,2821,1873, 1959,1929,2389,3251,1149,243,3609,1131,1701,143,1339,3497,2499,1571,983,4021,1625,3217,1163, 2977 /*end 12 •/ i (n < 0) { for(j*12;j<*MAXBIT;j++) iv[l+j*MAXDIM] «1 ; /* Initialize all direction numbers for the first coordinate to 1 */ for (j=l,k«0;j<*MAXBIT;j++,k+«MAXDIM) iu[j] * tiv[k] ; for ( k- 1, • k. < . AXDIM ;k++) { for (j=l;j<»mdeg[kj ;j++) iu[j] [k] «= (MAXBIT-j); for (j=mdeg{k]+l;j<»MAXBIT;j++) { ipp.ip [k] ; i=iu(j-mdegtk]J tk) ; i » (i >> mdegϊkj ) ; for (l-mdeg(k]-l;l>»l;l--) {
in the previous call
if(in!«n-l) { unsigned long gray;
/* Set ix to 0 */ for (k-l;k<-IMIN(d,MAXDIM) ;k++) ix[k].0; in>n-l; gray-in* (in>>l) ; /* Find gray code of in */ for (j=l;j<»MAXBIT;j++) { if (gray&l) { /* Only digits which are 1 are uβed */ ira-(j-l)*MAXDIM; for (k.l,-k<«IMIN(d, AXDIM) ;k++) ix[k] *= ivlim+k] ;
} gray»«l;
1 i Im»in; /* Calculate the next vector in the sequence */ for (j-l,-j<-MAXBIT;j++) { /• Find the rightmost zero bit •/ if (! (im & 11) break; i >>« 1; if (j > MAXBIT) nrerror("MAXBIT too small in sobseq"); im.(j-1) 'MAXDIM; for (k«l ;k<»IMIN (d, MAXDIM) ;k++) { ix[k] *< iv (im+k] ; χ [k-l) -ixlk) *fac;
) in++ ;
#undef MAXBIT *undef MAXDIM
..................................................................... void halton(int n)
This is the function halton for generating Halton points.
It returns the n-th d-dimensional Halton point. The point is implicitly returned through the array x. The last two digits of n-l in base p[j] are kept in ql[j] and q2[j] . When both digits become p[j]-l, the radical inverse function is computed again. That way the accumulation of round-off error is avoided. In practice, there are not any upper bounds on the values of d and n.
.....♦.....................-........................................../ extern int d; /* actual dimension of the points */ extern int *ql,*q2; /* ql[j] is the last digit of n-l in base p[j], q2[j] is the digit before the last one */ extern double *x; /* This will contain the Halton point */ extern int *p; /• the first d prime numbers */ extern int *p 1; /* first d prime numbers minus 1 */ extern double~*incrl,*incr2; /• incrllj] is 1/ptj] and 1/ (p[j] *ptj] ) */ double find_fi (int p, int n) ; /• See below */ void halton(int n)
{ double a; int j,nn; static int ins_n; /• The default value of inβ_n is 0 •/
/* Check if the (n-l)-th number was generated in the previous call to halton. If not, update ql, q2, and x */
the last digit is less than p[j]-l •/ qi[j]++; x fj ] =x (j] +incrl [j ] ;
/• This iβ the case when the last digit iβ p (j] -l and the digit before the last one is less than p [j ] - l •/ ql ljl -0 ; q2 [j] ++ ; x [j] =x [j ] +incrl [j ] +iπcr2 (j ] - 1.0 ; else
SUBSTTTUTE SHEET (RULE 26)
/* This is the case when the last digit is p [j ] - l and the digit before the last one iβ alβo p [j] - l */
) *incr2 [j ] *incrl [j] ;
find_fi(int p, int n)
This returns the radical inverse function fi(p,n) at n for the prime p.
double find_fi(int p, int n) int p2,nn; double s,fi,incr; incral.0/p; p2-p*p; nn»n/p2;
/* The two largest components of fi are added later to avoid possible loss of precision */ fi-((n/pVp)+ fi)/ p2; fi+*(ntp)/ (double) p; return fi;