You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by jm...@apache.org on 2021/05/26 21:58:21 UTC

[datasketches-vector] 02/02: FD cleanup -- bump oj algo version, fix a few tests missing fail(), and make more things final

This is an automated email from the ASF dual-hosted git repository.

jmalkin pushed a commit to branch fdrr
in repository https://gitbox.apache.org/repos/asf/datasketches-vector.git

commit 2b94bce8a71478927b3f01a703015b34a882e0bd
Author: Jon Malkin <jm...@users.noreply.github.com>
AuthorDate: Wed May 26 14:56:57 2021 -0700

    FD cleanup -- bump oj algo version, fix a few tests missing fail(), and make more things final
---
 pom.xml                                                      | 12 ++++++++++--
 .../vector/decomposition/FrequentDirections.java             |  2 +-
 .../vector/decomposition/MatrixOpsImplOjAlgo.java            |  2 +-
 .../apache/datasketches/vector/matrix/MatrixImplOjAlgo.java  |  2 +-
 .../vector/decomposition/FrequentDirectionsTest.java         |  5 +++++
 .../datasketches/vector/matrix/MatrixImplOjAlgoTest.java     |  1 -
 6 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/pom.xml b/pom.xml
index 047f7c5..cd7c287 100644
--- a/pom.xml
+++ b/pom.xml
@@ -85,8 +85,9 @@ under the License.
 
   <properties>
     <!-- UNIQUE FOR THIS JAVA COMPONENT -->
-    <ojalgo.version>48.0.0</ojalgo.version> 
-    <datasketches-memory.version>1.2.0-incubating</datasketches-memory.version>
+    <ojalgo.version>48.4.2</ojalgo.version>
+    <datasketches-memory.version>1.3.0</datasketches-memory.version>
+    <!--<commons-math3.version>3.6.1</commons-math3.version>-->
     <!-- END:UNIQUE FOR THIS JAVA COMPONENT -->
 
     <!-- Test -->
@@ -165,6 +166,13 @@ under the License.
       <artifactId>datasketches-memory</artifactId>
       <version>${datasketches-memory.version}</version>
     </dependency>
+    <!--
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-math3</artifactId>
+      <version>${commons-math3.version}</version>
+    </dependency>
+    -->
     <!-- END: UNIQUE FOR THIS JAVA COMPONENT -->
 
     <!-- Test Scope -->
diff --git a/src/main/java/org/apache/datasketches/vector/decomposition/FrequentDirections.java b/src/main/java/org/apache/datasketches/vector/decomposition/FrequentDirections.java
index c86b025..619e688 100644
--- a/src/main/java/org/apache/datasketches/vector/decomposition/FrequentDirections.java
+++ b/src/main/java/org/apache/datasketches/vector/decomposition/FrequentDirections.java
@@ -67,7 +67,7 @@ public final class FrequentDirections {
 
   private double svAdjustment_;
 
-  private Matrix B_;
+  private final Matrix B_;
 
   private SVDAlgo algo_ = DEFAULT_SVD_ALGO;
 
diff --git a/src/main/java/org/apache/datasketches/vector/decomposition/MatrixOpsImplOjAlgo.java b/src/main/java/org/apache/datasketches/vector/decomposition/MatrixOpsImplOjAlgo.java
index 39fd0d8..ed774fe 100644
--- a/src/main/java/org/apache/datasketches/vector/decomposition/MatrixOpsImplOjAlgo.java
+++ b/src/main/java/org/apache/datasketches/vector/decomposition/MatrixOpsImplOjAlgo.java
@@ -33,7 +33,7 @@ import org.apache.datasketches.vector.matrix.Matrix;
 import org.apache.datasketches.vector.matrix.MatrixType;
 
 class MatrixOpsImplOjAlgo extends MatrixOps {
-  private double[] sv_;
+  private final double[] sv_;
   private Primitive64Store Vt_;
 
   // work objects for SISVD
diff --git a/src/main/java/org/apache/datasketches/vector/matrix/MatrixImplOjAlgo.java b/src/main/java/org/apache/datasketches/vector/matrix/MatrixImplOjAlgo.java
index 577c7a0..3803353 100644
--- a/src/main/java/org/apache/datasketches/vector/matrix/MatrixImplOjAlgo.java
+++ b/src/main/java/org/apache/datasketches/vector/matrix/MatrixImplOjAlgo.java
@@ -39,7 +39,7 @@ import org.apache.datasketches.vector.MatrixFamily;
  * Implements the ojAlgo Matrix operations.
  */
 public final class MatrixImplOjAlgo extends Matrix {
-  private Primitive64Store mtx_;
+  private final Primitive64Store mtx_;
 
   private MatrixImplOjAlgo(final int numRows, final int numCols) {
     mtx_ = Primitive64Store.FACTORY.make(numRows, numCols);
diff --git a/src/test/java/org/apache/datasketches/vector/decomposition/FrequentDirectionsTest.java b/src/test/java/org/apache/datasketches/vector/decomposition/FrequentDirectionsTest.java
index e14e757..436c5f1 100644
--- a/src/test/java/org/apache/datasketches/vector/decomposition/FrequentDirectionsTest.java
+++ b/src/test/java/org/apache/datasketches/vector/decomposition/FrequentDirectionsTest.java
@@ -234,6 +234,7 @@ public class FrequentDirectionsTest {
 
     // with compensation
     m = fd.getResult(true);
+    assertNotNull(m);
     sv = fd.getSingularValues(true);
     for (int i = k; i > 1; --i) {
       final double val = Math.abs(m.getElement(k - i, i));
@@ -338,6 +339,7 @@ public class FrequentDirectionsTest {
     mem.putByte(PreambleUtil.SER_VER_BYTE, (byte) 0);
     try {
       FrequentDirections.heapify(mem);
+      fail();
     } catch (final IllegalArgumentException e) {
       // expected
     }
@@ -348,6 +350,7 @@ public class FrequentDirectionsTest {
     mem.putByte(PreambleUtil.FAMILY_BYTE, (byte) 0);
     try {
       FrequentDirections.heapify(mem);
+      fail();
     } catch (final IllegalArgumentException e) {
       // expected
     }
@@ -360,6 +363,7 @@ public class FrequentDirectionsTest {
     Memory mem = Memory.wrap(bytes);
     try {
       FrequentDirections.heapify(mem);
+      fail();
     } catch (final IllegalArgumentException e) {
       // expected
     }
@@ -371,6 +375,7 @@ public class FrequentDirectionsTest {
     mem = Memory.wrap(bytes);
     try {
       FrequentDirections.heapify(mem);
+      fail();
     } catch (final IllegalArgumentException e) {
       // expected
     }
diff --git a/src/test/java/org/apache/datasketches/vector/matrix/MatrixImplOjAlgoTest.java b/src/test/java/org/apache/datasketches/vector/matrix/MatrixImplOjAlgoTest.java
index f46d5f5..8a13328 100644
--- a/src/test/java/org/apache/datasketches/vector/matrix/MatrixImplOjAlgoTest.java
+++ b/src/test/java/org/apache/datasketches/vector/matrix/MatrixImplOjAlgoTest.java
@@ -28,7 +28,6 @@ import org.testng.annotations.Test;
 import org.apache.datasketches.memory.Memory;
 import org.apache.datasketches.memory.WritableMemory;
 
-@SuppressWarnings("javadoc")
 public class MatrixImplOjAlgoTest {
 
   @Test

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org