OKlibrary  0.2.1.6
flintpp.cpp File Reference
#include "flintpp.h"
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Defines

#define NOTHROW
#define NO_ASSERTS
#define Assert(a)   (void)0
#define FLINTCPPVMAJ   2
#define FLINTCPPVMIN   1

Functions

const LINT operator+ (const LINT &lm, const LINT &ln)
const LINT operator- (const LINT &lm, const LINT &ln)
const LINT operator* (const LINT &lm, const LINT &ln)
const LINT operator/ (const LINT &lm, const LINT &ln)
const LINT operator% (const LINT &lm, const LINT &ln)
const LINT operator<< (const LINT &ln, const int times)
const LINT operator>> (const LINT &ln, const int times)
const LINT operator^ (const LINT &lm, const LINT &ln)
const LINT operator| (const LINT &lm, const LINT &ln)
const LINT operator& (const LINT &lm, const LINT &ln)
const int operator== (const LINT &lm, const LINT &ln)
const int operator!= (const LINT &lm, const LINT &ln)
const int operator< (const LINT &lm, const LINT &ln)
const int operator> (const LINT &lm, const LINT &ln)
const int operator<= (const LINT &lm, const LINT &ln)
const int operator>= (const LINT &lm, const LINT &ln)
void fswap (LINT &a, LINT &b)
void purge (LINT &a)
const LINT add (const LINT &a, const LINT &b)
const LINT sub (const LINT &a, const LINT &b)
const LINT mul (const LINT &a, const LINT &b)
const LINT sqr (const LINT &a)
const LINT divr (const LINT &a, const LINT &b, LINT &r)
const LINT mod (const LINT &a, const LINT &n)
const LINT mod2 (const LINT &a, const USHORT k)
const LINT madd (const LINT &lr, const LINT &ln, const LINT &m)
const LINT msub (const LINT &lr, const LINT &ln, const LINT &m)
const LINT mmul (const LINT &lr, const LINT &ln, const LINT &m)
const LINT msqr (const LINT &lr, const LINT &m)
const LINT mexp (const LINT &lr, const LINT &ln, const LINT &m)
const LINT mexp (const USHORT b, const LINT &ln, const LINT &m)
const LINT mexp (const LINT &lr, const USHORT e, const LINT &m)
const LINT mexp5m (const LINT &lr, const LINT &ln, const LINT &m)
const LINT mexpkm (const LINT &lr, const LINT &ln, const LINT &m)
const LINT mexp2 (const LINT &lr, const USHORT e, const LINT &m)
const LINT shift (const LINT &a, const int noofbits)
const unsigned int ld (const LINT &a)
const int isprime (const LINT &p)
const int iseven (const LINT &p)
const int isodd (const LINT &p)
const LINT issqr (const LINT &lr)
const LINT root (const LINT &lr)
const LINT gcd (const LINT &a, const LINT &b)
const LINT lcm (const LINT &a, const LINT &b)
const LINT xgcd (const LINT &a, const LINT &b, LINT &u, int &sign_u, LINT &v, int &sign_v)
const LINT inv (const LINT &a, const LINT &b)
const int jacobi (const LINT &p, const LINT &q)
const LINT root (const LINT &a, const LINT &p)
const LINT root (const LINT &a, const LINT &p, const LINT &q)
const LINT chinrem (const unsigned int noofeq, LINT **koeff)
const LINT primroot (const unsigned int noofprimes, LINT **primes)
const int twofact (const LINT &even, LINT &odd)
const LINT findprime (const USHORT l)
const LINT findprime (const USHORT l, const LINT &f)
const LINT findprime (const LINT &pmin, const LINT &pmax, const LINT &f)
const LINT nextprime (const LINT &a, const LINT &f)
const LINT extendprime (const USHORT l, const LINT &a, const LINT &q, const LINT &f)
const LINT extendprime (const LINT &pmin, const LINT &pmax, const LINT &a, const LINT &q, const LINT &f)
const LINT strongprime (const USHORT l)
const LINT strongprime (const USHORT l, const LINT &f)
const LINT strongprime (const USHORT l, const USHORT lt, const USHORT lr, const USHORT ls, const LINT &f)
const LINT strongprime (const LINT &pmin, const LINT &pmax, const LINT &f)
const LINT strongprime (const LINT &pmin, const LINT &pmax, const USHORT lt, const USHORT lr, const USHORT ls, const LINT &f)
const int mequ (const LINT &a, const LINT &b, const LINT &m)
void seedl (const LINT &seed)
LINT randl (const int l)
LINT randl (const LINT &rmin, const LINT &rmax)
int seedBBS (const LINT &seed)
LINT randBBS (const int l)
LINT randBBS (const LINT &rmin, const LINT &rmax)
ostream & LintHex (ostream &s)
ostream & LintDec (ostream &s)
ostream & LintOct (ostream &s)
ostream & LintBin (ostream &s)
ostream & LintUpr (ostream &s)
ostream & LintLwr (ostream &s)
ostream & LintShowbase (ostream &s)
ostream & LintNobase (ostream &s)
ostream & LintShowlength (ostream &s)
ostream & LintNolength (ostream &s)
ostream & _SetLintFlags (ostream &s, int flag)
ostream & _ResetLintFlags (ostream &s, int flag)
LINT_omanip< int > SetLintFlags (int flag)
LINT_omanip< int > ResetLintFlags (int flag)
ostream & operator<< (ostream &s, const LINT &ln)
ofstream & operator<< (ofstream &s, const LINT &ln)
fstream & operator<< (fstream &s, const LINT &ln)
ifstream & operator>> (ifstream &s, LINT &ln)
fstream & operator>> (fstream &s, LINT &ln)
char * lint2str (const LINT &ln, const USHORT base, const int showbase)
UCHARlint2byte (const LINT &ln, int *len)

