Here you can find the source of sumSq(float[][] arr)
Parameter | Description |
---|---|
arr | a parameter |
public static float sumSq(float[][] arr)
//package com.java2s; public class Main { /**//w w w . j av a 2 s .co m * Calculate the sum of the squared values of a 2D array. * * @param arr * @return sum of squares */ public static float sumSq(float[][] arr) { float sum = 0; for (int i = 0; i < arr.length; i++) sum += sumSq(arr[i]); return sum; } /** * Calculate the sum the squared values of a 1D array. * * @param arr * @return sum of squares */ public static float sumSq(float[] arr) { float sum = 0; for (int i = 0; i < arr.length; i++) sum += arr[i] * arr[i]; return sum; } }