Examples of SVD


Examples of ch.akuhn.hapax.linalg.SVD

    public LatentSemanticIndex createIndex() {
        return this.createIndex(DEFAULT_DIMENSIONS);
    }

    public LatentSemanticIndex createIndex(int dimensions) {
        return new LatentSemanticIndex(terms, documents, new SVD(matrix, dimensions))
                .initializeGlobalWeightings(globalWeightings)
                .initializeDocumentLength(lengthArray.asIntArray());
    }
View Full Code Here

Examples of com.nr.la.SVD

   

    // Test SVD (not very deeply, however)
    System.out.println("Testing SVD");
    SVD svd = new SVD(a);
    double[][] x = new double[b.length][b[0].length];
    svd.solve(b,x);
    sbeps = 1.e-14;
    localflag = maxel(matsub(matmul(a,x),b)) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** SVD: Inconsistent solution vector");
     
    }

//    System.out.println("svd: rank = " << svd.rank() << "  nullity = " << svd.nullity() << endl;
    localflag = (svd.rank() != 50 || svd.nullity() != 0);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** SVD: Unexpected rank or nullity in original matrix");
     
    }

    for (i=0;i<N;i++) {       // Decrease the matrix rank
      a[3][i]=a[2][i]-a[1][i];
      a[4][i]=0.0;
    }
    SVD svd2 = new SVD(a);
//    System.out.println("svd: rank = " << svd2.rank() << "  nullity = " << svd2.nullity() << endl;
    localflag = (svd2.rank() != 48 || svd2.nullity() != 2);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** SVD: Unexpected rank or nullity in modified matrix");
     
    }
View Full Code Here

Examples of com.nr.la.SVD

          for (j=mm+1;j<ncof;j++) {
            power *= xs[i];
            u[i][j]=power;
          }
        }
        SVD svd = new SVD(u);
        svd.solve(bb,coff);
        devmax=sum=0.0;
        Ratfn rat = new Ratfn(coff,mm+1,kk+1);
        for (j=0;j<npt;j++) {
          ee[j]=rat.get(xs[j])-fs[j];
          wt[j]=abs(ee[j]);
View Full Code Here

Examples of com.nr.la.SVD

public class SVD_Ex {
 
  public static void main(String[] args) {
    double[] a =  { 1, 2, 3, 4, 5, 6, 7, 8,9 };
    double[][]m = NRUtil.buildMatrix(3, 3, a);
    SVD svd = new SVD(m);
    double b[] = { 3, 1, 2 };
    double[] x = new double[3];
    System.out.println(svd.inv_condition());
    System.out.println(svd.rank());
    System.out.println(svd.nullity());
   
    svd.solve(b, x);
    System.out.println(NRUtil.toString(x));
  }
View Full Code Here

Examples of com.nr.la.SVD

      else afunc=funcsmd.funk(row(xmd,i));   // Discussed in 15.4.4
      tmp=1.0/sig[i];
      for (j=0;j<ma;j++) aa[i][j]=afunc[j]*tmp;
      b[i]=y[i]*tmp;
    }
    SVD svd = new SVD(aa);   // Singular value decomposition
    thresh = (tol > 0. ? tol*svd.w[0] : -1.);
    svd.solve(b,a,thresh);    // Solve for the coefficients
    chisq=0.0;   // Evaluate chi-square
    for (i=0;i<ndat;i++) {
      sum=0.;
      for (j=0;j<ma;j++) sum += aa[i][j]*a[j];
      chisq += SQR(sum-b[i]);
View Full Code Here

Examples of no.uib.cipr.matrix.SVD

    /**
     * Returns true if the matrix is singular
     */
    public static boolean singular(Matrix A) throws NotConvergedException {
        SVD svd = SVD.factorize(A);
        double[] S = svd.getS();
        for (int i = 0; i < S.length; ++i)
            if (S[i] == 0)
                return true;
        return false;
    }
View Full Code Here

Examples of no.uib.cipr.matrix.SVD

    public void testStaticFactorize() throws NotConvergedException {
        assertEquals(A, SVD.factorize(A));
    }

    public void testFactor() throws NotConvergedException {
        SVD svd = new SVD(A.numRows(), A.numColumns());
        assertEquals(A, svd.factor(A.copy()));
    }
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.