From 44db1f6ea2178cc2f003c0f7d4eae0db60daacae Mon Sep 17 00:00:00 2001
From: Giovanni La Mura <giovanni.lamura@inaf.it>
Date: Tue, 5 Mar 2024 15:00:03 +0100
Subject: [PATCH] Use C implamentation of complex numbers for LAPACK calls

---
 src/libnptm/lapack_calls.cpp | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/libnptm/lapack_calls.cpp b/src/libnptm/lapack_calls.cpp
index e22c5a84..b4cb88d7 100644
--- a/src/libnptm/lapack_calls.cpp
+++ b/src/libnptm/lapack_calls.cpp
@@ -1,17 +1,15 @@
 #include <complex>
-#include <cstdlib>
+#include <complex.h>
 
 #ifndef INCLUDE_LAPACK_CALLS_H_
 #include "lapacke.h"
 #include "../include/lapack_calls.h"
 #endif
 
-using namespace std;
-
 void zinvert(std::complex<double> **mat, lapack_int n, int &jer) {
   jer = 0;
   __complex__ double *arr = new __complex__ double[n * n];
-  const __complex__ double uim = 1.0di;
+  const __complex__ double uim = 1.0*I;
   for (lapack_int i = 0; i < n; i++) {
     for (lapack_int j = 0; j < n; j++) {
       lapack_int idx = i + n * j;
@@ -26,7 +24,7 @@ void zinvert(std::complex<double> **mat, lapack_int n, int &jer) {
   for (lapack_int i = 0; i < n; i++) {
     for (lapack_int j = 0; j < n; j++) {
       lapack_int idx = i + n * j;
-      mat[j][i] = complex<double>(__real__ arr[idx], __imag__ arr[idx]);
+      mat[j][i] = std::complex<double>(creal(arr[idx]), cimag(arr[idx]));
     }
   }
   delete [] IPIV;
-- 
GitLab