Improving MATLAB's isprime performance without arbitrary-precision arithmetic
This work addresses performance issues for MATLAB users in scientific and engineering fields, but it is incremental as it optimizes an existing function without introducing new paradigms.
The researchers tackled the problem of slow primality testing in MATLAB's isprime function by developing modular arithmetic and vectorized techniques, resulting in speed improvements of 5-10 times for small integers and hundreds of times for large integers and arrays.
MATLAB is a numerical computing platform used by scientists, engineers, mathematicians, and students which contains many mathematical functions, including isprime. MATLAB's isprime function determines which elements of an input array are prime. This research details modular arithmetic techniques, the Miller-Rabin primality test, vectorized operations, and division-minimizing strategies which harness the power of MATLAB's capabilities to improve isprime's performance. The results are typically 5 to 10 times faster for small integers and many hundreds of times faster for large integers and long arrays.