List of utility methods to do Vector
double | median(double[] vector) Returns the median of the vector. final double[] sorted = vector.clone(); Arrays.sort(sorted); if (vector.length % 2 == 1) { return sorted[vector.length / 2]; return (sorted[vector.length / 2 - 1] + sorted[vector.length / 2]) / 2; |
double | normVector(List norm Vector double result = 0.0; for (Double aV1 : v1) { result = result + (aV1 * aV1); return Math.sqrt(result); |
Vector | removeDuplicateDomains(Vector s) remove Duplicate Domains int i = 0; int j = 0; boolean duplicates = false; String str1 = ""; String str2 = ""; Vector v = new Vector(); for (i = 0; i < s.size(); i++) { duplicates = false; ... |
Vector | removeDuplicates(Vector s) remove Duplicates int i = 0; int j = 0; boolean duplicates = false; Vector v = new Vector(); for (i = 0; i < s.size(); i++) { duplicates = false; for (j = (i + 1); j < s.size(); j++) { if (s.elementAt(i).toString().equalsIgnoreCase(s.elementAt(j).toString())) { ... |
void | shiftIndicies(List list, int[] indicies, int shiftVector) shift List elements left or right. if (indicies.length > 0) { Arrays.sort(indicies); int listSize = list.size(); if (shiftVector > 0) { while (shiftVector > 0) { shiftVector--; if (indicies[indicies.length - 1] == (listSize - 1)) break; ... |
float[] | vector(final float[] p2, final float[] p1) Creates the vector p2-(minus) p1. if (p2.length != p1.length) return null; final int len = p2.length; final float[] v = new float[len]; for (int i = 0; i < len; i++) { v[i] = p2[i] - p1[i]; return v; ... |
void | Vector2fMult(float[] a, float[] b, float[] dest) Vectorf Mult dest[X] = a[X] * b[X]; dest[Y] = a[Y] * b[Y]; |
void | Vector2fNegate(float[] a, float[] dest) Vectorf Negate dest[X] = -a[X]; dest[Y] = -a[Y]; |
float[] | Vector2fNew() Vectorf New return new float[] { 0, 0 }; |
void | Vector2fNormalize(float[] a, float[] dest) Vectorf Normalize float fLen = (float) Math.sqrt((a[X] * a[X] + a[Y] * a[Y])); if (fLen == 0) return; fLen = 1.0f / fLen; dest[X] = a[X] * fLen; dest[Y] = a[Y] * fLen; |