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

Function largest_prime_factor

numpy/fft/_pocketfft.c:217–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215 }
216
217NOINLINE static size_t largest_prime_factor (size_t n)
218 {
219 size_t res=1;
220 size_t tmp;
221 while (((tmp=(n>>1))<<1)==n)
222 { res=2; n=tmp; }
223
224 size_t limit=(size_t)sqrt(n+0.01);
225 for (size_t x=3; x<=limit; x+=2)
226 while (((tmp=(n/x))*x)==n)
227 {
228 res=x;
229 n=tmp;
230 limit=(size_t)sqrt(n+0.01);
231 }
232 if (n>1) res=n;
233
234 return res;
235 }
236
237NOINLINE static double cost_guess (size_t n)
238 {

Callers 2

make_cfft_planFunction · 0.85
make_rfft_planFunction · 0.85

Calls 1

sqrtFunction · 0.50

Tested by

no test coverage detected