diff options
author | simon | 2008-07-29 08:05:04 +0000 |
---|---|---|
committer | simon | 2008-07-29 08:05:04 +0000 |
commit | ea392df771cf9aa7acd7ec8b38dad404fd72bfa9 (patch) | |
tree | 094a624fc6a123d75c48786b07c07db748cf619c /src | |
parent | 96d72e22c73a591f924a3b334658cc7edb28dda1 (diff) | |
download | scilab2c-ea392df771cf9aa7acd7ec8b38dad404fd72bfa9.tar.gz scilab2c-ea392df771cf9aa7acd7ec8b38dad404fd72bfa9.tar.bz2 scilab2c-ea392df771cf9aa7acd7ec8b38dad404fd72bfa9.zip |
added missing files
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/Makefile.in | 2 | ||||
-rwxr-xr-x | src/configure | 5 | ||||
-rw-r--r-- | src/configure.ac | 3 | ||||
-rw-r--r-- | src/elementaryFunctions/includes/conj.h | 26 | ||||
-rw-r--r-- | src/includes/lapack.h | 24 | ||||
-rw-r--r-- | src/lib/lapack/zgelsy.f | 16 | ||||
-rw-r--r-- | src/matrixOperations/division/zldiva.c | 121 | ||||
-rw-r--r-- | src/matrixOperations/includes/hilbert.h | 34 | ||||
-rw-r--r-- | src/statisticsFunctions/Makefile.am | 3 | ||||
-rw-r--r-- | src/statisticsFunctions/Makefile.in | 3 |
11 files changed, 211 insertions, 28 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 74314a41..72021f9f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,4 +18,4 @@ SUBDIRS= lib/blas \ statisticsFunctions \ matrixOperations \ implicitList \ - string + string diff --git a/src/Makefile.in b/src/Makefile.in index 22d7b222..752fc1f2 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -189,7 +189,7 @@ SUBDIRS = lib/blas \ statisticsFunctions \ matrixOperations \ implicitList \ - string + string all: all-recursive diff --git a/src/configure b/src/configure index 4d8fee99..4cd9a6a8 100755 --- a/src/configure +++ b/src/configure @@ -22153,7 +22153,7 @@ fi ###### Creation of the header file (machine.h) ####################### -ac_config_files="$ac_config_files Makefile lib/blas/Makefile lib/lapack/Makefile type/Makefile matrixOperations/Makefile matrixOperations/addition/Makefile matrixOperations/subtraction/Makefile matrixOperations/multiplication/Makefile matrixOperations/division/Makefile matrixOperations/cat/Makefile matrixOperations/transpose/Makefile matrixOperations/trace/Makefile implicitList/Makefile elementaryFunctions/Makefile elementaryFunctions/cos/Makefile elementaryFunctions/cosh/Makefile elementaryFunctions/acos/Makefile elementaryFunctions/acosh/Makefile elementaryFunctions/sin/Makefile elementaryFunctions/sinh/Makefile elementaryFunctions/asin/Makefile elementaryFunctions/asinh/Makefile elementaryFunctions/tan/Makefile elementaryFunctions/tanh/Makefile elementaryFunctions/atan/Makefile elementaryFunctions/atan2/Makefile elementaryFunctions/atanh/Makefile elementaryFunctions/log/Makefile elementaryFunctions/log1p/Makefile elementaryFunctions/log10/Makefile elementaryFunctions/exp/Makefile elementaryFunctions/exp10/Makefile elementaryFunctions/sqrt/Makefile elementaryFunctions/lnp1m1/Makefile elementaryFunctions/pow/Makefile auxiliaryFunctions/Makefile auxiliaryFunctions/abs/Makefile auxiliaryFunctions/find/Makefile auxiliaryFunctions/isempty/Makefile auxiliaryFunctions/isnan/Makefile auxiliaryFunctions/rand/Makefile auxiliaryFunctions/sign/Makefile auxiliaryFunctions/size/Makefile auxiliaryFunctions/length/Makefile auxiliaryFunctions/type/Makefile auxiliaryFunctions/pythag/Makefile statisticsFunctions/Makefile statisticsFunctions/mean/Makefile statisticsFunctions/sum/Makefile string/Makefile string/disp/Makefile string/string/Makefile" +ac_config_files="$ac_config_files Makefile lib/blas/Makefile lib/lapack/Makefile type/Makefile matrixOperations/Makefile matrixOperations/addition/Makefile matrixOperations/subtraction/Makefile matrixOperations/multiplication/Makefile matrixOperations/division/Makefile matrixOperations/cat/Makefile matrixOperations/transpose/Makefile matrixOperations/trace/Makefile matrixOperations/hilbert/Makefile implicitList/Makefile elementaryFunctions/Makefile elementaryFunctions/cos/Makefile elementaryFunctions/cosh/Makefile elementaryFunctions/conj/Makefile elementaryFunctions/acos/Makefile elementaryFunctions/acosh/Makefile elementaryFunctions/sin/Makefile elementaryFunctions/sinh/Makefile elementaryFunctions/asin/Makefile elementaryFunctions/asinh/Makefile elementaryFunctions/tan/Makefile elementaryFunctions/tanh/Makefile elementaryFunctions/atan/Makefile elementaryFunctions/atan2/Makefile elementaryFunctions/atanh/Makefile elementaryFunctions/log/Makefile elementaryFunctions/log1p/Makefile elementaryFunctions/log10/Makefile elementaryFunctions/exp/Makefile elementaryFunctions/exp10/Makefile elementaryFunctions/sqrt/Makefile elementaryFunctions/lnp1m1/Makefile elementaryFunctions/pow/Makefile auxiliaryFunctions/Makefile auxiliaryFunctions/abs/Makefile auxiliaryFunctions/find/Makefile auxiliaryFunctions/isempty/Makefile auxiliaryFunctions/isnan/Makefile auxiliaryFunctions/rand/Makefile auxiliaryFunctions/sign/Makefile auxiliaryFunctions/size/Makefile auxiliaryFunctions/length/Makefile auxiliaryFunctions/type/Makefile auxiliaryFunctions/pythag/Makefile statisticsFunctions/Makefile statisticsFunctions/mean/Makefile statisticsFunctions/sum/Makefile statisticsFunctions/variance/Makefile string/Makefile string/disp/Makefile string/string/Makefile" @@ -22776,10 +22776,12 @@ do "matrixOperations/cat/Makefile") CONFIG_FILES="$CONFIG_FILES matrixOperations/cat/Makefile" ;; "matrixOperations/transpose/Makefile") CONFIG_FILES="$CONFIG_FILES matrixOperations/transpose/Makefile" ;; "matrixOperations/trace/Makefile") CONFIG_FILES="$CONFIG_FILES matrixOperations/trace/Makefile" ;; + "matrixOperations/hilbert/Makefile") CONFIG_FILES="$CONFIG_FILES matrixOperations/hilbert/Makefile" ;; "implicitList/Makefile") CONFIG_FILES="$CONFIG_FILES implicitList/Makefile" ;; "elementaryFunctions/Makefile") CONFIG_FILES="$CONFIG_FILES elementaryFunctions/Makefile" ;; "elementaryFunctions/cos/Makefile") CONFIG_FILES="$CONFIG_FILES elementaryFunctions/cos/Makefile" ;; "elementaryFunctions/cosh/Makefile") CONFIG_FILES="$CONFIG_FILES elementaryFunctions/cosh/Makefile" ;; + "elementaryFunctions/conj/Makefile") CONFIG_FILES="$CONFIG_FILES elementaryFunctions/conj/Makefile" ;; "elementaryFunctions/acos/Makefile") CONFIG_FILES="$CONFIG_FILES elementaryFunctions/acos/Makefile" ;; "elementaryFunctions/acosh/Makefile") CONFIG_FILES="$CONFIG_FILES elementaryFunctions/acosh/Makefile" ;; "elementaryFunctions/sin/Makefile") CONFIG_FILES="$CONFIG_FILES elementaryFunctions/sin/Makefile" ;; @@ -22813,6 +22815,7 @@ do "statisticsFunctions/Makefile") CONFIG_FILES="$CONFIG_FILES statisticsFunctions/Makefile" ;; "statisticsFunctions/mean/Makefile") CONFIG_FILES="$CONFIG_FILES statisticsFunctions/mean/Makefile" ;; "statisticsFunctions/sum/Makefile") CONFIG_FILES="$CONFIG_FILES statisticsFunctions/sum/Makefile" ;; + "statisticsFunctions/variance/Makefile") CONFIG_FILES="$CONFIG_FILES statisticsFunctions/variance/Makefile" ;; "string/Makefile") CONFIG_FILES="$CONFIG_FILES string/Makefile" ;; "string/disp/Makefile") CONFIG_FILES="$CONFIG_FILES string/disp/Makefile" ;; "string/string/Makefile") CONFIG_FILES="$CONFIG_FILES string/string/Makefile" ;; diff --git a/src/configure.ac b/src/configure.ac index b2594b3d..13f5a8be 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -172,10 +172,12 @@ matrixOperations/division/Makefile matrixOperations/cat/Makefile matrixOperations/transpose/Makefile matrixOperations/trace/Makefile +matrixOperations/hilbert/Makefile implicitList/Makefile elementaryFunctions/Makefile elementaryFunctions/cos/Makefile elementaryFunctions/cosh/Makefile +elementaryFunctions/conj/Makefile elementaryFunctions/acos/Makefile elementaryFunctions/acosh/Makefile elementaryFunctions/sin/Makefile @@ -209,6 +211,7 @@ auxiliaryFunctions/pythag/Makefile statisticsFunctions/Makefile statisticsFunctions/mean/Makefile statisticsFunctions/sum/Makefile +statisticsFunctions/variance/Makefile string/Makefile string/disp/Makefile string/string/Makefile diff --git a/src/elementaryFunctions/includes/conj.h b/src/elementaryFunctions/includes/conj.h new file mode 100644 index 00000000..ee777578 --- /dev/null +++ b/src/elementaryFunctions/includes/conj.h @@ -0,0 +1,26 @@ +/* + * 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 + * + */ + +#ifndef __CONJ_H__ +#define __CONJ_H__ + +#include "floatComplex.h" +#include "doubleComplex.h" + +floatComplex cconjs( floatComplex in ) ; + +void cconja ( floatComplex* in , int size, floatComplex* out ); + +doubleComplex zconjs ( doubleComplex in) ; + +void zconja ( doubleComplex* in , int size, doubleComplex* out ) ; +#endif /* !__CONJ_H__ */ diff --git a/src/includes/lapack.h b/src/includes/lapack.h index 5201f5d6..2751988a 100644 --- a/src/includes/lapack.h +++ b/src/includes/lapack.h @@ -89,28 +89,22 @@ extern double dlacpy_ (char* NORM, int* M, int* N, double* A, int* LDA, /****** doubleComplex fortran function ************/ -extern doubleComplex zlamch_ (char *CMACH, unsigned long int i); +extern int zlamch_ (); -extern double zlange_ (char* NORM, int* M, int* N, doubleComplex* A, int* LDA , - doubleComplex* WORK); +extern int zlange_ (); -extern doubleComplex zgetrf_ (int* M, int* N , doubleComplex* A , int* LDA , int* IPIV , - int* INFO); +extern int zgetrf_ (); -extern doubleComplex zgecon_ (char* NORM, int* N, doubleComplex* A, int* LDA, double* ANORM, - double* RCOND, doubleComplex* WORK , double* IWORK, int* INFO ) ; +extern int zgecon_ ( ) ; -extern doubleComplex zgetrs_ (char* TRANS, int* N, int* NRHS, doubleComplex* A, int* LDA, - int* IPIV, doubleComplex* B, int* LDB, int* INFO ) ; +extern int zgetrs_ ( ) ; -extern doubleComplex zgelsy_ (int* M, int* N, int* NRHS, doubleComplex* A, int* LDA, +extern int zgelsy_ (); +/*extern doubleComplex zgelsy_ (int* M, int* N, int* NRHS, doubleComplex* A, int* LDA, doubleComplex* B, int* LDB, int* JPVT, double* RCOND, int* RANK, doubleComplex* WORK, int* LWORK, double* RWORK, int* INFO) ; +*/ - - - -extern doubleComplex zlacpy_ (char* NORM, int* M, int* N, doubleComplex* A, int* LDA, - doubleComplex* B, int* LDB ); +extern int zlacpy_ (); #endif /* !__LAPACK_H__ */ diff --git a/src/lib/lapack/zgelsy.f b/src/lib/lapack/zgelsy.f index 684cf2c2..95aece58 100644 --- a/src/lib/lapack/zgelsy.f +++ b/src/lib/lapack/zgelsy.f @@ -311,9 +311,9 @@ * * [R11,R12] = [ T11, 0 ] * Y * - IF( RANK.LT.N ) - $ CALL ZTZRZF( RANK, N, A, LDA, WORK( MN+1 ), WORK( 2*MN+1 ), - $ LWORK-2*MN, INFO ) +c IF( RANK.LT.N ) +c $ CALL ZTZRZF( RANK, N, A, LDA, WORK( MN+1 ), WORK( 2*MN+1 ), +c $ LWORK-2*MN, INFO ) * * complex workspace: 2*MN. * Details of Householder rotations stored in WORK(MN+1:2*MN) @@ -339,11 +339,11 @@ * * B(1:N,1:NRHS) := Y' * B(1:N,1:NRHS) * - IF( RANK.LT.N ) THEN - CALL ZUNMRZ( 'Left', 'Conjugate transpose', N, NRHS, RANK, - $ N-RANK, A, LDA, WORK( MN+1 ), B, LDB, - $ WORK( 2*MN+1 ), LWORK-2*MN, INFO ) - END IF +c IF( RANK.LT.N ) THEN +c CALL ZUNMRZ( 'Left', 'Conjugate transpose', N, NRHS, RANK, +c $ N-RANK, A, LDA, WORK( MN+1 ), B, LDB, +c $ WORK( 2*MN+1 ), LWORK-2*MN, INFO ) +c END IF * * complex workspace: 2*MN+NRHS. * diff --git a/src/matrixOperations/division/zldiva.c b/src/matrixOperations/division/zldiva.c new file mode 100644 index 00000000..625375f1 --- /dev/null +++ b/src/matrixOperations/division/zldiva.c @@ -0,0 +1,121 @@ +/* + * 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" + +int 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); + return 0; +} diff --git a/src/matrixOperations/includes/hilbert.h b/src/matrixOperations/includes/hilbert.h new file mode 100644 index 00000000..8e4e857b --- /dev/null +++ b/src/matrixOperations/includes/hilbert.h @@ -0,0 +1,34 @@ +/* + * 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 + * + */ + +#ifndef __HILBERT_H__ +#define __HILBERT_H__ + +#include <math.h> +/* +** generate an Hilbert's matrix +** param out : the hilbert's matrix in float precision +** param size: matrix's size +*/ + +void shilba ( float* out, int size) ; + +/* +** generate an Hilbert's matrix +** param out : the hilbert's matrix in double precision +** param size: matrix's size +*/ + + +void dhilba ( double* out, int size ) ; + +#endif /* !__HILBERT_H__ */ diff --git a/src/statisticsFunctions/Makefile.am b/src/statisticsFunctions/Makefile.am index bb937ab9..8ba9e216 100644 --- a/src/statisticsFunctions/Makefile.am +++ b/src/statisticsFunctions/Makefile.am @@ -11,4 +11,5 @@ ## SUBDIRS= mean \ - sum
\ No newline at end of file + sum\ + variance diff --git a/src/statisticsFunctions/Makefile.in b/src/statisticsFunctions/Makefile.in index c48f8b17..9884029a 100644 --- a/src/statisticsFunctions/Makefile.in +++ b/src/statisticsFunctions/Makefile.in @@ -166,7 +166,8 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = mean \ - sum + sum\ + variance all: all-recursive |