int lanczos_step(SMat A,int first,int last,double[][] wptr,double[] alf,double[] eta,double[] oldeta,double[] bet,int[] ll,boolean[] refEnough,double[] rnmp,double[] tolp,int n){
  double t;
  double[] mid;
  double rnm=rnmp[0];
  double tol=tolp[0];
  double anorm;
  int i, j;
  for (j=first; j < last; j++) {
    mid=wptr[2];
    wptr[2]=wptr[1];
    wptr[1]=mid;
    mid=wptr[3];
    wptr[3]=wptr[4];
    wptr[4]=mid;
    store(n,STORQ,j - 1,wptr[2]);
    if (j - 1 < MAXLL)     store(n,STORP,j - 1,wptr[4]);
    bet[j]=rnm;
    if (0 == bet[j]) {
      rnm=startv(A,wptr,j,n);
      if (0 != ierr)       return j;
      if (0 == rnm)       refEnough[0]=true;
    }
    if (refEnough[0]) {
      mid=wptr[2];
      wptr[2]=wptr[1];
      wptr[1]=mid;
      break;
    }
    t=1.0 / rnm;
    svd_datx(n,t,wptr[0],1,wptr[1],1);
    svd_dscal(n,t,wptr[3],1);
    svd_opb(A,wptr[3],wptr[0],OPBTemp);
    svd_daxpy(n,-rnm,wptr[2],1,wptr[0],1);
    alf[j]=svd_ddot(n,wptr[0],1,wptr[3],1);
    svd_daxpy(n,-alf[j],wptr[1],1,wptr[0],1);
    if (j <= MAXLL && (Math.abs(alf[j - 1]) > 4.0 * Math.abs(alf[j])))     ll[0]=j;
    for (i=0; i < svd_imin(ll[0],j - 1); i++) {
      store(n,RETRP,i,wptr[5]);
      t=svd_ddot(n,wptr[5],1,wptr[0],1);
      store(n,RETRQ,i,wptr[5]);
      svd_daxpy(n,-t,wptr[5],1,wptr[0],1);
      eta[i]=eps1;
      oldeta[i]=eps1;
    }
    t=svd_ddot(n,wptr[0],1,wptr[4],1);
    svd_daxpy(n,-t,wptr[2],1,wptr[0],1);
    if (bet[j] > 0.0)     bet[j]=bet[j] + t;
    t=svd_ddot(n,wptr[0],1,wptr[3],1);
    svd_daxpy(n,-t,wptr[1],1,wptr[0],1);
    alf[j]=alf[j] + t;
    svd_dcopy(n,wptr[0],1,wptr[4],1);
    rnm=Math.sqrt(svd_ddot(n,wptr[0],1,wptr[4],1));
    anorm=bet[j] + Math.abs(alf[j]) + rnm;
    tol=reps * anorm;
    ortbnd(alf,eta,oldeta,bet,j,rnm);
    double[] ref_rnm=new double[]{rnm};
    purge(n,ll[0],wptr[0],wptr[1],wptr[4],wptr[3],wptr[5],eta,oldeta,j,ref_rnm,tol);
    rnm=ref_rnm[0];
    if (rnm <= tol)     rnm=0.0;
  }
  rnmp[0]=rnm;
  tolp[0]=tol;
  return j;
}

