/* Function: solve * * Computes eigenvectors of the standard eigenvalue problem Ax = l x. * * Parameters: * A - Left-hand side matrix. * ev - Array of eigenvectors. * work - Workspace array. * lwork - Size of the input workspace array. * communicator - MPI communicator for selecting the threshold criterion. */ void solve(K* const& A, K**& ev, K* const& work, int& lwork, const MPI_Comm& communicator) { int info; K* tau = work + lwork; underlying_type<K>* d = reinterpret_cast<underlying_type<K>*>(tau + Eigensolver<K>::_n); underlying_type<K>* e = d + Eigensolver<K>::_n; trd("L", &(Eigensolver<K>::_n), A, &(Eigensolver<K>::_n), d, e, tau, work, &lwork, &info); underlying_type<K> vl = -1.0 / HPDDM_EPS; underlying_type<K> vu = Eigensolver<K>::_threshold; int iu = Eigensolver<K>::_nu; int nsplit; underlying_type<K>* evr = e + Eigensolver<K>::_n - 1; int* iblock = new int[5 * Eigensolver<K>::_n]; int* isplit = iblock + Eigensolver<K>::_n; int* iwork = isplit + Eigensolver<K>::_n; char range = Eigensolver<K>::_threshold > 0.0 ? 'V' : 'I'; stebz(&range, "B", &(Eigensolver<K>::_n), &vl, &vu, &i__1, &iu, &(Eigensolver<K>::_tol), d, e, &(Eigensolver<K>::_nu), &nsplit, evr, iblock, isplit, reinterpret_cast<underlying_type<K>*>(work), iwork, &info); if(Eigensolver<K>::_nu) { ev = new K*[Eigensolver<K>::_nu]; *ev = new K[Eigensolver<K>::_n * Eigensolver<K>::_nu]; for(unsigned short i = 1; i < Eigensolver<K>::_nu; ++i) ev[i] = *ev + i * Eigensolver<K>::_n; int* ifailv = new int[Eigensolver<K>::_nu]; stein(&(Eigensolver<K>::_n), d, e, &(Eigensolver<K>::_nu), evr, iblock, isplit, *ev, &(Eigensolver<K>::_n), reinterpret_cast<underlying_type<K>*>(work), iwork, ifailv, &info); delete [] ifailv; mtr("L", "L", "N", &(Eigensolver<K>::_n), &(Eigensolver<K>::_nu), A, &(Eigensolver<K>::_n), tau, *ev, &(Eigensolver<K>::_n), work, &lwork, &info); if(!Wrapper<K>::is_complex) lwork += 3 * Eigensolver<K>::_n - 1; else lwork += 4 * Eigensolver<K>::_n - 1; } delete [] iblock; }
int main() { const DVD diehard("Die Hard", 130, 9.99); DVD stein("Stein's Gate", 120, 10.11); DVD bun("Bunraku", 121, 3.56); diehard.output(); stein.output(); bun.output(); stein.changeprice(1.11); bun.changeprice(0); diehard.output(); stein.output(); bun.output(); cout << diehard.get_title() << '\n'; cout << stein.get_minutes() << '\n'; cout << bun.get_price() << '\n'; }