octave-bug-tracker
[Top][All Lists]
Advanced

[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: Wed, 27 Oct 2021 18:15:04 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0

Follow-up Comment #18, bug #61312 (project octave):

@Markus: I tried changing the C++ function to handle n-dimensional arrays
instead of scalars so that the for loop could be migrated but I keep getting
an error "value on right hand side of assignment is undefined". This has
nothing to do with prime numbers and everything to do with conversion to/from
uint64NDArray.

If it's not a performance problem having that final for-loop, Patch 11 can be
applied if it looks reliable to you.

Otherwise, this is what I'm trying to do in C++ in a new DEFUN function
__isprimelargevector__ to eliminate the last for-loop, while the scalar
function __isprimelarge__ has been taken out of its DEFUN. It builds but
doesn't return anything and the BISTs fail.


uint64NDArray vec = args(0).xuint64_array_value
("__isprimelargevector__: unable to convert input. Call isprime() instead.");

octave_value_list retval (vec.numel());

for (octave_idx_type i = 0; i < vec.numel(); i++)
  retval(i) = __isprimelarge__ (vec(i));

return retval;



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?61312>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]