Ejemplo n.º 1
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 )
{
#ifndef RELEASE
    PushCallStack("pmrrr::EigEstimate");
#endif
    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[0] );
    if( retval != 0 )
    {
        std::ostringstream msg;
        msg << "PMRRR returned " << retval; 
        throw std::runtime_error( msg.str().c_str() );
    }

    Estimate estimate;
    estimate.numLocalEigenvalues = nz;
    mpi::AllReduce( &nz, &estimate.numGlobalEigenvalues, 1, mpi::SUM, comm );
#ifndef RELEASE
    PopCallStack();
#endif
    return estimate;
}
Ejemplo n.º 2
0
// Compute all of the eigenvalues
Info Eig( int n, double* d, double* e, double* w, mpi::Comm comm )
{
#ifndef RELEASE
    PushCallStack("pmrrr::Eig");
#endif
    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[0] );
    if( retval != 0 )
    {
        std::ostringstream msg;        
        msg << "PMRRR returned " << retval;
        throw std::runtime_error( msg.str().c_str() );
    }

    Info info;
    info.numLocalEigenvalues=nz;
    info.firstLocalEigenvalue=offset;
    info.numGlobalEigenvalues=n;

#ifndef RELEASE
    PopCallStack();
#endif
    return info;
}
Ejemplo n.º 3
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;
}
Ejemplo n.º 4
0
// Compute all of the eigenpairs with eigenvalues indices in 
// [lowerBound,upperBound]
Info Eig
( int n, const double* d, const double* e, double* w, double* Z, int ldz, 
  mpi::Comm comm, int lowerBound, int upperBound )
{
#ifndef RELEASE
    PushCallStack("pmrrr::Eig");
#endif
    ++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[0] );
    if( retval != 0 )
    {
        std::ostringstream msg;        
        msg << "PMRRR returned " << retval;
        throw std::runtime_error( msg.str().c_str() );
    }

    Info info;
    info.numLocalEigenvalues=nz;
    info.firstLocalEigenvalue=offset;
    info.numGlobalEigenvalues=(upperBound-lowerBound)+1;

#ifndef RELEASE
    PopCallStack();
#endif
    return info;
}
Ejemplo n.º 5
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;
}
Ejemplo n.º 6
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;
}
Ejemplo n.º 7
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;
}