From 92d3899c14d576c20762d7860f5e2f137923da0c Mon Sep 17 00:00:00 2001 From: torset Date: Mon, 16 Feb 2009 15:29:51 +0000 Subject: Miscellanous change - Major change : change size by rows for more comprehension --- src/matrixOperations/logm/zlogma.c | 83 +++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 32 deletions(-) (limited to 'src/matrixOperations/logm/zlogma.c') diff --git a/src/matrixOperations/logm/zlogma.c b/src/matrixOperations/logm/zlogma.c index 37516822..5a10151e 100644 --- a/src/matrixOperations/logm/zlogma.c +++ b/src/matrixOperations/logm/zlogma.c @@ -19,8 +19,9 @@ #include "matrixTranspose.h" #include "matrixInversion.h" #include "max.h" +#include "conj.h" -void zlogma (doubleComplex* in, int size, doubleComplex* out){ +void zlogma (doubleComplex* in, int rows, doubleComplex* out){ /* Algo : */ /* trouver les valeurs propres vp */ @@ -31,54 +32,67 @@ void zlogma (doubleComplex* in, int size, doubleComplex* out){ int i; doubleComplex *eigenvalues, *eigenvectors, *tmp; - int symetrique = 0; + int hermitienne = 0; int info = 0; /* Used by LAPACK */ int iWorkSize = 0; /* Used by LAPACK */ doubleComplex *pdblWork = NULL; /* Used by LAPACK */ doubleComplex *pdblRWork = NULL; /* Used by LAPACK */ doubleComplex * pdblLeftvectors = NULL; /* Used by LAPACK */ - doubleComplex * inCopy = NULL; /* Used by LAPACK */ /* Data initialization */ - eigenvalues = malloc((uint)(size*size)*sizeof(doubleComplex)); - eigenvectors = malloc((uint)(size*size)*sizeof(doubleComplex)); - tmp = malloc((uint)(size*size)*sizeof(doubleComplex)); - iWorkSize = max(1,2*size); + eigenvalues = malloc((uint)(rows*rows)*sizeof(doubleComplex)); + eigenvectors = malloc((uint)(rows*rows)*sizeof(doubleComplex)); + tmp = malloc((uint)(rows*rows)*sizeof(doubleComplex)); + iWorkSize = max(1,2*rows); pdblWork = malloc((uint)(iWorkSize)*sizeof(doubleComplex)); - pdblRWork = malloc((uint)(2*size)*sizeof(doubleComplex)); - inCopy = malloc((uint)(size*size)*sizeof(doubleComplex)); + pdblRWork = malloc((uint)(2*rows)*sizeof(doubleComplex)); + /* Copy in in inCopy */ - for (i=0;i=0;i--) { + /* on le fait en descendant sinon on écrase l'element 0 alors qu'il doit etre réutilisé + ---> erreur */ + if ( ((i+i*rows)/rows)%2 == 0) + eigenvalues[i*rows+i] = DoubleComplex(zreals(eigenvalues[(i*rows+i)/(2*rows)]),0); + else eigenvalues[i*rows+i] = DoubleComplex(zimags(eigenvalues[(i*rows+i)/(2*rows)]),0); + } + for (i=1;i