TBCI Numerical high perf. C++ Library  2.8.0
specfun_stdcplx.cpp
Go to the documentation of this file.
1 
5 // $Id: specfun_stdcplx.cpp,v 1.1.2.10 2019/05/28 11:13:02 garloff Exp $
6 
7 //#define NO_NS
8 
9 #include "tbci/specfun_stdcplx.h"
10 #include "tbci/constants.h"
11 #include <stdio.h>
12 #include "tbci/specfun/prototypes2.h"
13 
15 
17  const CPLX__ complex<double>& b,
18  const CPLX__ complex<double>& z)
19 {
20  printf ("????\n");
21  doublecomplex sin_erg;
22  doublecomplex pow_erg;
23  doublecomplex temp;
25 
26  temp.r = pi*b.real(); temp.i = pi*b.imag();
27  z_sin(&sin_erg, &temp);
28 
29  temp.r = -b.real() + 1.0; temp.i = -b.imag();
30  pow_zz(&pow_erg, (doublecomplex*)&z, &temp);
31 
32  res = pi/CPLX__ complex<double>(sin_erg.r, sin_erg.i)
33  *(HypergeometricM(a,b,z)/(gamma(a-b+1.0)*gamma(b))
34  -CPLX__ complex<double>(pow_erg.r, pow_erg.i)
35  *HypergeometricM(a-b+1.0,-b+2.0,z)/(gamma(a)*gamma(-b+2.0))
36  );
37 
38  return res;
39 }
40 
41 
43 {
44  floatcomplex arg = {(float)z.real(), (float)z.imag()};
45  floatcomplex erg;
46  cgamma_(&erg, &arg);
47 
48  return CPLX__ complex<double>(erg.r, erg.i);
49 }
50 
51 
53  const CPLX__ complex<double>& b,
54  const CPLX__ complex<double>& z)
55 {
56  doublecomplex erg = {0, 0};
57  const LONG_ int lnchf = 0; //Log-Ausgabe (1)
58  const LONG_ int ip = 10; //Anzahl der genauen Stellen
59 
60  conhyp_(&erg, (doublecomplex*)&a, (doublecomplex*)&b,
61  (doublecomplex*)&z, &lnchf, &ip);
62 
63  return CPLX__ complex<double>(erg.r, erg.i);
64 }
65 
67 {
68  double zr, zi, fnu;
69  LONG_ int kode, m, n;
70  double cyr[1], cyi[1];
71  LONG_ int nz, ierr;
72 
73  zr = z.real(); zi = z.imag();
74 
75  kode = 1; // Unskaliert
76  m = 1; // Art H1
77  n = 1; // Laenge der Sequenz
78  fnu = MATH__ fabs(order);
79  zbesh_(&zr, &zi, &fnu, &kode, &m, &n, cyr, cyi, &nz, &ierr);
80  if (ierr || nz)
81  fprintf (stderr, "Error computing Hankel function\n");
82  if (order >= 0.0)
83  return CPLX__ complex<double> (cyr[0], cyi[0]);
84  //else
85  static const CPLX__ complex<double> I(0,1);
86  return CPLX__ complex<double>(cyr[0], cyi[0])* MATH__ exp(pi*fnu*I);
87 }
88 
89 
91 {
92  double zr, zi, fnu;
93  LONG_ int kode, m, n;
94  double cyr[1], cyi[1];
95  LONG_ int nz, ierr;
96 
97  zr = z.real(); zi = z.imag();
98 
99  kode = 1; // Unskaliert
100  m = 2; // Art H2
101  n = 1; // Laenge der Sequenz
102  fnu = MATH__ fabs(order);
103  zbesh_(&zr, &zi, &fnu, &kode, &m, &n, cyr, cyi, &nz, &ierr);
104  if (ierr || nz)
105  fprintf (stderr, "Error computing Hankel function\n");
106  if (order >= 0.0)
107  return CPLX__ complex<double> (cyr[0], cyi[0]);
108  //else
109  static const CPLX__ complex<double> I(0,1);
110  return CPLX__ complex<double> (cyr[0], cyi[0]) * MATH__ exp(-pi*fnu*I);
111 }
112 
113 
115 {
116  double zr, zi, fnu;
117  LONG_ int kode, n;
118  double cyr[1], cyi[1];
119  LONG_ int nz, ierr;
120 
121  zr = z.real(); zi = z.imag();
122 
123  kode = 1; // Unskaliert
124  n = 1; // Laenge der Sequenz
125  fnu = MATH__ fabs(order);
126  zbesj_(&zr, &zi, &fnu, &kode, &n, cyr, cyi, &nz, &ierr);
127  if (ierr || nz)
128  fprintf (stderr, "Error computing Hankel function\n");
129  if (order >= 0.0)
130  return CPLX__ complex<double> (cyr[0], cyi[0]);
131  //else
132  //J(-FNU,Z) = J(FNU,Z)*COS(PI*FNU) - Y(FNU,Z)*SIN(PI*FNU)
133  return CPLX__ complex<double>(cyr[0], cyi[0])* MATH__ cos(pi*fnu)
134  - bessely(fnu, z)* MATH__ sin(pi*fnu);
135 }
136 
137 
138 
140 {
141  double zr, zi, fnu;
142  LONG_ int kode, n;
143  double cyr[1], cyi[1];
144  LONG_ int nz, ierr;
145 
146  zr = z.real(); zi = z.imag();
147 
148  kode = 1; // Unskaliert
149  n = 1; // Laenge der Sequenz
150  fnu = MATH__ fabs(order);
151  zbesi_(&zr, &zi, &fnu, &kode, &n, cyr, cyi, &nz, &ierr);
152  if (ierr || nz)
153  fprintf (stderr, "Error computing Hankel function\n");
154  if (order >= 0.0)
155  return CPLX__ complex<double> (cyr[0], cyi[0]);
156  //else
157  //I(-FNU,Z) = I(FNU,Z) + (2/PI)*SIN(PI*FNU)*K(FNU,Z)
158  return CPLX__ complex<double> (cyr[0], cyi[0])
159  + 2.0/pi*MATH__ sin(pi*fnu)*besselk(fnu,z);
160 }
161 
162 
163 
165 {
166  double zr, zi, fnu;
167  LONG_ int kode, n;
168  double cyr[1], cyi[1];
169  LONG_ int nz, ierr;
170 
171  zr = z.real(); zi = z.imag();
172 
173  kode = 1; // Unskaliert
174  n = 1; // Laenge der Sequenz
175  fnu = MATH__ fabs(order);
176  zbesk_(&zr, &zi, &fnu, &kode, &n, cyr, cyi, &nz, &ierr);
177  if (ierr || nz)
178  fprintf (stderr, "Error computing Hankel function\n");
179  if (order >= 0.0)
180  return CPLX__ complex<double> (cyr[0], cyi[0]);
181  //else
182  //o.k.
183  return CPLX__ complex<double> (cyr[0], cyi[0]);
184 }
185 
186 
188 {
189  double zr, zi, fnu;
190  LONG_ int kode, n;
191  double cyr[1], cyi[1];
192  double wcyr[1], wcyi[1];
193  LONG_ int nz, ierr;
194 
195  zr = z.real(); zi = z.imag();
196 
197  kode = 1; // Unskaliert
198  n = 1; // Laenge der Sequenz
199  fnu = MATH__ fabs(order);
200  zbesy_(&zr, &zi, &fnu, &kode, &n, cyr, cyi, &nz, wcyr, wcyi, &ierr);
201  if (ierr || nz)
202  fprintf (stderr, "Error computing Hankel function\n");
203  if (order >= 0.0)
204  return CPLX__ complex<double> (cyr[0], cyi[0]);
205  //else
206  //Y(-FNU,Z) = Y(FNU,Z)*COS(PI*FNU) + J(FNU,Z)*SIN(PI*FNU)
207  return CPLX__ complex<double> (cyr[0], cyi[0])*MATH__ cos(pi*fnu)
208  + besselj(fnu,z)*MATH__ sin(pi*fnu);
209 }
210 
real i
Definition: f2c.h:33
void cgamma_(complex *ret_val, complex *z)
Definition: TOMS404.C:30
int zbesi_(double *zr, double *zi, double *fnu, int *kode, int *n, double *cyr, double *cyi, int *nz, int *ierr)
Definition: zbesi.c:24
TBCI__ cplx< T > cos(const TBCI__ cplx< T > &z)
Definition: cplx.h:786
double fabs(const int a)
Definition: basics.h:1215
int zbesk_(double *zr, double *zi, double *fnu, int *kode, int *n, double *cyr, double *cyi, int *nz, int *ierr)
Definition: zbesk.c:25
#define NAMESPACE_TBCI
Definition: basics.h:317
cplx< double > besselk(double order, const cplx< double > &z)
Definition: specfun.cpp:160
void pow_zz(doublecomplex *r, const doublecomplex *a, const doublecomplex *b)
int zbesh_(double *zr, double *zi, double *fnu, int *kode, int *m, int *n, double *cyr, double *cyi, int *nz, int *ierr)
Definition: zbesh.c:132
cplx< double > gamma(const cplx< double > &z)
Definition: specfun.cpp:39
int zbesy_(double *zr, double *zi, double *fnu, int *kode, int *n, double *cyr, double *cyi, int *nz, double *wcyr, double *wcyi, int *ierr)
Definition: zbesy.c:23
doublereal r
Definition: f2c.h:34
cplx< double > besseli(double order, const cplx< double > &z)
Definition: specfun.cpp:135
const Vector< T > Vector< T > Vector< T > Vector< T > Vector< T > & z
Definition: LM_fit.h:172
T arg(const TBCI__ cplx< T > &c)
Definition: cplx.h:690
int zbesj_(double *zr, double *zi, double *fnu, int *kode, int *n, double *cyr, double *cyi, int *nz, int *ierr)
Definition: zbesj.c:24
const double pi
Definition: constants.h:38
cplx< double > HypergeometricM(const cplx< double > &a, const cplx< double > &b, const cplx< double > &z)
Definition: specfun.cpp:49
NAMESPACE_TBCI cplx< double > besselh1(double order, const cplx< double > &z)
Definition: specfun.cpp:62
TBCI__ cplx< T > sin(const TBCI__ cplx< T > &z)
Definition: cplx.h:776
F_TMatrix< T > b
Definition: f_matrix.h:736
doublereal i
Definition: f2c.h:34
TBCI__ cplx< T > exp(const TBCI__ cplx< T > &z)
Definition: cplx.h:756
cplx< double > bessely(double order, const cplx< double > &z)
Definition: specfun.cpp:183
#define CPLX__
Definition: basics.h:341
void conhyp_(doublecomplex *ret_val, const doublecomplex *a, const doublecomplex *b, const doublecomplex *z, const int *lnchf, const int *ip)
Definition: TOMS_707.C:121
#define LONG_
Definition: prototypes2.h:14
#define NAMESPACE_END
Definition: basics.h:323
cplx< double > besselj(double order, const cplx< double > &z)
Definition: specfun.cpp:110
cplx< double > HypergeometricU(const cplx< double > &a, const cplx< double > &b, const cplx< double > &z)
Definition: specfun.cpp:15
const Vector< T > Vector< T > Vector< T > Vector< T > Vector< T > Vector< T > Vector< T > Vector< T > long int res
Definition: LM_fit.h:199
Definition: f2c.h:33
cplx< double > besselh2(double order, const cplx< double > &z)
Definition: specfun.cpp:86
const unsigned TMatrix< T > const Matrix< T > * a
void z_sin(doublecomplex *r, const doublecomplex *z)
#define MATH__
Definition: basics.h:339
real r
Definition: f2c.h:33