Examples of plusEqualsSparse()


Examples of cc.mallet.types.HashedSparseVector.plusEqualsSparse()

  }
 
  public void testPlusEquals ()
  {
    HashedSparseVector s = (HashedSparseVector) s1.cloneMatrix ();
    s.plusEqualsSparse (s2, 2.0);
    checkAnswer (s, new double[] { 3, 5, 7, 6, 7 });

    HashedSparseVector s2p = new HashedSparseVector
                       (new int[] { 13 },
                        new double[] { 0.8 });
View Full Code Here

Examples of cc.mallet.types.HashedSparseVector.plusEqualsSparse()

                       new double[] { 0.2, 0.8, 1.2 });
    s.plusEqualsSparse (s4, 1.0);
    checkAnswer (s, new double[] { 3, 5, 7.2, 6.8, 8.2 })

    HashedSparseVector s5 = new HashedSparseVector (new int[] { 7 }, new double[] { 0.2 });
    s5.plusEqualsSparse (s1);
    for (int i = 0; i < s5.numLocations(); i++) {
      assertEquals (7, s5.indexAtLocation (i));
      assertEquals (3.2, s5.valueAtLocation (i), 0.0);
    }
View Full Code Here

Examples of cc.mallet.types.HashedSparseVector.plusEqualsSparse()

      assertEquals (7, s5.indexAtLocation (i));
      assertEquals (3.2, s5.valueAtLocation (i), 0.0);
    }

    HashedSparseVector s6 = new HashedSparseVector (new int[] { 7 }, new double[] { 0.2 });
    s6.plusEqualsSparse (s1, 3.5);
    for (int i = 0; i < s6.numLocations(); i++) {
      assertEquals (7, s6.indexAtLocation (i));
      assertEquals (10.7, s6.valueAtLocation (i), 0.0);
    }
  }
View Full Code Here

Examples of cc.mallet.types.HashedSparseVector.plusEqualsSparse()

  public void testPlusEqualsAfterClone ()
  {
    s1.indexVector ();
    HashedSparseVector s = (HashedSparseVector) s1.cloneMatrixZeroed ();
    s.plusEqualsSparse (s1);
    s.plusEqualsSparse (s2, 2.0);
    checkAnswer (s, new double[] { 3, 5, 7, 6, 7 });
  }

  public void testDotProduct () {
View Full Code Here

Examples of cc.mallet.types.HashedSparseVector.plusEqualsSparse()

  public void testPlusEqualsAfterClone ()
  {
    s1.indexVector ();
    HashedSparseVector s = (HashedSparseVector) s1.cloneMatrixZeroed ();
    s.plusEqualsSparse (s1);
    s.plusEqualsSparse (s2, 2.0);
    checkAnswer (s, new double[] { 3, 5, 7, 6, 7 });
  }

  public void testDotProduct () {
    HashedSparseVector t1 = new HashedSparseVector (new int[] { 7 }, new double[] { 0.2 });
View Full Code Here

Examples of cc.mallet.types.HashedSparseVector.plusEqualsSparse()

    assertEquals (9.0, binary2.dotProduct (s1), 0.0001);
    assertEquals (9.0, s1.dotProduct (binary2), 0.0001);

    HashedSparseVector dblVec = (HashedSparseVector) s1.cloneMatrix ();
    dblVec.plusEqualsSparse (binary1);
    checkAnswer (dblVec, new double[] { 2, 3, 4, 5, 6 });

    HashedSparseVector dblVec2 = (HashedSparseVector) s1.cloneMatrix ();
    dblVec2.plusEqualsSparse (binary2);
    checkAnswer (dblVec2, new double[] { 2, 2, 4, 4, 6 });
View Full Code Here

Examples of cc.mallet.types.HashedSparseVector.plusEqualsSparse()

    HashedSparseVector dblVec = (HashedSparseVector) s1.cloneMatrix ();
    dblVec.plusEqualsSparse (binary1);
    checkAnswer (dblVec, new double[] { 2, 3, 4, 5, 6 });

    HashedSparseVector dblVec2 = (HashedSparseVector) s1.cloneMatrix ();
    dblVec2.plusEqualsSparse (binary2);
    checkAnswer (dblVec2, new double[] { 2, 2, 4, 4, 6 });
  }

  public void testCloneMatrixZeroed ()
  {
View Full Code Here

Examples of cc.mallet.types.IndexedSparseVector.plusEqualsSparse()

  }

  public void testPlusEquals ()
  {
    IndexedSparseVector s = (IndexedSparseVector) s1.cloneMatrix ();
    s.plusEqualsSparse (s2, 2.0);
    checkAnswer (s, new double[] { 3, 5, 7, 6, 7 });

    IndexedSparseVector s2p = new IndexedSparseVector
                       (new int[] { 13 },
                        new double[] { 0.8 });
View Full Code Here

Examples of cc.mallet.types.IndexedSparseVector.plusEqualsSparse()

                       new double[] { 0.2, 0.8, 1.2 });
    s.plusEqualsSparse (s4, 1.0);
    checkAnswer (s, new double[] { 3, 5, 7.2, 6.8, 8.2 });

    IndexedSparseVector s5 = new IndexedSparseVector (new int[] { 7 }, new double[] { 0.2 });
    s5.plusEqualsSparse (s1);
    for (int i = 0; i < s5.numLocations(); i++) {
      assertEquals (7, s5.indexAtLocation (i));
      assertEquals (3.2, s5.valueAtLocation (i), 0.0);
    }
View Full Code Here

Examples of cc.mallet.types.IndexedSparseVector.plusEqualsSparse()

      assertEquals (7, s5.indexAtLocation (i));
      assertEquals (3.2, s5.valueAtLocation (i), 0.0);
    }

    IndexedSparseVector s6 = new IndexedSparseVector (new int[] { 7 }, new double[] { 0.2 });
    s6.plusEqualsSparse (s1, 3.5);
    for (int i = 0; i < s6.numLocations(); i++) {
      assertEquals (7, s6.indexAtLocation (i));
      assertEquals (10.7, s6.valueAtLocation (i), 0.0);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.