chrislo-sourceclassifier 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +0 -312
- data/Rakefile +2 -2
- data/sourceclassifier.gemspec +6 -6
- metadata +4 -316
- data/sources/gcc/ackermann.gcc-2.gcc +0 -93
- data/sources/gcc/ackermann.gcc-3.gcc +0 -20
- data/sources/gcc/ary.gcc +0 -40
- data/sources/gcc/binarytrees.gcc +0 -136
- data/sources/gcc/binarytrees.gcc-2.gcc +0 -140
- data/sources/gcc/binarytrees.gcc-3.gcc +0 -134
- data/sources/gcc/chameneos.gcc +0 -117
- data/sources/gcc/chameneos.gcc-2.gcc +0 -134
- data/sources/gcc/chameneos.gcc-3.gcc +0 -120
- data/sources/gcc/chameneosredux.gcc +0 -306
- data/sources/gcc/echo.gcc +0 -144
- data/sources/gcc/except.gcc +0 -52
- data/sources/gcc/fannkuch.gcc +0 -105
- data/sources/gcc/fannkuch.gcc-2.gcc +0 -94
- data/sources/gcc/fasta.gcc +0 -158
- data/sources/gcc/fasta.gcc-2.gcc +0 -132
- data/sources/gcc/fasta.gcc-3.gcc +0 -145
- data/sources/gcc/fasta.gcc-4.gcc +0 -141
- data/sources/gcc/fibo.gcc +0 -20
- data/sources/gcc/harmonic.gcc +0 -22
- data/sources/gcc/hash.gcc +0 -31
- data/sources/gcc/hash2.gcc +0 -38
- data/sources/gcc/heapsort.gcc +0 -72
- data/sources/gcc/hello.gcc-2.gcc +0 -12
- data/sources/gcc/hello.gcc-3.gcc +0 -20
- data/sources/gcc/knucleotide.gcc +0 -173
- data/sources/gcc/knucleotide.gcc-2.gcc +0 -168
- data/sources/gcc/lists.gcc +0 -226
- data/sources/gcc/magicsquares.gcc +0 -378
- data/sources/gcc/mandelbrot.gcc +0 -84
- data/sources/gcc/mandelbrot.gcc-2.gcc +0 -63
- data/sources/gcc/mandelbrot.gcc-3.gcc +0 -91
- data/sources/gcc/mandelbrot.gcc-4.gcc +0 -78
- data/sources/gcc/matrix.gcc +0 -66
- data/sources/gcc/message.gcc-2.gcc +0 -72
- data/sources/gcc/message.gcc-3.gcc +0 -64
- data/sources/gcc/methcall.gcc +0 -89
- data/sources/gcc/moments.gcc +0 -120
- data/sources/gcc/nbody.gcc +0 -142
- data/sources/gcc/nbody.gcc-2.gcc +0 -143
- data/sources/gcc/nbody.gcc-3.gcc +0 -142
- data/sources/gcc/nestedloop.gcc +0 -25
- data/sources/gcc/nsieve.gcc +0 -35
- data/sources/gcc/nsievebits.gcc-2.gcc +0 -37
- data/sources/gcc/nsievebits.gcc-3.gcc +0 -53
- data/sources/gcc/objinst.gcc +0 -95
- data/sources/gcc/partialsums.gcc +0 -86
- data/sources/gcc/partialsums.gcc-3.gcc +0 -81
- data/sources/gcc/partialsums.gcc-4.gcc +0 -68
- data/sources/gcc/pidigits.gcc +0 -105
- data/sources/gcc/primes.gcc +0 -75
- data/sources/gcc/prodcons.gcc +0 -86
- data/sources/gcc/random.gcc +0 -29
- data/sources/gcc/raytracer.gcc +0 -125
- data/sources/gcc/raytracer.gcc-2.gcc +0 -181
- data/sources/gcc/recursive.gcc +0 -68
- data/sources/gcc/recursive.gcc-2.gcc +0 -55
- data/sources/gcc/regexdna.gcc-2.gcc +0 -126
- data/sources/gcc/regexmatch.gcc +0 -136
- data/sources/gcc/revcomp.gcc +0 -85
- data/sources/gcc/revcomp.gcc-2.gcc +0 -88
- data/sources/gcc/revcomp.gcc-4.gcc +0 -71
- data/sources/gcc/reversefile.gcc +0 -103
- data/sources/gcc/reversefile.gcc-2.gcc +0 -56
- data/sources/gcc/sieve.gcc +0 -34
- data/sources/gcc/spectralnorm.gcc +0 -54
- data/sources/gcc/spellcheck.gcc +0 -72
- data/sources/gcc/spellcheck.gcc-2.gcc +0 -61
- data/sources/gcc/strcat.gcc +0 -38
- data/sources/gcc/sumcol.gcc-2.gcc +0 -98
- data/sources/gcc/sumcol.gcc-3.gcc +0 -22
- data/sources/gcc/sumcol.gcc-4.gcc +0 -18
- data/sources/gcc/sumcol.gcc-5.gcc +0 -32
- data/sources/gcc/takfp.gcc +0 -23
- data/sources/gcc/tcp-stream.gcc +0 -122
- data/sources/gcc/tcpecho.gcc +0 -122
- data/sources/gcc/tcpecho.gcc-2.gcc +0 -136
- data/sources/gcc/tcprequest.gcc +0 -122
- data/sources/gcc/threadring.gcc +0 -73
- data/sources/gcc/wc.gcc +0 -52
- data/sources/gcc/wc.gcc-2.gcc +0 -40
- data/sources/gcc/wc.gcc-3.gcc +0 -46
- data/sources/gcc/wordfreq.gcc-2.gcc +0 -85
- data/sources/perl/ackermann.perl +0 -28
- data/sources/perl/ackermann.perl-2.perl +0 -25
- data/sources/perl/ackermann.perl-3.perl +0 -20
- data/sources/perl/ackermann.perl-4.perl +0 -18
- data/sources/perl/ary.perl +0 -25
- data/sources/perl/ary.perl-2.perl +0 -23
- data/sources/perl/binarytrees.perl +0 -66
- data/sources/perl/binarytrees.perl-2.perl +0 -71
- data/sources/perl/chameneos.perl +0 -67
- data/sources/perl/echo.perl +0 -81
- data/sources/perl/except.perl +0 -73
- data/sources/perl/fannkuch.perl +0 -44
- data/sources/perl/fannkuch.perl-2.perl +0 -38
- data/sources/perl/fasta.perl +0 -112
- data/sources/perl/fasta.perl-2.perl +0 -135
- data/sources/perl/fasta.perl-4.perl +0 -122
- data/sources/perl/fibo.perl +0 -15
- data/sources/perl/fibo.perl-2.perl +0 -0
- data/sources/perl/fibo.perl-3.perl +0 -0
- data/sources/perl/harmonic.perl +0 -7
- data/sources/perl/hash.perl +0 -23
- data/sources/perl/hash.perl-2.perl +0 -17
- data/sources/perl/hash.perl-3.perl +0 -24
- data/sources/perl/hash2.perl +0 -16
- data/sources/perl/heapsort.perl +0 -65
- data/sources/perl/heapsort.perl-2.perl +0 -0
- data/sources/perl/hello.perl +0 -5
- data/sources/perl/knucleotide.perl-2.perl +0 -30
- data/sources/perl/lists.perl +0 -48
- data/sources/perl/mandelbrot.perl-2.perl +0 -32
- data/sources/perl/matrix.perl +0 -59
- data/sources/perl/matrix.perl-2.perl +0 -0
- data/sources/perl/matrix.perl-3.perl +0 -0
- data/sources/perl/message.perl +0 -27
- data/sources/perl/methcall.perl +0 -66
- data/sources/perl/moments.perl +0 -44
- data/sources/perl/nbody.perl +0 -108
- data/sources/perl/nestedloop.perl +0 -28
- data/sources/perl/nsieve.perl-2.perl +0 -41
- data/sources/perl/nsieve.perl-4.perl +0 -43
- data/sources/perl/nsievebits.perl +0 -37
- data/sources/perl/objinst.perl +0 -73
- data/sources/perl/partialsums.perl-3.perl +0 -31
- data/sources/perl/pidigits.perl +0 -52
- data/sources/perl/pidigits.perl-2.perl +0 -47
- data/sources/perl/process.perl +0 -50
- data/sources/perl/prodcons.perl +0 -47
- data/sources/perl/random.perl-4.perl +0 -17
- data/sources/perl/recursive.perl-2.perl +0 -57
- data/sources/perl/regexdna.perl +0 -48
- data/sources/perl/regexdna.perl-2.perl +0 -43
- data/sources/perl/regexdna.perl-3.perl +0 -50
- data/sources/perl/regexdna.perl-4.perl +0 -49
- data/sources/perl/regexdna.perl-5.perl +0 -42
- data/sources/perl/regexdna.perl-6.perl +0 -43
- data/sources/perl/regexmatch.perl +0 -35
- data/sources/perl/revcomp.perl-2.perl +0 -34
- data/sources/perl/reversefile.perl +0 -8
- data/sources/perl/reversefile.perl-2.perl +0 -0
- data/sources/perl/reversefile.perl-3.perl +0 -0
- data/sources/perl/sieve.perl +0 -23
- data/sources/perl/spectralnorm.perl-2.perl +0 -54
- data/sources/perl/spellcheck.perl +0 -24
- data/sources/perl/strcat.perl +0 -13
- data/sources/perl/strcat.perl-2.perl +0 -0
- data/sources/perl/sumcol.perl +0 -8
- data/sources/perl/takfp.perl +0 -23
- data/sources/perl/takfp.perl-3.perl +0 -20
- data/sources/perl/tcpecho.perl +0 -61
- data/sources/perl/tcprequest.perl +0 -61
- data/sources/perl/tcpstream.perl +0 -61
- data/sources/perl/threadring.perl +0 -55
- data/sources/perl/threadring.perl-2.perl +0 -43
- data/sources/perl/wc.perl +0 -20
- data/sources/perl/wc.perl-2.perl +0 -14
- data/sources/perl/wordfreq.perl +0 -22
- data/sources/perl/wordfreq.perl-3.perl +0 -0
- data/sources/perl/wordfreq.perl3.perl +0 -0
- data/sources/python/ackermann.python +0 -21
- data/sources/python/ary.python +0 -19
- data/sources/python/binarytrees.python +0 -39
- data/sources/python/binarytrees.python-3.python +0 -44
- data/sources/python/chameneos.python-6.python +0 -73
- data/sources/python/chameneosredux.python +0 -126
- data/sources/python/chameneosredux.python-2.python +0 -122
- data/sources/python/dispatch.python +0 -176
- data/sources/python/dispatch.python-2.python +0 -136
- data/sources/python/echo.python +0 -64
- data/sources/python/except.python +0 -62
- data/sources/python/fannkuch.python +0 -50
- data/sources/python/fannkuch.python-2.python +0 -54
- data/sources/python/fasta.python-2.python +0 -79
- data/sources/python/fibo.python +0 -17
- data/sources/python/fibo.python-2.python +0 -0
- data/sources/python/fibo.python-3.python +0 -0
- data/sources/python/harmonic.python-2.python +0 -9
- data/sources/python/hash.python +0 -21
- data/sources/python/hash.python-2.python +0 -0
- data/sources/python/hash2.python +0 -30
- data/sources/python/heapsort.python-3.python +0 -66
- data/sources/python/hello.python +0 -5
- data/sources/python/implicitode.python +0 -231
- data/sources/python/knucleotide.python +0 -55
- data/sources/python/lists.python +0 -44
- data/sources/python/magicsquares.python +0 -145
- data/sources/python/mandelbrot.python +0 -44
- data/sources/python/mandelbrot.python-2.python +0 -35
- data/sources/python/mandelbrot.python-3.python +0 -46
- data/sources/python/matrix.python +0 -34
- data/sources/python/matrix.python-2.python +0 -23
- data/sources/python/message.python +0 -24
- data/sources/python/message.python-2.python +0 -20
- data/sources/python/message.python-3.python +0 -19
- data/sources/python/meteor.python +0 -210
- data/sources/python/meteor.python-2.python +0 -192
- data/sources/python/methcall.python +0 -51
- data/sources/python/moments.python +0 -65
- data/sources/python/nbody.python +0 -123
- data/sources/python/nbody.python-2.python +0 -120
- data/sources/python/nestedloop.python +0 -24
- data/sources/python/nsieve.python +0 -27
- data/sources/python/nsieve.python-2.python +0 -23
- data/sources/python/nsieve.python-4.python +0 -25
- data/sources/python/nsievebits.python +0 -27
- data/sources/python/nsievebits.python-2.python +0 -43
- data/sources/python/objinst.python +0 -53
- data/sources/python/partialsums.python +0 -37
- data/sources/python/partialsums.python-2.python +0 -35
- data/sources/python/partialsums.python-3.python +0 -48
- data/sources/python/pidigits.python +0 -38
- data/sources/python/pidigits.python-3.python +0 -63
- data/sources/python/pidigits.python-4.python +0 -24
- data/sources/python/process.python +0 -51
- data/sources/python/process.python-2.python +0 -133
- data/sources/python/prodcons.python +0 -51
- data/sources/python/prodcons.python-2.python +0 -0
- data/sources/python/random.python +0 -27
- data/sources/python/raytracer.python +0 -203
- data/sources/python/recursive.python +0 -35
- data/sources/python/regexdna.python +0 -39
- data/sources/python/regexdna.python-2.python +0 -34
- data/sources/python/regexmatch.python +0 -36
- data/sources/python/revcomp.python-3.python +0 -31
- data/sources/python/reversefile.python +0 -13
- data/sources/python/reversefile.python-2.python +0 -0
- data/sources/python/reversefile.python-3.python +0 -0
- data/sources/python/sieve.python +0 -50
- data/sources/python/spectralnorm.python-2.python +0 -36
- data/sources/python/spellcheck.python +0 -17
- data/sources/python/strcat.python +0 -35
- data/sources/python/strcat.python-2.python +0 -0
- data/sources/python/sumcol.python-2.python +0 -0
- data/sources/python/sumcol.python-3.python +0 -0
- data/sources/python/takfp.python +0 -19
- data/sources/python/tcpecho.python +0 -67
- data/sources/python/tcprequest.python +0 -67
- data/sources/python/tcpstream.python +0 -67
- data/sources/python/threadring.python +0 -47
- data/sources/python/threadring.python-2.python +0 -40
- data/sources/python/threadring.python-3.python +0 -34
- data/sources/python/wc.python-2.python +0 -19
- data/sources/python/wordfreq.python +0 -43
- data/sources/python/wordfreq.python-2.python +0 -0
- data/sources/python/wordfreq.python-3.python +0 -28
- data/sources/python/wordfreq.python-4.python +0 -38
- data/sources/python/wordfreq.python-5.python +0 -39
- data/sources/ruby/ackermann.ruby +0 -17
- data/sources/ruby/ackermann.ruby-5.ruby +0 -153
- data/sources/ruby/ary.ruby +0 -22
- data/sources/ruby/binarytrees.ruby-2.ruby +0 -55
- data/sources/ruby/chameneos.ruby-2.ruby +0 -71
- data/sources/ruby/dispatch.ruby +0 -114
- data/sources/ruby/echo.ruby +0 -41
- data/sources/ruby/except.ruby +0 -61
- data/sources/ruby/except.ruby-2.ruby +0 -61
- data/sources/ruby/fannkuch.ruby +0 -42
- data/sources/ruby/fasta.ruby +0 -81
- data/sources/ruby/fibo.ruby +0 -15
- data/sources/ruby/harmonic.ruby-2.ruby +0 -15
- data/sources/ruby/hash.ruby +0 -19
- data/sources/ruby/hash2.ruby +0 -23
- data/sources/ruby/heapsort.ruby +0 -55
- data/sources/ruby/hello.ruby +0 -6
- data/sources/ruby/knucleotide.ruby-2.ruby +0 -44
- data/sources/ruby/lists.ruby +0 -46
- data/sources/ruby/mandelbrot.ruby-3.ruby +0 -63
- data/sources/ruby/matrix.ruby +0 -40
- data/sources/ruby/matrix.ruby-2.ruby +0 -30
- data/sources/ruby/message.ruby +0 -29
- data/sources/ruby/message.ruby-2.ruby +0 -24
- data/sources/ruby/meteor.ruby +0 -386
- data/sources/ruby/meteor.ruby-2.ruby +0 -561
- data/sources/ruby/methcall.ruby +0 -58
- data/sources/ruby/methcall.ruby-2.ruby +0 -54
- data/sources/ruby/moments.ruby +0 -64
- data/sources/ruby/nbody.ruby-2.ruby +0 -145
- data/sources/ruby/nestedloop.ruby +0 -22
- data/sources/ruby/nsieve.ruby +0 -36
- data/sources/ruby/nsieve.ruby-2.ruby +0 -25
- data/sources/ruby/nsievebits.ruby-2.ruby +0 -42
- data/sources/ruby/objinst.ruby +0 -58
- data/sources/ruby/partialsums.ruby +0 -39
- data/sources/ruby/pidigits.ruby +0 -92
- data/sources/ruby/pidigits.ruby-2.ruby +0 -109
- data/sources/ruby/prodcons.ruby +0 -41
- data/sources/ruby/random.ruby +0 -17
- data/sources/ruby/recursive.ruby-2.ruby +0 -53
- data/sources/ruby/regexdna.ruby +0 -32
- data/sources/ruby/regexdna.ruby-2.ruby +0 -38
- data/sources/ruby/regexmatch.ruby +0 -33
- data/sources/ruby/revcomp.ruby +0 -28
- data/sources/ruby/reversefile.ruby +0 -7
- data/sources/ruby/sieve.ruby +0 -30
- data/sources/ruby/spectralnorm.ruby +0 -48
- data/sources/ruby/spellcheck.ruby +0 -18
- data/sources/ruby/spellcheck.ruby-2.ruby +0 -0
- data/sources/ruby/strcat.ruby +0 -12
- data/sources/ruby/strcat.ruby-2.ruby +0 -12
- data/sources/ruby/sumcol.ruby +0 -12
- data/sources/ruby/sumcol.ruby-2.ruby +0 -5
- data/sources/ruby/takfp.ruby +0 -15
- data/sources/ruby/tcpecho.ruby +0 -45
- data/sources/ruby/tcprequest.ruby +0 -45
- data/sources/ruby/tcpstream.ruby +0 -45
- data/sources/ruby/threadring.ruby +0 -61
- data/sources/ruby/threadring.ruby-2.ruby +0 -33
- data/sources/ruby/wc.ruby +0 -15
- data/sources/ruby/wordfreq.ruby +0 -17
- data/sources/ruby/wordfreq.ruby2.ruby +0 -0
data/sources/gcc/fasta.gcc-2.gcc
DELETED
@@ -1,132 +0,0 @@
|
|
1
|
-
/* The Computer Language Shootout
|
2
|
-
* http://shootout.alioth.debian.org/
|
3
|
-
* contributed by Joern Inge Vestgaarden
|
4
|
-
* Compile with gcc -O3 -fomit-frame-pointer -march=pentium4 -mfpmath=sse -msse2 -o fasta fasta.c
|
5
|
-
*/
|
6
|
-
|
7
|
-
#include <stdio.h>
|
8
|
-
#include <stdlib.h>
|
9
|
-
#include <string.h>
|
10
|
-
|
11
|
-
#define MIN(a,b) ((a) <= (b) ? (a) : (b))
|
12
|
-
#define LINE_LEN 60
|
13
|
-
|
14
|
-
#define IM 139968
|
15
|
-
#define IA 3877
|
16
|
-
#define IC 29573
|
17
|
-
int global_last = 42;
|
18
|
-
#define gen_random(max) (max*((global_last = (global_last * IA + IC) % IM) / ((float)(IM))))
|
19
|
-
|
20
|
-
struct aminoacids {
|
21
|
-
float p;
|
22
|
-
char c;
|
23
|
-
};
|
24
|
-
|
25
|
-
void make_cumulative (struct aminoacids * genelist, int count) {
|
26
|
-
float cp = 0.0;
|
27
|
-
int i;
|
28
|
-
for (i=0; i < count; i++) {
|
29
|
-
cp += genelist[i].p;
|
30
|
-
genelist[i].p = cp;
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
|
-
void repeat_fasta (const char *s, int n) {
|
35
|
-
int len = strlen(s);
|
36
|
-
int pos = 0;
|
37
|
-
while (n > 0) {
|
38
|
-
const int line = MIN(LINE_LEN, n);
|
39
|
-
const int left = len-pos;
|
40
|
-
n -= line;
|
41
|
-
if (left >= line) { /* Line not broken */
|
42
|
-
fwrite(s+pos,1,line,stdout);
|
43
|
-
putc('\n', stdout);
|
44
|
-
pos += line;
|
45
|
-
} else { /* Line broken */
|
46
|
-
fwrite(s+pos,1,left,stdout);
|
47
|
-
pos = 0;
|
48
|
-
fwrite(s,1,line-left,stdout);
|
49
|
-
pos += line - left;
|
50
|
-
putc('\n', stdout);
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
void random_fasta (struct aminoacids * genelist, int n) {
|
56
|
-
char buf[LINE_LEN+1];
|
57
|
-
char *s = NULL;
|
58
|
-
struct aminoacids *a = genelist;
|
59
|
-
float r;
|
60
|
-
while (n > 0) {
|
61
|
-
const int line = MIN(LINE_LEN, n);
|
62
|
-
const char *end = (char *)buf + line;
|
63
|
-
n -= line;
|
64
|
-
s = buf;
|
65
|
-
while (s < end) {
|
66
|
-
r = gen_random(1.0);
|
67
|
-
a = genelist;
|
68
|
-
while (*((float *)a) < r) ++a; /* Linear search */
|
69
|
-
*s++ = a->c;
|
70
|
-
}
|
71
|
-
*s = '\n';
|
72
|
-
fwrite(buf, 1, line+1, stdout);
|
73
|
-
}
|
74
|
-
}
|
75
|
-
|
76
|
-
|
77
|
-
/* Main -- define alphabets, make 3 fragments */
|
78
|
-
|
79
|
-
static struct aminoacids iub[] = {
|
80
|
-
{ 0.27, 'a' },
|
81
|
-
{ 0.12, 'c' },
|
82
|
-
{ 0.12, 'g' },
|
83
|
-
{ 0.27, 't' },
|
84
|
-
{ 0.02, 'B' },
|
85
|
-
{ 0.02, 'D' },
|
86
|
-
{ 0.02, 'H' },
|
87
|
-
{ 0.02, 'K' },
|
88
|
-
{ 0.02, 'M' },
|
89
|
-
{ 0.02, 'N' },
|
90
|
-
{ 0.02, 'R' },
|
91
|
-
{ 0.02, 'S' },
|
92
|
-
{ 0.02, 'V' },
|
93
|
-
{ 0.02, 'W' },
|
94
|
-
{ 0.02, 'Y' }
|
95
|
-
};
|
96
|
-
|
97
|
-
#define IUB_LEN (sizeof (iub) / sizeof (struct aminoacids))
|
98
|
-
|
99
|
-
static struct aminoacids homosapiens[] = {
|
100
|
-
{ 0.3029549426680, 'a' },
|
101
|
-
{ 0.1979883004921, 'c' },
|
102
|
-
{ 0.1975473066391, 'g' },
|
103
|
-
{ 0.3015094502008, 't' },
|
104
|
-
};
|
105
|
-
|
106
|
-
#define HOMOSAPIENS_LEN (sizeof (homosapiens) / sizeof (struct aminoacids))
|
107
|
-
|
108
|
-
static char * alu =
|
109
|
-
"GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG" \
|
110
|
-
"GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA" \
|
111
|
-
"CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT" \
|
112
|
-
"ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA" \
|
113
|
-
"GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG" \
|
114
|
-
"AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC" \
|
115
|
-
"AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA";
|
116
|
-
|
117
|
-
int main (int argc, char * argv[]) {
|
118
|
-
int n = 1000;
|
119
|
-
if (argc > 1) sscanf (argv[1], "%d", &n);
|
120
|
-
make_cumulative (iub, IUB_LEN);
|
121
|
-
make_cumulative (homosapiens, HOMOSAPIENS_LEN);
|
122
|
-
|
123
|
-
printf (">ONE Homo sapiens alu\n");
|
124
|
-
repeat_fasta ( alu, n*2);
|
125
|
-
printf (">TWO IUB ambiguity codes\n");
|
126
|
-
random_fasta ( iub, n*3);
|
127
|
-
printf (">THREE Homo sapiens frequency\n");
|
128
|
-
random_fasta ( homosapiens, n*5);
|
129
|
-
|
130
|
-
return 0;
|
131
|
-
}
|
132
|
-
|
data/sources/gcc/fasta.gcc-3.gcc
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
/* The Computer Language Benchmarks Game
|
2
|
-
* http://shootout.alioth.debian.org/
|
3
|
-
* Contributed by Joern Inge Vestgaarden
|
4
|
-
* Modified by Jorge Peixoto de Morais Neto
|
5
|
-
* Modified by Ryan Flynn
|
6
|
-
*/
|
7
|
-
|
8
|
-
#include <stdio.h>
|
9
|
-
#include <stdlib.h>
|
10
|
-
#include <string.h>
|
11
|
-
#include <err.h>
|
12
|
-
|
13
|
-
#define WIDTH 60
|
14
|
-
#define MIN(a,b) ((a) <= (b) ? (a) : (b))
|
15
|
-
#define NELEMENTS(x) (sizeof (x) / sizeof ((x)[0]))
|
16
|
-
|
17
|
-
typedef struct {
|
18
|
-
float p;
|
19
|
-
char c;
|
20
|
-
} aminoacid_t;
|
21
|
-
|
22
|
-
static inline float myrandom (float max) {
|
23
|
-
unsigned long const IM = 139968;
|
24
|
-
unsigned long const IA = 3877;
|
25
|
-
unsigned long const IC = 29573;
|
26
|
-
static unsigned long last = 42;
|
27
|
-
last = (last * IA + IC) % IM;
|
28
|
-
/*Integer to float conversions are faster if the integer is signed*/
|
29
|
-
return max * (long) last / IM;
|
30
|
-
}
|
31
|
-
|
32
|
-
static inline void accumulate_probabilities (aminoacid_t *genelist, size_t len) {
|
33
|
-
float cp = 0.0;
|
34
|
-
size_t i;
|
35
|
-
for (i = 0; i < len; i++) {
|
36
|
-
cp += genelist[i].p;
|
37
|
-
genelist[i].p = cp;
|
38
|
-
}
|
39
|
-
}
|
40
|
-
|
41
|
-
/* This function prints the characters of the string s. When it */
|
42
|
-
/* reaches the end of the string, it goes back to the beginning */
|
43
|
-
/* It stops when the total number of characters printed is count. */
|
44
|
-
/* Between each WIDTH consecutive characters it prints a newline */
|
45
|
-
/* This function assumes that WIDTH <= strlen (s) + 1 */
|
46
|
-
static void repeat_fasta (char const *s, size_t count) {
|
47
|
-
size_t pos = 0;
|
48
|
-
size_t len = strlen (s);
|
49
|
-
char *s2 = malloc (len + WIDTH);
|
50
|
-
memcpy (s2, s, len);
|
51
|
-
memcpy (s2 + len, s, WIDTH);
|
52
|
-
do {
|
53
|
-
size_t line = MIN(WIDTH, count);
|
54
|
-
fwrite_unlocked (s2 + pos,1,line,stdout);
|
55
|
-
putchar_unlocked ('\n');
|
56
|
-
pos += line;
|
57
|
-
if (pos >= len) pos -= len;
|
58
|
-
count -= line;
|
59
|
-
} while (count);
|
60
|
-
free (s2);
|
61
|
-
}
|
62
|
-
|
63
|
-
/* This function takes a pointer to the first element of an array */
|
64
|
-
/* Each element of the array is a struct with a character and */
|
65
|
-
/* a float number p between 0 and 1. */
|
66
|
-
/* The function generates a random float number r and */
|
67
|
-
/* finds the first array element such that p >= r. */
|
68
|
-
/* This is a weighted random selection. */
|
69
|
-
/* The function then prints the character of the array element. */
|
70
|
-
/* This is done count times. */
|
71
|
-
/* Between each WIDTH consecutive characters, the function prints a newline */
|
72
|
-
static void random_fasta (aminoacid_t const *genelist, size_t count) {
|
73
|
-
do {
|
74
|
-
size_t line = MIN(WIDTH, count);
|
75
|
-
size_t pos = 0;
|
76
|
-
char buf[WIDTH + 1];
|
77
|
-
do {
|
78
|
-
float r = myrandom (1.0);
|
79
|
-
size_t i = 0;
|
80
|
-
while (genelist[i].p < r)
|
81
|
-
++i; /* Linear search */
|
82
|
-
buf[pos++] = genelist[i].c;
|
83
|
-
} while (pos < line);
|
84
|
-
buf[line] = '\n';
|
85
|
-
fwrite_unlocked (buf, 1, line + 1, stdout);
|
86
|
-
count -= line;
|
87
|
-
} while (count);
|
88
|
-
}
|
89
|
-
|
90
|
-
int main (int argc, char **argv) {
|
91
|
-
static char OutBuf[128 * 1024];
|
92
|
-
size_t n;
|
93
|
-
if (argc > 1) {
|
94
|
-
char const *arg = argv[1];
|
95
|
-
char *tail;
|
96
|
-
n = strtoul (arg, &tail, 0);
|
97
|
-
if (tail == arg)
|
98
|
-
errx (1, "Could not convert \"%s\" to an unsigned long integer", arg);
|
99
|
-
} else n = 1000;
|
100
|
-
|
101
|
-
static aminoacid_t iub[] = {
|
102
|
-
{ 0.27, 'a' },
|
103
|
-
{ 0.12, 'c' },
|
104
|
-
{ 0.12, 'g' },
|
105
|
-
{ 0.27, 't' },
|
106
|
-
{ 0.02, 'B' },
|
107
|
-
{ 0.02, 'D' },
|
108
|
-
{ 0.02, 'H' },
|
109
|
-
{ 0.02, 'K' },
|
110
|
-
{ 0.02, 'M' },
|
111
|
-
{ 0.02, 'N' },
|
112
|
-
{ 0.02, 'R' },
|
113
|
-
{ 0.02, 'S' },
|
114
|
-
{ 0.02, 'V' },
|
115
|
-
{ 0.02, 'W' },
|
116
|
-
{ 0.02, 'Y' }};
|
117
|
-
|
118
|
-
static aminoacid_t homosapiens[] = {
|
119
|
-
{ 0.3029549426680, 'a' },
|
120
|
-
{ 0.1979883004921, 'c' },
|
121
|
-
{ 0.1975473066391, 'g' },
|
122
|
-
{ 0.3015094502008, 't' }};
|
123
|
-
|
124
|
-
accumulate_probabilities (iub, NELEMENTS(iub));
|
125
|
-
accumulate_probabilities (homosapiens, NELEMENTS(homosapiens));
|
126
|
-
|
127
|
-
static char const *const alu ="\
|
128
|
-
GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG\
|
129
|
-
GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA\
|
130
|
-
CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT\
|
131
|
-
ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA\
|
132
|
-
GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG\
|
133
|
-
AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC\
|
134
|
-
AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA";
|
135
|
-
|
136
|
-
setvbuf(stdout, OutBuf, _IOFBF, sizeof OutBuf); /* buffer output */
|
137
|
-
fputs_unlocked (">ONE Homo sapiens alu\n", stdout);
|
138
|
-
repeat_fasta (alu, 2 * n);
|
139
|
-
fputs_unlocked (">TWO IUB ambiguity codes\n", stdout);
|
140
|
-
random_fasta (iub, 3 * n);
|
141
|
-
fputs_unlocked (">THREE Homo sapiens frequency\n", stdout);
|
142
|
-
random_fasta (homosapiens, 5 * n);
|
143
|
-
return 0;
|
144
|
-
}
|
145
|
-
|
data/sources/gcc/fasta.gcc-4.gcc
DELETED
@@ -1,141 +0,0 @@
|
|
1
|
-
/* The Computer Language Benchmarks Game
|
2
|
-
* http://shootout.alioth.debian.org/
|
3
|
-
* Contributed by Joern Inge Vestgaarden
|
4
|
-
* Modified by Jorge Peixoto de Morais Neto
|
5
|
-
*/
|
6
|
-
|
7
|
-
#include <stdio.h>
|
8
|
-
#include <stdlib.h>
|
9
|
-
#include <string.h>
|
10
|
-
#include <err.h>
|
11
|
-
|
12
|
-
#define WIDTH 60
|
13
|
-
#define MIN(a,b) ((a) <= (b) ? (a) : (b))
|
14
|
-
#define NELEMENTS(x) (sizeof (x) / sizeof ((x)[0]))
|
15
|
-
|
16
|
-
typedef struct {
|
17
|
-
float p;
|
18
|
-
char c;
|
19
|
-
} aminoacid_t;
|
20
|
-
|
21
|
-
static inline float myrandom (float max) {
|
22
|
-
unsigned long const IM = 139968;
|
23
|
-
unsigned long const IA = 3877;
|
24
|
-
unsigned long const IC = 29573;
|
25
|
-
static unsigned long last = 42;
|
26
|
-
last = (last * IA + IC) % IM;
|
27
|
-
/*Integer to float conversions are faster if the integer is signed*/
|
28
|
-
return max * (long) last / IM;
|
29
|
-
}
|
30
|
-
|
31
|
-
static inline void accumulate_probabilities (aminoacid_t *genelist, size_t len) {
|
32
|
-
float cp = 0.0;
|
33
|
-
size_t i;
|
34
|
-
for (i = 0; i < len; i++) {
|
35
|
-
cp += genelist[i].p;
|
36
|
-
genelist[i].p = cp;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
/* This function prints the characters of the string s. When it */
|
41
|
-
/* reaches the end of the string, it goes back to the beginning */
|
42
|
-
/* It stops when the total number of characters printed is count. */
|
43
|
-
/* Between each WIDTH consecutive characters it prints a newline */
|
44
|
-
/* This function assumes that WIDTH <= strlen (s) + 1 */
|
45
|
-
static void repeat_fasta (char const *s, size_t count) {
|
46
|
-
size_t pos = 0;
|
47
|
-
size_t len = strlen (s);
|
48
|
-
char *s2 = malloc (len + WIDTH);
|
49
|
-
memcpy (s2, s, len);
|
50
|
-
memcpy (s2 + len, s, WIDTH);
|
51
|
-
do {
|
52
|
-
size_t line = MIN(WIDTH, count);
|
53
|
-
fwrite_unlocked (s2 + pos,1,line,stdout);
|
54
|
-
putchar_unlocked ('\n');
|
55
|
-
pos += line;
|
56
|
-
if (pos >= len) pos -= len;
|
57
|
-
count -= line;
|
58
|
-
} while (count);
|
59
|
-
free (s2);
|
60
|
-
}
|
61
|
-
|
62
|
-
/* This function takes a pointer to the first element of an array */
|
63
|
-
/* Each element of the array is a struct with a character and */
|
64
|
-
/* a float number p between 0 and 1. */
|
65
|
-
/* The function generates a random float number r and */
|
66
|
-
/* finds the first array element such that p >= r. */
|
67
|
-
/* This is a weighted random selection. */
|
68
|
-
/* The function then prints the character of the array element. */
|
69
|
-
/* This is done count times. */
|
70
|
-
/* Between each WIDTH consecutive characters, the function prints a newline */
|
71
|
-
static void random_fasta (aminoacid_t const *genelist, size_t count) {
|
72
|
-
do {
|
73
|
-
size_t line = MIN(WIDTH, count);
|
74
|
-
size_t pos = 0;
|
75
|
-
char buf[WIDTH + 1];
|
76
|
-
do {
|
77
|
-
float r = myrandom (1.0);
|
78
|
-
size_t i = 0;
|
79
|
-
while (genelist[i].p < r)
|
80
|
-
++i; /* Linear search */
|
81
|
-
buf[pos++] = genelist[i].c;
|
82
|
-
} while (pos < line);
|
83
|
-
buf[line] = '\n';
|
84
|
-
fwrite_unlocked (buf, 1, line + 1, stdout);
|
85
|
-
count -= line;
|
86
|
-
} while (count);
|
87
|
-
}
|
88
|
-
|
89
|
-
int main (int argc, char **argv) {
|
90
|
-
size_t n;
|
91
|
-
if (argc > 1) {
|
92
|
-
char const *arg = argv[1];
|
93
|
-
char *tail;
|
94
|
-
n = strtoul (arg, &tail, 0);
|
95
|
-
if (tail == arg)
|
96
|
-
errx (1, "Could not convert \"%s\" to an unsigned long integer", arg);
|
97
|
-
} else n = 1000;
|
98
|
-
|
99
|
-
static aminoacid_t iub[] = {
|
100
|
-
{ 0.27, 'a' },
|
101
|
-
{ 0.12, 'c' },
|
102
|
-
{ 0.12, 'g' },
|
103
|
-
{ 0.27, 't' },
|
104
|
-
{ 0.02, 'B' },
|
105
|
-
{ 0.02, 'D' },
|
106
|
-
{ 0.02, 'H' },
|
107
|
-
{ 0.02, 'K' },
|
108
|
-
{ 0.02, 'M' },
|
109
|
-
{ 0.02, 'N' },
|
110
|
-
{ 0.02, 'R' },
|
111
|
-
{ 0.02, 'S' },
|
112
|
-
{ 0.02, 'V' },
|
113
|
-
{ 0.02, 'W' },
|
114
|
-
{ 0.02, 'Y' }};
|
115
|
-
|
116
|
-
static aminoacid_t homosapiens[] = {
|
117
|
-
{ 0.3029549426680, 'a' },
|
118
|
-
{ 0.1979883004921, 'c' },
|
119
|
-
{ 0.1975473066391, 'g' },
|
120
|
-
{ 0.3015094502008, 't' }};
|
121
|
-
|
122
|
-
accumulate_probabilities (iub, NELEMENTS(iub));
|
123
|
-
accumulate_probabilities (homosapiens, NELEMENTS(homosapiens));
|
124
|
-
|
125
|
-
static char const *const alu ="\
|
126
|
-
GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG\
|
127
|
-
GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA\
|
128
|
-
CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT\
|
129
|
-
ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA\
|
130
|
-
GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG\
|
131
|
-
AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC\
|
132
|
-
AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA";
|
133
|
-
|
134
|
-
fputs_unlocked (">ONE Homo sapiens alu\n", stdout);
|
135
|
-
repeat_fasta (alu, 2 * n);
|
136
|
-
fputs_unlocked (">TWO IUB ambiguity codes\n", stdout);
|
137
|
-
random_fasta (iub, 3 * n);
|
138
|
-
fputs_unlocked (">THREE Homo sapiens frequency\n", stdout);
|
139
|
-
random_fasta (homosapiens, 5 * n);
|
140
|
-
return 0;
|
141
|
-
}
|
data/sources/gcc/fibo.gcc
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
/* -*- mode: c -*-
|
2
|
-
* $Id: fibo.gcc,v 1.6 2005-04-25 19:01:38 igouy-guest Exp $
|
3
|
-
* http://shootout.alioth.debian.org/
|
4
|
-
* Revised with register allocation by David Bronaugh
|
5
|
-
*/
|
6
|
-
|
7
|
-
#include <stdio.h>
|
8
|
-
#include <stdlib.h>
|
9
|
-
|
10
|
-
static unsigned long
|
11
|
-
fib(unsigned long n) {
|
12
|
-
return( (n < 2) ? 1 : (fib(n-2) + fib(n-1)) );
|
13
|
-
}
|
14
|
-
|
15
|
-
int
|
16
|
-
main(int argc, char *argv[]) {
|
17
|
-
int N = ((argc == 2) ? atoi(argv[1]) : 1);
|
18
|
-
printf("%ld\n", fib(N));
|
19
|
-
return(0);
|
20
|
-
}
|
data/sources/gcc/harmonic.gcc
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
/* The Great Computer Language Shootout
|
2
|
-
http://shootout.alioth.debian.org/
|
3
|
-
|
4
|
-
contributed by Greg Buchholz
|
5
|
-
Optimized by Paul Hsieh
|
6
|
-
compile: gcc -O2 -o harmonic harmonic.c
|
7
|
-
*/
|
8
|
-
#include<stdio.h>
|
9
|
-
#include<stdlib.h>
|
10
|
-
|
11
|
-
int main (int argc, char **argv)
|
12
|
-
{
|
13
|
-
double i=1, sum=0;
|
14
|
-
int n;
|
15
|
-
|
16
|
-
for(n = atoi(argv[1]); n > 0; n--, i++)
|
17
|
-
sum += 1/i;
|
18
|
-
|
19
|
-
printf("%.9f\n", sum);
|
20
|
-
return 0;
|
21
|
-
}
|
22
|
-
|