Package org.esa.snap.core.util.math
Class VectorLookupTable
- java.lang.Object
-
- org.esa.snap.core.util.math.VectorLookupTable
-
public class VectorLookupTable extends Object
The classVectorLookupTable
performs the function of multilinear interpolation for vector lookup tables with an arbitrary number of dimensions.todo - method for degrading a table (see
LookupTable
)
-
-
Constructor Summary
Constructors Constructor Description VectorLookupTable(int length, double[] values, double[]... dimensions)
Constructs an array lookup table for the lookup values and dimensions supplied as arguments.VectorLookupTable(int length, double[] values, IntervalPartition... dimensions)
Constructs an array lookup table for the lookup values and dimensions supplied as arguments.VectorLookupTable(int length, float[] values, float[]... dimensions)
Constructs an array lookup table for the lookup values and dimensions supplied as arguments.VectorLookupTable(int length, float[] values, IntervalPartition... dimensions)
Constructs an array lookup table for the lookup values and dimensions supplied as arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IntervalPartition
getDimension(int i)
Returns the the ith dimension associated with the lookup table.int
getDimensionCount()
Returns the number of dimensions associated with the lookup table.IntervalPartition[]
getDimensions()
Returns the dimensions associated with the lookup table.double[]
getValues(double... coordinates)
Returns an interpolated value array for the given coordinates.
-
-
-
Constructor Detail
-
VectorLookupTable
public VectorLookupTable(int length, double[] values, IntervalPartition... dimensions)
Constructs an array lookup table for the lookup values and dimensions supplied as arguments.- Parameters:
length
- the length of the lookup vector.values
- the lookup values. Thevalues
array must be laid out in row-major order, so that the dimension associated with the last axis varies fastest.dimensions
- the interval partitions defining the dimensions associated with the lookup table. An interval partition is a strictly increasing sequence of at least two real numbers, seeIntervalPartition
.- Throws:
IllegalArgumentException
- iflength
is less than1
or the length ofvalues
is not equal tolength
times the number of coordinate grid vertices.NullPointerException
- if thevalues
array or thedimensions
array isnull
or any dimension isnull
.
-
VectorLookupTable
public VectorLookupTable(int length, float[] values, IntervalPartition... dimensions)
Constructs an array lookup table for the lookup values and dimensions supplied as arguments.- Parameters:
length
- the length of the lookup vector.values
- the lookup values. Thevalues
array must be laid out in row-major order, so that the dimension associated with the last axis varies fastest.dimensions
- the interval partitions defining the dimensions associated with the lookup table. An interval partition is a strictly increasing sequence of at least two real numbers, seeIntervalPartition
.- Throws:
IllegalArgumentException
- iflength
is less than1
or the length ofvalues
is not equal tolength
times the number of coordinate grid vertices.NullPointerException
- if thevalues
array or thedimensions
array isnull
or any dimension isnull
.
-
VectorLookupTable
public VectorLookupTable(int length, double[] values, double[]... dimensions)
Constructs an array lookup table for the lookup values and dimensions supplied as arguments.- Parameters:
length
- the length of the lookup vector.values
- the lookup values. Thevalues
array must be laid out in row-major order, so that the dimension associated with the last axis varies fastest.dimensions
- the interval partitions defining the dimensions associated with the lookup table. An interval partition is a strictly increasing sequence of at least two real numbers, seeIntervalPartition
.- Throws:
IllegalArgumentException
- iflength
is less than1
or the length ofvalues
is not equal tolength
times the number of coordinate grid vertices.NullPointerException
- if thevalues
array or thedimensions
array isnull
or any dimension isnull
.
-
VectorLookupTable
public VectorLookupTable(int length, float[] values, float[]... dimensions)
Constructs an array lookup table for the lookup values and dimensions supplied as arguments.- Parameters:
length
- the length of the lookup vector.values
- the lookup values. Thevalues
array must be laid out in row-major order, so that the dimension associated with the last axis varies fastest.dimensions
- the interval partitions defining the dimensions associated with the lookup table. An interval partition is a strictly increasing sequence of at least two real numbers, seeIntervalPartition
.- Throws:
IllegalArgumentException
- iflength
is less than1
or the length ofvalues
is not equal tolength
times the number of coordinate grid vertices.NullPointerException
- if thevalues
array or thedimensions
array isnull
or any dimension isnull
.
-
-
Method Detail
-
getDimensionCount
public final int getDimensionCount()
Returns the number of dimensions associated with the lookup table.- Returns:
- the number of dimensions.
-
getDimensions
public final IntervalPartition[] getDimensions()
Returns the dimensions associated with the lookup table.- Returns:
- the dimensions.
-
getDimension
public final IntervalPartition getDimension(int i)
Returns the the ith dimension associated with the lookup table.- Parameters:
i
- the index number of the dimension of interest- Returns:
- the ith dimension.
-
getValues
public final double[] getValues(double... coordinates) throws IllegalArgumentException
Returns an interpolated value array for the given coordinates.- Parameters:
coordinates
- the coordinates of the lookup point.- Returns:
- the interpolated value array.
- Throws:
IllegalArgumentException
- if the length of thecoordinates
array is not equal to the number of dimensions associated with the lookup table.NullPointerException
- if thecoordinates
array isnull
.
-
-