int lanczos_step ( SMat A , int first , int last , double [ ] [ ] wptr , double [ ] alf , double [ ] eta , double [ ] oldeta , double [ ] bet , int [ ] ll , boolean [ ] refEnough , double [ ] rnmp , double [ ] tolp , int n ) { double t ; double [ ] mid ; double rnm = rnmp [ 0 ] ; double tol = tolp [ 0 ] ; double anorm ; int i , j ; for ( j = first ; j < last ; j ++ ) { mid = wptr [ 2 ] ; wptr [ 2 ] = wptr [ 1 ] ; wptr [ 1 ] = mid ; mid = wptr [ 3 ] ; wptr [ 3 ] = wptr [ 4 ] ; wptr [ 4 ] = mid ; store ( n , STORQ , j - 1 , wptr [ 2 ] ) ; if ( j - 1 < MAXLL ) store ( n , STORP , j - 1 , wptr [ 4 ] ) ; bet [ j ] = rnm ; if ( 0 == bet [ j ] ) { rnm = startv ( A , wptr , j , n ) ; if ( 0 != ierr ) return j ; if ( 0 == rnm ) refEnough [ 0 ] = true ; } if ( refEnough [ 0 ] ) { mid = wptr [ 2 ] ; wptr [ 2 ] = wptr [ 1 ] ; wptr [ 1 ] = mid ; break ; } t = 1.0 / rnm ; svd_datx ( n , t , wptr [ 0 ] , 1 , wptr [ 1 ] , 1 ) ; svd_dscal ( n , t , wptr [ 3 ] , 1 ) ; svd_opb ( A , wptr [ 3 ] , wptr [ 0 ] , OPBTemp ) ; svd_daxpy ( n , - rnm , wptr [ 2 ] , 1 , wptr [ 0 ] , 1 ) ; alf [ j ] = svd_ddot ( n , wptr [ 0 ] , 1 , wptr [ 3 ] , 1 ) ; svd_daxpy ( n , - alf [ j ] , wptr [ 1 ] , 1 , wptr [ 0 ] , 1 ) ; if ( j <= MAXLL && ( Math . abs ( alf [ j - 1 ] ) > 4.0 * Math . abs ( alf [ j ] ) ) ) ll [ 0 ] = j ; for ( i = 0 ; i < svd_imin ( ll [ 0 ] , j - 1 ) ; i ++ ) { store ( n , RETRP , i , wptr [ 5 ] ) ; t = svd_ddot ( n , wptr [ 5 ] , 1 , wptr [ 0 ] , 1 ) ; store ( n , RETRQ , i , wptr [ 5 ] ) ; svd_daxpy ( n , - t , wptr [ 5 ] , 1 , wptr [ 0 ] , 1 ) ; eta [ i ] = eps1 ; oldeta [ i ] = eps1 ; } t = svd_ddot ( n , wptr [ 0 ] , 1 , wptr [ 4 ] , 1 ) ; svd_daxpy ( n , - t , wptr [ 2 ] , 1 , wptr [ 0 ] , 1 ) ; if ( bet [ j ] > 0.0 ) bet [ j ] = bet [ j ] + t ; t = svd_ddot ( n , wptr [ 0 ] , 1 , wptr [ 3 ] , 1 ) ; svd_daxpy ( n , - t , wptr [ 1 ] , 1 , wptr [ 0 ] , 1 ) ; alf [ j ] = alf [ j ] + t ; svd_dcopy ( n , wptr [ 0 ] , 1 , wptr [ 4 ] , 1 ) ; rnm = Math . sqrt ( svd_ddot ( n , wptr [ 0 ] , 1 , wptr [ 4 ] , 1 ) ) ; anorm = bet [ j ] + Math . abs ( alf [ j ] ) + rnm ; tol = reps * anorm ; ortbnd ( alf , eta , oldeta , bet , j , rnm ) ; double [ ] ref_rnm = new double [ ] { rnm } ; purge ( n , ll [ 0 ] , wptr [ 0 ] , wptr [ 1 ] , wptr [ 4 ] , wptr [ 3 ] , wptr [ 5 ] , eta , oldeta , j , ref_rnm , tol ) ; rnm = ref_rnm [ 0 ] ; if ( rnm <= tol ) rnm = 0.0 ; } rnmp [ 0 ] = rnm ; tolp [ 0 ] = tol ; return j ; }
description - - - - - - - - - - - function embodies a single lanczos step arguments - - - - - - - - - ( input ) n dimension of the eigenproblem for matrix b first start of index through loop last end of index through loop wptr array of pointers pointing to work space alf array to hold diagonal of the tridiagonal matrix t eta orthogonality estimate of lanczos vectors at step j oldeta orthogonality estimate of lanczos vectors at step j - 1 bet array to hold off - diagonal of t ll number of intitial lanczos vectors in local orthog . ( has value of 0 , 1 or 2 ) enough stop flag functions used - - - - - - - - - - - - - - blas svd_ddot , svd_dscal , svd_daxpy , svd_datx , svd_dcopy user store las purge , ortbnd , startv utility svd_imin , svd_imax
