ngs_server 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (248) hide show
  1. data/bin/ngs_server +72 -50
  2. data/ext/bamtools/extconf.rb +3 -3
  3. data/ext/vcftools/Makefile +28 -0
  4. data/ext/vcftools/README.txt +36 -0
  5. data/ext/vcftools/cpp/.svn/all-wcprops +125 -0
  6. data/ext/vcftools/cpp/.svn/dir-prop-base +6 -0
  7. data/ext/vcftools/cpp/.svn/entries +708 -0
  8. data/ext/vcftools/cpp/.svn/text-base/Makefile.svn-base +46 -0
  9. data/ext/vcftools/cpp/.svn/text-base/dgeev.cpp.svn-base +146 -0
  10. data/ext/vcftools/cpp/.svn/text-base/dgeev.h.svn-base +43 -0
  11. data/ext/vcftools/cpp/.svn/text-base/output_log.cpp.svn-base +79 -0
  12. data/ext/vcftools/cpp/.svn/text-base/output_log.h.svn-base +34 -0
  13. data/ext/vcftools/cpp/.svn/text-base/parameters.cpp.svn-base +535 -0
  14. data/ext/vcftools/cpp/.svn/text-base/parameters.h.svn-base +154 -0
  15. data/ext/vcftools/cpp/.svn/text-base/vcf_entry.cpp.svn-base +497 -0
  16. data/ext/vcftools/cpp/.svn/text-base/vcf_entry.h.svn-base +190 -0
  17. data/ext/vcftools/cpp/.svn/text-base/vcf_entry_getters.cpp.svn-base +421 -0
  18. data/ext/vcftools/cpp/.svn/text-base/vcf_entry_setters.cpp.svn-base +482 -0
  19. data/ext/vcftools/cpp/.svn/text-base/vcf_file.cpp.svn-base +495 -0
  20. data/ext/vcftools/cpp/.svn/text-base/vcf_file.h.svn-base +184 -0
  21. data/ext/vcftools/cpp/.svn/text-base/vcf_file_diff.cpp.svn-base +1282 -0
  22. data/ext/vcftools/cpp/.svn/text-base/vcf_file_filters.cpp.svn-base +1215 -0
  23. data/ext/vcftools/cpp/.svn/text-base/vcf_file_format_convert.cpp.svn-base +1138 -0
  24. data/ext/vcftools/cpp/.svn/text-base/vcf_file_index.cpp.svn-base +171 -0
  25. data/ext/vcftools/cpp/.svn/text-base/vcf_file_output.cpp.svn-base +3012 -0
  26. data/ext/vcftools/cpp/.svn/text-base/vcftools.cpp.svn-base +107 -0
  27. data/ext/vcftools/cpp/.svn/text-base/vcftools.h.svn-base +25 -0
  28. data/ext/vcftools/cpp/Makefile +46 -0
  29. data/ext/vcftools/cpp/dgeev.cpp +146 -0
  30. data/ext/vcftools/cpp/dgeev.h +43 -0
  31. data/ext/vcftools/cpp/output_log.cpp +79 -0
  32. data/ext/vcftools/cpp/output_log.h +34 -0
  33. data/ext/vcftools/cpp/parameters.cpp +535 -0
  34. data/ext/vcftools/cpp/parameters.h +154 -0
  35. data/ext/vcftools/cpp/vcf_entry.cpp +497 -0
  36. data/ext/vcftools/cpp/vcf_entry.h +190 -0
  37. data/ext/vcftools/cpp/vcf_entry_getters.cpp +421 -0
  38. data/ext/vcftools/cpp/vcf_entry_setters.cpp +482 -0
  39. data/ext/vcftools/cpp/vcf_file.cpp +495 -0
  40. data/ext/vcftools/cpp/vcf_file.h +184 -0
  41. data/ext/vcftools/cpp/vcf_file_diff.cpp +1282 -0
  42. data/ext/vcftools/cpp/vcf_file_filters.cpp +1215 -0
  43. data/ext/vcftools/cpp/vcf_file_format_convert.cpp +1138 -0
  44. data/ext/vcftools/cpp/vcf_file_index.cpp +171 -0
  45. data/ext/vcftools/cpp/vcf_file_output.cpp +3012 -0
  46. data/ext/vcftools/cpp/vcftools.cpp +107 -0
  47. data/ext/vcftools/cpp/vcftools.h +25 -0
  48. data/ext/vcftools/examples/.svn/all-wcprops +185 -0
  49. data/ext/vcftools/examples/.svn/dir-prop-base +6 -0
  50. data/ext/vcftools/examples/.svn/entries +1048 -0
  51. data/ext/vcftools/examples/.svn/prop-base/perl-api-1.pl.svn-base +5 -0
  52. data/ext/vcftools/examples/.svn/text-base/annotate-test.vcf.svn-base +37 -0
  53. data/ext/vcftools/examples/.svn/text-base/annotate.out.svn-base +23 -0
  54. data/ext/vcftools/examples/.svn/text-base/annotate.txt.svn-base +7 -0
  55. data/ext/vcftools/examples/.svn/text-base/annotate2.out.svn-base +52 -0
  56. data/ext/vcftools/examples/.svn/text-base/annotate3.out.svn-base +23 -0
  57. data/ext/vcftools/examples/.svn/text-base/cmp-test-a-3.3.vcf.svn-base +12 -0
  58. data/ext/vcftools/examples/.svn/text-base/cmp-test-a.vcf.svn-base +12 -0
  59. data/ext/vcftools/examples/.svn/text-base/cmp-test-b-3.3.vcf.svn-base +12 -0
  60. data/ext/vcftools/examples/.svn/text-base/cmp-test-b.vcf.svn-base +12 -0
  61. data/ext/vcftools/examples/.svn/text-base/cmp-test.out.svn-base +53 -0
  62. data/ext/vcftools/examples/.svn/text-base/concat-a.vcf.svn-base +21 -0
  63. data/ext/vcftools/examples/.svn/text-base/concat-b.vcf.svn-base +13 -0
  64. data/ext/vcftools/examples/.svn/text-base/concat-c.vcf.svn-base +19 -0
  65. data/ext/vcftools/examples/.svn/text-base/concat.out.svn-base +39 -0
  66. data/ext/vcftools/examples/.svn/text-base/invalid-4.0.vcf.svn-base +31 -0
  67. data/ext/vcftools/examples/.svn/text-base/isec-n2-test.vcf.out.svn-base +19 -0
  68. data/ext/vcftools/examples/.svn/text-base/merge-test-a.vcf.svn-base +17 -0
  69. data/ext/vcftools/examples/.svn/text-base/merge-test-b.vcf.svn-base +17 -0
  70. data/ext/vcftools/examples/.svn/text-base/merge-test-c.vcf.svn-base +15 -0
  71. data/ext/vcftools/examples/.svn/text-base/merge-test.vcf.out.svn-base +31 -0
  72. data/ext/vcftools/examples/.svn/text-base/perl-api-1.pl.svn-base +46 -0
  73. data/ext/vcftools/examples/.svn/text-base/query-test.out.svn-base +6 -0
  74. data/ext/vcftools/examples/.svn/text-base/shuffle-test.vcf.svn-base +12 -0
  75. data/ext/vcftools/examples/.svn/text-base/subset.SNPs.out.svn-base +10 -0
  76. data/ext/vcftools/examples/.svn/text-base/subset.indels.out.svn-base +18 -0
  77. data/ext/vcftools/examples/.svn/text-base/subset.vcf.svn-base +21 -0
  78. data/ext/vcftools/examples/.svn/text-base/valid-3.3.vcf.svn-base +30 -0
  79. data/ext/vcftools/examples/.svn/text-base/valid-4.0.vcf.stats.svn-base +104 -0
  80. data/ext/vcftools/examples/.svn/text-base/valid-4.0.vcf.svn-base +34 -0
  81. data/ext/vcftools/examples/.svn/text-base/valid-4.1.vcf.svn-base +37 -0
  82. data/ext/vcftools/examples/annotate-test.vcf +37 -0
  83. data/ext/vcftools/examples/annotate.out +23 -0
  84. data/ext/vcftools/examples/annotate.txt +7 -0
  85. data/ext/vcftools/examples/annotate2.out +52 -0
  86. data/ext/vcftools/examples/annotate3.out +23 -0
  87. data/ext/vcftools/examples/cmp-test-a-3.3.vcf +12 -0
  88. data/ext/vcftools/examples/cmp-test-a.vcf +12 -0
  89. data/ext/vcftools/examples/cmp-test-b-3.3.vcf +12 -0
  90. data/ext/vcftools/examples/cmp-test-b.vcf +12 -0
  91. data/ext/vcftools/examples/cmp-test.out +53 -0
  92. data/ext/vcftools/examples/concat-a.vcf +21 -0
  93. data/ext/vcftools/examples/concat-b.vcf +13 -0
  94. data/ext/vcftools/examples/concat-c.vcf +19 -0
  95. data/ext/vcftools/examples/concat.out +39 -0
  96. data/ext/vcftools/examples/invalid-4.0.vcf +31 -0
  97. data/ext/vcftools/examples/isec-n2-test.vcf.out +19 -0
  98. data/ext/vcftools/examples/merge-test-a.vcf +17 -0
  99. data/ext/vcftools/examples/merge-test-b.vcf +17 -0
  100. data/ext/vcftools/examples/merge-test-c.vcf +15 -0
  101. data/ext/vcftools/examples/merge-test.vcf.out +31 -0
  102. data/ext/vcftools/examples/perl-api-1.pl +46 -0
  103. data/ext/vcftools/examples/query-test.out +6 -0
  104. data/ext/vcftools/examples/shuffle-test.vcf +12 -0
  105. data/ext/vcftools/examples/subset.SNPs.out +10 -0
  106. data/ext/vcftools/examples/subset.indels.out +18 -0
  107. data/ext/vcftools/examples/subset.vcf +21 -0
  108. data/ext/vcftools/examples/valid-3.3.vcf +30 -0
  109. data/ext/vcftools/examples/valid-4.0.vcf +34 -0
  110. data/ext/vcftools/examples/valid-4.0.vcf.stats +104 -0
  111. data/ext/vcftools/examples/valid-4.1.vcf +37 -0
  112. data/ext/vcftools/extconf.rb +2 -0
  113. data/ext/vcftools/perl/.svn/all-wcprops +149 -0
  114. data/ext/vcftools/perl/.svn/entries +844 -0
  115. data/ext/vcftools/perl/.svn/prop-base/fill-aa.svn-base +5 -0
  116. data/ext/vcftools/perl/.svn/prop-base/fill-an-ac.svn-base +5 -0
  117. data/ext/vcftools/perl/.svn/prop-base/fill-ref-md5.svn-base +5 -0
  118. data/ext/vcftools/perl/.svn/prop-base/tab-to-vcf.svn-base +5 -0
  119. data/ext/vcftools/perl/.svn/prop-base/test.t.svn-base +5 -0
  120. data/ext/vcftools/perl/.svn/prop-base/vcf-annotate.svn-base +5 -0
  121. data/ext/vcftools/perl/.svn/prop-base/vcf-compare.svn-base +5 -0
  122. data/ext/vcftools/perl/.svn/prop-base/vcf-concat.svn-base +5 -0
  123. data/ext/vcftools/perl/.svn/prop-base/vcf-convert.svn-base +5 -0
  124. data/ext/vcftools/perl/.svn/prop-base/vcf-fix-newlines.svn-base +5 -0
  125. data/ext/vcftools/perl/.svn/prop-base/vcf-isec.svn-base +5 -0
  126. data/ext/vcftools/perl/.svn/prop-base/vcf-merge.svn-base +5 -0
  127. data/ext/vcftools/perl/.svn/prop-base/vcf-query.svn-base +5 -0
  128. data/ext/vcftools/perl/.svn/prop-base/vcf-shuffle-cols.svn-base +5 -0
  129. data/ext/vcftools/perl/.svn/prop-base/vcf-sort.svn-base +5 -0
  130. data/ext/vcftools/perl/.svn/prop-base/vcf-stats.svn-base +5 -0
  131. data/ext/vcftools/perl/.svn/prop-base/vcf-subset.svn-base +5 -0
  132. data/ext/vcftools/perl/.svn/prop-base/vcf-to-tab.svn-base +5 -0
  133. data/ext/vcftools/perl/.svn/prop-base/vcf-validator.svn-base +5 -0
  134. data/ext/vcftools/perl/.svn/text-base/ChangeLog.svn-base +84 -0
  135. data/ext/vcftools/perl/.svn/text-base/FaSlice.pm.svn-base +214 -0
  136. data/ext/vcftools/perl/.svn/text-base/Makefile.svn-base +12 -0
  137. data/ext/vcftools/perl/.svn/text-base/Vcf.pm.svn-base +2853 -0
  138. data/ext/vcftools/perl/.svn/text-base/VcfStats.pm.svn-base +681 -0
  139. data/ext/vcftools/perl/.svn/text-base/fill-aa.svn-base +103 -0
  140. data/ext/vcftools/perl/.svn/text-base/fill-an-ac.svn-base +56 -0
  141. data/ext/vcftools/perl/.svn/text-base/fill-ref-md5.svn-base +204 -0
  142. data/ext/vcftools/perl/.svn/text-base/tab-to-vcf.svn-base +92 -0
  143. data/ext/vcftools/perl/.svn/text-base/test.t.svn-base +376 -0
  144. data/ext/vcftools/perl/.svn/text-base/vcf-annotate.svn-base +1099 -0
  145. data/ext/vcftools/perl/.svn/text-base/vcf-compare.svn-base +1193 -0
  146. data/ext/vcftools/perl/.svn/text-base/vcf-concat.svn-base +310 -0
  147. data/ext/vcftools/perl/.svn/text-base/vcf-convert.svn-base +180 -0
  148. data/ext/vcftools/perl/.svn/text-base/vcf-fix-newlines.svn-base +97 -0
  149. data/ext/vcftools/perl/.svn/text-base/vcf-isec.svn-base +660 -0
  150. data/ext/vcftools/perl/.svn/text-base/vcf-merge.svn-base +577 -0
  151. data/ext/vcftools/perl/.svn/text-base/vcf-query.svn-base +272 -0
  152. data/ext/vcftools/perl/.svn/text-base/vcf-shuffle-cols.svn-base +89 -0
  153. data/ext/vcftools/perl/.svn/text-base/vcf-sort.svn-base +79 -0
  154. data/ext/vcftools/perl/.svn/text-base/vcf-stats.svn-base +160 -0
  155. data/ext/vcftools/perl/.svn/text-base/vcf-subset.svn-base +206 -0
  156. data/ext/vcftools/perl/.svn/text-base/vcf-to-tab.svn-base +112 -0
  157. data/ext/vcftools/perl/.svn/text-base/vcf-validator.svn-base +145 -0
  158. data/ext/vcftools/perl/ChangeLog +84 -0
  159. data/ext/vcftools/perl/FaSlice.pm +214 -0
  160. data/ext/vcftools/perl/Makefile +12 -0
  161. data/ext/vcftools/perl/Vcf.pm +2853 -0
  162. data/ext/vcftools/perl/VcfStats.pm +681 -0
  163. data/ext/vcftools/perl/fill-aa +103 -0
  164. data/ext/vcftools/perl/fill-an-ac +56 -0
  165. data/ext/vcftools/perl/fill-ref-md5 +204 -0
  166. data/ext/vcftools/perl/tab-to-vcf +92 -0
  167. data/ext/vcftools/perl/test.t +376 -0
  168. data/ext/vcftools/perl/vcf-annotate +1099 -0
  169. data/ext/vcftools/perl/vcf-compare +1193 -0
  170. data/ext/vcftools/perl/vcf-concat +310 -0
  171. data/ext/vcftools/perl/vcf-convert +180 -0
  172. data/ext/vcftools/perl/vcf-fix-newlines +97 -0
  173. data/ext/vcftools/perl/vcf-isec +660 -0
  174. data/ext/vcftools/perl/vcf-merge +577 -0
  175. data/ext/vcftools/perl/vcf-query +286 -0
  176. data/ext/vcftools/perl/vcf-shuffle-cols +89 -0
  177. data/ext/vcftools/perl/vcf-sort +79 -0
  178. data/ext/vcftools/perl/vcf-stats +160 -0
  179. data/ext/vcftools/perl/vcf-subset +206 -0
  180. data/ext/vcftools/perl/vcf-to-tab +112 -0
  181. data/ext/vcftools/perl/vcf-validator +145 -0
  182. data/ext/vcftools/website/.svn/all-wcprops +41 -0
  183. data/ext/vcftools/website/.svn/entries +238 -0
  184. data/ext/vcftools/website/.svn/prop-base/VCF-poster.pdf.svn-base +5 -0
  185. data/ext/vcftools/website/.svn/prop-base/favicon.ico.svn-base +5 -0
  186. data/ext/vcftools/website/.svn/prop-base/favicon.png.svn-base +5 -0
  187. data/ext/vcftools/website/.svn/text-base/Makefile.svn-base +6 -0
  188. data/ext/vcftools/website/.svn/text-base/README.svn-base +2 -0
  189. data/ext/vcftools/website/.svn/text-base/VCF-poster.pdf.svn-base +0 -0
  190. data/ext/vcftools/website/.svn/text-base/default.css.svn-base +250 -0
  191. data/ext/vcftools/website/.svn/text-base/favicon.ico.svn-base +0 -0
  192. data/ext/vcftools/website/.svn/text-base/favicon.png.svn-base +0 -0
  193. data/ext/vcftools/website/Makefile +6 -0
  194. data/ext/vcftools/website/README +2 -0
  195. data/ext/vcftools/website/VCF-poster.pdf +0 -0
  196. data/ext/vcftools/website/default.css +250 -0
  197. data/ext/vcftools/website/favicon.ico +0 -0
  198. data/ext/vcftools/website/favicon.png +0 -0
  199. data/ext/vcftools/website/img/.svn/all-wcprops +53 -0
  200. data/ext/vcftools/website/img/.svn/entries +300 -0
  201. data/ext/vcftools/website/img/.svn/prop-base/bg.gif.svn-base +5 -0
  202. data/ext/vcftools/website/img/.svn/prop-base/bgcode.gif.svn-base +5 -0
  203. data/ext/vcftools/website/img/.svn/prop-base/bgcontainer.gif.svn-base +5 -0
  204. data/ext/vcftools/website/img/.svn/prop-base/bgul.gif.svn-base +5 -0
  205. data/ext/vcftools/website/img/.svn/prop-base/header.gif.svn-base +5 -0
  206. data/ext/vcftools/website/img/.svn/prop-base/li.gif.svn-base +5 -0
  207. data/ext/vcftools/website/img/.svn/prop-base/quote.gif.svn-base +5 -0
  208. data/ext/vcftools/website/img/.svn/prop-base/search.gif.svn-base +5 -0
  209. data/ext/vcftools/website/img/.svn/text-base/bg.gif.svn-base +0 -0
  210. data/ext/vcftools/website/img/.svn/text-base/bgcode.gif.svn-base +0 -0
  211. data/ext/vcftools/website/img/.svn/text-base/bgcontainer.gif.svn-base +0 -0
  212. data/ext/vcftools/website/img/.svn/text-base/bgul.gif.svn-base +0 -0
  213. data/ext/vcftools/website/img/.svn/text-base/header.gif.svn-base +0 -0
  214. data/ext/vcftools/website/img/.svn/text-base/li.gif.svn-base +0 -0
  215. data/ext/vcftools/website/img/.svn/text-base/quote.gif.svn-base +0 -0
  216. data/ext/vcftools/website/img/.svn/text-base/search.gif.svn-base +0 -0
  217. data/ext/vcftools/website/img/bg.gif +0 -0
  218. data/ext/vcftools/website/img/bgcode.gif +0 -0
  219. data/ext/vcftools/website/img/bgcontainer.gif +0 -0
  220. data/ext/vcftools/website/img/bgul.gif +0 -0
  221. data/ext/vcftools/website/img/header.gif +0 -0
  222. data/ext/vcftools/website/img/li.gif +0 -0
  223. data/ext/vcftools/website/img/quote.gif +0 -0
  224. data/ext/vcftools/website/img/search.gif +0 -0
  225. data/ext/vcftools/website/src/.svn/all-wcprops +53 -0
  226. data/ext/vcftools/website/src/.svn/entries +300 -0
  227. data/ext/vcftools/website/src/.svn/text-base/docs.inc.svn-base +202 -0
  228. data/ext/vcftools/website/src/.svn/text-base/index.inc.svn-base +52 -0
  229. data/ext/vcftools/website/src/.svn/text-base/index.php.svn-base +80 -0
  230. data/ext/vcftools/website/src/.svn/text-base/license.inc.svn-base +27 -0
  231. data/ext/vcftools/website/src/.svn/text-base/links.inc.svn-base +13 -0
  232. data/ext/vcftools/website/src/.svn/text-base/options.inc.svn-base +654 -0
  233. data/ext/vcftools/website/src/.svn/text-base/perl_module.inc.svn-base +249 -0
  234. data/ext/vcftools/website/src/.svn/text-base/specs.inc.svn-base +18 -0
  235. data/ext/vcftools/website/src/docs.inc +202 -0
  236. data/ext/vcftools/website/src/index.inc +52 -0
  237. data/ext/vcftools/website/src/index.php +80 -0
  238. data/ext/vcftools/website/src/license.inc +27 -0
  239. data/ext/vcftools/website/src/links.inc +13 -0
  240. data/ext/vcftools/website/src/options.inc +654 -0
  241. data/ext/vcftools/website/src/perl_module.inc +249 -0
  242. data/ext/vcftools/website/src/specs.inc +18 -0
  243. data/lib/config.ru +9 -0
  244. data/lib/ngs_server/add.rb +9 -0
  245. data/lib/ngs_server/version.rb +1 -1
  246. data/lib/ngs_server.rb +55 -3
  247. data/ngs_server.gemspec +5 -2
  248. 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_ */