SVDX routine in LAPACKE 3.6

Open discussion regarding features, bugs, issues, vendors, etc.

SVDX routine in LAPACKE 3.6

Postby Klimrod » Wed Mar 30, 2016 11:15 am

Dear LAPACKE community,

I faced LAPACKE source for the first time and stuck in very first usage.
I run very simple code (see below) and trying you brand new svd functionality: sgesvdx.
But it does not work. All I see is output:
** On entry to SGESVDX parameter number 15 had an illegal value

Digging into code I could not see any logic in C/Fortran API compliance: at C level (LAPACKE_sgesvdx_work routine) there is a check for 'a' and 's' letters for jobu variable, while in Fortran (SGESVDX routine) it checks for 'v' and 'n'.

Could you please tell me if I miss something?

Thank you in advance,
Victor.

Code: Select all
#include <stdlib.h>
#include <stdio.h>
#include "lapacke.h"

/* Parameters */
#define N 500
#define NRHS 3
#define LDA 3000
#define LDB NRHS
#include <time.h>
/* Main program */
int mmm() {


   float *a = (float*)LAPACKE_malloc(LDA*N * sizeof(float));
   float *b = (float*)LAPACKE_malloc(LDB*N * sizeof(float));
   int maxDim = __max(LDA, N);
   int minDim = __min(LDA, N);
   float *eigenValues = (float*)LAPACKE_malloc(maxDim * sizeof(float));
   float *workAr = (float*)LAPACKE_malloc(maxDim * sizeof(float));

   float *eigenVectorsU = (float*)LAPACKE_malloc(maxDim*maxDim * sizeof(float));
   float *eigenVectorsV = (float*)LAPACKE_malloc(maxDim*maxDim * sizeof(float));

   for (int i = 0; i < LDA; i++)
   {
      for (int j = 0; j < N; j++)
      {
         a[j*LDA + i] = rand() / (float)RAND_MAX;
      }
   }

   for (int i = 0; i < minDim; i++)
   {
      eigenValues[i] = 0;
   }


   clock_t startTime = clock();
   int NS = LDA;
   LAPACKE_sgesvdx(LAPACK_ROW_MAJOR, 'V', 'V', 'A', (int)N, (int)LDA, a, (int)LDA, 0, 0, 0, 0, NS, eigenValues, eigenVectorsU, (int)maxDim, eigenVectorsV, (int)maxDim, workAr);
   float times = (clock() - (float)startTime) / CLOCKS_PER_SEC;
   printf("time = %f\n", times);

   LAPACKE_free(eigenValues);
   LAPACKE_free(a);
   LAPACKE_free(b);
   LAPACKE_free(workAr);
   LAPACKE_free(eigenVectorsU);
   LAPACKE_free(eigenVectorsV);
   exit(0);
}
Klimrod
 
Posts: 1
Joined: Wed Mar 30, 2016 11:04 am

Return to User Discussion

Who is online

Users browsing this forum: Bing [Bot] and 4 guests