|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object umontreal.iro.lecuyer.util.Misc
public class Misc
This class provides miscellaneous functions that are hard to classify. Some may be moved to another class in the future.
Method Summary | |
---|---|
static double |
evalPoly(double[] C,
int n,
double x)
. |
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 double |
getMedian(double[] A,
int n)
Returns the median of the first n elements of array A. |
static double |
getMedian(int[] A,
int n)
Returns the median of the first n elements of array A. |
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[] A,
int n,
int k)
Returns the kth smallest item of the array A of size n. |
static int |
quickSelect(int[] A,
int n,
int k)
Returns the kth smallest item of the array A of size n. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static double quickSelect(double[] A, int n, int k)
A
- the array which contain the itemsn
- the number of items in the arrayk
- the index of the smallest item
public static int quickSelect(int[] A, int n, int k)
A
- the array which contain the itemsn
- the number of items in the arrayk
- the index of the smallest item
public static double getMedian(double[] A, int n)
A
- the arrayn
- the number of used elements
public static double getMedian(int[] A, int n)
A
- the arrayn
- the number of used elements
public 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.
NullPointerException
- if times is null.
IllegalArgumentException
- if start is negative,
or if end is smaller than start.
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
- argument where polynomial is evaluated
public static double evalPoly(double[] C, int n, double x)
C
- Coefficients of the polynomialn
- degree of the polynomialx
- argument where polynomial is evaluated
|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |