Skip to content

Commit

Permalink
Include gsl complex files in XaoS, update sffe project files to use c…
Browse files Browse the repository at this point in the history
…orrect implementation for architecture
  • Loading branch information
jblang committed May 18, 2019
1 parent 3190788 commit aa6320b
Show file tree
Hide file tree
Showing 15 changed files with 1,998 additions and 8 deletions.
2 changes: 1 addition & 1 deletion XaoS.pro
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ include($$PWD/src/engine/engine.pri)
include($$PWD/src/filter/filter.pri)
include($$PWD/src/ui-hlp/ui-hlp.pri)
include($$PWD/src/util/util.pri)
#include($$PWD/src/sffe/sffe.pri)
include($$PWD/src/sffe/sffe.pri)
103 changes: 103 additions & 0 deletions src/include/gsl/gsl_complex.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/* complex/gsl_complex.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#ifndef __GSL_COMPLEX_H__
#define __GSL_COMPLEX_H__

#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif

__BEGIN_DECLS


/* two consecutive built-in types as a complex number */
typedef double * gsl_complex_packed ;
typedef float * gsl_complex_packed_float ;
typedef long double * gsl_complex_packed_long_double ;

typedef const double * gsl_const_complex_packed ;
typedef const float * gsl_const_complex_packed_float ;
typedef const long double * gsl_const_complex_packed_long_double ;


/* 2N consecutive built-in types as N complex numbers */
typedef double * gsl_complex_packed_array ;
typedef float * gsl_complex_packed_array_float ;
typedef long double * gsl_complex_packed_array_long_double ;

typedef const double * gsl_const_complex_packed_array ;
typedef const float * gsl_const_complex_packed_array_float ;
typedef const long double * gsl_const_complex_packed_array_long_double ;


/* Yes... this seems weird. Trust us. The point is just that
sometimes you want to make it obvious that something is
an output value. The fact that it lacks a 'const' may not
be enough of a clue for people in some contexts.
*/
typedef double * gsl_complex_packed_ptr ;
typedef float * gsl_complex_packed_float_ptr ;
typedef long double * gsl_complex_packed_long_double_ptr ;

typedef const double * gsl_const_complex_packed_ptr ;
typedef const float * gsl_const_complex_packed_float_ptr ;
typedef const long double * gsl_const_complex_packed_long_double_ptr ;


typedef struct
{
long double dat[2];
}
gsl_complex_long_double;

typedef struct
{
double dat[2];
}
gsl_complex;

typedef struct
{
float dat[2];
}
gsl_complex_float;

#define GSL_REAL(z) ((z).dat[0])
#define GSL_IMAG(z) ((z).dat[1])
#define GSL_COMPLEX_P(zp) ((zp)->dat)
#define GSL_COMPLEX_P_REAL(zp) ((zp)->dat[0])
#define GSL_COMPLEX_P_IMAG(zp) ((zp)->dat[1])
#define GSL_COMPLEX_EQ(z1,z2) (((z1).dat[0] == (z2).dat[0]) && ((z1).dat[1] == (z2).dat[1]))

#define GSL_SET_COMPLEX(zp,x,y) do {(zp)->dat[0]=(x); (zp)->dat[1]=(y);} while(0)
#define GSL_SET_REAL(zp,x) do {(zp)->dat[0]=(x);} while(0)
#define GSL_SET_IMAG(zp,y) do {(zp)->dat[1]=(y);} while(0)

#define GSL_SET_COMPLEX_PACKED(zp,n,x,y) do {*((zp)+2*(n))=(x); *((zp)+(2*(n)+1))=(y);} while(0)

__END_DECLS

#endif /* __GSL_COMPLEX_H__ */
142 changes: 142 additions & 0 deletions src/include/gsl/gsl_complex_math.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/* complex/gsl_complex_math.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Jorma Olavi Tähtinen, Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#ifndef __GSL_COMPLEX_MATH_H__
#define __GSL_COMPLEX_MATH_H__
#include <gsl/gsl_inline.h>
#include <gsl/gsl_complex.h>

#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS }
#else
#define __BEGIN_DECLS /* empty */
#define __END_DECLS /* empty */
#endif

__BEGIN_DECLS

