apint icon indicating copy to clipboard operation
apint copied to clipboard

Better algorithms for the multiplication and division functions

Open AaronKutch opened this issue 6 years ago • 4 comments

This is a continuation of #18 and #27. I am tracking this in one issue, because the specific division algorithm I have in mind uses Karatsuba multiplication. I will post updates here as I experiment more. I will also fix the sprawling technical debt of the division function.

AaronKutch avatar Jul 15 '19 01:07 AaronKutch

As a reminder to myself, I need to check that my unrolling is actually making a difference in the multiplication function

AaronKutch avatar Jul 15 '19 02:07 AaronKutch

Based on problems I have encountered so far, the Karatsuba versions will have to wait for the better constructors and related PRs. However, I am preparing rewrites of the O(n^2) multiplication and division functions using lessons I learned from my slice rotation function. They should be dramatically faster and also reduce cognitive complexity problems. I will not be PRing them until the reorganization PR is settled.

AaronKutch avatar Aug 16 '19 16:08 AaronKutch

Maybe this can be some inspiration for you: https://github.com/paritytech/parity-common/pull/126

Robbepop avatar Aug 16 '19 18:08 Robbepop

A new slice::fill method was added which will help me clean up certain parts

AaronKutch avatar Apr 08 '20 20:04 AaronKutch