Here you can find the source of normalize(double[][] matrix, double lower, double upper)
public static double[][] normalize(double[][] matrix, double lower, double upper)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; public class Main { public static double[][] normalize(double[][] matrix, double lower, double upper) { double[][] normalized = new double[matrix.length][]; for (int row = 0; row < matrix.length; row++) { //Feed each row to the overloaded method normalized[row] = normalize(matrix[row], lower, upper); }//from ww w.j ava2 s .c o m return normalized; } public static double[] normalize(double[] vector, double lower, double upper) { double[] normalized = new double[vector.length]; double max = Arrays.stream(vector).max().getAsDouble(); double min = Arrays.stream(vector).min().getAsDouble(); for (int i = 0; i < normalized.length; i++) { normalized[i] = (vector[i] - min) * (upper - lower) / (max - min) + lower; } return normalized; } }