GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
__isprimelarge__.cc File Reference
#include "defun.h"
#include "error.h"
#include "ovl.h"
Include dependency graph for __isprimelarge__.cc:

Go to the source code of this file.

Functions

OCTAVE_EXPORT octave_value_list F__isprimelarge__ (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list F__pollardrho__ (const octave_value_list &args, int)
 
bool isprimescalar (uint64_t n)
 
uint64_t localgcd (uint64_t a, uint64_t b)
 
bool millerrabin (uint64_t div, uint64_t d, uint64_t r, uint64_t n)
 
uint64_t pollardrho (uint64_t n, uint64_t c=1)
 
uint64_t safemultiply (uint64_t a, uint64_t b, uint64_t modulus)
 
uint64_t safepower (uint64_t a, uint64_t b, uint64_t modulus)
 

Function Documentation

◆ F__isprimelarge__()

OCTAVE_EXPORT octave_value_list F__isprimelarge__ ( const octave_value_list args,
int   
)

◆ F__pollardrho__()

OCTAVE_EXPORT octave_value_list F__pollardrho__ ( const octave_value_list args,
int   
)

Definition at line 260 of file __isprimelarge__.cc.

References n, ovl(), pollardrho(), and print_usage().

◆ isprimescalar()

bool isprimescalar ( uint64_t  n)

Definition at line 99 of file __isprimelarge__.cc.

References d, millerrabin(), n, and r.

Referenced by F__isprimelarge__().

◆ localgcd()

uint64_t localgcd ( uint64_t  a,
uint64_t  b 
)
inline

Definition at line 205 of file __isprimelarge__.cc.

Referenced by pollardrho().

◆ millerrabin()

bool millerrabin ( uint64_t  div,
uint64_t  d,
uint64_t  r,
uint64_t  n 
)

Definition at line 81 of file __isprimelarge__.cc.

References d, n, r, safemultiply(), safepower(), and x.

Referenced by isprimescalar().

◆ pollardrho()

uint64_t pollardrho ( uint64_t  n,
uint64_t  c = 1 
)

Definition at line 215 of file __isprimelarge__.cc.

References error_unless(), localgcd(), n, safemultiply(), and x.

Referenced by F__pollardrho__().

◆ safemultiply()

uint64_t safemultiply ( uint64_t  a,
uint64_t  b,
uint64_t  modulus 
)

Definition at line 40 of file __isprimelarge__.cc.

References r.

Referenced by millerrabin(), pollardrho(), and safepower().

◆ safepower()

uint64_t safepower ( uint64_t  a,
uint64_t  b,
uint64_t  modulus 
)

Definition at line 65 of file __isprimelarge__.cc.

References safemultiply().

Referenced by millerrabin().