MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / greatestPrimeFactor

Function greatestPrimeFactor

src/backend/common/dispatch.hpp:37–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36template<typename T>
37inline T greatestPrimeFactor(T n) {
38 T v{2};
39
40 while (v <= n) {
41 if (n % v == 0 && isPrime(v))
42 n /= v;
43 else
44 v += 1;
45 }
46
47 return v;
48}
49// Empty columns (dim==1) in refDims are removed from dims & strides.
50// INPUT: refDims, refNdims
51// UPDATE: dims, strides

Callers 1

calcPadInfoFunction · 0.85

Calls 1

isPrimeFunction · 0.85

Tested by

no test coverage detected