public class Misc
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static double |
evalPoly(int n,
double[] X,
double[] C,
double z)
Given n, X and C as described in
interpol(n, X, Y, C), this
function returns the value of the interpolating polynomial P(z) evaluated
at z (see eq. |
static int |
getTimeInterval(double[] times,
int start,
int end,
double t)
Returns the index of the time interval corresponding to time t.
|
static void |
interpol(int n,
double[] X,
double[] Y,
double[] C)
Computes the Newton interpolating polynomial.
|
static double |
quickSelect(double[] t,
int n,
int k)
Returns the
kth smallest item of the array t of size n.
|
static int |
quickSelect(int[] t,
int n,
int k)
Returns the
kth smallest item of the array t of size n.
|
public static double quickSelect(double[] t,
int n,
int k)
t - the array which contain the itemsn - the number of items in the arrayk - the index of the smallest itempublic static int quickSelect(int[] t,
int n,
int k)
t - the array which contain the itemsn - the number of items in the arrayk - the index of the smallest itempublic static int getTimeInterval(double[] times,
int start,
int end,
double t)
times - an array of simulation times.start - the first index in the array to consider.end - the last index (inclusive) in the array to consider.t - the queried simulation time.java.lang.NullPointerException - if times is null.java.lang.IllegalArgumentException - if start is negative,
or if end is smaller than start.java.lang.ArrayIndexOutOfBoundsException - if start + end
is greater than or equal to the length of times.public static void interpol(int n,
double[] X,
double[] Y,
double[] C)
n - degree of the interpolating polynomialX - x-coordinates of pointsY - y-coordinates of pointsC - Coefficients of the interpolating polynomialpublic static double evalPoly(int n,
double[] X,
double[] C,
double z)
interpol(n, X, Y, C), this
function returns the value of the interpolating polynomial P(z) evaluated
at z (see eq. ).n - degree of the interpolating polynomialX - x-coordinates of pointsC - Coefficients of the interpolating polynomialz - x-coordinate where polynomial is evaluatedTo submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.