File: fixc6.cc

package info (click to toggle)
eclib 2014-09-21-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,216 kB
  • ctags: 4,287
  • sloc: cpp: 45,827; makefile: 222; sh: 108
file content (70 lines) | stat: -rw-r--r-- 2,058 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// file fixc6.cc: implementation of fixc6 class
//////////////////////////////////////////////////////////////////////////
//
// Copyright 1990-2012 John Cremona
// 
// This file is part of the eclib package.
// 
// eclib is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2 of the License, or (at your
// option) any later version.
// 
// eclib is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for more details.
// 
// You should have received a copy of the GNU General Public License
// along with eclib; if not, write to the Free Software Foundation,
// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
// 
//////////////////////////////////////////////////////////////////////////

// the constructor initializes the static data member with all the
// fixed values

#include <eclib/marith.h>
#include <map>
#include <eclib/fixc6.h>

fixc6::fixc6()
{
#ifdef MPFP // Multi-Precision Floating Point
  return;
#else

  long n=1; int i; bigint c4,c6;
  ifstream datafile("fixc6.data");
  while(n) 
    {
      datafile>>n>>i>>c6;
      if(n!=0) fixc6table[pair<long,int>(n,i)] = c6;
    }
  datafile.close();
  datafile.open("fixc4.data");
  n=1;
  while(n) 
    {
      datafile>>n>>i>>c4;
      if(n!=0) fixc4table[pair<long,int>(n,i)] = c4;
    }
  datafile.close();

#endif // MPFP
} // end of constructor

void fixc6::operator()(long N, int i, bigint& c4, bigint& c6)
{
  pair<long,int> key(N,i+1);
  map<pair<long,int>,bigint>::const_iterator j = fixc6table.find(key); 
  if(j!=fixc6table.end()) c6=j->second;
  j = fixc4table.find(key); 
  if(j!=fixc4table.end()) c4=j->second;
  return; 
}

map< pair<long,int>, bigint > fixc6::fixc6table;
map< pair<long,int>, bigint > fixc6::fixc4table;
fixc6 c4c6fixer;  // the one and only instance of the class