# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.analysis.curvefit.interpolation.bivariate

## Class BivariateRegularGrid

• java.lang.Object
• com.numericalmethod.suanshu.analysis.curvefit.interpolation.bivariate.BivariateRegularGrid
• All Implemented Interfaces:
BivariateGrid

public class BivariateRegularGrid
extends Object
implements BivariateGrid
A regular grid is a tessellation of n-dimensional Euclidean space by congruent parallelotopes (e.g. bricks), meaning that grid points are equally-spaced. This is a special case of rectilinear grid. This implementation is backed by a two-dimensional array.
Wikipedia: Regular grid
• ### Constructor Summary

Constructors
Constructor and Description
BivariateRegularGrid(double[][] z, double x0, double y0, double deltaX, double deltaY)
Create a new grid where the dependent variable values are taken from the given two-dimensional array and the values of the dependent variables are specified by their first values and the difference between successive values.
• ### Method Summary

All Methods
Modifier and Type Method and Description
double deltaX()
Return the distance between two adjacent points along the x-axis.
double deltaY()
Return the distance between two adjacent points along the y-axis.
int sizeX()
Define the size of the grid along the x-axis.
int sizeY()
Define the size of the grid along the y-axis.
double[] x()
Get the values of the independent variable xi.
double x(int i)
Get the value of xi, the i-th value of the independent variable x.
double x0()
Get the value of x0, the first value of the independent variable x.
double[] y()
Get the values of the independent variable yj.
double y(int j)
Get the value of yj, the j-th value of the independent variable y.
double y0()
Get the value of y0, the first value of the independent variable y.
double z(int i, int j)
Get the value of the dependent variable z at the given indices in the grid.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### BivariateRegularGrid

public BivariateRegularGrid(double[][] z,
double x0,
double y0,
double deltaX,
double deltaY)
Create a new grid where the dependent variable values are taken from the given two-dimensional array and the values of the dependent variables are specified by their first values and the difference between successive values.

The first index for the input array will be corresponding to x and the second index to y and the size will be inferred from the size of the array.

Parameters:
z - the two-dimensional array containing the values of the dependent variable
x0 - the first value of the independent variable x
y0 - the first value of the independent variable y
deltaX - the distance between adjacent points along the x-axis
deltaY - the distance between adjacent points along the y-axis
• ### Method Detail

• #### z

public double z(int i,
int j)
Description copied from interface: BivariateGrid
Get the value of the dependent variable z at the given indices in the grid.
Specified by:
z in interface BivariateGrid
Parameters:
i - the index along the x-axis
j - the index along the y-axis
Returns:
z(xi, yj)
• #### x

public double[] x()
Description copied from interface: BivariateGrid
Get the values of the independent variable xi.
Specified by:
x in interface BivariateGrid
Returns:
xi's
• #### y

public double[] y()
Description copied from interface: BivariateGrid
Get the values of the independent variable yj.
Specified by:
y in interface BivariateGrid
Returns:
yj's
• #### x

public double x(int i)
Description copied from interface: BivariateGrid
Get the value of xi, the i-th value of the independent variable x.
Specified by:
x in interface BivariateGrid
Parameters:
i - the index
Returns:
xi
• #### y

public double y(int j)
Description copied from interface: BivariateGrid
Get the value of yj, the j-th value of the independent variable y.
Specified by:
y in interface BivariateGrid
Parameters:
j - the index
Returns:
yj
• #### sizeX

public int sizeX()
Description copied from interface: BivariateGrid
Define the size of the grid along the x-axis. That is, the number of points along the x-axis.
Specified by:
sizeX in interface BivariateGrid
Returns:
the size along the x-axis
• #### sizeY

public int sizeY()
Description copied from interface: BivariateGrid
Define the size of the grid along the y-axis. That is, the number of points along the y-axis.
Specified by:
sizeY in interface BivariateGrid
Returns:
the size along the y-axis
• #### x0

public double x0()
Get the value of x0, the first value of the independent variable x.
Returns:
x0
• #### y0

public double y0()
Get the value of y0, the first value of the independent variable y.
Returns:
y0
• #### deltaX

public double deltaX()
Return the distance between two adjacent points along the x-axis.
Returns:
$$\delta_x$$
• #### deltaY

public double deltaY()
Return the distance between two adjacent points along the y-axis.
Returns:
$$\delta_y$$