{smcl}
{* 07jul2005}{...}
{cmd:help mata rank1coef()}
{hline}

{title:Title}

{p 4 8 2}
{bf: rank1coef() -- Search for coefficients of a rank-1 Korborov lattice generator that make good lattice points}


{title:Syntax}

{p 8 8 2}
{it:real rowvector}{bind:}
{cmd:rank1coef(}{it:real scalar smax}, {it:p} [, {it:real scalar alpha}]{cmd:)}


{title:Description}

{p 4 4 2}
{cmd:rank1coef()} searches for the integer values that make good rank-1 Korobov
lattice generators for prime number {it:p} and dimensions 2, 3, ..., {it:smax}.
{cmd:rank1coef()} returns a row vector of length {it:smax} where the first
element is the prime {it:p} and elements 2, 3, ..., {it:smax} contain the
coefficents for the rank-1 Korobov lattice generator for dimensions 2, 3, ...,
{it:smax}.

{title:Remarks}

{p 4 4 2}
This is a companion routine for {cmd:mvnlattice()} used for searching for
coefficients used in its rank-1 quadrature rule.  It implements the method of
good lattice points described by Sloan and Joe (1994), Chapter 4.  The
optional scalar {it:alpha} specifies the order of the Bernoulli polynomial used
to approximate the quadrature error.  If given, {it:alpha} can only be equal to 2 or 4,
otherwise, the Korobov "worst function", (1-2*x)^2, is used.

{p 4 4 2}
Note that {cmd:rank1coef()} uses an exhaustive search and can take considerable
time for large primes, {it:p}, and maximum dimension, {it:smax}.

{title:Conformability}

    {cmd:rank1coef(}{it:smax}, {it:p}{cmd:):}
	{it:input:}
	     {it:smax}:  {it:1 x 1}
		{it:p}:  {it:1 x 1}
	    {it:alpha}:  {it:1 x 1}
       {it:output:}
           {it:result}:  {it:1 x {it:smax}}
		 

{title:References}

{p 4 6 2}
Sloan, I.H. and S. Joe 1994. Lattice Methods for multiple Integration.
Oxford University Press 

{title:Source code}

{p 4 4 2}
{view rank1coef.mata}

{title:Also see}

{p 4 13 2}
{hi: mvnlattice.mata()}

{p 4 13 2}
Online:  help for 
{bf:{help mvnlattice: mvnlattice()}}
{p_end}
