summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjofret2008-05-20 15:00:41 +0000
committerjofret2008-05-20 15:00:41 +0000
commit4887092b4731a40a970cfd0f867287e45db06955 (patch)
tree32b4e340fae8a9f14a8f0607c8fdb6a88cb7adf3 /src
parent5e0af9bec2fcb724a8433910c8d665601d082e1f (diff)
downloadscilab2c-4887092b4731a40a970cfd0f867287e45db06955.tar.gz
scilab2c-4887092b4731a40a970cfd0f867287e45db06955.tar.bz2
scilab2c-4887092b4731a40a970cfd0f867287e45db06955.zip
* Adding atanh Algorithm
* Update file License * Need some tests improvement
Diffstat (limited to 'src')
-rw-r--r--src/elementaryFunctions/atanh/Makefile.am4
-rw-r--r--src/elementaryFunctions/atanh/Makefile.in8
-rw-r--r--src/elementaryFunctions/atanh/catanha.c20
-rw-r--r--src/elementaryFunctions/atanh/catanhs.c6
-rw-r--r--src/elementaryFunctions/atanh/datanha.c20
-rw-r--r--src/elementaryFunctions/atanh/datanhs.c31
-rw-r--r--src/elementaryFunctions/atanh/satanha.c20
-rw-r--r--src/elementaryFunctions/atanh/satanhs.c4
-rw-r--r--src/elementaryFunctions/atanh/testAtanh.h22
-rw-r--r--src/elementaryFunctions/atanh/zatanha.c20
-rw-r--r--src/elementaryFunctions/atanh/zatanhs.c11
11 files changed, 97 insertions, 69 deletions
diff --git a/src/elementaryFunctions/atanh/Makefile.am b/src/elementaryFunctions/atanh/Makefile.am
index df8d31a3..aa78a71d 100644
--- a/src/elementaryFunctions/atanh/Makefile.am
+++ b/src/elementaryFunctions/atanh/Makefile.am
@@ -39,6 +39,10 @@ check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \
check_LDADD = $(top_builddir)/type/libDoubleComplex.la \
$(top_builddir)/type/libFloatComplex.la \
+ $(top_builddir)/lib/lapack/libscilapack.la \
+ $(top_builddir)/elementaryFunctions/atan/libAtan.la \
+ $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \
+ $(top_builddir)/auxiliaryFunctions/abs/libAbs.la \
$(top_builddir)/elementaryFunctions/atanh/libAtanh.la \
@LIBMATH@
diff --git a/src/elementaryFunctions/atanh/Makefile.in b/src/elementaryFunctions/atanh/Makefile.in
index 3d7d9a8e..2a0da2df 100644
--- a/src/elementaryFunctions/atanh/Makefile.in
+++ b/src/elementaryFunctions/atanh/Makefile.in
@@ -68,6 +68,10 @@ am_testDoubleAtanh_OBJECTS = \
testDoubleAtanh_OBJECTS = $(am_testDoubleAtanh_OBJECTS)
am__DEPENDENCIES_1 = $(top_builddir)/type/libDoubleComplex.la \
$(top_builddir)/type/libFloatComplex.la \
+ $(top_builddir)/lib/lapack/libscilapack.la \
+ $(top_builddir)/elementaryFunctions/atan/libAtan.la \
+ $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \
+ $(top_builddir)/auxiliaryFunctions/abs/libAbs.la \
$(top_builddir)/elementaryFunctions/atanh/libAtanh.la
testDoubleAtanh_DEPENDENCIES = $(am__DEPENDENCIES_1)
testDoubleAtanh_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -233,6 +237,10 @@ check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \
check_LDADD = $(top_builddir)/type/libDoubleComplex.la \
$(top_builddir)/type/libFloatComplex.la \
+ $(top_builddir)/lib/lapack/libscilapack.la \
+ $(top_builddir)/elementaryFunctions/atan/libAtan.la \
+ $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \
+ $(top_builddir)/auxiliaryFunctions/abs/libAbs.la \
$(top_builddir)/elementaryFunctions/atanh/libAtanh.la \
@LIBMATH@
diff --git a/src/elementaryFunctions/atanh/catanha.c b/src/elementaryFunctions/atanh/catanha.c
index d6b1986e..0c7a77eb 100644
--- a/src/elementaryFunctions/atanh/catanha.c
+++ b/src/elementaryFunctions/atanh/catanha.c
@@ -1,14 +1,14 @@
/*
-** -*- C -*-
-**
-** catanha.c
-** Made by Bruno JOFRET <bruno.jofret@inria.fr>
-**
-** Started on Thu Dec 7 14:54:24 2006 jofret
-** Last update Mon Oct 22 09:56:50 2007 bruno
-**
-** Copyright INRIA 2006
-*/
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET
+ *
+ * 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 "atanh.h"
diff --git a/src/elementaryFunctions/atanh/catanhs.c b/src/elementaryFunctions/atanh/catanhs.c
index 92af66b3..8c975154 100644
--- a/src/elementaryFunctions/atanh/catanhs.c
+++ b/src/elementaryFunctions/atanh/catanhs.c
@@ -11,8 +11,10 @@
*/
#include "atanh.h"
+#include "atan.h"
floatComplex catanhs(floatComplex z) {
- /* FIXME : Let's code... */
- return z;
+ floatComplex minus_i_z = FloatComplex(cimags(z), -creals(z));
+ floatComplex atan_minus_i_z = catans(minus_i_z);
+ return FloatComplex(-cimags(atan_minus_i_z), creals(atan_minus_i_z));
}
diff --git a/src/elementaryFunctions/atanh/datanha.c b/src/elementaryFunctions/atanh/datanha.c
index 149c6f86..01189a8d 100644
--- a/src/elementaryFunctions/atanh/datanha.c
+++ b/src/elementaryFunctions/atanh/datanha.c
@@ -1,14 +1,14 @@
/*
-** -*- C -*-
-**
-** datanha.c
-** Made by Bruno JOFRET <bruno.jofret@inria.fr>
-**
-** Started on Thu Dec 7 14:54:56 2006 jofret
-** Last update Mon Oct 22 09:56:40 2007 bruno
-**
-** Copyright INRIA 2006
-*/
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET
+ *
+ * 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 "atanh.h"
diff --git a/src/elementaryFunctions/atanh/datanhs.c b/src/elementaryFunctions/atanh/datanhs.c
index c6d80c77..e5eddf39 100644
--- a/src/elementaryFunctions/atanh/datanhs.c
+++ b/src/elementaryFunctions/atanh/datanhs.c
@@ -1,18 +1,23 @@
/*
-** -*- C -*-
-**
-** datanhs.c
-** Made by Bruno JOFRET <bruno.jofret@inria.fr>
-**
-** Started on Thu Dec 7 12:02:41 2006 jofret
-** Last update Thu Sep 6 15:12:05 2007 bruno
-**
-** Copyright INRIA 2006
-*/
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET
+ *
+ * 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 "atanh.h"
-
+#include "atan.h"
+/*
+// METHOD
+// based on the formula atanh(z) = i atan(-i z)
+//
+// Real case : atanh(x) = -imag(atan(-i x))
+*/
double datanhs(double x) {
- return (atanh(x));
+ return (-zimags(zatans(DoubleComplex(0.0, -x))));
}
diff --git a/src/elementaryFunctions/atanh/satanha.c b/src/elementaryFunctions/atanh/satanha.c
index d65f5876..48b79a0d 100644
--- a/src/elementaryFunctions/atanh/satanha.c
+++ b/src/elementaryFunctions/atanh/satanha.c
@@ -1,14 +1,14 @@
/*
-** -*- C -*-
-**
-** satanha.c
-** Made by Bruno JOFRET <bruno.jofret@inria.fr>
-**
-** Started on Thu Dec 7 16:03:27 2006 jofret
-** Last update Mon Oct 22 09:56:30 2007 bruno
-**
-** Copyright INRIA 2006
-*/
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET
+ *
+ * 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 "atanh.h"
diff --git a/src/elementaryFunctions/atanh/satanhs.c b/src/elementaryFunctions/atanh/satanhs.c
index 36eeb99a..15354aad 100644
--- a/src/elementaryFunctions/atanh/satanhs.c
+++ b/src/elementaryFunctions/atanh/satanhs.c
@@ -10,9 +10,9 @@
*
*/
-#include <math.h>
#include "atanh.h"
+#include "atan.h"
float satanhs(float x) {
- return (atanhf(x));
+ return (-cimags(catans(FloatComplex(0.0, -x))));
}
diff --git a/src/elementaryFunctions/atanh/testAtanh.h b/src/elementaryFunctions/atanh/testAtanh.h
index 47a3956f..2c574f83 100644
--- a/src/elementaryFunctions/atanh/testAtanh.h
+++ b/src/elementaryFunctions/atanh/testAtanh.h
@@ -1,14 +1,14 @@
/*
-** -*- C -*-
-**
-** testAtanh.h
-** Made by Bruno JOFRET <bruno.jofret@inria.fr>
-**
-** Started on Fri Mar 30 11:22:40 2007 jofret
-** Last update Thu Sep 6 17:15:05 2007 bruno
-**
-** Copyright INRIA 2007
-*/
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2007-2008 - INRIA - Bruno JOFRET
+ *
+ * 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 _TESTATANH_H_
#define _TESTATANH_H_
@@ -22,6 +22,8 @@ void satanhsTest(void);
void datanhsTest(void);
+/* FIXME : Add missing prototypes and increase tests cases */
+
int testAtanh(void);
#endif /* !_TESTATANH_H_ */
diff --git a/src/elementaryFunctions/atanh/zatanha.c b/src/elementaryFunctions/atanh/zatanha.c
index 659fae61..e35af912 100644
--- a/src/elementaryFunctions/atanh/zatanha.c
+++ b/src/elementaryFunctions/atanh/zatanha.c
@@ -1,14 +1,14 @@
/*
-** -*- C -*-
-**
-** zatanha.c
-** Made by Bruno JOFRET <bruno.jofret@inria.fr>
-**
-** Started on Thu Dec 7 16:12:02 2006 jofret
-** Last update Mon Oct 22 09:56:21 2007 bruno
-**
-** Copyright INRIA 2006
-*/
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET
+ *
+ * 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 "atanh.h"
diff --git a/src/elementaryFunctions/atanh/zatanhs.c b/src/elementaryFunctions/atanh/zatanhs.c
index 1bb6c82d..7fb81126 100644
--- a/src/elementaryFunctions/atanh/zatanhs.c
+++ b/src/elementaryFunctions/atanh/zatanhs.c
@@ -10,9 +10,16 @@
*
*/
+/*
+// METHOD
+// based on the formula atanh(z) = i atan(-i z)
+*/
+
#include "atanh.h"
+#include "atan.h"
doubleComplex zatanhs(doubleComplex z) {
- /* FIXME: Dummy... */
- return z;
+ doubleComplex minus_i_z = DoubleComplex(zimags(z), -zreals(z));
+ doubleComplex atan_minus_i_z = zatans(minus_i_z);
+ return DoubleComplex(-zimags(atan_minus_i_z), zreals(atan_minus_i_z));
}