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

Function rfftp_factorize

numpy/fft/_pocketfft.c:1782–1812  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1780 }
1781
1782WARN_UNUSED_RESULT
1783static int rfftp_factorize (rfftp_plan plan)
1784 {
1785 size_t length=plan->length;
1786 size_t nfct=0;
1787 while ((length%4)==0)
1788 { if (nfct>=NFCT) return -1; plan->fct[nfct++].fct=4; length>>=2; }
1789 if ((length%2)==0)
1790 {
1791 length>>=1;
1792 // factor 2 should be at the front of the factor list
1793 if (nfct>=NFCT) return -1;
1794 plan->fct[nfct++].fct=2;
1795 SWAP(plan->fct[0].fct, plan->fct[nfct-1].fct,size_t);
1796 }
1797 size_t maxl=(size_t)(sqrt((double)length))+1;
1798 for (size_t divisor=3; (length>1)&&(divisor<maxl); divisor+=2)
1799 if ((length%divisor)==0)
1800 {
1801 while ((length%divisor)==0)
1802 {
1803 if (nfct>=NFCT) return -1;
1804 plan->fct[nfct++].fct=divisor;
1805 length/=divisor;
1806 }
1807 maxl=(size_t)(sqrt((double)length))+1;
1808 }
1809 if (length>1) plan->fct[nfct++].fct=length;
1810 plan->nfct=nfct;
1811 return 0;
1812 }
1813
1814static size_t rfftp_twsize(rfftp_plan plan)
1815 {

Callers 1

make_rfftp_planFunction · 0.85

Calls 1

sqrtFunction · 0.50

Tested by

no test coverage detected