Package org.netlib.util

Examples of org.netlib.util.intW


            throw new IllegalArgumentException("L == null");

        /*
         * Calculate factorisation, and extract the triangular factor
         */
        intW info = new intW(0);
        LAPACK.getInstance().dgelqf(m, n, A.getData(), Matrices.ld(m), tau, work,
                work.length, info);

        if (info.val < 0)
            throw new IllegalArgumentException();
View Full Code Here


        double[] Xd = ((DenseMatrix) X).getData();

        X.set(B);

        intW info = new intW(0);
        LAPACK.getInstance().dtptrs(uplo.netlib(), trans.netlib(), diag.netlib(), numRows,
                X.numColumns(), data, Xd, Matrices.ld(numRows), info);

        if (info.val > 0)
            throw new MatrixSingularException();
View Full Code Here

    ARPACK arpack = ARPACK.getInstance();
    /*
     * Setting up parameters for DSAUPD call.
     *
     */
    intW ido = new intW(0); // must start zero
    String bmat = "I"; // standard problem
    doubleW tol = new doubleW(0); // uses machine precision
    intW info = new intW(0); // request random starting vector
    double[] resid = new double[n]; // allocate starting vector
    /*
     * NVC is the largest number of basis vectors that will
     * be used in the Implicitly Restarted Arnoldi Process.
     * Work per major iteration is proportional to N*NCV*NCV. 
     *
     */
    int ncv = Math.min(nev * 4, n); // rule of thumb use twice nev
    double[] v = new double[n * ncv];
    double[] workd = new double[3*n];
    double[] workl = new double[ncv*(ncv+8)];
    // Parameters
    int[] iparam = new int[11];
    {
      int ishfts = 1; // use the exact shift strategy
      int maxitr = 300; // max number of Arnoldi iterations
      int mode = 1; // use "mode 1"
      iparam[1-1] = ishfts;
      iparam[3-1] = maxitr;
      iparam[7-1] = mode;
    }
    int[] ipntr = new int[11];
    // debug setting
    org.netlib.arpack.arpack_debug.ndigit.val = -3;
    org.netlib.arpack.arpack_debug.logfil.val = 6;
    org.netlib.arpack.arpack_debug.msgets.val = 0;
    org.netlib.arpack.arpack_debug.msaitr.val = 0;
    org.netlib.arpack.arpack_debug.msapps.val = 0;
    org.netlib.arpack.arpack_debug.msaupd.val = 0;
    org.netlib.arpack.arpack_debug.msaup2.val = 0;
    org.netlib.arpack.arpack_debug.mseigt.val = 0;
    org.netlib.arpack.arpack_debug.mseupd.val = 0;
    /*
     * Main loop (reverse communication loop)
     *
     * Repeatedly calls the routine DSAUPD and takes
     * actions indicated by parameter IDO until either
     * convergence is indicated or maxitr has been
     * exceeded.
     *
     */
    assert n > 0;
    assert nev > 0;
    assert ncv > nev && ncv <= n;
    while (true) {
      arpack.dsaupd(
          ido, // reverse communication parameter
          bmat, // "I" = standard problem
          n, // problem size
          which.name(), // which values are requested?
          nev, // who many values?
          tol, // 0 = use machine precision
          resid,
          ncv,
          v,
          n,
          iparam,
          ipntr,
          workd,
          workl,
          workl.length,
          info );
      if (!(ido.val == 1 || ido.val == -1)) break;
      /* Perform matrix vector multiplication
       *
       *    y <--- OP*x
       *
       * The user should supply his own matrix-
       * vector multiplication routine here that
       * takes workd(ipntr(1)) as the input, and
       * return the result to workd(ipntr(2)).  
       *
       */
      int x0 = ipntr[1-1]-1; // Fortran is off-by-one compared to Java!
      int y0 = ipntr[2-1]-1;
      Vector x = Vector.copy(workd, x0, n);
      Vector y = this.callback(x);
      assert y.size() == n;
      y.storeOn(workd, y0);  
    }
    /*
     * Either we have convergence or there is an error.
     *  
     */
    if (info.val != 0) throw new Error("dsaupd ERRNO = "+info.val
        +", see http://www.caam.rice.edu/software/ARPACK/UG/node136.html");
    /*
     * Post-Process using DSEUPD.
     *
     * Computed eigenvalues may be extracted.
     *
     * The routine DSEUPD now called to do this
     * post processing (other modes may require
     * more complicated post processing than
     * "mode 1").
     *
     */
    boolean rvec = true; // request vectors
    boolean[] select = new boolean[ncv];
    double[] d = new double[ncv * 2];
    double sigma = 0; // not used in "mode 1"
    intW ierr = new intW(0);
    intW nevW = new intW(nev);
    arpack.dseupd(
        rvec,
        "All",
        select,
        d,
View Full Code Here

  @Override
  public AllEigenvalues run() {
    double[] wr = new double[n];
    double[] wi = new double[n];
    intW info = new intW(0);
    double[] a = A.asColumnMajorArray();
    double[] vl = new double[l ? n * n : 0];
    double[] vr = new double[r ? n * n : 0];
    double[] work = allocateWorkspace();
    lapack.dgeev(
View Full Code Here

   *
   */
  private double[] allocateWorkspace() {
    int lwork = ((l || r) ? 4 : 3) * n;
        double[] query = new double[1];
        intW info = new intW(0);
        lapack.dgeev(
        jobv(l),
        jobv(r),
        n,
        null,
View Full Code Here

        else
            Vr = null;

        // Find the needed workspace
        double[] worksize = new double[1];
        intW info = new intW(0);
        LAPACK.getInstance().dgeev(jobLeft.netlib(), jobRight.netlib(), n, new double[0],
                Matrices.ld(n), new double[0], new double[0], new double[0], Matrices.ld(n),
                new double[0], Matrices.ld(n), worksize, -1, info);

        // Allocate workspace
View Full Code Here

        if (!A.isSquare())
            throw new IllegalArgumentException("!A.isSquare()");
        else if (A.numRows() != n)
            throw new IllegalArgumentException("A.numRows() != n");

        intW info = new intW(0);
        LAPACK.getInstance().dgeev(jobLeft.netlib(), jobRight.netlib(), n, A.getData(),
                Matrices.ld(n), Wr, Wi, jobLeft == JobEig.All ? Vl.getData() : new double[0],
                Matrices.ld(n), jobRight == JobEig.All ? Vr.getData() : new double[0], Matrices.ld(n),
                work, work.length, info);
View Full Code Here

        // Allocate factorization matrix. The factorization matrix will be
        // large enough to accomodate any pivots
        BandMatrix Af = new BandMatrix(this, kl, ku + kl);
        int[] ipiv = new int[numRows];

        intW info = new intW(0);
        LAPACK.getInstance().dgbsv(numRows, kl, ku, X.numColumns(),
                Af.getData(), Matrices.ld(2 * kl + ku + 1), ipiv, Xd, Matrices.ld(numRows), info);

        if (info.val > 0)
            throw new MatrixSingularException();
View Full Code Here

        if (n != A.numRows())
            throw new IllegalArgumentException("n != A.numRows()");

        notspd = false;

        intW info = new intW(0);
        if (upper)
            LAPACK.getInstance().dpotrf(UpLo.Upper.netlib(), A.numRows(),
                    A.getData(), Matrices.ld(A.numRows()), info);
        else
            LAPACK.getInstance().dpotrf(UpLo.Lower.netlib(), A.numRows(),
View Full Code Here

        if (notspd)
            throw new MatrixNotSPDException();
        if (n != B.numRows())
            throw new IllegalArgumentException("n != B.numRows()");

        intW info = new intW(0);
        if (upper)
            LAPACK.getInstance().dpotrs(UpLo.Upper.netlib(), Cu.numRows(),
                    B.numColumns(), Cu.getData(), Matrices.ld(Cu.numRows()),
                    B.getData(), Matrices.ld(Cu.numRows()), info);
        else
View Full Code Here

TOP

Related Classes of org.netlib.util.intW

Copyright © 2018 www.massapicom. 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.