Variables

static void(* LINT_User_Error_Handler )(LINT_ERRORS, const char *const, const int, const int) = NULL

Define Documentation

#define Assert (   a)    (void)0

Definition at line 65 of file flintpp.cpp.

Referenced by extendprime(), randBBS(), randl(), and strongprime().

#define FLINTCPPVMAJ   2

Definition at line 70 of file flintpp.cpp.

#define FLINTCPPVMIN   1

Definition at line 71 of file flintpp.cpp.

#define NO_ASSERTS

Definition at line 56 of file flintpp.cpp.

#define NOTHROW

Definition at line 53 of file flintpp.cpp.


Function Documentation

ostream& _ResetLintFlags ( ostream &  s,
int  flag 
)

Definition at line 3282 of file flintpp.cpp.

References s.

Referenced by ResetLintFlags().

ostream& _SetLintFlags ( ostream &  s,
int  flag 
)

Definition at line 3276 of file flintpp.cpp.

References s.

Referenced by SetLintFlags().

const LINT add ( const LINT &  a,
const LINT &  b 
)

Definition at line 1864 of file flintpp.cpp.

References add_l(), E_CLINT_OFL, and E_CLINT_OK.

const LINT chinrem ( const unsigned int  noofeq,
LINT **  koeff 
)

Definition at line 2529 of file flintpp.cpp.

References chinrem_l().

const LINT divr ( const LINT &  a,
const LINT &  b,
LINT &  r 
)

Definition at line 1970 of file flintpp.cpp.

References div_l(), E_CLINT_DBZ, E_CLINT_OK, and q.

const LINT extendprime ( const USHORT  l,
const LINT &  a,
const LINT &  q,
const LINT &  f 
)

Definition at line 2694 of file flintpp.cpp.

References CLINTMAXBIT.

Referenced by strongprime().

const LINT extendprime ( const LINT &  pmin,
const LINT &  pmax,
const LINT &  a,
const LINT &  q,
const LINT &  f 
)

Definition at line 2713 of file flintpp.cpp.

References Assert, q, randBBS(), and usrandBBS_l().

const LINT findprime ( const USHORT  l)

Definition at line 2600 of file flintpp.cpp.

Referenced by findprime(), and strongprime().

const LINT findprime ( const USHORT  l,
const LINT &  f 
)

Definition at line 2609 of file flintpp.cpp.

References CLINTMAXBIT, and findprime().

const LINT findprime ( const LINT &  pmin,
const LINT &  pmax,
const LINT &  f 
)

Definition at line 2626 of file flintpp.cpp.

References randBBS().

void fswap ( LINT &  a,
LINT &  b 
)

Definition at line 1159 of file flintpp.cpp.

const LINT inv ( const LINT &  a,
const LINT &  b 
)

Definition at line 2468 of file flintpp.cpp.

References inv_l().

Referenced by strongprime().

const int iseven ( const LINT &  p)

Definition at line 2375 of file flintpp.cpp.

References ISEVEN_L.

const int isodd ( const LINT &  p)

Definition at line 2382 of file flintpp.cpp.

References ISODD_L.

const int isprime ( const LINT &  p)

Definition at line 2368 of file flintpp.cpp.

