MCPcopy Create free account
hub / github.com/numpy/numpy / calc_first_octant

Function calc_first_octant

numpy/fft/_pocketfft.c:74–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72 }
73
74NOINLINE static void calc_first_octant(size_t den, double * restrict res)
75 {
76 size_t n = (den+4)>>3;
77 if (n==0) return;
78 res[0]=1.; res[1]=0.;
79 if (n==1) return;
80 size_t l1=(size_t)sqrt(n);
81 for (size_t i=1; i<l1; ++i)
82 my_sincosm1pi((2.*i)/den,&res[2*i]);
83 size_t start=l1;
84 while(start<n)
85 {
86 double cs[2];
87 my_sincosm1pi((2.*start)/den,cs);
88 res[2*start] = cs[0]+1.;
89 res[2*start+1] = cs[1];
90 size_t end = l1;
91 if (start+end>n) end = n-start;
92 for (size_t i=1; i<end; ++i)
93 {
94 double csx[2]={res[2*i], res[2*i+1]};
95 res[2*(start+i)] = ((cs[0]*csx[0] - cs[1]*csx[1] + cs[0]) + csx[0]) + 1.;
96 res[2*(start+i)+1] = (cs[0]*csx[1] + cs[1]*csx[0]) + cs[1] + csx[1];
97 }
98 start += l1;
99 }
100 for (size_t i=1; i<l1; ++i)
101 res[2*i] += 1.;
102 }
103
104NOINLINE static void calc_first_quadrant(size_t n, double * restrict res)
105 {

Callers 3

calc_first_quadrantFunction · 0.85
calc_first_halfFunction · 0.85
sincos_2pibyn_halfFunction · 0.85

Calls 2

my_sincosm1piFunction · 0.85
sqrtFunction · 0.50

Tested by

no test coverage detected