/* Complex numbers */

gsl_complex gsl_complex_polar (double r, double theta); /* r= r e^(i theta) */

INLINE_DECL gsl_complex gsl_complex_rect (double x, double y); /* r= real+i*imag */

#ifdef HAVE_INLINE
INLINE_FUN gsl_complex
gsl_complex_rect (double x, double y)
{ /* return z = x + i y */
gsl_complex z;
GSL_SET_COMPLEX (&z, x, y);
return z;
}
#endif

#define GSL_COMPLEX_ONE (gsl_complex_rect(1.0,0.0))
#define GSL_COMPLEX_ZERO (gsl_complex_rect(0.0,0.0))
#define GSL_COMPLEX_NEGONE (gsl_complex_rect(-1.0,0.0))

/* Properties of complex numbers */

double gsl_complex_arg (gsl_complex z); /* return arg(z), -pi< arg(z) <=+pi */
double gsl_complex_abs (gsl_complex z); /* return |z| */
double gsl_complex_abs2 (gsl_complex z); /* return |z|^2 */
double gsl_complex_logabs (gsl_complex z); /* return log|z| */

/* Complex arithmetic operators */

gsl_complex gsl_complex_add (gsl_complex a, gsl_complex b); /* r=a+b */
gsl_complex gsl_complex_sub (gsl_complex a, gsl_complex b); /* r=a-b */
gsl_complex gsl_complex_mul (gsl_complex a, gsl_complex b); /* r=a*b */
gsl_complex gsl_complex_div (gsl_complex a, gsl_complex b); /* r=a/b */

gsl_complex gsl_complex_add_real (gsl_complex a, double x); /* r=a+x */
gsl_complex gsl_complex_sub_real (gsl_complex a, double x); /* r=a-x */
gsl_complex gsl_complex_mul_real (gsl_complex a, double x); /* r=a*x */
gsl_complex gsl_complex_div_real (gsl_complex a, double x); /* r=a/x */

gsl_complex gsl_complex_add_imag (gsl_complex a, double y); /* r=a+iy */
gsl_complex gsl_complex_sub_imag (gsl_complex a, double y); /* r=a-iy */
gsl_complex gsl_complex_mul_imag (gsl_complex a, double y); /* r=a*iy */
gsl_complex gsl_complex_div_imag (gsl_complex a, double y); /* r=a/iy */

gsl_complex gsl_complex_conjugate (gsl_complex z); /* r=conj(z) */
gsl_complex gsl_complex_inverse (gsl_complex a); /* r=1/a */
gsl_complex gsl_complex_negative (gsl_complex a); /* r=-a */

/* Elementary Complex Functions */

gsl_complex gsl_complex_sqrt (gsl_complex z); /* r=sqrt(z) */
gsl_complex gsl_complex_sqrt_real (double x); /* r=sqrt(x) (x<0 ok) */

gsl_complex gsl_complex_pow (gsl_complex a, gsl_complex b); /* r=a^b */
gsl_complex gsl_complex_pow_real (gsl_complex a, double b); /* r=a^b */

gsl_complex gsl_complex_exp (gsl_complex a); /* r=exp(a) */
gsl_complex gsl_complex_log (gsl_complex a); /* r=log(a) (base e) */
gsl_complex gsl_complex_log10 (gsl_complex a); /* r=log10(a) (base 10) */
gsl_complex gsl_complex_log_b (gsl_complex a, gsl_complex b); /* r=log_b(a) (base=b) */

/* Complex Trigonometric Functions */

gsl_complex gsl_complex_sin (gsl_complex a); /* r=sin(a) */
gsl_complex gsl_complex_cos (gsl_complex a); /* r=cos(a) */
gsl_complex gsl_complex_sec (gsl_complex a); /* r=sec(a) */
gsl_complex gsl_complex_csc (gsl_complex a); /* r=csc(a) */
gsl_complex gsl_complex_tan (gsl_complex a); /* r=tan(a) */
gsl_complex gsl_complex_cot (gsl_complex a); /* r=cot(a) */

/* Inverse Complex Trigonometric Functions */

