ngs_server 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/ngs_server +72 -50
- data/ext/bamtools/extconf.rb +3 -3
- data/ext/vcftools/Makefile +28 -0
- data/ext/vcftools/README.txt +36 -0
- data/ext/vcftools/cpp/.svn/all-wcprops +125 -0
- data/ext/vcftools/cpp/.svn/dir-prop-base +6 -0
- data/ext/vcftools/cpp/.svn/entries +708 -0
- data/ext/vcftools/cpp/.svn/text-base/Makefile.svn-base +46 -0
- data/ext/vcftools/cpp/.svn/text-base/dgeev.cpp.svn-base +146 -0
- data/ext/vcftools/cpp/.svn/text-base/dgeev.h.svn-base +43 -0
- data/ext/vcftools/cpp/.svn/text-base/output_log.cpp.svn-base +79 -0
- data/ext/vcftools/cpp/.svn/text-base/output_log.h.svn-base +34 -0
- data/ext/vcftools/cpp/.svn/text-base/parameters.cpp.svn-base +535 -0
- data/ext/vcftools/cpp/.svn/text-base/parameters.h.svn-base +154 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_entry.cpp.svn-base +497 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_entry.h.svn-base +190 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_entry_getters.cpp.svn-base +421 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_entry_setters.cpp.svn-base +482 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_file.cpp.svn-base +495 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_file.h.svn-base +184 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_file_diff.cpp.svn-base +1282 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_file_filters.cpp.svn-base +1215 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_file_format_convert.cpp.svn-base +1138 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_file_index.cpp.svn-base +171 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_file_output.cpp.svn-base +3012 -0
- data/ext/vcftools/cpp/.svn/text-base/vcftools.cpp.svn-base +107 -0
- data/ext/vcftools/cpp/.svn/text-base/vcftools.h.svn-base +25 -0
- data/ext/vcftools/cpp/Makefile +46 -0
- data/ext/vcftools/cpp/dgeev.cpp +146 -0
- data/ext/vcftools/cpp/dgeev.h +43 -0
- data/ext/vcftools/cpp/output_log.cpp +79 -0
- data/ext/vcftools/cpp/output_log.h +34 -0
- data/ext/vcftools/cpp/parameters.cpp +535 -0
- data/ext/vcftools/cpp/parameters.h +154 -0
- data/ext/vcftools/cpp/vcf_entry.cpp +497 -0
- data/ext/vcftools/cpp/vcf_entry.h +190 -0
- data/ext/vcftools/cpp/vcf_entry_getters.cpp +421 -0
- data/ext/vcftools/cpp/vcf_entry_setters.cpp +482 -0
- data/ext/vcftools/cpp/vcf_file.cpp +495 -0
- data/ext/vcftools/cpp/vcf_file.h +184 -0
- data/ext/vcftools/cpp/vcf_file_diff.cpp +1282 -0
- data/ext/vcftools/cpp/vcf_file_filters.cpp +1215 -0
- data/ext/vcftools/cpp/vcf_file_format_convert.cpp +1138 -0
- data/ext/vcftools/cpp/vcf_file_index.cpp +171 -0
- data/ext/vcftools/cpp/vcf_file_output.cpp +3012 -0
- data/ext/vcftools/cpp/vcftools.cpp +107 -0
- data/ext/vcftools/cpp/vcftools.h +25 -0
- data/ext/vcftools/examples/.svn/all-wcprops +185 -0
- data/ext/vcftools/examples/.svn/dir-prop-base +6 -0
- data/ext/vcftools/examples/.svn/entries +1048 -0
- data/ext/vcftools/examples/.svn/prop-base/perl-api-1.pl.svn-base +5 -0
- data/ext/vcftools/examples/.svn/text-base/annotate-test.vcf.svn-base +37 -0
- data/ext/vcftools/examples/.svn/text-base/annotate.out.svn-base +23 -0
- data/ext/vcftools/examples/.svn/text-base/annotate.txt.svn-base +7 -0
- data/ext/vcftools/examples/.svn/text-base/annotate2.out.svn-base +52 -0
- data/ext/vcftools/examples/.svn/text-base/annotate3.out.svn-base +23 -0
- data/ext/vcftools/examples/.svn/text-base/cmp-test-a-3.3.vcf.svn-base +12 -0
- data/ext/vcftools/examples/.svn/text-base/cmp-test-a.vcf.svn-base +12 -0
- data/ext/vcftools/examples/.svn/text-base/cmp-test-b-3.3.vcf.svn-base +12 -0
- data/ext/vcftools/examples/.svn/text-base/cmp-test-b.vcf.svn-base +12 -0
- data/ext/vcftools/examples/.svn/text-base/cmp-test.out.svn-base +53 -0
- data/ext/vcftools/examples/.svn/text-base/concat-a.vcf.svn-base +21 -0
- data/ext/vcftools/examples/.svn/text-base/concat-b.vcf.svn-base +13 -0
- data/ext/vcftools/examples/.svn/text-base/concat-c.vcf.svn-base +19 -0
- data/ext/vcftools/examples/.svn/text-base/concat.out.svn-base +39 -0
- data/ext/vcftools/examples/.svn/text-base/invalid-4.0.vcf.svn-base +31 -0
- data/ext/vcftools/examples/.svn/text-base/isec-n2-test.vcf.out.svn-base +19 -0
- data/ext/vcftools/examples/.svn/text-base/merge-test-a.vcf.svn-base +17 -0
- data/ext/vcftools/examples/.svn/text-base/merge-test-b.vcf.svn-base +17 -0
- data/ext/vcftools/examples/.svn/text-base/merge-test-c.vcf.svn-base +15 -0
- data/ext/vcftools/examples/.svn/text-base/merge-test.vcf.out.svn-base +31 -0
- data/ext/vcftools/examples/.svn/text-base/perl-api-1.pl.svn-base +46 -0
- data/ext/vcftools/examples/.svn/text-base/query-test.out.svn-base +6 -0
- data/ext/vcftools/examples/.svn/text-base/shuffle-test.vcf.svn-base +12 -0
- data/ext/vcftools/examples/.svn/text-base/subset.SNPs.out.svn-base +10 -0
- data/ext/vcftools/examples/.svn/text-base/subset.indels.out.svn-base +18 -0
- data/ext/vcftools/examples/.svn/text-base/subset.vcf.svn-base +21 -0
- data/ext/vcftools/examples/.svn/text-base/valid-3.3.vcf.svn-base +30 -0
- data/ext/vcftools/examples/.svn/text-base/valid-4.0.vcf.stats.svn-base +104 -0
- data/ext/vcftools/examples/.svn/text-base/valid-4.0.vcf.svn-base +34 -0
- data/ext/vcftools/examples/.svn/text-base/valid-4.1.vcf.svn-base +37 -0
- data/ext/vcftools/examples/annotate-test.vcf +37 -0
- data/ext/vcftools/examples/annotate.out +23 -0
- data/ext/vcftools/examples/annotate.txt +7 -0
- data/ext/vcftools/examples/annotate2.out +52 -0
- data/ext/vcftools/examples/annotate3.out +23 -0
- data/ext/vcftools/examples/cmp-test-a-3.3.vcf +12 -0
- data/ext/vcftools/examples/cmp-test-a.vcf +12 -0
- data/ext/vcftools/examples/cmp-test-b-3.3.vcf +12 -0
- data/ext/vcftools/examples/cmp-test-b.vcf +12 -0
- data/ext/vcftools/examples/cmp-test.out +53 -0
- data/ext/vcftools/examples/concat-a.vcf +21 -0
- data/ext/vcftools/examples/concat-b.vcf +13 -0
- data/ext/vcftools/examples/concat-c.vcf +19 -0
- data/ext/vcftools/examples/concat.out +39 -0
- data/ext/vcftools/examples/invalid-4.0.vcf +31 -0
- data/ext/vcftools/examples/isec-n2-test.vcf.out +19 -0
- data/ext/vcftools/examples/merge-test-a.vcf +17 -0
- data/ext/vcftools/examples/merge-test-b.vcf +17 -0
- data/ext/vcftools/examples/merge-test-c.vcf +15 -0
- data/ext/vcftools/examples/merge-test.vcf.out +31 -0
- data/ext/vcftools/examples/perl-api-1.pl +46 -0
- data/ext/vcftools/examples/query-test.out +6 -0
- data/ext/vcftools/examples/shuffle-test.vcf +12 -0
- data/ext/vcftools/examples/subset.SNPs.out +10 -0
- data/ext/vcftools/examples/subset.indels.out +18 -0
- data/ext/vcftools/examples/subset.vcf +21 -0
- data/ext/vcftools/examples/valid-3.3.vcf +30 -0
- data/ext/vcftools/examples/valid-4.0.vcf +34 -0
- data/ext/vcftools/examples/valid-4.0.vcf.stats +104 -0
- data/ext/vcftools/examples/valid-4.1.vcf +37 -0
- data/ext/vcftools/extconf.rb +2 -0
- data/ext/vcftools/perl/.svn/all-wcprops +149 -0
- data/ext/vcftools/perl/.svn/entries +844 -0
- data/ext/vcftools/perl/.svn/prop-base/fill-aa.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/fill-an-ac.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/fill-ref-md5.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/tab-to-vcf.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/test.t.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-annotate.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-compare.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-concat.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-convert.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-fix-newlines.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-isec.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-merge.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-query.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-shuffle-cols.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-sort.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-stats.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-subset.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-to-tab.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-validator.svn-base +5 -0
- data/ext/vcftools/perl/.svn/text-base/ChangeLog.svn-base +84 -0
- data/ext/vcftools/perl/.svn/text-base/FaSlice.pm.svn-base +214 -0
- data/ext/vcftools/perl/.svn/text-base/Makefile.svn-base +12 -0
- data/ext/vcftools/perl/.svn/text-base/Vcf.pm.svn-base +2853 -0
- data/ext/vcftools/perl/.svn/text-base/VcfStats.pm.svn-base +681 -0
- data/ext/vcftools/perl/.svn/text-base/fill-aa.svn-base +103 -0
- data/ext/vcftools/perl/.svn/text-base/fill-an-ac.svn-base +56 -0
- data/ext/vcftools/perl/.svn/text-base/fill-ref-md5.svn-base +204 -0
- data/ext/vcftools/perl/.svn/text-base/tab-to-vcf.svn-base +92 -0
- data/ext/vcftools/perl/.svn/text-base/test.t.svn-base +376 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-annotate.svn-base +1099 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-compare.svn-base +1193 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-concat.svn-base +310 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-convert.svn-base +180 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-fix-newlines.svn-base +97 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-isec.svn-base +660 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-merge.svn-base +577 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-query.svn-base +272 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-shuffle-cols.svn-base +89 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-sort.svn-base +79 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-stats.svn-base +160 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-subset.svn-base +206 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-to-tab.svn-base +112 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-validator.svn-base +145 -0
- data/ext/vcftools/perl/ChangeLog +84 -0
- data/ext/vcftools/perl/FaSlice.pm +214 -0
- data/ext/vcftools/perl/Makefile +12 -0
- data/ext/vcftools/perl/Vcf.pm +2853 -0
- data/ext/vcftools/perl/VcfStats.pm +681 -0
- data/ext/vcftools/perl/fill-aa +103 -0
- data/ext/vcftools/perl/fill-an-ac +56 -0
- data/ext/vcftools/perl/fill-ref-md5 +204 -0
- data/ext/vcftools/perl/tab-to-vcf +92 -0
- data/ext/vcftools/perl/test.t +376 -0
- data/ext/vcftools/perl/vcf-annotate +1099 -0
- data/ext/vcftools/perl/vcf-compare +1193 -0
- data/ext/vcftools/perl/vcf-concat +310 -0
- data/ext/vcftools/perl/vcf-convert +180 -0
- data/ext/vcftools/perl/vcf-fix-newlines +97 -0
- data/ext/vcftools/perl/vcf-isec +660 -0
- data/ext/vcftools/perl/vcf-merge +577 -0
- data/ext/vcftools/perl/vcf-query +286 -0
- data/ext/vcftools/perl/vcf-shuffle-cols +89 -0
- data/ext/vcftools/perl/vcf-sort +79 -0
- data/ext/vcftools/perl/vcf-stats +160 -0
- data/ext/vcftools/perl/vcf-subset +206 -0
- data/ext/vcftools/perl/vcf-to-tab +112 -0
- data/ext/vcftools/perl/vcf-validator +145 -0
- data/ext/vcftools/website/.svn/all-wcprops +41 -0
- data/ext/vcftools/website/.svn/entries +238 -0
- data/ext/vcftools/website/.svn/prop-base/VCF-poster.pdf.svn-base +5 -0
- data/ext/vcftools/website/.svn/prop-base/favicon.ico.svn-base +5 -0
- data/ext/vcftools/website/.svn/prop-base/favicon.png.svn-base +5 -0
- data/ext/vcftools/website/.svn/text-base/Makefile.svn-base +6 -0
- data/ext/vcftools/website/.svn/text-base/README.svn-base +2 -0
- data/ext/vcftools/website/.svn/text-base/VCF-poster.pdf.svn-base +0 -0
- data/ext/vcftools/website/.svn/text-base/default.css.svn-base +250 -0
- data/ext/vcftools/website/.svn/text-base/favicon.ico.svn-base +0 -0
- data/ext/vcftools/website/.svn/text-base/favicon.png.svn-base +0 -0
- data/ext/vcftools/website/Makefile +6 -0
- data/ext/vcftools/website/README +2 -0
- data/ext/vcftools/website/VCF-poster.pdf +0 -0
- data/ext/vcftools/website/default.css +250 -0
- data/ext/vcftools/website/favicon.ico +0 -0
- data/ext/vcftools/website/favicon.png +0 -0
- data/ext/vcftools/website/img/.svn/all-wcprops +53 -0
- data/ext/vcftools/website/img/.svn/entries +300 -0
- data/ext/vcftools/website/img/.svn/prop-base/bg.gif.svn-base +5 -0
- data/ext/vcftools/website/img/.svn/prop-base/bgcode.gif.svn-base +5 -0
- data/ext/vcftools/website/img/.svn/prop-base/bgcontainer.gif.svn-base +5 -0
- data/ext/vcftools/website/img/.svn/prop-base/bgul.gif.svn-base +5 -0
- data/ext/vcftools/website/img/.svn/prop-base/header.gif.svn-base +5 -0
- data/ext/vcftools/website/img/.svn/prop-base/li.gif.svn-base +5 -0
- data/ext/vcftools/website/img/.svn/prop-base/quote.gif.svn-base +5 -0
- data/ext/vcftools/website/img/.svn/prop-base/search.gif.svn-base +5 -0
- data/ext/vcftools/website/img/.svn/text-base/bg.gif.svn-base +0 -0
- data/ext/vcftools/website/img/.svn/text-base/bgcode.gif.svn-base +0 -0
- data/ext/vcftools/website/img/.svn/text-base/bgcontainer.gif.svn-base +0 -0
- data/ext/vcftools/website/img/.svn/text-base/bgul.gif.svn-base +0 -0
- data/ext/vcftools/website/img/.svn/text-base/header.gif.svn-base +0 -0
- data/ext/vcftools/website/img/.svn/text-base/li.gif.svn-base +0 -0
- data/ext/vcftools/website/img/.svn/text-base/quote.gif.svn-base +0 -0
- data/ext/vcftools/website/img/.svn/text-base/search.gif.svn-base +0 -0
- data/ext/vcftools/website/img/bg.gif +0 -0
- data/ext/vcftools/website/img/bgcode.gif +0 -0
- data/ext/vcftools/website/img/bgcontainer.gif +0 -0
- data/ext/vcftools/website/img/bgul.gif +0 -0
- data/ext/vcftools/website/img/header.gif +0 -0
- data/ext/vcftools/website/img/li.gif +0 -0
- data/ext/vcftools/website/img/quote.gif +0 -0
- data/ext/vcftools/website/img/search.gif +0 -0
- data/ext/vcftools/website/src/.svn/all-wcprops +53 -0
- data/ext/vcftools/website/src/.svn/entries +300 -0
- data/ext/vcftools/website/src/.svn/text-base/docs.inc.svn-base +202 -0
- data/ext/vcftools/website/src/.svn/text-base/index.inc.svn-base +52 -0
- data/ext/vcftools/website/src/.svn/text-base/index.php.svn-base +80 -0
- data/ext/vcftools/website/src/.svn/text-base/license.inc.svn-base +27 -0
- data/ext/vcftools/website/src/.svn/text-base/links.inc.svn-base +13 -0
- data/ext/vcftools/website/src/.svn/text-base/options.inc.svn-base +654 -0
- data/ext/vcftools/website/src/.svn/text-base/perl_module.inc.svn-base +249 -0
- data/ext/vcftools/website/src/.svn/text-base/specs.inc.svn-base +18 -0
- data/ext/vcftools/website/src/docs.inc +202 -0
- data/ext/vcftools/website/src/index.inc +52 -0
- data/ext/vcftools/website/src/index.php +80 -0
- data/ext/vcftools/website/src/license.inc +27 -0
- data/ext/vcftools/website/src/links.inc +13 -0
- data/ext/vcftools/website/src/options.inc +654 -0
- data/ext/vcftools/website/src/perl_module.inc +249 -0
- data/ext/vcftools/website/src/specs.inc +18 -0
- data/lib/config.ru +9 -0
- data/lib/ngs_server/add.rb +9 -0
- data/lib/ngs_server/version.rb +1 -1
- data/lib/ngs_server.rb +55 -3
- data/ngs_server.gemspec +5 -2
- metadata +296 -6
@@ -0,0 +1,146 @@
|
|
1
|
+
/*
|
2
|
+
* dgeev.cpp
|
3
|
+
*
|
4
|
+
* Created on: 20 Apr 2011
|
5
|
+
* Author: auton
|
6
|
+
* ($Revision: 1 $)
|
7
|
+
*/
|
8
|
+
|
9
|
+
#include "dgeev.h"
|
10
|
+
|
11
|
+
void dgeev_sort(double *Er, double *Ei, int N)
|
12
|
+
{
|
13
|
+
double temp, *E2;
|
14
|
+
int i, j;
|
15
|
+
|
16
|
+
E2 = new double[N];
|
17
|
+
for (i=0; i<N; i++)
|
18
|
+
E2[i] = Er[i]*Er[i]+Ei[i]*Ei[i];
|
19
|
+
|
20
|
+
for (j=0; j<N; j++)
|
21
|
+
for (i=0; i<N-1; i++)
|
22
|
+
if (fabs(E2[i])<fabs(E2[i+1]))
|
23
|
+
{
|
24
|
+
temp = E2[i]; E2[i] = E2[i+1]; E2[i+1] = temp;
|
25
|
+
temp = Er[i]; Er[i] = Er[i+1]; Er[i+1] = temp;
|
26
|
+
temp = Ei[i]; Ei[i] = Ei[i+1]; Ei[i+1] = temp;
|
27
|
+
}
|
28
|
+
|
29
|
+
delete [] E2;
|
30
|
+
}
|
31
|
+
|
32
|
+
|
33
|
+
void dgeev_sort(double *Er, double *Ei, double **Evecs, int N)
|
34
|
+
{
|
35
|
+
double temp, *E2;
|
36
|
+
int i, j, k;
|
37
|
+
|
38
|
+
E2 = new double[N];
|
39
|
+
for (i=0; i<N; i++)
|
40
|
+
E2[i] = Er[i]*Er[i]+Ei[i]*Ei[i];
|
41
|
+
|
42
|
+
for (j=0; j<N; j++)
|
43
|
+
for (i=0; i<N-1; i++)
|
44
|
+
if (fabs(E2[i])<fabs(E2[i+1]))
|
45
|
+
{
|
46
|
+
temp = E2[i]; E2[i] = E2[i+1]; E2[i+1] = temp;
|
47
|
+
temp = Er[i]; Er[i] = Er[i+1]; Er[i+1] = temp;
|
48
|
+
temp = Ei[i]; Ei[i] = Ei[i+1]; Ei[i+1] = temp;
|
49
|
+
|
50
|
+
for (k=0; k<N; k++)
|
51
|
+
{
|
52
|
+
temp = Evecs[k][i];
|
53
|
+
Evecs[k][i] = Evecs[k][i+1];
|
54
|
+
Evecs[k][i+1] = temp;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
delete [] E2;
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
double* dgeev_ctof(double **in, int rows, int cols)
|
63
|
+
{
|
64
|
+
double *out;
|
65
|
+
int i, j;
|
66
|
+
|
67
|
+
out = new double[rows*cols];
|
68
|
+
for (i=0; i<rows; i++)
|
69
|
+
for (j=0; j<cols; j++)
|
70
|
+
out[i+j*cols] = in[i][j];
|
71
|
+
return(out);
|
72
|
+
}
|
73
|
+
|
74
|
+
|
75
|
+
void dgeev_ftoc(double *in, double **out, int rows, int cols)
|
76
|
+
{
|
77
|
+
int i, j;
|
78
|
+
|
79
|
+
for (i=0; i<rows; i++)
|
80
|
+
for (j=0; j<cols; j++)
|
81
|
+
out[i][j] = in[i+j*cols];
|
82
|
+
}
|
83
|
+
|
84
|
+
|
85
|
+
void dgeev(double **H, int n, double *Er, double *Ei)
|
86
|
+
{
|
87
|
+
char jobvl, jobvr;
|
88
|
+
int lda, ldvl, ldvr, lwork, info;
|
89
|
+
double *a, *vl, *vr, *work;
|
90
|
+
|
91
|
+
jobvl = 'N'; // V/N to calculate/not calculate the left eigenvectors of the matrix H.
|
92
|
+
jobvr = 'N'; // As above, but for the right eigenvectors.
|
93
|
+
|
94
|
+
lda = n; // The leading dimension of the matrix a.
|
95
|
+
a = dgeev_ctof(H, n, lda); // Convert the matrix H from double pointer C form to single pointer Fortran form.
|
96
|
+
|
97
|
+
/* Whether we want them or not, we need to define the matrices
|
98
|
+
for the eigenvectors, and give their leading dimensions.
|
99
|
+
We also create a vector for work space. */
|
100
|
+
|
101
|
+
ldvl = n;
|
102
|
+
vl = new double[n*n];
|
103
|
+
ldvr = n;
|
104
|
+
vr = new double[n*n];
|
105
|
+
work = new double[4*n];
|
106
|
+
lwork = 4*n;
|
107
|
+
|
108
|
+
dgeev_(&jobvl, &jobvr, &n, a, &lda, Er, Ei, vl, &ldvl, vr, &ldvr, work, &lwork, &info);
|
109
|
+
|
110
|
+
dgeev_sort(Er, Ei, n); //Sort the results by eigenvalue in decreasing magnitude.
|
111
|
+
|
112
|
+
delete [] a;
|
113
|
+
delete [] vl;
|
114
|
+
delete [] vr;
|
115
|
+
delete [] work;
|
116
|
+
}
|
117
|
+
|
118
|
+
|
119
|
+
void dgeev(double **H, int n, double *Er, double *Ei, double **Evecs)
|
120
|
+
{
|
121
|
+
char jobvl, jobvr;
|
122
|
+
int lda, ldvl, ldvr, lwork, info;
|
123
|
+
double *a, *vl, *vr, *work;
|
124
|
+
|
125
|
+
jobvl = 'N';
|
126
|
+
jobvr = 'V';
|
127
|
+
lda = n;
|
128
|
+
a = dgeev_ctof(H, n, lda);
|
129
|
+
|
130
|
+
ldvl = n;
|
131
|
+
vl = new double[n*n];
|
132
|
+
ldvr = n;
|
133
|
+
vr = new double[n*n];
|
134
|
+
work = new double[4*n];
|
135
|
+
lwork = 4*n;
|
136
|
+
|
137
|
+
dgeev_(&jobvl, &jobvr, &n, a, &lda, Er, Ei, vl, &ldvl, vr, &ldvr, work, &lwork, &info);
|
138
|
+
|
139
|
+
dgeev_ftoc(vr, Evecs, n, ldvr);
|
140
|
+
dgeev_sort(Er, Ei, Evecs, n);
|
141
|
+
|
142
|
+
delete [] a;
|
143
|
+
delete [] vl;
|
144
|
+
delete [] vr;
|
145
|
+
delete [] work;
|
146
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/*
|
2
|
+
* dgeev.h
|
3
|
+
* ($Revision: 1 $)
|
4
|
+
This file contains a wrapper around the LAPACK dgeev routine,
|
5
|
+
used to calculate eigenvalues and associated eigenvectors
|
6
|
+
for a square asymmetric matrix H. Since the matrix is asymmetrix,
|
7
|
+
both real and imaginary components of the eigenvalues are returned.
|
8
|
+
For real, symmetric matricies, the eigenvalues will be real, and
|
9
|
+
hence the complex terms equal to zero.
|
10
|
+
|
11
|
+
There are two function calls defined in this header, of the
|
12
|
+
forms
|
13
|
+
|
14
|
+
void dgeev(double **H, int n, double *Er, double *Ei)
|
15
|
+
void dgeev(double **H, int n, double *Er, double *Ei, double **Evecs)
|
16
|
+
|
17
|
+
H: the n by n matrix that we are solving.
|
18
|
+
n: the order of the square matrix H.
|
19
|
+
Er: an n-element array to hold the real parts of the eigenvalues.
|
20
|
+
Ei: an n-element array to hold the imaginary parts of the eigenvalues.
|
21
|
+
Evecs: an n by n matrix to hold the eigenvectors.
|
22
|
+
*/
|
23
|
+
|
24
|
+
#ifndef DGEEV_H_
|
25
|
+
#define DGEEV_H_
|
26
|
+
|
27
|
+
#include <cmath>
|
28
|
+
|
29
|
+
void dgeev(double **H, int n, double *Er, double *Ei);
|
30
|
+
void dgeev(double **H, int n, double *Er, double *Ei, double **Evecs);
|
31
|
+
|
32
|
+
double *dgeev_ctof(double **in, int rows, int cols);
|
33
|
+
void dgeev_ftoc(double *in, double **out, int rows, int cols);
|
34
|
+
void dgeev_sort(double *Er, double *Ei, int N);
|
35
|
+
void dgeev_sort(double *Er, double *Ei, double **Evecs, int N);
|
36
|
+
|
37
|
+
|
38
|
+
extern "C" void dgeev_(char *jobvl, char *jobvr, int *n, double *a,
|
39
|
+
int *lda, double *wr, double *wi, double *vl,
|
40
|
+
int *ldvl, double *vr, int *ldvr,
|
41
|
+
double *work, int *lwork, int *info);
|
42
|
+
|
43
|
+
#endif
|
@@ -0,0 +1,79 @@
|
|
1
|
+
/*
|
2
|
+
* log.cpp
|
3
|
+
*
|
4
|
+
* Created on: Nov 11, 2009
|
5
|
+
* Author: Adam Auton
|
6
|
+
* ($Revision: 66 $)
|
7
|
+
*/
|
8
|
+
|
9
|
+
#include "output_log.h"
|
10
|
+
|
11
|
+
void printLOG(string s)
|
12
|
+
{
|
13
|
+
LOG << s; LOG.flush();
|
14
|
+
cout << s; cout.flush();
|
15
|
+
}
|
16
|
+
|
17
|
+
void error(string err_msg, int error_code)
|
18
|
+
{
|
19
|
+
printLOG("Error:" + err_msg + "\n");
|
20
|
+
exit(error_code);
|
21
|
+
}
|
22
|
+
|
23
|
+
|
24
|
+
void error(string err_msg, double value1, double value2, int error_code)
|
25
|
+
{
|
26
|
+
printLOG("Error:" + err_msg + "\n");
|
27
|
+
stringstream ss;
|
28
|
+
ss << "Value1=" << value1 << " Value2=" << value2 << endl;
|
29
|
+
printLOG(ss.str());
|
30
|
+
exit(error_code);
|
31
|
+
}
|
32
|
+
|
33
|
+
void warning(string err_msg)
|
34
|
+
{
|
35
|
+
printLOG(err_msg + "\n");
|
36
|
+
}
|
37
|
+
|
38
|
+
void one_off_warning(string err_msg)
|
39
|
+
{
|
40
|
+
static set<string> previous_warnings;
|
41
|
+
if (previous_warnings.find(err_msg) == previous_warnings.end())
|
42
|
+
{
|
43
|
+
printLOG(err_msg + "\n");
|
44
|
+
previous_warnings.insert(err_msg);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
string int2str(int n)
|
49
|
+
{
|
50
|
+
std::ostringstream s2( std::stringstream::out );
|
51
|
+
s2 << n;
|
52
|
+
return s2.str();
|
53
|
+
}
|
54
|
+
|
55
|
+
string longint2str(long int n)
|
56
|
+
{
|
57
|
+
std::ostringstream s2( std::stringstream::out );
|
58
|
+
s2 << n;
|
59
|
+
return s2.str();
|
60
|
+
}
|
61
|
+
|
62
|
+
string dbl2str(double n, int prc)
|
63
|
+
{
|
64
|
+
std::ostringstream s2;
|
65
|
+
if ( prc > 0 )
|
66
|
+
s2.precision(prc);
|
67
|
+
s2 << n;
|
68
|
+
return s2.str();
|
69
|
+
}
|
70
|
+
|
71
|
+
string dbl2str_fixed(double n, int prc)
|
72
|
+
{
|
73
|
+
std::ostringstream s2;
|
74
|
+
s2 << setiosflags( ios::fixed );
|
75
|
+
if ( prc > 0 )
|
76
|
+
s2.precision(prc);
|
77
|
+
s2 << n;
|
78
|
+
return s2.str();
|
79
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/*
|
2
|
+
* log.h
|
3
|
+
*
|
4
|
+
* Created on: Nov 11, 2009
|
5
|
+
* Author: Adam Auton
|
6
|
+
* ($Revision: 91 $)
|
7
|
+
*/
|
8
|
+
|
9
|
+
#ifndef LOG_H_
|
10
|
+
#define LOG_H_
|
11
|
+
|
12
|
+
#include <cstdio>
|
13
|
+
#include <cstdlib>
|
14
|
+
#include <fstream>
|
15
|
+
#include <iomanip>
|
16
|
+
#include <iostream>
|
17
|
+
#include <set>
|
18
|
+
#include <sstream>
|
19
|
+
|
20
|
+
using namespace std;
|
21
|
+
|
22
|
+
extern ofstream LOG;
|
23
|
+
|
24
|
+
void printLOG(string s);
|
25
|
+
void error(string err_msg, int error_code=0);
|
26
|
+
void error(string err_msg, double value1, double value2, int error_code=0);
|
27
|
+
void warning(string err_msg);
|
28
|
+
void one_off_warning(string err_msg);
|
29
|
+
string int2str(int n);
|
30
|
+
string longint2str(long int n);
|
31
|
+
string dbl2str(double n, int prc);
|
32
|
+
string dbl2str_fixed(double n, int prc);
|
33
|
+
|
34
|
+
#endif /* LOG_H_ */
|