|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgpalta.core.Common
public abstract class Common
Useful utilities for all clases
Field Summary | |
---|---|
static java.util.Random |
globalRandom
A random number generator for use by other classes |
Constructor Summary | |
---|---|
Common()
|
Method Summary | |
---|---|
static double[] |
copy(double[] x)
Obtain a copy of an array |
static double[][] |
copy(double[][] m)
Obtain an independent copy of the given matrix |
static int[] |
copy(int[] x)
Obtain a copy of an array |
static int[][] |
copy(int[][] m)
Obtain an independent copy of the given matrix |
static double |
dist(double[] x1,
double[] x2,
int n)
N Distance between two vectors |
static double |
dist2(double[] x1,
double[] x2)
Euclidean distance between two vectors |
static double |
dotProduct(double[] x1,
double[] x2)
Dot product between two vectors |
static int[] |
randPerm(int n)
Efficient permutation algorithm, O(n) |
static double[][] |
readFromFile(java.lang.String fileName,
java.lang.String separator)
Read a matrix from file |
static void |
sigmoid(double[] x)
Calculate the sigmoid (logistic function) for an entire array (inplace, i.e. modifying its contents) |
static double |
sum(double[] x)
Sum of the values of a vector |
static double[][] |
transpose(double[][] m)
Transpose a matrix |
static void |
transpose(double[][] mT,
double[][] m)
|
static double |
variance(double[] x)
Variance of a vector |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.util.Random globalRandom
Constructor Detail |
---|
public Common()
Method Detail |
---|
public static int[] randPerm(int n)
n
- The size of the permutation
public static void sigmoid(double[] x)
x
- the arraypublic static double[][] readFromFile(java.lang.String fileName, java.lang.String separator) throws java.io.IOException
fileName
- The file to readseparator
- Carachter that separates each value
java.io.IOException
- If any errors occur when reading the filepublic static double[][] transpose(double[][] m)
m
- The matrix to transpose
public static void transpose(double[][] mT, double[][] m)
public static double sum(double[] x)
x
- The vector
public static double[][] copy(double[][] m)
m
- The matrix to copy
public static int[][] copy(int[][] m)
m
- The matrix to copy
public static double[] copy(double[] x)
x
- The array to copy
public static int[] copy(int[] x)
x
- The array to copy
public static double dist(double[] x1, double[] x2, int n)
x1
- one vectorx2
- the othern
-
public static double dist2(double[] x1, double[] x2)
x1
- one vectorx2
- the other vector
public static double dotProduct(double[] x1, double[] x2)
x1
- one vectorx2
- the other vector
public static double variance(double[] x)
x
- The vector
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |