-
Notifications
You must be signed in to change notification settings - Fork 0
/
QuickTests.cpp
80 lines (66 loc) · 2.65 KB
/
QuickTests.cpp
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
71
72
73
74
75
76
77
78
#include "Galosh.hpp"
#include "Parameters.hpp"
#include "HMMoC-BFloat-Algebra/Algebra.hpp" //TAH 11/4/2011
#include <sstream> // For stringstream.
#include <ctime> // for std::time
// TODO: REMOVE ..
#include <iostream>
using namespace galosh;
/////////////
// Required for linking with muscle (even though we don't access it from ProfileTrainer.cpp).
#ifdef __HAVE_MUSCLE
int g_argc;
char **g_argv;
#endif // __HAVE_MUSCLE
int
test_algebras ( /*supportedTypesPtr_t supported_types, */ int argc, char **argv )
{
clock_t start = clock();
bfloat bfloat0 = 1.0;
cout << "[0] bfloat0: " << bfloat0 << endl;
bfloat0 *= 1E-10;
cout << "[1] bfloat0 after *= 1E-10: " << bfloat0 << endl;
cout << "[1] log(bfloat0) is now: " << log( bfloat0 ) << endl;
for( int i = 2; i <= 30; i++ ) {
bfloat0 *= bfloat0;
cout << "[" << i << "] bfloat0 after *= bfloat0: " << bfloat0 << endl;
cout << "[" << i << "] log(bfloat0) is now: " << log( bfloat0 ) << endl;
cout << "[" << i << "] 1.0 - bfloat0 is now: " << ( 1.0 - bfloat0 ) << endl;
}
bfloat bfloat1 = 1.0;
cout << "[0] bfloat1: " << bfloat1 << endl;
bfloat1 *= 1E-1;
cout << "[1] bfloat1 after *= 1E-1: " << bfloat1 << endl;
cout << "[1] log(bfloat1) is now: " << log( bfloat1 ) << endl;
for( int i = 2; i <= 10; i++ ) {
bfloat1 *= 1E-1;
cout << "[" << i << "] bfloat1 after *= 1E-1: " << bfloat1 << endl;
cout << "[" << i << "] log(bfloat1) is now: " << log( bfloat1 ) << endl;
cout << "[" << i << "] 1.0 - bfloat1 is now: " << ( 1.0 - bfloat1 ) << endl;
}
cout << "largest float: " << numeric_limits<float>::max() << endl;
cout << "smallest float: " << numeric_limits<float>::min() << endl;
bfloat bfloat2 = ( bfloat1 * 1E-5 );
cout << " bfloat1 is " << bfloat1 << endl;
cout << " bfloat2 is " << bfloat2 << endl;
cout << " ( bfloat2 - bfloat1 ) = " << ( bfloat2 - bfloat1 ) << endl;
cout << " ( bfloat1 - bfloat2 ) = " << ( bfloat1 - bfloat2 ) << endl;
cout << " bfloat0 is " << bfloat0 << endl;
cout << " ( bfloat0 - bfloat1 ) = " << ( bfloat0 - bfloat1 ) << endl;
cout << " ( bfloat1 - bfloat0 ) = " << ( bfloat1 - bfloat0 ) << endl;
clock_t end = clock();
double cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
cout << "Elapsed CPU time: " << cpu_time_used << endl;
return 0;
} // test_algebras(..)
int
main ( int argc, char **argv )
{
// // Support only DNA sequences
// //PolySequence::SupportedTypes supportedTypes( true );
//
// // Support only AminoAcid sequences
// PolySequence::SupportedTypes supportedTypes( false, true );
return //test_algebras( &supportedTypes, argc, argv );
test_algebras( argc, argv );
} // main( int, char** )