mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gsing...@apache.org
Subject svn commit: r802427 - in /lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix: DenseVector.java SparseVector.java
Date Sat, 08 Aug 2009 17:53:58 GMT
Author: gsingers
Date: Sat Aug  8 17:53:58 2009
New Revision: 802427

URL: http://svn.apache.org/viewvc?rev=802427&view=rev
Log:
MAHOUT-121: properly init the lengthSquared and some small reformats

Modified:
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/DenseVector.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/SparseVector.java

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/DenseVector.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/DenseVector.java?rev=802427&r1=802426&r2=802427&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/DenseVector.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/DenseVector.java Sat Aug
 8 17:53:58 2009
@@ -27,6 +27,7 @@
 public class DenseVector extends AbstractVector {
 
   private double[] values;
+  private double lengthSquared = -1.0;
 
   /** For serialization purposes only */
   public DenseVector() {
@@ -293,11 +294,11 @@
     return result;
   }
 
-  private Double lengthSquared = null;
+
 
   @Override
   public double getLengthSquared() {
-    if (lengthSquared != null) {
+    if (lengthSquared < 0.0) {
       return lengthSquared;
     }
 

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/SparseVector.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/SparseVector.java?rev=802427&r1=802426&r2=802427&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/SparseVector.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/SparseVector.java Sat
Aug  8 17:53:58 2009
@@ -29,6 +29,7 @@
   private OrderedIntDoubleMapping values;
 
   private int cardinality;
+  private double lengthSquared = -1.0;
 
   /** For serialization purposes only. */
   public SparseVector() {
@@ -289,7 +290,7 @@
     this.values = values;
   }
 
-  private double lengthSquared;
+
 
   @Override
   public double getLengthSquared() {



Mime
View raw message