List of utility methods to do Square Calculate
byte[] | square2array(byte[][] square) squarearray int height = square.length; int width = square[0].length; byte[] ar = new byte[height * width]; int i = 0; for (int r = 0; r < height; r++) { for (int c = 0; c < width; c++) { ar[i] = square[r][c]; i++; ... |
byte | square2Index(long square) square Index long b = square ^ (square - 1); int fold = (int) (b ^ (b >>> 32)); return bitTable[(fold * 0x783a9b23) >>> 26]; |
double | squareArea(final double side) Calculates the area of a square. return rectangleArea(side, side);
|
int | squared(int x) squared return (int) Math.round(Math.pow(x, x)); |
double | squaredError(double[] vector1, double[] vector2) squared Error double squaredError = 0; for (int i = 0; i < vector1.length; i++) { squaredError += (vector1[i] - vector2[i]) * (vector1[i] - vector2[i]); return squaredError; |
double | squaredLoss(double[] x, double[] y, double w_0, double w_1) This will return the squared loss of the given points double sum = 0; for (int j = 0; j < x.length; j++) { sum += Math.pow((y[j] - (w_1 * x[j] + w_0)), 2); return sum; |
double | squaredNorm(final double[] vec) Returns the square of the euclidean norm of a vector. assert vec != null; double s = 0; for (double i : vec) { s += Math.pow(i, 2); return s; |
void | squareEntries(double[][] m) square Entries for (int i = 0; i < m.length; i++) for (int j = 0; j < m[i].length; j++) m[i][j] *= m[i][j]; |
double | squarenessRatio(final double w, final double h) squareness Ratio return Math.abs(1.0 - (w > h ? w / h : h / w));
|
long | squareOfSumFirstN(long n) square Of Sum First N long sumN = sumFirstN(n); return sumN * sumN; |