java.lang.ObjectLinearArray
Class LinearArray provides several static operation on linear arrays of double. Methods add(), subtract() multiply(), merge() and clone() return a new array, while methods fillRandomData(), sortSelection() and sortBubble() modify the array that is passed as an argument to them.
| Constructor Summary | |
LinearArray()
|
|
| Method Summary | |
static double[] |
add(double[] a1,
double[] a2)
Implements linear array addition. |
static double[] |
clone(double[] original)
Creates an exact copy of an array. |
static void |
fillRandomData(double[] a)
Fills a linear array with radmon data in the range [0..1). |
static int |
maxLocationFrom(double[] a,
int start)
Starting from a specified position of an array, it identifies the location of the maximum element of the array. |
static int |
minLocationFrom(double[] a,
int start)
Starting from a specified position of an array, it identifies the location of the minimum element of the array. |
static double[] |
multiply(double factor,
double[] a)
Implements scalar linear array multiplication. |
static void |
printH(double[] a)
Prints the elements of an array, all at the same line. |
static void |
printV(double[] a)
Prints the elements of an array, each at a different line. |
static double[] |
subtract(double[] a1,
double[] a2)
Implements linear array subtraction. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public LinearArray()
| Method Detail |
public static double[] add(double[] a1,
double[] a2)
a1 - The first array to be added. It cannot be NULL.a2 - The second array to be added. It cannot be NULL.
public static double[] clone(double[] original)
public static void fillRandomData(double[] a)
a - The array to be filled. It cannot be NULL.
public static int maxLocationFrom(double[] a,
int start)
a - The array to be searched.start - The search for the maximum starts from this position.
public static int minLocationFrom(double[] a,
int start)
a - The array to be searched.start - The search for the minimum starts from this position.
public static double[] multiply(double factor,
double[] a)
factor - The factor of the multiplication.a - The array to be multiplied. It cannot be NULL.
public static void printH(double[] a)
a - The array of which the ellements are printed.public static void printV(double[] a)
a - The array of which the ellements are printed.
public static double[] subtract(double[] a1,
double[] a2)
a1 - The array from which we subtract. It cannot be NULL.a2 - The array to be subtracted. It cannot be NULL.