gsl_complex gsl_complex_arcsin (gsl_complex a); /* r=arcsin(a) */
gsl_complex gsl_complex_arcsin_real (double a); /* r=arcsin(a) */
gsl_complex gsl_complex_arccos (gsl_complex a); /* r=arccos(a) */
gsl_complex gsl_complex_arccos_real (double a); /* r=arccos(a) */
gsl_complex gsl_complex_arcsec (gsl_complex a); /* r=arcsec(a) */
gsl_complex gsl_complex_arcsec_real (double a); /* r=arcsec(a) */
gsl_complex gsl_complex_arccsc (gsl_complex a); /* r=arccsc(a) */
gsl_complex gsl_complex_arccsc_real (double a); /* r=arccsc(a) */
gsl_complex gsl_complex_arctan (gsl_complex a); /* r=arctan(a) */
gsl_complex gsl_complex_arccot (gsl_complex a); /* r=arccot(a) */

/* Complex Hyperbolic Functions */

gsl_complex gsl_complex_sinh (gsl_complex a); /* r=sinh(a) */
gsl_complex gsl_complex_cosh (gsl_complex a); /* r=coshh(a) */
gsl_complex gsl_complex_sech (gsl_complex a); /* r=sech(a) */
gsl_complex gsl_complex_csch (gsl_complex a); /* r=csch(a) */
gsl_complex gsl_complex_tanh (gsl_complex a); /* r=tanh(a) */
gsl_complex gsl_complex_coth (gsl_complex a); /* r=coth(a) */

/* Inverse Complex Hyperbolic Functions */

gsl_complex gsl_complex_arcsinh (gsl_complex a); /* r=arcsinh(a) */
gsl_complex gsl_complex_arccosh (gsl_complex a); /* r=arccosh(a) */
gsl_complex gsl_complex_arccosh_real (double a); /* r=arccosh(a) */
gsl_complex gsl_complex_arcsech (gsl_complex a); /* r=arcsech(a) */
gsl_complex gsl_complex_arccsch (gsl_complex a); /* r=arccsch(a) */
gsl_complex gsl_complex_arctanh (gsl_complex a); /* r=arctanh(a) */
gsl_complex gsl_complex_arctanh_real (double a); /* r=arctanh(a) */
gsl_complex gsl_complex_arccoth (gsl_complex a); /* r=arccoth(a) */

__END_DECLS

#endif /* __GSL_COMPLEX_MATH_H__ */
67 changes: 67 additions & 0 deletions src/include/gsl/gsl_inline.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/* gsl_inline.h
*
* Copyright (C) 2008, 2009 Brian Gough
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#ifndef __GSL_INLINE_H__
#define __GSL_INLINE_H__

/* In recent versiions of GCC, the inline keyword has two different
forms: GNU and C99.
In GNU mode we can use 'extern inline' to make inline functions
work like macros. The function is only inlined--it is never output
as a definition in an object file.
In the new C99 mode 'extern inline' has a different meaning--it
causes the definition of the function to be output in each object
file where it is used. This will result in multiple-definition
errors on linking. The 'inline' keyword on its own (without
extern) has the same behavior as the original GNU 'extern inline'.
The C99 style is the default with -std=c99 in GCC 4.3.
This header file allows either form of inline to be used by
redefining the macros INLINE_DECL and INLINE_FUN. These are used
in the public header files as
INLINE_DECL double gsl_foo (double x);
#ifdef HAVE_INLINE
INLINE_FUN double gsl_foo (double x) { return x+1.0; } ;
#endif
*/

#ifdef HAVE_INLINE
# if defined(__GNUC_STDC_INLINE__) || defined(GSL_C99_INLINE) || defined(HAVE_C99_INLINE)
# define INLINE_DECL inline /* use C99 inline */
# define INLINE_FUN inline
# else
# define INLINE_DECL /* use GNU extern inline */
# define INLINE_FUN extern inline
# endif
#else
# define INLINE_DECL /* */
#endif

/* Range checking conditions in headers do not require any run-time
tests of the global variable gsl_check_range. They are enabled or
disabled in user code at compile time with GSL_RANGE_CHECK macro.
See also build.h. */
#define GSL_RANGE_COND(x) (x)

#endif /* __GSL_INLINE_H__ */
Loading

0 comments on commit aa6320b

Please sign in to comment.