Examples of norm()


Examples of no.uib.cipr.matrix.Matrix.norm()

                Matrix B = Matrices.random(A.numRows(), A.numColumns());
                Matrix X = Matrices.random(A.numRows(), A.numColumns());
                X = A.transSolve(B, X);

                Matrix Y = A.transAmultAdd(X, X.copy().set(-1, B));
                assertEquals(0, Y.norm(Matrix.Norm.Frobenius), tol);
                assertEquals(Ad, A);
                return;
            } catch (MatrixSingularException e) {
                Utilities.addDiagonal(A, Ad, 1);
            } catch (MatrixNotSPDException e) {
View Full Code Here

Examples of no.uib.cipr.matrix.Vector.norm()

                Vector b = Matrices.random(A.numRows());
                Vector x = Matrices.random(A.numRows());
                x = A.solve(b, x);

                Vector y = A.multAdd(-1, x, x.copy().set(b));
                assertEquals(0, y.norm(Vector.Norm.Two), tol);
                assertEquals(Ad, A);
                return;
            } catch (MatrixSingularException e) {
                Utilities.addDiagonal(A, Ad, 1);
            } catch (MatrixNotSPDException e) {
View Full Code Here

Examples of no.uib.cipr.matrix.Vector.norm()

                Vector b = Matrices.random(A.numRows());
                Vector x = Matrices.random(A.numRows());
                x = A.transSolve(b, x);

                Vector y = A.transMultAdd(-1, x, x.copy().set(b));
                assertEquals(0, y.norm(Vector.Norm.Two), tol);
                assertEquals(Ad, A);
                return;
            } catch (MatrixSingularException e) {
                Utilities.addDiagonal(A, Ad, 1);
            } catch (MatrixNotSPDException e) {
View Full Code Here

Examples of no.uib.cipr.matrix.Vector.norm()

        ilut.setMatrix(A);
        ilut.apply(b, x);

        Vector r = A.multAdd(-1, x, b.copy());

        assertEquals(0, r.norm(Vector.Norm.TwoRobust), 1e-5);
    }

}
View Full Code Here

Examples of org.apache.mahout.math.DenseVector.norm()

          if (previousEigen == null) {
            previousEigen = currentEigen.clone();
          } else {
            double dot = currentEigen.dot(previousEigen);
            if (dot > 0) {
              dot /= (currentEigen.norm(2) * previousEigen.norm(2));
            }
           // log.info("Current pass * previous pass = {}", dot);
          }
        }
      }
View Full Code Here

Examples of org.apache.mahout.math.DenseVector.norm()

      }
      // converged!
      double eigenValue = state.getStatusProgress().get(state.getStatusProgress().size() - 1).getEigenValue();
      // it's actually more efficient to do this to normalize than to call currentEigen = currentEigen.normalize(),
      // because the latter does a clone, which isn't necessary here.
      currentEigen.assign(new TimesFunction(), 1 / currentEigen.norm(2));
      eigens.assignRow(i, currentEigen);
      eigenValues.add(eigenValue);
      state.setCurrentEigenValues(eigenValues);
      log.info("Found eigenvector {}, eigenvalue: {}", i, eigenValue);
View Full Code Here

Examples of org.apache.mahout.math.DenseVector.norm()

    FeatureVectorEncoder enc = new ContinuousValueEncoder("foo");
    Vector v1 = new DenseVector(20);
    enc.addToVector("-123", v1);
    assertEquals(-123, v1.minValue(), 0);
    assertEquals(0, v1.maxValue(), 0);
    assertEquals(123, v1.norm(1), 0);

    v1 = new DenseVector(20);
    enc.addToVector("123", v1);
    assertEquals(123, v1.maxValue(), 0);
    assertEquals(0, v1.minValue(), 0);
View Full Code Here

Examples of org.apache.mahout.math.DenseVector.norm()

    v1 = new DenseVector(20);
    enc.addToVector("123", v1);
    assertEquals(123, v1.maxValue(), 0);
    assertEquals(0, v1.minValue(), 0);
    assertEquals(123, v1.norm(1), 0);

    Vector v2 = new DenseVector(20);
    enc.setProbes(2);
    enc.addToVector("123", v2);
    assertEquals(123, v2.maxValue(), 0);
View Full Code Here

Examples of org.apache.mahout.math.DenseVector.norm()

    Vector v2 = new DenseVector(20);
    enc.setProbes(2);
    enc.addToVector("123", v2);
    assertEquals(123, v2.maxValue(), 0);
    assertEquals(2 * 123, v2.norm(1), 0);

    v1 = v2.minus(v1);
    assertEquals(123, v1.maxValue(), 0);
    assertEquals(123, v1.norm(1), 0);

View Full Code Here

Examples of org.apache.mahout.math.DenseVector.norm()

    TextValueEncoder enc = new TextValueEncoder("text");
    Vector v1 = new DenseVector(200);
    enc.addToVector("test1 and more", v1);
    enc.flush(1, v1);
    // should set 6 distinct locations to 1
    assertEquals(6.0, v1.norm(1), 0);
    assertEquals(1.0, v1.maxValue(), 0);

    // now some fancy weighting
    StaticWordValueEncoder w = new StaticWordValueEncoder("text");
    w.setDictionary(ImmutableMap.<String, Double>of("word1", 3.0, "word2", 1.5));
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.