From c41092c7d45082cd1af7df9ad931d91d067809da Mon Sep 17 00:00:00 2001 From: THANH-PHONG HO Date: Wed, 28 Oct 2015 15:28:23 -0400 Subject: [PATCH] New Java 8 features added. --- src/main/java/org/jblas/FloatFunction.java | 3 ++- src/main/java/org/jblas/Geometry.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jblas/FloatFunction.java b/src/main/java/org/jblas/FloatFunction.java index 91f6a889..ac64559d 100644 --- a/src/main/java/org/jblas/FloatFunction.java +++ b/src/main/java/org/jblas/FloatFunction.java @@ -39,7 +39,8 @@ /** * Represents a function on floats. */ -public interface FloatFunction { +public interface FloatFunction +{ /** Compute the function. */ public float compute(float x); } \ No newline at end of file diff --git a/src/main/java/org/jblas/Geometry.java b/src/main/java/org/jblas/Geometry.java index ed68408b..7bdf91d7 100644 --- a/src/main/java/org/jblas/Geometry.java +++ b/src/main/java/org/jblas/Geometry.java @@ -74,7 +74,7 @@ public static DoubleMatrix center(DoubleMatrix x) { /** Center the rows of a matrix (in-place). */ public static DoubleMatrix centerRows(DoubleMatrix x) { DoubleMatrix temp = new DoubleMatrix(x.columns); - for (int r = 0; r < x.rows; r++) + for (r: x.rows) x.putRow(r, center(x.getRow(r, temp))); return x; } @@ -82,7 +82,7 @@ public static DoubleMatrix centerRows(DoubleMatrix x) { /** Center the columns of a matrix (in-place). */ public static DoubleMatrix centerColumns(DoubleMatrix x) { DoubleMatrix temp = new DoubleMatrix(x.rows); - for (int c = 0; c < x.columns; c++) + for (c : x.columns) x.putColumn(c, center(x.getColumn(c, temp))); return x; }