[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin
From: |
Arun Giridhar |
Subject: |
[Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin test |
Date: |
Thu, 28 Oct 2021 18:33:57 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0 |
Follow-up Comment #20, bug #61312 (project octave):
@Markus: Thank you for the tip about boolNDArray. I was able to get it to work
with that change. Earlier I had been trying to construct an octave value
vector directly instead of converting a boolNDArray with ovl().
I'm also very surprised at exactly how much overhead was present in that last
for-loop. Moving that to C++ sped up the overall performance by 2.5x from that
change alone. The latest patch (Patch 12, attached to this comment) is
therefore 2.5x as fast as Patch 11 in Comment #16. Thank you for the guidance
to look at that part.
Patch 12 attached with the following changes compared to Patch 11:
1. Moved the final for-loop in isprime.m to C++, enabling a vector to be
passed instead of a sequence of scalars.
2. Renamed internal functions in the Miller-Rabin code and made some
documentation edits for the end user.
3. Since Miller-Rabin was now faster than before, the THRESHOLD value needed
to be retuned in isprime.m.
Please examine the last line of isprime() and the corresponding C++ use of
boolNDArray in __isprimelarge__. Is there a performance penalty to boolNDArray
when the Octave function will always call it with a row vector?
(file #52166)
_______________________________________________________
Additional Item Attachment:
File name: patch12.patch Size:13 KB
<https://file.savannah.gnu.org/file/patch12.patch?file_id=52166>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?61312>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin test, (continued)
- [Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin test, Arun Giridhar, 2021/10/18
- [Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin test, Markus Mützel, 2021/10/18
- [Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin test, Arun Giridhar, 2021/10/18
- [Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin test, Arun Giridhar, 2021/10/18
- [Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin test, Michael Leitner, 2021/10/18
- [Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin test, Arun Giridhar, 2021/10/18
- [Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin test, Arun Giridhar, 2021/10/18
- [Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin test, Markus Mützel, 2021/10/27
- [Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin test, Arun Giridhar, 2021/10/27
- [Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin test, Markus Mützel, 2021/10/28
- [Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin test,
Arun Giridhar <=
- [Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin test, Markus Mützel, 2021/10/29
- [Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin test, Arun Giridhar, 2021/10/29
- [Octave-bug-tracker] [bug #61312] Extending isprime() with Miller-Rabin test, Markus Mützel, 2021/10/30