My project is about finding Q in QR decomposition for very large matrices (e.g. 500*500) in C++. I've started to use Lapack package recently and its especial function "dgeqrf". I started by a simple matrix as below in Code:blocks:
#include <iostream>
#include <lapacke.h>
using namespace std;
int main()
{
double a[6][2] = {{0,2},{2,-1},{2,-1},{0,1.5},{2,-1},{2,-1}};
int m=6;
int n=2;
int info = 0;
int lda = m;
int lwork = n;
double *work;
double *tau;
dgeqrf_(&m, &n, a, &lda, tau, work, &lwork, &info);
}
After running the code, I saw this error in "dgeqrf" line:
error: cannot convert 'double (*)[2]' to 'double*' for argument '3' to 'void dgeqrf_(int*, int*, double*, int*, double*, double*, int*, int*)'
Who can help me about this error?Do I have mistake in parameter definition?
Also, after running, how I can work with the Q matrix? Can I define a new matix double q[][]=dgeqrf(....)
and use it in my project?
I'm sorry if my question was very basic but I couldn't find the solution.
double a[12] = {0, 2, 2, 0, 2, 2, // row1
2,-1,-1,1.5,-1,-1}; // row2