2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2012 -Scilab Enterprises - Adeline CARNIS
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
12 /*--------------------------------------------------------------------------*/
21 #include "eigs_dependencies.h"
22 /*--------------------------------------------------------------------------*/
24 /*--------------------------------------------------------------------------*/
25 // dgemm performs one of the matrix-matrix operations
26 extern int C2F(dgemm)(char* transa, char* transb, int* m, int* n, int* k,
27 double* alpha, double* A, int* lda, double* B, int* ldb,
28 double* beta, double* C, int* ldc);
29 // zgemm performs one of the matrix-matrix operations
30 extern int C2F(zgemm)(char* transa, char* transb, int* m, int* n, int* k,
31 doublecomplex* alpha, doublecomplex* A, int* lda, doublecomplex* B,
32 int* ldb, doublecomplex* beta, doublecomplex* C, int* ldc);
34 // dgemv performs matrix-vector operations
35 extern int C2F(dgemv) (char* trans, int* m, int* n, double* alpha, double* A, int* lda,
36 double* x, int* incx, double* beta, double* y, int* incy);
37 extern int C2F(zgemv) (char* trans, int* m, int* n, doublecomplex* alpha, doublecomplex* A,
38 int* lda, doublecomplex* x, int* incx, doublecomplex* beta, doublecomplex* y, int* incy);
40 // dgetrf computes an LU factorization of a general M by N matrix A (double) using partial pivoting with row interchanges
41 extern int C2F(dgetrf)(int* m, int* n, double* A, int* lda, int* ipiv, int* info);
43 // zgetrf computes an LU factorization of a general M by N matrix A (complex*16) using partial pivoting with row interchanges
44 extern int C2F(zgetrf)(int* m, int* n, doublecomplex* A, int* lda, int* ipiv, int* info);
45 // dgetrs solves a linear system using the factors computed by dgetrf
46 extern int C2F(dgetrs) (char* trans, int* n, int* nrhs, double* A, int *lda, int* ipiv, double* B, int* ldb, int* info);
47 // zgetrs solves a linear system using the factors computed by zgetrf
48 extern int C2F(zgetrs) (char* trans, int* n, int* nrhs, doublecomplex* AC, int* lda, int* ipiv, doublecomplex* B, int* ldb, int* info);
50 // dpotrf computes the cholesky factorization of a real symmetric positive definite matrix A
51 extern int C2F(dpotrf)(char* uplo, int* n, double* A, int* lda, int* info);
53 // zpotrf computes the cholesky factorization of a real hermitian positive definite matrix A
54 extern int C2F(zpotrf)(char* uplo, int* n, doublecomplex* A, int* lda, int* info);
56 // dtrsm solves a triangular linear system
57 extern int C2F(dtrsm) (char* side, char* uplo, char* trans, char* diag, int* m, int* n, double* alpha, double* A, int* lda, double* B, int* ldb);
58 // ztrsm solve a triangular linear system
59 extern int C2F(ztrsm) (char* side, char* uplo, char* trans, char* diag, int* m, int* n, doublecomplex* alpha, doublecomplex* A, int* lda, doublecomplex* B, int* ldb);
60 // dsyrk does a rank k symmetric update
61 extern int C2F(dsyrk) (char* uplo, char* trans, int* n, int* k, double* alpha,
62 double* A, int* lda, double* beta, double* B, int* ldb);
63 // ztrmm multiply by a triangular matrix
64 extern int C2F(ztrmm) (char* side, char* uplo, char* trans, char* diag, int* m, int* n, doublecomplex* alphac,
65 doublecomplex* A, int* lda, doublecomplex* B, int* ldb);
66 // ztrmv multiply a vector by a triangular matrix
67 extern int C2F(ztrmv) (char* uplo, char* trans, char* diag, int* n, doublecomplex* A, int* lda, doublecomplex* x, int* incx);
68 // dtrmv multiply a vector by a triangular matrix
69 extern int C2F(dtrmv) (char* uplo, char* trans, char* diag, int* n, double* A, int* lda, double* x, int* incx);
70 /*--------------------------------------------------------------------------*/
72 /*--------------------------------------------------------------------------*/
73 extern int C2F(dsaupd)(int *ido, char *bmat, int *n, char *which, int *nev,
74 double *tol, double *resid, int *ncv, double *v,
75 int *ldv, int *iparam, int *ipntr, double *workd,
76 double *workl, int *lworkl, int *info);
77 /*--------------------------------------------------------------------------*/
79 /*--------------------------------------------------------------------------*/
80 extern int C2F(dseupd)(int *rvec, char *howmny, int *select, double *d,
81 double *z, int *ldz, double *sigma, char *bmat,
82 int *n, char *which, int *nev , double *tol,
83 double *resid, int *ncv, double *v , int *ldv,
84 int *iparam, int *ipntr, double *workd, double *workl,
85 int *lworkl, int *info);
86 /*--------------------------------------------------------------------------*/
88 /*--------------------------------------------------------------------------*/
89 extern int C2F(dnaupd)(int *ido, char *bmat, int *n, char *which, int *nev,
90 double *tol, double *resid, int *ncv, double *v,
91 int *ldv, int *iparam, int *ipntr, double *workd,
92 double *workl, int *lworkl, int *info);
93 /*--------------------------------------------------------------------------*/
95 /*--------------------------------------------------------------------------*/
96 extern int C2F(dneupd)(int *rvec, char *howmny, int *select, double *dr,
97 double *di, double *z, int *ldz, double *sigmar,
98 double *sigmai, double *workev, char *bmat, int *n,
99 char *which, int *nev, double *tol, double *resid,
100 int *ncv, double *v, int *ldv, int *iparam, int *ipntr,
101 double *workd, double *workl, int *lworkl, int *info);
102 /*--------------------------------------------------------------------------*/
104 /*--------------------------------------------------------------------------*/
105 extern int C2F(znaupd)(int * ido, char * bmat, int * n, char * which,
106 int * nev, double * tol, doublecomplex * resid,
107 int * ncv, doublecomplex * v, int * ldv, int * iparam,
108 int * ipntr, doublecomplex * workd,
109 doublecomplex * workl, int * lworkl, double * rwork,
111 /*--------------------------------------------------------------------------*/
113 /*--------------------------------------------------------------------------*/
114 extern int C2F(zneupd)(int * rvec, char * howmny, int * select,
115 doublecomplex * d, doublecomplex * z, int * ldz,
116 doublecomplex * sigma, doublecomplex * workev,
117 char * bmat, int * n, char * which, int * nev,
118 double * tol, doublecomplex * resid, int * ncv,
119 doublecomplex * v, int * ldv, int * iparam, int * ipntr,
120 doublecomplex * workd, doublecomplex * workl,
121 int * lworkl, double * rwork, int * info);
122 /*--------------------------------------------------------------------------*/
124 static double alpha = 1.;
125 static double beta = 0.;
127 static doublecomplex alphac = {1., 0.};
128 static doublecomplex betac = {0., 0.};
130 int eigs(double *AR, doublecomplex *AC, int N, int Acomplex, int Asym,
131 double* B, doublecomplex* BC, int Bcomplex, int matB, int nev,
132 doublecomplex SIGMA, char* which, double* maxiter, double* tol,
133 double* NCV, double* RESID, doublecomplex* RESIDC, int* INFO,
134 double* cholB, int INFO_EUPD, double* eigenvalue,
135 double* eigenvector, doublecomplex* eigenvalueC,
136 doublecomplex* eigenvectorC, int RVEC)
150 // VARIABLES DSAUPD, DNAUPD, ZNAUPD
160 doublecomplex* VC = NULL;
162 double* WORKD = NULL;
163 doublecomplex* WORKDC = NULL;
165 double* WORKL = NULL;
166 doublecomplex* WORKLC = NULL;
168 double* RWORK = NULL;
172 // VARIABLES DSEUPD, DNEUPD, ZNEUPD
181 double* WORKEV = NULL;
182 doublecomplex* WORKEVC = NULL;
184 doublecomplex mSIGMA = {.r = -SIGMA.r, .i = -SIGMA.i };
187 doublecomplex* RC = NULL;
190 doublecomplex* AMSBC = NULL;
195 doublecomplex* tempC = NULL;
201 IPARAM[2] = (int) maxiter[0];
202 IPARAM[6] = 1; // by default mode = 1
207 if (!strcmp(which, "SM") || (SIGMA.r != 0 || SIGMA.i != 0))
214 if ((matB == 0) || (IPARAM[6] == 1)) // if B = [] or mode = 1 -> bmat = 'I' : standard eigenvalue problem
218 else // generalized eigenvalue problem
226 if (Asym == 0 && !Acomplex && !Bcomplex) // if dnaupd ncv = 2*nev+1
228 ncv = Max(2 * nev + 1, 20);
230 else // if dsaupd or znaupd ncv = 2*nev
232 ncv = Max(2 * nev, 20);
242 if (ncv <= nev || ncv > N) // Error
249 if ((!Acomplex && !Bcomplex && Asym == 1 && nev >= N) || ((Acomplex || Bcomplex || !Asym) && nev >= N - 1))
256 if (cholB[0]) // we already have the cholesky decomposition
265 if (!Bcomplex) // B is real
267 R = (double *)malloc(N * N * sizeof(double));
268 memcpy(R, B, N * N * sizeof(double));
269 C2F(dpotrf) ("u", &N, R, &N, &INFO_CHOL); // Compute the upper triangular matrix R
270 if (INFO_CHOL != 0) // Errors
278 RC = (doublecomplex *) malloc(N * N * sizeof(doublecomplex));
279 memcpy(RC, BC, N * N * sizeof(doublecomplex));
280 C2F(zpotrf) ("u", &N, RC, &N, &INFO_CHOL); // Computes the upper triangular matrix
292 if (!Acomplex && !Bcomplex) // A and B are not complex
294 if (IPARAM[6] == 3) // if mode = 3
296 AMSB = (double*)malloc(N * N * sizeof(double));
297 memcpy(AMSB, AR, N * N * sizeof(double));
300 // Compute LU decomposition AMSB = A - sigma*B
301 if (matB == 0) // if B = [] -> standard eigenvalue problem : A - sigma *I
303 for (i = 0 ; i < N ; i++)
305 AMSB[i + i * N] -= SIGMA.r;
308 else // generalized eigenvalue problem
312 C2F(dsyrk) ("u", "t", &N, &N, &mSIGMA.r, R, &N, &alpha, AMSB, &N);
313 if (!Asym) //dsyrk does a symmetric update so we need to correct for the antisymmetric part
315 for (i = 0; i < N; i++)
317 for (j = 0; j < i; j++)
319 AMSB[i + j * N] = AMSB[j + i * N] + AR[i + j * N] - AR[j + i * N];
326 C2F(daxpy)(&N2, &mSIGMA.r, B, &iOne, AMSB, &iOne);
332 IPVT = (int*) calloc(N, sizeof(int));
333 C2F(dgetrf)(&N, &N, AMSB, &N, IPVT, &INFO_LU);
344 LWORKL = ncv * ncv + 8 * ncv;
345 WORKL = (double*) calloc(LWORKL, sizeof(double));
350 LWORKL = 3 * ncv * (ncv + 2);
351 WORKL = (double*) calloc(LWORKL, sizeof(double));
355 WORKD = (double*) calloc(3 * N, sizeof(double));
356 V = (double*) calloc(N * ncv, sizeof(double));
358 if (IPARAM[6] == 1 && matB)
360 temp = (double*) malloc(N * sizeof(double));
367 C2F(dsaupd)(&IDO, bmat, &N, which, &nev, tol, RESID, &ncv, V, &LDV, IPARAM, IPNTR, WORKD, WORKL, &LWORKL, &INFO[0]);
371 C2F(dnaupd)(&IDO, bmat, &N, which, &nev, tol, RESID, &ncv, V, &LDV, IPARAM, IPNTR, WORKD, WORKL, &LWORKL, &INFO[0]);
374 if (INFO[0] == -1) //non critical error
376 sciprint("%s: WARNING: Maximum number of iterations reached. Only %d eigenvalues converged.\n", "eigs", IPARAM[4]);
398 if (IDO == -1 || IDO == 1 || IDO == 2)
400 if (IPARAM[6] == 1) // mode = 1
404 memcpy(WORKD + IPNTR[1] - 1, WORKD + IPNTR[0] - 1, N * sizeof(double));
406 else //IDO=1 or IDO=-1
408 if (matB == 0) // B = [] -> standard eigenvalue problem
413 C2F(dsymv) ("u", &N, &alpha, AR, &N, WORKD + IPNTR[0] - 1, &iOne, &beta, WORKD + IPNTR[1] - 1, &iOne);
417 C2F(dgemv) ("n", &N, &N, &alpha, AR, &N, WORKD + IPNTR[0] - 1, &iOne, &beta, WORKD + IPNTR[1] - 1, &iOne);
420 else // generalized eigenvalue problem
422 // OP = inv(Rprime)*A*inv(R)*x
423 memcpy(WORKD + IPNTR[1] - 1, WORKD + IPNTR[0] - 1, N * sizeof(double));
424 C2F(dtrsm) ("l", "u", "n", "n", &N, &iOne, &alpha, R, &N, WORKD + IPNTR[1] - 1, &N);
425 memcpy(temp, WORKD + IPNTR[1] - 1, N * sizeof(double));
428 C2F(dsymv) ("u", &N, &alpha, AR, &N, temp, &iOne, &beta, WORKD + IPNTR[1] - 1, &iOne);
432 C2F(dgemv) ("n", &N, &N, &alpha, AR, &N, temp, &iOne, &beta, WORKD + IPNTR[1] - 1, &iOne);
434 C2F(dtrsm) ("l", "u", "t", "n", &N, &iOne, &alpha, R, &N, WORKD + IPNTR[1] - 1, &N);
440 if (IPARAM[6] == 3) // mode = 3
442 if (matB == 0) // B = [] -> standard eigenvalue problem
446 // y = B*x where B = I so workd[ipntr[1]-1:ipntr[1]+N-1] = workd[ipntr[0]-1:ipntr[0]+N-1]
447 memcpy(WORKD + IPNTR[1] - 1, WORKD + IPNTR[0] - 1, N * sizeof(double));
451 // workd[ipntr[1]-1:ipntr[1]+N-1] = inv(U)*inv(L)*inv(P)*workd[ipntr[0]-1:ipntr[0]+N-1]
452 memcpy(WORKD + IPNTR[1] - 1, WORKD + IPNTR[0] - 1, N * sizeof(double));
453 C2F(dgetrs) ("n", &N, &iOne, AMSB, &N, IPVT, WORKD + IPNTR[1] - 1, &N, &INFO_INV);
456 else // matB == 1 so B is not empty and bmat = 'G'-> generalized eigenvalue problem
458 if (IDO == 2 || IDO == -1)
460 if (cholB[0]) // workd[ipntr[1]-1:ipntr[1]+N-1] = Rprime * R * workd[ipntr[0]-1:ipntr[0]+N-1]
462 memcpy(WORKD + IPNTR[1] - 1, WORKD + IPNTR[0] - 1, N * sizeof(double));
463 C2F(dtrmv) ("u", "n", "n", &N, B, &N, WORKD + IPNTR[1] - 1, &iOne);
464 C2F(dtrmv) ("u", "t", "n", &N, B, &N, WORKD + IPNTR[1] - 1, &iOne);
466 else // workd[ipntr[1]-1:ipntr[1]+N-1] = B * workd[ipntr[0]-1:ipntr[0]+N-1]
468 C2F(dgemv) ("n", &N, &N, &alpha, B, &N, WORKD + IPNTR[0] - 1, &iOne, &beta, WORKD + IPNTR[1] - 1, &iOne);
474 // compute workd[ipntr[1]-1:ipntr[1]+N-1] = inv(U)*inv(L)*inv(P)*workd[ipntr[1]-1:ipntr[1]+N-1]
475 C2F(dgetrs) ("n", &N, &iOne, AMSB, &N, IPVT, WORKD + IPNTR[1] - 1, &N, &INFO_INV);
481 // computes workd[ipntr[1]-1:ipntr[1]+N-1] = inv(U)*inv(L)*inv(P)*workd[ipntr[2]-1:ipntr[2]+N-1]
482 memcpy(WORKD + IPNTR[1] - 1, WORKD + IPNTR[2] - 1, N * sizeof(double));
483 C2F(dgetrs) ("n", &N, &iOne, AMSB, &N, IPVT, WORKD + IPNTR[1] - 1, &N, &INFO_INV);
509 SELECT = (int *)calloc(ncv, sizeof(int));
513 C2F(dseupd) (&RVEC, HOWMNY, SELECT, eigenvalue, eigenvector, &LDV,
514 &SIGMA.r, bmat, &N, which, &nev, tol, RESID, &ncv, V,
515 &LDV, IPARAM, IPNTR, WORKD, WORKL, &LWORKL, &INFO_EUPD);
533 if (matB && IPARAM[6] == 1)
535 // we need to revert back to the original problem
536 // since we really solved for (y,\lambda) in R^{-T}Ay=\lambda y
537 //with y = Rx, so that x = R^{-1}y
538 C2F(dtrsm) ("l", "u", "n", "n", &N, &nev, &alpha, R, &N, eigenvector, &N);
545 DR = (double *)calloc((nev + 1), sizeof(double));
546 DI = (double *)calloc((nev + 1), sizeof(double));
547 WORKEV = (double *)calloc(3 * ncv, sizeof(double));
549 RVEC = RVEC || (IPARAM[6] == 3 && SIGMA.i != 0);
553 Z = (double *)calloc(N * (nev + 1), sizeof(double));
556 C2F(dneupd) (&RVEC, HOWMNY, SELECT, DR, DI, Z, &LDV, &SIGMA.r,
557 &SIGMA.i, WORKEV, bmat, &N, which, &nev, tol, RESID,
558 &ncv, V, &LDV, IPARAM, IPNTR, WORKD, WORKL, &LWORKL, &INFO_EUPD);
578 if (Z && matB && IPARAM[6] == 1)
580 // we need to revert back to the original problem
581 // since we really solved for (y,\lambda) in R^{-T}Ay=\lambda y
582 //with y = Rx, so that x = R^{-1}y
583 C2F(dtrsm) ("l", "u", "n", "n", &N, &nev, &alpha, R, &N, Z, &N);
585 //we use oldnev, because dneupd increases nev by one sometimes.
586 process_dneupd_data(DR, DI, Z, N, oldnev, AR, eigenvalueC,
587 eigenvectorC, (IPARAM[6] == 3) && (SIGMA.i != 0));
605 else // A or/and B complex
607 if (IPARAM[6] == 3) // mode = 3
609 AMSBC = (doublecomplex*)malloc(N * N * sizeof(doublecomplex));
611 if (SIGMA.r != 0 || SIGMA.i != 0)
613 if (matB == 0) // standard eigenvalue problem
615 memcpy(AMSBC, AC, N * N * sizeof(doublecomplex));
616 for (i = 0 ; i < N ; i++)
618 AMSBC[i + i * N].r -= SIGMA.r;
619 AMSBC[i + i * N].i -= SIGMA.i;
622 else // generalized eigenvalue problem
626 memcpy(AMSBC, BC, N * N * sizeof(doublecomplex));
627 C2F(ztrmm)("l", "u", "c", "n", &N, &N, &mSIGMA, BC, &N, AMSBC, &N);
628 C2F(zaxpy)(&N2, &alphac, AC, &iOne, AMSBC, &iOne);
632 memcpy(AMSBC, AC, N * N * sizeof(doublecomplex));
633 C2F(zaxpy) (&N2, &mSIGMA, BC, &iOne, AMSBC, &iOne);
639 memcpy(AMSBC, AC, N * N * sizeof(doublecomplex));
643 IPVT = (int*) calloc(N, sizeof(int));
644 C2F(zgetrf) (&N, &N, AMSBC, &N, IPVT, &INFO_LU);
652 LWORKL = 3 * ncv * ncv + 5 * ncv;
654 VC = (doublecomplex*) calloc(N * ncv, sizeof(doublecomplex));
655 WORKLC = (doublecomplex*) calloc(LWORKL, sizeof(doublecomplex));
656 WORKDC = (doublecomplex*) calloc(3 * N, sizeof(doublecomplex));
657 RWORK = (double*) calloc(ncv, sizeof(double));
658 if (IPARAM[6] == 1 && matB)
660 tempC = (doublecomplex*) malloc(N * sizeof(doublecomplex));
665 C2F(znaupd)(&IDO, bmat, &N, which, &nev, tol, RESIDC, &ncv, VC, &LDV, IPARAM, IPNTR, WORKDC, WORKLC, &LWORKL, RWORK, &INFO[0]);
667 if (INFO[0] == -1) //non critical error
669 sciprint("%s: WARNING: Maximum number of iterations reached. Only %d eigenvalues converged.\n", "eigs", IPARAM[4]);
688 if (IDO == -1 || IDO == 1 || IDO == 2)
690 if (IPARAM[6] == 1) // mode = 1
694 memcpy(WORKDC + IPNTR[1] - 1, WORKDC + IPNTR[0] - 1, N * sizeof(doublecomplex));
698 if (matB == 0) // B = I
701 C2F(zgemv) ("n", &N, &N, &alphac, AC, &N, WORKDC + IPNTR[0] - 1, &iOne, &betac, WORKDC + IPNTR[1] - 1, &iOne);
705 // OP = inv(RC')*A*inv(RC)*x
706 memcpy(WORKDC + IPNTR[1] - 1, WORKDC + IPNTR[0] - 1, N * sizeof(doublecomplex));
707 C2F(ztrsm) ("l", "u", "n", "n", &N, &iOne, &alphac, RC, &N, WORKDC + IPNTR[1] - 1, &N);
708 memcpy(tempC, WORKDC + IPNTR[1] - 1, N * sizeof(doublecomplex));
709 C2F(zgemv) ("n", &N, &N, &alphac, AC, &N, tempC, &iOne, &betac, WORKDC + IPNTR[1] - 1, &iOne);
710 C2F(ztrsm) ("l", "u", "c", "n", &N, &iOne, &alphac, RC, &N, WORKDC + IPNTR[1] - 1, &N);
716 if (IPARAM[6] == 3) // if mode = 3
718 if (matB == 0) // B = [] -> matB is empty -> standard eigenvalue problem
722 // y = B*x where B = I so workd[ipntr[1]-1:ipntr[1]+N-1] = workd[ipntr[0]-1:ipntr[0]+N-1]
723 memcpy(WORKDC + IPNTR[1] - 1, WORKDC + IPNTR[0] - 1, N * sizeof(doublecomplex));
727 // workd[ipntr[1]-1:ipntr[1]+N-1] = inv(U)*inv(L)*inv(P)*workd[ipntr[0]-1:ipntr[0]+N-1]
728 memcpy(WORKDC + IPNTR[1] - 1, WORKDC + IPNTR[0] - 1, N * sizeof(doublecomplex));
729 C2F(zgetrs) ("n", &N, &iOne, AMSBC, &N, IPVT, WORKDC + IPNTR[1] - 1, &N, &INFO_INV);
733 else // matB == 1 so B is not empty and bmat = 'G'-> generalized eigenvalue problem
735 if (IDO == 2 || IDO == -1)
737 if (cholB[0]) // workd[ipntr[1]-1:ipntr[1]+N-1] = RCprime * RC * workd[ipntr[0]-1:ipntr[0]+N-1]
739 memcpy(WORKDC + IPNTR[1] - 1, WORKDC + IPNTR[0] - 1, N * sizeof(doublecomplex));
740 C2F(ztrmv) ("u", "n", "n", &N, BC, &N, WORKDC + IPNTR[1] - 1, &iOne);
741 C2F(ztrmv) ("u", "c", "n", &N, BC, &N, WORKDC + IPNTR[1] - 1, &iOne);
743 else // workd[ipntr[1]-1:ipntr[1]+N-1] = B *workd[ipntr[0]-1:ipntr[0]+N-1]
745 C2F(zgemv) ("n", &N, &N, &alphac, BC, &N, WORKDC + IPNTR[0] - 1, &iOne, &betac, WORKDC + IPNTR[1] - 1, &iOne);
750 // compute workd[ipntr[1]-1:ipntr[1]+N-1] = inv(U)*inv(L)*inv(P)*workd[ipntr[1]-1:ipntr[1]+N-1]
751 C2F(zgetrs) ("n", &N, &iOne, AMSBC, &N, IPVT, WORKDC + IPNTR[1] - 1, &N, &INFO_INV);
757 /* compute workd[ipntr[1]-1:ipntr[1]+N-1] = inv(U)*inv(L)*inv(P)*workd[ipntr[2]-1:ipntr[2]+N-1] */
758 memcpy(WORKDC + IPNTR[1] - 1, WORKDC + IPNTR[2] - 1, N * sizeof(doublecomplex));
759 C2F(zgetrs) ("n", &N, &iOne, AMSBC, &N, IPVT, WORKDC + IPNTR[1] - 1, &N, &INFO_INV);
785 SELECT = (int *)calloc(ncv, sizeof(int));
786 WORKEVC = (doublecomplex *) calloc(2 * ncv, sizeof(doublecomplex));
788 C2F(zneupd) (&RVEC, HOWMNY, SELECT, eigenvalueC, eigenvectorC, &LDV, &SIGMA, WORKEVC, bmat, &N,
789 which, &nev, tol, RESIDC, &ncv, VC, &LDV, IPARAM, IPNTR, WORKDC,
790 WORKLC, &LWORKL, RWORK, &INFO_EUPD);
811 if (matB && IPARAM[6] == 1)
813 C2F(ztrsm) ("l", "u", "n", "n", &N, &nev, &alphac, RC, &N, eigenvectorC, &N);