Skip to content

Instantly share code, notes, and snippets.

@blakejohnson
Forked from xianyi/test_dgeqrt3_int64.c
Last active December 27, 2015 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blakejohnson/7356904 to your computer and use it in GitHub Desktop.
Save blakejohnson/7356904 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
extern void dgeqrt3_(long * m, long *n, double * a, long *lda, double *t, long *ldt, long*info);
int main(int argc, char**argv)
{
int in, i;
long n,info=1;
int ct;
double * a, *t;
if(argc<=2){
printf("Please input n and count\n");
exit(1);
}
in=atoi(argv[1]);
ct=atoi(argv[2]);
n=in;
a=(double*)malloc(n*n*sizeof(double));
t=(double*)malloc(n*n*sizeof(double));
srand((unsigned)time(NULL));
for (i=0; i<n*n; i++){
a[i] = (rand()%100)/10.0;
t[i]=0.0;
}
if(a==NULL || t==NULL){
printf("memory alloc error!\n");
exit(1);
}
for (i = 0; i < ct; i++) {
dgeqrt3_(&n, &n, a, &n, t, &n, &info);
if (i % 10 == 0) printf("Iteration %d\n", i);
}
printf("%ld\n",info);
free(a);
free(t);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment