summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/elementaryFunctions/acosh/Makefile.am7
-rw-r--r--src/elementaryFunctions/acosh/Makefile.in14
-rw-r--r--src/elementaryFunctions/acosh/cacosha.c20
-rw-r--r--src/elementaryFunctions/acosh/cacoshs.c37
-rw-r--r--src/elementaryFunctions/acosh/dacosha.c20
-rw-r--r--src/elementaryFunctions/acosh/dacoshs.c21
-rw-r--r--src/elementaryFunctions/acosh/sacosha.c20
-rw-r--r--src/elementaryFunctions/acosh/testDoubleAcosh.c4
-rw-r--r--src/elementaryFunctions/acosh/zacosha.c20
-rw-r--r--src/elementaryFunctions/acosh/zacoshs.c17
10 files changed, 114 insertions, 66 deletions
diff --git a/src/elementaryFunctions/acosh/Makefile.am b/src/elementaryFunctions/acosh/Makefile.am
index 55009674..48f23977 100644
--- a/src/elementaryFunctions/acosh/Makefile.am
+++ b/src/elementaryFunctions/acosh/Makefile.am
@@ -39,7 +39,14 @@ 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/acos/libAcos.la \
$(top_builddir)/elementaryFunctions/acosh/libAcosh.la \
+ $(top_builddir)/elementaryFunctions/atan/libAtan.la \
+ $(top_builddir)/elementaryFunctions/log/libLog.la \
+ $(top_builddir)/elementaryFunctions/log1p/libLog1p.la \
+ $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \
+ $(top_builddir)/auxiliaryFunctions/abs/libAbs.la \
@LIBMATH@
check_PROGRAMS = testFloatAcosh testDoubleAcosh
diff --git a/src/elementaryFunctions/acosh/Makefile.in b/src/elementaryFunctions/acosh/Makefile.in
index b514a376..c4efad75 100644
--- a/src/elementaryFunctions/acosh/Makefile.in
+++ b/src/elementaryFunctions/acosh/Makefile.in
@@ -68,8 +68,14 @@ am_testDoubleAcosh_OBJECTS = \
testDoubleAcosh_OBJECTS = $(am_testDoubleAcosh_OBJECTS)
am__DEPENDENCIES_1 = $(top_builddir)/type/libDoubleComplex.la \
$(top_builddir)/type/libFloatComplex.la \
+ $(top_builddir)/lib/lapack/libscilapack.la \
$(top_builddir)/elementaryFunctions/acos/libAcos.la \
- $(top_builddir)/elementaryFunctions/acosh/libAcosh.la
+ $(top_builddir)/elementaryFunctions/acosh/libAcosh.la \
+ $(top_builddir)/elementaryFunctions/atan/libAtan.la \
+ $(top_builddir)/elementaryFunctions/log/libLog.la \
+ $(top_builddir)/elementaryFunctions/log1p/libLog1p.la \
+ $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \
+ $(top_builddir)/auxiliaryFunctions/abs/libAbs.la
testDoubleAcosh_DEPENDENCIES = $(am__DEPENDENCIES_1)
testDoubleAcosh_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(testDoubleAcosh_CFLAGS) \
@@ -234,8 +240,14 @@ 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/acos/libAcos.la \
$(top_builddir)/elementaryFunctions/acosh/libAcosh.la \
+ $(top_builddir)/elementaryFunctions/atan/libAtan.la \
+ $(top_builddir)/elementaryFunctions/log/libLog.la \
+ $(top_builddir)/elementaryFunctions/log1p/libLog1p.la \
+ $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \
+ $(top_builddir)/auxiliaryFunctions/abs/libAbs.la \
@LIBMATH@
diff --git a/src/elementaryFunctions/acosh/cacosha.c b/src/elementaryFunctions/acosh/cacosha.c
index dd4fa6ba..925ddf88 100644
--- a/src/elementaryFunctions/acosh/cacosha.c
+++ b/src/elementaryFunctions/acosh/cacosha.c
@@ -1,14 +1,14 @@
/*
-** -*- C -*-
-**
-** cacosha.c
-** Made by Bruno JOFRET <bruno.jofret@inria.fr>
-**
-** Started on Fri Jan 5 10:23:49 2007 jofret
-** Last update Mon Oct 22 09:59:42 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
+ *
+ */
#include "acosh.h"
diff --git a/src/elementaryFunctions/acosh/cacoshs.c b/src/elementaryFunctions/acosh/cacoshs.c
index 6fa0ebf3..b90de13d 100644
--- a/src/elementaryFunctions/acosh/cacoshs.c
+++ b/src/elementaryFunctions/acosh/cacoshs.c
@@ -1,18 +1,31 @@
/*
-** -*- C -*-
-**
-** cacoshs.c
-** Made by Bruno JOFRET <bruno.jofret@inria.fr>
-**
-** Started on Fri Jan 5 11:29:45 2007 jofret
-** Last update Thu Sep 6 10:44:09 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
+ *
+ */
+
+// METHOD
+// based on the formula :
+//
+// acosh(z) = sign(-imag(acos(z)) i acos(z)
+//
+// sign(x) = 1 if x >= 0
+// | -1 if x < 0
#include "acosh.h"
+#include "acos.h"
+
+#define localSign(x) x >= 0 ? 1.0f : -1.0f
floatComplex cacoshs(floatComplex z) {
- /* FIXME: Dummy... */
- return z;
+ floatComplex acos_z = cacoss(z);
+ float sign = localSign(-cimags(acos_z));
+
+ return FloatComplex(-sign * cimags(acos_z), sign * creals(acos_z));
}
diff --git a/src/elementaryFunctions/acosh/dacosha.c b/src/elementaryFunctions/acosh/dacosha.c
index f6ddc6fc..d681a052 100644
--- a/src/elementaryFunctions/acosh/dacosha.c
+++ b/src/elementaryFunctions/acosh/dacosha.c
@@ -1,14 +1,14 @@
/*
-** -*- C -*-
-**
-** dacosha.c
-** Made by Bruno JOFRET <bruno.jofret@inria.fr>
-**
-** Started on Fri Jan 5 11:29:20 2007 jofret
-** Last update Mon Oct 22 09:59:29 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
+ *
+ */
#include "acosh.h"
diff --git a/src/elementaryFunctions/acosh/dacoshs.c b/src/elementaryFunctions/acosh/dacoshs.c
index 3d60f07e..978a0b59 100644
--- a/src/elementaryFunctions/acosh/dacoshs.c
+++ b/src/elementaryFunctions/acosh/dacoshs.c
@@ -1,15 +1,14 @@
/*
-** -*- C -*-
-**
-** dacoshs.c
-** Made by Bruno JOFRET <bruno.jofret@inria.fr>
-**
-** Started on Fri Jan 5 10:26:21 2007 jofret
-** Last update Thu Sep 6 10:43:39 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
+ *
+ */
#include <math.h>
#include "acosh.h"
diff --git a/src/elementaryFunctions/acosh/sacosha.c b/src/elementaryFunctions/acosh/sacosha.c
index 450a8a3e..12b748cf 100644
--- a/src/elementaryFunctions/acosh/sacosha.c
+++ b/src/elementaryFunctions/acosh/sacosha.c
@@ -1,14 +1,14 @@
/*
-** -*- C -*-
-**
-** sacosha.c
-** Made by Bruno JOFRET <bruno.jofret@inria.fr>
-**
-** Started on Fri Jan 5 10:25:57 2007 jofret
-** Last update Mon Oct 22 09:59:20 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
+ *
+ */
#include "acosh.h"
diff --git a/src/elementaryFunctions/acosh/testDoubleAcosh.c b/src/elementaryFunctions/acosh/testDoubleAcosh.c
index 89dc8784..8dabec28 100644
--- a/src/elementaryFunctions/acosh/testDoubleAcosh.c
+++ b/src/elementaryFunctions/acosh/testDoubleAcosh.c
@@ -15,6 +15,7 @@
void dacoshsTest(void) {
printf(">> Double scalar\n");
printf("dacoshs(0) = %e\n", dacoshs(0.0));
+ printf("dacoshs(0.1) = %e\n", dacoshs(0.1));
printf("dacoshs(PI) = %e\n", dacoshs(DPI));
printf("dacoshs(PI/2) = %e\n", dacoshs(DPI/2));
printf("dacoshs(PI/3) = %e\n", dacoshs(DPI/3));
@@ -28,6 +29,7 @@ void dacoshsTest(void) {
}
void zacoshsTest(void) {
+ doubleComplex dot_one = DoubleComplex(0.1, 0.0);
doubleComplex pi_pi = DoubleComplex(DPI, DPI);
doubleComplex pi_2_pi_2 = DoubleComplex(DPI/2, DPI/2);
doubleComplex pi_2_pi_3 = DoubleComplex(DPI/2, DPI/3);
@@ -35,6 +37,8 @@ void zacoshsTest(void) {
doubleComplex out;
printf(">> Double Complex scalar\n");
+ out = zacoshs(dot_one);
+ printf("zacoshs(0.1 + I*0) = %e + I * %e\n", zreals(out), zimags(out));
out = zacoshs(pi_pi);
printf("zacoshs(PI + I*PI) = %e + I * %e\n", zreals(out), zimags(out));
out = zacoshs(pi_2_pi_2);
diff --git a/src/elementaryFunctions/acosh/zacosha.c b/src/elementaryFunctions/acosh/zacosha.c
index 08329151..c5ba119e 100644
--- a/src/elementaryFunctions/acosh/zacosha.c
+++ b/src/elementaryFunctions/acosh/zacosha.c
@@ -1,14 +1,14 @@
/*
-** -*- C -*-
-**
-** zacosha.c
-** Made by Bruno JOFRET <bruno.jofret@inria.fr>
-**
-** Started on Fri Jan 5 10:25:14 2007 jofret
-** Last update Mon Oct 22 09:59:06 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
+ *
+ */
#include "acosh.h"
diff --git a/src/elementaryFunctions/acosh/zacoshs.c b/src/elementaryFunctions/acosh/zacoshs.c
index fb9b408c..44202226 100644
--- a/src/elementaryFunctions/acosh/zacoshs.c
+++ b/src/elementaryFunctions/acosh/zacoshs.c
@@ -10,9 +10,22 @@
*
*/
+// METHOD
+// based on the formula :
+//
+// acosh(z) = sign(-imag(acos(z)) i acos(z)
+//
+// sign(x) = 1 if x >= 0
+// | -1 if x < 0
+
#include "acosh.h"
+#include "acos.h"
+
+#define localSign(x) x >= 0 ? 1.0 : -1.0
doubleComplex zacoshs(doubleComplex z) {
- /* FIXME: Dummy... */
- return z;
+ doubleComplex acos_z = zacoss(z);
+ double sign = localSign(-zimags(acos_z));
+
+ return DoubleComplex(-sign * zimags(acos_z), sign * zreals(acos_z));
}