ruby-dcl 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (319) hide show
  1. data/ChangeLog +321 -0
  2. data/GenWrapper/Makefile +14 -0
  3. data/GenWrapper/cproto2init.rb +41 -0
  4. data/GenWrapper/dcl_narrayed_funcs.rb +181 -0
  5. data/GenWrapper/dcl_rb_footing +29 -0
  6. data/GenWrapper/dcl_rb_heading +129 -0
  7. data/GenWrapper/def.rb +20 -0
  8. data/GenWrapper/elim_ary_size.rb +398 -0
  9. data/GenWrapper/etc/Mk_proto +375 -0
  10. data/GenWrapper/etc/dcl_gen +13 -0
  11. data/GenWrapper/etc/p_header +63 -0
  12. data/GenWrapper/etc/p_init +410 -0
  13. data/GenWrapper/pparse.rb +137 -0
  14. data/GenWrapper/proto/Makefile +35 -0
  15. data/GenWrapper/proto/grph1_00 +17 -0
  16. data/GenWrapper/proto/grph1_csgi.fp +27 -0
  17. data/GenWrapper/proto/grph1_scpack.fp +442 -0
  18. data/GenWrapper/proto/grph1_sgpack.fp +1406 -0
  19. data/GenWrapper/proto/grph1_slpack.fp +316 -0
  20. data/GenWrapper/proto/grph1_stpack.fp +411 -0
  21. data/GenWrapper/proto/grph1_swpack.fp +746 -0
  22. data/GenWrapper/proto/grph2_00 +16 -0
  23. data/GenWrapper/proto/grph2_grpack.fp +139 -0
  24. data/GenWrapper/proto/grph2_ucpack.fp +522 -0
  25. data/GenWrapper/proto/grph2_udpack.fp +692 -0
  26. data/GenWrapper/proto/grph2_uepack.fp +601 -0
  27. data/GenWrapper/proto/grph2_ugpack.fp +436 -0
  28. data/GenWrapper/proto/grph2_uhpack.fp +246 -0
  29. data/GenWrapper/proto/grph2_ulpack.fp +516 -0
  30. data/GenWrapper/proto/grph2_umpack.fp +676 -0
  31. data/GenWrapper/proto/grph2_uspack.fp +989 -0
  32. data/GenWrapper/proto/grph2_uupack.fp +663 -0
  33. data/GenWrapper/proto/grph2_uvpack.fp +246 -0
  34. data/GenWrapper/proto/grph2_uwpack.fp +203 -0
  35. data/GenWrapper/proto/grph2_uxpack.fp +295 -0
  36. data/GenWrapper/proto/grph2_uypack.fp +295 -0
  37. data/GenWrapper/proto/grph2_uzpack.fp +574 -0
  38. data/GenWrapper/proto/math1_00 +12 -0
  39. data/GenWrapper/proto/math1_blklib.fp +58 -0
  40. data/GenWrapper/proto/math1_chrlib.fp +83 -0
  41. data/GenWrapper/proto/math1_fnclib.fp +79 -0
  42. data/GenWrapper/proto/math1_gnmlib.fp +118 -0
  43. data/GenWrapper/proto/math1_gt2dlib.fp +144 -0
  44. data/GenWrapper/proto/math1_ifalib.fp +123 -0
  45. data/GenWrapper/proto/math1_indxlib.fp +222 -0
  46. data/GenWrapper/proto/math1_intlib.fp +46 -0
  47. data/GenWrapper/proto/math1_lrllib.fp +276 -0
  48. data/GenWrapper/proto/math1_maplib.fp +24 -0
  49. data/GenWrapper/proto/math1_oslib.fp +28 -0
  50. data/GenWrapper/proto/math1_rfalib.fp +420 -0
  51. data/GenWrapper/proto/math1_rfblib.fp +51 -0
  52. data/GenWrapper/proto/math1_sublib.fp +60 -0
  53. data/GenWrapper/proto/math1_syslib.fp +767 -0
  54. data/GenWrapper/proto/math1_vialib.fp +339 -0
  55. data/GenWrapper/proto/math1_viblib.fp +264 -0
  56. data/GenWrapper/proto/math1_vralib.fp +339 -0
  57. data/GenWrapper/proto/math1_vrblib.fp +264 -0
  58. data/GenWrapper/proto/math1_xfclib.fp +68 -0
  59. data/GenWrapper/proto/math2_00 +12 -0
  60. data/GenWrapper/proto/math2_fftlib.fp +803 -0
  61. data/GenWrapper/proto/math2_intrlib.fp +32 -0
  62. data/GenWrapper/proto/math2_odelib.fp_notused +568 -0
  63. data/GenWrapper/proto/math2_rnmlib.fp +54 -0
  64. data/GenWrapper/proto/math2_shtlib.fp +1292 -0
  65. data/GenWrapper/proto/math2_shtlib.fp_old +1294 -0
  66. data/GenWrapper/proto/math2_vstlib.fp +84 -0
  67. data/GenWrapper/proto/misc1_00 +17 -0
  68. data/GenWrapper/proto/misc1_chnlib.fp +47 -0
  69. data/GenWrapper/proto/misc1_datelib.fp +352 -0
  70. data/GenWrapper/proto/misc1_fmtlib.fp +19 -0
  71. data/GenWrapper/proto/misc1_misclib.fp +26 -0
  72. data/GenWrapper/proto/misc1_randlib.fp +36 -0
  73. data/GenWrapper/proto/misc1_timelib.fp +151 -0
  74. data/GenWrapper/proto2c.rb +13 -0
  75. data/GenWrapper/prototype.rb +209 -0
  76. data/GenWrapper/util.rb +9 -0
  77. data/GenWrapper/variable.rb +671 -0
  78. data/README +29 -0
  79. data/Rakefile +44 -0
  80. data/ToDo +2 -0
  81. data/dcl_cary2obj.c +354 -0
  82. data/dcl_narrayed_funcs.c +518 -0
  83. data/dcl_obj2cary.c +512 -0
  84. data/dcl_rubydcloriginal.c +129 -0
  85. data/demo/gokuraku/hop/hop.rb +26 -0
  86. data/demo/gokuraku/jump/jump1.rb +64 -0
  87. data/demo/gokuraku/jump/jump2.rb +50 -0
  88. data/demo/gokuraku/layout/lay1.rb +46 -0
  89. data/demo/gokuraku/layout/lay2.rb +44 -0
  90. data/demo/gokuraku/step/step0.rb +34 -0
  91. data/demo/gokuraku/step/step1.rb +84 -0
  92. data/demo/gokuraku/step/step2.rb +62 -0
  93. data/demo/gokuraku/u1d/u1d1.rb +37 -0
  94. data/demo/gokuraku/u1d/u1d2.rb +50 -0
  95. data/demo/gokuraku/u2d/u2d1.rb +46 -0
  96. data/demo/gokuraku/u2d/u2d2.rb +49 -0
  97. data/demo/gokuraku/u2d/u2d3.rb +45 -0
  98. data/demo/gokuraku/u2d/u2d4.rb +61 -0
  99. data/demo/grph1/scpack/scpkt2.rb +40 -0
  100. data/demo/grph1/scpack/scpkt3.rb +102 -0
  101. data/demo/grph1/scpack/scpkt6.rb +84 -0
  102. data/demo/grph1/scpack/scpkt7.rb +59 -0
  103. data/demo/grph1/scpack/scpkt8.rb +60 -0
  104. data/demo/grph1/scpack/t810630.dat +296 -0
  105. data/demo/grph1/scpack/t811231.dat +296 -0
  106. data/demo/grph1/sgpack/sgfont.rb +52 -0
  107. data/demo/grph1/sgpack/sgfonz.rb +53 -0
  108. data/demo/grph1/sgpack/sgksx1.rb +44 -0
  109. data/demo/grph1/sgpack/sgksx2.rb +90 -0
  110. data/demo/grph1/sgpack/sgksx3.rb +75 -0
  111. data/demo/grph1/sgpack/sglidx.rb +40 -0
  112. data/demo/grph1/sgpack/sgltyp.rb +48 -0
  113. data/demo/grph1/sgpack/sgpk01.rb +39 -0
  114. data/demo/grph1/sgpack/sgpk02.rb +79 -0
  115. data/demo/grph1/sgpack/sgpk03.rb +107 -0
  116. data/demo/grph1/sgpack/sgpk04.rb +86 -0
  117. data/demo/grph1/sgpack/sgpk05.rb +66 -0
  118. data/demo/grph1/sgpack/sgpk06.rb +91 -0
  119. data/demo/grph1/sgpack/sgpk07.rb +66 -0
  120. data/demo/grph1/sgpack/sgpk08.rb +67 -0
  121. data/demo/grph1/sgpack/sgpk09.rb +61 -0
  122. data/demo/grph1/sgpack/sgpk10.rb +58 -0
  123. data/demo/grph1/sgpack/sgtclr.rb +59 -0
  124. data/demo/grph1/sgpack/sgtone.rb +70 -0
  125. data/demo/grph1/sgpack/sgtonz.rb +66 -0
  126. data/demo/grph1/slpack/slpk01.rb +37 -0
  127. data/demo/grph1/slpack/slpk02.rb +29 -0
  128. data/demo/grph1/slpack/slpk03.rb +36 -0
  129. data/demo/grph1/slpack/slpk04.rb +36 -0
  130. data/demo/grph2/g2pack/g2pk01.rb +78 -0
  131. data/demo/grph2/g2pack/g2pk02.rb +75 -0
  132. data/demo/grph2/grpack/grpk01.rb +65 -0
  133. data/demo/grph2/ucpack/ucpk01.rb +95 -0
  134. data/demo/grph2/ucpack/ucpk02.rb +95 -0
  135. data/demo/grph2/udegpk/u2df01.rb +50 -0
  136. data/demo/grph2/udegpk/u2df02.rb +76 -0
  137. data/demo/grph2/udegpk/u2df03.rb +80 -0
  138. data/demo/grph2/udegpk/u2df04.rb +52 -0
  139. data/demo/grph2/udegpk/u2df05.rb +70 -0
  140. data/demo/grph2/udegpk/u2df06.rb +59 -0
  141. data/demo/grph2/udegpk/u2df07.rb +68 -0
  142. data/demo/grph2/udegpk/u2df08.rb +91 -0
  143. data/demo/grph2/udegpk/u2df09b.rb +88 -0
  144. data/demo/grph2/udegpk/u2df09c.rb +89 -0
  145. data/demo/grph2/udegpk/u2df09e.rb +88 -0
  146. data/demo/grph2/udegpk/u2df09f.rb +89 -0
  147. data/demo/grph2/ulpack/ulpk01.rb +111 -0
  148. data/demo/grph2/ulpack/ulpk01n.rb +111 -0
  149. data/demo/grph2/ulpack/ulpk02.rb +111 -0
  150. data/demo/grph2/ulpack/ulpk02n.rb +111 -0
  151. data/demo/grph2/umpack/t811231.dat +296 -0
  152. data/demo/grph2/umpack/test01.rb +69 -0
  153. data/demo/grph2/umpack/test02.rb +64 -0
  154. data/demo/grph2/umpack/test03.rb +84 -0
  155. data/demo/grph2/umpack/test04.rb +54 -0
  156. data/demo/grph2/umpack/test05.rb +85 -0
  157. data/demo/grph2/umpack/test06.rb +44 -0
  158. data/demo/grph2/umpack/test07.rb +43 -0
  159. data/demo/grph2/umpack/test08.rb +37 -0
  160. data/demo/grph2/umpack/test09.rb +86 -0
  161. data/demo/grph2/umpack/test10.rb +52 -0
  162. data/demo/grph2/umpack/umpk01.rb +65 -0
  163. data/demo/grph2/umpack/umpk02.rb +54 -0
  164. data/demo/grph2/umpack/umpk03.rb +46 -0
  165. data/demo/grph2/umpack/umpk04.rb +65 -0
  166. data/demo/grph2/umpack/umpk05.rb +84 -0
  167. data/demo/grph2/uspack/uspk01.rb +39 -0
  168. data/demo/grph2/uspack/uspk02.rb +47 -0
  169. data/demo/grph2/uspack/uspk03.rb +38 -0
  170. data/demo/grph2/uspack/uspk04.rb +64 -0
  171. data/demo/grph2/uspack/uspk05.rb +68 -0
  172. data/demo/grph2/uspack/uspk06.rb +43 -0
  173. data/demo/grph2/uspack/uspk07.rb +62 -0
  174. data/demo/grph2/uspack/uspk08.rb +46 -0
  175. data/demo/grph2/uspack/uspk09.rb +89 -0
  176. data/demo/grph2/uspack/uspk10.rb +48 -0
  177. data/demo/grph2/uspack/uspk11.rb +71 -0
  178. data/demo/grph2/uspack/uspk12.rb +51 -0
  179. data/demo/grph2/uupack/uupk01.rb +50 -0
  180. data/demo/grph2/uupack/uupk02.rb +74 -0
  181. data/demo/grph2/uupack/uupk03.rb +56 -0
  182. data/demo/grph2/uupack/uupk04.rb +84 -0
  183. data/demo/grph2/uupack/uupk05.rb +74 -0
  184. data/demo/grph2/uupack/uupk06.rb +77 -0
  185. data/demo/grph2/uupack/uupk07.rb +88 -0
  186. data/demo/grph2/uxyzpk/uxyz01.rb +38 -0
  187. data/demo/grph2/uxyzpk/uxyz02.rb +36 -0
  188. data/demo/grph2/uxyzpk/uxyz03.rb +37 -0
  189. data/demo/grph2/uxyzpk/uxyz04.rb +54 -0
  190. data/demo/grph2/uxyzpk/uxyz05.rb +41 -0
  191. data/demo/grph2/uxyzpk/uxyz06.rb +42 -0
  192. data/demo/grph2/uxyzpk/uxyz07.rb +38 -0
  193. data/demo/grph2/uxyzpk/uxyz08.rb +60 -0
  194. data/demo/grph2/uxyzpk/uxyz09.rb +52 -0
  195. data/demo/grph2/uxyzpk/uxyz10.rb +57 -0
  196. data/demo/grph2/ximage/MEMO +23 -0
  197. data/demo/grph2/ximage/tomsclm.dat +1344 -0
  198. data/demo/grph2/ximage/ximg01.rb +145 -0
  199. data/demo/math1/gt2dlib/gt2d01.rb +33 -0
  200. data/demo/math2/fftlib/fftl01.rb +28 -0
  201. data/demo/math2/fftlib/fftl02.rb +224 -0
  202. data/demo/math2/intrlib/intr01.rb +22 -0
  203. data/demo/math2/rnmlib/rnml01.rb +21 -0
  204. data/demo/math2/vstlib/vstl01.rb +29 -0
  205. data/demo/math2/vstlib/vstl02.rb +38 -0
  206. data/demo/rakuraku/color/color1.rb +61 -0
  207. data/demo/rakuraku/color/color2.rb +57 -0
  208. data/demo/rakuraku/color/color3.rb +81 -0
  209. data/demo/rakuraku/kihon/kihon1.rb +39 -0
  210. data/demo/rakuraku/kihon/kihon2.rb +56 -0
  211. data/demo/rakuraku/kihon/kihon3.rb +57 -0
  212. data/demo/rakuraku/kihon/kihon4.rb +70 -0
  213. data/demo/rakuraku/kihon/kihon5.rb +56 -0
  214. data/demo/rakuraku/kihon/kihon6.rb +40 -0
  215. data/demo/rakuraku/kihon/kihon7.rb +98 -0
  216. data/demo/rakuraku/kihon/kihon8.rb +93 -0
  217. data/demo/rakuraku/kihon/kihon9.rb +77 -0
  218. data/demo/rakuraku/kihon/kihona.rb +123 -0
  219. data/demo/rakuraku/kihon/kihonb.rb +73 -0
  220. data/demo/rakuraku/kihon/kihonc.rb +110 -0
  221. data/demo/rakuraku/layout/lay1.rb +29 -0
  222. data/demo/rakuraku/layout/lay2.rb +28 -0
  223. data/demo/rakuraku/layout/lay3.rb +29 -0
  224. data/demo/rakuraku/map3d/map3d1.rb +68 -0
  225. data/demo/rakuraku/map3d/map3d2.rb +67 -0
  226. data/demo/rakuraku/map3d/map3d3.rb +66 -0
  227. data/demo/rakuraku/map3d/map3d4.rb +107 -0
  228. data/demo/rakuraku/map3d/map3d5.rb +118 -0
  229. data/demo/rakuraku/map3d/map3d6.rb +96 -0
  230. data/demo/rakuraku/map3d/map3d7.rb +98 -0
  231. data/demo/rakuraku/miss/miss1.rb +76 -0
  232. data/demo/rakuraku/miss/miss2.rb +60 -0
  233. data/demo/rakuraku/quick/quick1.rb +35 -0
  234. data/demo/rakuraku/quick/quick2.rb +33 -0
  235. data/demo/rakuraku/quick/quick3.rb +46 -0
  236. data/demo/rakuraku/quick/quick4.rb +47 -0
  237. data/demo/rakuraku/quick/quick5.rb +46 -0
  238. data/demo/rakuraku/u2d/u2d1.rb +50 -0
  239. data/demo/rakuraku/u2d/u2d2.rb +51 -0
  240. data/demo/rakuraku/u2d/u2d3.rb +70 -0
  241. data/demo/rakuraku/u2d/u2d4.rb +59 -0
  242. data/demo/rakuraku/u2d/u2d5.rb +61 -0
  243. data/demo/rakuraku/u2d/u2d6.rb +57 -0
  244. data/demo/rakuraku/u2d/u2d7.rb +103 -0
  245. data/demo/rakuraku/uspack/uspac1.rb +35 -0
  246. data/demo/rakuraku/uspack/uspac2.rb +66 -0
  247. data/demo/rakuraku/uspack/uspac3.rb +37 -0
  248. data/demo/rakuraku/uspack/uspac4.rb +49 -0
  249. data/demo/rakuraku/uxyz/uxyz1.rb +37 -0
  250. data/demo/rakuraku/uxyz/uxyz2.rb +35 -0
  251. data/demo/rakuraku/uxyz/uxyz3.rb +38 -0
  252. data/demo/rakuraku/uxyz/uxyz4.rb +36 -0
  253. data/demo/rakuraku/uxyz/uxyz5.rb +57 -0
  254. data/demo/rakuraku/uxyz/uxyz6.rb +43 -0
  255. data/demo/rakuraku/uxyz/uxyz7.rb +39 -0
  256. data/demo/rakuraku/uxyz/uxyz8.rb +56 -0
  257. data/demo/rubydcloriginal/uemrkz1.rb +37 -0
  258. data/dummy.c +9 -0
  259. data/extconf.rb +133 -0
  260. data/grph1_csgi.c +119 -0
  261. data/grph1_scpack.c +1388 -0
  262. data/grph1_sgpack.c +3876 -0
  263. data/grph1_slpack.c +432 -0
  264. data/grph1_stpack.c +1044 -0
  265. data/grph1_swpack.c +1922 -0
  266. data/grph1_zgpack.c.org +141 -0
  267. data/grph2_grpack.c +368 -0
  268. data/grph2_ucpack.c +1232 -0
  269. data/grph2_udpack.c +1404 -0
  270. data/grph2_uepack.c +1443 -0
  271. data/grph2_ugpack.c +1073 -0
  272. data/grph2_uhpack.c +943 -0
  273. data/grph2_ulpack.c +1304 -0
  274. data/grph2_umpack.c +1540 -0
  275. data/grph2_uspack.c +2481 -0
  276. data/grph2_uupack.c +1689 -0
  277. data/grph2_uvpack.c +943 -0
  278. data/grph2_uwpack.c +552 -0
  279. data/grph2_uxpack.c +555 -0
  280. data/grph2_uypack.c +555 -0
  281. data/grph2_uzpack.c +1455 -0
  282. data/init.c.default +187 -0
  283. data/init.c.gtk +189 -0
  284. data/lib/dcl.rb +5084 -0
  285. data/math1_blklib.c +227 -0
  286. data/math1_chrlib.c +239 -0
  287. data/math1_fnclib.c +254 -0
  288. data/math1_gnmlib.c +356 -0
  289. data/math1_gt2dlib.c +514 -0
  290. data/math1_ifalib.c +427 -0
  291. data/math1_indxlib.c +709 -0
  292. data/math1_intlib.c +167 -0
  293. data/math1_lrllib.c +817 -0
  294. data/math1_maplib.c +172 -0
  295. data/math1_oslib.c +111 -0
  296. data/math1_rfalib.c +1417 -0
  297. data/math1_rfblib.c +232 -0
  298. data/math1_sublib.c +221 -0
  299. data/math1_syslib.c +2025 -0
  300. data/math1_vialib.c +1156 -0
  301. data/math1_viblib.c +1027 -0
  302. data/math1_vralib.c +1156 -0
  303. data/math1_vrblib.c +1027 -0
  304. data/math1_xfclib.c +142 -0
  305. data/math2_fftlib.c +833 -0
  306. data/math2_intrlib.c +138 -0
  307. data/math2_rnmlib.c +226 -0
  308. data/math2_shtlib.c +1568 -0
  309. data/math2_vstlib.c +366 -0
  310. data/misc1_chnlib.c +179 -0
  311. data/misc1_datelib.c +953 -0
  312. data/misc1_fmtlib.c +99 -0
  313. data/misc1_misclib.c +118 -0
  314. data/misc1_randlib.c +142 -0
  315. data/misc1_timelib.c +380 -0
  316. data/obsolete/README +2 -0
  317. data/obsolete/dcl_ext.html +112 -0
  318. data/obsolete/dcl_ext.rb +313 -0
  319. metadata +433 -0
