Browse Source

Add testcase from issue 2562

pull/3142/head
Martin Kroeker GitHub 5 years ago
parent
commit
a3c9caedf8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 42 additions and 0 deletions
  1. +42
    -0
      cpp_thread_test/dpotrf_bug2562.cpp

+ 42
- 0
cpp_thread_test/dpotrf_bug2562.cpp View File

@@ -0,0 +1,42 @@
#include <string.h>
#include <math.h>
#include <string>

#ifdef __cplusplus
extern "C" {
#endif

void dpotrf_(const char *uplo, const int *n, double *a, const int *lda,
int *info);

#ifdef __cplusplus
}
#endif

int main(void)
{
const size_t n = 32768;
// Create positive definite N X N matrix
double *A = static_cast<double *>(malloc (n * n *sizeof(double)));
for (size_t i = 0; i < n; i++) {
for (size_t j = 0; j < n; j++) {
if (j == i) {
A[i * n + j] = n - 1;
} else {
A[i * n + j] = 1;
}
}
}
// Factorize
const char *uplo = "U";
const int int_n = static_cast<int>(n);
int info;
dpotrf_(uplo, &int_n, A, &int_n, &info);

// Free matrix
free(A);
return 0;
}

Loading…
Cancel
Save