@Test public void addToFirstScaledTest() { float[] da1 = {1, 2, 0, -1, -30}; float[] da2 = {-0.5f, -1, 0, 0.5f, 15}; FloatArrays.addToFirstScaled(da1, da2, 2); Assert.assertEquals(FloatArrays.max(da1), 0f, 0.0001); Assert.assertEquals(FloatArrays.min(da1), 0f, 0.0001); }
public static void addToFirstScaled(float[] first, float[] second, float scale) { validateArrays(first, second); for (int i = 0; i < first.length; i++) { first[i] = first[i] + second[i] * scale; } }
FloatArrays { public static void addToFirstScaled(float[] first, float[] second, float scale) { validateArrays(first, second); for (int i = 0; i < first.length; i++) { first[i] = first[i] + second[i] * scale; } } }
FloatArrays { public static void addToFirstScaled(float[] first, float[] second, float scale) { validateArrays(first, second); for (int i = 0; i < first.length; i++) { first[i] = first[i] + second[i] * scale; } } private  FloatArrays(); }
FloatArrays { public static void addToFirstScaled(float[] first, float[] second, float scale) { validateArrays(first, second); for (int i = 0; i < first.length; i++) { first[i] = first[i] + second[i] * scale; } } private  FloatArrays(); static boolean inRange(float d1, float d2, float range); static float[] reverse(float[] input); static float[] convert(int[] input); static float[][] convert(int[][] input); static float[] convert(double[] input); static boolean arrayEqualsInRange(float[] d1, float[] d2, float range); static boolean arrayEquals(float[] d1, float[] d2); static float[] appendZeros(float[] darray, int zeroAmountToAppend); static float[] normalize16bitLittleEndian(byte[] bytez); static float[] normalize16bitLittleEndian(byte[] bytez, int amount); static byte[] denormalize16BitLittleEndian(float[] input); static int[] toUnsignedInteger(float[] input, int max); static int[] toInteger(float[] input, int min, int max); static float max(float... input); static void trimValues(float[] input, float minVal, float maxVal); static float absMax(float... input); static String format(float... input); static String format(int fractionDigits, float... input); static String format(int fractionDigits, String delimiter, float... input); static String format(int rightPad, int fractionDigits, String delimiter, float... input); static float min(float... input); static float absMin(float... input); static void validateArray(float... input); static int maxIndex(float... input); static int minIndex(float... input); static float sum(float... input); static float[] sum(float[] a1, float[] a2); static void addToFirst(float[] first, float[] second); static void addToAll(float[] data, float valueToAdd); static void addToFirstScaled(float[] first, float[] second, float scale); static float[] square(float... input); static void squareInPlace(float... input); static float[] subtract(float[] a1, float[] a2); static void subtractFromFirst(float[] first, float[] second); static float[] multiply(float[] a1, float[] a2); static float dotProduct(float[] a1, float[] a2); static void multiplyToFirst(float[] first, float[] second); static float[] scale(float[] a1, float b); static void scaleInPlace(float[] a1, float b); static float mean(float... input); static float absoluteSumOfDifferences(float[] a, float[] b); static float[] absoluteDifference(float[] a, float[] b); static void validateArrays(float[] a1, float[] a2); static float squaredSum(float[] array); static float squaredSumOfDifferences(float[] a, float[] b); static float variance(float[] input); static float standardDeviation(float[] a); static boolean containsNaN(float[] a); static boolean containsNanOrInfinite(float[] a); static void floorInPlace(float[] var, float minValue); static void nonZeroFloorInPlace(float[] data, float floor); static void normalizeInPlace(float[] data); static float[] fromString(String str, String delimiter); static void serialize(DataOutputStream dos, float[] data); static void serializeRaw(DataOutputStream dos, float[] data); static void serialize(DataOutputStream dos, float[][] data); static void serializeRaw(DataOutputStream dos, float[][] data); static float[] deserialize(DataInputStream dis); static float[] deserializeRaw(DataInputStream dis, int amount); static void deserializeRaw(DataInputStream dis, float[] result); static float[][] deserialize2d(DataInputStream dis); static void deserialize2DRaw(DataInputStream dis, float[][] result); static float[][] clone2D(float[][] result); static float[] to1D(float[][] matrix); static float[][] toMatrix(float[] vector, int dimension); static float[][] loadFromText(File input); }
FloatArrays { public static void addToFirstScaled(float[] first, float[] second, float scale) { validateArrays(first, second); for (int i = 0; i < first.length; i++) { first[i] = first[i] + second[i] * scale; } } private  FloatArrays(); static boolean inRange(float d1, float d2, float range); static float[] reverse(float[] input); static float[] convert(int[] input); static float[][] convert(int[][] input); static float[] convert(double[] input); static boolean arrayEqualsInRange(float[] d1, float[] d2, float range); static boolean arrayEquals(float[] d1, float[] d2); static float[] appendZeros(float[] darray, int zeroAmountToAppend); static float[] normalize16bitLittleEndian(byte[] bytez); static float[] normalize16bitLittleEndian(byte[] bytez, int amount); static byte[] denormalize16BitLittleEndian(float[] input); static int[] toUnsignedInteger(float[] input, int max); static int[] toInteger(float[] input, int min, int max); static float max(float... input); static void trimValues(float[] input, float minVal, float maxVal); static float absMax(float... input); static String format(float... input); static String format(int fractionDigits, float... input); static String format(int fractionDigits, String delimiter, float... input); static String format(int rightPad, int fractionDigits, String delimiter, float... input); static float min(float... input); static float absMin(float... input); static void validateArray(float... input); static int maxIndex(float... input); static int minIndex(float... input); static float sum(float... input); static float[] sum(float[] a1, float[] a2); static void addToFirst(float[] first, float[] second); static void addToAll(float[] data, float valueToAdd); static void addToFirstScaled(float[] first, float[] second, float scale); static float[] square(float... input); static void squareInPlace(float... input); static float[] subtract(float[] a1, float[] a2); static void subtractFromFirst(float[] first, float[] second); static float[] multiply(float[] a1, float[] a2); static float dotProduct(float[] a1, float[] a2); static void multiplyToFirst(float[] first, float[] second); static float[] scale(float[] a1, float b); static void scaleInPlace(float[] a1, float b); static float mean(float... input); static float absoluteSumOfDifferences(float[] a, float[] b); static float[] absoluteDifference(float[] a, float[] b); static void validateArrays(float[] a1, float[] a2); static float squaredSum(float[] array); static float squaredSumOfDifferences(float[] a, float[] b); static float variance(float[] input); static float standardDeviation(float[] a); static boolean containsNaN(float[] a); static boolean containsNanOrInfinite(float[] a); static void floorInPlace(float[] var, float minValue); static void nonZeroFloorInPlace(float[] data, float floor); static void normalizeInPlace(float[] data); static float[] fromString(String str, String delimiter); static void serialize(DataOutputStream dos, float[] data); static void serializeRaw(DataOutputStream dos, float[] data); static void serialize(DataOutputStream dos, float[][] data); static void serializeRaw(DataOutputStream dos, float[][] data); static float[] deserialize(DataInputStream dis); static float[] deserializeRaw(DataInputStream dis, int amount); static void deserializeRaw(DataInputStream dis, float[] result); static float[][] deserialize2d(DataInputStream dis); static void deserialize2DRaw(DataInputStream dis, float[][] result); static float[][] clone2D(float[][] result); static float[] to1D(float[][] matrix); static float[][] toMatrix(float[] vector, int dimension); static float[][] loadFromText(File input); static final float[] ZERO_LENGTH_ARRAY; static final float[][] ZERO_LENGTH_MATRIX; static final Pattern FEATURE_LINES_PATTERN; }