mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gsing...@apache.org
Subject svn commit: r802476 - in /lucene/mahout/trunk/core/src: main/java/org/apache/mahout/matrix/DenseVector.java main/java/org/apache/mahout/matrix/SparseVector.java test/java/org/apache/mahout/matrix/TestDenseVector.java
Date Sun, 09 Aug 2009 02:36:02 GMT
Author: gsingers
Date: Sun Aug  9 02:36:01 2009
New Revision: 802476

URL: http://svn.apache.org/viewvc?rev=802476&view=rev
Log:
MAHOUT-121: fix lengthSquared calcs

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
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/matrix/TestDenseVector.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=802476&r1=802475&r2=802476&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 Sun Aug
 9 02:36:01 2009
@@ -298,7 +298,7 @@
 
   @Override
   public double getLengthSquared() {
-    if (lengthSquared < 0.0) {
+    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=802476&r1=802475&r2=802476&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 Sun
Aug  9 02:36:01 2009
@@ -294,7 +294,7 @@
 
   @Override
   public double getLengthSquared() {
-    if (lengthSquared < 0.0) {
+    if (lengthSquared >= 0.0) {
       return lengthSquared;
     }
     double result = 0.0;

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/matrix/TestDenseVector.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/matrix/TestDenseVector.java?rev=802476&r1=802475&r2=802476&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/matrix/TestDenseVector.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/matrix/TestDenseVector.java Sun
Aug  9 02:36:01 2009
@@ -35,10 +35,8 @@
 
   public void testAsFormatString() {
     String formatString = test.asFormatString();
-    assertEquals(
-        "format",
-        "{\"class\":\"org.apache.mahout.matrix.DenseVector\",\"vector\":\"{\\\"values\\\":[1.1,2.2,3.3]}\"}",
-        formatString);
+    Vector vec = AbstractVector.decodeVector(formatString);
+    assertEquals(vec, test);
   }
 
   public void testCardinality() {



Mime
View raw message