References ISPRIME_L.

Referenced by prime_l().

const LINT issqr ( const LINT &  lr)

Definition at line 2389 of file flintpp.cpp.

References issqr_l().

const int jacobi ( const LINT &  p,
const LINT &  q 
)

Definition at line 2481 of file flintpp.cpp.

References jacobi_l().

const LINT lcm ( const LINT &  a,
const LINT &  b 
)

Definition at line 2426 of file flintpp.cpp.

References E_CLINT_OFL, E_CLINT_OK, and lcm_l().

const unsigned int ld ( const LINT &  a)

Definition at line 2361 of file flintpp.cpp.

References ld_l().

Referenced by operator<<(), randBBS(), randl(), and strongprime().

UCHAR* lint2byte ( const LINT &  ln,
int *  len 
)

Definition at line 3486 of file flintpp.cpp.

References clint2byte_l().

char* lint2str ( const LINT &  ln,
const USHORT  base,
const int  showbase 
)

Definition at line 3466 of file flintpp.cpp.

References xclint2str_l().

Referenced by operator<<().

ostream& LintBin ( ostream &  s)

Definition at line 3231 of file flintpp.cpp.

References s.

ostream& LintDec ( ostream &  s)

Definition at line 3219 of file flintpp.cpp.

References s.

ostream& LintHex ( ostream &  s)

Definition at line 3213 of file flintpp.cpp.

References s.

ostream& LintLwr ( ostream &  s)

Definition at line 3243 of file flintpp.cpp.

References s.

ostream& LintNobase ( ostream &  s)

Definition at line 3255 of file flintpp.cpp.

References s.

ostream& LintNolength ( ostream &  s)

Definition at line 3267 of file flintpp.cpp.

References s.

ostream& LintOct ( ostream &  s)

Definition at line 3225 of file flintpp.cpp.

References s.

ostream& LintShowbase ( ostream &  s)

Definition at line 3249 of file flintpp.cpp.

References s.

ostream& LintShowlength ( ostream &  s)

Definition at line 3261 of file flintpp.cpp.

References s.

ostream& LintUpr ( ostream &  s)

Definition at line 3237 of file flintpp.cpp.

References s.

const LINT madd ( const LINT &  lr,
const LINT &  ln,
const LINT &  m 
)

Definition at line 2043 of file flintpp.cpp.

References E_CLINT_DBZ, E_CLINT_OK, and madd_l().

const int mequ ( const LINT &  a,
const LINT &  b,
const LINT &  m 
)

Definition at line 2952 of file flintpp.cpp.

References E_CLINT_DBZ, and mequ_l().

const LINT mexp ( const LINT &  lr,
const LINT &  ln,
const LINT &  m 
)

Definition at line 2153 of file flintpp.cpp.

References E_CLINT_DBZ, E_CLINT_OK, and mexp_l().

const LINT mexp ( const USHORT  b,
const LINT &  ln,
const LINT &  m 
)

Definition at line 2179 of file flintpp.cpp.

References E_CLINT_DBZ, E_CLINT_OK, wmexp_l(), and wmexpm_l().

const LINT mexp ( const LINT &  lr,
const USHORT  e,
const LINT &  m 
)

Definition at line 2211 of file flintpp.cpp.

References E_CLINT_DBZ, E_CLINT_OK, umexp_l(), and umexpm_l().

const LINT mexp2 ( const LINT &  lr,
const USHORT  e,
const LINT &  m 
)

Definition at line 2301 of file flintpp.cpp.

References E_CLINT_DBZ, E_CLINT_OK, and mexp2_l().

const LINT mexp5m ( const LINT &  lr,
const LINT &  ln,
const LINT &  m 
)

Definition at line 2243 of file flintpp.cpp.

References E_CLINT_DBZ, E_CLINT_MOD, E_CLINT_OK, and mexp5m_l().

const LINT mexpkm ( const LINT &  lr,
const LINT &  ln,
const LINT &  m 
)

Definition at line 2272 of file flintpp.cpp.

References E_CLINT_DBZ, E_CLINT_MOD, E_CLINT_OK, and mexpkm_l().

const LINT mmul ( const LINT &  lr,
const LINT &  ln,
const LINT &  m 
)

Definition at line 2095 of file flintpp.cpp.

References E_CLINT_DBZ, E_CLINT_OK, mmul_l(), and msqr_l().

const LINT mod ( const LINT &  a,
const LINT &  n 
)

Definition at line 1997 of file flintpp.cpp.

References div_l(), E_CLINT_DBZ, and E_CLINT_OK.

