[dirty dipoles] cosmetics (macros for fn signatures)

Former-commit-id: 48cede61bc2ba4a63287b04de8f2c7ca825cfef5
This commit is contained in:
Marek Nečada 2018-01-23 15:10:53 +02:00
parent fecdc07a37
commit 01b23dd912
1 changed files with 18 additions and 32 deletions

View File

@ -44,16 +44,13 @@ typedef complex double (*lrhankelspec)(double, double, double,
// complex double fun(double c, double k0, double k, ccd *a, ccd *b, ccd *d, ccd *e) // complex double fun(double c, double k0, double k, ccd *a, ccd *b, ccd *d, ccd *e)
complex double fk5q1n0l(double c, double k0, double k, LRHANKELDEF(fk5q1n0l){
const complex double *a, const complex double *b, const complex double *d, const complex double *e, const complex double *ash) {
return (FF*e[0]-5*e[1]+10*e[2]-10*e[3]+5*e[4]-e[5])/k0; return (FF*e[0]-5*e[1]+10*e[2]-10*e[3]+5*e[4]-e[5])/k0;
} }
complex double fk5q1n1l(double c, double k0, double k, LRHANKELDEF(fk5q1n1l){
const complex double *a, const complex double *b, const complex double *d, const complex double *e, const complex double *ash) {
return (-FF*d[0]+5*d[1]-10*d[2]+10*d[3]-5*d[4]+d[5])/(k0*k); return (-FF*d[0]+5*d[1]-10*d[2]+10*d[3]-5*d[4]+d[5])/(k0*k);
} }
complex double fk5q1n2l(double c, double k0, double k, LRHANKELDEF(fk5q1n2l){
const complex double *a, const complex double *b, const complex double *d, const complex double *e, const complex double *ash) {
double t = 2/(k*k); double t = 2/(k*k);
return ( (FF*e[0] - t*a[0] + FF*t*d[0]*a[0]) return ( (FF*e[0] - t*a[0] + FF*t*d[0]*a[0])
-5 * (e[1] - t*a[1] + t*d[1]*a[1]) -5 * (e[1] - t*a[1] + t*d[1]*a[1])
@ -63,8 +60,7 @@ complex double fk5q1n2l(double c, double k0, double k,
- (e[5] - t*a[5] + t*d[5]*a[5]) - (e[5] - t*a[5] + t*d[5]*a[5])
)/k0; )/k0;
} }
complex double fk5q1n3l(double c, double k0, double k, LRHANKELDEF(fk5q1n3l){
const complex double *a, const complex double *b, const complex double *d, const complex double *e, const complex double *ash) {
double kk3 = 3*k*k; double kk3 = 3*k*k;
return ( return (
- FF*d[0]*(kk3+4*a[0]*a[0]) - FF*d[0]*(kk3+4*a[0]*a[0])
@ -75,8 +71,7 @@ complex double fk5q1n3l(double c, double k0, double k,
+ d[5]*(kk3+4*a[5]*a[5]) + d[5]*(kk3+4*a[5]*a[5])
)/(k0*k*k*k); )/(k0*k*k*k);
} }
complex double fk5q1n4l(double c, double k0, double k, LRHANKELDEF(fk5q1n4l){
const complex double *a, const complex double *b, const complex double *d, const complex double *e, const complex double *ash) {
double kk8 = k*k*8, kkkk = P4(k); // Není lepší pow? double kk8 = k*k*8, kkkk = P4(k); // Není lepší pow?
return ( return (
+ FF*e[0]*(kkkk + kk8*a[0]*a[0] + 8*P4(a[0])) + FF*e[0]*(kkkk + kk8*a[0]*a[0] + 8*P4(a[0]))
@ -104,8 +99,7 @@ LRHANKELDEF(fk5q1n5s){
#undef FORMK5Q1N5 #undef FORMK5Q1N5
complex double fk5q2n0(double c, double k0, double k, LRHANKELDEF(fk5q2n0){
const complex double *a, const complex double *b, const complex double *d, const complex double *e, const complex double *ash) {
return ( return (
- ash[0] - ash[0]
+ 5 * ash[1] + 5 * ash[1]
@ -115,8 +109,7 @@ complex double fk5q2n0(double c, double k0, double k,
+ ash[5] + ash[5]
) / (k0*k0); ) / (k0*k0);
} }
complex double fk5q2n1l(double c, double k0, double k, LRHANKELDEF(fk5q2n1l){
const complex double *a, const complex double *b, const complex double *d, const complex double *e, const complex double *ash) {
return ( FF *b[0]*a[0] return ( FF *b[0]*a[0]
- 5 *b[1]*a[1] - 5 *b[1]*a[1]
+10 *b[2]*a[2] +10 *b[2]*a[2]
@ -125,8 +118,7 @@ complex double fk5q2n1l(double c, double k0, double k,
- b[5]*a[5] - b[5]*a[5]
)/(k*k0*k0); )/(k*k0*k0);
} }
complex double fk5q2n2l(double c, double k0, double k, LRHANKELDEF(fk5q2n2l){
const complex double *a, const complex double *b, const complex double *d, const complex double *e, const complex double *ash) {
return ( b[0]*a[0]*a[0] return ( b[0]*a[0]*a[0]
+ 5 * b[1]*a[1]*a[1] + 5 * b[1]*a[1]*a[1]
-10 * b[2]*a[2]*a[2] -10 * b[2]*a[2]*a[2]
@ -150,16 +142,13 @@ complex double fk5q3n0l(double c, double k0, double k,
} }
#endif #endif
complex double fk5q1n0s(double c, double k0, double k, LRHANKELDEF(fk5q1n0s){
const complex double *a, const complex double *b, const complex double *d, const complex double *e, const complex double *ash) {
return (e[0]-5*e[1]+10*e[2]-10*e[3]+5*e[4]-e[5])/k0; return (e[0]-5*e[1]+10*e[2]-10*e[3]+5*e[4]-e[5])/k0;
} }
complex double fk5q1n1s(double c, double k0, double k, LRHANKELDEF(fk5q1n1s){
const complex double *a, const complex double *b, const complex double *d, const complex double *e, const complex double *ash) {
return (-d[0]+5*d[1]-10*d[2]+10*d[3]-5*d[4]+d[5])/(k0*k); return (-d[0]+5*d[1]-10*d[2]+10*d[3]-5*d[4]+d[5])/(k0*k);
} }
complex double fk5q1n2s(double c, double k0, double k, LRHANKELDEF(fk5q1n2s){
const complex double *a, const complex double *b, const complex double *d, const complex double *e, const complex double *ash) {
double t = 2/(k*k); double t = 2/(k*k);
return ( (e[0] - t*a[0] + t*d[0]*a[0]) return ( (e[0] - t*a[0] + t*d[0]*a[0])
-5 * (e[1] - t*a[1] + t*d[1]*a[1]) -5 * (e[1] - t*a[1] + t*d[1]*a[1])
@ -170,8 +159,7 @@ complex double fk5q1n2s(double c, double k0, double k,
)/k0; )/k0;
} }
complex double fk5q1n3s(double c, double k0, double k, LRHANKELDEF(fk5q1n3s){
const complex double *a, const complex double *b, const complex double *d, const complex double *e, const complex double *ash) {
double kk3 = 3*k*k; double kk3 = 3*k*k;
return ( return (
- d[0]*(kk3+4*a[0]*a[0]) - d[0]*(kk3+4*a[0]*a[0])
@ -182,8 +170,7 @@ complex double fk5q1n3s(double c, double k0, double k,
+ d[5]*(kk3+4*a[5]*a[5]) + d[5]*(kk3+4*a[5]*a[5])
)/(k0*k*k*k); )/(k0*k*k*k);
} }
complex double fk5q1n4s(double c, double k0, double k, LRHANKELDEF(fk5q1n4s){
const complex double *a, const complex double *b, const complex double *d, const complex double *e, const complex double *ash) {
double kk8 = k*k*8, kkkk = P4(k); // Není lepší pow? double kk8 = k*k*8, kkkk = P4(k); // Není lepší pow?
return ( return (
+ e[0]*(kkkk + kk8*a[0]*a[0] + 8*P4(a[0])) + e[0]*(kkkk + kk8*a[0]*a[0] + 8*P4(a[0]))
@ -197,8 +184,7 @@ complex double fk5q1n4s(double c, double k0, double k,
const lrhankelspec fk5q2n0s = fk5q2n0, fk5q2n0l = fk5q2n0; const lrhankelspec fk5q2n0s = fk5q2n0, fk5q2n0l = fk5q2n0;
complex double fk5q2n1s(double c, double k0, double k, LRHANKELDEF(fk5q2n1s){
const complex double *a, const complex double *b, const complex double *d, const complex double *e, const complex double *ash) {
return ( FF *b[0]*a[0] return ( FF *b[0]*a[0]
- 5 *b[1]*a[1] - 5 *b[1]*a[1]
+10 *b[2]*a[2] +10 *b[2]*a[2]
@ -207,8 +193,7 @@ complex double fk5q2n1s(double c, double k0, double k,
- b[5]*a[5] - b[5]*a[5]
)/(k*k0*k0); )/(k*k0*k0);
} }
complex double fk5q2n2s(double c, double k0, double k, LRHANKELDEF(fk5q2n2s){
const complex double *a, const complex double *b, const complex double *d, const complex double *e, const complex double *ash) {
return ( FF * b[0]*a[0]*a[0] return ( FF * b[0]*a[0]*a[0]
+ 5 * b[1]*a[1]*a[1] + 5 * b[1]*a[1]*a[1]
-10 * b[2]*a[2]*a[2] -10 * b[2]*a[2]*a[2]
@ -301,6 +286,7 @@ void lrhankel_recpart_fill(complex double *target,
} }
} }
#ifdef TESTING
#include <stdio.h> #include <stdio.h>
int main() { int main() {
double k0 = 0.7; double k0 = 0.7;
@ -325,11 +311,11 @@ int main() {
//if (/*!*/((qm==1)&&(n==0))){ // not skip q==2, n=0 for now //if (/*!*/((qm==1)&&(n==0))){ // not skip q==2, n=0 for now
// complex double fun(double c, double k0, double k, ccd *a, ccd *b, ccd *d, ccd *e) // complex double fun(double c, double k0, double k, ccd *a, ccd *b, ccd *d, ccd *e)
complex double result = complex double result =
//transfuns_f[kappa][qm][n](c,k0,k,a,b,d,e,ash); (k < k0 ? transfuns_n : transfuns_f)[kappa][qm][n](c,k0,k,a,b,d,e,ash);
fk5q2n5l(c,k0,k,a,b,d,e,ash);
printf("%.16e %.16e ", creal(result), cimag(result)); printf("%.16e %.16e ", creal(result), cimag(result));
} }
printf("\n"); printf("\n");
} }
return 0; return 0;
} }
#endif