49 #include "blockmemshell/memory.h"
50 #include "scip/type_retcode.h"
55 #define BMS_CALL(x) do \
59 SCIPerrorMessage("No memory in function call\n"); \
60 return SCIP_NOMEMORY; \
66 #define DOUBLETOINT(x) ((LAPACKINTTYPE) (x + 0.5))
77 char* JOBZ,
char* RANGE,
char* UPLO,
79 double* VL,
double* VU,
106 SCIP_Bool geteigenvectors,
110 SCIP_Real* eigenvalue,
111 SCIP_Real* eigenvector
136 assert( blkmem != NULL );
139 assert( 0 < i && i <= n );
140 assert( eigenvalue != NULL );
141 assert( ( ! geteigenvectors) || eigenvector != NULL );
144 JOBZ = geteigenvectors ?
'V' :
'N';
159 F77_FUNC(dsyevr, DSYEVR)( &JOBZ, &RANGE, &UPLO,
163 &ABSTOL, &M, NULL, NULL,
165 &LWORK, &WISIZE, &LIWORK,
170 SCIPerrorMessage(
"There was an error when calling DSYEVR. INFO = %d\n", INFO);
178 BMS_CALL( BMSallocBlockMemoryArray(blkmem, &WORK, (
int) LWORK) );
179 BMS_CALL( BMSallocBlockMemoryArray(blkmem, &IWORK, (
int) LIWORK) );
180 BMS_CALL( BMSallocBlockMemoryArray(blkmem, &WTMP, (
int) N) );
181 BMS_CALL( BMSallocBlockMemoryArray(blkmem, &ISUPPZ, 2) );
187 F77_FUNC(dsyevr, DSYEVR)( &JOBZ, &RANGE, &UPLO,
191 &ABSTOL, &M, WTMP, eigenvector,
193 &LWORK, IWORK, &LIWORK,
198 SCIPerrorMessage(
"There was an error when calling DSYEVR. INFO = %d\n", INFO);
203 *eigenvalue = WTMP[0];
206 BMSfreeBlockMemoryArray(blkmem, &ISUPPZ, 2);
207 BMSfreeBlockMemoryArray(blkmem, &WTMP, (
int) N);
208 BMSfreeBlockMemoryArray(blkmem, &IWORK, (
int) LIWORK);
209 BMSfreeBlockMemoryArray(blkmem, &WORK, (
int) LWORK);
247 F77_FUNC(dgemv, DGEMV)(&TRANS, &M, &N, &ALPHA, A, &LDA, X, &INCX, &BETA, Y, &INCY);
long long int LAPACKINTTYPE
Macros for calling Fortran-functions.
SCIP_RETCODE SCIPlapackMatrixVectorMult(int nrows, int ncols, SCIP_Real *matrix, SCIP_Real *vector, SCIP_Real *result)
#define F77_FUNC(name, NAME)
interface methods for eigenvector computation and matrix multiplication using different versions of L...
EXTERN SCIP_RETCODE SCIPlapackComputeIthEigenvalue(BMS_BLKMEM *blkmem, SCIP_Bool geteigenvectors, int n, SCIP_Real *A, int i, SCIP_Real *eigenvalue, SCIP_Real *eigenvector)