Hey,
I am experiencing some small troubles with dgesvd_ when I am trying to compute the "economical" version of the SVD (JOBU=S,JOBVT=S).
The code works just fine when I allocate the fullsize arrays (NxN and MxM ) but fails when the arrays are allocated just to their needed size (Visual studio complains of a heap corruption).
I was wondering if you could give me some pointers as to what I am doing wrong.
I am also attaching the xcode in question
=========================================
void svdtest()
{
long m=3,n=8;
////////////////
char JOBU[1]={'S'}, JOBVT[1]={'S'};
double *u=new double[m*min(m,n)];
double *v=new double[min(m,n)*n];
double *s=new double[min(m,n)];
double *work;
long info,lwork=100000;
work=new double[lwork];
/////////////////
double *mat=new double[m*n];
for (int i=0;i<m;i++)
for (int j=0;j<n;j++)
mat[i*n+j]=i+j+1;
/////////////////////
dgesvd_(JOBU, JOBVT, &m, &n, mat, &m, s,u, &m,v,&n, work,&lwork, &info);
delete[] u;
delete[] v;
delete[] s;
delete[] work;
///////////////////
delete[] mat;
}

