Is it possible to use Gwnum library to accelerate the multiplication in Mathematica?

  • 3
    $\begingroup$ This appears to be a C library and yes, they can be principally called through LibraryLink. It is not easy though and it also requires a bit of C programming on your sid. $\endgroup$ – Henrik Schumacher Jul 24 '19 at 17:08
  • 2
    $\begingroup$ To be clear, it won't be possible to override the default multiplication operator (but yes you can call any C library through LibraryLink if you take the time to write the glue code). $\endgroup$ – Szabolcs Jul 24 '19 at 17:46
  • 5
    $\begingroup$ Actually, a quick benchmark seems to show that IntegerDigits takes longer than Mathematica's native multiplication ... Do[IntegerDigits[123456789123456789123456789123456789, 65536], {1000}] // RepeatedTiming vs Do[123456789123456789123456789123456789* 123456789123456789123456789123456789, {1000}] // RepeatedTiming $\endgroup$ – Szabolcs Jul 24 '19 at 20:04
  • 3
    $\begingroup$ This reads like 2 questions to me: 1 Q: Is it possible to call the Gwnum library from Mathematica? A: Probably, with a bit of C programming to glue the two together. And, more interesting perhaps 2 Q Will using Gwnum accelerate multiplication ? A: As a paying customer I'd be a bit miffed to find that it did ! $\endgroup$ – High Performance Mark Jul 27 '19 at 9:45
  • 3
    $\begingroup$ While this is an interesting question, I think it would be prudent to add some extra detail in the question body - link to the library, your reasoning that it would be faster, and so on - so as to spend as little of an answerers time as possible. $\endgroup$ – Carl Lange Jul 27 '19 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.