diff options
author | torset | 2008-11-13 10:19:42 +0000 |
---|---|---|
committer | torset | 2008-11-13 10:19:42 +0000 |
commit | 8b3e28e3007c2105035da2b0140ee91a75768fd1 (patch) | |
tree | d7b35834173ec3bed7b3d40dd6b2779eeddf009c /src/matrixOperations | |
parent | fbb4b7c8d67e1e6a98bce659ab5ec18fd3362d13 (diff) | |
download | scilab2c-8b3e28e3007c2105035da2b0140ee91a75768fd1.tar.gz scilab2c-8b3e28e3007c2105035da2b0140ee91a75768fd1.tar.bz2 scilab2c-8b3e28e3007c2105035da2b0140ee91a75768fd1.zip |
Delete files cause have been rename
Diffstat (limited to 'src/matrixOperations')
-rw-r--r-- | src/matrixOperations/division/cldiva.c | 67 | ||||
-rw-r--r-- | src/matrixOperations/division/crdiva.c | 65 | ||||
-rw-r--r-- | src/matrixOperations/division/dldiva.c | 115 | ||||
-rw-r--r-- | src/matrixOperations/division/drdiva.c | 132 | ||||
-rw-r--r-- | src/matrixOperations/division/sldiva.c | 63 | ||||
-rw-r--r-- | src/matrixOperations/division/srdiva.c | 65 | ||||
-rw-r--r-- | src/matrixOperations/division/zldiva.c | 123 | ||||
-rw-r--r-- | src/matrixOperations/division/zrdiva.c | 155 |
8 files changed, 0 insertions, 785 deletions
diff --git a/src/matrixOperations/division/cldiva.c b/src/matrixOperations/division/cldiva.c deleted file mode 100644 index 26b2d188..00000000 --- a/src/matrixOperations/division/cldiva.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab - * Copyright (C) 2008-2008 - INRIA - Allan SIMON - * - * This file must be used under the terms of the CeCILL. - * This source file is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at - * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - * - */ - - -/**** WARNING NOT WORK AT ALL FOR THE MOMENT ***/ -/**** Because of problem of conversion float-> double ****/ -#include "matrixDivision.h" -#include "lapack.h" -#include <string.h> -#include <stdio.h> - - -void cldiva ( floatComplex* in1, int lines1, int columns1 , - floatComplex* in2, int lines2, int columns2 , - floatComplex* out ){ - - int i = 0 ; - /* these 3 variable are created to permit to use the value in the fortran functions - because they need doubleComplex matrix as arguments and we can't cast directly the pointers - without having problems , i know that's ugly */ - doubleComplex *dblin1 = NULL; - doubleComplex *dblin2 = NULL; - doubleComplex *dblout = NULL; - - - - /* Array allocations*/ - dblin1 = (doubleComplex*)malloc(sizeof(doubleComplex) * (unsigned int)columns1 * (unsigned int)lines1); - dblin2 = (doubleComplex*)malloc(sizeof(doubleComplex) * (unsigned int)columns2 * (unsigned int)lines2); - dblout = (doubleComplex*)malloc(sizeof(doubleComplex) * (unsigned int)lines1 * (unsigned int)lines2); - - - - /*copy and cast all the floatComplex value into doubleComplex value */ - for ( i = 0 ; i < lines1 * columns1 ; i ++ ) - { - dblin1[i] = DoubleComplex ( (double) creals( in1[i]) , (double) cimags ( in1[i])) ; - } - - for ( i = 0 ; i < lines2 * columns2 ; i ++ ) - { - dblin2[i] = DoubleComplex ( (double) creals( in2[i]) , (double) cimags ( in2[i])) ; - } - - zldiva( dblin1 , lines1 , columns1 , dblin2 , lines2 , columns2 , dblout ); - - - for ( i = 0 ; i < min(lines2,columns2) * lines1 ; i++ ) - { - out[i] = FloatComplex ((float) zreals ( dblout[i]) , (float) zimags ( dblout[i])) ; - - } - - free ( dblin1); - free ( dblin2); - free ( dblout); - -} diff --git a/src/matrixOperations/division/crdiva.c b/src/matrixOperations/division/crdiva.c deleted file mode 100644 index 6b174d3c..00000000 --- a/src/matrixOperations/division/crdiva.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab - * Copyright (C) 2008-2008 - INRIA - Allan SIMON - * - * This file must be used under the terms of the CeCILL. - * This source file is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at - * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - * - */ - - - -#include "matrixDivision.h" -#include "lapack.h" -#include <string.h> -#include <stdio.h> - -void crdiva ( floatComplex* in1, int lines1, int columns1 , - floatComplex* in2, int lines2, int columns2 , - floatComplex* out ){ - - int i = 0 ; - /* these 3 variable are created to permit to use the value in the fortran functions - because they need doubleComplex matrix as arguments and we can't cast directly the pointers - without having problems , i know that's ugly */ - doubleComplex *dblin1 = NULL; - doubleComplex *dblin2 = NULL; - doubleComplex *dblout = NULL; - - - - /* Array allocations*/ - dblin1 = (doubleComplex*)malloc(sizeof(doubleComplex) * (unsigned int)columns1 * (unsigned int)lines1); - dblin2 = (doubleComplex*)malloc(sizeof(doubleComplex) * (unsigned int)columns2 * (unsigned int)lines2); - dblout = (doubleComplex*)malloc(sizeof(doubleComplex) * (unsigned int)lines1 * (unsigned int)lines2); - - - - /*copy and cast all the floatComplex value into doubleComplex value */ - for ( i = 0 ; i < lines1 * columns1 ; i ++ ) - { - dblin1[i] = DoubleComplex ( (double) creals( in1[i]) , (double) cimags ( in1[i])) ; - } - - for ( i = 0 ; i < lines2 * columns2 ; i ++ ) - { - dblin2[i] = DoubleComplex ( (double) creals( in2[i]) , (double) cimags ( in2[i])) ; - } - - zrdiva( dblin1 , lines1 , columns1 , dblin2 , lines2 , columns2 , dblout ); - - - for ( i = 0 ; i < min(lines2,columns2) * lines1 ; i++ ) - { - out[i] = FloatComplex ((float) zreals ( dblout[i]) , (float) zimags ( dblout[i])) ; - - } - - free ( dblin1); - free ( dblin2); - free ( dblout); - -} diff --git a/src/matrixOperations/division/dldiva.c b/src/matrixOperations/division/dldiva.c deleted file mode 100644 index 86d155fc..00000000 --- a/src/matrixOperations/division/dldiva.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab - * Copyright (C) 2008-2008 - INRIA - Allan SIMON - * - * This file must be used under the terms of the CeCILL. - * This source file is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at - * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - * - */ - - - - -#include "matrixDivision.h" -#include "lapack.h" -#include <stdio.h> -#include <string.h> - -void dldiva (double* in1, int lines1, int columns1 , - double* in2, int lines2, int columns2 , - double* out ){ - - - char cNorm = 0; - int iExit = 0; - - /*temporary variables*/ - int iWork = 0; - int iInfo = 0; - int iMax = 0; - double dblRcond = 0; - - double dblEps = 0; - double dblAnorm = 0; - - double *pAf = NULL; - double *pXb = NULL; - double *pDwork = NULL; - - int *pRank = NULL; - int *pIpiv = NULL; - int *pJpvt = NULL; - int *pIwork = NULL; - - iWork = max(4 * columns1, max(min(lines1, columns1) + 3 * lines1 + 1, 2 * min(lines1, columns1) + columns2)); - - - - - /* Array allocations*/ - pAf = (double*)malloc(sizeof(double) * (unsigned int) lines1 * (unsigned int) columns1); - pXb = (double*)malloc(sizeof(double) * (unsigned int) max(lines1,columns1) * (unsigned int) columns1); - - pRank = (int*)malloc(sizeof(int)); - pIpiv = (int*)malloc(sizeof(int) *(unsigned int) columns1); - pJpvt = (int*)malloc(sizeof(int) *(unsigned int) columns1); - pIwork = (int*)malloc(sizeof(int) *(unsigned int) columns1); - - - - cNorm = '1'; - pDwork = (double*)malloc(sizeof(double) *(unsigned int)iWork); - dblEps = getRelativeMachinePrecision() ; - - dblAnorm = dlange_(&cNorm, &lines1, &columns1, in1, &lines1, pDwork); - - if(lines1 == columns1) - { - cNorm = 'F'; - dlacpy_(&cNorm, &columns1, &columns1, in1, &columns1, pAf, &columns1); - dgetrf_(&columns1, &columns1, pAf, &columns1, pIpiv, &iInfo); - if(iInfo == 0) - { - cNorm = '1'; - C2F(dgecon)(&cNorm, &columns1, pAf, &columns1, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); - if(dblRcond > sqrt(dblEps)) - { - cNorm = 'N'; - C2F(dgetrs)(&cNorm, &columns1, &columns2, pAf, &columns1, pIpiv, in2, &columns1, &iInfo); - cNorm = 'F'; - C2F(dlacpy)(&cNorm, &columns1, &columns2, in2, &columns1, out, &columns1); - iExit = 1; - } - } - - } - - if(iExit == 0) - { - dblRcond = sqrt(dblEps); - cNorm = 'F'; - iMax = max(lines1, columns1); - C2F(dlacpy)(&cNorm, &lines1, &columns2, in2, &lines2, pXb, &iMax); - memset(pJpvt, 0x00,(unsigned int) sizeof(int) * (unsigned int) columns1); - C2F(dgelsy)( &lines1, &columns1, &columns2, in1, &lines1, pXb, &iMax, - pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); - - if(iInfo == 0) - { - - cNorm = 'F'; - C2F(dlacpy)(&cNorm, &columns1, &columns2, pXb, &iMax, out, &columns1); - } - } - - free(pAf); - free(pXb); - free(pRank); - free(pIpiv); - free(pJpvt); - free(pIwork); - free(pDwork); -} diff --git a/src/matrixOperations/division/drdiva.c b/src/matrixOperations/division/drdiva.c deleted file mode 100644 index e062ad58..00000000 --- a/src/matrixOperations/division/drdiva.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab - * Copyright (C) 2008-2008 - INRIA - Allan SIMON - * - * This file must be used under the terms of the CeCILL. - * This source file is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at - * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - * - */ - -#include "matrixDivision.h" -#include "lapack.h" -#include <string.h> -#include <stdio.h> - - - -void drdiva ( double * in1, int lines1, int columns1, - double * in2, int lines2, int columns2, - double * out){ - - char cNorm = 0; - int iExit = 0; - - /*temporary variables*/ - int iWork = 0; - int iInfo = 0; - int iMax = 0; - double dblRcond = 0; - - double dblEps = 0; - double dblAnorm = 0; - - double *pAf = NULL; - double *pAt = NULL; - double *pBt = NULL; - double *pDwork = NULL; - - int *pRank = NULL; - int *pIpiv = NULL; - int *pJpvt = NULL; - int *pIwork = NULL; - - iWork = max(4 * columns2, max(min(lines2, columns2) + 3 * lines2 + 1, 2 * min(lines2, columns2) + lines1)); - - - /* Array allocations*/ - pAf = (double*)malloc(sizeof(double) * (unsigned int)columns2 * (unsigned int)lines2); - pAt = (double*)malloc(sizeof(double) * (unsigned int)columns2 *(unsigned int) lines2); - pBt = (double*)malloc(sizeof(double) * (unsigned int)max(lines2,columns2) * (unsigned int)lines1); - - pRank = (int*)malloc(sizeof(int)); - pIpiv = (int*)malloc(sizeof(int) * (unsigned int)columns2); - pJpvt = (int*)malloc(sizeof(int) * (unsigned int)lines2); - pIwork = (int*)malloc(sizeof(int) * (unsigned int)columns2); - - - cNorm = '1'; - pDwork = (double*)malloc(sizeof(double) * (unsigned int)iWork); - dblEps = getRelativeMachinePrecision() ; - dblAnorm = dlange_(&cNorm, &lines2, &columns1, in2, &lines2, pDwork); - - /*tranpose A and B*/ - - dtransposea(in2, lines2, columns2, pAt); - dtransposea(in1, lines1, columns2, pBt); - - if(lines2 == columns2) - { - cNorm = 'F'; - dlacpy_(&cNorm, &columns2, &columns2, pAt, &columns2, pAf, &columns2); - dgetrf_(&columns2, &columns2, pAf, &columns2, pIpiv, &iInfo); - if(iInfo == 0) - { - cNorm = '1'; - dgecon_(&cNorm, &columns2, pAf, &columns2, &dblAnorm, &dblRcond, pDwork, pIwork, &iInfo); - if(dblRcond > sqrt(dblEps)) - { - cNorm = 'N'; - dgetrs_(&cNorm, &columns2, &lines1, pAf, &columns2, pIpiv, pBt, &columns2, &iInfo); - dtransposea(pBt, columns2, lines1, out); - iExit = 1; - } - } - - } - - if(iExit == 0) - { - dblRcond = sqrt(dblEps); - cNorm = 'F'; - iMax = max(lines2, columns2); - memset(pJpvt, 0x00, (unsigned int)sizeof(int) * (unsigned int)lines2); - dgelsy_(&columns2, &lines2, &lines1, pAt, &columns2, pBt, &iMax, - pJpvt, &dblRcond, &pRank[0], pDwork, &iWork, &iInfo); - - if(iInfo == 0) - { - - - /* TransposeRealMatrix(pBt, lines1, lines2, out, Max(lines1,columns1), lines2);*/ - - /*Mega caca de la mort qui tue des ours a mains nues - mais je ne sais pas comment le rendre "beau" :(*/ - { - int i,j,ij,ji; - for(j = 0 ; j < lines2 ; j++) - { - for(i = 0 ; i < lines1 ; i++) - { - ij = i + j * lines1; - ji = j + i * max(lines2, columns2); - out[ij] = pBt[ji]; - } - } - } - } - } - - free(pAf); - free(pAt); - free(pBt); - free(pRank); - free(pIpiv); - free(pJpvt); - free(pIwork); - free(pDwork); - -} - diff --git a/src/matrixOperations/division/sldiva.c b/src/matrixOperations/division/sldiva.c deleted file mode 100644 index 1f5191b5..00000000 --- a/src/matrixOperations/division/sldiva.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab - * Copyright (C) 2008-2008 - INRIA - Allan SIMON - * - * This file must be used under the terms of the CeCILL. - * This source file is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at - * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - * - */ - - -#include "matrixDivision.h" -#include "lapack.h" -#include <string.h> -#include <stdio.h> -void sldiva ( float* in1, int lines1, int columns1 , - float* in2, int lines2, int columns2 , - float* out ){ - - int i = 0 ; - /* these 3 variable are created to permit to use the value in the fortran functions - because they need double matrix as arguments and we can't cast directly the pointers - without having problems , i know that's ugly */ - double *dblin1 = NULL; - double *dblin2 = NULL; - double *dblout = NULL; - - - - /* Array allocations*/ - dblin1 = (double*)malloc(sizeof(double) * (unsigned int)columns1 * (unsigned int)lines1); - dblin2 = (double*)malloc(sizeof(double) * (unsigned int)columns2 * (unsigned int)lines2); - dblout = (double*)malloc(sizeof(double) * (unsigned int)lines1 * (unsigned int)lines2); - - - - /*copy and cast all the float value into double value */ - for ( i = 0 ; i < lines1 * columns1 ; i ++ ) - { - dblin1[i] = (double) in1[i] ; - } - - for ( i = 0 ; i < lines2 * columns2 ; i ++ ) - { - dblin2[i] = (double) in2[i] ; - } - - dldiva( dblin1 , lines1 , columns1 , dblin2 , lines2 , columns2 , dblout ); - - - for ( i = 0 ; i < min(lines2,columns2) * lines1 ; i++ ) - { - out[i] = (float) dblout[i] ; - - } - - free ( dblin1); - free ( dblin2); - free ( dblout); - -} diff --git a/src/matrixOperations/division/srdiva.c b/src/matrixOperations/division/srdiva.c deleted file mode 100644 index 3aaa67df..00000000 --- a/src/matrixOperations/division/srdiva.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab - * Copyright (C) 2008-2008 - INRIA - Allan SIMON - * - * This file must be used under the terms of the CeCILL. - * This source file is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at - * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - * - */ - - -/**** WARNING NOT WORK AT ALL FOR THE MOMENT ***/ -/**** Because of problem of conversion float-> double ****/ -#include "matrixDivision.h" -#include "lapack.h" -#include <string.h> -#include <stdio.h> -void srdiva ( float* in1, int lines1, int columns1 , - float* in2, int lines2, int columns2 , - float* out ){ - - int i = 0 ; - /* these 3 variable are created to permit to use the value in the fortran functions - because they need double matrix as arguments and we can't cast directly the pointers - without having problems , i know that's ugly */ - double *dblin1 = NULL; - double *dblin2 = NULL; - double *dblout = NULL; - - - - /* Array allocations*/ - dblin1 = (double*)malloc(sizeof(double) * (unsigned int)columns1 * (unsigned int)lines1); - dblin2 = (double*)malloc(sizeof(double) * (unsigned int)columns2 * (unsigned int)lines2); - dblout = (double*)malloc(sizeof(double) * (unsigned int)lines1 * (unsigned int)lines2); - - - - /*copy and cast all the float value into double value */ - for ( i = 0 ; i < lines1 * columns1 ; i ++ ) - { - dblin1[i] = (double) in1[i] ; - } - - for ( i = 0 ; i < lines2 * columns2 ; i ++ ) - { - dblin2[i] = (double) in2[i] ; - } - - drdiva( dblin1 , lines1 , columns1 , dblin2 , lines2 , columns2 , dblout ); - - - for ( i = 0 ; i < min(lines2,columns2) * lines1 ; i++ ) - { - out[i] = (float) dblout[i] ; - - } - - free ( dblin1); - free ( dblin2); - free ( dblout); - -} diff --git a/src/matrixOperations/division/zldiva.c b/src/matrixOperations/division/zldiva.c deleted file mode 100644 index 35636ca4..00000000 --- a/src/matrixOperations/division/zldiva.c +++ /dev/null @@ -1,123 +0,0 @@ - -/* - * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab - * Copyright (C) 2008-2008 - INRIA - Allan SIMON - * - * This file must be used under the terms of the CeCILL. - * This source file is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at - * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - * - */ - - -#include "matrixDivision.h" -#include "string.h" - -void zldiva( doubleComplex* in1, int lines1, int columns1 , - doubleComplex* in2, int lines2, int columns2 , - doubleComplex* out ) -{ - - - char cNorm = 0; - int iExit = 0; - - /*temporary variables*/ - int iWork = 0; - int iInfo = 0; - int iMax = 0; - int iRank = 0; - - double dblRcond = 0; - - double dblEps = 0; - double dblAnorm = 0; - - doubleComplex *pAf = NULL; - doubleComplex *pXb = NULL; - doubleComplex *pDwork = NULL; - - - double *pRwork = NULL; - - - int *pIpiv = NULL; - int *pJpvt = NULL; - - iWork = max(2*columns2, min(lines2, columns2) + max(2 * min(lines2, columns2), max(lines2 + 1, min(lines2, columns2) + lines1))); - - - - /* Array allocations*/ - - - pAf = (doubleComplex*)malloc(sizeof(doubleComplex) *(unsigned int) lines1 *(unsigned int)columns1); - pXb = (doubleComplex*)malloc(sizeof(doubleComplex) *(unsigned int) max(lines1,columns1) *(unsigned int) columns2); - - - pIpiv = (int*)malloc(sizeof(int) * (unsigned int)columns1); - pJpvt = (int*)malloc(sizeof(int) * (unsigned int)columns1); - pRwork = (double*)malloc(sizeof(double) * (unsigned int)columns1*2); - - - cNorm = '1'; - pDwork = (doubleComplex*)malloc(sizeof(doubleComplex) * (unsigned int)iWork); - dblEps = getRelativeMachinePrecision() ; - dblAnorm = C2F(zlange)(&cNorm, &lines1, &columns1, in1, &lines1, pDwork); - - if(lines1 == columns1) - { - cNorm = 'F'; - C2F(zlacpy)(&cNorm, &columns1, &columns1, in1, &columns1, pAf, &columns1); - C2F(zlacpy)(&cNorm, &columns1, &columns2, in2, &columns1, pXb, &columns1); - C2F(zgetrf)(&columns1, &columns1, pAf, &columns1, pIpiv, &iInfo); - if(iInfo == 0) - { - cNorm = '1'; - C2F(zgecon)(&cNorm, &columns1, pAf, &columns1, &dblAnorm, &dblRcond, pDwork, pRwork, &iInfo); - if(dblRcond > sqrt(dblEps)) - { - cNorm = 'N'; - C2F(zgetrs)(&cNorm, &columns1, &columns2, pAf, &columns1, pIpiv, pXb, &columns1, &iInfo); - cNorm = 'F'; - C2F(zlacpy)(&cNorm, &columns1, &columns2, pXb, &columns1, out, &columns1); - - iExit = 1; - } - - } - } - - if(iExit == 0) - { - dblRcond = sqrt(dblEps); - cNorm = 'F'; - iMax = max(lines1, columns1); - C2F(zlacpy)(&cNorm, &lines1, &columns2, in2, &lines1, pXb, &iMax); - memset(pJpvt, 0x00,(unsigned int) sizeof(int) * (unsigned int)columns1); - C2F(zgelsy)( &lines1, &columns1, &columns2, in1, &lines1, pXb, &iMax, - pJpvt, &dblRcond, &iRank, pDwork, &iWork, pRwork, &iInfo); - - if(iInfo == 0) - { - - cNorm = 'F'; - C2F(zlacpy)(&cNorm, &columns1, &columns2, pXb, &iMax, out, &columns1); - - } - } - - - - - - free(pAf); - free(pXb); - free(pIpiv); - free(pJpvt); - free(pRwork); - free(pDwork); - -} diff --git a/src/matrixOperations/division/zrdiva.c b/src/matrixOperations/division/zrdiva.c deleted file mode 100644 index 3799ee19..00000000 --- a/src/matrixOperations/division/zrdiva.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab - * Copyright (C) 2008-2008 - INRIA - Allan SIMON - * - * This file must be used under the terms of the CeCILL. - * This source file is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at - * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - * - */ - -#include "matrixDivision.h" - -#include <stdio.h> -#include <string.h> - -void zrdiva( doubleComplex* in1, int lines1, int columns1 , - doubleComplex* in2, int lines2, int columns2 , - doubleComplex* out ) -{ - - char cNorm = 0; - int iExit = 0; - - /*temporary variables*/ - int iWork = 0; - int iInfo = 0; - int iMax = 0; - double dblRcond = 0; - - double dblEps = 0; - double dblAnorm = 0; - - - doubleComplex *poAf = NULL; - doubleComplex *poAt = NULL; - doubleComplex *poBt = NULL; - doubleComplex *poDwork = NULL; - - int *pRank = NULL; - int *pIpiv = NULL; - int *pJpvt = NULL; - double *pRwork = NULL; - - iWork = max(2*columns2, min(lines2, columns2) + max(2 * min(lines2, columns2), max(lines2 + 1, min(lines2, columns2) + lines1))); - - - - /* Array allocations*/ - - - poAf = (doubleComplex*)malloc(sizeof(doubleComplex) *(unsigned int) lines2 *(unsigned int) columns2); - poAt = (doubleComplex*)malloc(sizeof(doubleComplex) * (unsigned int)lines2 *(unsigned int) columns2); - poBt = (doubleComplex*)malloc(sizeof(doubleComplex) *(unsigned int) max(lines2, columns2) *(unsigned int) lines1); - - pRank = (int*)malloc(sizeof(int)); - pIpiv = (int*)malloc(sizeof(int) *(unsigned int) columns2); - pJpvt = (int*)malloc(sizeof(int) *(unsigned int) lines2); - pRwork = (double*)malloc(sizeof(double) * 2 *(unsigned int) lines2); - - - - cNorm = '1'; - poDwork = (doubleComplex*)malloc(sizeof(doubleComplex) *(unsigned int) iWork); - dblEps = getRelativeMachinePrecision() ; - dblAnorm = C2F(zlange)(&cNorm, &lines2, &columns2, in2, &lines2, poDwork); - - /* hermitian tranpose A (transpose + conjugate )*/ - - ztransposea(in2, lines2, columns2, poAt); - zconja ( poAt , lines2*columns2 , poAt ); - { - int i,j,ij,ji; - for(j = 0 ; j < lines1 ; j++) - { - for(i = 0 ; i < columns2 ; i++) - { - ij = i + j * max(lines2, columns2); - ji = j + i * lines1; - - poBt[ij] = DoubleComplex (zreals ( in1[ji] ) , - zimags ( in1[ji] ) ); - } - } - } - - if(lines2 == columns2) - { - cNorm = 'F'; - C2F(zlacpy)(&cNorm, &columns2, &columns2, poAt, &columns1, poAf, &columns2); - C2F(zgetrf)(&columns2, &columns2, poAf, &columns2, pIpiv, &iInfo); - if(iInfo == 0) - { - cNorm = '1'; - C2F(zgecon)(&cNorm, &columns2, poAf, &columns2, &dblAnorm, - &dblRcond, poDwork, pRwork, &iInfo); - if(dblRcond > sqrt(dblEps)) - { - cNorm = 'N'; - C2F(zgetrs)(&cNorm, &columns2, &lines1, poAf, &columns2, pIpiv, poBt, &columns2, &iInfo); - ztransposea(poBt, columns2, lines2, out); - - iExit = 1; - } - } - - } - - if(iExit == 0) - { - dblRcond = sqrt(dblEps); - cNorm = 'F'; - iMax = max(lines2, columns2); - - memset(pJpvt, 0x00,(unsigned int) sizeof(int) *(unsigned int) lines2); - C2F(zgelsy)(&columns2, &lines2, &lines1, poAt, &columns2, poBt, &iMax, - pJpvt, &dblRcond, &pRank[0], poDwork, &iWork, pRwork, &iInfo); - - if(iInfo == 0) - { - - /*// TransposeRealMatrix(pBt, lines1, lines2, _pdblRealOut, Max(lines1,columns1), lines2); - - //Mega caca de la mort qui tue des ours a mains nues - //mais je ne sais pas comment le rendre "beau" :(*/ - { - int i,j,ij,ji; - for(j = 0 ; j < lines2 ; j++) - { - for(i = 0 ; i < lines1 ; i++) - { - ij = i + j * lines1; - ji = j + i * max(lines2, columns2); - out[ij] = DoubleComplex ( zreals( poBt[ji]) , -zimags ( poBt[ji])); - printf ( "\n\t\t\t<debug>%e + %e\n " , zreals( poBt[ji]) , -zimags ( poBt[ji])); - } - } - } - } - } - - - - free(poAf); - free(poAt); - free(poBt); - free(pRank); - free(pIpiv); - free(pJpvt); - free(pRwork); - free(poDwork); - -} - - |