From 07ad3a03eaf3bb9ea745e15061c4dac52edfa5f8 Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 16 Jul 2008 13:36:17 +0000 Subject: corrected configure , and add comment in ddiva --- src/configure | 7 ++-- src/configure.ac | 15 +++++---- src/includes/lapack.h | 21 ++++++++++++ src/matrixOperations/Makefile.am | 3 +- src/matrixOperations/Makefile.in | 3 +- src/matrixOperations/division/ddiva.c | 6 ++-- src/matrixOperations/division/testMatrixDivision.c | 12 +++---- src/matrixOperations/includes/matrixDivision.h | 14 +++++--- src/string/Makefile.am | 2 +- src/string/Makefile.in | 2 +- src/string/string/testString.c | 39 ++++++++++------------ 11 files changed, 77 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/configure b/src/configure index 8c895485..5c6bac99 100755 --- a/src/configure +++ b/src/configure @@ -21877,7 +21877,7 @@ if test "$enable_stop_on_warning" = yes; then CFLAGS="$CFLAGS -Werror" fi -########### FORTRAN FLAGS ###################### +###########�FORTRAN FLAGS ###################### ###################### ######## With F77 / G77 / GFortran ... @@ -21887,7 +21887,7 @@ if test -n "$F77"; then FFLAGS="$FFLAGS -g -Wall " fi -########### C FLAGS ###################### +###########�C FLAGS ###################### ###################### ######## With GCC ... @@ -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/cat/Makefile matrixOperations/transpose/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 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" @@ -22772,6 +22772,7 @@ do "matrixOperations/addition/Makefile") CONFIG_FILES="$CONFIG_FILES matrixOperations/addition/Makefile" ;; "matrixOperations/subtraction/Makefile") CONFIG_FILES="$CONFIG_FILES matrixOperations/subtraction/Makefile" ;; "matrixOperations/multiplication/Makefile") CONFIG_FILES="$CONFIG_FILES matrixOperations/multiplication/Makefile" ;; + "matrixOperations/division/Makefile") CONFIG_FILES="$CONFIG_FILES matrixOperations/division/Makefile" ;; "matrixOperations/cat/Makefile") CONFIG_FILES="$CONFIG_FILES matrixOperations/cat/Makefile" ;; "matrixOperations/transpose/Makefile") CONFIG_FILES="$CONFIG_FILES matrixOperations/transpose/Makefile" ;; "implicitList/Makefile") CONFIG_FILES="$CONFIG_FILES implicitList/Makefile" ;; diff --git a/src/configure.ac b/src/configure.ac index 61e04d56..148e74b9 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -12,7 +12,7 @@ AC_INIT([sci2cLibrary],[0.1],[]) AC_CONFIG_AUX_DIR(config) -AC_PREREQ(2.55) +AC_PREREQ(2.61) RM='rm -f' SCIDIR=$srcdir @@ -52,20 +52,20 @@ AC_SUBST(LIBMATH) ## all the --with-* argument help ################################# AC_ARG_WITH(stdc99, - AC_HELP_STRING([--with-stdc99],[Enable standard C99 (Used in complex implementation)])) + AS_HELP_STRING([--with-stdc99],[Enable standard C99 (Used in complex implementation)])) if test "$with_stdc99" = yes; then AC_CHECK_HEADERS([complex.h]) CFLAGS="$CFLAGS -std=c99" fi AC_ARG_WITH(blas, - AC_HELP_STRING([--with-blas],[Enable call to blas library (Used in matrix operations)])) + AS_HELP_STRING([--with-blas],[Enable call to blas library (Used in matrix operations)])) if test "$with_blas" = no; then CFLAGS="$CFLAGS -DWITHOUT_BLAS" fi AC_ARG_ENABLE(debug, - AC_HELP_STRING([--enable-debug],[Use verbose messages through compilation process])) + AS_HELP_STRING([--enable-debug],[Use verbose messages through compilation process])) if test "$enable_debug" = yes; then CFLAGS="$CFLAGS -Wall -Wextra -pedantic -Wconversion -Wformat -Wshadow \ -Wpointer-arith -Wcast-align -Wmissing-prototypes \ @@ -73,12 +73,12 @@ if test "$enable_debug" = yes; then fi AC_ARG_ENABLE(stopOnWarning, - AC_HELP_STRING([--enable-stop-on-warning],[Stop the compilation on the first warning found in the C/C++ code])) + AS_HELP_STRING([--enable-stop-on-warning],[Stop the compilation on the first warning found in the C/C++ code])) if test "$enable_stop_on_warning" = yes; then CFLAGS="$CFLAGS -Werror" fi -########### FORTRAN FLAGS ###################### +###########�FORTRAN FLAGS ###################### ###################### ######## With F77 / G77 / GFortran ... @@ -88,7 +88,7 @@ if test -n "$F77"; then FFLAGS="$FFLAGS -g -Wall " fi -########### C FLAGS ###################### +###########�C FLAGS ###################### ###################### ######## With GCC ... @@ -168,6 +168,7 @@ matrixOperations/Makefile matrixOperations/addition/Makefile matrixOperations/subtraction/Makefile matrixOperations/multiplication/Makefile +matrixOperations/division/Makefile matrixOperations/cat/Makefile matrixOperations/transpose/Makefile implicitList/Makefile diff --git a/src/includes/lapack.h b/src/includes/lapack.h index a094ecc9..8bc4744e 100644 --- a/src/includes/lapack.h +++ b/src/includes/lapack.h @@ -18,6 +18,13 @@ #define getOverflowThreshold() dlamch_("o", 1L) #define getUnderflowThreshold() dlamch_("u", 1L) +#define getOneNorm(lines,cols,in,work) dlange_("1", lines, cols, in, lines, work) +#define resolveSystemLinear(cols1,row2,cpytranIn1,pIpiv, transposeOfIn2,info) \ + dgetrs_ ("N" ,cols1, row2, cpytranIn1 , cols1, pIpiv,transposeOfIn2, cols1, info) ; + + + + /** * -- LAPACK auxiliary routine (version 3.0) -- * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., @@ -62,5 +69,19 @@ **/ extern double dlamch_ (char *CMACH, unsigned long int i); +extern double dlange_ (char* NORM, int* M, int* N, double* A, int* LDA , double* WORK); + +extern double dgetrf_ (int* M, int* N , double* A , int* LDA , int* IPIV , int* INFO); + +extern double dgecon_ (char* NORM, int* N, double* A, int* LDA, double* ANORM, + double* RCOND, double* WORK , int* IWORK, int* INFO ) ; + +extern double dgetrs_ (char* TRANS, int* N, int* NRHS, double* A, int* LDA, + int* IPIV, double* B, int* LDB, int* INFO ) ; + +extern double dgelsy_ (int* M, int* N, int* NRHS, double* A, int* LDA, + double* B, int* LDB, int* JPVT, double* RCOND, int* RANK, + double* WORK, int* LWORK, int* INFO) ; + #endif /* !__LAPACK_H__ */ diff --git a/src/matrixOperations/Makefile.am b/src/matrixOperations/Makefile.am index ddf2c404..67dfaccd 100644 --- a/src/matrixOperations/Makefile.am +++ b/src/matrixOperations/Makefile.am @@ -15,5 +15,6 @@ SUBDIRS= addition \ multiplication \ division \ cat \ - transpose + transpose \ + division diff --git a/src/matrixOperations/Makefile.in b/src/matrixOperations/Makefile.in index 10b2987a..a265efd6 100644 --- a/src/matrixOperations/Makefile.in +++ b/src/matrixOperations/Makefile.in @@ -170,7 +170,8 @@ SUBDIRS = addition \ multiplication \ division \ cat \ - transpose + transpose \ + division all: all-recursive diff --git a/src/matrixOperations/division/ddiva.c b/src/matrixOperations/division/ddiva.c index 8fe660ba..f7c8e9e5 100644 --- a/src/matrixOperations/division/ddiva.c +++ b/src/matrixOperations/division/ddiva.c @@ -14,6 +14,7 @@ #include "matrixDivision.h" #include "lapack.h" + void drdiva ( double* in1, int lines1, int columns1 , double* in2, int lines2, int columns2 , double* out ){ @@ -83,7 +84,9 @@ void drdiva ( double* in1, int lines1, int columns1 , dtransposea ( in1, lines1, columns1, transpOfIn1); - dtransposea ( in2, lines2, columns2, transpOfIn2) ; + dtransposea ( in2, lines2, columns2, transpOfIn2) ; + + /* case of a square matrix */ if ( lines1 == columns1 ) @@ -146,7 +149,6 @@ void drdiva ( double* in1, int lines1, int columns1 , } } - } diff --git a/src/matrixOperations/division/testMatrixDivision.c b/src/matrixOperations/division/testMatrixDivision.c index 3f97cfd3..ba3e1839 100644 --- a/src/matrixOperations/division/testMatrixDivision.c +++ b/src/matrixOperations/division/testMatrixDivision.c @@ -15,8 +15,8 @@ #include #define LINES1 2 -#define LINES2 1 -#define COLUMNS 3 +#define LINES2 2 +#define COLUMNS 2 /* static void sdivaTest ( void ) { @@ -221,18 +221,18 @@ static void ddivaTest ( void ) { int i = 0 ; - double in1[] = { 1 , 2 , 3 , 4 ,5 , 6 } ; + double in1[] = { 1 , 2 , 3 , 4 } ; -double in2[] = { 7 , 8 , 9 } ; +double in2[] = { 1 , 2 ,3 ,4 } ; -double result[] = { 0.25773195876288651 , 0.62886597938144329 }; +double result[] = { 1 ,0 , 0 , 1 }; double out [(COLUMNS)*(LINES2)] ; - printf("\n>rentre dans fonction \n"); + drdiva ( in1 , LINES1 , COLUMNS , in2 , LINES2 , COLUMNS , out ) ; printf("\n\n\t>>>>>debut assert\n"); for ( i = 0 ; i < LINES2 *COLUMNS ; i++ ) diff --git a/src/matrixOperations/includes/matrixDivision.h b/src/matrixOperations/includes/matrixDivision.h index 3fa66d6a..3c46d6c1 100644 --- a/src/matrixOperations/includes/matrixDivision.h +++ b/src/matrixOperations/includes/matrixDivision.h @@ -15,17 +15,23 @@ #include "floatComplex.h" #include "doubleComplex.h" +#include "cat.h" +#include "matrixTranspose.h" -void srdiva ( float * in1, int it1, - float * in2, int it2, - float *out, int itOut, int size) ; + +void srdiva ( float* in1, int lines1, int columns1 , + float* in2, int lines2, int columns2 , + float* out ); void sldiva ( float * in1, int it1, float * in2, int it2, float * out, int itOut, int size) ; - + +void drdiva ( double* in1, int lines1, int columns1 , + double* in2, int lines2, int columns2 , + double* out ); void drdiva ( double * in1, int it1, double * in2, int it2, diff --git a/src/string/Makefile.am b/src/string/Makefile.am index 72955c38..9fc47f04 100644 --- a/src/string/Makefile.am +++ b/src/string/Makefile.am @@ -11,7 +11,7 @@ ## SUBDIRS = disp \ - #string + string diff --git a/src/string/Makefile.in b/src/string/Makefile.in index 848760a9..0d753286 100644 --- a/src/string/Makefile.in +++ b/src/string/Makefile.in @@ -166,7 +166,7 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = disp \ - #string + string all: all-recursive diff --git a/src/string/string/testString.c b/src/string/string/testString.c index 6106cb65..f3564218 100644 --- a/src/string/string/testString.c +++ b/src/string/string/testString.c @@ -19,7 +19,7 @@ #define SIZE 10000 /* -** \test pour les float s +** \floating scalars test */ static void sstringaTest (void) { float tabF[SIZE]; @@ -43,17 +43,16 @@ static void sstringaTest (void) { tabF[i] = (float) rand () ; } -/* appel de la fonction à tester */ +/* call to the function to test */ sstringa ( tabF , SIZE , tabC ) ; -/* on reconvertit dans le sens inverse */ +/* reverse convertion*/ for ( i = 0 ; i < SIZE ; ++i) { sscanf ( tabC[i] , "%e" , &(tabF2[i]) ) ; } -/* et on compare si les floatants initiaux et finaux sont identiques , - à une marge d'erreur pres à cause de l'epsilon machine */ +/* and we compare if the initial and final floats are equal */ for ( i = 0 ; i < SIZE ; ++i) { @@ -66,7 +65,7 @@ static void sstringaTest (void) { /* -** \test pour les double s +** \double scalars test */ static void dstringaTest (void) { @@ -92,10 +91,10 @@ static void dstringaTest (void) { tabD[i] = (double) rand () ; } -/* appel de la fonction à tester sstringa ( tabD , SIZE , tabC ) ; */ +/* call to the function to test */ dstringa ( tabD , SIZE , tabC ) ; -/* on reconvertit dans le sens inverse */ +/* reverse convertion*/ for ( i = 0 ; i < SIZE ; ++i) { @@ -103,8 +102,7 @@ static void dstringaTest (void) { } -/* et on compare si les floatants initiaux et finaux sont identique , - à une marge d'erreur pres à cause de l'epsilon machine*/ +/* and we compare if the initial and final doubles are equal */ for ( i = 0 ; i < SIZE ; ++i) { @@ -117,7 +115,7 @@ static void dstringaTest (void) { /* -** \test pour les float c +** \complex floats test */ static void cstringaTest (void) { @@ -144,10 +142,11 @@ static void cstringaTest (void) { tabF[i] = FloatComplex ((float) rand (), (float) rand()); } -/* appel de la fonction à tester */ + cstringa ( tabF , SIZE , tabC ) ; -/* on reconvertit dans le sens inverse */ +/* reverse convertion*/ + for ( i = 0 ; i < SIZE ; ++i) { sscanf (tabC[i] , "%e + %e" , &real , &img ); @@ -156,8 +155,9 @@ static void cstringaTest (void) { tabF2[i] = FloatComplex (real ,img ); } -/* et on compare si les floats initiaux et finaux sont identique , - à une marge d'erreur pres à cause de l'epsilon machine */ + +/* and we compare if the initial and final floats are equal */ + for ( i = 0 ; i < SIZE ; ++i) { @@ -171,7 +171,7 @@ static void cstringaTest (void) { /* -** \test pour les doubles 07 +** \double 07 test */ static void zstringaTest (void) { doubleComplex tabD[SIZE]; @@ -200,10 +200,9 @@ static void zstringaTest (void) { tabD[i] = DoubleComplex ((double) rand (), (double) rand()); } -/* appel de la fonction à tester*/ zstringa ( tabD , SIZE , tabC ) ; -/* on reconvertit dans le sens inverse*/ +/* reverse convertion*/ for ( i = 0 ; i < SIZE ; ++i) { real = (double) strtod (tabC[i] ,&temp ); @@ -211,9 +210,7 @@ static void zstringaTest (void) { tabD2[i] = DoubleComplex (real ,img ); } - -/* et on compare si les doubles initiaux et finaux sont identique , - à une marge d'erreur pres à cause de l'epsilon machine */ +/* and we compare if the initial and final doubles are equal */ for ( i = 0 ; i < SIZE ; ++i) { -- cgit