a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
gslpp_complex.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 HEPfit Collaboration
3  *
4  *
5  * For the licensing terms see doc/COPYING.
6  */
7 
8 #include <iostream>
9 #ifndef GSLPP_COMPLEX
10 #define GSLPP_COMPLEX
11 #ifndef __GSL_COMPLEX_H__
12 # include <gsl/gsl_complex.h>
13 #endif
14 #ifndef __GSL_COMPLEX_MATH_H__
15 # include <gsl/gsl_complex_math.h>
16 #endif
17 
24 namespace gslpp
25 {
35  class complex
36  {
37  gsl_complex _complex;
38  public:
39  static const complex& i();
43  complex();
44 
52  complex(const double& real, const double& imag, bool polar = false);
56  complex(const complex& z);
61  complex(const double& a);
66  complex(const gsl_complex* z);
71  complex(const gsl_complex& z);
75  virtual ~complex();
80  bool is_real() const;
85  bool is_imag() const;
87  void assign(const double& real, const double& imag, bool polar);
89  const double& real() const;
91  const double& imag() const;
93  double& real();
95  double& imag();
99  double arg() const;
103  double abs() const;
107  double abs2() const;
111  double log_of_abs() const;
115  complex& operator=(const complex& z);
119  complex& operator=(const double& x);
123  bool operator==(const complex& z1) const;
127  bool operator!=(const complex& z1) const;
131  complex operator-() const;
135  complex operator+(const complex& z1) const;
139  complex operator-(const complex& z1) const;
143  complex operator*(const complex& z1) const;
147  complex operator/(const complex& z1) const;
151  complex& operator+=(const complex& z1);
155  complex& operator-=(const complex& z1);
159  complex& operator*=(const complex& z1);
163  complex& operator/=(const complex& z1);
167  complex operator+(const double& a) const;
171  complex operator-(const double& a) const;
175  complex operator*(const double& a) const;
179  complex operator/(const double& a) const;
183  complex& operator+=(const double& a);
187  complex& operator-=(const double& a);
191  complex& operator*=(const double& a);
195  complex& operator/=(const double& a);
199  complex conjugate() const;
203  complex inverse() const;
205  gsl_complex* as_gsl_type_ptr() const;
206  gsl_complex& as_gsl_type();
207  const gsl_complex& as_gsl_type() const;
208  operator gsl_complex& ();
209  operator const gsl_complex& () const;
210 
218  friend std::ostream& operator<<(std::ostream& output, const complex& z);
228  friend complex operator+(const double& x1, const complex& z2);
229 
236  friend complex operator-(const double& x1, const complex& z2);
237 
244  friend complex operator*(const double& x1, const complex& z2);
245 
252  friend complex operator/(const double& x1,const complex& z2);
256  friend complex exp(const complex& z);
257  friend complex log(const complex& z);
258  friend complex log10(const complex& z);
259  friend complex log(const complex& z,
260  const complex& b);
261  friend complex dilog(const complex& z);
262  friend complex sqrt(const complex& z);
263  friend complex pow(const complex& z1,
264  const complex& z2);
265  friend complex pow(const complex& z,
266  const double x);
267  friend complex sin(const complex& z);
268  friend complex cos(const complex& z);
269  friend complex tan(const complex& z);
270  friend complex sec(const complex& z);
271  friend complex csc(const complex& z);
272  friend complex cot(const complex& z);
273  friend complex arcsin(const complex& z);
274  friend complex arccos(const complex& z);
275  friend complex arctan(const complex& z);
276  friend complex arcsec(const complex& z);
277  friend complex arccsc(const complex& z);
278  friend complex arccot(const complex& z);
279  friend complex sinh(const complex& z);
280  friend complex cosh(const complex& z);
281  friend complex tanh(const complex& z);
282  friend complex sech(const complex& z);
283  friend complex csch(const complex& z);
284  friend complex coth(const complex& z);
285  friend complex arcsinh(const complex& z);
286  friend complex arccosh(const complex& z);
287  friend complex arctanh(const complex& z);
288  friend complex arcsech(const complex& z);
289  friend complex arccsch(const complex& z);
290  friend complex arccoth(const complex& z);
291  };
292 }
293 #endif
294 
gslpp::complex::pow
friend complex pow(const complex &z1, const complex &z2)
Definition: gslpp_complex.cpp:395
gslpp::complex::is_imag
bool is_imag() const
Check if complex number is purely imaginary.
Definition: gslpp_complex.cpp:47
gslpp::complex::cot
friend complex cot(const complex &z)
Definition: gslpp_complex.cpp:465
gslpp::complex::tan
friend complex tan(const complex &z)
Definition: gslpp_complex.cpp:438
gslpp::complex::tanh
friend complex tanh(const complex &z)
Definition: gslpp_complex.cpp:551
gslpp::complex::operator=
complex & operator=(const complex &z)
Assignment operator for a complex variable of complex type.
Definition: gslpp_complex.cpp:96
gslpp::complex::operator<<
friend std::ostream & operator<<(std::ostream &output, const complex &z)
Definition: gslpp_complex.cpp:143
gslpp::complex::arcsin
friend complex arcsin(const complex &z)
Definition: gslpp_complex.cpp:474
gslpp::complex::log_of_abs
double log_of_abs() const
Definition: gslpp_complex.cpp:91
gslpp::complex::dilog
friend complex dilog(const complex &z)
Definition: gslpp_complex.cpp:370
gslpp::complex
A class for defining operations on and functions of complex numbers.
Definition: gslpp_complex.h:35
gslpp::complex::as_gsl_type_ptr
gsl_complex * as_gsl_type_ptr() const
Definition: gslpp_complex.cpp:118
gslpp::complex::sinh
friend complex sinh(const complex &z)
Definition: gslpp_complex.cpp:533
gslpp::complex::log10
friend complex log10(const complex &z)
Definition: gslpp_complex.cpp:351
gslpp::complex::abs2
double abs2() const
Definition: gslpp_complex.cpp:86
gslpp::complex::operator+=
complex & operator+=(const complex &z1)
Addition assignment operator for a complex number.
Definition: gslpp_complex.cpp:215
gslpp::complex::arcsech
friend complex arcsech(const complex &z)
Definition: gslpp_complex.cpp:614
gslpp::complex::cosh
friend complex cosh(const complex &z)
Definition: gslpp_complex.cpp:542
gslpp::complex::arccoth
friend complex arccoth(const complex &z)
Definition: gslpp_complex.cpp:632
gslpp::complex::arccos
friend complex arccos(const complex &z)
Definition: gslpp_complex.cpp:483
gslpp::complex::arctan
friend complex arctan(const complex &z)
Definition: gslpp_complex.cpp:492
gslpp::complex::operator/
complex operator/(const complex &z1) const
Division operator for a complex number.
Definition: gslpp_complex.cpp:209
gslpp::complex::operator+
complex operator+(const complex &z1) const
Addition operator for a complex number.
Definition: gslpp_complex.cpp:191
gslpp::complex::arcsec
friend complex arcsec(const complex &z)
Definition: gslpp_complex.cpp:501
gslpp::complex::imag
const double & imag() const
Definition: gslpp_complex.cpp:59
gslpp::complex::conjugate
complex conjugate() const
Definition: gslpp_complex.cpp:288
gslpp::complex::coth
friend complex coth(const complex &z)
Definition: gslpp_complex.cpp:578
gslpp::complex::csc
friend complex csc(const complex &z)
Definition: gslpp_complex.cpp:456
gslpp::complex::cos
friend complex cos(const complex &z)
Definition: gslpp_complex.cpp:429
gslpp::complex::operator!=
bool operator!=(const complex &z1) const
Inequivalence operator between two complex variables.
Definition: gslpp_complex.cpp:113
gslpp::complex::sin
friend complex sin(const complex &z)
Definition: gslpp_complex.cpp:420
gslpp::complex::operator*
complex operator*(const complex &z1) const
Multiplication operator for a complex number.
Definition: gslpp_complex.cpp:203
gslpp::complex::abs
double abs() const
Definition: gslpp_complex.cpp:81
gslpp::complex::_complex
gsl_complex _complex
Definition: gslpp_complex.h:37
gslpp::complex::sec
friend complex sec(const complex &z)
Definition: gslpp_complex.cpp:447
gslpp::complex::arg
double arg() const
Definition: gslpp_complex.cpp:76
gslpp::complex::complex
complex()
Default constructor for the complex class.
Definition: gslpp_complex.cpp:18
gslpp::complex::i
static const complex & i()
Definition: gslpp_complex.cpp:154
gslpp::complex::sech
friend complex sech(const complex &z)
Definition: gslpp_complex.cpp:560
gslpp::complex::arccot
friend complex arccot(const complex &z)
Definition: gslpp_complex.cpp:519
gslpp::complex::exp
friend complex exp(const complex &z)
Definition: gslpp_complex.cpp:333
gslpp::complex::operator==
bool operator==(const complex &z1) const
Equivalence operator between two complex variables.
Definition: gslpp_complex.cpp:108
gslpp::complex::assign
void assign(const double &real, const double &imag, bool polar)
Definition: gslpp_complex.cpp:173
gslpp::complex::arcsinh
friend complex arcsinh(const complex &z)
Definition: gslpp_complex.cpp:587
gslpp::complex::operator*=
complex & operator*=(const complex &z1)
Muliplication assignment operator for a complex number.
Definition: gslpp_complex.cpp:227
gslpp::complex::arccsc
friend complex arccsc(const complex &z)
Definition: gslpp_complex.cpp:510
gslpp::complex::sqrt
friend complex sqrt(const complex &z)
Definition: gslpp_complex.cpp:385
gslpp::complex::arccosh
friend complex arccosh(const complex &z)
Definition: gslpp_complex.cpp:596
gslpp::complex::~complex
virtual ~complex()
Default destructor for the complex class.
Definition: gslpp_complex.cpp:37
gslpp::complex::operator-
complex operator-() const
Unary minus operator for a complex number.
Definition: gslpp_complex.cpp:185
gslpp::complex::real
const double & real() const
Definition: gslpp_complex.cpp:53
gslpp::complex::operator/=
complex & operator/=(const complex &z1)
Division assignment operator for a complex number.
Definition: gslpp_complex.cpp:233
gslpp::complex::is_real
bool is_real() const
Check if complex number is purely real.
Definition: gslpp_complex.cpp:41
gslpp::complex::as_gsl_type
gsl_complex & as_gsl_type()
Definition: gslpp_complex.cpp:123
gslpp::complex::inverse
complex inverse() const
Definition: gslpp_complex.cpp:294
gslpp::complex::operator-=
complex & operator-=(const complex &z1)
Subtraction assignment operator for a complex number.
Definition: gslpp_complex.cpp:221
gslpp::complex::csch
friend complex csch(const complex &z)
Definition: gslpp_complex.cpp:569
gslpp
Complex number, vector and matrix manipulation using GSL.
Definition: gslpp_complex.cpp:16
gslpp::complex::arctanh
friend complex arctanh(const complex &z)
Definition: gslpp_complex.cpp:605
gslpp::complex::arccsch
friend complex arccsch(const complex &z)
Definition: gslpp_complex.cpp:623
gslpp::complex::log
friend complex log(const complex &z)
Definition: gslpp_complex.cpp:342