int testIntel_oneAPI() { //int mat = 0; int i; double epsout = 0; int loop = 0; int info = 0; int fpm[128]; char uplo = 'U'; int n = 4; double emin = 0; double emax = 10; int numberOfEigenValuesExpected = 4; int numberOfEigenValuesFound; double* theEigenValues = calloc(n * numberOfEigenValuesExpected, sizeof(double)); if (theEigenValues == NULL) { printf("\nabort!"); } double* theEigenVectors = calloc(numberOfEigenValuesExpected, sizeof(double)); if (theEigenVectors == NULL) { printf("\nabort!"); } double* theResidual = calloc(numberOfEigenValuesExpected, sizeof(double)); if (theResidual == NULL) { printf("\nabort!"); } /* the first matrix in cst format symmetric [ 4 2 ] [ 4 2 ] [ 2 8 3 ] => [ 8 3 ] [ 3 7 1 ] [ 7 1 ] [ 1 3 ] [ 3 ] */ /* one based indexing - csr */ int theFirstMatrixMetaInfoTwo[] = { 1,3,5,7,8 }; // for CSR-storage the row-"pointer"-indices int theFirstMatrixMetaInfoOne[] = { 1,2,2,3,3,4,4 }; // for CSR-storage the column-indices double theFirstMatrixValues[] = { 4.,2.,8.,3.,7.,1.,3. }; // the values /* ======================== positive definite matrix ======================== */ /* the second matrix in csr format symmetric [ 1 0 0 0 ] [ 0 2 0 0 ] [ 0 0 3 0 ] [ 0 0 0 4 ] */ //int theSecondMatrixMetaInfoTwo[] = { 1,2,3,4,5 }; //int theSecondMatrixMetaInfoOne[] = { 1,2,3,4 }; //double theSecondMatrixValues[] = { 1,2,3, 4 }; /* ============================= positive semi-definite matrix ============================= */ /* the second matrix in csr format symmetric [ 1 0 0 0 ] [ 0 2 0 0 ] [ 0 0 3 0 ] [ 0 0 0 0 ] */ //int theSecondMatrixMetaInfoTwo[] = { 1,2,3,4,1 }; //int theSecondMatrixMetaInfoOne[] = { 1,2,3 }; //double theSecondMatrixValues[] = { 1.,2.,3. }; /* ========================================== positive semi-definite matrix numeric zero ========================================== */ /* the second matrix in csr format symmetric [ 1 0 0 0 ] [ 0 2 0 0 ] [ 0 0 3 0 ] [ 0 0 0 ~0 ] */ //int theSecondMatrixMetaInfoTwo[] = { 1,2,3,4,5 }; //int theSecondMatrixMetaInfoOne[] = { 1,2,3,4 }; //double theSecondMatrixValues[] = { 1,2, 3, 1e-15 }; /* ================ indefinte matrix ================ */ /* the second matrix in csr format symmetric [ 1 0 0 0 ] [ 0 2 0 0 ] [ 0 0 3 0 ] [ 0 0 0 -4] */ int theSecondMatrixMetaInfoTwo[] = { 1,2,3,4,5 }; int theSecondMatrixMetaInfoOne[] = { 1,2,3,4 }; double theSecondMatrixValues[] = { 1,2,3, -4 }; // the first matrix double* a = theFirstMatrixValues; int* ia = theFirstMatrixMetaInfoTwo; int* ja = theFirstMatrixMetaInfoOne; // the second matrix double* b = theSecondMatrixValues; int* ib = theSecondMatrixMetaInfoTwo; int* jb = theSecondMatrixMetaInfoOne; // sets all Extended Eigensolver parameters to their default values (defRev S. 1902) feastinit(fpm); /* check if matrix b is postiv definit */ fpm[27] = 1; dfeast_scsrgv( &uplo, &n, a, ia, ja, b, ib, jb, fpm, &epsout, &loop, &emin, &emax, &numberOfEigenValuesExpected, theEigenValues, theEigenVectors, &numberOfEigenValuesFound, theResidual, &info); switch (info) { case 0: break; case 202: printf("The MKL function 'dfeast_scsrgv': Problem with the size of the system n (n <= 0)"); return 1; case 201: printf("The MKL function 'dfeast_scsrgv': Problem with the initial subspace m0 (m0 <= 0 or m0 > n)"); return 1; case 200: printf("The MKL function 'dfeast_scsrgv': Problem with search interval emin, emax (emin = %f >= emax = %f)", emin, emax); return 1; case 4: printf("The MKL function 'dfeast_scsrgv': Successful return of only the computed subspace after call with fpm[13] = 1"); break; case 3: if (numberOfEigenValuesExpected < numberOfEigenValuesFound) { printf("The MKL function 'dfeast_scsrgv': Size of the subspace m0 is too small (m0 = %i < m = %i)", numberOfEigenValuesExpected, numberOfEigenValuesFound); printf("Please note that this internal error message from MKL may be to sensitive."); } break; case 2: printf("The MKL function 'dfeast_scsrgv': No convergence (number of itzeration loops > fpm[3])"); return 1; case 1: printf("The MKL function 'dfeast_scsrgv': No eigenvalue found in the search intervall"); return 1; case -1: printf("The MKL function 'dfeast_scsrgv': Internal error for memory allocation"); return 1; case -2: printf("The MKL function 'dfeast_scsrgv': Internal error of the inner system solver. Possible reasons: not enough memory for inner linear system solver or inconsistent input."); return 1; case -3: printf("The MKL function 'dfeast_scsrgv': Internal error of the reduced eigenvalue solver"); return 1; case -4: printf("The MKL function 'dfeast_scsrgv': Matrix B is not positive definite"); return 1; default: if (info < 0) { i = -(info + 100); printf("The MKL function 'dfeast_scsrgv': Problem with %i-th value of the input Extended Eigensolver parameter (fpm[%i - 1]). Only the parameters in use are checked.", i); } else { i = (info + 100); printf("The MKL function 'dfeast_scsrgv': Problem with %i-th value of the input Extended Eigensolver parameter (fpm[%i - 1]).", i); } return 1; } /* print evec */ printf("\nprinting: %s\n", "evec"); for (int iRow = 0; iRow < n; iRow++) { for (int iCol = 0; iCol < numberOfEigenValuesExpected; iCol++) { printf("%f\t", theEigenVectors[iCol + iRow * n]); } printf("\n"); } /* print eval */ printf("\nprinting: %s\n", "eval"); for (int iRow = 0; iRow < numberOfEigenValuesExpected; iRow++) { printf("\n%f\t", theEigenValues[iRow]); } int aa = 1; return 0; }