49 #include "blockmemshell/memory.h"
50 #include "scip/type_retcode.h"
56 #define BMS_CALL(x) do \
60 SCIPerrorMessage("No memory in function call\n"); \
61 return SCIP_NOMEMORY; \
67 #define SCIP_RealTOINT(x) ((int) (x + 0.5))
78 char* JOBZ,
char* RANGE,
char* UPLO,
79 int* N, SCIP_Real* A,
int* LDA,
80 SCIP_Real* VL, SCIP_Real* VU,
82 SCIP_Real* ABSTOL,
int* M, SCIP_Real* W, SCIP_Real* Z,
83 int* LDZ,
int* ISUPPZ, SCIP_Real* WORK,
84 int* LWORK,
int* IWORK,
int* LIWORK,
89 void F77_FUNC(dgemv, DGEMV)(
char* TRANS,
int* M,
int* N, SCIP_Real* ALPHA, SCIP_Real* A,
int* LDA,
90 SCIP_Real* X,
int* INCX, SCIP_Real* BETA, SCIP_Real* Y,
int* INCY);
93 void F77_FUNC(dgemm, DGEMM)(
char* TRANSA,
char* TRANSB,
int* M,
int* N,
int* K, SCIP_Real* ALPHA,
94 SCIP_Real* A,
int* LDA, SCIP_Real* B,
int* LDB, SCIP_Real* BETA, SCIP_Real* C,
int* LDC );
109 SCIP_Bool geteigenvectors,
113 SCIP_Real* eigenvalue,
114 SCIP_Real* eigenvector
140 assert( bufmem != NULL );
143 assert( 0 < i && i <= n );
144 assert( eigenvalue != NULL );
145 assert( ( ! geteigenvectors) || eigenvector != NULL );
148 JOBZ = geteigenvectors ?
'V' :
'N';
163 F77_FUNC(dsyevr, DSYEVR)( &JOBZ, &RANGE, &UPLO,
167 &ABSTOL, &M, NULL, NULL,
169 &LWORK, &WISIZE, &LIWORK,
174 SCIPerrorMessage(
"There was an error when calling DSYEVR. INFO = %d\n", INFO);
182 BMS_CALL( BMSallocBufferMemoryArray(bufmem, &WORK, LWORK) );
183 BMS_CALL( BMSallocBufferMemoryArray(bufmem, &IWORK, LIWORK) );
184 BMS_CALL( BMSallocBufferMemoryArray(bufmem, &WTMP, N) );
185 BMS_CALL( BMSallocBufferMemoryArray(bufmem, &ISUPPZ, 2) );
191 F77_FUNC(dsyevr, DSYEVR)( &JOBZ, &RANGE, &UPLO,
195 &ABSTOL, &M, WTMP, eigenvector,
197 &LWORK, IWORK, &LIWORK,
202 SCIPerrorMessage(
"There was an error when calling DSYEVR. INFO = %d\n", INFO);
207 *eigenvalue = WTMP[0];
210 BMSfreeBufferMemoryArray(bufmem, &ISUPPZ);
211 BMSfreeBufferMemoryArray(bufmem, &WTMP);
212 BMSfreeBufferMemoryArray(bufmem, &IWORK);
213 BMSfreeBufferMemoryArray(bufmem, &WORK);
223 SCIP_Real* eigenvalues,
224 SCIP_Real* eigenvectors
228 #if ( SDPA_VERSION == 740 )
250 assert( bufmem != NULL );
253 assert( eigenvalues != NULL );
254 assert( eigenvectors != NULL );
270 F77_FUNC(dsyevr, DSYEVR)( &JOBZ, &RANGE, &UPLO,
274 &ABSTOL, &M, NULL, NULL,
276 &LWORK, &WISIZE, &LIWORK,
281 SCIPerrorMessage(
"There was an error when calling DSYEVR. INFO = %d\n", INFO);
289 BMS_CALL( BMSallocBufferMemoryArray(bufmem, &WORK, (
int) LWORK) );
290 BMS_CALL( BMSallocBufferMemoryArray(bufmem, &IWORK, (
int) LIWORK) );
291 BMS_CALL( BMSallocBufferMemoryArray(bufmem, &ISUPPZ, (
int) 2 * N) );
297 F77_FUNC(dsyevr, DSYEVR)( &JOBZ, &RANGE, &UPLO,
301 &ABSTOL, &M, eigenvalues, eigenvectors,
303 &LWORK, IWORK, &LIWORK,
308 SCIPerrorMessage(
"There was an error when calling DSYEVR. INFO = %d\n", INFO);
313 BMSfreeBufferMemoryArray(bufmem, &ISUPPZ);
314 BMSfreeBufferMemoryArray(bufmem, &IWORK);
315 BMSfreeBufferMemoryArray(bufmem, &WORK);
353 F77_FUNC(dgemv, DGEMV)(&TRANS, &M, &N, &ALPHA, A, &LDA, X, &INCX, &BETA, Y, &INCY);
363 SCIP_Bool transposeA,
367 SCIP_Bool transposeB,
382 assert( (transposeA && transposeB && (nrowsA == ncolsB)) || (transposeA && !transposeB && (nrowsA == nrowsB))
383 || (!transposeA && transposeB && (ncolsA == ncolsB)) || (!transposeA && !transposeB && (ncolsA == nrowsB)) );
385 TRANSA = transposeA ?
'T' :
'N';
386 TRANSB = transposeB ?
'T' :
'N';
387 M = transposeA ? ncolsA : nrowsA;
388 N = transposeB ? nrowsB : ncolsB;
389 K = transposeA ? nrowsA : ncolsA;
391 LDA = transposeA ? K : M;
392 LDB = transposeB ? N : K;
396 F77_FUNC(dgemm, DGEMM)(&TRANSA, &TRANSB, &M, &N, &K, &ALPHA, matrixA, &LDA, matrixB, &LDB, &BETA, result, &LDC);
EXTERN SCIP_RETCODE SCIPlapackComputeIthEigenvalue(BMS_BUFMEM *bufmem, SCIP_Bool geteigenvectors, int n, SCIP_Real *A, int i, SCIP_Real *eigenvalue, SCIP_Real *eigenvector)
Macros for calling Fortran-functions.
SCIP_RETCODE SCIPlapackMatrixVectorMult(int nrows, int ncols, SCIP_Real *matrix, SCIP_Real *vector, SCIP_Real *result)
SCIP_RETCODE SCIPlapackComputeEigenvectorDecomposition(BMS_BUFMEM *bufmem, int n, SCIP_Real *A, SCIP_Real *eigenvalues, SCIP_Real *eigenvectors)
SCIP_RETCODE SCIPlapackMatrixMatrixMult(int nrowsA, int ncolsA, SCIP_Real *matrixA, SCIP_Bool transposeA, int nrowsB, int ncolsB, SCIP_Real *matrixB, SCIP_Bool transposeB, SCIP_Real *result)
#define F77_FUNC(name, NAME)
interface methods for eigenvector computation and matrix multiplication using different versions of L...
#define SCIP_RealTOINT(x)