Skip to content
Snippets Groups Projects
Commit 44db1f6e authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Use C implamentation of complex numbers for LAPACK calls

parent bbb401dc
No related branches found
No related tags found
No related merge requests found
#include <complex> #include <complex>
#include <cstdlib> #include <complex.h>
#ifndef INCLUDE_LAPACK_CALLS_H_ #ifndef INCLUDE_LAPACK_CALLS_H_
#include "lapacke.h" #include "lapacke.h"
#include "../include/lapack_calls.h" #include "../include/lapack_calls.h"
#endif #endif
using namespace std;
void zinvert(std::complex<double> **mat, lapack_int n, int &jer) { void zinvert(std::complex<double> **mat, lapack_int n, int &jer) {
jer = 0; jer = 0;
__complex__ double *arr = new __complex__ double[n * n]; __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 i = 0; i < n; i++) {
for (lapack_int j = 0; j < n; j++) { for (lapack_int j = 0; j < n; j++) {
lapack_int idx = i + n * j; lapack_int idx = i + n * j;
...@@ -26,7 +24,7 @@ void zinvert(std::complex<double> **mat, lapack_int n, int &jer) { ...@@ -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 i = 0; i < n; i++) {
for (lapack_int j = 0; j < n; j++) { for (lapack_int j = 0; j < n; j++) {
lapack_int idx = i + 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; delete [] IPIV;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment