Beispiel #1
0
// Compute all of the eigenpairs with eigenvalues indices in 
// [lowerBound,upperBound]
Info Eig
( int n, double* d, double* e, double* w, double* Z, int ldz, mpi::Comm comm, 
  int lowerBound, int upperBound )
{
    DEBUG_ONLY(CallStackEntry cse("herm_tridiag_eig::Eig"))
    Info info;
    ++lowerBound;
    ++upperBound;
    char jobz='V';
    char range='I';
    double vl, vu;
    int highAccuracy=0; 
    int nz, offset;
    std::vector<int> ZSupport(2*n);
    int retval = pmrrr
    ( &jobz, &range, &n, d, e, &vl, &vu, &lowerBound, &upperBound, 
      &highAccuracy, comm, &nz, &offset, w, Z, &ldz, ZSupport.data() );
    if( retval != 0 )
        RuntimeError("pmrrr returned ",retval);

    info.numLocalEigenvalues=nz;
    info.firstLocalEigenvalue=offset;
    info.numGlobalEigenvalues=(upperBound-lowerBound)+1;
    return info;
}
Beispiel #2
0
// Compute all of the eigenvalues
Info Eig( int n, double* d, double* e, double* w, mpi::Comm comm )
{
    DEBUG_ONLY(CallStackEntry cse("herm_tridiag_eig::Eig"))
    Info info;
    char jobz='N';
    char range='A';
    double vl, vu;
    int il, iu;
    int highAccuracy=0; 
    int nz, offset;
    int ldz=1;
    std::vector<int> ZSupport(2*n);
    int retval = pmrrr
    ( &jobz, &range, &n, d, e, &vl, &vu, &il, &iu, &highAccuracy, comm,
      &nz, &offset, w, 0, &ldz, ZSupport.data() );
    if( retval != 0 )
        RuntimeError("pmrrr returned ",retval);

    info.numLocalEigenvalues=nz;
    info.firstLocalEigenvalue=offset;
    info.numGlobalEigenvalues=n;
    return info;
}
Beispiel #3
0
// Return upper bounds on the number of (local) eigenvalues in the given range,
// (lowerBound,upperBound]
Estimate EigEstimate
( int n, double* d, double* e, double* w, mpi::Comm comm, 
  double lowerBound, double upperBound )
{
    DEBUG_ONLY(CallStackEntry cse("herm_tridiag_eig::EigEstimate"))
    Estimate estimate;
    char jobz='C';
    char range='V';
    int il, iu;
    int highAccuracy=0;
    int nz, offset;
    int ldz=1;
    std::vector<int> ZSupport(2*n);
    int retval = pmrrr
    ( &jobz, &range, &n, d, e, &lowerBound, &upperBound, &il, &iu, 
      &highAccuracy, comm, &nz, &offset, w, 0, &ldz, ZSupport.data() );
    if( retval != 0 )
        RuntimeError("pmrrr returned ",retval);

    estimate.numLocalEigenvalues = nz;
    estimate.numGlobalEigenvalues = mpi::AllReduce( nz, comm );
    return estimate;
}
Beispiel #4
0
// Compute all of the eigenpairs with eigenvalues in (lowerBound,upperBound]
Info Eig
( int n, double* d, double* e, double* w, double* Z, int ldz, mpi::Comm comm, 
  double lowerBound, double upperBound )
{
    DEBUG_ONLY(CSE cse("herm_tridiag_eig::Eig"))
    Info info;
    char jobz='V';
    char range='V';
    int il, iu;
    int highAccuracy=0; 
    int nz, offset;
    vector<int> ZSupport(2*n);
    int retval = pmrrr
    ( &jobz, &range, &n, d, e, &lowerBound, &upperBound, &il, &iu, 
      &highAccuracy, comm.comm, &nz, &offset, w, Z, &ldz, ZSupport.data() );
    if( retval != 0 )
        RuntimeError("pmrrr returned ",retval);

    info.numLocalEigenvalues=nz;
    info.firstLocalEigenvalue=offset;
    mpi::AllReduce( &nz, &info.numGlobalEigenvalues, 1, mpi::SUM, comm );
    return info;
}