You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

xpbtrf.c 847 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "test.h"
  2. datatype *A[2];
  3. int info[2];
  4. int n;
  5. void pre() {
  6. int i;
  7. x2matgen(n, n, A[0], A[1]);
  8. for (i = 0; i < n; i++) {
  9. // set diagonal
  10. A[0][x1 * (i + n * i)] =
  11. A[1][x1 * (i + n * i)] = (datatype) rand() / RAND_MAX;
  12. // set first row
  13. A[0][x1 * (n * i)] =
  14. A[1][x1 * (n * i)] = (datatype) rand() / RAND_MAX + n;
  15. }
  16. }
  17. void post() {
  18. error = x2vecerr(n * n, A[0], A[1]);
  19. }
  20. void tests() {
  21. A[0] = xmalloc(n * n);
  22. A[1] = xmalloc(n * n);
  23. #define ROUTINE XPREF(pbtrf)
  24. const int
  25. kd1 = n / 4,
  26. kd2 = n * 3 / 4;
  27. TEST("L", &n, &kd1, A[i], &n, &info[i]);
  28. TEST("L", &n, &kd2, A[i], &n, &info[i]);
  29. TEST("U", &n, &kd1, A[i] - x1 * kd1, &n, &info[i]);
  30. TEST("U", &n, &kd2, A[i] - x1 * kd2, &n, &info[i]);
  31. free(A[0]);
  32. free(A[1]);
  33. }