data/math2_intrlib.c ADDED
@@ -0,0 +1,138 @@
1
+ /*
2
+ * $Id: p_header,v 1.2 2011-02-23 17:47:10 koshiro Exp $
3
+ */
4
+
5
+ #include <stdio.h>
6
+ #include "ruby.h"
7
+ #include "libtinyf2c.h"
8
+ #include "narray.h"
9
+
10
+ /* for compatibility with ruby 1.6 */
11
+ #ifndef StringValuePtr
12
+ #define StringValuePtr(s) STR2CSTR(s)
13
+ #endif
14
+
15
+ #define DFLT_SIZE 32
16
+
17
+ extern char *dcl_obj2ccharary(VALUE, int, int);
18
+ extern integer *dcl_obj2cintegerary(VALUE);
19
+ extern real *dcl_obj2crealary(VALUE);
20
+ extern complex *dcl_obj2ccomplexary(VALUE);
21
+ extern logical *dcl_obj2clogicalary(VALUE);
22
+
23
+ extern VALUE dcl_ccharary2obj(char *, int, int);
24
+ extern VALUE dcl_cintegerary2obj(integer *, int, int, int *);
25
+ extern VALUE dcl_crealary2obj(real *, int, int, int *);
26
+ extern VALUE dcl_ccomplexary2obj(complex *, int, char *);
27
+ extern VALUE dcl_clogicalary2obj(logical *, int, int, int *);
28
+
29
+ extern void dcl_freeccharary(char *);
30
+ extern void dcl_freecintegerary(integer *);
31
+ extern void dcl_freecrealary(real *);
32
+ extern void dcl_freeccomplexary(complex *);
33
+ extern void dcl_freeclogicalary(logical *);
34
+
35
+ /* for functions which return real */
36
+ /* fnclib */
37
+ extern real rd2r_(real *);
38
+ extern real rr2d_(real *);
39
+ extern real rexp_(real *, integer *, integer *);
40
+ extern real rfpi_(void);
41
+ extern real rmod_(real *, real *);
42
+ /* gnmlib */
43
+ extern real rgnlt_(real *);
44
+ extern real rgnle_(real *);
45
+ extern real rgngt_(real *);
46
+ extern real rgnge_(real *);
47
+ /* rfalib */
48
+ extern real rmax_(real *, integer *, integer *);
49
+ extern real rmin_(real *, integer *, integer *);
50
+ extern real rsum_(real *, integer *, integer *);
51
+ extern real rave_(real *, integer *, integer *);
52
+ extern real rvar_(real *, integer *, integer *);
53
+ extern real rstd_(real *, integer *, integer *);
54
+ extern real rrms_(real *, integer *, integer *);
55
+ extern real ramp_(real *, integer *, integer *);
56
+ /* rfblib */
57
+ extern real rprd_(real *, real *, integer *, integer *, integer *);
58
+ extern real rcov_(real *, real *, integer *, integer *, integer *);
59
+ extern real rcor_(real *, real *, integer *, integer *, integer *);
60
+
61
+
62
+ extern VALUE mDCL;
63
+
64
+ static VALUE
65
+ dcl_vrintr(obj, rx, n, jx)
66
+ VALUE obj, rx, n, jx;
67
+ {
68
+ real *io_rx;
69
+ integer i_n;
70
+ integer i_jx;
71
+
72
+ if (TYPE(rx) == T_FLOAT) {
73
+ rx = rb_Array(rx);
74
+ }
75
+ /* if ((TYPE(rx) != T_ARRAY) &&
76
+ (rb_obj_is_kind_of(rx, cNArray) != Qtrue)) {
77
+ rb_raise(rb_eTypeError, "invalid type");
78
+ } -- no check since obj2c*ary will do that */
79
+ if ((TYPE(n) != T_BIGNUM) || (TYPE(n) != T_FIXNUM)) {
80
+ n = rb_funcall(n, rb_intern("to_i"), 0);
81
+ }
82
+ if ((TYPE(jx) != T_BIGNUM) || (TYPE(jx) != T_FIXNUM)) {
83
+ jx = rb_funcall(jx, rb_intern("to_i"), 0);
84
+ }
85
+
86
+ i_n = NUM2INT(n);
87
+ i_jx = NUM2INT(jx);
88
+ io_rx = dcl_obj2crealary(rx);
89
+
90
+
91
+ vrintr_(io_rx, &i_n, &i_jx);
92
+
93
+ {int array_shape[1] = {i_jx*(i_n-1)+1};
94
+ rx = dcl_crealary2obj(io_rx, i_jx*(i_n-1)+1, 1, array_shape);
95
+ }
96
+
97
+ dcl_freecrealary(io_rx);
98
+
99
+ return rx;
100
+
101
+ }
102
+
103
+ static VALUE
104
+ dcl_vcintr(obj, cx, n, jx)
105
+ VALUE obj, cx, n, jx;
106
+ {
107
+ complex *io_cx;
108
+ integer i_n;
109
+ integer i_jx;
110
+
111
+ /* checktype: not implemented for cx (ComplexInputOutputArrayVariable) */
112
+ if ((TYPE(n) != T_BIGNUM) || (TYPE(n) != T_FIXNUM)) {
113
+ n = rb_funcall(n, rb_intern("to_i"), 0);
114
+ }
115
+ if ((TYPE(jx) != T_BIGNUM) || (TYPE(jx) != T_FIXNUM)) {
116
+ jx = rb_funcall(jx, rb_intern("to_i"), 0);
117
+ }
118
+
119
+ i_n = NUM2INT(n);
120
+ i_jx = NUM2INT(jx);
121
+ /* initialization: not implemented for cx (ComplexInputOutputArrayVariable) */
122
+
123
+
124
+ vcintr_(io_cx, &i_n, &i_jx);
125
+
126
+ /* getresult: not implemented for cx (ComplexInputOutputArrayVariable) */
127
+
128
+
129
+ return cx;
130
+
131
+ }
132
+ void
133
+ init_math2_intrlib(mDCL)
134
+ VALUE mDCL;
135
+ {
136
+ rb_define_module_function(mDCL, "vrintr", dcl_vrintr, 3);
137
+ rb_define_module_function(mDCL, "vcintr", dcl_vcintr, 3);
138
+ }
data/math2_rnmlib.c ADDED
@@ -0,0 +1,226 @@
1
+ /*
2
+ * $Id: p_header,v 1.2 2011-02-23 17:47:10 koshiro Exp $
3
+ */
4
+
5
+ #include <stdio.h>
6
+ #include "ruby.h"
7
+ #include "libtinyf2c.h"
8
+ #include "narray.h"
9
+
10
+ /* for compatibility with ruby 1.6 */
11
+ #ifndef StringValuePtr
12
+ #define StringValuePtr(s) STR2CSTR(s)
13
+ #endif
14
+
15
+ #define DFLT_SIZE 32
16
+
17
+ extern char *dcl_obj2ccharary(VALUE, int, int);
18
+ extern integer *dcl_obj2cintegerary(VALUE);
19
+ extern real *dcl_obj2crealary(VALUE);
20
+ extern complex *dcl_obj2ccomplexary(VALUE);
21
+ extern logical *dcl_obj2clogicalary(VALUE);
22
+
23
+ extern VALUE dcl_ccharary2obj(char *, int, int);
24
+ extern VALUE dcl_cintegerary2obj(integer *, int, int, int *);
25
+ extern VALUE dcl_crealary2obj(real *, int, int, int *);
26
+ extern VALUE dcl_ccomplexary2obj(complex *, int, char *);
27
+ extern VALUE dcl_clogicalary2obj(logical *, int, int, int *);
28
+
29
+ extern void dcl_freeccharary(char *);
30
+ extern void dcl_freecintegerary(integer *);
31
+ extern void dcl_freecrealary(real *);
32
+ extern void dcl_freeccomplexary(complex *);
33
+ extern void dcl_freeclogicalary(logical *);
34
+
35
+ /* for functions which return real */
36
+ /* fnclib */
37
+ extern real rd2r_(real *);
38
+ extern real rr2d_(real *);
39
+ extern real rexp_(real *, integer *, integer *);
40
+ extern real rfpi_(void);
41
+ extern real rmod_(real *, real *);
42
+ /* gnmlib */
43
+ extern real rgnlt_(real *);
44
+ extern real rgnle_(real *);
45
+ extern real rgngt_(real *);
46
+ extern real rgnge_(real *);
47
+ /* rfalib */
48
+ extern real rmax_(real *, integer *, integer *);
49
+ extern real rmin_(real *, integer *, integer *);
50
+ extern real rsum_(real *, integer *, integer *);
51
+ extern real rave_(real *, integer *, integer *);
52
+ extern real rvar_(real *, integer *, integer *);
53
+ extern real rstd_(real *, integer *, integer *);
54
+ extern real rrms_(real *, integer *, integer *);
55
+ extern real ramp_(real *, integer *, integer *);
56
+ /* rfblib */
57
+ extern real rprd_(real *, real *, integer *, integer *, integer *);
58
+ extern real rcov_(real *, real *, integer *, integer *, integer *);
59
+ extern real rcor_(real *, real *, integer *, integer *, integer *);
60
+
61
+
62
+ extern VALUE mDCL;
63
+
64
+ static VALUE
65
+ dcl_vrrnm(obj, rx, n, jx, jy, nb)
66
+ VALUE obj, rx, n, jx, jy, nb;
67
+ {
68
+ real *i_rx;
69
+ real *o_ry;
70
+ integer i_n;
71
+ integer i_jx;
72
+ integer i_jy;
73
+ integer i_nb;
74
+ VALUE ry;
75
+
76
+ if (TYPE(rx) == T_FLOAT) {
77
+ rx = rb_Array(rx);
78
+ }
79
+ /* if ((TYPE(rx) != T_ARRAY) &&
80
+ (rb_obj_is_kind_of(rx, cNArray) != Qtrue)) {
81
+ rb_raise(rb_eTypeError, "invalid type");
82
+ } -- no check since obj2c*ary will do that */
83
+ if ((TYPE(n) != T_BIGNUM) || (TYPE(n) != T_FIXNUM)) {
84
+ n = rb_funcall(n, rb_intern("to_i"), 0);
85
+ }
86
+ if ((TYPE(jx) != T_BIGNUM) || (TYPE(jx) != T_FIXNUM)) {
87
+ jx = rb_funcall(jx, rb_intern("to_i"), 0);
88
+ }
89
+ if ((TYPE(jy) != T_BIGNUM) || (TYPE(jy) != T_FIXNUM)) {
90
+ jy = rb_funcall(jy, rb_intern("to_i"), 0);
91
+ }
92
+ if ((TYPE(nb) != T_BIGNUM) || (TYPE(nb) != T_FIXNUM)) {
93
+ nb = rb_funcall(nb, rb_intern("to_i"), 0);
94
+ }
95
+
96
+ i_n = NUM2INT(n);
97
+ i_jx = NUM2INT(jx);
98
+ i_jy = NUM2INT(jy);
99
+ i_nb = NUM2INT(nb);
100
+ i_rx = dcl_obj2crealary(rx);
101
+
102
+ o_ry= ALLOCA_N(real, i_jy*(i_n-1)+1);
103
+
104
+ vrrnm_(i_rx, o_ry, &i_n, &i_jx, &i_jy, &i_nb);
105
+
106
+ {int array_shape[1] = {i_jy*(i_n-1)+1};
107
+ ry = dcl_crealary2obj(o_ry, i_jy*(i_n-1)+1, 1, array_shape);
108
+ }
109
+
110
+ dcl_freecrealary(i_rx);
111
+
112
+ return ry;
113
+
114
+ }
115
+
116
+ static VALUE
117
+ dcl_vrrnm0(obj, rx, n, jx, jy, nb)
118
+ VALUE obj, rx, n, jx, jy, nb;
119
+ {
120
+ real *i_rx;
121
+ real *o_ry;
122
+ integer i_n;
123
+ integer i_jx;
124
+ integer i_jy;
125
+ integer i_nb;
126
+ VALUE ry;
127
+
128
+ if (TYPE(rx) == T_FLOAT) {
129
+ rx = rb_Array(rx);
130
+ }
131
+ /* if ((TYPE(rx) != T_ARRAY) &&
132
+ (rb_obj_is_kind_of(rx, cNArray) != Qtrue)) {
133
+ rb_raise(rb_eTypeError, "invalid type");
134
+ } -- no check since obj2c*ary will do that */
135
+ if ((TYPE(n) != T_BIGNUM) || (TYPE(n) != T_FIXNUM)) {
136
+ n = rb_funcall(n, rb_intern("to_i"), 0);
137
+ }
138
+ if ((TYPE(jx) != T_BIGNUM) || (TYPE(jx) != T_FIXNUM)) {
139
+ jx = rb_funcall(jx, rb_intern("to_i"), 0);
140
+ }
141
+ if ((TYPE(jy) != T_BIGNUM) || (TYPE(jy) != T_FIXNUM)) {
142
+ jy = rb_funcall(jy, rb_intern("to_i"), 0);
143
+ }
144
+ if ((TYPE(nb) != T_BIGNUM) || (TYPE(nb) != T_FIXNUM)) {
145
+ nb = rb_funcall(nb, rb_intern("to_i"), 0);
146
+ }
147
+
148
+ i_n = NUM2INT(n);
149
+ i_jx = NUM2INT(jx);
150
+ i_jy = NUM2INT(jy);
151
+ i_nb = NUM2INT(nb);
152
+ i_rx = dcl_obj2crealary(rx);
153
+
154
+ o_ry= ALLOCA_N(real, i_jy*(i_n-1)+1);
155
+
156
+ vrrnm0_(i_rx, o_ry, &i_n, &i_jx, &i_jy, &i_nb);
157
+
158
+ {int array_shape[1] = {i_jy*(i_n-1)+1};
159
+ ry = dcl_crealary2obj(o_ry, i_jy*(i_n-1)+1, 1, array_shape);
160
+ }
161
+
162
+ dcl_freecrealary(i_rx);
163
+
164
+ return ry;
165
+
166
+ }
167
+
168
+ static VALUE
169
+ dcl_vrrnm1(obj, rx, n, jx, jy, nb)
170
+ VALUE obj, rx, n, jx, jy, nb;
171
+ {
172
+ real *i_rx;
173
+ real *o_ry;
174
+ integer i_n;
175
+ integer i_jx;
176
+ integer i_jy;
177
+ integer i_nb;
178
+ VALUE ry;
179
+
180
+ if (TYPE(rx) == T_FLOAT) {
181
+ rx = rb_Array(rx);
182
+ }
183
+ /* if ((TYPE(rx) != T_ARRAY) &&
184
+ (rb_obj_is_kind_of(rx, cNArray) != Qtrue)) {
185
+ rb_raise(rb_eTypeError, "invalid type");
186
+ } -- no check since obj2c*ary will do that */
187
+ if ((TYPE(n) != T_BIGNUM) || (TYPE(n) != T_FIXNUM)) {
188
+ n = rb_funcall(n, rb_intern("to_i"), 0);
189
+ }
190
+ if ((TYPE(jx) != T_BIGNUM) || (TYPE(jx) != T_FIXNUM)) {
191
+ jx = rb_funcall(jx, rb_intern("to_i"), 0);
192
+ }
193
+ if ((TYPE(jy) != T_BIGNUM) || (TYPE(jy) != T_FIXNUM)) {
194
+ jy = rb_funcall(jy, rb_intern("to_i"), 0);
195
+ }
196
+ if ((TYPE(nb) != T_BIGNUM) || (TYPE(nb) != T_FIXNUM)) {
197
+ nb = rb_funcall(nb, rb_intern("to_i"), 0);
198
+ }
199
+
200
+ i_n = NUM2INT(n);
201
+ i_jx = NUM2INT(jx);
202
+ i_jy = NUM2INT(jy);
203
+ i_nb = NUM2INT(nb);
204
+ i_rx = dcl_obj2crealary(rx);
205
+
206
+ o_ry= ALLOCA_N(real, i_jx*(i_n-1)+1);
207
+
208
+ vrrnm1_(i_rx, o_ry, &i_n, &i_jx, &i_jy, &i_nb);
209
+
210
+ {int array_shape[1] = {i_jx*(i_n-1)+1};
211
+ ry = dcl_crealary2obj(o_ry, i_jx*(i_n-1)+1, 1, array_shape);
212
+ }
213
+
214
+ dcl_freecrealary(i_rx);
215
+
216
+ return ry;
217
+
218
+ }
219
+ void
220
+ init_math2_rnmlib(mDCL)
221
+ VALUE mDCL;
222
+ {
223
+ rb_define_module_function(mDCL, "vrrnm", dcl_vrrnm, 5);
224
+ rb_define_module_function(mDCL, "vrrnm0", dcl_vrrnm0, 5);
225
+ rb_define_module_function(mDCL, "vrrnm1", dcl_vrrnm1, 5);
226
+ }
data/math2_shtlib.c ADDED
@@ -0,0 +1,1568 @@
1
+ /*
2
+ * $Id: p_header,v 1.2 2011-02-23 17:47:10 koshiro Exp $
3
+ */
4
+
5
+ #include <stdio.h>
6
+ #include "ruby.h"
7
+ #include "libtinyf2c.h"
8
+ #include "narray.h"
9
+
10
+ /* for compatibility with ruby 1.6 */
11
+ #ifndef StringValuePtr
12
+ #define StringValuePtr(s) STR2CSTR(s)
13
+ #endif
14
+
15
+ #define DFLT_SIZE 32
16
+
17
+ extern char *dcl_obj2ccharary(VALUE, int, int);
18
+ extern integer *dcl_obj2cintegerary(VALUE);
19
+ extern real *dcl_obj2crealary(VALUE);
20
+ extern complex *dcl_obj2ccomplexary(VALUE);
21
+ extern logical *dcl_obj2clogicalary(VALUE);
22
+
23
+ extern VALUE dcl_ccharary2obj(char *, int, int);
24
+ extern VALUE dcl_cintegerary2obj(integer *, int, int, int *);
25
+ extern VALUE dcl_crealary2obj(real *, int, int, int *);
26
+ extern VALUE dcl_ccomplexary2obj(complex *, int, char *);
27
+ extern VALUE dcl_clogicalary2obj(logical *, int, int, int *);
28
+
29
+ extern void dcl_freeccharary(char *);
30
+ extern void dcl_freecintegerary(integer *);
31
+ extern void dcl_freecrealary(real *);
32
+ extern void dcl_freeccomplexary(complex *);
33
+ extern void dcl_freeclogicalary(logical *);
34
+
35
+ /* for functions which return real */
36
+ /* fnclib */
37
+ extern real rd2r_(real *);
38
+ extern real rr2d_(real *);
39
+ extern real rexp_(real *, integer *, integer *);
40
+ extern real rfpi_(void);
41
+ extern real rmod_(real *, real *);
42
+ /* gnmlib */
43
+ extern real rgnlt_(real *);
44
+ extern real rgnle_(real *);
45
+ extern real rgngt_(real *);
46
+ extern real rgnge_(real *);
47
+ /* rfalib */
48
+ extern real rmax_(real *, integer *, integer *);
49
+ extern real rmin_(real *, integer *, integer *);
50
+ extern real rsum_(real *, integer *, integer *);
51
+ extern real rave_(real *, integer *, integer *);
52
+ extern real rvar_(real *, integer *, integer *);
53
+ extern real rstd_(real *, integer *, integer *);
54
+ extern real rrms_(real *, integer *, integer *);
55
+ extern real ramp_(real *, integer *, integer *);
56
+ /* rfblib */
57
+ extern real rprd_(real *, real *, integer *, integer *, integer *);
58
+ extern real rcov_(real *, real *, integer *, integer *, integer *);
59
+ extern real rcor_(real *, real *, integer *, integer *, integer *);
60
+
61
+
62
+ extern VALUE mDCL;
63
+
64
+ static VALUE
65
+ dcl_shtlib(obj)
66
+ VALUE obj;
67
+ {
68
+ shtlib_();
69
+
70
+ return Qnil;
71
+
72
+ }
73
+
74
+ static VALUE
75
+ dcl_shtint(obj, mm, jm, im)
76
+ VALUE obj, mm, jm, im;
77
+ {
78
+ integer i_mm;
79
+ integer i_jm;
80
+ integer i_im;
81
+ real *o_work;
82
+ VALUE work;
83
+
84
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
85
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
86
+ }
87
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
88
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
89
+ }
90
+ if ((TYPE(im) != T_BIGNUM) || (TYPE(im) != T_FIXNUM)) {
91
+ im = rb_funcall(im, rb_intern("to_i"), 0);
92
+ }
93
+
94
+ i_mm = NUM2INT(mm);
95
+ i_jm = NUM2INT(jm);
96
+ i_im = NUM2INT(im);
97
+
98
+ o_work= ALLOCA_N(real, (i_jm+1)*(4*i_jm+5*i_mm+14)+(i_mm+1)*(i_mm+1)+i_mm+2+6*i_im+15);
99
+
100
+ shtint_(&i_mm, &i_jm, &i_im, o_work);
101
+
102
+ {int array_shape[1] = {(i_jm+1)*(4*i_jm+5*i_mm+14)+(i_mm+1)*(i_mm+1)+i_mm+2+6*i_im+15};
103
+ work = dcl_crealary2obj(o_work, (i_jm+1)*(4*i_jm+5*i_mm+14)+(i_mm+1)*(i_mm+1)+i_mm+2+6*i_im+15, 1, array_shape);
104
+ }
105
+
106
+
107
+ return work;
108
+
109
+ }
110
+
111
+ static VALUE
112
+ dcl_shtlap(obj, mm, ind, a)
113
+ VALUE obj, mm, ind, a;
114
+ {
115
+ integer i_mm;
116
+ integer i_ind;
117
+ real *i_a;
118
+ real *o_b;
119
+ VALUE b;
120
+
121
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
122
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
123
+ }
124
+ if ((TYPE(ind) != T_BIGNUM) || (TYPE(ind) != T_FIXNUM)) {
125
+ ind = rb_funcall(ind, rb_intern("to_i"), 0);
126
+ }
127
+ if (TYPE(a) == T_FLOAT) {
128
+ a = rb_Array(a);
129
+ }
130
+ /* if ((TYPE(a) != T_ARRAY) &&
131
+ (rb_obj_is_kind_of(a, cNArray) != Qtrue)) {
132
+ rb_raise(rb_eTypeError, "invalid type");
133
+ } -- no check since obj2c*ary will do that */
134
+
135
+ i_mm = NUM2INT(mm);
136
+ i_ind = NUM2INT(ind);
137
+ i_a = dcl_obj2crealary(a);
138
+
139
+ o_b= ALLOCA_N(real, (i_mm+1)*(i_mm+1));
140
+
141
+ shtlap_(&i_mm, &i_ind, i_a, o_b);
142
+
143
+ {int array_shape[1] = {(i_mm+1)*(i_mm+1)};
144
+ b = dcl_crealary2obj(o_b, (i_mm+1)*(i_mm+1), 1, array_shape);
145
+ }
146
+
147
+ dcl_freecrealary(i_a);
148
+
149
+ return b;
150
+
151
+ }
152
+
153
+ static VALUE
154
+ dcl_shtnml(obj, mm, n, m)
155
+ VALUE obj, mm, n, m;
156
+ {
157
+ integer i_mm;
158
+ integer i_n;
159
+ integer i_m;
160
+ integer o_lr;
161
+ integer o_li;
162
+ VALUE lr;
163
+ VALUE li;
164
+
165
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
166
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
167
+ }
168
+ if ((TYPE(n) != T_BIGNUM) || (TYPE(n) != T_FIXNUM)) {
169
+ n = rb_funcall(n, rb_intern("to_i"), 0);
170
+ }
171
+ if ((TYPE(m) != T_BIGNUM) || (TYPE(m) != T_FIXNUM)) {
172
+ m = rb_funcall(m, rb_intern("to_i"), 0);
173
+ }
174
+
175
+ i_mm = NUM2INT(mm);
176
+ i_n = NUM2INT(n);
177
+ i_m = NUM2INT(m);
178
+
179
+
180
+ shtnml_(&i_mm, &i_n, &i_m, &o_lr, &o_li);
181
+
182
+ lr = INT2NUM(o_lr);
183
+ li = INT2NUM(o_li);
184
+
185
+
186
+ return rb_ary_new3(2, lr, li);
187
+
188
+ }
189
+
190
+ static VALUE
191
+ dcl_shtfun(obj, mm, jm, m, work)
192
+ VALUE obj, mm, jm, m, work;
193
+ {
194
+ integer i_mm;
195
+ integer i_jm;
196
+ integer i_m;
197
+ real *o_fun;
198
+ real *i_work;
199
+ VALUE fun;
200
+
201
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
202
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
203
+ }
204
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
205
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
206
+ }
207
+ if ((TYPE(m) != T_BIGNUM) || (TYPE(m) != T_FIXNUM)) {
208
+ m = rb_funcall(m, rb_intern("to_i"), 0);
209
+ }
210
+ if (TYPE(work) == T_FLOAT) {
211
+ work = rb_Array(work);
212
+ }
213
+ /* if ((TYPE(work) != T_ARRAY) &&
214
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
215
+ rb_raise(rb_eTypeError, "invalid type");
216
+ } -- no check since obj2c*ary will do that */
217
+
218
+ i_mm = NUM2INT(mm);
219
+ i_jm = NUM2INT(jm);
220
+ i_m = NUM2INT(m);
221
+ i_work = dcl_obj2crealary(work);
222
+
223
+ o_fun= ALLOCA_N(real, ((2*i_jm+1)*(i_mm-i_m+1)));
224
+
225
+ shtfun_(&i_mm, &i_jm, &i_m, o_fun, i_work);
226
+
227
+ {int array_shape[2] = {(2*i_jm+1), (i_mm-i_m+1)};
228
+ fun = dcl_crealary2obj(o_fun, ((2*i_jm+1)*(i_mm-i_m+1)), 2, array_shape);
229
+ }
230
+
231
+ dcl_freecrealary(i_work);
232
+
233
+ return fun;
234
+
235
+ }
236
+
237
+ static VALUE
238
+ dcl_shtlfw(obj, mm, jm, m, isw, wm, work)
239
+ VALUE obj, mm, jm, m, isw, wm, work;
240
+ {
241
+ integer i_mm;
242
+ integer i_jm;
243
+ integer i_m;
244
+ integer i_isw;
245
+ real *i_wm;
246
+ real *o_sm;
247
+ real *i_work;
248
+ VALUE sm;
249
+
250
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
251
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
252
+ }
253
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
254
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
255
+ }
256
+ if ((TYPE(m) != T_BIGNUM) || (TYPE(m) != T_FIXNUM)) {
257
+ m = rb_funcall(m, rb_intern("to_i"), 0);
258
+ }
259
+ if ((TYPE(isw) != T_BIGNUM) || (TYPE(isw) != T_FIXNUM)) {
260
+ isw = rb_funcall(isw, rb_intern("to_i"), 0);
261
+ }
262
+ if (TYPE(wm) == T_FLOAT) {
263
+ wm = rb_Array(wm);
264
+ }
265
+ /* if ((TYPE(wm) != T_ARRAY) &&
266
+ (rb_obj_is_kind_of(wm, cNArray) != Qtrue)) {
267
+ rb_raise(rb_eTypeError, "invalid type");
268
+ } -- no check since obj2c*ary will do that */
269
+ if (TYPE(work) == T_FLOAT) {
270
+ work = rb_Array(work);
271
+ }
272
+ /* if ((TYPE(work) != T_ARRAY) &&
273
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
274
+ rb_raise(rb_eTypeError, "invalid type");
275
+ } -- no check since obj2c*ary will do that */
276
+
277
+ i_mm = NUM2INT(mm);
278
+ i_jm = NUM2INT(jm);
279
+ i_m = NUM2INT(m);
280
+ i_isw = NUM2INT(isw);
281
+ i_wm = dcl_obj2crealary(wm);
282
+ i_work = dcl_obj2crealary(work);
283
+
284
+ o_sm= ALLOCA_N(real, (i_mm-i_m+1));
285
+
286
+ shtlfw_(&i_mm, &i_jm, &i_m, &i_isw, i_wm, o_sm, i_work);
287
+
288
+ {int array_shape[1] = {i_mm-i_m+1};
289
+ sm = dcl_crealary2obj(o_sm, (i_mm-i_m+1), 1, array_shape);
290
+ }
291
+
292
+ dcl_freecrealary(i_wm);
293
+ dcl_freecrealary(i_work);
294
+
295
+ return sm;
296
+
297
+ }
298
+
299
+ static VALUE
300
+ dcl_shtlbw(obj, mm, jm, m, isw, sm, work)
301
+ VALUE obj, mm, jm, m, isw, sm, work;
302
+ {
303
+ integer i_mm;
304
+ integer i_jm;
305
+ integer i_m;
306
+ integer i_isw;
307
+ real *i_sm;
308
+ real *o_wm;
309
+ real *i_work;
310
+ VALUE wm;
311
+
312
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
313
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
314
+ }
315
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
316
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
317
+ }
318
+ if ((TYPE(m) != T_BIGNUM) || (TYPE(m) != T_FIXNUM)) {
319
+ m = rb_funcall(m, rb_intern("to_i"), 0);
320
+ }
321
+ if ((TYPE(isw) != T_BIGNUM) || (TYPE(isw) != T_FIXNUM)) {
322
+ isw = rb_funcall(isw, rb_intern("to_i"), 0);
323
+ }
324
+ if (TYPE(sm) == T_FLOAT) {
325
+ sm = rb_Array(sm);
326
+ }
327
+ /* if ((TYPE(sm) != T_ARRAY) &&
328
+ (rb_obj_is_kind_of(sm, cNArray) != Qtrue)) {
329
+ rb_raise(rb_eTypeError, "invalid type");
330
+ } -- no check since obj2c*ary will do that */
331
+ if (TYPE(work) == T_FLOAT) {
332
+ work = rb_Array(work);
333
+ }
334
+ /* if ((TYPE(work) != T_ARRAY) &&
335
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
336
+ rb_raise(rb_eTypeError, "invalid type");
337
+ } -- no check since obj2c*ary will do that */
338
+
339
+ i_mm = NUM2INT(mm);
340
+ i_jm = NUM2INT(jm);
341
+ i_m = NUM2INT(m);
342
+ i_isw = NUM2INT(isw);
343
+ i_sm = dcl_obj2crealary(sm);
344
+ i_work = dcl_obj2crealary(work);
345
+
346
+ o_wm= ALLOCA_N(real, (2*i_jm+1));
347
+
348
+ shtlbw_(&i_mm, &i_jm, &i_m, &i_isw, i_sm, o_wm, i_work);
349
+
350
+ {int array_shape[1] = {2*i_jm+1};
351
+ wm = dcl_crealary2obj(o_wm, (2*i_jm+1), 1, array_shape);
352
+ }
353
+
354
+ dcl_freecrealary(i_sm);
355
+ dcl_freecrealary(i_work);
356
+
357
+ return wm;
358
+
359
+ }
360
+
361
+ static VALUE
362
+ dcl_shts2w(obj, mm, jm, isw, s, work)
363
+ VALUE obj, mm, jm, isw, s, work;
364
+ {
365
+ integer i_mm;
366
+ integer i_jm;
367
+ integer i_isw;
368
+ real *i_s;
369
+ real *o_w;
370
+ real *i_work;
371
+ VALUE w;
372
+
373
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
374
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
375
+ }
376
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
377
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
378
+ }
379
+ if ((TYPE(isw) != T_BIGNUM) || (TYPE(isw) != T_FIXNUM)) {
380
+ isw = rb_funcall(isw, rb_intern("to_i"), 0);
381
+ }
382
+ if (TYPE(s) == T_FLOAT) {
383
+ s = rb_Array(s);
384
+ }
385
+ /* if ((TYPE(s) != T_ARRAY) &&
386
+ (rb_obj_is_kind_of(s, cNArray) != Qtrue)) {
387
+ rb_raise(rb_eTypeError, "invalid type");
388
+ } -- no check since obj2c*ary will do that */
389
+ if (TYPE(work) == T_FLOAT) {
390
+ work = rb_Array(work);
391
+ }
392
+ /* if ((TYPE(work) != T_ARRAY) &&
393
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
394
+ rb_raise(rb_eTypeError, "invalid type");
395
+ } -- no check since obj2c*ary will do that */
396
+
397
+ i_mm = NUM2INT(mm);
398
+ i_jm = NUM2INT(jm);
399
+ i_isw = NUM2INT(isw);
400
+ i_s = dcl_obj2crealary(s);
401
+ i_work = dcl_obj2crealary(work);
402
+
403
+ o_w= ALLOCA_N(real, ((2*i_jm+1)*(2*i_mm+1)));
404
+
405
+ shts2w_(&i_mm, &i_jm, &i_isw, i_s, o_w, i_work);
406
+
407
+ {int array_shape[2] = {(2*i_jm+1), (2*i_mm+1)};
408
+ w = dcl_crealary2obj(o_w, ((2*i_jm+1)*(2*i_mm+1)), 2, array_shape);
409
+ }
410
+
411
+ dcl_freecrealary(i_s);
412
+ dcl_freecrealary(i_work);
413
+
414
+ return w;
415
+
416
+ }
417
+
418
+ static VALUE
419
+ dcl_shtswa(obj, mm, jm, isw, m1, m2, s, work)
420
+ VALUE obj, mm, jm, isw, m1, m2, s, work;
421
+ {
422
+ integer i_mm;
423
+ integer i_jm;
424
+ integer i_isw;
425
+ integer i_m1;
426
+ integer i_m2;
427
+ real *i_s;
428
+ real *o_w;
429
+ real *i_work;
430
+ VALUE w;
431
+
432
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
433
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
434
+ }
435
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
436
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
437
+ }
438
+ if ((TYPE(isw) != T_BIGNUM) || (TYPE(isw) != T_FIXNUM)) {
439
+ isw = rb_funcall(isw, rb_intern("to_i"), 0);
440
+ }
441
+ if ((TYPE(m1) != T_BIGNUM) || (TYPE(m1) != T_FIXNUM)) {
442
+ m1 = rb_funcall(m1, rb_intern("to_i"), 0);
443
+ }
444
+ if ((TYPE(m2) != T_BIGNUM) || (TYPE(m2) != T_FIXNUM)) {
445
+ m2 = rb_funcall(m2, rb_intern("to_i"), 0);
446
+ }
447
+ if (TYPE(s) == T_FLOAT) {
448
+ s = rb_Array(s);
449
+ }
450
+ /* if ((TYPE(s) != T_ARRAY) &&
451
+ (rb_obj_is_kind_of(s, cNArray) != Qtrue)) {
452
+ rb_raise(rb_eTypeError, "invalid type");
453
+ } -- no check since obj2c*ary will do that */
454
+ if (TYPE(work) == T_FLOAT) {
455
+ work = rb_Array(work);
456
+ }
457
+ /* if ((TYPE(work) != T_ARRAY) &&
458
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
459
+ rb_raise(rb_eTypeError, "invalid type");
460
+ } -- no check since obj2c*ary will do that */
461
+
462
+ i_mm = NUM2INT(mm);
463
+ i_jm = NUM2INT(jm);
464
+ i_isw = NUM2INT(isw);
465
+ i_m1 = NUM2INT(m1);
466
+ i_m2 = NUM2INT(m2);
467
+ i_s = dcl_obj2crealary(s);
468
+ i_work = dcl_obj2crealary(work);
469
+
470
+ o_w= ALLOCA_N(real, ((2*i_jm+1)*(2*i_mm+1)));
471
+
472
+ shtswa_(&i_mm, &i_jm, &i_isw, &i_m1, &i_m2, i_s, o_w, i_work);
473
+
474
+ {int array_shape[2] = {(2*i_jm+1), (2*i_mm+1)};
475
+ w = dcl_crealary2obj(o_w, ((2*i_jm+1)*(2*i_mm+1)), 2, array_shape);
476
+ }
477
+
478
+ dcl_freecrealary(i_s);
479
+ dcl_freecrealary(i_work);
480
+
481
+ return w;
482
+
483
+ }
484
+
485
+ static VALUE
486
+ dcl_shtswz(obj, mm, jm, isw, s, work)
487
+ VALUE obj, mm, jm, isw, s, work;
488
+ {
489
+ integer i_mm;
490
+ integer i_jm;
491
+ integer i_isw;
492
+ real *i_s;
493
+ real *o_wz;
494
+ real *i_work;
495
+ VALUE wz;
496
+
497
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
498
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
499
+ }
500
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
501
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
502
+ }
503
+ if ((TYPE(isw) != T_BIGNUM) || (TYPE(isw) != T_FIXNUM)) {
504
+ isw = rb_funcall(isw, rb_intern("to_i"), 0);
505
+ }
506
+ if (TYPE(s) == T_FLOAT) {
507
+ s = rb_Array(s);
508
+ }
509
+ /* if ((TYPE(s) != T_ARRAY) &&
510
+ (rb_obj_is_kind_of(s, cNArray) != Qtrue)) {
511
+ rb_raise(rb_eTypeError, "invalid type");
512
+ } -- no check since obj2c*ary will do that */
513
+ if (TYPE(work) == T_FLOAT) {
514
+ work = rb_Array(work);
515
+ }
516
+ /* if ((TYPE(work) != T_ARRAY) &&
517
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
518
+ rb_raise(rb_eTypeError, "invalid type");
519
+ } -- no check since obj2c*ary will do that */
520
+
521
+ i_mm = NUM2INT(mm);
522
+ i_jm = NUM2INT(jm);
523
+ i_isw = NUM2INT(isw);
524
+ i_s = dcl_obj2crealary(s);
525
+ i_work = dcl_obj2crealary(work);
526
+
527
+ o_wz= ALLOCA_N(real, (2*i_jm+1));
528
+
529
+ shtswz_(&i_mm, &i_jm, &i_isw, i_s, o_wz, i_work);
530
+
531
+ {int array_shape[1] = {2*i_jm+1};
532
+ wz = dcl_crealary2obj(o_wz, (2*i_jm+1), 1, array_shape);
533
+ }
534
+
535
+ dcl_freecrealary(i_s);
536
+ dcl_freecrealary(i_work);
537
+
538
+ return wz;
539
+
540
+ }
541
+
542
+ static VALUE
543
+ dcl_shtswm(obj, mm, jm, m, isw, s, work)
544
+ VALUE obj, mm, jm, m, isw, s, work;
545
+ {
546
+ integer i_mm;
547
+ integer i_jm;
548
+ integer i_m;
549
+ integer i_isw;
550
+ real *i_s;
551
+ real *o_wr;
552
+ real *o_wi;
553
+ real *i_work;
554
+ VALUE wr;
555
+ VALUE wi;
556
+
557
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
558
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
559
+ }
560
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
561
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
562
+ }
563
+ if ((TYPE(m) != T_BIGNUM) || (TYPE(m) != T_FIXNUM)) {
564
+ m = rb_funcall(m, rb_intern("to_i"), 0);
565
+ }
566
+ if ((TYPE(isw) != T_BIGNUM) || (TYPE(isw) != T_FIXNUM)) {
567
+ isw = rb_funcall(isw, rb_intern("to_i"), 0);
568
+ }
569
+ if (TYPE(s) == T_FLOAT) {
570
+ s = rb_Array(s);
571
+ }
572
+ /* if ((TYPE(s) != T_ARRAY) &&
573
+ (rb_obj_is_kind_of(s, cNArray) != Qtrue)) {
574
+ rb_raise(rb_eTypeError, "invalid type");
575
+ } -- no check since obj2c*ary will do that */
576
+ if (TYPE(work) == T_FLOAT) {
577
+ work = rb_Array(work);
578
+ }
579
+ /* if ((TYPE(work) != T_ARRAY) &&
580
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
581
+ rb_raise(rb_eTypeError, "invalid type");
582
+ } -- no check since obj2c*ary will do that */
583
+
584
+ i_mm = NUM2INT(mm);
585
+ i_jm = NUM2INT(jm);
586
+ i_m = NUM2INT(m);
587
+ i_isw = NUM2INT(isw);
588
+ i_s = dcl_obj2crealary(s);
589
+ i_work = dcl_obj2crealary(work);
590
+
591
+ o_wr= ALLOCA_N(real, (2*i_jm+1));
592
+ o_wi= ALLOCA_N(real, (2*i_jm+1));
593
+
594
+ shtswm_(&i_mm, &i_jm, &i_m, &i_isw, i_s, o_wr, o_wi, i_work);
595
+
596
+ {int array_shape[1] = {2*i_jm+1};
597
+ wr = dcl_crealary2obj(o_wr, (2*i_jm+1), 1, array_shape);
598
+ }
599
+ {int array_shape[1] = {2*i_jm+1};
600
+ wi = dcl_crealary2obj(o_wi, (2*i_jm+1), 1, array_shape);
601
+ }
602
+
603
+ dcl_freecrealary(i_s);
604
+ dcl_freecrealary(i_work);
605
+
606
+ return rb_ary_new3(2, wr, wi);
607
+
608
+ }
609
+
610
+ static VALUE
611
+ dcl_shtswj(obj, mm, jm, isw, j, m1, m2, s, work)
612
+ VALUE obj, mm, jm, isw, j, m1, m2, s, work;
613
+ {
614
+ integer i_mm;
615
+ integer i_jm;
616
+ integer i_isw;
617
+ integer i_j;
618
+ integer i_m1;
619
+ integer i_m2;
620
+ real *i_s;
621
+ real *o_wj;
622
+ real *i_work;
623
+ VALUE wj;
624
+
625
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
626
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
627
+ }
628
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
629
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
630
+ }
631
+ if ((TYPE(isw) != T_BIGNUM) || (TYPE(isw) != T_FIXNUM)) {
632
+ isw = rb_funcall(isw, rb_intern("to_i"), 0);
633
+ }
634
+ if ((TYPE(j) != T_BIGNUM) || (TYPE(j) != T_FIXNUM)) {
635
+ j = rb_funcall(j, rb_intern("to_i"), 0);
636
+ }
637
+ if ((TYPE(m1) != T_BIGNUM) || (TYPE(m1) != T_FIXNUM)) {
638
+ m1 = rb_funcall(m1, rb_intern("to_i"), 0);
639
+ }
640
+ if ((TYPE(m2) != T_BIGNUM) || (TYPE(m2) != T_FIXNUM)) {
641
+ m2 = rb_funcall(m2, rb_intern("to_i"), 0);
642
+ }
643
+ if (TYPE(s) == T_FLOAT) {
644
+ s = rb_Array(s);
645
+ }
646
+ /* if ((TYPE(s) != T_ARRAY) &&
647
+ (rb_obj_is_kind_of(s, cNArray) != Qtrue)) {
648
+ rb_raise(rb_eTypeError, "invalid type");
649
+ } -- no check since obj2c*ary will do that */
650
+ if (TYPE(work) == T_FLOAT) {
651
+ work = rb_Array(work);
652
+ }
653
+ /* if ((TYPE(work) != T_ARRAY) &&
654
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
655
+ rb_raise(rb_eTypeError, "invalid type");
656
+ } -- no check since obj2c*ary will do that */
657
+
658
+ i_mm = NUM2INT(mm);
659
+ i_jm = NUM2INT(jm);
660
+ i_isw = NUM2INT(isw);
661
+ i_j = NUM2INT(j);
662
+ i_m1 = NUM2INT(m1);
663
+ i_m2 = NUM2INT(m2);
664
+ i_s = dcl_obj2crealary(s);
665
+ i_work = dcl_obj2crealary(work);
666
+
667
+ o_wj= ALLOCA_N(real, (2*i_mm+1));
668
+
669
+ shtswj_(&i_mm, &i_jm, &i_isw, &i_j, &i_m1, &i_m2, i_s, o_wj, i_work);
670
+
671
+ {int array_shape[1] = {2*i_mm+1};
672
+ wj = dcl_crealary2obj(o_wj, (2*i_mm+1), 1, array_shape);
673
+ }
674
+
675
+ dcl_freecrealary(i_s);
676
+ dcl_freecrealary(i_work);
677
+
678
+ return wj;
679
+
680
+ }
681
+
682
+ static VALUE
683
+ dcl_shtw2s(obj, mm, jm, isw, s, work)
684
+ VALUE obj, mm, jm, isw, s, work;
685
+ {
686
+ integer i_mm;
687
+ integer i_jm;
688
+ integer i_isw;
689
+ real *i_s;
690
+ real *o_w;
691
+ real *i_work;
692
+ VALUE w;
693
+
694
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
695
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
696
+ }
697
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
698
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
699
+ }
700
+ if ((TYPE(isw) != T_BIGNUM) || (TYPE(isw) != T_FIXNUM)) {
701
+ isw = rb_funcall(isw, rb_intern("to_i"), 0);
702
+ }
703
+ if (TYPE(s) == T_FLOAT) {
704
+ s = rb_Array(s);
705
+ }
706
+ /* if ((TYPE(s) != T_ARRAY) &&
707
+ (rb_obj_is_kind_of(s, cNArray) != Qtrue)) {
708
+ rb_raise(rb_eTypeError, "invalid type");
709
+ } -- no check since obj2c*ary will do that */
710
+ if (TYPE(work) == T_FLOAT) {
711
+ work = rb_Array(work);
712
+ }
713
+ /* if ((TYPE(work) != T_ARRAY) &&
714
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
715
+ rb_raise(rb_eTypeError, "invalid type");
716
+ } -- no check since obj2c*ary will do that */
717
+
718
+ i_mm = NUM2INT(mm);
719
+ i_jm = NUM2INT(jm);
720
+ i_isw = NUM2INT(isw);
721
+ i_s = dcl_obj2crealary(s);
722
+ i_work = dcl_obj2crealary(work);
723
+
724
+ o_w= ALLOCA_N(real, ((i_mm+1)*(i_mm+1)));
725
+
726
+ shtw2s_(&i_mm, &i_jm, &i_isw, i_s, o_w, i_work);
727
+
728
+ {int array_shape[2] = {(i_mm+1), (i_mm+1)};
729
+ w = dcl_crealary2obj(o_w, ((i_mm+1)*(i_mm+1)), 2, array_shape);
730
+ }
731
+
732
+ dcl_freecrealary(i_s);
733
+ dcl_freecrealary(i_work);
734
+
735
+ return w;
736
+
737
+ }
738
+
739
+ static VALUE
740
+ dcl_shtw2g(obj, mm, jm, im, w, work)
741
+ VALUE obj, mm, jm, im, w, work;
742
+ {
743
+ integer i_mm;
744
+ integer i_jm;
745
+ integer i_im;
746
+ real *i_w;
747
+ real *o_g;
748
+ real *i_work;
749
+ VALUE g;
750
+
751
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
752
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
753
+ }
754
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
755
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
756
+ }
757
+ if ((TYPE(im) != T_BIGNUM) || (TYPE(im) != T_FIXNUM)) {
758
+ im = rb_funcall(im, rb_intern("to_i"), 0);
759
+ }
760
+ if (TYPE(w) == T_FLOAT) {
761
+ w = rb_Array(w);
762
+ }
763
+ /* if ((TYPE(w) != T_ARRAY) &&
764
+ (rb_obj_is_kind_of(w, cNArray) != Qtrue)) {
765
+ rb_raise(rb_eTypeError, "invalid type");
766
+ } -- no check since obj2c*ary will do that */
767
+ if (TYPE(work) == T_FLOAT) {
768
+ work = rb_Array(work);
769
+ }
770
+ /* if ((TYPE(work) != T_ARRAY) &&
771
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
772
+ rb_raise(rb_eTypeError, "invalid type");
773
+ } -- no check since obj2c*ary will do that */
774
+
775
+ i_mm = NUM2INT(mm);
776
+ i_jm = NUM2INT(jm);
777
+ i_im = NUM2INT(im);
778
+ i_w = dcl_obj2crealary(w);
779
+ i_work = dcl_obj2crealary(work);
780
+
781
+ o_g= ALLOCA_N(real, ((2*i_im+1)*(2*i_jm+1)));
782
+
783
+ shtw2g_(&i_mm, &i_jm, &i_im, i_w, o_g, i_work);
784
+
785
+ {int array_shape[2] = {(2*i_im+1), (2*i_jm+1)};
786
+ g = dcl_crealary2obj(o_g, ((2*i_im+1)*(2*i_jm+1)), 2, array_shape);
787
+ }
788
+
789
+ dcl_freecrealary(i_w);
790
+ dcl_freecrealary(i_work);
791
+
792
+ return g;
793
+
794
+ }
795
+
796
+ static VALUE
797
+ dcl_shtwga(obj, mm, jm, im, m1, m2, w, work)
798
+ VALUE obj, mm, jm, im, m1, m2, w, work;
799
+ {
800
+ integer i_mm;
801
+ integer i_jm;
802
+ integer i_im;
803
+ integer i_m1;
804
+ integer i_m2;
805
+ real *i_w;
806
+ real *o_g;
807
+ real *i_work;
808
+ VALUE g;
809
+
810
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
811
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
812
+ }
813
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
814
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
815
+ }
816
+ if ((TYPE(im) != T_BIGNUM) || (TYPE(im) != T_FIXNUM)) {
817
+ im = rb_funcall(im, rb_intern("to_i"), 0);
818
+ }
819
+ if ((TYPE(m1) != T_BIGNUM) || (TYPE(m1) != T_FIXNUM)) {
820
+ m1 = rb_funcall(m1, rb_intern("to_i"), 0);
821
+ }
822
+ if ((TYPE(m2) != T_BIGNUM) || (TYPE(m2) != T_FIXNUM)) {
823
+ m2 = rb_funcall(m2, rb_intern("to_i"), 0);
824
+ }
825
+ if (TYPE(w) == T_FLOAT) {
826
+ w = rb_Array(w);
827
+ }
828
+ /* if ((TYPE(w) != T_ARRAY) &&
829
+ (rb_obj_is_kind_of(w, cNArray) != Qtrue)) {
830
+ rb_raise(rb_eTypeError, "invalid type");
831
+ } -- no check since obj2c*ary will do that */
832
+ if (TYPE(work) == T_FLOAT) {
833
+ work = rb_Array(work);
834
+ }
835
+ /* if ((TYPE(work) != T_ARRAY) &&
836
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
837
+ rb_raise(rb_eTypeError, "invalid type");
838
+ } -- no check since obj2c*ary will do that */
839
+
840
+ i_mm = NUM2INT(mm);
841
+ i_jm = NUM2INT(jm);
842
+ i_im = NUM2INT(im);
843
+ i_m1 = NUM2INT(m1);
844
+ i_m2 = NUM2INT(m2);
845
+ i_w = dcl_obj2crealary(w);
846
+ i_work = dcl_obj2crealary(work);
847
+
848
+ o_g= ALLOCA_N(real, ((2*i_im+1)*(2*i_jm+1)));
849
+
850
+ shtwga_(&i_mm, &i_jm, &i_im, &i_m1, &i_m2, i_w, o_g, i_work);
851
+
852
+ {int array_shape[2] = {(2*i_im+1), (2*i_jm+1)};
853
+ g = dcl_crealary2obj(o_g, ((2*i_im+1)*(2*i_jm+1)), 2, array_shape);
854
+ }
855
+
856
+ dcl_freecrealary(i_w);
857
+ dcl_freecrealary(i_work);
858
+
859
+ return g;
860
+
861
+ }
862
+
863
+ static VALUE
864
+ dcl_shtwgm(obj, mm, jm, im, m, wr, wi, work)
865
+ VALUE obj, mm, jm, im, m, wr, wi, work;
866
+ {
867
+ integer i_mm;
868
+ integer i_jm;
869
+ integer i_im;
870
+ integer i_m;
871
+ real *i_wr;
872
+ real *i_wi;
873
+ real *o_g;
874
+ real *i_work;
875
+ VALUE g;
876
+
877
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
878
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
879
+ }
880
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
881
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
882
+ }
883
+ if ((TYPE(im) != T_BIGNUM) || (TYPE(im) != T_FIXNUM)) {
884
+ im = rb_funcall(im, rb_intern("to_i"), 0);
885
+ }
886
+ if ((TYPE(m) != T_BIGNUM) || (TYPE(m) != T_FIXNUM)) {
887
+ m = rb_funcall(m, rb_intern("to_i"), 0);
888
+ }
889
+ if (TYPE(wr) == T_FLOAT) {
890
+ wr = rb_Array(wr);
891
+ }
892
+ /* if ((TYPE(wr) != T_ARRAY) &&
893
+ (rb_obj_is_kind_of(wr, cNArray) != Qtrue)) {
894
+ rb_raise(rb_eTypeError, "invalid type");
895
+ } -- no check since obj2c*ary will do that */
896
+ if (TYPE(wi) == T_FLOAT) {
897
+ wi = rb_Array(wi);
898
+ }
899
+ /* if ((TYPE(wi) != T_ARRAY) &&
900
+ (rb_obj_is_kind_of(wi, cNArray) != Qtrue)) {
901
+ rb_raise(rb_eTypeError, "invalid type");
902
+ } -- no check since obj2c*ary will do that */
903
+ if (TYPE(work) == T_FLOAT) {
904
+ work = rb_Array(work);
905
+ }
906
+ /* if ((TYPE(work) != T_ARRAY) &&
907
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
908
+ rb_raise(rb_eTypeError, "invalid type");
909
+ } -- no check since obj2c*ary will do that */
910
+
911
+ i_mm = NUM2INT(mm);
912
+ i_jm = NUM2INT(jm);
913
+ i_im = NUM2INT(im);
914
+ i_m = NUM2INT(m);
915
+ i_wr = dcl_obj2crealary(wr);
916
+ i_wi = dcl_obj2crealary(wi);
917
+ i_work = dcl_obj2crealary(work);
918
+
919
+ o_g= ALLOCA_N(real, ((2*i_im+1)*(2*i_jm+1)));
920
+
921
+ shtwgm_(&i_mm, &i_jm, &i_im, &i_m, i_wr, i_wi, o_g, i_work);
922
+
923
+ {int array_shape[2] = {(2*i_im+1), (2*i_jm+1)};
924
+ g = dcl_crealary2obj(o_g, ((2*i_im+1)*(2*i_jm+1)), 2, array_shape);
925
+ }
926
+
927
+ dcl_freecrealary(i_wr);
928
+ dcl_freecrealary(i_wi);
929
+ dcl_freecrealary(i_work);
930
+
931
+ return g;
932
+
933
+ }
934
+
935
+ static VALUE
936
+ dcl_shtwgz(obj, jm, im, wz)
937
+ VALUE obj, jm, im, wz;
938
+ {
939
+ integer i_jm;
940
+ integer i_im;
941
+ real *i_wz;
942
+ real *o_g;
943
+ VALUE g;
944
+
945
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
946
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
947
+ }
948
+ if ((TYPE(im) != T_BIGNUM) || (TYPE(im) != T_FIXNUM)) {
949
+ im = rb_funcall(im, rb_intern("to_i"), 0);
950
+ }
951
+ if (TYPE(wz) == T_FLOAT) {
952
+ wz = rb_Array(wz);
953
+ }
954
+ /* if ((TYPE(wz) != T_ARRAY) &&
955
+ (rb_obj_is_kind_of(wz, cNArray) != Qtrue)) {
956
+ rb_raise(rb_eTypeError, "invalid type");
957
+ } -- no check since obj2c*ary will do that */
958
+
959
+ i_jm = NUM2INT(jm);
960
+ i_im = NUM2INT(im);
961
+ i_wz = dcl_obj2crealary(wz);
962
+
963
+ o_g= ALLOCA_N(real, ((2*i_im+1)*(2*i_jm+1)));
964
+
965
+ shtwgz_(&i_jm, &i_im, i_wz, o_g);
966
+
967
+ {int array_shape[2] = {(2*i_im+1), (2*i_jm+1)};
968
+ g = dcl_crealary2obj(o_g, ((2*i_im+1)*(2*i_jm+1)), 2, array_shape);
969
+ }
970
+
971
+ dcl_freecrealary(i_wz);
972
+
973
+ return g;
974
+
975
+ }
976
+
977
+ static VALUE
978
+ dcl_shtwgj(obj, mm, im, m1, m2, wj, work)
979
+ VALUE obj, mm, im, m1, m2, wj, work;
980
+ {
981
+ integer i_mm;
982
+ integer i_im;
983
+ integer i_m1;
984
+ integer i_m2;
985
+ real *i_wj;
986
+ real *o_gj;
987
+ real *i_work;
988
+ VALUE gj;
989
+
990
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
991
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
992
+ }
993
+ if ((TYPE(im) != T_BIGNUM) || (TYPE(im) != T_FIXNUM)) {
994
+ im = rb_funcall(im, rb_intern("to_i"), 0);
995
+ }
996
+ if ((TYPE(m1) != T_BIGNUM) || (TYPE(m1) != T_FIXNUM)) {
997
+ m1 = rb_funcall(m1, rb_intern("to_i"), 0);
998
+ }
999
+ if ((TYPE(m2) != T_BIGNUM) || (TYPE(m2) != T_FIXNUM)) {
1000
+ m2 = rb_funcall(m2, rb_intern("to_i"), 0);
1001
+ }
1002
+ if (TYPE(wj) == T_FLOAT) {
1003
+ wj = rb_Array(wj);
1004
+ }
1005
+ /* if ((TYPE(wj) != T_ARRAY) &&
1006
+ (rb_obj_is_kind_of(wj, cNArray) != Qtrue)) {
1007
+ rb_raise(rb_eTypeError, "invalid type");
1008
+ } -- no check since obj2c*ary will do that */
1009
+ if (TYPE(work) == T_FLOAT) {
1010
+ work = rb_Array(work);
1011
+ }
1012
+ /* if ((TYPE(work) != T_ARRAY) &&
1013
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
1014
+ rb_raise(rb_eTypeError, "invalid type");
1015
+ } -- no check since obj2c*ary will do that */
1016
+
1017
+ i_mm = NUM2INT(mm);
1018
+ i_im = NUM2INT(im);
1019
+ i_m1 = NUM2INT(m1);
1020
+ i_m2 = NUM2INT(m2);
1021
+ i_wj = dcl_obj2crealary(wj);
1022
+ i_work = dcl_obj2crealary(work);
1023
+
1024
+ o_gj= ALLOCA_N(real, (2*i_im+1));
1025
+
1026
+ shtwgj_(&i_mm, &i_im, &i_m1, &i_m2, i_wj, o_gj, i_work);
1027
+
1028
+ {int array_shape[1] = {2*i_im+1};
1029
+ gj = dcl_crealary2obj(o_gj, (2*i_im+1), 1, array_shape);
1030
+ }
1031
+
1032
+ dcl_freecrealary(i_wj);
1033
+ dcl_freecrealary(i_work);
1034
+
1035
+ return gj;
1036
+
1037
+ }
1038
+
1039
+ static VALUE
1040
+ dcl_shtg2w(obj, mm, jm, im, g, work)
1041
+ VALUE obj, mm, jm, im, g, work;
1042
+ {
1043
+ integer i_mm;
1044
+ integer i_jm;
1045
+ integer i_im;
1046
+ real *i_g;
1047
+ real *o_w;
1048
+ real *i_work;
1049
+ VALUE w;
1050
+
1051
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
1052
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
1053
+ }
1054
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
1055
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
1056
+ }
1057
+ if ((TYPE(im) != T_BIGNUM) || (TYPE(im) != T_FIXNUM)) {
1058
+ im = rb_funcall(im, rb_intern("to_i"), 0);
1059
+ }
1060
+ if (TYPE(g) == T_FLOAT) {
1061
+ g = rb_Array(g);
1062
+ }
1063
+ /* if ((TYPE(g) != T_ARRAY) &&
1064
+ (rb_obj_is_kind_of(g, cNArray) != Qtrue)) {
1065
+ rb_raise(rb_eTypeError, "invalid type");
1066
+ } -- no check since obj2c*ary will do that */
1067
+ if (TYPE(work) == T_FLOAT) {
1068
+ work = rb_Array(work);
1069
+ }
1070
+ /* if ((TYPE(work) != T_ARRAY) &&
1071
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
1072
+ rb_raise(rb_eTypeError, "invalid type");
1073
+ } -- no check since obj2c*ary will do that */
1074
+
1075
+ i_mm = NUM2INT(mm);
1076
+ i_jm = NUM2INT(jm);
1077
+ i_im = NUM2INT(im);
1078
+ i_g = dcl_obj2crealary(g);
1079
+ i_work = dcl_obj2crealary(work);
1080
+
1081
+ o_w= ALLOCA_N(real, ((2*i_jm+1)*(2*i_mm+1)));
1082
+
1083
+ shtg2w_(&i_mm, &i_jm, &i_im, i_g, o_w, i_work);
1084
+
1085
+ {int array_shape[2] = {(2*i_jm+1), (2*i_mm+1)};
1086
+ w = dcl_crealary2obj(o_w, ((2*i_jm+1)*(2*i_mm+1)), 2, array_shape);
1087
+ }
1088
+
1089
+ dcl_freecrealary(i_g);
1090
+ dcl_freecrealary(i_work);
1091
+
1092
+ return w;
1093
+
1094
+ }
1095
+
1096
+ static VALUE
1097
+ dcl_shts2g(obj, mm, jm, im, isw, s, work)
1098
+ VALUE obj, mm, jm, im, isw, s, work;
1099
+ {
1100
+ integer i_mm;
1101
+ integer i_jm;
1102
+ integer i_im;
1103
+ integer i_isw;
1104
+ real *i_s;
1105
+ real *o_w;
1106
+ real *o_g;
1107
+ real *i_work;
1108
+ VALUE w;
1109
+ VALUE g;
1110
+
1111
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
1112
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
1113
+ }
1114
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
1115
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
1116
+ }
1117
+ if ((TYPE(im) != T_BIGNUM) || (TYPE(im) != T_FIXNUM)) {
1118
+ im = rb_funcall(im, rb_intern("to_i"), 0);
1119
+ }
1120
+ if ((TYPE(isw) != T_BIGNUM) || (TYPE(isw) != T_FIXNUM)) {
1121
+ isw = rb_funcall(isw, rb_intern("to_i"), 0);
1122
+ }
1123
+ if (TYPE(s) == T_FLOAT) {
1124
+ s = rb_Array(s);
1125
+ }
1126
+ /* if ((TYPE(s) != T_ARRAY) &&
1127
+ (rb_obj_is_kind_of(s, cNArray) != Qtrue)) {
1128
+ rb_raise(rb_eTypeError, "invalid type");
1129
+ } -- no check since obj2c*ary will do that */
1130
+ if (TYPE(work) == T_FLOAT) {
1131
+ work = rb_Array(work);
1132
+ }
1133
+ /* if ((TYPE(work) != T_ARRAY) &&
1134
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
1135
+ rb_raise(rb_eTypeError, "invalid type");
1136
+ } -- no check since obj2c*ary will do that */
1137
+
1138
+ i_mm = NUM2INT(mm);
1139
+ i_jm = NUM2INT(jm);
1140
+ i_im = NUM2INT(im);
1141
+ i_isw = NUM2INT(isw);
1142
+ i_s = dcl_obj2crealary(s);
1143
+ i_work = dcl_obj2crealary(work);
1144
+
1145
+ o_w= ALLOCA_N(real, ((2*i_jm+1)*(2*i_mm+1)));
1146
+ o_g= ALLOCA_N(real, ((2*i_im+1)*(2*i_jm+1)));
1147
+
1148
+ shts2g_(&i_mm, &i_jm, &i_im, &i_isw, i_s, o_w, o_g, i_work);
1149
+
1150
+ {int array_shape[2] = {(2*i_jm+1), (2*i_mm+1)};
1151
+ w = dcl_crealary2obj(o_w, ((2*i_jm+1)*(2*i_mm+1)), 2, array_shape);
1152
+ }
1153
+ {int array_shape[2] = {(2*i_im+1), (2*i_jm+1)};
1154
+ g = dcl_crealary2obj(o_g, ((2*i_im+1)*(2*i_jm+1)), 2, array_shape);
1155
+ }
1156
+
1157
+ dcl_freecrealary(i_s);
1158
+ dcl_freecrealary(i_work);
1159
+
1160
+ return rb_ary_new3(2, w, g);
1161
+
1162
+ }
1163
+
1164
+ static VALUE
1165
+ dcl_shtsga(obj, mm, jm, im, isw, m1, m2, s, work)
1166
+ VALUE obj, mm, jm, im, isw, m1, m2, s, work;
1167
+ {
1168
+ integer i_mm;
1169
+ integer i_jm;
1170
+ integer i_im;
1171
+ integer i_isw;
1172
+ integer i_m1;
1173
+ integer i_m2;
1174
+ real *i_s;
1175
+ real *o_w;
1176
+ real *o_g;
1177
+ real *i_work;
1178
+ VALUE w;
1179
+ VALUE g;
1180
+
1181
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
1182
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
1183
+ }
1184
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
1185
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
1186
+ }
1187
+ if ((TYPE(im) != T_BIGNUM) || (TYPE(im) != T_FIXNUM)) {
1188
+ im = rb_funcall(im, rb_intern("to_i"), 0);
1189
+ }
1190
+ if ((TYPE(isw) != T_BIGNUM) || (TYPE(isw) != T_FIXNUM)) {
1191
+ isw = rb_funcall(isw, rb_intern("to_i"), 0);
1192
+ }
1193
+ if ((TYPE(m1) != T_BIGNUM) || (TYPE(m1) != T_FIXNUM)) {
1194
+ m1 = rb_funcall(m1, rb_intern("to_i"), 0);
1195
+ }
1196
+ if ((TYPE(m2) != T_BIGNUM) || (TYPE(m2) != T_FIXNUM)) {
1197
+ m2 = rb_funcall(m2, rb_intern("to_i"), 0);
1198
+ }
1199
+ if (TYPE(s) == T_FLOAT) {
1200
+ s = rb_Array(s);
1201
+ }
1202
+ /* if ((TYPE(s) != T_ARRAY) &&
1203
+ (rb_obj_is_kind_of(s, cNArray) != Qtrue)) {
1204
+ rb_raise(rb_eTypeError, "invalid type");
1205
+ } -- no check since obj2c*ary will do that */
1206
+ if (TYPE(work) == T_FLOAT) {
1207
+ work = rb_Array(work);
1208
+ }
1209
+ /* if ((TYPE(work) != T_ARRAY) &&
1210
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
1211
+ rb_raise(rb_eTypeError, "invalid type");
1212
+ } -- no check since obj2c*ary will do that */
1213
+
1214
+ i_mm = NUM2INT(mm);
1215
+ i_jm = NUM2INT(jm);
1216
+ i_im = NUM2INT(im);
1217
+ i_isw = NUM2INT(isw);
1218
+ i_m1 = NUM2INT(m1);
1219
+ i_m2 = NUM2INT(m2);
1220
+ i_s = dcl_obj2crealary(s);
1221
+ i_work = dcl_obj2crealary(work);
1222
+
1223
+ o_w= ALLOCA_N(real, ((2*i_jm+1)*(2*i_mm+1)));
1224
+ o_g= ALLOCA_N(real, ((2*i_im+1)*(2*i_jm+1)));
1225
+
1226
+ shtsga_(&i_mm, &i_jm, &i_im, &i_isw, &i_m1, &i_m2, i_s, o_w, o_g, i_work);
1227
+
1228
+ {int array_shape[2] = {(2*i_jm+1), (2*i_mm+1)};
1229
+ w = dcl_crealary2obj(o_w, ((2*i_jm+1)*(2*i_mm+1)), 2, array_shape);
1230
+ }
1231
+ {int array_shape[2] = {(2*i_im+1), (2*i_jm+1)};
1232
+ g = dcl_crealary2obj(o_g, ((2*i_im+1)*(2*i_jm+1)), 2, array_shape);
1233
+ }
1234
+
1235
+ dcl_freecrealary(i_s);
1236
+ dcl_freecrealary(i_work);
1237
+
1238
+ return rb_ary_new3(2, w, g);
1239
+
1240
+ }
1241
+
1242
+ static VALUE
1243
+ dcl_shtsgz(obj, mm, jm, im, isw, s, work)
1244
+ VALUE obj, mm, jm, im, isw, s, work;
1245
+ {
1246
+ integer i_mm;
1247
+ integer i_jm;
1248
+ integer i_im;
1249
+ integer i_isw;
1250
+ real *i_s;
1251
+ real *o_wz;
1252
+ real *o_g;
1253
+ real *i_work;
1254
+ VALUE wz;
1255
+ VALUE g;
1256
+
1257
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
1258
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
1259
+ }
1260
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
1261
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
1262
+ }
1263
+ if ((TYPE(im) != T_BIGNUM) || (TYPE(im) != T_FIXNUM)) {
1264
+ im = rb_funcall(im, rb_intern("to_i"), 0);
1265
+ }
1266
+ if ((TYPE(isw) != T_BIGNUM) || (TYPE(isw) != T_FIXNUM)) {
1267
+ isw = rb_funcall(isw, rb_intern("to_i"), 0);
1268
+ }
1269
+ if (TYPE(s) == T_FLOAT) {
1270
+ s = rb_Array(s);
1271
+ }
1272
+ /* if ((TYPE(s) != T_ARRAY) &&
1273
+ (rb_obj_is_kind_of(s, cNArray) != Qtrue)) {
1274
+ rb_raise(rb_eTypeError, "invalid type");
1275
+ } -- no check since obj2c*ary will do that */
1276
+ if (TYPE(work) == T_FLOAT) {
1277
+ work = rb_Array(work);
1278
+ }
1279
+ /* if ((TYPE(work) != T_ARRAY) &&
1280
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
1281
+ rb_raise(rb_eTypeError, "invalid type");
1282
+ } -- no check since obj2c*ary will do that */
1283
+
1284
+ i_mm = NUM2INT(mm);
1285
+ i_jm = NUM2INT(jm);
1286
+ i_im = NUM2INT(im);
1287
+ i_isw = NUM2INT(isw);
1288
+ i_s = dcl_obj2crealary(s);
1289
+ i_work = dcl_obj2crealary(work);
1290
+
1291
+ o_wz= ALLOCA_N(real, (2*i_jm+1));
1292
+ o_g= ALLOCA_N(real, ((2*i_im+1)*(2*i_jm+1)));
1293
+
1294
+ shtsgz_(&i_mm, &i_jm, &i_im, &i_isw, i_s, o_wz, o_g, i_work);
1295
+
1296
+ {int array_shape[1] = {2*i_jm+1};
1297
+ wz = dcl_crealary2obj(o_wz, (2*i_jm+1), 1, array_shape);
1298
+ }
1299
+ {int array_shape[2] = {(2*i_im+1), (2*i_jm+1)};
1300
+ g = dcl_crealary2obj(o_g, ((2*i_im+1)*(2*i_jm+1)), 2, array_shape);
1301
+ }
1302
+
1303
+ dcl_freecrealary(i_s);
1304
+ dcl_freecrealary(i_work);
1305
+
1306
+ return rb_ary_new3(2, wz, g);
1307
+
1308
+ }
1309
+
1310
+ static VALUE
1311
+ dcl_shtsgm(obj, mm, jm, im, m, isw, s, work)
1312
+ VALUE obj, mm, jm, im, m, isw, s, work;
1313
+ {
1314
+ integer i_mm;
1315
+ integer i_jm;
1316
+ integer i_im;
1317
+ integer i_m;
1318
+ integer i_isw;
1319
+ real *i_s;
1320
+ real *o_wr;
1321
+ real *o_wi;
1322
+ real *o_g;
1323
+ real *i_work;
1324
+ VALUE wr;
1325
+ VALUE wi;
1326
+ VALUE g;
1327
+
1328
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
1329
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
1330
+ }
1331
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
1332
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
1333
+ }
1334
+ if ((TYPE(im) != T_BIGNUM) || (TYPE(im) != T_FIXNUM)) {
1335
+ im = rb_funcall(im, rb_intern("to_i"), 0);
1336
+ }
1337
+ if ((TYPE(m) != T_BIGNUM) || (TYPE(m) != T_FIXNUM)) {
1338
+ m = rb_funcall(m, rb_intern("to_i"), 0);
1339
+ }
1340
+ if ((TYPE(isw) != T_BIGNUM) || (TYPE(isw) != T_FIXNUM)) {
1341
+ isw = rb_funcall(isw, rb_intern("to_i"), 0);
1342
+ }
1343
+ if (TYPE(s) == T_FLOAT) {
1344
+ s = rb_Array(s);
1345
+ }
1346
+ /* if ((TYPE(s) != T_ARRAY) &&
1347
+ (rb_obj_is_kind_of(s, cNArray) != Qtrue)) {
1348
+ rb_raise(rb_eTypeError, "invalid type");
1349
+ } -- no check since obj2c*ary will do that */
1350
+ if (TYPE(work) == T_FLOAT) {
1351
+ work = rb_Array(work);
1352
+ }
1353
+ /* if ((TYPE(work) != T_ARRAY) &&
1354
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
1355
+ rb_raise(rb_eTypeError, "invalid type");
1356
+ } -- no check since obj2c*ary will do that */
1357
+
1358
+ i_mm = NUM2INT(mm);
1359
+ i_jm = NUM2INT(jm);
1360
+ i_im = NUM2INT(im);
1361
+ i_m = NUM2INT(m);
1362
+ i_isw = NUM2INT(isw);
1363
+ i_s = dcl_obj2crealary(s);
1364
+ i_work = dcl_obj2crealary(work);
1365
+
1366
+ o_wr= ALLOCA_N(real, (2*i_jm+1));
1367
+ o_wi= ALLOCA_N(real, (2*i_jm+1));
1368
+ o_g= ALLOCA_N(real, ((2*i_im+1)*(2*i_jm+1)));
1369
+
1370
+ shtsgm_(&i_mm, &i_jm, &i_im, &i_m, &i_isw, i_s, o_wr, o_wi, o_g, i_work);
1371
+
1372
+ {int array_shape[1] = {2*i_jm+1};
1373
+ wr = dcl_crealary2obj(o_wr, (2*i_jm+1), 1, array_shape);
1374
+ }
1375
+ {int array_shape[1] = {2*i_jm+1};
1376
+ wi = dcl_crealary2obj(o_wi, (2*i_jm+1), 1, array_shape);
1377
+ }
1378
+ {int array_shape[2] = {(2*i_im+1), (2*i_jm+1)};
1379
+ g = dcl_crealary2obj(o_g, ((2*i_im+1)*(2*i_jm+1)), 2, array_shape);
1380
+ }
1381
+
1382
+ dcl_freecrealary(i_s);
1383
+ dcl_freecrealary(i_work);
1384
+
1385
+ return rb_ary_new3(3, wr, wi, g);
1386
+
1387
+ }
1388
+
1389
+ static VALUE
1390
+ dcl_shtsgj(obj, mm, jm, im, isw, j, m1, m2, s, work)
1391
+ VALUE obj, mm, jm, im, isw, j, m1, m2, s, work;
1392
+ {
1393
+ integer i_mm;
1394
+ integer i_jm;
1395
+ integer i_im;
1396
+ integer i_isw;
1397
+ integer i_j;
1398
+ integer i_m1;
1399
+ integer i_m2;
1400
+ real *i_s;
1401
+ real *o_wj;
1402
+ real *o_gj;
1403
+ real *i_work;
1404
+ VALUE wj;
1405
+ VALUE gj;
1406
+
1407
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
1408
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
1409
+ }
1410
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
1411
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
1412
+ }
1413
+ if ((TYPE(im) != T_BIGNUM) || (TYPE(im) != T_FIXNUM)) {
1414
+ im = rb_funcall(im, rb_intern("to_i"), 0);
1415
+ }
1416
+ if ((TYPE(isw) != T_BIGNUM) || (TYPE(isw) != T_FIXNUM)) {
1417
+ isw = rb_funcall(isw, rb_intern("to_i"), 0);
1418
+ }
1419
+ if ((TYPE(j) != T_BIGNUM) || (TYPE(j) != T_FIXNUM)) {
1420
+ j = rb_funcall(j, rb_intern("to_i"), 0);
1421
+ }
1422
+ if ((TYPE(m1) != T_BIGNUM) || (TYPE(m1) != T_FIXNUM)) {
1423
+ m1 = rb_funcall(m1, rb_intern("to_i"), 0);
1424
+ }
1425
+ if ((TYPE(m2) != T_BIGNUM) || (TYPE(m2) != T_FIXNUM)) {
1426
+ m2 = rb_funcall(m2, rb_intern("to_i"), 0);
1427
+ }
1428
+ if (TYPE(s) == T_FLOAT) {
1429
+ s = rb_Array(s);
1430
+ }
1431
+ /* if ((TYPE(s) != T_ARRAY) &&
1432
+ (rb_obj_is_kind_of(s, cNArray) != Qtrue)) {
1433
+ rb_raise(rb_eTypeError, "invalid type");
1434
+ } -- no check since obj2c*ary will do that */
1435
+ if (TYPE(work) == T_FLOAT) {
1436
+ work = rb_Array(work);
1437
+ }
1438
+ /* if ((TYPE(work) != T_ARRAY) &&
1439
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
1440
+ rb_raise(rb_eTypeError, "invalid type");
1441
+ } -- no check since obj2c*ary will do that */
1442
+
1443
+ i_mm = NUM2INT(mm);
1444
+ i_jm = NUM2INT(jm);
1445
+ i_im = NUM2INT(im);
1446
+ i_isw = NUM2INT(isw);
1447
+ i_j = NUM2INT(j);
1448
+ i_m1 = NUM2INT(m1);
1449
+ i_m2 = NUM2INT(m2);
1450
+ i_s = dcl_obj2crealary(s);
1451
+ i_work = dcl_obj2crealary(work);
1452
+
1453
+ o_wj= ALLOCA_N(real, (2*i_mm+1));
1454
+ o_gj= ALLOCA_N(real, (2*i_im+1));
1455
+
1456
+ shtsgj_(&i_mm, &i_jm, &i_im, &i_isw, &i_j, &i_m1, &i_m2, i_s, o_wj, o_gj, i_work);
1457
+
1458
+ {int array_shape[1] = {2*i_mm+1};
1459
+ wj = dcl_crealary2obj(o_wj, (2*i_mm+1), 1, array_shape);
1460
+ }
1461
+ {int array_shape[1] = {2*i_im+1};
1462
+ gj = dcl_crealary2obj(o_gj, (2*i_im+1), 1, array_shape);
1463
+ }
1464
+
1465
+ dcl_freecrealary(i_s);
1466
+ dcl_freecrealary(i_work);
1467
+
1468
+ return rb_ary_new3(2, wj, gj);
1469
+
1470
+ }
1471
+
1472
+ static VALUE
1473
+ dcl_shtg2s(obj, mm, jm, im, isw, g, work)
1474
+ VALUE obj, mm, jm, im, isw, g, work;
1475
+ {
1476
+ integer i_mm;
1477
+ integer i_jm;
1478
+ integer i_im;
1479
+ integer i_isw;
1480
+ real *i_g;
1481
+ real *o_w;
1482
+ real *o_s;
1483
+ real *i_work;
1484
+ VALUE w;
1485
+ VALUE s;
1486
+
1487
+ if ((TYPE(mm) != T_BIGNUM) || (TYPE(mm) != T_FIXNUM)) {
1488
+ mm = rb_funcall(mm, rb_intern("to_i"), 0);
1489
+ }
1490
+ if ((TYPE(jm) != T_BIGNUM) || (TYPE(jm) != T_FIXNUM)) {
1491
+ jm = rb_funcall(jm, rb_intern("to_i"), 0);
1492
+ }
1493
+ if ((TYPE(im) != T_BIGNUM) || (TYPE(im) != T_FIXNUM)) {
1494
+ im = rb_funcall(im, rb_intern("to_i"), 0);
1495
+ }
1496
+ if ((TYPE(isw) != T_BIGNUM) || (TYPE(isw) != T_FIXNUM)) {
1497
+ isw = rb_funcall(isw, rb_intern("to_i"), 0);
1498
+ }
1499
+ if (TYPE(g) == T_FLOAT) {
1500
+ g = rb_Array(g);
1501
+ }
1502
+ /* if ((TYPE(g) != T_ARRAY) &&
1503
+ (rb_obj_is_kind_of(g, cNArray) != Qtrue)) {
1504
+ rb_raise(rb_eTypeError, "invalid type");
1505
+ } -- no check since obj2c*ary will do that */
1506
+ if (TYPE(work) == T_FLOAT) {
1507
+ work = rb_Array(work);
1508
+ }
1509
+ /* if ((TYPE(work) != T_ARRAY) &&
1510
+ (rb_obj_is_kind_of(work, cNArray) != Qtrue)) {
1511
+ rb_raise(rb_eTypeError, "invalid type");
1512
+ } -- no check since obj2c*ary will do that */
1513
+
1514
+ i_mm = NUM2INT(mm);
1515
+ i_jm = NUM2INT(jm);
1516
+ i_im = NUM2INT(im);
1517
+ i_isw = NUM2INT(isw);
1518
+ i_g = dcl_obj2crealary(g);
1519
+ i_work = dcl_obj2crealary(work);
1520
+
1521
+ o_w= ALLOCA_N(real, ((2*i_jm+1)*(2*i_mm+1)));
1522
+ o_s= ALLOCA_N(real, (i_mm+1)*(i_mm+1));
1523
+
1524
+ shtg2s_(&i_mm, &i_jm, &i_im, &i_isw, i_g, o_w, o_s, i_work);
1525
+
1526
+ {int array_shape[2] = {(2*i_jm+1), (2*i_mm+1)};
1527
+ w = dcl_crealary2obj(o_w, ((2*i_jm+1)*(2*i_mm+1)), 2, array_shape);
1528
+ }
1529
+ {int array_shape[1] = {(i_mm+1)*(i_mm+1)};
1530
+ s = dcl_crealary2obj(o_s, (i_mm+1)*(i_mm+1), 1, array_shape);
1531
+ }
1532
+
1533
+ dcl_freecrealary(i_g);
1534
+ dcl_freecrealary(i_work);
1535
+
1536
+ return rb_ary_new3(2, w, s);
1537
+
1538
+ }
1539
+ void
1540
+ init_math2_shtlib(mDCL)
1541
+ VALUE mDCL;
1542
+ {
1543
+ rb_define_module_function(mDCL, "shtlib", dcl_shtlib, 0);
1544
+ rb_define_module_function(mDCL, "shtint", dcl_shtint, 3);
1545
+ rb_define_module_function(mDCL, "shtlap", dcl_shtlap, 3);
1546
+ rb_define_module_function(mDCL, "shtnml", dcl_shtnml, 3);
1547
+ rb_define_module_function(mDCL, "shtfun", dcl_shtfun, 4);
1548
+ rb_define_module_function(mDCL, "shtlfw", dcl_shtlfw, 6);
1549
+ rb_define_module_function(mDCL, "shtlbw", dcl_shtlbw, 6);
1550
+ rb_define_module_function(mDCL, "shts2w", dcl_shts2w, 5);
1551
+ rb_define_module_function(mDCL, "shtswa", dcl_shtswa, 7);
1552
+ rb_define_module_function(mDCL, "shtswz", dcl_shtswz, 5);
1553
+ rb_define_module_function(mDCL, "shtswm", dcl_shtswm, 6);
1554
+ rb_define_module_function(mDCL, "shtswj", dcl_shtswj, 8);
1555
+ rb_define_module_function(mDCL, "shtw2s", dcl_shtw2s, 5);
1556
+ rb_define_module_function(mDCL, "shtw2g", dcl_shtw2g, 5);
1557
+ rb_define_module_function(mDCL, "shtwga", dcl_shtwga, 7);
1558
+ rb_define_module_function(mDCL, "shtwgm", dcl_shtwgm, 7);
1559
+ rb_define_module_function(mDCL, "shtwgz", dcl_shtwgz, 3);
1560
+ rb_define_module_function(mDCL, "shtwgj", dcl_shtwgj, 6);
1561
+ rb_define_module_function(mDCL, "shtg2w", dcl_shtg2w, 5);
1562
+ rb_define_module_function(mDCL, "shts2g", dcl_shts2g, 6);
1563
+ rb_define_module_function(mDCL, "shtsga", dcl_shtsga, 8);
1564
+ rb_define_module_function(mDCL, "shtsgz", dcl_shtsgz, 6);
1565
+ rb_define_module_function(mDCL, "shtsgm", dcl_shtsgm, 7);
1566
+ rb_define_module_function(mDCL, "shtsgj", dcl_shtsgj, 9);
1567
+ rb_define_module_function(mDCL, "shtg2s", dcl_shtg2s, 6);
1568
+ }