Home >Backend Development >C++ >How Can I Optimize My Number Theoretic Transform (NTT) and Modular Arithmetic for Fast Squaring of Very Large Numbers?

How Can I Optimize My Number Theoretic Transform (NTT) and Modular Arithmetic for Fast Squaring of Very Large Numbers?

Linda Hamilton
Linda HamiltonOriginal
2024-12-18 16:56:11893browse

How Can I Optimize My Number Theoretic Transform (NTT) and Modular Arithmetic for Fast Squaring of Very Large Numbers?

Modular arithmetics and NTT (finite field DFT) optimizations

Problem: I wanted to use NTT for fast squaring (see Fast bignum square computation), but the result is slow even for really big numbers .. more than 12000 bits.

So my question is:


  1. Is there a way to optimize my NTT transform?

    I did not mean to speed it by parallelism (threads); this is low-level layer only.

  2. Is there a way to speed up my modular arithmetics?

This is my (already optimized) source code in C for NTT (it's complete and 100% working in C whitout any need for third-party libs and should also be thread-safe. Beware the source array is used as a temporary!!!, Also it cannot transform the array to itself).

The above is the detailed content of How Can I Optimize My Number Theoretic Transform (NTT) and Modular Arithmetic for Fast Squaring of Very Large Numbers?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn