SSJ
V. labo.

umontreal.iro.lecuyer.util
Class Misc

java.lang.Object
  extended by umontreal.iro.lecuyer.util.Misc

public class Misc
extends Object

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)
          \begin{tabb}Evaluates the polynomial $P(x)$
 of degree $n$\ with coefficients $c_...</TD>
</TR>
<TR BGCOLOR=
static double evalPoly(int n, double[] X, double[] C, double z)
          .
static double getMedian(double[] A, int n)
          .
static double getMedian(int[] A, int n)
          [tabb47]
Athe array nthe number of used elements the median of A
static int getTimeInterval(double[] times, int start, int end, double t)
          .
static void interpol(int n, double[] X, double[] Y, double[] C)
          \begin{tabb}Computes the Newton interpolating polynomial.</TD>
</TR>
<TR BGCOLOR=
static double quickSelect(double[] A, int n, int k)
          .
static int quickSelect(int[] A, int n, int k)
          [tabb30]
Athe array which contain the items nthe number of items in the array kthe index of the smallest item the kth smallest item of the array A
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

quickSelect

public static double quickSelect(double[] A,
                                 int n,
                                 int k)
. \begin{tabb}
 Returns the $k^{th}$\ smallest item of the array $A$\ of size $n$.
 Array $A$\ is unchanged by the method.
 Restriction: $1 \le k \le n$.
 \end{tabb}
Athe array which contain the items nthe number of items in the array kthe index of the smallest item the kth smallest item of the array A


quickSelect

public static int quickSelect(int[] A,
                              int n,
                              int k)
[tabb30]
Athe array which contain the items nthe number of items in the array kthe index of the smallest item the kth smallest item of the array A


getMedian

public static double getMedian(double[] A,
                               int n)
. \begin{tabb}
 Returns the median of the first $n$\ elements of array $A$.
 \end{tabb}
Athe array nthe number of used elements the median of A


getMedian

public static double getMedian(int[] A,
                               int n)
[tabb47]
Athe array nthe number of used elements the median of A


getTimeInterval

public static int getTimeInterval(double[] times,
                                  int start,
                                  int end,
                                  double t)
. \begin{tabb}Returns the index of the time interval corresponding to time \texttt...
 ...d in non-decreasing order,
 the behavior of this method is undefined.
 \end{tabb}
timesan array of simulation times. startthe first index in the array to consider. endthe last index (inclusive) in the array to consider. tthe queried simulation time. the index of the interval. NullPointerExceptionif times is null. IllegalArgumentExceptionif start is negative, or if end is smaller than start. ArrayIndexOutOfBoundsExceptionif start + end is greater than or equal to the length of times.


interpol

public static void interpol(int n,
                            double[] X,
                            double[] Y,
                            double[] C)
\begin{tabb}Computes the Newton interpolating polynomial. Given the $n+1$
 real ...
 ...1) + \cdots +
 c_n(x-x_0)(x-x_1) \cdots(x-x_{n-1}).
 \end{displaymath}\end{tabb}
ndegree of the interpolating polynomial Xx-coordinates of points Yy-coordinates of points CCoefficients of the interpolating polynomial


evalPoly

public static double evalPoly(int n,
                              double[] X,
                              double[] C,
                              double z)
. \begin{tabb}
 % latex2html id marker 103
 Given $n$, $X$\ and $C$\ as described i...
 ...nomial $P(z)$\ evaluated
 at $z$\ (see eq. \ref{eq.newton.interpol}).
 \end{tabb}
ndegree of the interpolating polynomial Xx-coordinates of points CCoefficients of the interpolating polynomial zargument where polynomial is evaluated Value of the interpolating polynomial P(z)


evalPoly

public static double evalPoly(double[] C,
                              int n,
                              double x)
\begin{tabb}Evaluates the polynomial $P(x)$
 of degree $n$\ with coefficients $c_...
 ...uad P(x) = c_0 + c_1 x + c_2 x^2 + \cdots + c_n x^n
 \end{displaymath}\end{tabb}
CCoefficients of the polynomial ndegree of the polynomial xargument where polynomial is evaluated Value of the polynomial P(x)


SSJ
V. labo.

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