diff options
author | torset | 2008-12-11 13:05:58 +0000 |
---|---|---|
committer | torset | 2008-12-11 13:05:58 +0000 |
commit | f24d524141dc477e5beed63f444a1e25164b77f4 (patch) | |
tree | ff7146aea4fcf8e647a2fc2583651c7b17ba618a | |
parent | b117e4b7cafcb34345416a2fe900584e092327a9 (diff) | |
download | scilab2c-f24d524141dc477e5beed63f444a1e25164b77f4.tar.gz scilab2c-f24d524141dc477e5beed63f444a1e25164b77f4.tar.bz2 scilab2c-f24d524141dc477e5beed63f444a1e25164b77f4.zip |
Update chol files
-rw-r--r-- | src/matrixOperations/chol/Makefile.am | 18 | ||||
-rw-r--r-- | src/matrixOperations/chol/Makefile.in | 83 | ||||
-rw-r--r-- | src/matrixOperations/chol/cchola.c | 85 | ||||
-rw-r--r-- | src/matrixOperations/chol/schola.c | 75 | ||||
-rw-r--r-- | src/matrixOperations/chol/schols.c | 23 | ||||
-rw-r--r-- | src/matrixOperations/chol/testDoubleChol.c | 57 | ||||
-rw-r--r-- | src/matrixOperations/chol/testFloatChol.c | 80 | ||||
-rw-r--r-- | src/matrixOperations/chol/zchola.c | 75 |
8 files changed, 478 insertions, 18 deletions
diff --git a/src/matrixOperations/chol/Makefile.am b/src/matrixOperations/chol/Makefile.am index 3207be84..76e9af0b 100644 --- a/src/matrixOperations/chol/Makefile.am +++ b/src/matrixOperations/chol/Makefile.am @@ -13,6 +13,7 @@ libMatrixChol_la_CFLAGS = -I $(top_builddir)/type \ -I .\ -I $(top_builddir)/matrixOperations/includes \ + -I $(top_builddir)/operations/includes \ -I $(top_builddir)/elementaryFunctions/includes instdir = $(top_builddir)/lib @@ -22,8 +23,12 @@ pkglib_LTLIBRARIES = libMatrixChol.la HEAD = ../includes/chol.h libMatrixChol_la_SOURCES = $(HEAD) \ + schols.c \ + schola.c \ dchols.c \ - dchola.c + dchola.c \ + cchola.c \ + zchola.c ############ @@ -31,7 +36,7 @@ libMatrixChol_la_SOURCES = $(HEAD) \ ############ -check_PROGRAMS = testDoubleChol +check_PROGRAMS = testDoubleChol testFloatChol check_LDADD = $(top_builddir)/type/libDoubleComplex.la \ $(top_builddir)/type/libFloatComplex.la \ @@ -41,6 +46,9 @@ check_LDADD = $(top_builddir)/type/libDoubleComplex.la \ $(top_builddir)/auxiliaryFunctions/pythag/libPythag.la \ $(top_builddir)/operations/addition/libAddition.la \ $(top_builddir)/operations/multiplication/libMultiplication.la \ + $(top_builddir)/operations/division/libDivision.la \ + $(top_builddir)/operations/subtraction/libSubtraction.la \ + $(top_builddir)/auxiliaryFunctions/conj/libConj.la \ libMatrixChol.la check_INCLUDES = -I $(top_builddir)/type \ @@ -52,9 +60,11 @@ testDoubleChol_SOURCES = testDoubleChol.c testDoubleChol_LDADD = $(check_LDADD) testDoubleChol_CFLAGS = $(check_INCLUDES) +testFloatChol_SOURCES = testFloatChol.c +testFloatChol_LDADD = $(check_LDADD) +testFloatChol_CFLAGS = $(check_INCLUDES) - -TESTS = testDoubleChol +TESTS = testDoubleChol testFloatChol diff --git a/src/matrixOperations/chol/Makefile.in b/src/matrixOperations/chol/Makefile.in index 5a1a9dd9..9e1a6461 100644 --- a/src/matrixOperations/chol/Makefile.in +++ b/src/matrixOperations/chol/Makefile.in @@ -32,8 +32,8 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -check_PROGRAMS = testDoubleChol$(EXEEXT) -TESTS = testDoubleChol$(EXEEXT) +check_PROGRAMS = testDoubleChol$(EXEEXT) testFloatChol$(EXEEXT) +TESTS = testDoubleChol$(EXEEXT) testFloatChol$(EXEEXT) subdir = matrixOperations/chol DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -55,7 +55,9 @@ LTLIBRARIES = $(pkglib_LTLIBRARIES) libMatrixChol_la_LIBADD = am__objects_1 = am_libMatrixChol_la_OBJECTS = $(am__objects_1) \ - libMatrixChol_la-dchols.lo libMatrixChol_la-dchola.lo + libMatrixChol_la-schols.lo libMatrixChol_la-schola.lo \ + libMatrixChol_la-dchols.lo libMatrixChol_la-dchola.lo \ + libMatrixChol_la-cchola.lo libMatrixChol_la-zchola.lo libMatrixChol_la_OBJECTS = $(am_libMatrixChol_la_OBJECTS) libMatrixChol_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libMatrixChol_la_CFLAGS) \ @@ -66,6 +68,12 @@ testDoubleChol_DEPENDENCIES = $(check_LDADD) testDoubleChol_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testDoubleChol_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_testFloatChol_OBJECTS = testFloatChol-testFloatChol.$(OBJEXT) +testFloatChol_OBJECTS = $(am_testFloatChol_OBJECTS) +testFloatChol_DEPENDENCIES = $(check_LDADD) +testFloatChol_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testFloatChol_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/includes depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles @@ -78,8 +86,10 @@ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -SOURCES = $(libMatrixChol_la_SOURCES) $(testDoubleChol_SOURCES) -DIST_SOURCES = $(libMatrixChol_la_SOURCES) $(testDoubleChol_SOURCES) +SOURCES = $(libMatrixChol_la_SOURCES) $(testDoubleChol_SOURCES) \ + $(testFloatChol_SOURCES) +DIST_SOURCES = $(libMatrixChol_la_SOURCES) $(testDoubleChol_SOURCES) \ + $(testFloatChol_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -196,14 +206,19 @@ top_srcdir = @top_srcdir@ libMatrixChol_la_CFLAGS = -I $(top_builddir)/type \ -I .\ -I $(top_builddir)/matrixOperations/includes \ + -I $(top_builddir)/operations/includes \ -I $(top_builddir)/elementaryFunctions/includes instdir = $(top_builddir)/lib pkglib_LTLIBRARIES = libMatrixChol.la HEAD = ../includes/chol.h libMatrixChol_la_SOURCES = $(HEAD) \ + schols.c \ + schola.c \ dchols.c \ - dchola.c + dchola.c \ + cchola.c \ + zchola.c check_LDADD = $(top_builddir)/type/libDoubleComplex.la \ $(top_builddir)/type/libFloatComplex.la \ @@ -213,6 +228,9 @@ check_LDADD = $(top_builddir)/type/libDoubleComplex.la \ $(top_builddir)/auxiliaryFunctions/pythag/libPythag.la \ $(top_builddir)/operations/addition/libAddition.la \ $(top_builddir)/operations/multiplication/libMultiplication.la \ + $(top_builddir)/operations/division/libDivision.la \ + $(top_builddir)/operations/subtraction/libSubtraction.la \ + $(top_builddir)/auxiliaryFunctions/conj/libConj.la \ libMatrixChol.la check_INCLUDES = -I $(top_builddir)/type \ @@ -223,6 +241,9 @@ check_INCLUDES = -I $(top_builddir)/type \ testDoubleChol_SOURCES = testDoubleChol.c testDoubleChol_LDADD = $(check_LDADD) testDoubleChol_CFLAGS = $(check_INCLUDES) +testFloatChol_SOURCES = testFloatChol.c +testFloatChol_LDADD = $(check_LDADD) +testFloatChol_CFLAGS = $(check_INCLUDES) all: all-am .SUFFIXES: @@ -295,6 +316,9 @@ clean-checkPROGRAMS: testDoubleChol$(EXEEXT): $(testDoubleChol_OBJECTS) $(testDoubleChol_DEPENDENCIES) @rm -f testDoubleChol$(EXEEXT) $(testDoubleChol_LINK) $(testDoubleChol_OBJECTS) $(testDoubleChol_LDADD) $(LIBS) +testFloatChol$(EXEEXT): $(testFloatChol_OBJECTS) $(testFloatChol_DEPENDENCIES) + @rm -f testFloatChol$(EXEEXT) + $(testFloatChol_LINK) $(testFloatChol_OBJECTS) $(testFloatChol_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -302,9 +326,14 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMatrixChol_la-cchola.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMatrixChol_la-dchola.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMatrixChol_la-dchols.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMatrixChol_la-schola.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMatrixChol_la-schols.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libMatrixChol_la-zchola.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testDoubleChol-testDoubleChol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testFloatChol-testFloatChol.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -327,6 +356,20 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +libMatrixChol_la-schols.lo: schols.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMatrixChol_la_CFLAGS) $(CFLAGS) -MT libMatrixChol_la-schols.lo -MD -MP -MF $(DEPDIR)/libMatrixChol_la-schols.Tpo -c -o libMatrixChol_la-schols.lo `test -f 'schols.c' || echo '$(srcdir)/'`schols.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMatrixChol_la-schols.Tpo $(DEPDIR)/libMatrixChol_la-schols.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='schols.c' object='libMatrixChol_la-schols.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMatrixChol_la_CFLAGS) $(CFLAGS) -c -o libMatrixChol_la-schols.lo `test -f 'schols.c' || echo '$(srcdir)/'`schols.c + +libMatrixChol_la-schola.lo: schola.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMatrixChol_la_CFLAGS) $(CFLAGS) -MT libMatrixChol_la-schola.lo -MD -MP -MF $(DEPDIR)/libMatrixChol_la-schola.Tpo -c -o libMatrixChol_la-schola.lo `test -f 'schola.c' || echo '$(srcdir)/'`schola.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMatrixChol_la-schola.Tpo $(DEPDIR)/libMatrixChol_la-schola.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='schola.c' object='libMatrixChol_la-schola.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMatrixChol_la_CFLAGS) $(CFLAGS) -c -o libMatrixChol_la-schola.lo `test -f 'schola.c' || echo '$(srcdir)/'`schola.c + libMatrixChol_la-dchols.lo: dchols.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMatrixChol_la_CFLAGS) $(CFLAGS) -MT libMatrixChol_la-dchols.lo -MD -MP -MF $(DEPDIR)/libMatrixChol_la-dchols.Tpo -c -o libMatrixChol_la-dchols.lo `test -f 'dchols.c' || echo '$(srcdir)/'`dchols.c @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMatrixChol_la-dchols.Tpo $(DEPDIR)/libMatrixChol_la-dchols.Plo @@ -341,6 +384,20 @@ libMatrixChol_la-dchola.lo: dchola.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMatrixChol_la_CFLAGS) $(CFLAGS) -c -o libMatrixChol_la-dchola.lo `test -f 'dchola.c' || echo '$(srcdir)/'`dchola.c +libMatrixChol_la-cchola.lo: cchola.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMatrixChol_la_CFLAGS) $(CFLAGS) -MT libMatrixChol_la-cchola.lo -MD -MP -MF $(DEPDIR)/libMatrixChol_la-cchola.Tpo -c -o libMatrixChol_la-cchola.lo `test -f 'cchola.c' || echo '$(srcdir)/'`cchola.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMatrixChol_la-cchola.Tpo $(DEPDIR)/libMatrixChol_la-cchola.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cchola.c' object='libMatrixChol_la-cchola.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMatrixChol_la_CFLAGS) $(CFLAGS) -c -o libMatrixChol_la-cchola.lo `test -f 'cchola.c' || echo '$(srcdir)/'`cchola.c + +libMatrixChol_la-zchola.lo: zchola.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMatrixChol_la_CFLAGS) $(CFLAGS) -MT libMatrixChol_la-zchola.lo -MD -MP -MF $(DEPDIR)/libMatrixChol_la-zchola.Tpo -c -o libMatrixChol_la-zchola.lo `test -f 'zchola.c' || echo '$(srcdir)/'`zchola.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libMatrixChol_la-zchola.Tpo $(DEPDIR)/libMatrixChol_la-zchola.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zchola.c' object='libMatrixChol_la-zchola.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libMatrixChol_la_CFLAGS) $(CFLAGS) -c -o libMatrixChol_la-zchola.lo `test -f 'zchola.c' || echo '$(srcdir)/'`zchola.c + testDoubleChol-testDoubleChol.o: testDoubleChol.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleChol_CFLAGS) $(CFLAGS) -MT testDoubleChol-testDoubleChol.o -MD -MP -MF $(DEPDIR)/testDoubleChol-testDoubleChol.Tpo -c -o testDoubleChol-testDoubleChol.o `test -f 'testDoubleChol.c' || echo '$(srcdir)/'`testDoubleChol.c @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testDoubleChol-testDoubleChol.Tpo $(DEPDIR)/testDoubleChol-testDoubleChol.Po @@ -355,6 +412,20 @@ testDoubleChol-testDoubleChol.obj: testDoubleChol.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleChol_CFLAGS) $(CFLAGS) -c -o testDoubleChol-testDoubleChol.obj `if test -f 'testDoubleChol.c'; then $(CYGPATH_W) 'testDoubleChol.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleChol.c'; fi` +testFloatChol-testFloatChol.o: testFloatChol.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatChol_CFLAGS) $(CFLAGS) -MT testFloatChol-testFloatChol.o -MD -MP -MF $(DEPDIR)/testFloatChol-testFloatChol.Tpo -c -o testFloatChol-testFloatChol.o `test -f 'testFloatChol.c' || echo '$(srcdir)/'`testFloatChol.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testFloatChol-testFloatChol.Tpo $(DEPDIR)/testFloatChol-testFloatChol.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatChol.c' object='testFloatChol-testFloatChol.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatChol_CFLAGS) $(CFLAGS) -c -o testFloatChol-testFloatChol.o `test -f 'testFloatChol.c' || echo '$(srcdir)/'`testFloatChol.c + +testFloatChol-testFloatChol.obj: testFloatChol.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatChol_CFLAGS) $(CFLAGS) -MT testFloatChol-testFloatChol.obj -MD -MP -MF $(DEPDIR)/testFloatChol-testFloatChol.Tpo -c -o testFloatChol-testFloatChol.obj `if test -f 'testFloatChol.c'; then $(CYGPATH_W) 'testFloatChol.c'; else $(CYGPATH_W) '$(srcdir)/testFloatChol.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testFloatChol-testFloatChol.Tpo $(DEPDIR)/testFloatChol-testFloatChol.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatChol.c' object='testFloatChol-testFloatChol.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatChol_CFLAGS) $(CFLAGS) -c -o testFloatChol-testFloatChol.obj `if test -f 'testFloatChol.c'; then $(CYGPATH_W) 'testFloatChol.c'; else $(CYGPATH_W) '$(srcdir)/testFloatChol.c'; fi` + mostlyclean-libtool: -rm -f *.lo diff --git a/src/matrixOperations/chol/cchola.c b/src/matrixOperations/chol/cchola.c new file mode 100644 index 00000000..6a456188 --- /dev/null +++ b/src/matrixOperations/chol/cchola.c @@ -0,0 +1,85 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 WITHOUT_LAPACK +#include "lapack.h" +#else +#include "multiplication.h" +#include "division.h" +#include "subtraction.h" +#include "sqrt.h" +#endif + +#include "chol.h" +#include <malloc.h> +#include <stdio.h> + +void cchola(floatComplex * in, int size, floatComplex *out){ + /* param in : input matrix (square matrix) + param size : number of rows or columns + param out : output upper triangular matrix + */ + + /* + We compute U as A=Ut*U + */ + + +#ifndef WITHOUT_LAPACK + + /*We have to use a double, copy of in, + cause dpotrf works only with double, not with float*/ + doubleComplex* tmp; + int i=0, j=0, info=0; + + tmp=malloc((unsigned int)(size*size)*sizeof(doubleComplex)); + for(i=0;i<size*size;i++) tmp[i]=DoubleComplex((double)creals(in[i]),(double)cimags(in[i])); + + C2F(zpotrf)("U", &size, tmp, &size, &info,1L); + + for(i=0;i<size*size;i++) out[i]=FloatComplex((float)zreals(tmp[i]),(float)zimags(tmp[i])); + + /*Zeros in the lower triangular part*/ + for (i=0;i<size;i++){ + for (j=i+1;j<size;j++){ + out[j+i*size]=FloatComplex(0,0); + } + } +#else + /* Do not use Lapack functions*/ + + int i=0, j=0, k=0; + floatComplex tmp,transposee; + float accu; + + for (i=0;i<size*size;i++) out[i]=FloatComplex(0,0); /* Voir si on peut l'enlever */ + + for (i=0;i<size;i++){ + accu=0.0f; + for (j=0;j<i;j++){ + tmp=in[i*size+j]; + for (k=0;k<j;k++){ + transposee=FloatComplex(creals(out[j*size+k]),-cimags(out[j*size+k])); + tmp = cdiffs(tmp,cmuls(out[i*size+k],transposee)); + } + out[i*size+j]= crdivs(tmp,out[j*size+j]); + accu += creals(out[i*size+j])*creals(out[i*size+j]); + accu += cimags(out[i*size+j])*cimags(out[i*size+j]); + } + tmp = FloatComplex(creals(in[i*size+i])-accu,0); + out[i*size+i]=csqrts(tmp); + } + +#endif +} + + diff --git a/src/matrixOperations/chol/schola.c b/src/matrixOperations/chol/schola.c new file mode 100644 index 00000000..4a2121d8 --- /dev/null +++ b/src/matrixOperations/chol/schola.c @@ -0,0 +1,75 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + + +#ifdef WITHOUT_LAPACK +#include "lapack.h" +#else +#include "sqrt.h" +#endif +#include "chol.h" +#include <malloc.h> +#include <stdio.h> + +void schola(float * in, int size, float *out){ + /* param in : input matrix (square matrix) + param size : number of rows or columns + param U : output upper triangular matrix + */ + +#ifdef WITHOUT_LAPACK + + /*We have to use a double, copy of in, + cause dpotrf works only with double, not with float*/ + double* tmp; + int i=0,j=0,info=0; + + tmp=malloc((unsigned int)(size*size)*sizeof(float)); + for (i=0;i<size*size;i++) tmp[i]=(double)in[i]; + + C2F(dpotrf)("U", &size, tmp, &size, &info); + + for (i=0;i<size*size;i++) out[i]=(float)tmp[i]; + + /*Zeros in the lower triangular part*/ + for (i=0;i<size;i++){ + for (j=i+1;j<size;j++){ + out[j+i*size]=0; + } + } + +#else + /* Do not use Lapack functions*/ + int i=0, j=0, k=0; + float tmp=0, accu=0; + + for (i=0;i<size*size;i++) out[i]=0; /* Voir si on peut l'enlever */ + + for (i=0;i<size;i++){ + accu=0; + for (j=0;j<i;j++){ + tmp=in[i*size+j]; + for (k=0;k<j;k++){ + tmp-=out[i*size+k]*out[j*size+k]; + } + out[i*size+j]=tmp/out[j*size+j]; + accu+=out[i*size+j]*out[i*size+j]; + } + out[i*size+i]=ssqrts(in[i*size+i]-accu); + } + +#endif + +} + + + diff --git a/src/matrixOperations/chol/schols.c b/src/matrixOperations/chol/schols.c new file mode 100644 index 00000000..db99e3cd --- /dev/null +++ b/src/matrixOperations/chol/schols.c @@ -0,0 +1,23 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 "chol.h" +#include "sqrt.h" + +float schols(float in){ + return ssqrts(in); +} + + + diff --git a/src/matrixOperations/chol/testDoubleChol.c b/src/matrixOperations/chol/testDoubleChol.c index 63460b0e..4a89ba05 100644 --- a/src/matrixOperations/chol/testDoubleChol.c +++ b/src/matrixOperations/chol/testDoubleChol.c @@ -11,32 +11,73 @@ */ - #include <assert.h> - #include <stdio.h> - #include "chol.h" +#include <assert.h> +#include <stdio.h> +#include "chol.h" +#include <math.h> +#include <malloc.h> + static void dcholsTest(void){ double in=4; double out; - + printf("\n >>> DCholS <<<\n"); out=dchols(in); printf("result : %f\n",out); } static void dcholaTest(void){ - double in[4]= {2,1,1,4}; - double out[4]; - int size=2; + double in[9]= {0.722725308034569025040,0.8976796260103583335877,0.2427821881137788295746,\ + 0.4337721113115549087524,0.9677053210325539112091,0.5068534435704350471497,\ + 0.523297640960663557053,0.5596947595477104187012,0.5617307000793516635895}; + double res[9]={0.8501325238070644996213,0,0,\ + 0.5102405791617476982225,0.8410468907315681308390,0,\ + 0.6155483131232661886401,0.2920372626834314977451,0.3123222878611475739064}; + double out[9]; + int size=3; int i; + printf("\n >>> DCholA <<<\n"); + dchola(in,size,out); - for (i=0;i<4;i++) printf("indice : %d out : %f\n",i,out[i]); + for (i=0;i<9;i++){ + if (out[i]>1e-16) assert( (fabs(out[i]-res[i]) / fabs(out[i])) <1e-15); + } } +static void zcholaTest(void){ + double inR[9]= {9,4,2,4,5,1,2,1,4}; + double inI[9]= {1,-1,2,-1,-4,1,2,1,4}; + double resR[9]= {3,0,0,1.333333333333333259319,\ + 1.763834207376393736766,0,0.6666666666666666296592,\ + 0.1889822365046136265487,1.7525491637693282331867}; + double resI[9]= {0,0,0,- 0.3333333333333333148296,\ + 0,0,0.6666666666666666296592,- 0.0629940788348712366052,0}; + doubleComplex *in, *out; + int i; + + printf("\n >>> ZCholA <<<\n"); + in=DoubleComplexMatrix(inR,inI,9); + + out=malloc((uint)9*sizeof(doubleComplex)); + + zchola(in,3,out); + for (i=0;i<9;i++) printf("indice : %d out : %f+%f *i\n",i,zreals(out[i]),zimags(out[i])); + for (i=0;i<9;i++){ + if (zreals(out[i])>1e-16) + assert( (fabs(zreals(out[i])-resR[i]) / fabs(zreals(out[i]))) <1e-15); + if (zimags(out[i])>1e-16) + assert( (fabs(zimags(out[i])-resI[i]) / fabs(zimags(out[i]))) <1e-15); + } +} + + static int cholTest(void){ + printf("\n >>> Double Chol <<<\n"); dcholsTest(); dcholaTest(); + zcholaTest(); return 0; } diff --git a/src/matrixOperations/chol/testFloatChol.c b/src/matrixOperations/chol/testFloatChol.c new file mode 100644 index 00000000..84dc6d51 --- /dev/null +++ b/src/matrixOperations/chol/testFloatChol.c @@ -0,0 +1,80 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 <math.h> + #include <assert.h> + #include <stdio.h> + #include "chol.h" + +static void scholsTest(void){ + float in=4; + float out; + printf("\n >>> SCholS <<<\n"); + out=schols(in); + printf("result : %f\n",out); + +} + +static void scholaTest(void){ + float in[9]= {0.722725308034569025040f,0.8976796260103583335877f,0.2427821881137788295746f,\ +0.4337721113115549087524f,0.9677053210325539112091f,0.5068534435704350471497f,\ +0.523297640960663557053f,0.5596947595477104187012f,0.5617307000793516635895f}; + float res[9]={0.8501325238070644996213f,0.0f,0.0f,\ +0.5102405791617476982225f,0.8410468907315681308390f,0.0f,\ +0.6155483131232661886401f,0.2920372626834314977451f,0.3123222878611475739064f}; + float out[9]; + int size=3; + int i; + printf("\n >>> SCholA <<<\n"); + schola(in,size,out); + for (i=0;i<9;i++){ + if (out[i]>1e-16) assert( (fabs(out[i]-res[i]) / fabs(out[i])) <1e-6); + } +} + + +static void ccholaTest(void){ + float inR[9]= {9.0f,4.0f,2.0f,4.0f,5.0f,1.0f,2.0f,1.0f,4.0f}; + float inI[9]= {0.0f,-1.0f,2.0f,-1.0f,0.0f,1.0f,2.0f,1.0f,0.0f}; + float resR[9]= {3.0f,0.0f,0.0f,1.333333333333333259319f,\ + 1.763834207376393736766f,0.0f,0.6666666666666666296592f,\ + 0.1889822365046136265487f,1.7525491637693282331867f}; + float resI[9]= {0.0f,0.0f,0.0f,- 0.3333333333333333148296f,\ + 0.0f,0.0f,0.6666666666666666296592f,- 0.0629940788348712366052f,0.0f}; + floatComplex *in, out[9]; + int i; + + printf("\n >>> CCholA <<<\n"); + in=FloatComplexMatrix(inR,inI,9); + + cchola(in,3,out); + for (i=0;i<9;i++) printf("indice : %d out : %f+%f *i\n",i,creals(out[i]),cimags(out[i])); + for (i=0;i<9;i++){ + if (creals(out[i])>1e-16) + assert( (fabs(creals(out[i])-resR[i]) / fabs(creals(out[i]))) <1e-8); + if (cimags(out[i])>1e-16) + assert( (fabs(cimags(out[i])-resI[i]) / fabs(cimags(out[i]))) <1e-8); + } +} +static int cholTest(void){ + printf("\n >>> Float Chol <<<\n"); + scholsTest(); + scholaTest(); + ccholaTest(); + return 0; +} + + +int main (void){ + assert(cholTest()==0); + return 0; +} diff --git a/src/matrixOperations/chol/zchola.c b/src/matrixOperations/chol/zchola.c new file mode 100644 index 00000000..724ff646 --- /dev/null +++ b/src/matrixOperations/chol/zchola.c @@ -0,0 +1,75 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * 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 + * + */ + +#ifdef WITHOUT_LAPACK +#include "lapack.h" +#else +#include "multiplication.h" +#include "division.h" +#include "subtraction.h" +#include "sqrt.h" +#endif + +#include "chol.h" +#include <malloc.h> +#include <stdio.h> + +void zchola(doubleComplex * in, int size, doubleComplex *out){ + /* param in : input matrix (square matrix) + param size : number of rows or columns + param out : output upper triangular matrix + */ + +#ifdef WITHOUT_LAPACK + int i=0, j=0, info=0; + + for(i=0;i<size*size;i++) out[i]=in[i]; + + C2F(zpotrf)("U", &size, out, &size, &info); + + /*Zeros in the lower triangular part*/ + for (i=0;i<size;i++){ + for (j=i+1;j<size;j++){ + out[j+i*size]=DoubleComplex(0,0); + } + } + +#else + /* Do not use Lapack functions*/ + + int i=0, j=0, k=0; + doubleComplex tmp,transposee; + double accu; + + for (i=0;i<size*size;i++) out[i]=DoubleComplex(0,0); /* Voir si on peut l'enlever */ + + for (i=0;i<size;i++){ + accu=0.0f; + for (j=0;j<i;j++){ + tmp=in[i*size+j]; + for (k=0;k<j;k++){ + transposee=DoubleComplex(zreals(out[j*size+k]),-zimags(out[j*size+k])); + tmp = zdiffs(tmp,zmuls(out[i*size+k],transposee)); + } + out[i*size+j]= zrdivs(tmp,out[j*size+j]); + accu += zreals(out[i*size+j])*zreals(out[i*size+j]); + accu += zimags(out[i*size+j])*zimags(out[i*size+j]); + } + tmp = DoubleComplex(zreals(in[i*size+i])-accu,0); + out[i*size+i]=zsqrts(tmp); + } + + +#endif +} + + |