| 616 | #endif |
| 617 | |
| 618 | int MatrixOperations::performEigenAnalysis(int pBeginMod, int pEndMod) |
| 619 | { |
| 620 | |
| 621 | beginMod=pBeginMod; |
| 622 | endMod = pEndMod; |
| 623 | |
| 624 | Matrix * A = theMatrix; |
| 625 | |
| 626 | // opserr<< "hessian:"<< * theMatrix<<endln; |
| 627 | |
| 628 | if (A ==0) {opserr<<"error, Hessian does not exist in MatrixOperator::performEigenAnalysis !"<<endln; exit(-1);} |
| 629 | |
| 630 | // Number of equations |
| 631 | int n = A->noRows(); |
| 632 | if (n != A->noCols()) { |
| 633 | opserr<<"MatrixOperations::performEigenAnalysis wrong. m!=n"<<endln; |
| 634 | exit(-1); |
| 635 | } |
| 636 | |
| 637 | numModes = endMod - beginMod +1; //Q |
| 638 | // Check for quick return |
| 639 | if (numModes < 1) { |
| 640 | numModes = 0; |
| 641 | return 0; |
| 642 | } |
| 643 | |
| 644 | // Simple check |
| 645 | if (numModes > n) |
| 646 | numModes = n; |
| 647 | |
| 648 | // Allocate storage for eigenvalues |
| 649 | if (eigenvalue != 0) |
| 650 | delete [] eigenvalue; |
| 651 | eigenvalue = new double [n]; |
| 652 | |
| 653 | // Real work array (see LAPACK dsbevx subroutine documentation) |
| 654 | double *work = new double [7*n]; |
| 655 | |
| 656 | // Integer work array (see LAPACK dsbevx subroutine documentation) |
| 657 | int *iwork = new int [5*n]; |
| 658 | |
| 659 | // Leading dimension of eigenvectors |
| 660 | int ldz = n; |
| 661 | setSizeOfEigenVector(ldz); // alloc memory here. |
| 662 | |
| 663 | // Allocate storage for eigenvectors |
| 664 | if (eigenvector != 0) |
| 665 | delete [] eigenvector; |
| 666 | eigenvector = new double [ldz*numModes]; |
| 667 | |
| 668 | // Number of superdiagonals |
| 669 | int kd = n-1; |
| 670 | |
| 671 | // Matrix data |
| 672 | |
| 673 | |
| 674 | //double *ab = theSOE->A; // |
| 675 | double *ab = new double [n*n]; |