xref: /libCEED/tests/t306-basis.c (revision d863ab9ba6a0d47c58445a35d35b36efba07fc93)
1 /// @file
2 /// Test QR Factorization
3 /// \test Test QR Factorization
4 #include <ceed.h>
5 #include <ceed-impl.h>
6 
7 int main(int argc, char **argv) {
8   Ceed ceed;
9   CeedScalar qr[12] = {1, -1, 4, 1, 4, -2, 1, 4, 2, 1, -1, 0};
10   CeedScalar tau[3];
11 
12   CeedInit(argv[1], &ceed);
13 
14   CeedQRFactorization(qr, tau, 4, 3);
15   for (int i=0; i<12; i++) {
16     if (qr[i] <= 1E-14 && qr[i] >= -1E-14) qr[i] = 0;
17     fprintf(stdout, "%12.8f\n", qr[i]);
18   }
19   for (int i=0; i<3; i++) {
20     if (tau[i] <= 1E-14 && qr[i] >= -1E-14) tau[i] = 0;
21     fprintf(stdout, "%12.8f\n", tau[i]);
22   }
23   CeedDestroy(&ceed);
24   return 0;
25 }
26