Static Public Member Functions | Static Private Member Functions
amp::mpfr_storage Class Reference

#include <amp.h>

Static Public Member Functions

static mpfr_recordnewMpfr (unsigned int Precision)
 
static void deleteMpfr (mpfr_record *ref)
 
static gmp_randstate_t * getRandState ()
 
static mpfr_recordnewMpfr (unsigned int Precision)
 
static void deleteMpfr (mpfr_record *ref)
 
static gmp_randstate_t * getRandState ()
 

Static Private Member Functions

static mpfr_record_ptrgetList (unsigned int Precision)
 
static mpfr_record_ptrgetList (unsigned int Precision)
 

Detailed Description

Definition at line 47 of file amp.h.

Member Function Documentation

◆ deleteMpfr() [1/2]

void amp::mpfr_storage::deleteMpfr ( amp::mpfr_record ref)
static

Definition at line 30 of file amp.cpp.

31 {
33  ref->next = lst;
34  lst = ref;
35 }
mpfr_record * next
Definition: amp.h:39
unsigned int Precision
Definition: amp.h:37
static mpfr_record_ptr & getList(unsigned int Precision)
Definition: amp.cpp:63

◆ deleteMpfr() [2/2]

static void amp::mpfr_storage::deleteMpfr ( mpfr_record ref)
static

◆ getList() [1/2]

amp::mpfr_record_ptr & amp::mpfr_storage::getList ( unsigned int  Precision)
staticprivate

Definition at line 63 of file amp.cpp.

64 {
65  static amp::mpfr_record_ptr tmp = NULL;
66  static int lastPrec = -1;
67  static amp::mpfr_record_ptr &lastList = tmp;
68  if( lastPrec!=Precision )
69  {
70  while( _mpfr_storage_v.size()<Precision+1 )
71  _mpfr_storage_v.push_back(NULL);
72  lastPrec = (int)Precision;
73  lastList = _mpfr_storage_v[Precision];
74  }
75  return lastList;
76 }
std::vector< amp::mpfr_record *> _mpfr_storage_v
Definition: amp.cpp:7
#define NULL
Definition: omList.c:10

◆ getList() [2/2]

static mpfr_record_ptr& amp::mpfr_storage::getList ( unsigned int  Precision)
staticprivate

◆ getRandState() [1/2]

gmp_randstate_t * amp::mpfr_storage::getRandState ( )
static

Definition at line 37 of file amp.cpp.

38 {
39  if( !_mpfr_storage_init )
40  {
41  time_t _timer;
42  gmp_randinit_default(_mpfr_storage_rs);
43  gmp_randseed_ui(_mpfr_storage_rs, (unsigned long int)(time(&_timer)));
44  _mpfr_storage_init = true;
45  }
46  return &_mpfr_storage_rs;
47 }
gmp_randstate_t _mpfr_storage_rs
Definition: amp.cpp:8
bool _mpfr_storage_init
Definition: amp.cpp:9

◆ getRandState() [2/2]

static gmp_randstate_t* amp::mpfr_storage::getRandState ( )
static

◆ newMpfr() [1/2]

amp::mpfr_record * amp::mpfr_storage::newMpfr ( unsigned int  Precision)
static

Definition at line 11 of file amp.cpp.

12 {
13  amp::mpfr_record_ptr &lst = getList(Precision);
14  if( lst==NULL )
15  {
17  rec->Precision = Precision;
18  rec->refCount = 0;
19  mpfr_init2(rec->value, Precision);
20  rec->next = lst;
21  lst = rec;
22  }
23 
24  amp::mpfr_record *p = lst;
25  p->refCount = 1;
26  lst = lst->next;
27  return p;
28 }
mpfr_record * next
Definition: amp.h:39
unsigned int Precision
Definition: amp.h:37
mpfr_t value
Definition: amp.h:38
static mpfr_record_ptr & getList(unsigned int Precision)
Definition: amp.cpp:63
#define NULL
Definition: omList.c:10
unsigned int refCount
Definition: amp.h:36
int p
Definition: cfModGcd.cc:4019

◆ newMpfr() [2/2]

static mpfr_record* amp::mpfr_storage::newMpfr ( unsigned int  Precision)
static

The documentation for this class was generated from the following files: