c - culagesvd() in CULA -


i want use culadgesvd() function compute svd matrix. not clear me how use in c/c++ info in documentation. give me complete small c program, template, show how function used? couple of lines (with stuff culainitialize() , culashutdown()) do, need see how function can run without error.

i thought svd not included in free version (it though). below example qr decomposition. put in .cpp file:

#include<cula.h> #include<iostream>  int main() {            float x[] = {1, 2, 3, 4};     int n_rows = 2, n_cols = 2;     float scale[n_cols];      culainitialize();        culasgeqrf(n_rows, n_cols, &(x[0]), n_rows, &(scale[0]));     culashutdown();      for(int ii = 1; ii < n_rows; ii++)     {         for(int jj = 0; jj < n_cols; jj++)         {             if(ii > jj) { x[ii + jj * n_rows] *= scale[jj]; }         }     }      for(int ii = 0; ii < n_rows * n_cols; ii++)     {         std::cout << x[ii] << std::endl;     }      return 0; } 

and compile using:

g++ -fpic -c -i/usr/local/cula/include -wl,-rpath,/usr/local/cula/lib64 -l/usr/local/cula/lib64 -lcula_lapack_basic gpuqr.cpp g++ -o gpuqr gpuqr.o -wl,-rpath,/usr/local/cula/lib64 -l/usr/local/cula/lib64 -lcula_lapack_basic 

then call program using:

./gpuqr -2.23607 0.894427 -4.91935 -0.894427 

check post cula , rcpp here.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -