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

Function rfftp_comp_twiddle

numpy/fft/_pocketfft.c:1827–1865  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1825 }
1826
1827WARN_UNUSED_RESULT NOINLINE static int rfftp_comp_twiddle (rfftp_plan plan)
1828 {
1829 size_t length=plan->length;
1830 double *twid = RALLOC(double, 2*length);
1831 if (!twid) return -1;
1832 sincos_2pibyn_half(length, twid);
1833 size_t l1=1;
1834 double *ptr=plan->mem;
1835 for (size_t k=0; k<plan->nfct; ++k)
1836 {
1837 size_t ip=plan->fct[k].fct, ido=length/(l1*ip);
1838 if (k<plan->nfct-1) // last factor doesn't need twiddles
1839 {
1840 plan->fct[k].tw=ptr; ptr+=(ip-1)*(ido-1);
1841 for (size_t j=1; j<ip; ++j)
1842 for (size_t i=1; i<=(ido-1)/2; ++i)
1843 {
1844 plan->fct[k].tw[(j-1)*(ido-1)+2*i-2] = twid[2*j*l1*i];
1845 plan->fct[k].tw[(j-1)*(ido-1)+2*i-1] = twid[2*j*l1*i+1];
1846 }
1847 }
1848 if (ip>5) // special factors required by *g functions
1849 {
1850 plan->fct[k].tws=ptr; ptr+=2*ip;
1851 plan->fct[k].tws[0] = 1.;
1852 plan->fct[k].tws[1] = 0.;
1853 for (size_t i=1; i<=(ip>>1); ++i)
1854 {
1855 plan->fct[k].tws[2*i ] = twid[2*i*(length/ip)];
1856 plan->fct[k].tws[2*i+1] = twid[2*i*(length/ip)+1];
1857 plan->fct[k].tws[2*(ip-i) ] = twid[2*i*(length/ip)];
1858 plan->fct[k].tws[2*(ip-i)+1] = -twid[2*i*(length/ip)+1];
1859 }
1860 }
1861 l1*=ip;
1862 }
1863 DEALLOC(twid);
1864 return 0;
1865 }
1866
1867NOINLINE static rfftp_plan make_rfftp_plan (size_t length)
1868 {

Callers 1

make_rfftp_planFunction · 0.85

Calls 1

sincos_2pibyn_halfFunction · 0.85

Tested by

no test coverage detected