ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
complex.hpp
Go to the documentation of this file.
1/*
2 * $Id: complex.hpp 77 2012-01-15 15:32:13Z jdl3 $
3 * Copyright (C) 2010, 2011, 2012, 2024 John D Lamb
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#ifndef CCGSL_COMPLEX_HPP
21#define CCGSL_COMPLEX_HPP
22
23#include<cmath>
24#include<cstring>
25#include<complex>
26#include<gsl/gsl_complex.h>
27#include<gsl/gsl_complex_math.h>
28
29namespace gsl {
42 class complex : public gsl_complex {
43 friend class complex_ptr;
44 friend class complex_ref;
45 friend class vector_complex;
46 friend class matrix_complex;
47 public:
48 // Default constructible: so that it can be stored in a container
57 explicit complex( double* dat ){
58 memcpy( this->dat, dat, 2 * sizeof( double ) );
59 }
65 complex( double const real, double const imag ){
66 GSL_SET_REAL( this, real );
67 GSL_SET_IMAG( this, imag );
68 }
73 complex( std::complex<double> const& z ){
74 GSL_SET_REAL( this, std::real( z ) );
75 GSL_SET_IMAG( this, std::imag( z ) );
76 }
77 // copy constructor: default is OK
78 // assignment operator: default is OK
79 // destructor: default is OK
84 complex( gsl_complex const& z ){
85 GSL_SET_REAL( this, GSL_REAL( z ) );
86 GSL_SET_IMAG( this, GSL_IMAG( z ) );
87 }
92#ifdef __GXX_EXPERIMENTAL_CXX0X__
93 explicit operator std::complex<double>() const {
94 return std::complex<double>( GSL_REAL( *this ), GSL_IMAG( *this ) );
95 }
96#else
97 operator std::complex<double>() const {
98 std::complex<double> z = std::complex<double>( GSL_REAL( *this ), GSL_IMAG( *this ) );
99 return z;
100 }
101#endif
106 gsl_complex& get(){ return dynamic_cast<gsl_complex&>( *this ); }
111 gsl_complex const& get() const { return dynamic_cast<gsl_complex const&>( *this ); }
118 static complex rect( double x, double y ){ complex z; GSL_SET_COMPLEX( &z, x, y ); return z; }
125 static complex polar( double r, double theta ){ complex z;
126 GSL_SET_COMPLEX( &z, r * std::cos( theta ), r * std::sin( theta ) ); return z; }
132 void set_complex( double x, double y ){ GSL_SET_COMPLEX( this, x, y );}
137 double real() const { return GSL_REAL( *this ); }
142 double imag() const { return GSL_IMAG( *this ); }
147 void set_real( double x ){ GSL_SET_REAL( this, x ); }
152 void set_imag( double y ){ GSL_SET_IMAG( this, y ); }
158 static double arg( complex const& z ){ return gsl_complex_arg( z ); }
164 static double abs( complex const& z ){ return gsl_complex_abs( z ); }
170 static double abs2( complex const& z ){ return gsl_complex_abs2( z ); }
176 static double logabs( complex const& z ){ return gsl_complex_logabs( z ); }
183 static complex add( complex const& a, complex const& b )
184 { return complex( gsl_complex_add( a, b ) ); }
191 static complex sub( complex const& a, complex const& b )
192 { return complex( gsl_complex_sub( a, b ) ); }
199 static complex mul( complex const& a, complex const& b )
200 { return complex( gsl_complex_mul( a, b ) ); }
207 static complex div( complex const& a, complex const& b )
208 { return complex( gsl_complex_div( a, b ) ); }
215 static complex add_real( complex const& a, double x )
216 { return complex( gsl_complex_add_real( a, x ) ); }
223 static complex sub_real( complex const& a, double x )
224 { return complex( gsl_complex_sub_real( a, x ) ); }
231 static complex mul_real( complex const& a, double x )
232 { return complex( gsl_complex_mul_real( a, x ) ); }
239 static complex div_real( complex const& a, double x )
240 { return complex( gsl_complex_div_real( a, x ) ); }
247 static complex add_imag( complex const& a, double y )
248 { return complex( gsl_complex_add_imag( a, y ) ); }
255 static complex sub_imag( complex const& a, double y )
256 { return complex( gsl_complex_sub_imag( a, y ) ); }
263 static complex mul_imag( complex const& a, double y )
264 { return complex( gsl_complex_mul_imag( a, y ) ); }
271 static complex div_imag( complex const& a, double y )
272 { return complex( gsl_complex_div_imag( a, y ) ); }
278 static complex conjugate( complex const& z )
279 { return complex( gsl_complex_conjugate( z ) ); }
285 static complex inverse( complex const& a )
286 { return complex( gsl_complex_inverse( a ) ); }
292 static complex negative( complex const& a )
293 { return complex( gsl_complex_negative( a ) ); }
299 static complex sqrt( complex const& z )
300 { return complex( gsl_complex_sqrt( z ) ); }
306 static complex sqrt_real( double x )
307 { return complex( gsl_complex_sqrt_real( x ) ); }
314 static complex pow( complex const& a, complex const& b )
315 { return complex( gsl_complex_pow( a, b ) ); }
322 static complex pow_real( complex const& a, double b )
323 { return complex( gsl_complex_pow_real( a, b ) ); }
329 static complex exp( complex const& a )
330 { return complex( gsl_complex_exp( a ) ); }
336 static complex log( complex const& a )
337 { return complex( gsl_complex_log( a ) ); }
343 static complex log10( complex const& a )
344 { return complex( gsl_complex_log10( a ) ); }
351 static complex log_b( complex const& a, complex const& b )
352 { return complex( gsl_complex_log_b( a, b ) ); }
358 static complex sin( complex const& a )
359 { return complex( gsl_complex_sin( a ) ); }
365 static complex cos( complex const& a )
366 { return complex( gsl_complex_cos( a ) ); }
372 static complex sec( complex const& a )
373 { return complex( gsl_complex_sec( a ) ); }
379 static complex csc( complex const& a )
380 { return complex( gsl_complex_csc( a ) ); }
386 static complex tan( complex const& a )
387 { return complex( gsl_complex_tan( a ) ); }
393 static complex cot( complex const& a )
394 { return complex( gsl_complex_cot( a ) ); }
400 static complex arcsin( complex const& a )
401 { return complex( gsl_complex_arcsin( a ) ); }
407 static complex arcsin_real( double a )
408 { return complex( gsl_complex_arcsin_real( a ) ); }
414 static complex arccos( complex const& a )
415 { return complex( gsl_complex_arccos( a ) ); }
421 static complex arccos_real( double a )
422 { return complex( gsl_complex_arccos_real( a ) ); }
428 static complex arcsec( complex const& a )
429 { return complex( gsl_complex_arcsec( a ) ); }
435 static complex arcsec_real( double a )
436 { return complex( gsl_complex_arcsec_real( a ) ); }
442 static complex arccsc( complex const& a )
443 { return complex( gsl_complex_arccsc( a ) ); }
449 static complex arccsc_real( double a )
450 { return complex( gsl_complex_arccsc_real( a ) ); }
456 static complex arctan( complex const& a )
457 { return complex( gsl_complex_arctan( a ) ); }
463 static complex arccot( complex const& a )
464 { return complex( gsl_complex_arccot( a ) ); }
470 static complex sinh( complex const& a )
471 { return complex( gsl_complex_sinh( a ) ); }
477 static complex cosh( complex const& a )
478 { return complex( gsl_complex_cosh( a ) ); }
484 static complex sech( complex const& a )
485 { return complex( gsl_complex_sech( a ) ); }
491 static complex csch( complex const& a )
492 { return complex( gsl_complex_csch( a ) ); }
498 static complex tanh( complex const& a )
499 { return complex( gsl_complex_tanh( a ) ); }
505 static complex coth( complex const& a )
506 { return complex( gsl_complex_coth( a ) ); }
512 static complex arcsinh( complex const& a )
513 { return complex( gsl_complex_arcsinh( a ) ); }
519 static complex arccosh( complex const& a )
520 { return complex( gsl_complex_arccosh( a ) ); }
526 static complex arccosh_real( double a )
527 { return complex( gsl_complex_arccosh_real( a ) ); }
533 static complex arcsech( complex const& a )
534 { return complex( gsl_complex_arcsech( a ) ); }
540 static complex arccsch( complex const& a )
541 { return complex( gsl_complex_arccsch( a ) ); }
547 static complex arctanh( complex const& a )
548 { return complex( gsl_complex_arctanh( a ) ); }
554 static complex arctanh_real( double a )
555 { return complex( gsl_complex_arctanh_real( a ) ); }
561 static complex arccoth( complex const& a )
562 { return complex( gsl_complex_arccoth( a ) ); }
569 bool operator==( complex const& z ) const { return dat[0] == z.dat[0] and dat[1] == z.dat[1]; }
576 bool operator!=( complex const& z ) const { return dat[0] != z.dat[0] or dat[1] != z.dat[1]; }
583 bool operator<( complex const& z ) const {
584 return dat[0] < z.dat[0] or (dat[0] == z.dat[0] and dat[1] < z.dat[1]); }
591 bool operator>( complex const& z ) const {
592 return dat[0] > z.dat[0] or (dat[0] == z.dat[0] and dat[1] > z.dat[1]); }
599 bool operator<=( complex const& z ) const { return *this < z or *this == z; }
606 bool operator>=( complex const& z ) const { return *this > z or *this == z; }
607 };
608
614 protected:
618 double* dat;
619 public:
624 complex_ref( double* dat ) : dat( dat ){}
630 operator gsl_complex() const {
631 gsl_complex z; memcpy( z.dat, dat, 2 * sizeof( double ) ); return z; }
637 operator complex() const {
638 complex z; memcpy( z.dat, dat, 2 * sizeof( double ) ); return z; }
639 // Default constructible
643 complex_ref() : dat( 0 ){}
648 complex_ref( complex& z ) : dat( z.dat ){}
649 // copy constructor: default is OK
650 // assignment operator: default is OK
651 // also need to copy from complex
657 memcpy( dat, z.dat, 2 * sizeof( double ) ); return *this; }
658 // destructor: default is OK
664 void set_complex( double x, double y ){ GSL_SET_COMPLEX( this, x, y );}
669 double real() const { return GSL_REAL( *this ); }
674 double imag() const { return GSL_IMAG( *this ); }
679 void set_real( double x ){ GSL_SET_REAL( this, x ); }
684 void set_imag( double y ){ GSL_SET_IMAG( this, y ); }
685 };
686
691 class complex_ptr : private complex_ref {
692 public:
698 complex_ptr( double* dat ) : complex_ref( dat ){}
703 complex_ref operator*(){ return *this; }
708 complex_ref* operator->(){ return this; }
713 complex_ref const operator*() const { return *this; }
718 complex_ref const* operator->() const { return this; }
719 };
720
733 template<typename Ch,typename Tr>
734 std::basic_ostream<Ch,Tr>& operator<<( std::basic_ostream<Ch,Tr>& stream, complex const& z ){
735 double i = z.imag();
736 if( i >= 0 ) stream << z.real() << "+" << i << "i";
737 else stream << z.real() << "-" << -i << "i";
738 return stream;
739 }
740
753 template<typename Ch,typename Tr>
754 std::basic_ostream<Ch,Tr>& operator<<( std::basic_ostream<Ch,Tr>& stream,
755 complex_ref const& z ){
756 double i = z.imag();
757 if( i >= 0 ) stream << z.real() << "+" << i << "i";
758 else stream << z.real() << "-" << -i << "i";
759 return stream;
760 }
761
772 namespace cpx {
779 inline complex rect( double x, double y ){ return complex::rect( x, y ); }
786 inline complex polar( double r, double theta ){ return complex::polar( r, theta ); }
792 inline double arg( complex const& z ){ return complex::arg( z ); }
798 inline double abs( complex const& z ){ return complex::abs( z ); }
804 inline double abs2( complex const& z ){ return complex::abs2( z ); }
810 inline double logabs( complex const& z ){ return complex::logabs( z ); }
817 inline complex add( complex const& a, complex const& b )
818 { return complex::add( a, b ); }
825 inline complex sub( complex const& a, complex const& b )
826 { return complex::sub( a, b ); }
833 inline complex mul( complex const& a, complex const& b )
834 { return complex::mul( a, b ); }
841 inline complex div( complex const& a, complex const& b )
842 { return complex::div( a, b ); }
849 inline complex add_real( complex const& a, double x )
850 { return complex::add_real( a, x ); }
857 inline complex sub_real( complex const& a, double x )
858 { return complex::sub_real( a, x ); }
865 inline complex mul_real( complex const& a, double x )
866 { return complex::mul_real( a, x ); }
873 inline complex div_real( complex const& a, double x )
874 { return complex::div_real( a, x ); }
881 inline complex add_imag( complex const& a, double y )
882 { return complex::add_imag( a, y ); }
889 inline complex sub_imag( complex const& a, double y )
890 { return complex::sub_imag( a, y ); }
897 inline complex mul_imag( complex const& a, double y )
898 { return complex::mul_imag( a, y ); }
905 inline complex div_imag( complex const& a, double y )
906 { return complex::div_imag( a, y ); }
912 inline complex conjugate( complex const& z )
913 { return complex::conjugate( z ); }
919 inline complex inverse( complex const& a )
920 { return complex::inverse( a ); }
926 inline complex negative( complex const& a )
927 { return complex::negative( a ); }
933 inline complex sqrt( complex const& z )
934 { return complex::sqrt( z ); }
940 inline complex sqrt_real( double x )
941 { return complex::sqrt_real( x ); }
948 inline complex pow( complex const& a, complex const& b )
949 { return complex::pow( a, b ); }
956 inline complex pow_real( complex const& a, double b )
957 { return complex::pow_real( a, b ); }
963 inline complex exp( complex const& a )
964 { return complex::exp( a ); }
970 inline complex log( complex const& a )
971 { return complex::log( a ); }
977 inline complex log10( complex const& a )
978 { return complex::log10( a ); }
985 inline complex log_b( complex const& a, complex const& b )
986 { return complex::log_b( a, b ); }
992 inline complex sin( complex const& a )
993 { return complex::sin( a ); }
999 inline complex cos( complex const& a )
1000 { return complex::cos( a ); }
1006 inline complex sec( complex const& a )
1007 { return complex::sec( a ); }
1013 inline complex csc( complex const& a )
1014 { return complex::csc( a ); }
1020 inline complex tan( complex const& a )
1021 { return complex::tan( a ); }
1027 inline complex cot( complex const& a )
1028 { return complex::cot( a ); }
1034 inline complex arcsin( complex const& a )
1035 { return complex::arcsin( a ); }
1041 inline complex arcsin_real( double a )
1042 { return complex::arcsin_real( a ); }
1048 inline complex arccos( complex const& a )
1049 { return complex::arccos( a ); }
1055 inline complex arccos_real( double a )
1056 { return complex::arccos_real( a ); }
1062 inline complex arcsec( complex const& a )
1063 { return complex::arcsec( a ); }
1069 inline complex arcsec_real( double a )
1070 { return complex::arcsec_real( a ); }
1076 inline complex arccsc( complex const& a )
1077 { return complex::arccsc( a ); }
1083 inline complex arccsc_real( double a )
1084 { return complex::arccsc_real( a ); }
1090 inline complex arctan( complex const& a )
1091 { return complex::arctan( a ); }
1097 inline complex arccot( complex const& a )
1098 { return complex::arccot( a ); }
1104 inline complex sinh( complex const& a )
1105 { return complex::sinh( a ); }
1111 inline complex cosh( complex const& a )
1112 { return complex::cosh( a ); }
1118 inline complex sech( complex const& a )
1119 { return complex::sech( a ); }
1125 inline complex csch( complex const& a )
1126 { return complex::csch( a ); }
1132 inline complex tanh( complex const& a )
1133 { return complex::tanh( a ); }
1139 inline complex coth( complex const& a )
1140 { return complex::coth( a ); }
1146 inline complex arcsinh( complex const& a )
1147 { return complex::arcsinh( a ); }
1153 inline complex arccosh( complex const& a )
1154 { return complex::arccosh( a ); }
1160 inline complex arccosh_real( double a )
1161 { return complex::arccosh_real( a ); }
1167 inline complex arcsech( complex const& a )
1168 { return complex::arcsech( a ); }
1174 inline complex arccsch( complex const& a )
1175 { return complex::arccsch( a ); }
1181 inline complex arctanh( complex const& a )
1182 { return complex::arctanh( a ); }
1188 inline complex arctanh_real( double a )
1189 { return complex::arctanh_real( a ); }
1195 inline complex arccoth( complex const& a )
1196 { return complex::arccoth( a ); }
1197 }
1198
1202 typedef gsl_complex_packed complex_packed;
1206 typedef gsl_const_complex_packed complex_const_packed;
1210 typedef gsl_complex_packed_ptr complex_packed_ptr;
1214 typedef gsl_const_complex_packed_ptr complex_const_packed_ptr;
1218 typedef gsl_complex_packed_array complex_packed_array;
1222 typedef gsl_const_complex_packed_array complex_const_packed_array;
1223
1224}
1225
1226#endif
This class can be used like a pointer for complex objects so that we can iterate over a vector (for e...
Definition: complex.hpp:691
complex_ref const operator*() const
Dereference the pointer.
Definition: complex.hpp:713
complex_ref * operator->()
Dereference the pointer.
Definition: complex.hpp:708
complex_ref operator*()
Dereference the pointer.
Definition: complex.hpp:703
complex_ref const * operator->() const
Dereference the pointer.
Definition: complex.hpp:718
complex_ptr(double *dat)
Typically we are given a pointer to the data storing the complex and need to construct a complex_ptr ...
Definition: complex.hpp:698
This class can be used like a reference for complex objects so that we can iterate over a vector (for...
Definition: complex.hpp:613
void set_imag(double y)
C++ version of GSL_SET_IMAG().
Definition: complex.hpp:684
double real() const
C++ version of GSL_REAL().
Definition: complex.hpp:669
complex_ref(double *dat)
We use this in constructing complex_ptr objects.
Definition: complex.hpp:624
void set_complex(double x, double y)
C++ version of GSL_SET_COMPLEX().
Definition: complex.hpp:664
double * dat
The data.
Definition: complex.hpp:618
complex_ref & operator=(complex const &z)
Assignment from complex.
Definition: complex.hpp:656
double imag() const
C++ version of GSL_IMAG().
Definition: complex.hpp:674
void set_real(double x)
C++ version of GSL_SET_REAL().
Definition: complex.hpp:679
complex_ref()
The default constructor is only really useful for assigning to.
Definition: complex.hpp:643
complex_ref(complex &z)
Make sure we can construct from a complex.
Definition: complex.hpp:648
This class handles complex numbers.
Definition: complex.hpp:42
static complex log10(complex const &a)
C++ version of gsl_complex_log10().
Definition: complex.hpp:343
static complex arcsec_real(double a)
C++ version of gsl_complex_arcsec_real().
Definition: complex.hpp:435
static complex arcsec(complex const &a)
C++ version of gsl_complex_arcsec().
Definition: complex.hpp:428
static complex arccsc_real(double a)
C++ version of gsl_complex_arccsc_real().
Definition: complex.hpp:449
static double logabs(complex const &z)
C++ version of gsl_complex_logabs().
Definition: complex.hpp:176
complex(double *dat)
Allow construction from raw data.
Definition: complex.hpp:57
static complex sqrt(complex const &z)
C++ version of gsl_complex_sqrt().
Definition: complex.hpp:299
static complex log_b(complex const &a, complex const &b)
C++ version of gsl_complex_log_b().
Definition: complex.hpp:351
static complex add_real(complex const &a, double x)
C++ version of gsl_complex_add_real().
Definition: complex.hpp:215
static complex arctanh(complex const &a)
C++ version of gsl_complex_arctanh().
Definition: complex.hpp:547
static complex arccsc(complex const &a)
C++ version of gsl_complex_arccsc().
Definition: complex.hpp:442
bool operator==(complex const &z) const
A complex object must be less than comparable so that it can be used as a container value type.
Definition: complex.hpp:569
bool operator>(complex const &z) const
A complex object must be less than comparable so that it can be used as a container value type.
Definition: complex.hpp:591
static complex div(complex const &a, complex const &b)
C++ version of gsl_complex_div().
Definition: complex.hpp:207
static complex arccot(complex const &a)
C++ version of gsl_complex_arccot().
Definition: complex.hpp:463
static complex tan(complex const &a)
C++ version of gsl_complex_tan().
Definition: complex.hpp:386
bool operator>=(complex const &z) const
A complex object must be less than comparable so that it can be used as a container value type.
Definition: complex.hpp:606
static complex mul_real(complex const &a, double x)
C++ version of gsl_complex_mul_real().
Definition: complex.hpp:231
bool operator!=(complex const &z) const
A complex object must be less than comparable so that it can be used as a container value type.
Definition: complex.hpp:576
static complex sub_real(complex const &a, double x)
C++ version of gsl_complex_sub_real().
Definition: complex.hpp:223
static complex inverse(complex const &a)
C++ version of gsl_complex_inverse().
Definition: complex.hpp:285
bool operator<=(complex const &z) const
A complex object must be less than comparable so that it can be used as a container value type.
Definition: complex.hpp:599
static complex sec(complex const &a)
C++ version of gsl_complex_sec().
Definition: complex.hpp:372
static complex add(complex const &a, complex const &b)
C++ version of gsl_complex_add().
Definition: complex.hpp:183
static complex sin(complex const &a)
C++ version of gsl_complex_sin().
Definition: complex.hpp:358
double imag() const
C++ version of GSL_IMAG().
Definition: complex.hpp:142
static double abs2(complex const &z)
C++ version of gsl_complex_abs2().
Definition: complex.hpp:170
static complex tanh(complex const &a)
C++ version of gsl_complex_tanh().
Definition: complex.hpp:498
static complex arcsinh(complex const &a)
C++ version of gsl_complex_arcsinh().
Definition: complex.hpp:512
static complex sub_imag(complex const &a, double y)
C++ version of gsl_complex_sub_imag().
Definition: complex.hpp:255
static complex arctan(complex const &a)
C++ version of gsl_complex_arctan().
Definition: complex.hpp:456
static complex arccos_real(double a)
C++ version of gsl_complex_arccos_real().
Definition: complex.hpp:421
static complex arccoth(complex const &a)
C++ version of gsl_complex_arccoth().
Definition: complex.hpp:561
static complex polar(double r, double theta)
C++ version of gsl_complex_rect().
Definition: complex.hpp:125
static complex div_real(complex const &a, double x)
C++ version of gsl_complex_div_real().
Definition: complex.hpp:239
static complex arccsch(complex const &a)
C++ version of gsl_complex_arccsch().
Definition: complex.hpp:540
static complex arccosh_real(double a)
C++ version of gsl_complex_arccosh_real().
Definition: complex.hpp:526
static complex csc(complex const &a)
C++ version of gsl_complex_csc().
Definition: complex.hpp:379
void set_complex(double x, double y)
C++ version of GSL_SET_COMPLEX().
Definition: complex.hpp:132
static complex sech(complex const &a)
C++ version of gsl_complex_sech().
Definition: complex.hpp:484
complex(gsl_complex const &z)
Constructor from base class.
Definition: complex.hpp:84
static complex cos(complex const &a)
C++ version of gsl_complex_cos().
Definition: complex.hpp:365
static double arg(complex const &z)
C++ version of gsl_complex_arg().
Definition: complex.hpp:158
void set_real(double x)
C++ version of GSL_SET_REAL().
Definition: complex.hpp:147
static complex mul_imag(complex const &a, double y)
C++ version of gsl_complex_mul_imag().
Definition: complex.hpp:263
static complex coth(complex const &a)
C++ version of gsl_complex_coth().
Definition: complex.hpp:505
static complex negative(complex const &a)
C++ version of gsl_complex_negative().
Definition: complex.hpp:292
static complex arctanh_real(double a)
C++ version of gsl_complex_arctanh_real().
Definition: complex.hpp:554
static complex csch(complex const &a)
C++ version of gsl_complex_csch().
Definition: complex.hpp:491
static complex exp(complex const &a)
C++ version of gsl_complex_exp().
Definition: complex.hpp:329
static complex pow_real(complex const &a, double b)
C++ version of gsl_complex_pow_real().
Definition: complex.hpp:322
static complex conjugate(complex const &z)
C++ version of gsl_complex_conjugate().
Definition: complex.hpp:278
static complex sub(complex const &a, complex const &b)
C++ version of gsl_complex_sub().
Definition: complex.hpp:191
void set_imag(double y)
C++ version of GSL_SET_IMAG().
Definition: complex.hpp:152
static complex sqrt_real(double x)
C++ version of gsl_complex_sqrt_real().
Definition: complex.hpp:306
static complex arccosh(complex const &a)
C++ version of gsl_complex_arccosh().
Definition: complex.hpp:519
static complex sinh(complex const &a)
C++ version of gsl_complex_sinh().
Definition: complex.hpp:470
double real() const
C++ version of GSL_REAL().
Definition: complex.hpp:137
static complex mul(complex const &a, complex const &b)
C++ version of gsl_complex_mul().
Definition: complex.hpp:199
static complex rect(double x, double y)
C++ version of gsl_complex_rect().
Definition: complex.hpp:118
complex(std::complex< double > const &z)
Allow construction from a std::complex<double>.
Definition: complex.hpp:73
gsl_complex const & get() const
Get the base class object.
Definition: complex.hpp:111
static complex cosh(complex const &a)
C++ version of gsl_complex_cosh().
Definition: complex.hpp:477
static complex div_imag(complex const &a, double y)
C++ version of gsl_complex_div_imag().
Definition: complex.hpp:271
static complex log(complex const &a)
C++ version of gsl_complex_log().
Definition: complex.hpp:336
complex(double const real, double const imag)
Allow construction from real and imaginary values.
Definition: complex.hpp:65
bool operator<(complex const &z) const
A complex object must be less than comparable so that it can be used as a container value type.
Definition: complex.hpp:583
static complex pow(complex const &a, complex const &b)
C++ version of gsl_complex_pow().
Definition: complex.hpp:314
gsl_complex & get()
Get the base class object.
Definition: complex.hpp:106
static complex arcsech(complex const &a)
C++ version of gsl_complex_arcsech().
Definition: complex.hpp:533
static complex arcsin(complex const &a)
C++ version of gsl_complex_arcsin().
Definition: complex.hpp:400
static complex arcsin_real(double a)
C++ version of gsl_complex_arcsin_real().
Definition: complex.hpp:407
static complex cot(complex const &a)
C++ version of gsl_complex_cot().
Definition: complex.hpp:393
complex()
The default constructor is only really useful for assigning to.
Definition: complex.hpp:52
static double abs(complex const &z)
C++ version of gsl_complex_abs().
Definition: complex.hpp:164
static complex arccos(complex const &a)
C++ version of gsl_complex_arccos().
Definition: complex.hpp:414
static complex add_imag(complex const &a, double y)
C++ version of gsl_complex_add_imag().
Definition: complex.hpp:247
This class handles matrix_complex objects as shared handles.
This class handles vector_complex objects as shared handles.
complex log(complex const &a)
C++ version of gsl_complex_log().
Definition: complex.hpp:970
complex sqrt_real(double x)
C++ version of gsl_complex_sqrt_real().
Definition: complex.hpp:940
double arg(complex const &z)
C++ version of gsl_complex_arg().
Definition: complex.hpp:792
complex pow(complex const &a, complex const &b)
C++ version of gsl_complex_pow().
Definition: complex.hpp:948
complex polar(double r, double theta)
C++ version of gsl_complex_rect().
Definition: complex.hpp:786
complex conjugate(complex const &z)
C++ version of gsl_complex_conjugate().
Definition: complex.hpp:912
complex arcsec(complex const &a)
C++ version of gsl_complex_arcsec().
Definition: complex.hpp:1062
complex coth(complex const &a)
C++ version of gsl_complex_coth().
Definition: complex.hpp:1139
complex arcsin(complex const &a)
C++ version of gsl_complex_arcsin().
Definition: complex.hpp:1034
complex div(complex const &a, complex const &b)
C++ version of gsl_complex_div().
Definition: complex.hpp:841
double abs2(complex const &z)
C++ version of gsl_complex_abs2().
Definition: complex.hpp:804
complex csc(complex const &a)
C++ version of gsl_complex_csc().
Definition: complex.hpp:1013
complex cos(complex const &a)
C++ version of gsl_complex_cos().
Definition: complex.hpp:999
complex arctanh(complex const &a)
C++ version of gsl_complex_arctanh().
Definition: complex.hpp:1181
complex arcsech(complex const &a)
C++ version of gsl_complex_arcsech().
Definition: complex.hpp:1167
complex arccos(complex const &a)
C++ version of gsl_complex_arccos().
Definition: complex.hpp:1048
complex exp(complex const &a)
C++ version of gsl_complex_exp().
Definition: complex.hpp:963
complex inverse(complex const &a)
C++ version of gsl_complex_inverse().
Definition: complex.hpp:919
complex arccsch(complex const &a)
C++ version of gsl_complex_arccsch().
Definition: complex.hpp:1174
complex cosh(complex const &a)
C++ version of gsl_complex_cosh().
Definition: complex.hpp:1111
complex arccos_real(double a)
C++ version of gsl_complex_arccos_real().
Definition: complex.hpp:1055
complex sin(complex const &a)
C++ version of gsl_complex_sin().
Definition: complex.hpp:992
complex negative(complex const &a)
C++ version of gsl_complex_negative().
Definition: complex.hpp:926
complex sub(complex const &a, complex const &b)
C++ version of gsl_complex_sub().
Definition: complex.hpp:825
complex sub_imag(complex const &a, double y)
C++ version of gsl_complex_sub_imag().
Definition: complex.hpp:889
complex sqrt(complex const &z)
C++ version of gsl_complex_sqrt().
Definition: complex.hpp:933
complex sub_real(complex const &a, double x)
C++ version of gsl_complex_sub_real().
Definition: complex.hpp:857
complex arctanh_real(double a)
C++ version of gsl_complex_arctanh_real().
Definition: complex.hpp:1188
complex sec(complex const &a)
C++ version of gsl_complex_sec().
Definition: complex.hpp:1006
complex sech(complex const &a)
C++ version of gsl_complex_sech().
Definition: complex.hpp:1118
complex arcsec_real(double a)
C++ version of gsl_complex_arcsec_real().
Definition: complex.hpp:1069
complex cot(complex const &a)
C++ version of gsl_complex_cot().
Definition: complex.hpp:1027
double abs(complex const &z)
C++ version of gsl_complex_abs().
Definition: complex.hpp:798
complex arctan(complex const &a)
C++ version of gsl_complex_arctan().
Definition: complex.hpp:1090
complex log_b(complex const &a, complex const &b)
C++ version of gsl_complex_log_b().
Definition: complex.hpp:985
complex mul(complex const &a, complex const &b)
C++ version of gsl_complex_mul().
Definition: complex.hpp:833
complex div_real(complex const &a, double x)
C++ version of gsl_complex_div_real().
Definition: complex.hpp:873
complex mul_real(complex const &a, double x)
C++ version of gsl_complex_mul_real().
Definition: complex.hpp:865
complex add_imag(complex const &a, double y)
C++ version of gsl_complex_add_imag().
Definition: complex.hpp:881
complex arccsc(complex const &a)
C++ version of gsl_complex_arccsc().
Definition: complex.hpp:1076
complex arccot(complex const &a)
C++ version of gsl_complex_arccot().
Definition: complex.hpp:1097
complex pow_real(complex const &a, double b)
C++ version of gsl_complex_pow_real().
Definition: complex.hpp:956
complex sinh(complex const &a)
C++ version of gsl_complex_sinh().
Definition: complex.hpp:1104
complex arcsin_real(double a)
C++ version of gsl_complex_arcsin_real().
Definition: complex.hpp:1041
complex tan(complex const &a)
C++ version of gsl_complex_tan().
Definition: complex.hpp:1020
complex tanh(complex const &a)
C++ version of gsl_complex_tanh().
Definition: complex.hpp:1132
complex rect(double x, double y)
C++ version of gsl_complex_rect().
Definition: complex.hpp:779
complex arccoth(complex const &a)
C++ version of gsl_complex_arccoth().
Definition: complex.hpp:1195
double logabs(complex const &z)
C++ version of gsl_complex_logabs().
Definition: complex.hpp:810
complex log10(complex const &a)
C++ version of gsl_complex_log10().
Definition: complex.hpp:977
complex arcsinh(complex const &a)
C++ version of gsl_complex_arcsinh().
Definition: complex.hpp:1146
complex arccosh_real(double a)
C++ version of gsl_complex_arccosh_real().
Definition: complex.hpp:1160
complex arccosh(complex const &a)
C++ version of gsl_complex_arccosh().
Definition: complex.hpp:1153
complex add(complex const &a, complex const &b)
C++ version of gsl_complex_add().
Definition: complex.hpp:817
complex mul_imag(complex const &a, double y)
C++ version of gsl_complex_mul_imag().
Definition: complex.hpp:897
complex csch(complex const &a)
C++ version of gsl_complex_csch().
Definition: complex.hpp:1125
complex arccsc_real(double a)
C++ version of gsl_complex_arccsc_real().
Definition: complex.hpp:1083
complex div_imag(complex const &a, double y)
C++ version of gsl_complex_div_imag().
Definition: complex.hpp:905
complex add_real(complex const &a, double x)
C++ version of gsl_complex_add_real().
Definition: complex.hpp:849
double b(int order, double qq)
C++ version of gsl_sf_mathieu_b().
Definition: sf_mathieu.hpp:298
double a(int order, double qq)
C++ version of gsl_sf_mathieu_a().
Definition: sf_mathieu.hpp:272
The gsl package creates an interface to the GNU Scientific Library for C++.
Definition: blas.hpp:34
gsl_const_complex_packed_array complex_const_packed_array
Typedef.
Definition: complex.hpp:1222
gsl_const_complex_packed_ptr complex_const_packed_ptr
Typedef.
Definition: complex.hpp:1214
gsl_complex_packed_array complex_packed_array
Typedef.
Definition: complex.hpp:1218
gsl_complex_packed complex_packed
Typedef.
Definition: complex.hpp:1202
gsl_const_complex_packed complex_const_packed
Typedef.
Definition: complex.hpp:1206
gsl_complex_packed_ptr complex_packed_ptr
Typedef.
Definition: complex.hpp:1210
std::basic_ostream< Ch, Tr > & operator<<(std::basic_ostream< Ch, Tr > &stream, complex const &z)
Define the << operator so that we can use expressions like.
Definition: complex.hpp:734