SSJ
V. 2.6.

## umontreal.iro.lecuyer.hups Class Rank1Lattice

```java.lang.Object
umontreal.iro.lecuyer.hups.PointSet
umontreal.iro.lecuyer.hups.Rank1Lattice
```
Direct Known Subclasses:
KorobovLattice

`public class Rank1Latticeextends PointSet`

This class implements point sets specified by integration lattices of rank 1. They are defined as follows. One selects an arbitrary positive integer n and a s-dimensional integer vector (a0,..., as-1). [Usually, a0 = 1 and 0 <= aj < n for each j; when the aj are outside the interval [0, n), then we replace aj by ( aj mod n) in all calculations.] The points are defined by

ui = (i/n)(a0, a1,…, as-1) mod 1

for i = 0,..., n - 1. These n points are distinct provided that n and the aj's have no common factor.

Constructor Summary
```Rank1Lattice(int n, int[] a, int s)```
Instantiates a `Rank1Lattice` with n points and lattice vector a of dimension s.

Method Summary
` void` ```addRandomShift(int d1, int d2, RandomStream stream)```
Adds a random shift to all the points of the point set, using stream stream to generate the random numbers.
` void` `clearRandomShift()`
Clears the random shift.
` int[]` `getAs()`
Returns the generator aj of the lattice.
` double` ```getCoordinate(int i, int j)```
Returns ui, j, the coordinate j of the point i.
` PointSetIterator` `iterator()`
Constructs and returns a point set iterator.
` void` `setNumPoints(int n)`
Resets the number of points of the lattice to n.
` String` `toString()`
Formats a string that contains information about the point set.

Methods inherited from class umontreal.iro.lecuyer.hups.PointSet
`addRandomShift, addRandomShift, addRandomShift, formatPoints, formatPoints, formatPoints, formatPoints, formatPointsBase, formatPointsBase, formatPointsBase, formatPointsBase, formatPointsNumbered, formatPointsNumbered, getDimension, getNumPoints, getStream, randomize, randomize, randomize, randomize, randomize, setStream, unrandomize`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Rank1Lattice

```public Rank1Lattice(int n,
int[] a,
int s)```
Instantiates a `Rank1Lattice` with n points and lattice vector a of dimension s.

Parameters:
`n` - there are n points
`a` - the lattice vector
`s` - dimension of the lattice vector a
Method Detail

### setNumPoints

`public void setNumPoints(int n)`
Resets the number of points of the lattice to n. The dimension s and the aj are unchanged.

### getAs

`public int[] getAs()`
Returns the generator aj of the lattice. (The original ones before they are reset to aj mod n). Its components are returned as a[j], for j = 0, 1,…,(s - 1).

```public void addRandomShift(int d1,
int d2,
RandomStream stream)```
Adds a random shift to all the points of the point set, using stream stream to generate the random numbers. For each coordinate j from d1 to d2-1, the shift dj is generated uniformly over [0, 1) and added modulo 1 to all the coordinates of all the points.

Overrides:
`addRandomShift` in class `PointSet`
Parameters:
`d1` - lower dimension of shift
`d2` - upper dimension of shift is d2 - 1
`stream` - random number stream used to generate uniforms

### clearRandomShift

`public void clearRandomShift()`
Clears the random shift.

Overrides:
`clearRandomShift` in class `PointSet`

### toString

`public String toString()`
Description copied from class: `PointSet`
Formats a string that contains information about the point set.

Overrides:
`toString` in class `PointSet`
Returns:
string representation of the point set information

### getCoordinate

```public double getCoordinate(int i,
int j)```
Description copied from class: `PointSet`
Returns ui, j, the coordinate j of the point i.

Specified by:
`getCoordinate` in class `PointSet`
Parameters:
`i` - index of the point to look for
`j` - index of the coordinate to look for
Returns:
the value of ui, j

### iterator

`public PointSetIterator iterator()`
Description copied from class: `PointSet`
Constructs and returns a point set iterator. The default implementation returns an iterator that uses the method `getCoordinate` (i,j) to iterate over the points and coordinates, but subclasses can reimplement it for better efficiency.

Overrides:
`iterator` in class `PointSet`
Returns:
point set iterator for the point set

SSJ
V. 2.6.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.