const LINT mod2 ( const LINT &  a,
const USHORT  k 
)

Definition at line 2022 of file flintpp.cpp.

References E_CLINT_OK, and mod2_l().

const LINT msqr ( const LINT &  lr,
const LINT &  m 
)

Definition at line 2128 of file flintpp.cpp.

References E_CLINT_DBZ, E_CLINT_OK, and msqr_l().

const LINT msub ( const LINT &  lr,
const LINT &  ln,
const LINT &  m 
)

Definition at line 2069 of file flintpp.cpp.

References E_CLINT_DBZ, E_CLINT_OK, and msub_l().

Referenced by strongprime().

const LINT mul ( const LINT &  a,
const LINT &  b 
)

Definition at line 1916 of file flintpp.cpp.

References E_CLINT_OFL, E_CLINT_OK, mul_l(), and sqr_l().

const LINT nextprime ( const LINT &  a,
const LINT &  f 
)

Definition at line 2677 of file flintpp.cpp.

References gcd().

const int operator!= ( const LINT &  lm,
const LINT &  ln 
)

Definition at line 1016 of file flintpp.cpp.

References equ_l().

const LINT operator% ( const LINT &  lm,
const LINT &  ln 
)

Definition at line 554 of file flintpp.cpp.

References div_l(), E_CLINT_DBZ, E_CLINT_OK, and ZEROCLINT_L.

const LINT operator& ( const LINT &  lm,
const LINT &  ln 
)

Definition at line 949 of file flintpp.cpp.

References and_l().

const LINT operator* ( const LINT &  lm,
const LINT &  ln 
)

Definition at line 498 of file flintpp.cpp.

References E_CLINT_OFL, E_CLINT_OK, mul_l(), and sqr_l().

const LINT operator+ ( const LINT &  lm,
const LINT &  ln 
)

Definition at line 451 of file flintpp.cpp.

References add_l(), E_CLINT_OFL, and E_CLINT_OK.

const LINT operator- ( const LINT &  lm,
const LINT &  ln 
)

Definition at line 474 of file flintpp.cpp.

References E_CLINT_OK, E_CLINT_UFL, and sub_l().

const LINT operator/ ( const LINT &  lm,
const LINT &  ln 
)

Definition at line 527 of file flintpp.cpp.

References div_l(), E_CLINT_DBZ, E_CLINT_OK, and ZEROCLINT_L.

const int operator< ( const LINT &  lm,
const LINT &  ln 
)

Definition at line 1031 of file flintpp.cpp.

References cmp_l().

const LINT operator<< ( const LINT &  ln,
const int  times 
)

Definition at line 805 of file flintpp.cpp.

References E_CLINT_OFL, E_CLINT_OK, E_CLINT_UFL, and shift_l().

ostream& operator<< ( ostream &  s,
const LINT &  ln 
)

Definition at line 3301 of file flintpp.cpp.

References ld(), lint2str(), s, and strupr_l().

ofstream& operator<< ( ofstream &  s,
const LINT &  ln 
)

Definition at line 3367 of file flintpp.cpp.

References DIGITS_L, and s.

fstream& operator<< ( fstream &  s,
const LINT &  ln 
)

Definition at line 3381 of file flintpp.cpp.

References DIGITS_L, and s.

const int operator<= ( const LINT &  lm,
const LINT &  ln 
)

Definition at line 1059 of file flintpp.cpp.

References cmp_l().

const int operator== ( const LINT &  lm,
const LINT &  ln 
)

Definition at line 1001 of file flintpp.cpp.

References equ_l().

const int operator> ( const LINT &  lm,
const LINT &  ln 
)

Definition at line 1045 of file flintpp.cpp.

References cmp_l().

const int operator>= ( const LINT &  lm,
const LINT &  ln 
)

Definition at line 1075 of file flintpp.cpp.

References cmp_l().

const LINT operator>> ( const LINT &  ln,
const int  times 
)

Definition at line 835 of file flintpp.cpp.

References E_CLINT_OFL, E_CLINT_OK, E_CLINT_UFL, and shift_l().

ifstream& operator>> ( ifstream &  s,
LINT &  ln 
)

Definition at line 3395 of file flintpp.cpp.

References CLINTMAXSHORT, DIGITS_L, s, and vcheck_l().

fstream& operator>> ( fstream &  s,
LINT &  ln 
)

Definition at line 3424 of file flintpp.cpp.

References CLINTMAXSHORT, DIGITS_L, s, and vcheck_l().

