@Test public void testUnitize2() { System.out.println("unitize2"); double[] data = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0}; MathEx.unitize2(data); assertEquals(1, MathEx.norm2(data), 1E-7); }
public static void unitize2(double[] x) { double n = norm(x); for (int i = 0; i < x.length; i++) { x[i] /= n; } }
MathEx { public static void unitize2(double[] x) { double n = norm(x); for (int i = 0; i < x.length; i++) { x[i] /= n; } } }
MathEx { public static void unitize2(double[] x) { double n = norm(x); for (int i = 0; i < x.length; i++) { x[i] /= n; } } private  MathEx(); }
MathEx { public static void unitize2(double[] x) { double n = norm(x); for (int i = 0; i < x.length; i++) { x[i] /= n; } } private  MathEx(); static double log2(double x); static double log(double x); static double log1pe(double x); static boolean isInt(float x); static boolean isInt(double x); static boolean equals(double a, double b); static double logistic(double x); static double tanh(double x); static double sqr(double x); static boolean isPower2(int x); static boolean isProbablePrime(long n, int k); static double round(double x, int decimal); static double factorial(int n); static double lfactorial(int n); static double choose(int n, int k); static double lchoose(int n, int k); static void setSeed(long seed); static void setSeed(); static long probablePrime(long n, int k); static LongStream seeds(long n, int k); static int random(double[] prob); static int[] random(double[] prob, int n); static double random(); static double[] random(int n); static double random(double lo, double hi); static double[] random(double lo, double hi, int n); static long randomLong(); static int randomInt(int n); static int randomInt(int lo, int hi); static int[] permutate(int n); static void permutate(int[] x); static void permutate(float[] x); static void permutate(double[] x); static void permutate(Object[] x); static int softmax(double[] posteriori); static int softmax(double[] x, int k); static int[] c(int... x); static float[] c(float... x); static double[] c(double... x); static String[] c(String... x); static int[] c(int[]... list); static float[] c(float[]... list); static double[] c(double[]... list); static String[] c(String[]... list); static int[] cbind(int[]... x); static float[] cbind(float[]... x); static double[] cbind(double[]... x); static String[] cbind(String[]... x); static int[][] rbind(int[]... x); static float[][] rbind(float[]... x); static double[][] rbind(double[]... x); static String[][] rbind(String[]... x); static E[] slice(E[] data, int[] index); static int[] slice(int[] data, int[] index); static float[] slice(float[] data, int[] index); static double[] slice(double[] data, int[] index); static boolean contains(double[][] polygon, double[] point); static boolean contains(double[][] polygon, double x, double y); static void reverse(int[] a); static void reverse(float[] a); static void reverse(double[] a); static void reverse(T[] a); static int min(int a, int b, int c); static double min(float a, float b, float c); static double min(double a, double b, double c); static int min(int a, int b, int c, int d); static double min(float a, float b, float c, float d); static double min(double a, double b, double c, double d); static int max(int a, int b, int c); static float max(float a, float b, float c); static double max(double a, double b, double c); static int max(int a, int b, int c, int d); static float max(float a, float b, float c, float d); static double max(double a, double b, double c, double d); static int min(int[] x); static float min(float[] x); static double min(double[] x); static int whichMin(int[] x); static int whichMin(float[] x); static int whichMin(double[] x); static IntPair whichMin(double[][] x); static int max(int[] x); static float max(float[] x); static double max(double[] x); static int whichMax(int[] x); static int whichMax(float[] x); static int whichMax(double[] x); static IntPair whichMax(double[][] x); static int min(int[][] matrix); static double min(double[][] matrix); static int max(int[][] matrix); static double max(double[][] matrix); static double[][] transpose(double[][] A); static int[] rowMin(int[][] data); static int[] rowMax(int[][] data); static long[] rowSums(int[][] data); static double[] rowMin(double[][] data); static double[] rowMax(double[][] data); static double[] rowSums(double[][] data); static double[] rowMeans(double[][] data); static double[] rowSds(double[][] data); static int[] colMin(int[][] data); static int[] colMax(int[][] data); static long[] colSums(int[][] data); static double[] colMin(double[][] data); static double[] colMax(double[][] data); static double[] colSums(double[][] data); static double[] colMeans(double[][] data); static double[] colSds(double[][] data); static int sum(byte[] x); static long sum(int[] x); static double sum(float[] x); static double sum(double[] x); static int median(int[] a); static float median(float[] a); static double median(double[] a); static T median(T[] a); static int q1(int[] a); static float q1(float[] a); static double q1(double[] a); static T q1(T[] a); static int q3(int[] a); static float q3(float[] a); static double q3(double[] a); static T q3(T[] a); static double mean(int[] x); static double mean(float[] x); static double mean(double[] x); static double var(int[] x); static double var(float[] x); static double var(double[] x); static double sd(int[] x); static double sd(float[] x); static double sd(double[] x); static double mad(int[] x); static double mad(float[] x); static double mad(double[] x); static boolean all(boolean[] x); static boolean any(boolean[] x); static double distance(int[] x, int[] y); static double distance(float[] x, float[] y); static double distance(double[] x, double[] y); static double distance(SparseArray x, SparseArray y); static double[][] pdist(double[][] x); static void pdist(double[][] x, double[][] dist, boolean squared, boolean half); static double squaredDistance(int[] x, int[] y); static double squaredDistance(float[] x, float[] y); static double squaredDistance(double[] x, double[] y); static double squaredDistance(SparseArray x, SparseArray y); static double squaredDistanceWithMissingValues(double[] x, double[] y); static double entropy(double[] p); static double KullbackLeiblerDivergence(double[] x, double[] y); static double KullbackLeiblerDivergence(SparseArray x, SparseArray y); static double KullbackLeiblerDivergence(double[] x, SparseArray y); static double KullbackLeiblerDivergence(SparseArray x, double[] y); static double JensenShannonDivergence(double[] x, double[] y); static double JensenShannonDivergence(SparseArray x, SparseArray y); static double JensenShannonDivergence(double[] x, SparseArray y); static double JensenShannonDivergence(SparseArray x, double[] y); static int dot(int[] x, int[] y); static float dot(float[] x, float[] y); static double dot(double[] x, double[] y); static double dot(SparseArray x, SparseArray y); static double cov(int[] x, int[] y); static double cov(float[] x, float[] y); static double cov(double[] x, double[] y); static double[][] cov(double[][] data); static double[][] cov(double[][] data, double[] mu); static double cor(int[] x, int[] y); static double cor(float[] x, float[] y); static double cor(double[] x, double[] y); static double[][] cor(double[][] data); static double[][] cor(double[][] data, double[] mu); static double spearman(int[] x, int[] y); static double spearman(float[] x, float[] y); static double spearman(double[] x, double[] y); static double kendall(int[] x, int[] y); static double kendall(float[] x, float[] y); static double kendall(double[] x, double[] y); static float norm1(float[] x); static double norm1(double[] x); static float norm2(float[] x); static double norm2(double[] x); static float normInf(float[] x); static double normInf(double[] x); static float norm(float[] x); static double norm(double[] x); static float cos(float[] x, float[] y); static double cos(double[] x, double[] y); static void standardize(double[] x); static void scale(double[][] x); static void standardize(double[][] x); static void normalize(double[][] x); static void normalize(double[][] x, boolean centerizing); static void unitize(double[] x); static void unitize1(double[] x); static void unitize2(double[] x); static boolean equals(float[] x, float[] y); static boolean equals(float[] x, float[] y, float epsilon); static boolean equals(double[] x, double[] y); static boolean equals(double[] x, double[] y, double eps); static boolean equals(float[][] x, float[][] y); static boolean equals(float[][] x, float[][] y, float epsilon); static boolean equals(double[][] x, double[][] y); static boolean equals(double[][] x, double[][] y, double eps); static boolean isZero(float x); static boolean isZero(float x, float epsilon); static boolean isZero(double x); static boolean isZero(double x, double epsilon); static int[][] clone(int[][] x); static float[][] clone(float[][] x); static double[][] clone(double[][] x); static void swap(int[] x, int i, int j); static void swap(float[] x, int i, int j); static void swap(double[] x, int i, int j); static void swap(Object[] x, int i, int j); static void swap(int[] x, int[] y); static void swap(float[] x, float[] y); static void swap(double[] x, double[] y); static void swap(E[] x, E[] y); static void copy(int[] x, int[] y); static void copy(float[] x, float[] y); static void copy(double[] x, double[] y); static void copy(int[][] x, int[][] y); static void copy(float[][] x, float[][] y); static void copy(double[][] x, double[][] y); static void add(double[] y, double[] x); static void sub(double[] y, double[] x); static void scale(double a, double[] x); static void scale(double a, double[] x, double[] y); static double[] axpy(double a, double[] x, double[] y); static double[] pow(double[] x, double n); static int[] unique(int[] x); static String[] unique(String[] x); static int[][] sort(double[][] x); static double[] solve(double[] a, double[] b, double[] c, double[] r); }
MathEx { public static void unitize2(double[] x) { double n = norm(x); for (int i = 0; i < x.length; i++) { x[i] /= n; } } private  MathEx(); static double log2(double x); static double log(double x); static double log1pe(double x); static boolean isInt(float x); static boolean isInt(double x); static boolean equals(double a, double b); static double logistic(double x); static double tanh(double x); static double sqr(double x); static boolean isPower2(int x); static boolean isProbablePrime(long n, int k); static double round(double x, int decimal); static double factorial(int n); static double lfactorial(int n); static double choose(int n, int k); static double lchoose(int n, int k); static void setSeed(long seed); static void setSeed(); static long probablePrime(long n, int k); static LongStream seeds(long n, int k); static int random(double[] prob); static int[] random(double[] prob, int n); static double random(); static double[] random(int n); static double random(double lo, double hi); static double[] random(double lo, double hi, int n); static long randomLong(); static int randomInt(int n); static int randomInt(int lo, int hi); static int[] permutate(int n); static void permutate(int[] x); static void permutate(float[] x); static void permutate(double[] x); static void permutate(Object[] x); static int softmax(double[] posteriori); static int softmax(double[] x, int k); static int[] c(int... x); static float[] c(float... x); static double[] c(double... x); static String[] c(String... x); static int[] c(int[]... list); static float[] c(float[]... list); static double[] c(double[]... list); static String[] c(String[]... list); static int[] cbind(int[]... x); static float[] cbind(float[]... x); static double[] cbind(double[]... x); static String[] cbind(String[]... x); static int[][] rbind(int[]... x); static float[][] rbind(float[]... x); static double[][] rbind(double[]... x); static String[][] rbind(String[]... x); static E[] slice(E[] data, int[] index); static int[] slice(int[] data, int[] index); static float[] slice(float[] data, int[] index); static double[] slice(double[] data, int[] index); static boolean contains(double[][] polygon, double[] point); static boolean contains(double[][] polygon, double x, double y); static void reverse(int[] a); static void reverse(float[] a); static void reverse(double[] a); static void reverse(T[] a); static int min(int a, int b, int c); static double min(float a, float b, float c); static double min(double a, double b, double c); static int min(int a, int b, int c, int d); static double min(float a, float b, float c, float d); static double min(double a, double b, double c, double d); static int max(int a, int b, int c); static float max(float a, float b, float c); static double max(double a, double b, double c); static int max(int a, int b, int c, int d); static float max(float a, float b, float c, float d); static double max(double a, double b, double c, double d); static int min(int[] x); static float min(float[] x); static double min(double[] x); static int whichMin(int[] x); static int whichMin(float[] x); static int whichMin(double[] x); static IntPair whichMin(double[][] x); static int max(int[] x); static float max(float[] x); static double max(double[] x); static int whichMax(int[] x); static int whichMax(float[] x); static int whichMax(double[] x); static IntPair whichMax(double[][] x); static int min(int[][] matrix); static double min(double[][] matrix); static int max(int[][] matrix); static double max(double[][] matrix); static double[][] transpose(double[][] A); static int[] rowMin(int[][] data); static int[] rowMax(int[][] data); static long[] rowSums(int[][] data); static double[] rowMin(double[][] data); static double[] rowMax(double[][] data); static double[] rowSums(double[][] data); static double[] rowMeans(double[][] data); static double[] rowSds(double[][] data); static int[] colMin(int[][] data); static int[] colMax(int[][] data); static long[] colSums(int[][] data); static double[] colMin(double[][] data); static double[] colMax(double[][] data); static double[] colSums(double[][] data); static double[] colMeans(double[][] data); static double[] colSds(double[][] data); static int sum(byte[] x); static long sum(int[] x); static double sum(float[] x); static double sum(double[] x); static int median(int[] a); static float median(float[] a); static double median(double[] a); static T median(T[] a); static int q1(int[] a); static float q1(float[] a); static double q1(double[] a); static T q1(T[] a); static int q3(int[] a); static float q3(float[] a); static double q3(double[] a); static T q3(T[] a); static double mean(int[] x); static double mean(float[] x); static double mean(double[] x); static double var(int[] x); static double var(float[] x); static double var(double[] x); static double sd(int[] x); static double sd(float[] x); static double sd(double[] x); static double mad(int[] x); static double mad(float[] x); static double mad(double[] x); static boolean all(boolean[] x); static boolean any(boolean[] x); static double distance(int[] x, int[] y); static double distance(float[] x, float[] y); static double distance(double[] x, double[] y); static double distance(SparseArray x, SparseArray y); static double[][] pdist(double[][] x); static void pdist(double[][] x, double[][] dist, boolean squared, boolean half); static double squaredDistance(int[] x, int[] y); static double squaredDistance(float[] x, float[] y); static double squaredDistance(double[] x, double[] y); static double squaredDistance(SparseArray x, SparseArray y); static double squaredDistanceWithMissingValues(double[] x, double[] y); static double entropy(double[] p); static double KullbackLeiblerDivergence(double[] x, double[] y); static double KullbackLeiblerDivergence(SparseArray x, SparseArray y); static double KullbackLeiblerDivergence(double[] x, SparseArray y); static double KullbackLeiblerDivergence(SparseArray x, double[] y); static double JensenShannonDivergence(double[] x, double[] y); static double JensenShannonDivergence(SparseArray x, SparseArray y); static double JensenShannonDivergence(double[] x, SparseArray y); static double JensenShannonDivergence(SparseArray x, double[] y); static int dot(int[] x, int[] y); static float dot(float[] x, float[] y); static double dot(double[] x, double[] y); static double dot(SparseArray x, SparseArray y); static double cov(int[] x, int[] y); static double cov(float[] x, float[] y); static double cov(double[] x, double[] y); static double[][] cov(double[][] data); static double[][] cov(double[][] data, double[] mu); static double cor(int[] x, int[] y); static double cor(float[] x, float[] y); static double cor(double[] x, double[] y); static double[][] cor(double[][] data); static double[][] cor(double[][] data, double[] mu); static double spearman(int[] x, int[] y); static double spearman(float[] x, float[] y); static double spearman(double[] x, double[] y); static double kendall(int[] x, int[] y); static double kendall(float[] x, float[] y); static double kendall(double[] x, double[] y); static float norm1(float[] x); static double norm1(double[] x); static float norm2(float[] x); static double norm2(double[] x); static float normInf(float[] x); static double normInf(double[] x); static float norm(float[] x); static double norm(double[] x); static float cos(float[] x, float[] y); static double cos(double[] x, double[] y); static void standardize(double[] x); static void scale(double[][] x); static void standardize(double[][] x); static void normalize(double[][] x); static void normalize(double[][] x, boolean centerizing); static void unitize(double[] x); static void unitize1(double[] x); static void unitize2(double[] x); static boolean equals(float[] x, float[] y); static boolean equals(float[] x, float[] y, float epsilon); static boolean equals(double[] x, double[] y); static boolean equals(double[] x, double[] y, double eps); static boolean equals(float[][] x, float[][] y); static boolean equals(float[][] x, float[][] y, float epsilon); static boolean equals(double[][] x, double[][] y); static boolean equals(double[][] x, double[][] y, double eps); static boolean isZero(float x); static boolean isZero(float x, float epsilon); static boolean isZero(double x); static boolean isZero(double x, double epsilon); static int[][] clone(int[][] x); static float[][] clone(float[][] x); static double[][] clone(double[][] x); static void swap(int[] x, int i, int j); static void swap(float[] x, int i, int j); static void swap(double[] x, int i, int j); static void swap(Object[] x, int i, int j); static void swap(int[] x, int[] y); static void swap(float[] x, float[] y); static void swap(double[] x, double[] y); static void swap(E[] x, E[] y); static void copy(int[] x, int[] y); static void copy(float[] x, float[] y); static void copy(double[] x, double[] y); static void copy(int[][] x, int[][] y); static void copy(float[][] x, float[][] y); static void copy(double[][] x, double[][] y); static void add(double[] y, double[] x); static void sub(double[] y, double[] x); static void scale(double a, double[] x); static void scale(double a, double[] x, double[] y); static double[] axpy(double a, double[] x, double[] y); static double[] pow(double[] x, double n); static int[] unique(int[] x); static String[] unique(String[] x); static int[][] sort(double[][] x); static double[] solve(double[] a, double[] b, double[] c, double[] r); static final double EPSILON; static final float FLOAT_EPSILON; static final int RADIX; static final int DIGITS; static final int FLOAT_DIGITS; static final int ROUND_STYLE; static final int MACHEP; static final int FLOAT_MACHEP; static final int NEGEP; static final int FLOAT_NEGEP; }