summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjofret2006-12-07 17:03:31 +0000
committerjofret2006-12-07 17:03:31 +0000
commit62cf055a899adcc2678fd8bd72f7dbb633d1b8da (patch)
tree0798c9b3b934a736626bb2663f6b1e0a7b515942 /src
parent4a2f1ca4f4f56b8f707f04ccbdc2236f7df0d64d (diff)
downloadscilab2c-62cf055a899adcc2678fd8bd72f7dbb633d1b8da.tar.gz
scilab2c-62cf055a899adcc2678fd8bd72f7dbb633d1b8da.tar.bz2
scilab2c-62cf055a899adcc2678fd8bd72f7dbb633d1b8da.zip
Begin basic library
Cos
Diffstat (limited to 'src')
-rw-r--r--src/Makefile40
-rw-r--r--src/elementaryFunctions/Makefile42
-rw-r--r--src/elementaryFunctions/cos/Makefile47
-rw-r--r--src/elementaryFunctions/cos/ccosa.c28
-rw-r--r--src/elementaryFunctions/cos/ccoss.c24
-rw-r--r--src/elementaryFunctions/cos/cos.h57
-rw-r--r--src/elementaryFunctions/cos/dcosa.c20
-rw-r--r--src/elementaryFunctions/cos/dcoss.c17
-rw-r--r--src/elementaryFunctions/cos/scosa.c20
-rw-r--r--src/elementaryFunctions/cos/scoss.c17
-rw-r--r--src/elementaryFunctions/cos/zcosa.c27
-rw-r--r--src/elementaryFunctions/cos/zcoss.c24
-rw-r--r--src/type/Makefile5
13 files changed, 366 insertions, 2 deletions
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 00000000..af7619e9
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,40 @@
+##
+## -*- makefile -*-
+##
+## Makefile
+## Made by Bruno JOFRET <bruno.jofret@inria.fr>
+##
+## Started on Tue Dec 5 09:19:53 2006 jofret
+## Last update Thu Dec 7 16:14:26 2006 jofret
+##
+## Copyright INRIA 2006
+##
+
+DIRS = type \
+ elementaryFunctions
+
+all: recure
+
+recure:
+ @for i in $(DIRS); \
+ do cd $$i && make; \
+ cd .. ;\
+ done
+
+clean:
+ @for i in $(DIRS); \
+ do cd $$i && make $@; \
+ cd .. ;\
+ done
+
+distclean:
+ @for i in $(DIRS); \
+ do cd $$i && make $@; \
+ cd .. ;\
+ done
+
+re: clean all
+
+todo:
+ @grep -R FIXME * > TODO
+ @cat TODO \ No newline at end of file
diff --git a/src/elementaryFunctions/Makefile b/src/elementaryFunctions/Makefile
new file mode 100644
index 00000000..b51c7ac3
--- /dev/null
+++ b/src/elementaryFunctions/Makefile
@@ -0,0 +1,42 @@
+##
+## -*- makefile -*-
+##
+## Makefile
+## Made by Bruno JOFRET <bruno.jofret@inria.fr>
+##
+## Started on Tue Dec 5 09:19:53 2006 jofret
+## Last update Thu Dec 7 17:25:24 2006 jofret
+##
+## Copyright INRIA 2006
+##
+
+DIRS = cos #\
+# cosh \
+# sin \
+# sinh \
+# tan \
+# tanh \
+# exp \
+# log
+
+all: recure
+
+recure:
+ @for i in $(DIRS); \
+ do cd $$i && make; \
+ cd .. ;\
+ done
+
+clean:
+ @for i in $(DIRS); \
+ do cd $$i && make $@; \
+ cd .. ;\
+ done
+
+distclean:
+ @for i in $(DIRS); \
+ do cd $$i && make $@; \
+ cd .. ;\
+ done
+
+re: clean all \ No newline at end of file
diff --git a/src/elementaryFunctions/cos/Makefile b/src/elementaryFunctions/cos/Makefile
new file mode 100644
index 00000000..0c18a80f
--- /dev/null
+++ b/src/elementaryFunctions/cos/Makefile
@@ -0,0 +1,47 @@
+##
+## -*- makefile -*-
+##
+## Makefile
+## Made by Bruno JOFRET <bruno.jofret@inria.fr>
+##
+## Started on Thu Nov 30 16:33:40 2006 jofret
+## Last update Thu Dec 7 15:25:32 2006 jofret
+##
+## Copyright INRIA 2006
+##
+
+NAME = ../../lib/libCos.a
+
+RM = rm -f
+CC = gcc
+INCLUDE = ../../type
+LINK = ../../lib
+CFLAGS = -Werror -Wall -pedantic -ansi -I $(INCLUDE) -L $(LINK)
+AR = ar cru
+RANLIB = ranlib
+
+SRC = scoss.c \
+ dcoss.c \
+ ccoss.c \
+ zcoss.c \
+ scosa.c \
+ dcosa.c \
+ ccosa.c \
+ zcosa.c
+
+HEAD = cos.h
+OBJ = $(SRC:.c=.o)
+
+all: $(NAME)
+
+$(NAME) : $(HEAD) $(OBJ)
+ $(AR) $@ $(OBJ)
+ $(RANLIB) $@
+
+clean:
+ $(RM) $(OBJ)
+
+distclean: clean
+ $(RM) $(NAME)
+
+re: clean all
diff --git a/src/elementaryFunctions/cos/ccosa.c b/src/elementaryFunctions/cos/ccosa.c
new file mode 100644
index 00000000..9859ea3d
--- /dev/null
+++ b/src/elementaryFunctions/cos/ccosa.c
@@ -0,0 +1,28 @@
+/*
+** -*- C -*-
+**
+** ccosa.c
+** Made by Bruno JOFRET <bruno.jofret@inria.fr>
+**
+** Started on Thu Dec 7 14:54:24 2006 jofret
+** Last update Thu Dec 7 17:15:29 2006 jofret
+**
+** Copyright INRIA 2006
+*/
+
+
+#ifndef STDC99
+#include "floatComplex.h"
+#else
+#include <complex.h>
+typedef float complex floatComplex;
+#endif
+
+floatComplex ccoss(floatComplex);
+
+void ccosa(floatComplex* x, int strideX, floatComplex* y, int strideY, int size) {
+ int i = 0;
+ for (i = 0; i < size; ++i) {
+ y[i] = ccoss(x[i]);
+ }
+}
diff --git a/src/elementaryFunctions/cos/ccoss.c b/src/elementaryFunctions/cos/ccoss.c
new file mode 100644
index 00000000..7b963d4d
--- /dev/null
+++ b/src/elementaryFunctions/cos/ccoss.c
@@ -0,0 +1,24 @@
+/*
+** -*- C -*-
+**
+** ccoss.c
+** Made by Bruno JOFRET <bruno.jofret@inria.fr>
+**
+** Started on Thu Dec 7 12:04:28 2006 jofret
+** Last update Thu Dec 7 15:25:09 2006 jofret
+**
+** Copyright INRIA 2006
+*/
+
+#ifndef STDC99
+#include "floatComplex.h"
+#else
+#include <complex.h>
+typedef float complex floatComplex;
+#endif
+
+
+floatComplex ccoss(floatComplex z) {
+ /* FIXME: Dummy... */
+ return z;
+}
diff --git a/src/elementaryFunctions/cos/cos.h b/src/elementaryFunctions/cos/cos.h
new file mode 100644
index 00000000..13a4b303
--- /dev/null
+++ b/src/elementaryFunctions/cos/cos.h
@@ -0,0 +1,57 @@
+/*
+** -*- C -*-
+**
+** cos.h
+** Made by Bruno JOFRET <bruno.jofret@inria.fr>
+**
+** Started on Tue Dec 5 15:49:18 2006 jofret
+** Last update Thu Dec 7 15:53:29 2006 jofret
+**
+** Copyright INRIA 2006
+*/
+
+/*
+** Compute Cosine for different types .
+*/
+
+/*
+** \brief Float Cosine function
+*/
+float scoss(float);
+
+/*
+** \brief Double Cosine function
+*/
+double dcoss(double);
+
+/*
+** \brief Float Complex Cosine function
+*/
+floatComplex ccoss(floatComplex);
+
+/*
+** \brief Double Complex Cosine function
+*/
+doubleComplex zcoss(doubleComplex);
+
+/*
+** \brief Float Matrix Cosine function
+*/
+void scosa(float*, int, float*, int, int);
+
+/*
+** \brief Double Matrix Cosine function
+*/
+void dcosa(double*, int, double*, int, int);
+
+/*
+** \brief Float Complex Matrix Cosine function
+*/
+void ccosa(floatComplex*, int, floatComplex*, int, int);
+
+/*
+** \brief Double Complex Matrix Cosine function
+*/
+void zcosa(doubleComplex*, int, doubleComplex*, int, int);
+
+
diff --git a/src/elementaryFunctions/cos/dcosa.c b/src/elementaryFunctions/cos/dcosa.c
new file mode 100644
index 00000000..45c18465
--- /dev/null
+++ b/src/elementaryFunctions/cos/dcosa.c
@@ -0,0 +1,20 @@
+/*
+** -*- C -*-
+**
+** dcosa.c
+** Made by Bruno JOFRET <bruno.jofret@inria.fr>
+**
+** Started on Thu Dec 7 14:54:56 2006 jofret
+** Last update Thu Dec 7 17:30:17 2006 jofret
+**
+** Copyright INRIA 2006
+*/
+
+double dcoss(double);
+
+void dcosa(double* x, int strideX, double* y, int strideY, int size) {
+ int i = 0;
+ for (i = 0; i < size; ++i) {
+ y[i] = dcoss(x[i]);
+ }
+}
diff --git a/src/elementaryFunctions/cos/dcoss.c b/src/elementaryFunctions/cos/dcoss.c
new file mode 100644
index 00000000..37551f2f
--- /dev/null
+++ b/src/elementaryFunctions/cos/dcoss.c
@@ -0,0 +1,17 @@
+/*
+** -*- C -*-
+**
+** dcoss.c
+** Made by Bruno JOFRET <bruno.jofret@inria.fr>
+**
+** Started on Thu Dec 7 12:02:41 2006 jofret
+** Last update Thu Dec 7 17:33:14 2006 jofret
+**
+** Copyright INRIA 2006
+*/
+
+#include <math.h>
+
+double dcoss(double x) {
+ return (cos(x));
+}
diff --git a/src/elementaryFunctions/cos/scosa.c b/src/elementaryFunctions/cos/scosa.c
new file mode 100644
index 00000000..ef9ae739
--- /dev/null
+++ b/src/elementaryFunctions/cos/scosa.c
@@ -0,0 +1,20 @@
+/*
+** -*- C -*-
+**
+** scosa.c
+** Made by Bruno JOFRET <bruno.jofret@inria.fr>
+**
+** Started on Thu Dec 7 16:03:27 2006 jofret
+** Last update Thu Dec 7 17:32:22 2006 jofret
+**
+** Copyright INRIA 2006
+*/
+
+float scoss(float);
+
+void scosa(float* x, int strideX, float* y, int strideY, int size) {
+ int i = 0;
+ for (i = 0; i < size; ++i) {
+ y[i] = scoss(x[i]);
+ }
+}
diff --git a/src/elementaryFunctions/cos/scoss.c b/src/elementaryFunctions/cos/scoss.c
new file mode 100644
index 00000000..1964a25f
--- /dev/null
+++ b/src/elementaryFunctions/cos/scoss.c
@@ -0,0 +1,17 @@
+/*
+** -*- C -*-
+**
+** scoss.c
+** Made by Bruno JOFRET <bruno.jofret@inria.fr>
+**
+** Started on Thu Dec 7 11:05:37 2006 jofret
+** Last update Thu Dec 7 17:32:52 2006 jofret
+**
+** Copyright INRIA 2006
+*/
+
+#include <math.h>
+
+float scoss(float x) {
+ return (cos(x));
+}
diff --git a/src/elementaryFunctions/cos/zcosa.c b/src/elementaryFunctions/cos/zcosa.c
new file mode 100644
index 00000000..9e76b850
--- /dev/null
+++ b/src/elementaryFunctions/cos/zcosa.c
@@ -0,0 +1,27 @@
+/*
+** -*- C -*-
+**
+** zcosa.c
+** Made by Bruno JOFRET <bruno.jofret@inria.fr>
+**
+** Started on Thu Dec 7 16:12:02 2006 jofret
+** Last update Thu Dec 7 17:18:38 2006 jofret
+**
+** Copyright INRIA 2006
+*/
+
+#ifndef STDC99
+#include "doubleComplex.h"
+#else
+#include <complex.h>
+typedef double complex doubleComplex;
+#endif
+
+doubleComplex zcoss(doubleComplex);
+
+void zcosa(doubleComplex* x, int strideX, doubleComplex* y, int strideY, int size) {
+ int i = 0;
+ for (i = 0; i < size; ++i) {
+ y[i] = zcoss(x[i]);
+ }
+}
diff --git a/src/elementaryFunctions/cos/zcoss.c b/src/elementaryFunctions/cos/zcoss.c
new file mode 100644
index 00000000..b921a9c9
--- /dev/null
+++ b/src/elementaryFunctions/cos/zcoss.c
@@ -0,0 +1,24 @@
+/*
+** -*- C -*-
+**
+** zcoss.c
+** Made by Bruno JOFRET <bruno.jofret@inria.fr>
+**
+** Started on Thu Dec 7 12:05:48 2006 jofret
+** Last update Thu Dec 7 16:43:16 2006 jofret
+**
+** Copyright INRIA 2006
+*/
+
+#ifndef STDC99
+#include "doubleComplex.h"
+#else
+#include <complex.h>
+typedef double complex doubleComplex;
+#endif
+
+
+doubleComplex zcoss(doubleComplex z) {
+ /* FIXME: Dummy... */
+ return (DoubleComplex(0,1));
+}
diff --git a/src/type/Makefile b/src/type/Makefile
index d93c90e7..77bb93c4 100644
--- a/src/type/Makefile
+++ b/src/type/Makefile
@@ -5,14 +5,14 @@
## Made by Bruno JOFRET <bruno.jofret@inria.fr>
##
## Started on Thu Nov 30 16:33:40 2006 jofret
-## Last update Thu Dec 7 14:27:32 2006 jofret
+## Last update Thu Dec 7 15:04:27 2006 jofret
##
## Copyright INRIA 2006
##
RM = rm -f
CC = gcc
-CFLAGS = -Wall -pedantic -ansi
+CFLAGS = -Wall -pedantic -ansi -Werror
AR = ar cru
RANLIB = ranlib
@@ -50,4 +50,5 @@ clean:
distclean: clean
$(RM) $(LIBS)
+re: clean all