const LINT operator^ ( const LINT &  lm,
const LINT &  ln 
)

Definition at line 923 of file flintpp.cpp.

References xor_l().

const LINT operator| ( const LINT &  lm,
const LINT &  ln 
)

Definition at line 936 of file flintpp.cpp.

References or_l().

const LINT primroot ( const unsigned int  noofprimes,
LINT **  primes 
)

Definition at line 2560 of file flintpp.cpp.

References primroot_l().

void purge ( LINT &  a)

Definition at line 1182 of file flintpp.cpp.

References purge_l(), and SETDIGITS_L.

LINT randBBS ( const int  l)

Definition at line 3040 of file flintpp.cpp.

References CLINTMAXBIT, and randBBS_l().

Referenced by extendprime(), and findprime().

LINT randBBS ( const LINT &  rmin,
const LINT &  rmax 
)

Definition at line 3049 of file flintpp.cpp.

References Assert, CLINTMAXBIT, ld(), and randBBS_l().

LINT randl ( const int  l)

Definition at line 2991 of file flintpp.cpp.

References CLINTMAXBIT, and rand_l().

LINT randl ( const LINT &  rmin,
const LINT &  rmax 
)

Definition at line 3000 of file flintpp.cpp.

References Assert, CLINTMAXBIT, ld(), and rand_l().

LINT_omanip<int> ResetLintFlags ( int  flag)

Definition at line 3293 of file flintpp.cpp.

References _ResetLintFlags().

const LINT LINT::root ( const LINT &  lr)

Definition at line 2401 of file flintpp.cpp.

References iroot_l().

const LINT LINT::root ( const LINT &  a,
const LINT &  p 
)

Definition at line 2490 of file flintpp.cpp.

References proot_l().

const LINT root ( const LINT &  a,
const LINT &  p,
const LINT &  q 
)

Definition at line 2509 of file flintpp.cpp.

References root_l().

int seedBBS ( const LINT &  seed)

Definition at line 3033 of file flintpp.cpp.

References seedBBS_l().

void seedl ( const LINT &  seed)

Definition at line 2984 of file flintpp.cpp.

References seed64_l().

LINT_omanip<int> SetLintFlags ( int  flag)

Definition at line 3288 of file flintpp.cpp.

References _SetLintFlags().

const LINT shift ( const LINT &  a,
const int  noofbits 
)

Definition at line 2326 of file flintpp.cpp.

References E_CLINT_OFL, E_CLINT_OK, E_CLINT_UFL, and shift_l().

const LINT sqr ( const LINT &  a)

Definition at line 1945 of file flintpp.cpp.

References E_CLINT_OFL, E_CLINT_OK, and sqr_l().

const LINT strongprime ( const USHORT  l)

Definition at line 2808 of file flintpp.cpp.

References CLINTMAXBIT.

Referenced by strongprime().

const LINT strongprime ( const USHORT  l,
const LINT &  f 
)

Definition at line 2829 of file flintpp.cpp.

References CLINTMAXBIT, and strongprime().

const LINT strongprime ( const USHORT  l,
const USHORT  lt,
const USHORT  lr,
const USHORT  ls,
const LINT &  f 
)

Definition at line 2853 of file flintpp.cpp.

References CLINTMAXBIT, and strongprime().

const LINT strongprime ( const LINT &  pmin,
const LINT &  pmax,
const LINT &  f 
)

Definition at line 2881 of file flintpp.cpp.

References ld(), and strongprime().

const LINT strongprime ( const LINT &  pmin,
const LINT &  pmax,
const USHORT  lt,
const USHORT  lr,
const USHORT  ls,
const LINT &  f 
)

Definition at line 2912 of file flintpp.cpp.

References Assert, CLINTMAXBIT, extendprime(), findprime(), inv(), msub(), and s.

const LINT sub ( const LINT &  a,
const LINT &  b 
)

Definition at line 1890 of file flintpp.cpp.

References E_CLINT_OK, E_CLINT_UFL, and sub_l().

const int twofact ( const LINT &  even,
LINT &  odd 
)

Definition at line 2590 of file flintpp.cpp.

References twofact_l().

const LINT xgcd ( const LINT &  a,
const LINT &  b,
LINT &  u,
int &  sign_u,
LINT &  v,
int &  sign_v 
)

Definition at line 2452 of file flintpp.cpp.

References xgcd_l().


Variable Documentation

void(* LINT_User_Error_Handler)(LINT_ERRORS, const char *const, const int, const int) = NULL [static]

Definition at line 3506 of file flintpp.cpp.