STK: a Small (Matlab/Octave) Toolbox for Kriging
 STK_SAMPLING_NESTEDLHS builds a Nested Latin Hypercube Sampling (NLHS)

 CALL: X = stk_sampling_nestedlhs (N, DIM)

   builds a NLHS, with length(N) levels, N(k) points at the k-th level,
   and a dimension DIM. X has sum(N) rows and (DIM + 1) columns, the last
   column begin the levels.
   A design is nested when all points observed at the (k+1)-th level are
   also observed at the k-th level.
   A nested design is a Latin Hypercube Sampling (LHS), if every
   sub-design corresponding to a specified level is a LHS.
   Remark: N(k+1) must divide N(k).

 CALL: X = stk_sampling_nestedlhs (N, DIM, BOX)

   does the same thing in the DIM-dimensional hyperrectangle specified by the
   argument BOX, which is a 2 x DIM matrix where BOX(1, j) and BOX(2, j) are
   the lower- and upper-bound of the interval on the j^th coordinate.
   Default value for BOX: [0; 1]^DIM.
   If BOX is provided, DIM = size(BOX, 2).
   Warning: size(X, 2) == (DIM + 1)

 CALL: X = stk_sampling_nestedlhs (N, DIM, BOX, NITER)

   allows to change the number of independent random LHS that are used at
   each level to complete the design.
   Default value for NITER: 1000.
   Put NITER to 1 to generate a random NLHS.

 CALL: X = stk_sampling_nestedlhs (N, DIM, BOX, NITER, LEVELS)

   does the same thing, but the levels are indexed by the vector LEVELS.
   The length of LEVELS must be greater or equal than the length of N.
   Default value for LEVELS: 1:length(N).

 EXAMPLE

   n = [48, 12, 6, 2]; dim = 2;
   bnd = stk_hrect([-5, 1; 7, 2]);
   levels = [100; 50; 33; 25; 20];
   x = stk_sampling_nestedlhs(n, dim, bnd, [], levels);

 REFERENCE

   [1] Peter Z. G. Qian, "Nested latin hypercube designs", Biometrika,
       96(4):957-970, 2009.

 See also: stk_sampling_nesteddesign, stk_sampling_randomlhs