gccxml_gem 0.9-x86-cygwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (241) hide show
  1. data/Rakefile +75 -0
  2. data/bin/gccxml.exe +0 -0
  3. data/bin/gccxml_cc1plus.exe +0 -0
  4. data/gccxml.rb +50 -0
  5. data/share/doc/gccxml-0.9/Copyright.txt +55 -0
  6. data/share/doc/gccxml-0.9/gccxml.html +168 -0
  7. data/share/doc/gccxml-0.9/gccxml.txt +293 -0
  8. data/share/gccxml-0.9/Borland/5.5/Wrappers/algorithm +7 -0
  9. data/share/gccxml-0.9/Borland/5.5/Wrappers/algorithm.h +7 -0
  10. data/share/gccxml-0.9/Borland/5.5/Wrappers/bitset +7 -0
  11. data/share/gccxml-0.9/Borland/5.5/Wrappers/bitset.h +7 -0
  12. data/share/gccxml-0.9/Borland/5.5/Wrappers/cctype +1 -0
  13. data/share/gccxml-0.9/Borland/5.5/Wrappers/cfloat +1 -0
  14. data/share/gccxml-0.9/Borland/5.5/Wrappers/climits +1 -0
  15. data/share/gccxml-0.9/Borland/5.5/Wrappers/cmath +1 -0
  16. data/share/gccxml-0.9/Borland/5.5/Wrappers/complex +7 -0
  17. data/share/gccxml-0.9/Borland/5.5/Wrappers/complex.h +7 -0
  18. data/share/gccxml-0.9/Borland/5.5/Wrappers/cstddef +1 -0
  19. data/share/gccxml-0.9/Borland/5.5/Wrappers/cstdio +1 -0
  20. data/share/gccxml-0.9/Borland/5.5/Wrappers/cstdlib +1 -0
  21. data/share/gccxml-0.9/Borland/5.5/Wrappers/cstring +7 -0
  22. data/share/gccxml-0.9/Borland/5.5/Wrappers/cstring.h +7 -0
  23. data/share/gccxml-0.9/Borland/5.5/Wrappers/ctime +1 -0
  24. data/share/gccxml-0.9/Borland/5.5/Wrappers/cwchar +1 -0
  25. data/share/gccxml-0.9/Borland/5.5/Wrappers/cwctype +1 -0
  26. data/share/gccxml-0.9/Borland/5.5/Wrappers/deque +7 -0
  27. data/share/gccxml-0.9/Borland/5.5/Wrappers/deque.h +7 -0
  28. data/share/gccxml-0.9/Borland/5.5/Wrappers/exception +7 -0
  29. data/share/gccxml-0.9/Borland/5.5/Wrappers/exception.h +7 -0
  30. data/share/gccxml-0.9/Borland/5.5/Wrappers/fstream +7 -0
  31. data/share/gccxml-0.9/Borland/5.5/Wrappers/fstream.h +7 -0
  32. data/share/gccxml-0.9/Borland/5.5/Wrappers/function +7 -0
  33. data/share/gccxml-0.9/Borland/5.5/Wrappers/function.h +7 -0
  34. data/share/gccxml-0.9/Borland/5.5/Wrappers/functional +7 -0
  35. data/share/gccxml-0.9/Borland/5.5/Wrappers/gccxml_typeinfo.h +146 -0
  36. data/share/gccxml-0.9/Borland/5.5/Wrappers/iomanip +7 -0
  37. data/share/gccxml-0.9/Borland/5.5/Wrappers/iomanip.h +7 -0
  38. data/share/gccxml-0.9/Borland/5.5/Wrappers/ios +7 -0
  39. data/share/gccxml-0.9/Borland/5.5/Wrappers/ios.h +7 -0
  40. data/share/gccxml-0.9/Borland/5.5/Wrappers/iosfwd +7 -0
  41. data/share/gccxml-0.9/Borland/5.5/Wrappers/iosfwd.h +7 -0
  42. data/share/gccxml-0.9/Borland/5.5/Wrappers/iostream +7 -0
  43. data/share/gccxml-0.9/Borland/5.5/Wrappers/iostream.h +7 -0
  44. data/share/gccxml-0.9/Borland/5.5/Wrappers/istream +7 -0
  45. data/share/gccxml-0.9/Borland/5.5/Wrappers/istream.h +7 -0
  46. data/share/gccxml-0.9/Borland/5.5/Wrappers/iterator +7 -0
  47. data/share/gccxml-0.9/Borland/5.5/Wrappers/iterator.h +7 -0
  48. data/share/gccxml-0.9/Borland/5.5/Wrappers/limits +7 -0
  49. data/share/gccxml-0.9/Borland/5.5/Wrappers/limits.h +7 -0
  50. data/share/gccxml-0.9/Borland/5.5/Wrappers/list +7 -0
  51. data/share/gccxml-0.9/Borland/5.5/Wrappers/list.h +7 -0
  52. data/share/gccxml-0.9/Borland/5.5/Wrappers/locale +7 -0
  53. data/share/gccxml-0.9/Borland/5.5/Wrappers/locale.h +7 -0
  54. data/share/gccxml-0.9/Borland/5.5/Wrappers/map +7 -0
  55. data/share/gccxml-0.9/Borland/5.5/Wrappers/map.h +7 -0
  56. data/share/gccxml-0.9/Borland/5.5/Wrappers/memory +7 -0
  57. data/share/gccxml-0.9/Borland/5.5/Wrappers/memory.h +7 -0
  58. data/share/gccxml-0.9/Borland/5.5/Wrappers/new +7 -0
  59. data/share/gccxml-0.9/Borland/5.5/Wrappers/new.h +7 -0
  60. data/share/gccxml-0.9/Borland/5.5/Wrappers/numeric +7 -0
  61. data/share/gccxml-0.9/Borland/5.5/Wrappers/numeric.h +7 -0
  62. data/share/gccxml-0.9/Borland/5.5/Wrappers/ostream +7 -0
  63. data/share/gccxml-0.9/Borland/5.5/Wrappers/ostream.h +7 -0
  64. data/share/gccxml-0.9/Borland/5.5/Wrappers/queue +7 -0
  65. data/share/gccxml-0.9/Borland/5.5/Wrappers/queue.h +7 -0
  66. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/codecvt +1 -0
  67. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/collate +1 -0
  68. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/ctype +1 -0
  69. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/iosbase +1 -0
  70. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/iotraits +1 -0
  71. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/iterator +1 -0
  72. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/lochelp +1 -0
  73. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/locimpl +1 -0
  74. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/locvector +1 -0
  75. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/messages +1 -0
  76. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/money +1 -0
  77. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/numbrw +1 -0
  78. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/numeral +1 -0
  79. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/rwdispatch.h +1 -0
  80. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/rwlocale +1 -0
  81. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/rwstderr_macros.h +64 -0
  82. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/string_ref +1 -0
  83. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/time +1 -0
  84. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/traits +1 -0
  85. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/tree +1 -0
  86. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/usefacet +1 -0
  87. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/valimp +1 -0
  88. data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/vendor +1 -0
  89. data/share/gccxml-0.9/Borland/5.5/Wrappers/set +7 -0
  90. data/share/gccxml-0.9/Borland/5.5/Wrappers/set.h +7 -0
  91. data/share/gccxml-0.9/Borland/5.5/Wrappers/sstream +7 -0
  92. data/share/gccxml-0.9/Borland/5.5/Wrappers/sstream.h +7 -0
  93. data/share/gccxml-0.9/Borland/5.5/Wrappers/stack +7 -0
  94. data/share/gccxml-0.9/Borland/5.5/Wrappers/stack.h +7 -0
  95. data/share/gccxml-0.9/Borland/5.5/Wrappers/stdexcept +7 -0
  96. data/share/gccxml-0.9/Borland/5.5/Wrappers/stdexcept.h +7 -0
  97. data/share/gccxml-0.9/Borland/5.5/Wrappers/streambuf +7 -0
  98. data/share/gccxml-0.9/Borland/5.5/Wrappers/streambuf.h +7 -0
  99. data/share/gccxml-0.9/Borland/5.5/Wrappers/string +7 -0
  100. data/share/gccxml-0.9/Borland/5.5/Wrappers/string.h +7 -0
  101. data/share/gccxml-0.9/Borland/5.5/Wrappers/strstream +7 -0
  102. data/share/gccxml-0.9/Borland/5.5/Wrappers/strstream.h +7 -0
  103. data/share/gccxml-0.9/Borland/5.5/Wrappers/typeinfo +7 -0
  104. data/share/gccxml-0.9/Borland/5.5/Wrappers/typeinfo.h +7 -0
  105. data/share/gccxml-0.9/Borland/5.5/Wrappers/utility +7 -0
  106. data/share/gccxml-0.9/Borland/5.5/Wrappers/utility.h +7 -0
  107. data/share/gccxml-0.9/Borland/5.5/Wrappers/valarray +7 -0
  108. data/share/gccxml-0.9/Borland/5.5/Wrappers/valarray.h +7 -0
  109. data/share/gccxml-0.9/Borland/5.5/Wrappers/vector +7 -0
  110. data/share/gccxml-0.9/Borland/5.5/Wrappers/vector.h +7 -0
  111. data/share/gccxml-0.9/Borland/5.5/except.h +154 -0
  112. data/share/gccxml-0.9/Borland/5.5/gccxml_fstream.h +431 -0
  113. data/share/gccxml-0.9/Borland/5.5/gccxml_new.h +166 -0
  114. data/share/gccxml-0.9/Borland/5.5/gccxml_valarray.h +786 -0
  115. data/share/gccxml-0.9/Borland/5.5/gccxml_vector.h +1457 -0
  116. data/share/gccxml-0.9/Borland/5.5/io.h +352 -0
  117. data/share/gccxml-0.9/Borland/5.5/oaidl.h +7006 -0
  118. data/share/gccxml-0.9/Borland/5.5/propidl.h +1477 -0
  119. data/share/gccxml-0.9/Borland/5.5/rw/locimpl.h +477 -0
  120. data/share/gccxml-0.9/Borland/5.5/rw/rwlocale.h +619 -0
  121. data/share/gccxml-0.9/Borland/5.5/stdarg.h +55 -0
  122. data/share/gccxml-0.9/Borland/5.5/valarray.cc +2883 -0
  123. data/share/gccxml-0.9/GCC/2.95/algorithm +76 -0
  124. data/share/gccxml-0.9/GCC/2.95/bitset +17 -0
  125. data/share/gccxml-0.9/GCC/2.95/cctype +24 -0
  126. data/share/gccxml-0.9/GCC/2.95/clocale +14 -0
  127. data/share/gccxml-0.9/GCC/2.95/cmath +33 -0
  128. data/share/gccxml-0.9/GCC/2.95/complex +38 -0
  129. data/share/gccxml-0.9/GCC/2.95/csetjmp +13 -0
  130. data/share/gccxml-0.9/GCC/2.95/csignal +14 -0
  131. data/share/gccxml-0.9/GCC/2.95/cstdarg +12 -0
  132. data/share/gccxml-0.9/GCC/2.95/cstddef +13 -0
  133. data/share/gccxml-0.9/GCC/2.95/cstdio +55 -0
  134. data/share/gccxml-0.9/GCC/2.95/cstdlib +66 -0
  135. data/share/gccxml-0.9/GCC/2.95/cstring +34 -0
  136. data/share/gccxml-0.9/GCC/2.95/ctime +24 -0
  137. data/share/gccxml-0.9/GCC/2.95/cwchar +65 -0
  138. data/share/gccxml-0.9/GCC/2.95/cwctype +31 -0
  139. data/share/gccxml-0.9/GCC/2.95/deque +19 -0
  140. data/share/gccxml-0.9/GCC/2.95/exception +20 -0
  141. data/share/gccxml-0.9/GCC/2.95/fstream +23 -0
  142. data/share/gccxml-0.9/GCC/2.95/functional +64 -0
  143. data/share/gccxml-0.9/GCC/2.95/gccxml_bitset +1066 -0
  144. data/share/gccxml-0.9/GCC/2.95/iomanip +20 -0
  145. data/share/gccxml-0.9/GCC/2.95/iosfwd +20 -0
  146. data/share/gccxml-0.9/GCC/2.95/iostream +27 -0
  147. data/share/gccxml-0.9/GCC/2.95/iterator +39 -0
  148. data/share/gccxml-0.9/GCC/2.95/list +19 -0
  149. data/share/gccxml-0.9/GCC/2.95/map +20 -0
  150. data/share/gccxml-0.9/GCC/2.95/memory +21 -0
  151. data/share/gccxml-0.9/GCC/2.95/new +13 -0
  152. data/share/gccxml-0.9/GCC/2.95/numeric +15 -0
  153. data/share/gccxml-0.9/GCC/2.95/pthread.h +16 -0
  154. data/share/gccxml-0.9/GCC/2.95/queue +20 -0
  155. data/share/gccxml-0.9/GCC/2.95/set +20 -0
  156. data/share/gccxml-0.9/GCC/2.95/sstream +24 -0
  157. data/share/gccxml-0.9/GCC/2.95/stack +19 -0
  158. data/share/gccxml-0.9/GCC/2.95/std/bastring.cc +524 -0
  159. data/share/gccxml-0.9/GCC/2.95/std/complext.h +397 -0
  160. data/share/gccxml-0.9/GCC/2.95/std/dcomplex.h +92 -0
  161. data/share/gccxml-0.9/GCC/2.95/std/fcomplex.h +88 -0
  162. data/share/gccxml-0.9/GCC/2.95/std/gslice_array.h +170 -0
  163. data/share/gccxml-0.9/GCC/2.95/std/indirect_array.h +157 -0
  164. data/share/gccxml-0.9/GCC/2.95/std/ldcomplex.h +96 -0
  165. data/share/gccxml-0.9/GCC/2.95/std/mask_array.h +154 -0
  166. data/share/gccxml-0.9/GCC/2.95/std/slice_array.h +156 -0
  167. data/share/gccxml-0.9/GCC/2.95/std/std_valarray.h +728 -0
  168. data/share/gccxml-0.9/GCC/2.95/std/straits.h +162 -0
  169. data/share/gccxml-0.9/GCC/2.95/std/valarray_meta.h +1035 -0
  170. data/share/gccxml-0.9/GCC/2.95/stdexcept +17 -0
  171. data/share/gccxml-0.9/GCC/2.95/stl_alloc.h +1057 -0
  172. data/share/gccxml-0.9/GCC/2.95/stl_bvector.h +836 -0
  173. data/share/gccxml-0.9/GCC/2.95/stl_deque.h +1699 -0
  174. data/share/gccxml-0.9/GCC/2.95/stl_list.h +843 -0
  175. data/share/gccxml-0.9/GCC/2.95/stl_tree.h +1331 -0
  176. data/share/gccxml-0.9/GCC/2.95/stl_vector.h +828 -0
  177. data/share/gccxml-0.9/GCC/2.95/string +26 -0
  178. data/share/gccxml-0.9/GCC/2.95/strstream +23 -0
  179. data/share/gccxml-0.9/GCC/2.95/typeinfo +11 -0
  180. data/share/gccxml-0.9/GCC/2.95/utility +25 -0
  181. data/share/gccxml-0.9/GCC/2.95/valarray +52 -0
  182. data/share/gccxml-0.9/GCC/2.95/vector +19 -0
  183. data/share/gccxml-0.9/GCC/2.96/sstream +305 -0
  184. data/share/gccxml-0.9/GCC/3.0/pthread.h +16 -0
  185. data/share/gccxml-0.9/GCC/3.1/pthread.h +16 -0
  186. data/share/gccxml-0.9/GCC/3.2/bits/fstream.tcc +500 -0
  187. data/share/gccxml-0.9/GCC/3.2/bits/istream.tcc +1207 -0
  188. data/share/gccxml-0.9/GCC/3.2/bits/locale_facets.h +1810 -0
  189. data/share/gccxml-0.9/GCC/3.2/bits/locale_facets.tcc +2397 -0
  190. data/share/gccxml-0.9/GCC/3.2/bits/messages_members.h +108 -0
  191. data/share/gccxml-0.9/GCC/3.2/bits/ostream.tcc +713 -0
  192. data/share/gccxml-0.9/GCC/3.2/bits/sstream.tcc +241 -0
  193. data/share/gccxml-0.9/GCC/3.2/bits/stl_deque.h +1682 -0
  194. data/share/gccxml-0.9/GCC/3.2/bits/stl_list.h +989 -0
  195. data/share/gccxml-0.9/GCC/3.2/bits/stl_tree.h +1462 -0
  196. data/share/gccxml-0.9/GCC/3.2/bits/stl_vector.h +1085 -0
  197. data/share/gccxml-0.9/GCC/3.2/bits/valarray_meta.h +1063 -0
  198. data/share/gccxml-0.9/GCC/3.2/fstream +579 -0
  199. data/share/gccxml-0.9/GCC/3.2/pthread.h +16 -0
  200. data/share/gccxml-0.9/GCC/3.2/sstream +384 -0
  201. data/share/gccxml-0.9/GCC/3.3/bits/fstream.tcc +530 -0
  202. data/share/gccxml-0.9/GCC/3.3/bits/list.tcc +378 -0
  203. data/share/gccxml-0.9/GCC/3.3/bits/locale_facets.h +2050 -0
  204. data/share/gccxml-0.9/GCC/3.3/bits/messages_members.h +108 -0
  205. data/share/gccxml-0.9/GCC/3.3/bits/sstream.tcc +243 -0
  206. data/share/gccxml-0.9/GCC/3.3/bits/stl_deque.h +1603 -0
  207. data/share/gccxml-0.9/GCC/3.3/bits/stl_list.h +1167 -0
  208. data/share/gccxml-0.9/GCC/3.3/bits/stl_tree.h +1462 -0
  209. data/share/gccxml-0.9/GCC/3.3/bits/stl_vector.h +992 -0
  210. data/share/gccxml-0.9/GCC/3.3/bits/valarray_meta.h +1135 -0
  211. data/share/gccxml-0.9/GCC/3.3/fstream +842 -0
  212. data/share/gccxml-0.9/GCC/3.3/gccxml_builtins.h +22 -0
  213. data/share/gccxml-0.9/GCC/3.3/sstream +638 -0
  214. data/share/gccxml-0.9/GCC/3.4/gccxml_builtins.h +91 -0
  215. data/share/gccxml-0.9/GCC/4.0/gccxml_builtins.h +128 -0
  216. data/share/gccxml-0.9/GCC/4.1/bits/gthr-default.h +618 -0
  217. data/share/gccxml-0.9/GCC/4.1/gccxml_builtins.h +131 -0
  218. data/share/gccxml-0.9/GCC/4.2/gccxml_builtins.h +131 -0
  219. data/share/gccxml-0.9/GCC/find_flags +105 -0
  220. data/share/gccxml-0.9/Intel/find_flags +56 -0
  221. data/share/gccxml-0.9/Intel/pthread.h +16 -0
  222. data/share/gccxml-0.9/MIPSpro/7.3/exception +9 -0
  223. data/share/gccxml-0.9/MIPSpro/7.3/gccxml_mpro_internals.h +21 -0
  224. data/share/gccxml-0.9/MIPSpro/7.3/iomanip +161 -0
  225. data/share/gccxml-0.9/MIPSpro/7.3/ostream +9 -0
  226. data/share/gccxml-0.9/MIPSpro/7.3/stddef.h +9 -0
  227. data/share/gccxml-0.9/MIPSpro/7.3/stl_config.h +9 -0
  228. data/share/gccxml-0.9/MIPSpro/7.3/stl_locale.h +17 -0
  229. data/share/gccxml-0.9/MIPSpro/7.3/stl_monetary.h +14 -0
  230. data/share/gccxml-0.9/MIPSpro/7.3/stl_numeric_facets.h +13 -0
  231. data/share/gccxml-0.9/MIPSpro/7.3/stl_threads.h +11 -0
  232. data/share/gccxml-0.9/MIPSpro/7.3/string +18 -0
  233. data/share/gccxml-0.9/MIPSpro/find_flags +137 -0
  234. data/share/gccxml-0.9/Sun/5.8/adaptation.patch +168 -0
  235. data/share/gccxml-0.9/Sun/README +8 -0
  236. data/share/gccxml-0.9/Sun/adapt_headers.sh +24 -0
  237. data/share/gccxml-0.9/Sun/find_flags +69 -0
  238. data/share/gccxml-0.9/gccxml_config +2 -0
  239. data/share/gccxml-0.9/gccxml_find_flags +93 -0
  240. data/share/man/man1/gccxml.1 +246 -0
  241. metadata +324 -0
@@ -0,0 +1,2883 @@
1
+ #ifndef __VALARRAY_CC
2
+ #define __VALARRAY_CC
3
+ #pragma option push -b -a8 -pc -Vx- -Ve- -w-inl -w-aus -w-sig
4
+
5
+ /***************************************************************************
6
+ *
7
+ * valaray.cc - Declarations for the Standard Library valarray
8
+ *
9
+ ***************************************************************************
10
+ *
11
+ * Copyright (c) 1994-1999 Rogue Wave Software, Inc. All Rights Reserved.
12
+ *
13
+ * This computer software is owned by Rogue Wave Software, Inc. and is
14
+ * protected by U.S. copyright laws and other laws and by international
15
+ * treaties. This computer software is furnished by Rogue Wave Software,
16
+ * Inc. pursuant to a written license agreement and may be used, copied,
17
+ * transmitted, and stored only in accordance with the terms of such
18
+ * license and with the inclusion of the above copyright notice. This
19
+ * computer software or any other copies thereof may not be provided or
20
+ * otherwise made available to any other person.
21
+ *
22
+ * U.S. Government Restricted Rights. This computer software is provided
23
+ * with Restricted Rights. Use, duplication, or disclosure by the
24
+ * Government is subject to restrictions as set forth in subparagraph (c)
25
+ * (1) (ii) of The Rights in Technical Data and Computer Software clause
26
+ * at DFARS 252.227-7013 or subparagraphs (c) (1) and (2) of the
27
+ * Commercial Computer Software � Restricted Rights at 48 CFR 52.227-19,
28
+ * as applicable. Manufacturer is Rogue Wave Software, Inc., 5500
29
+ * Flatiron Parkway, Boulder, Colorado 80301 USA.
30
+ *
31
+ **************************************************************************/
32
+
33
+ #if defined ( __SUNPRO_CC ) || defined (__EDG__)
34
+ #include<stdlib.h>
35
+ #endif
36
+
37
+ #ifndef _RWSTD_NO_NAMESPACE
38
+ namespace std {
39
+ #endif
40
+
41
+ #if !defined (_RWSTD_NO_NAMESPACE) && defined (_RWSTD_NO_NEW_HEADER)
42
+ using ::abs;
43
+ using ::cos;
44
+ using ::sin;
45
+ using ::tan;
46
+ using ::asin;
47
+ using ::acos;
48
+ using ::atan;
49
+ using ::atan2;
50
+ using ::sinh;
51
+ using ::cosh;
52
+ using ::tanh;
53
+ using ::exp;
54
+ using ::log;
55
+ using ::log10;
56
+ using ::sqrt;
57
+ using ::pow;
58
+ #endif
59
+
60
+ /*****************************************************************
61
+ * *
62
+ * VALARRAY MEMBER FUNCTIONS *
63
+ * *
64
+ ******************************************************************/
65
+ // unary operators
66
+
67
+ template<class T>
68
+ valarray<T> valarray<T>::operator+() const
69
+ {
70
+ valarray<T> tmp_array(size());
71
+
72
+ for(size_t ind=0; ind< size(); ind++ )
73
+ tmp_array[ind] = +memory_array[ind];
74
+
75
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
76
+
77
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
78
+ _tmp_ret->length = size();
79
+
80
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
81
+
82
+ return _tmp_ret;
83
+ }
84
+
85
+ template <class T>
86
+ valarray<T> valarray<T>::operator-() const
87
+ {
88
+ valarray<T> tmp_array(size());
89
+
90
+ for(size_t ind=0; ind< size(); ind++ )
91
+ tmp_array[ind] = -memory_array[ind];
92
+
93
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
94
+
95
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
96
+ _tmp_ret->length = size();
97
+
98
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
99
+
100
+ return _tmp_ret;
101
+ }
102
+ #ifndef _RWSTD_NO_ONLY_NEEDED_INSTANTIATION
103
+ template <class T>
104
+ valarray<T> valarray<T>::operator~() const
105
+ {
106
+ valarray<T> tmp_array(size());
107
+
108
+ for(size_t ind=0; ind< size(); ind++ )
109
+ tmp_array[ind] = ~memory_array[ind];
110
+
111
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
112
+
113
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
114
+ _tmp_ret->length = size();
115
+
116
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
117
+
118
+ return _tmp_ret;
119
+ }
120
+
121
+ template <class T>
122
+ valarray<bool> valarray<T>::operator!() const
123
+ {
124
+ valarray<bool> tmp_array(size());
125
+
126
+ for(size_t ind=0; ind< size(); ind++ )
127
+ tmp_array[ind] = !memory_array[ind];
128
+
129
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
130
+
131
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
132
+ _tmp_ret->length = size();
133
+
134
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
135
+
136
+ return _tmp_ret;
137
+ }
138
+ #endif
139
+
140
+ // computed assignment
141
+
142
+ template <class T>
143
+ valarray<T>& valarray<T>::operator*= (const valarray<T>& array)
144
+ {
145
+ size_t upper_l = ( size() < array.size() ) ? size() : array.size();
146
+
147
+ for(size_t ind=0; ind < upper_l; ind++)
148
+ memory_array[ind]*= array[ind];
149
+
150
+ return *this;
151
+ }
152
+
153
+ template <class T>
154
+ valarray<T>& valarray<T>::operator/= (const valarray<T>& array)
155
+ {
156
+ size_t upper_l = ( size() < array.size() ) ? size() : array.size();
157
+
158
+ for(size_t ind=0; ind < upper_l; ind++)
159
+ memory_array[ind]/= array[ind];
160
+
161
+ return *this;
162
+ }
163
+
164
+ template <class T>
165
+ valarray<T>& valarray<T>::operator+= (const valarray<T>& array)
166
+ {
167
+ size_t upper_l = ( size() < array.size() ) ? size() : array.size();
168
+
169
+ for(size_t ind=0; ind < upper_l; ind++)
170
+ memory_array[ind]+= array[ind];
171
+
172
+ return *this;
173
+ }
174
+
175
+ template <class T>
176
+ valarray<T>& valarray<T>::operator-= (const valarray<T>& array)
177
+ {
178
+ size_t upper_l = ( size() < array.size() ) ? size() : array.size();
179
+
180
+ for(size_t ind=0; ind < upper_l; ind++)
181
+ memory_array[ind]-= array[ind];
182
+
183
+ return *this;
184
+ }
185
+
186
+ #ifndef _RWSTD_NO_ONLY_NEEDED_INSTANTIATION
187
+ template <class T>
188
+ valarray<T>& valarray<T>::operator%= (const valarray<T>& array)
189
+ {
190
+ size_t upper_l = ( size() < array.size() ) ? size() : array.size();
191
+
192
+ for(size_t ind=0; ind < upper_l; ind++)
193
+ memory_array[ind]%= array[ind];
194
+
195
+ return *this;
196
+ }
197
+
198
+ template <class T>
199
+ valarray<T>& valarray<T>::operator^= (const valarray<T>& array)
200
+ {
201
+ size_t upper_l = ( size() < array.size() ) ? size() : array.size();
202
+
203
+ for(size_t ind=0; ind < upper_l; ind++)
204
+ memory_array[ind]^= array[ind];
205
+
206
+ return *this;
207
+ }
208
+
209
+ template <class T>
210
+ valarray<T>& valarray<T>::operator&= (const valarray<T>& array)
211
+ {
212
+ size_t upper_l = ( size() < array.size() ) ? size() : array.size();
213
+
214
+ for(size_t ind=0; ind < upper_l; ind++)
215
+ memory_array[ind]&= array[ind];
216
+
217
+ return *this;
218
+ }
219
+
220
+ template <class T>
221
+ valarray<T>& valarray<T>::operator|= (const valarray<T>& array)
222
+ {
223
+ size_t upper_l = ( size() < array.size() ) ? size() : array.size();
224
+
225
+ for(size_t ind=0; ind < upper_l; ind++)
226
+ memory_array[ind]|= array[ind];
227
+
228
+ return *this;
229
+ }
230
+
231
+ template <class T>
232
+ valarray<T>& valarray<T>::operator<<= (const valarray<T>& array)
233
+ {
234
+ size_t upper_l = ( size() < array.size() ) ? size() : array.size();
235
+
236
+ for(size_t ind=0; ind < upper_l; ind++)
237
+ memory_array[ind]<<= array[ind];
238
+
239
+ return *this;
240
+ }
241
+
242
+ template <class T>
243
+ valarray<T>& valarray<T>::operator>>= (const valarray<T>& array)
244
+ {
245
+ size_t upper_l = ( size() < array.size() ) ? size() : array.size();
246
+
247
+ for(size_t ind=0; ind < upper_l; ind++)
248
+ memory_array[ind]>>= array[ind];
249
+
250
+ return *this;
251
+ }
252
+ #endif
253
+
254
+ template <class T>
255
+ valarray<T>& valarray<T>::operator*= (const T& val)
256
+ {
257
+ for(size_t ind=0; ind < size(); ind++)
258
+ memory_array[ind]*= val;
259
+
260
+ return *this;
261
+ }
262
+
263
+ template <class T>
264
+ valarray<T>& valarray<T>::operator/= (const T& val)
265
+ {
266
+ for(size_t ind=0; ind < size(); ind++)
267
+ memory_array[ind]/= val;
268
+
269
+ return *this;
270
+ }
271
+
272
+ template <class T>
273
+ valarray<T>& valarray<T>::operator+= (const T& val)
274
+ {
275
+ for(size_t ind=0; ind < size(); ind++)
276
+ memory_array[ind]+= val;
277
+
278
+ return *this;
279
+ }
280
+
281
+ template <class T>
282
+ valarray<T>& valarray<T>::operator-= (const T& val)
283
+ {
284
+ for(size_t ind=0; ind < size(); ind++)
285
+ memory_array[ind]-= val;
286
+
287
+ return *this;
288
+ }
289
+
290
+ #ifndef _RWSTD_NO_ONLY_NEEDED_INSTANTIATION
291
+ template <class T>
292
+ valarray<T>& valarray<T>::operator%= (const T& val)
293
+ {
294
+ for(size_t ind=0; ind < size(); ind++)
295
+ memory_array[ind]%= val;
296
+
297
+ return *this;
298
+ }
299
+
300
+ template <class T>
301
+ valarray<T>& valarray<T>::operator^= (const T& val)
302
+ {
303
+ for(size_t ind=0; ind < size(); ind++)
304
+ memory_array[ind]^= val;
305
+
306
+ return *this;
307
+ }
308
+
309
+ template <class T>
310
+ valarray<T>& valarray<T>::operator&= (const T& val)
311
+ {
312
+ for(size_t ind=0; ind < size(); ind++)
313
+ memory_array[ind]&= val;
314
+
315
+ return *this;
316
+ }
317
+
318
+ template <class T>
319
+ valarray<T>& valarray<T>::operator|= (const T& val)
320
+ {
321
+ for(size_t ind=0; ind < size(); ind++)
322
+ memory_array[ind]|= val;
323
+
324
+ return *this;
325
+ }
326
+
327
+ template <class T>
328
+ valarray<T>& valarray<T>::operator<<= (const T& val)
329
+ {
330
+ for(size_t ind=0; ind < size(); ind++)
331
+ memory_array[ind]<<= val;
332
+
333
+ return *this;
334
+ }
335
+
336
+ template <class T>
337
+ valarray<T>& valarray<T>::operator>>= (const T& val)
338
+ {
339
+ for(size_t ind=0; ind < size(); ind++)
340
+ memory_array[ind]>>= val;
341
+
342
+ return *this;
343
+ }
344
+ #endif
345
+
346
+ // other valarray member functions
347
+
348
+ template <class T>
349
+ T valarray<T>::sum() const
350
+ {
351
+ T tmp;
352
+ if ( size() > 0 )
353
+ {
354
+ tmp = memory_array[0];
355
+ for(size_t ind=1; ind<size(); ind++)
356
+ tmp+= memory_array[ind];
357
+ }
358
+
359
+ return tmp;
360
+ }
361
+
362
+ template <class T>
363
+ valarray<T> valarray<T>::shift(int sh) const
364
+ {
365
+ valarray<T> tmp_array(static_cast<T>(T()),size());
366
+
367
+ int right=0;
368
+ int left=0;
369
+
370
+ if ( sh < 0 ) right = -sh;
371
+ else left = sh;
372
+
373
+ for(size_t ind=left; ind< (size()-right); ind++ )
374
+ tmp_array[ind+right-left] = memory_array[ind];
375
+
376
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
377
+
378
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
379
+ _tmp_ret->length = size();
380
+
381
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
382
+
383
+ return _tmp_ret;
384
+ }
385
+
386
+ template <class T>
387
+ valarray<T> valarray<T>::cshift(int sh) const
388
+ {
389
+ valarray<T> tmp_array(static_cast<T>(T()),size());
390
+
391
+ if ( sh >= 0 )
392
+ {
393
+ for(size_t ind=0; ind< size(); ind++ )
394
+ tmp_array[ind] = memory_array[(ind+sh)%size()];
395
+ }
396
+ else
397
+ {
398
+ for(size_t ind=size()+sh; ind< (2*size()+sh); ind++ )
399
+ tmp_array[ind-size()-sh] = memory_array[ind%size()];
400
+ }
401
+
402
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
403
+
404
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
405
+ _tmp_ret->length = size();
406
+
407
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
408
+
409
+ return _tmp_ret;
410
+ }
411
+
412
+ template <class T>
413
+ valarray<T> valarray<T>::apply(T func(T)) const
414
+ {
415
+ valarray<T> tmp_array(size());
416
+
417
+ for(size_t ind=0; ind< size(); ind++ )
418
+ tmp_array[ind] = func(memory_array[ind]);
419
+
420
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
421
+
422
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
423
+ _tmp_ret->length = size();
424
+
425
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
426
+
427
+ return _tmp_ret;
428
+ }
429
+
430
+ template <class T>
431
+ valarray<T> valarray<T>::apply(T func(const T&)) const
432
+ {
433
+ valarray<T> tmp_array(size());
434
+
435
+ for(size_t ind=0; ind< size(); ind++ )
436
+ tmp_array[ind] = func(memory_array[ind]);
437
+
438
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
439
+
440
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
441
+ _tmp_ret->length = size();
442
+
443
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
444
+
445
+ return _tmp_ret;
446
+ }
447
+
448
+ // operator[] for slice
449
+
450
+ template <class T>
451
+ valarray<T> valarray<T>::operator[](slice sl) const
452
+ {
453
+ valarray<T> tmp_array(sl.size());
454
+
455
+ size_t ind = sl.start();
456
+ size_t cpt = 0;
457
+
458
+ while( cpt < sl.size() )
459
+ {
460
+ tmp_array[cpt] = memory_array[ind];
461
+ ind+= sl.stride();
462
+ cpt++;
463
+ }
464
+
465
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
466
+
467
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
468
+ _tmp_ret->length = sl.size();
469
+
470
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
471
+
472
+ return _tmp_ret;
473
+ }
474
+
475
+ // copy ctor and assignment for slice
476
+
477
+ template <class T>
478
+ valarray<T>::valarray(const slice_array<T>& sl_ar)
479
+ {
480
+ valarray<T> tmp_array(sl_ar.get_slice().size());
481
+
482
+ size_t ind = sl_ar.get_slice().start();
483
+ size_t cpt = 0;
484
+
485
+ while( cpt < sl_ar.get_slice().size() )
486
+ {
487
+ tmp_array[cpt] = (*(sl_ar.get_ref_mem_array()))[ind];
488
+ ind+= sl_ar.get_slice().stride();
489
+ cpt++;
490
+ }
491
+ memory_array._replace(tmp_array._RW_get_memory_array()._RW_get_storage(),sl_ar.get_slice().size());
492
+
493
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
494
+ }
495
+
496
+ template <class T>
497
+ valarray<T>& valarray<T>::operator= (const slice_array<T>& sl_ar)
498
+ {
499
+ valarray<T> tmp_array(sl_ar.get_slice().size());
500
+
501
+ size_t ind = sl_ar.get_slice().start();
502
+ size_t cpt = 0;
503
+
504
+ while( cpt < sl_ar.get_slice().size() )
505
+ {
506
+ tmp_array[cpt] = (*(sl_ar.get_ref_mem_array()))[ind];
507
+ ind+= sl_ar.get_slice().stride();
508
+ cpt++;
509
+ }
510
+
511
+ if ( &memory_array == sl_ar.get_ref_mem_array() )
512
+ memory_array._RW_resize_without_copy(0);
513
+
514
+ memory_array._replace(tmp_array._RW_get_memory_array()._RW_get_storage(),sl_ar.get_slice().size());
515
+
516
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
517
+
518
+ return *this;
519
+ }
520
+
521
+ // operator[] for gslice
522
+
523
+ template <class T>
524
+ valarray<T> valarray<T>::operator[](const gslice& sl) const
525
+ {
526
+ valarray<T> tmp_array(sl.ind_numb());
527
+
528
+ gslice *gsl = (gslice *)&sl;
529
+
530
+ size_t ind = gsl->next_ind();
531
+ size_t cpt = 0;
532
+
533
+ while( !sl.is_reseted() )
534
+ {
535
+ tmp_array[cpt] = memory_array[ind];
536
+ ind= gsl->next_ind();
537
+ cpt++;
538
+ }
539
+
540
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
541
+
542
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
543
+ _tmp_ret->length = tmp_array.size();
544
+
545
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
546
+
547
+ return _tmp_ret;
548
+ }
549
+
550
+ // copy ctor and assignment for gslice
551
+
552
+ template <class T>
553
+ valarray<T>::valarray(const gslice_array<T>& sl_ar)
554
+ {
555
+ gslice sl(sl_ar.get_slice());
556
+ valarray<T> tmp_array(sl.ind_numb());
557
+
558
+ size_t ind = sl.next_ind();
559
+ size_t cpt = 0;
560
+
561
+ while( !sl.is_reseted() )
562
+ {
563
+ tmp_array[cpt] = (*(sl_ar.get_ref_mem_array()))[ind];
564
+ ind= sl.next_ind();
565
+ cpt++;
566
+ }
567
+
568
+ memory_array._replace(tmp_array._RW_get_memory_array()._RW_get_storage(),tmp_array.size());
569
+
570
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
571
+ }
572
+
573
+ template <class T>
574
+ valarray<T>& valarray<T>::operator= (const gslice_array<T>& sl_ar)
575
+ {
576
+ gslice sl(sl_ar.get_slice());
577
+ valarray<T> tmp_array(sl.ind_numb());
578
+
579
+ size_t ind = sl.next_ind();
580
+ size_t cpt = 0;
581
+
582
+ while( !sl.is_reseted() )
583
+ {
584
+ tmp_array[cpt] = (*(sl_ar.get_ref_mem_array()))[ind];
585
+ ind= sl.next_ind();
586
+ cpt++;
587
+ }
588
+
589
+ if ( &memory_array == sl_ar.get_ref_mem_array() )
590
+ memory_array._RW_resize_without_copy(0);
591
+
592
+ memory_array._replace(tmp_array._RW_get_memory_array()._RW_get_storage(),tmp_array.size());
593
+
594
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
595
+
596
+ return *this;
597
+ }
598
+ // operator[] for valarray[valarray<bool>] used with mask_array
599
+ template <class T>
600
+ valarray<T> valarray<T>::operator[](const valarray<bool>& array) const
601
+ {
602
+ size_t iter,size =0;
603
+
604
+ for(iter=0; iter < array.size(); iter++ )
605
+ if ( array[iter] ) size++;
606
+
607
+ valarray<T> tmp_array(size);
608
+
609
+ size_t cpt = 0;
610
+
611
+ for( iter=0; iter < array.size(); iter++ )
612
+ if ( array[iter] ) tmp_array[cpt++] = memory_array[iter];
613
+
614
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
615
+
616
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
617
+ _tmp_ret->length = size;
618
+
619
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
620
+
621
+ return _tmp_ret;
622
+ }
623
+
624
+ // copy ctor and assignment for mask_array
625
+
626
+ template <class T>
627
+ valarray<T>::valarray(const mask_array<T>& mask)
628
+ {
629
+
630
+ mask_array<T> *msk = (mask_array<T> *)&mask;
631
+ valarray<bool>* sec = msk->get_array_pt();
632
+
633
+ size_t iter,size =0;
634
+
635
+ for(iter=0; iter < sec->size(); iter++ )
636
+ if ( (*sec)[iter] ) size++;
637
+
638
+ valarray<T> tmp_array(size);
639
+
640
+ size_t cpt = 0;
641
+
642
+ for( iter=0; iter < sec->size(); iter++ )
643
+ if ( (*sec)[iter] ) tmp_array[cpt++] = (*(mask.get_ref_mem_array()))[iter];
644
+
645
+ memory_array._replace(tmp_array._RW_get_memory_array()._RW_get_storage(),size);
646
+
647
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
648
+ }
649
+
650
+ template <class T>
651
+ valarray<T>& valarray<T>::operator= (const mask_array<T>& mask)
652
+ {
653
+ mask_array<T> *msk = (mask_array<T> *)&mask;
654
+ valarray<bool>* sec = msk->get_array_pt();
655
+
656
+ size_t iter,size =0;
657
+
658
+ for(iter=0; iter < sec->size(); iter++ )
659
+ if ( (*sec)[iter] ) size++;
660
+
661
+ valarray<T> tmp_array(size);
662
+
663
+ size_t cpt = 0;
664
+
665
+ for( iter=0; iter < sec->size(); iter++ )
666
+ if ( (*sec)[iter] ) tmp_array[cpt++] = (*(mask.get_ref_mem_array()))[iter];
667
+
668
+ if ( &memory_array == mask.get_ref_mem_array() )
669
+ memory_array._RW_resize_without_copy(0);
670
+
671
+ memory_array._replace(tmp_array._RW_get_memory_array()._RW_get_storage(),size);
672
+
673
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
674
+
675
+ return *this;
676
+ }
677
+
678
+ // operator[] for valarray[valarray<size_t>] used with indirect_array
679
+
680
+ template <class T>
681
+ valarray<T> valarray<T>::operator[](const valarray<size_t>& array) const
682
+ {
683
+ valarray<T> tmp_array(array.size());
684
+
685
+ for( size_t iter=0; iter < array.size(); iter++ )
686
+ tmp_array[iter] = memory_array[array[iter]];
687
+
688
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
689
+
690
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
691
+ _tmp_ret->length = array.size();
692
+
693
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
694
+
695
+ return _tmp_ret;
696
+ }
697
+
698
+ // copy ctor and assignment for indirect_array
699
+
700
+ template <class T>
701
+ valarray<T>::valarray(const indirect_array<T>& indir)
702
+ {
703
+
704
+ indirect_array<T> *indr= (indirect_array<T> *)&indir;
705
+ valarray<size_t>* sec = indr->get_array_pt();
706
+
707
+ valarray<T> tmp_array(sec->size());
708
+
709
+ size_t cpt = 0;
710
+
711
+ for(size_t iter=0; iter < sec->size(); iter++ )
712
+ tmp_array[cpt++] = (*(indir.get_ref_mem_array()))[(*sec)[iter]];
713
+
714
+ memory_array._replace(tmp_array._RW_get_memory_array()._RW_get_storage(),sec->size());
715
+
716
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
717
+ }
718
+ template <class T>
719
+ valarray<T>& valarray<T>::operator= (const indirect_array<T>& indir)
720
+ {
721
+ indirect_array<T> *indr= (indirect_array<T> *)&indir;
722
+ valarray<size_t>* sec = indr->get_array_pt();
723
+
724
+ valarray<T> tmp_array(sec->size());
725
+
726
+ size_t cpt = 0;
727
+
728
+ for(size_t iter=0; iter < sec->size(); iter++ )
729
+ tmp_array[cpt++] = (*(indir.get_ref_mem_array()))[(*sec)[iter]];
730
+
731
+ if ( &memory_array == indir.get_ref_mem_array() )
732
+ memory_array._RW_resize_without_copy(0);
733
+
734
+ memory_array._replace(tmp_array._RW_get_memory_array()._RW_get_storage(),sec->size());
735
+
736
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
737
+
738
+ return *this;
739
+ }
740
+ /*
741
+ *
742
+ * VALARRAY NON MEMBER FUNCTIONS
743
+ *
744
+ */
745
+ template<class T>
746
+ valarray<T> operator* (const valarray<T>& a, const valarray<T>& b)
747
+ {
748
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
749
+ valarray<T> tmp_array(length);
750
+
751
+ for(size_t ind=0; ind< length; ind++ )
752
+ tmp_array[ind] = a[ind]*b[ind];
753
+
754
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
755
+
756
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
757
+ _tmp_ret->length = length;
758
+
759
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
760
+
761
+ return _tmp_ret;
762
+ }
763
+
764
+ template<class T>
765
+ valarray<T> operator/ (const valarray<T>& a, const valarray<T>& b)
766
+ {
767
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
768
+ valarray<T> tmp_array(length);
769
+
770
+ for(size_t ind=0; ind< length; ind++ )
771
+ tmp_array[ind] = a[ind]/b[ind];
772
+
773
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
774
+
775
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
776
+ _tmp_ret->length = length;
777
+
778
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
779
+
780
+ return _tmp_ret;
781
+ }
782
+
783
+ template<class T>
784
+ valarray<T> operator% (const valarray<T>& a, const valarray<T>& b)
785
+ {
786
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
787
+ valarray<T> tmp_array(length);
788
+
789
+ for(size_t ind=0; ind< length; ind++ )
790
+ tmp_array[ind] = a[ind]%b[ind];
791
+
792
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
793
+
794
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
795
+ _tmp_ret->length = length;
796
+
797
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
798
+
799
+ return _tmp_ret;
800
+ }
801
+
802
+ template<class T>
803
+ valarray<T> operator+ (const valarray<T>& a, const valarray<T>& b)
804
+ {
805
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
806
+ valarray<T> tmp_array(length);
807
+
808
+ for(size_t ind=0; ind< length; ind++ )
809
+ tmp_array[ind] = a[ind]+b[ind];
810
+
811
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
812
+
813
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
814
+ _tmp_ret->length = length;
815
+
816
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
817
+
818
+ return _tmp_ret;
819
+ }
820
+
821
+ template<class T>
822
+ valarray<T> operator- (const valarray<T>& a, const valarray<T>& b)
823
+ {
824
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
825
+ valarray<T> tmp_array(length);
826
+
827
+ for(size_t ind=0; ind< length; ind++ )
828
+ tmp_array[ind] = a[ind]-b[ind];
829
+
830
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
831
+
832
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
833
+ _tmp_ret->length = length;
834
+
835
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
836
+
837
+ return _tmp_ret;
838
+ }
839
+ template<class T>
840
+ valarray<T> operator^ (const valarray<T>& a, const valarray<T>& b)
841
+ {
842
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
843
+ valarray<T> tmp_array(length);
844
+
845
+ for(size_t ind=0; ind< length; ind++ )
846
+ tmp_array[ind] = a[ind]^b[ind];
847
+
848
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
849
+
850
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
851
+ _tmp_ret->length = length;
852
+
853
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
854
+
855
+ return _tmp_ret;
856
+ }
857
+
858
+ template<class T>
859
+ valarray<T> operator& (const valarray<T>& a, const valarray<T>& b)
860
+ {
861
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
862
+ valarray<T> tmp_array(length);
863
+
864
+ for(size_t ind=0; ind< length; ind++ )
865
+ tmp_array[ind] = a[ind]&b[ind];
866
+
867
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
868
+
869
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
870
+ _tmp_ret->length = length;
871
+
872
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
873
+
874
+ return _tmp_ret;
875
+ }
876
+
877
+ template<class T>
878
+ valarray<T> operator| (const valarray<T>& a, const valarray<T>& b)
879
+ {
880
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
881
+ valarray<T> tmp_array(length);
882
+
883
+ for(size_t ind=0; ind< length; ind++ )
884
+ tmp_array[ind] = a[ind]|b[ind];
885
+
886
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
887
+
888
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
889
+ _tmp_ret->length = length;
890
+
891
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
892
+
893
+ return _tmp_ret;
894
+ }
895
+
896
+ template<class T>
897
+ valarray<T> operator<< (const valarray<T>& a, const valarray<T>& b)
898
+ {
899
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
900
+ valarray<T> tmp_array(length);
901
+
902
+ for(size_t ind=0; ind< length; ind++ )
903
+ tmp_array[ind] = a[ind]<<b[ind];
904
+
905
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
906
+
907
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
908
+ _tmp_ret->length = length;
909
+
910
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
911
+
912
+ return _tmp_ret;
913
+ }
914
+
915
+ template<class T>
916
+ valarray<T> operator>> (const valarray<T>& a, const valarray<T>& b)
917
+ {
918
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
919
+ valarray<T> tmp_array(length);
920
+
921
+ for(size_t ind=0; ind< length; ind++ )
922
+ tmp_array[ind] = a[ind]>>b[ind];
923
+
924
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
925
+
926
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
927
+ _tmp_ret->length = length;
928
+
929
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
930
+
931
+ return _tmp_ret;
932
+ }
933
+
934
+ template<class T>
935
+ valarray<bool> operator&& (const valarray<T>& a, const valarray<T>& b)
936
+ {
937
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
938
+ valarray<bool> tmp_array(length);
939
+
940
+ for(size_t ind=0; ind< length; ind++ )
941
+ tmp_array[ind] = a[ind] && b[ind];
942
+
943
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
944
+
945
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
946
+ _tmp_ret->length = length;
947
+
948
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
949
+
950
+ return _tmp_ret;
951
+ }
952
+
953
+ template<class T>
954
+ valarray<bool> operator|| (const valarray<T>& a, const valarray<T>& b)
955
+ {
956
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
957
+ valarray<bool> tmp_array(length);
958
+
959
+ for(size_t ind=0; ind< length; ind++ )
960
+ tmp_array[ind] = a[ind] || b[ind];
961
+
962
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
963
+
964
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
965
+ _tmp_ret->length = length;
966
+
967
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
968
+
969
+ return _tmp_ret;
970
+ }
971
+
972
+ // with non array second parameter
973
+
974
+ template<class T>
975
+ valarray<T> operator* (const valarray<T>& a, const T& b)
976
+ {
977
+ size_t length= a.size();
978
+ valarray<T> tmp_array(length);
979
+
980
+ for(size_t ind=0; ind< length; ind++ )
981
+ tmp_array[ind] = a[ind]*b;
982
+
983
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
984
+
985
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
986
+ _tmp_ret->length = length;
987
+
988
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
989
+
990
+ return _tmp_ret;
991
+ }
992
+
993
+ template<class T>
994
+ valarray<T> operator/ (const valarray<T>& a, const T& b)
995
+ {
996
+ size_t length= a.size();
997
+ valarray<T> tmp_array(length);
998
+
999
+ for(size_t ind=0; ind< length; ind++ )
1000
+ tmp_array[ind] = a[ind]/b;
1001
+
1002
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1003
+
1004
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1005
+ _tmp_ret->length = length;
1006
+
1007
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1008
+
1009
+ return _tmp_ret;
1010
+ }
1011
+
1012
+ template<class T>
1013
+ valarray<T> operator% (const valarray<T>& a,const T& b)
1014
+ {
1015
+ size_t length= a.size();
1016
+ valarray<T> tmp_array(length);
1017
+
1018
+ for(size_t ind=0; ind< length; ind++ )
1019
+ tmp_array[ind] = a[ind]%b;
1020
+
1021
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1022
+
1023
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1024
+ _tmp_ret->length = length;
1025
+
1026
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1027
+
1028
+ return _tmp_ret;
1029
+ }
1030
+
1031
+ template<class T>
1032
+ valarray<T> operator+ (const valarray<T>& a, const T& b)
1033
+ {
1034
+ size_t length= a.size();
1035
+ valarray<T> tmp_array(length);
1036
+
1037
+ for(size_t ind=0; ind< length; ind++ )
1038
+ tmp_array[ind] = a[ind]+b;
1039
+
1040
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1041
+
1042
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1043
+ _tmp_ret->length = length;
1044
+
1045
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1046
+
1047
+ return _tmp_ret;
1048
+ }
1049
+
1050
+ template<class T>
1051
+ valarray<T> operator- (const valarray<T>& a, const T& b)
1052
+ {
1053
+ size_t length= a.size();
1054
+ valarray<T> tmp_array(length);
1055
+
1056
+ for(size_t ind=0; ind< length; ind++ )
1057
+ tmp_array[ind] = a[ind]-b;
1058
+
1059
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1060
+
1061
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1062
+ _tmp_ret->length = length;
1063
+
1064
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1065
+
1066
+ return _tmp_ret;
1067
+ }
1068
+ template<class T>
1069
+ valarray<T> operator^ (const valarray<T>& a, const T& b)
1070
+ {
1071
+ size_t length= a.size();
1072
+ valarray<T> tmp_array(length);
1073
+
1074
+ for(size_t ind=0; ind< length; ind++ )
1075
+ tmp_array[ind] = a[ind]^b;
1076
+
1077
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1078
+
1079
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1080
+ _tmp_ret->length = length;
1081
+
1082
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1083
+
1084
+ return _tmp_ret;
1085
+ }
1086
+
1087
+ template<class T>
1088
+ valarray<T> operator& (const valarray<T>& a, const T& b)
1089
+ {
1090
+ size_t length= a.size();
1091
+ valarray<T> tmp_array(length);
1092
+
1093
+ for(size_t ind=0; ind< length; ind++ )
1094
+ tmp_array[ind] = a[ind]&b;
1095
+
1096
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1097
+
1098
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1099
+ _tmp_ret->length = length;
1100
+
1101
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1102
+
1103
+ return _tmp_ret;
1104
+ }
1105
+
1106
+ template<class T>
1107
+ valarray<T> operator| (const valarray<T>& a, const T& b)
1108
+ {
1109
+ size_t length= a.size();
1110
+ valarray<T> tmp_array(length);
1111
+
1112
+ for(size_t ind=0; ind< length; ind++ )
1113
+ tmp_array[ind] = a[ind]|b;
1114
+
1115
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1116
+
1117
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1118
+ _tmp_ret->length = length;
1119
+
1120
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1121
+
1122
+ return _tmp_ret;
1123
+ }
1124
+
1125
+ template<class T>
1126
+ valarray<T> operator<< (const valarray<T>& a, const T& b)
1127
+ {
1128
+ size_t length= a.size();
1129
+ valarray<T> tmp_array(length);
1130
+
1131
+ for(size_t ind=0; ind< length; ind++ )
1132
+ tmp_array[ind] = a[ind]<<b;
1133
+
1134
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1135
+
1136
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1137
+ _tmp_ret->length = length;
1138
+
1139
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1140
+
1141
+ return _tmp_ret;
1142
+ }
1143
+
1144
+ template<class T>
1145
+ valarray<T> operator>> (const valarray<T>& a, const T& b)
1146
+ {
1147
+ size_t length= a.size();
1148
+ valarray<T> tmp_array(length);
1149
+
1150
+ for(size_t ind=0; ind< length; ind++ )
1151
+ tmp_array[ind] = a[ind]>>b;
1152
+
1153
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1154
+
1155
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1156
+ _tmp_ret->length = length;
1157
+
1158
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1159
+
1160
+ return _tmp_ret;
1161
+ }
1162
+
1163
+ template<class T>
1164
+ valarray<bool> operator&& (const valarray<T>& a, const T& b)
1165
+ {
1166
+ size_t length= a.size();
1167
+ valarray<bool> tmp_array(length);
1168
+
1169
+ for(size_t ind=0; ind< length; ind++ )
1170
+ tmp_array[ind] = a[ind] && b;
1171
+
1172
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1173
+
1174
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1175
+ _tmp_ret->length = length;
1176
+
1177
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1178
+
1179
+ return _tmp_ret;
1180
+ }
1181
+
1182
+ template<class T>
1183
+ valarray<bool> operator|| (const valarray<T>& a, const T& b)
1184
+ {
1185
+ size_t length= a.size();
1186
+ valarray<bool> tmp_array(length);
1187
+
1188
+ for(size_t ind=0; ind< length; ind++ )
1189
+ tmp_array[ind] = a[ind] || b;
1190
+
1191
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1192
+
1193
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1194
+ _tmp_ret->length = length;
1195
+
1196
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1197
+
1198
+ return _tmp_ret;
1199
+ }
1200
+
1201
+ // with non array first parameter
1202
+
1203
+ template<class T>
1204
+ valarray<T> operator* (const T& a, const valarray<T>& b)
1205
+ {
1206
+ size_t length= b.size();
1207
+ valarray<T> tmp_array(length);
1208
+
1209
+ for(size_t ind=0; ind< length; ind++ )
1210
+ tmp_array[ind] = a*b[ind];
1211
+
1212
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1213
+
1214
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1215
+ _tmp_ret->length = length;
1216
+
1217
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1218
+
1219
+ return _tmp_ret;
1220
+ }
1221
+
1222
+ template<class T>
1223
+ valarray<T> operator/ (const T& a, const valarray<T>& b)
1224
+ {
1225
+ size_t length= b.size();
1226
+ valarray<T> tmp_array(length);
1227
+
1228
+ for(size_t ind=0; ind< length; ind++ )
1229
+ tmp_array[ind] = a/b[ind];
1230
+
1231
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1232
+
1233
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1234
+ _tmp_ret->length = length;
1235
+
1236
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1237
+
1238
+ return _tmp_ret;
1239
+ }
1240
+
1241
+ template<class T>
1242
+ valarray<T> operator% (const T& a, const valarray<T>& b)
1243
+ {
1244
+ size_t length= b.size();
1245
+ valarray<T> tmp_array(length);
1246
+
1247
+ for(size_t ind=0; ind< length; ind++ )
1248
+ tmp_array[ind] = a%b[ind];
1249
+
1250
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1251
+
1252
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1253
+ _tmp_ret->length = length;
1254
+
1255
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1256
+
1257
+ return _tmp_ret;
1258
+ }
1259
+
1260
+ template<class T>
1261
+ valarray<T> operator+ (const T& a, const valarray<T>& b)
1262
+ {
1263
+ size_t length= b.size();
1264
+ valarray<T> tmp_array(length);
1265
+
1266
+ for(size_t ind=0; ind< length; ind++ )
1267
+ tmp_array[ind] = a+b[ind];
1268
+
1269
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1270
+
1271
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1272
+ _tmp_ret->length = length;
1273
+
1274
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1275
+
1276
+ return _tmp_ret;
1277
+ }
1278
+
1279
+ template<class T>
1280
+ valarray<T> operator- (const T& a, const valarray<T>& b)
1281
+ {
1282
+ size_t length= b.size();
1283
+ valarray<T> tmp_array(length);
1284
+
1285
+ for(size_t ind=0; ind< length; ind++ )
1286
+ tmp_array[ind] = a-b[ind];
1287
+
1288
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1289
+
1290
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1291
+ _tmp_ret->length = length;
1292
+
1293
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1294
+
1295
+ return _tmp_ret;
1296
+ }
1297
+ template<class T>
1298
+ valarray<T> operator^ (const T& a, const valarray<T>& b)
1299
+ {
1300
+ size_t length= b.size();
1301
+ valarray<T> tmp_array(length);
1302
+
1303
+ for(size_t ind=0; ind< length; ind++ )
1304
+ tmp_array[ind] = a^b[ind];
1305
+
1306
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1307
+
1308
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1309
+ _tmp_ret->length = length;
1310
+
1311
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1312
+
1313
+ return _tmp_ret;
1314
+ }
1315
+
1316
+ template<class T>
1317
+ valarray<T> operator& (const T& a, const valarray<T>& b)
1318
+ {
1319
+ size_t length= b.size();
1320
+ valarray<T> tmp_array(length);
1321
+
1322
+ for(size_t ind=0; ind< length; ind++ )
1323
+ tmp_array[ind] = a&b[ind];
1324
+
1325
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1326
+
1327
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1328
+ _tmp_ret->length = length;
1329
+
1330
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1331
+
1332
+ return _tmp_ret;
1333
+ }
1334
+
1335
+ template<class T>
1336
+ valarray<T> operator| (const T& a, const valarray<T>& b)
1337
+ {
1338
+ size_t length= b.size();
1339
+ valarray<T> tmp_array(length);
1340
+
1341
+ for(size_t ind=0; ind< length; ind++ )
1342
+ tmp_array[ind] = a|b[ind];
1343
+
1344
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1345
+
1346
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1347
+ _tmp_ret->length = length;
1348
+
1349
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1350
+
1351
+ return _tmp_ret;
1352
+ }
1353
+
1354
+ template<class T>
1355
+ valarray<T> operator<< (const T& a, const valarray<T>& b)
1356
+ {
1357
+ size_t length= b.size();
1358
+ valarray<T> tmp_array(length);
1359
+
1360
+ for(size_t ind=0; ind< length; ind++ )
1361
+ tmp_array[ind] = a<<b[ind];
1362
+
1363
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1364
+
1365
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1366
+ _tmp_ret->length = length;
1367
+
1368
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1369
+
1370
+ return _tmp_ret;
1371
+ }
1372
+
1373
+ template<class T>
1374
+ valarray<T> operator>> (const T& a, const valarray<T>& b)
1375
+ {
1376
+ size_t length= b.size();
1377
+ valarray<T> tmp_array(length);
1378
+
1379
+ for(size_t ind=0; ind< length; ind++ )
1380
+ tmp_array[ind] = a>>b[ind];
1381
+
1382
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1383
+
1384
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1385
+ _tmp_ret->length = length;
1386
+
1387
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1388
+
1389
+ return _tmp_ret;
1390
+ }
1391
+
1392
+ template<class T>
1393
+ valarray<bool> operator&& (const T& a, const valarray<T>& b)
1394
+ {
1395
+ size_t length= b.size();
1396
+ valarray<bool> tmp_array(length);
1397
+
1398
+ for(size_t ind=0; ind< length; ind++ )
1399
+ tmp_array[ind] = a && b[ind];
1400
+
1401
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1402
+
1403
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1404
+ _tmp_ret->length = length;
1405
+
1406
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1407
+
1408
+ return _tmp_ret;
1409
+ }
1410
+
1411
+ template<class T>
1412
+ valarray<bool> operator|| (const T& a, const valarray<T>& b)
1413
+ {
1414
+ size_t length= b.size();
1415
+ valarray<bool> tmp_array(length);
1416
+
1417
+ for(size_t ind=0; ind< length; ind++ )
1418
+ tmp_array[ind] = a || b[ind];
1419
+
1420
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1421
+
1422
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1423
+ _tmp_ret->length = length;
1424
+
1425
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1426
+
1427
+ return _tmp_ret;
1428
+ }
1429
+
1430
+ // comparison operators
1431
+
1432
+ template<class T>
1433
+ valarray<bool> operator== (const valarray<T>& a, const valarray<T>& b)
1434
+ {
1435
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
1436
+ valarray<bool> tmp_array(length);
1437
+
1438
+ for(size_t ind=0; ind< length; ind++ )
1439
+ tmp_array[ind] = (a[ind]==b[ind]);
1440
+
1441
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1442
+
1443
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1444
+ _tmp_ret->length = length;
1445
+
1446
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1447
+
1448
+ return _tmp_ret;
1449
+ }
1450
+
1451
+ template<class T>
1452
+ valarray<bool> operator!= (const valarray<T>& a, const valarray<T>& b)
1453
+ {
1454
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
1455
+ valarray<bool> tmp_array(length);
1456
+
1457
+ for(size_t ind=0; ind< length; ind++ )
1458
+ tmp_array[ind] = (a[ind]!=b[ind]);
1459
+
1460
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1461
+
1462
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1463
+ _tmp_ret->length = length;
1464
+
1465
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1466
+
1467
+ return _tmp_ret;
1468
+ }
1469
+
1470
+ template<class T>
1471
+ valarray<bool> operator< (const valarray<T>& a, const valarray<T>& b)
1472
+ {
1473
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
1474
+ valarray<bool> tmp_array(length);
1475
+
1476
+ for(size_t ind=0; ind< length; ind++ )
1477
+ tmp_array[ind] = (a[ind]<b[ind]);
1478
+
1479
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1480
+
1481
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1482
+ _tmp_ret->length = length;
1483
+
1484
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1485
+
1486
+ return _tmp_ret;
1487
+ }
1488
+
1489
+ template<class T>
1490
+ valarray<bool> operator> (const valarray<T>& a, const valarray<T>& b)
1491
+ {
1492
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
1493
+ valarray<bool> tmp_array(length);
1494
+
1495
+ for(size_t ind=0; ind< length; ind++ )
1496
+ tmp_array[ind] = (a[ind]>b[ind]);
1497
+
1498
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1499
+
1500
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1501
+ _tmp_ret->length = length;
1502
+
1503
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1504
+
1505
+ return _tmp_ret;
1506
+ }
1507
+
1508
+ template<class T>
1509
+ valarray<bool> operator<= (const valarray<T>& a, const valarray<T>& b)
1510
+ {
1511
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
1512
+ valarray<bool> tmp_array(length);
1513
+
1514
+ for(size_t ind=0; ind< length; ind++ )
1515
+ tmp_array[ind] = (a[ind]<=b[ind]);
1516
+
1517
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1518
+
1519
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1520
+ _tmp_ret->length = length;
1521
+
1522
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1523
+
1524
+ return _tmp_ret;
1525
+ }
1526
+
1527
+ template<class T>
1528
+ valarray<bool> operator>= (const valarray<T>& a, const valarray<T>& b)
1529
+ {
1530
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
1531
+ valarray<bool> tmp_array(length);
1532
+
1533
+ for(size_t ind=0; ind< length; ind++ )
1534
+ tmp_array[ind] = (a[ind]>=b[ind]);
1535
+
1536
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1537
+
1538
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1539
+ _tmp_ret->length = length;
1540
+
1541
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1542
+
1543
+ return _tmp_ret;
1544
+ }
1545
+
1546
+ // comparison operators, non valarray second param
1547
+
1548
+ template<class T>
1549
+ valarray<bool> operator== (const valarray<T>& a, const T& b)
1550
+ {
1551
+ size_t length= a.size();
1552
+ valarray<bool> tmp_array(length);
1553
+
1554
+ for(size_t ind=0; ind< length; ind++ )
1555
+ tmp_array[ind] = (a[ind]==b);
1556
+
1557
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1558
+
1559
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1560
+ _tmp_ret->length = length;
1561
+
1562
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1563
+
1564
+ return _tmp_ret;
1565
+ }
1566
+
1567
+ template<class T>
1568
+ valarray<bool> operator!= (const valarray<T>& a, const T& b)
1569
+ {
1570
+ size_t length= a.size();
1571
+ valarray<bool> tmp_array(length);
1572
+
1573
+ for(size_t ind=0; ind< length; ind++ )
1574
+ tmp_array[ind] = (a[ind]!=b);
1575
+
1576
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1577
+
1578
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1579
+ _tmp_ret->length = length;
1580
+
1581
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1582
+
1583
+ return _tmp_ret;
1584
+ }
1585
+
1586
+ template<class T>
1587
+ valarray<bool> operator< (const valarray<T>& a, const T& b)
1588
+ {
1589
+ size_t length= a.size();
1590
+ valarray<bool> tmp_array(length);
1591
+
1592
+ for(size_t ind=0; ind< length; ind++ )
1593
+ tmp_array[ind] = (a[ind]<b);
1594
+
1595
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1596
+
1597
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1598
+ _tmp_ret->length = length;
1599
+
1600
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1601
+
1602
+ return _tmp_ret;
1603
+ }
1604
+
1605
+ template<class T>
1606
+ valarray<bool> operator> (const valarray<T>& a, const T& b)
1607
+ {
1608
+ size_t length= a.size();
1609
+ valarray<bool> tmp_array(length);
1610
+
1611
+ for(size_t ind=0; ind< length; ind++ )
1612
+ tmp_array[ind] = (a[ind]>b);
1613
+
1614
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1615
+
1616
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1617
+ _tmp_ret->length = length;
1618
+
1619
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1620
+
1621
+ return _tmp_ret;
1622
+ }
1623
+
1624
+ template<class T>
1625
+ valarray<bool> operator<= (const valarray<T>& a, const T& b)
1626
+ {
1627
+ size_t length= a.size();
1628
+ valarray<bool> tmp_array(length);
1629
+
1630
+ for(size_t ind=0; ind< length; ind++ )
1631
+ tmp_array[ind] = (a[ind]<=b);
1632
+
1633
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1634
+
1635
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1636
+ _tmp_ret->length = length;
1637
+
1638
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1639
+
1640
+ return _tmp_ret;
1641
+ }
1642
+
1643
+ template<class T>
1644
+ valarray<bool> operator>= (const valarray<T>& a, const T& b)
1645
+ {
1646
+ size_t length= a.size();
1647
+ valarray<bool> tmp_array(length);
1648
+
1649
+ for(size_t ind=0; ind< length; ind++ )
1650
+ tmp_array[ind] = (a[ind]>=b);
1651
+
1652
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1653
+
1654
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1655
+ _tmp_ret->length = length;
1656
+
1657
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1658
+
1659
+ return _tmp_ret;
1660
+ }
1661
+
1662
+ // comparison operators, non valarray first param
1663
+
1664
+ template<class T>
1665
+ valarray<bool> operator== (const T& a, const valarray<T>& b)
1666
+ {
1667
+ size_t length= b.size();
1668
+ valarray<bool> tmp_array(length);
1669
+
1670
+ for(size_t ind=0; ind< length; ind++ )
1671
+ tmp_array[ind] = (a==b[ind]);
1672
+
1673
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1674
+
1675
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1676
+ _tmp_ret->length = length;
1677
+
1678
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1679
+
1680
+ return _tmp_ret;
1681
+ }
1682
+
1683
+ template<class T>
1684
+ valarray<bool> operator!= (const T& a, const valarray<T>& b)
1685
+ {
1686
+ size_t length= b.size();
1687
+ valarray<bool> tmp_array(length);
1688
+
1689
+ for(size_t ind=0; ind< length; ind++ )
1690
+ tmp_array[ind] = (a!=b[ind]);
1691
+
1692
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1693
+
1694
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1695
+ _tmp_ret->length = length;
1696
+
1697
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1698
+
1699
+ return _tmp_ret;
1700
+ }
1701
+
1702
+ template<class T>
1703
+ valarray<bool> operator< (const T& a, const valarray<T>& b)
1704
+ {
1705
+ size_t length= b.size();
1706
+ valarray<bool> tmp_array(length);
1707
+
1708
+ for(size_t ind=0; ind< length; ind++ )
1709
+ tmp_array[ind] = (a<b[ind]);
1710
+
1711
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1712
+
1713
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1714
+ _tmp_ret->length = length;
1715
+
1716
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1717
+
1718
+ return _tmp_ret;
1719
+ }
1720
+
1721
+ template<class T>
1722
+ valarray<bool> operator> (const T& a, const valarray<T>& b)
1723
+ {
1724
+ size_t length= b.size();
1725
+ valarray<bool> tmp_array(length);
1726
+
1727
+ for(size_t ind=0; ind< length; ind++ )
1728
+ tmp_array[ind] = (a>b[ind]);
1729
+
1730
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1731
+
1732
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1733
+ _tmp_ret->length = length;
1734
+
1735
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1736
+
1737
+ return _tmp_ret;
1738
+ }
1739
+
1740
+ template<class T>
1741
+ valarray<bool> operator<= (const T& a, const valarray<T>& b)
1742
+ {
1743
+ size_t length= b.size();
1744
+ valarray<bool> tmp_array(length);
1745
+
1746
+ for(size_t ind=0; ind< length; ind++ )
1747
+ tmp_array[ind] = (a<=b[ind]);
1748
+
1749
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1750
+
1751
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1752
+ _tmp_ret->length = length;
1753
+
1754
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1755
+
1756
+ return _tmp_ret;
1757
+ }
1758
+
1759
+ template<class T>
1760
+ valarray<bool> operator>= (const T& a, const valarray<T>& b)
1761
+ {
1762
+ size_t length= b.size();
1763
+ valarray<bool> tmp_array(length);
1764
+
1765
+ for(size_t ind=0; ind< length; ind++ )
1766
+ tmp_array[ind] = (a>=b[ind]);
1767
+
1768
+ _RW_IMP_SPACE(_RW_temporary<bool>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<bool>);
1769
+
1770
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1771
+ _tmp_ret->length = length;
1772
+
1773
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1774
+
1775
+ return _tmp_ret;
1776
+ }
1777
+ #ifndef _RWSTD_NO_ONLY_NEEDED_INSTANTIATION
1778
+ // min and max functions
1779
+
1780
+ template <class T>
1781
+ T valarray<T>::min()const
1782
+ {
1783
+ T tmp;
1784
+ if ( size() > 0 )
1785
+ {
1786
+ tmp = memory_array[0];
1787
+ for(size_t ind=1; ind< size(); ind++)
1788
+ if ( memory_array[ind] < tmp )
1789
+ tmp= memory_array[ind];
1790
+ }
1791
+
1792
+ return tmp;
1793
+ }
1794
+
1795
+ template <class T>
1796
+ T valarray<T>::max()const
1797
+ {
1798
+ T tmp;
1799
+ if ( size() > 0 )
1800
+ {
1801
+ tmp = memory_array[0];
1802
+ for(size_t ind=1; ind< size(); ind++)
1803
+ if ( memory_array[ind] > tmp )
1804
+ tmp= memory_array[ind];
1805
+ }
1806
+
1807
+ return tmp;
1808
+ }
1809
+ #else
1810
+ template <class T>
1811
+ T min(const valarray<T>& ar)
1812
+ {
1813
+ T tmp;
1814
+ if ( ar.size() > 0 )
1815
+ {
1816
+ tmp = ar[0];
1817
+ for(size_t ind=1; ind< ar.size(); ind++)
1818
+ if ( ar[ind] < tmp )
1819
+ tmp= ar[ind];
1820
+ }
1821
+
1822
+ return tmp;
1823
+ }
1824
+
1825
+ template <class T>
1826
+ T max(const valarray<T>& ar)
1827
+ {
1828
+ T tmp;
1829
+ if ( ar.size() > 0 )
1830
+ {
1831
+ tmp = ar[0];
1832
+ for(size_t ind=1; ind< ar.size(); ind++)
1833
+ if ( ar[ind] > tmp )
1834
+ tmp= ar[ind];
1835
+ }
1836
+
1837
+ return tmp;
1838
+ }
1839
+ #endif
1840
+ // transcendentals
1841
+ template<class T>
1842
+ valarray<T> abs(const valarray<T>& a)
1843
+ {
1844
+ valarray<T> tmp_array(a.size());
1845
+
1846
+ for(size_t ind=0; ind< a.size(); ind++ )
1847
+ tmp_array[ind] = abs(a[ind]);
1848
+
1849
+ // note: abs need to be overloaded for
1850
+ // float, long double and long see (17.3.1.1)
1851
+
1852
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1853
+
1854
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1855
+ _tmp_ret->length = a.size();
1856
+
1857
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1858
+
1859
+ return _tmp_ret;
1860
+ }
1861
+
1862
+ template<class T>
1863
+ valarray<T> acos(const valarray<T>& a)
1864
+ {
1865
+ valarray<T> tmp_array(a.size());
1866
+
1867
+ for(size_t ind=0; ind< a.size(); ind++ )
1868
+ tmp_array[ind] = acos(a[ind]);
1869
+
1870
+ // note: acos need to be overloaded for
1871
+ // float, long double see (17.3.1.1)
1872
+
1873
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1874
+
1875
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1876
+ _tmp_ret->length = a.size();
1877
+
1878
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1879
+
1880
+ return _tmp_ret;
1881
+ }
1882
+
1883
+ template<class T>
1884
+ valarray<T> asin(const valarray<T>& a)
1885
+ {
1886
+ valarray<T> tmp_array(a.size());
1887
+
1888
+ for(size_t ind=0; ind< a.size(); ind++ )
1889
+ tmp_array[ind] = asin(a[ind]);
1890
+
1891
+ // note: asin need to be overloaded for
1892
+ // float, long double see (17.3.1.1)
1893
+
1894
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1895
+
1896
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1897
+ _tmp_ret->length = a.size();
1898
+
1899
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1900
+
1901
+ return _tmp_ret;
1902
+ }
1903
+
1904
+ template<class T>
1905
+ valarray<T> atan(const valarray<T>& a)
1906
+ {
1907
+ valarray<T> tmp_array(a.size());
1908
+
1909
+ for(size_t ind=0; ind< a.size(); ind++ )
1910
+ tmp_array[ind] = atan(a[ind]);
1911
+
1912
+ // note: atan need to be overloaded for
1913
+ // float, long double see (17.3.1.1)
1914
+
1915
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1916
+
1917
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1918
+ _tmp_ret->length = a.size();
1919
+
1920
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1921
+
1922
+ return _tmp_ret;
1923
+ }
1924
+
1925
+ template<class T>
1926
+ valarray<T> cos(const valarray<T>& a)
1927
+ {
1928
+ valarray<T> tmp_array(a.size());
1929
+
1930
+ for(size_t ind=0; ind< a.size(); ind++ )
1931
+ tmp_array[ind] = cos(a[ind]);
1932
+
1933
+ // note: cos need to be overloaded for
1934
+ // float, long double see (17.3.1.1)
1935
+
1936
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1937
+
1938
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1939
+ _tmp_ret->length = a.size();
1940
+
1941
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1942
+
1943
+ return _tmp_ret;
1944
+ }
1945
+
1946
+ template<class T>
1947
+ valarray<T> cosh(const valarray<T>& a)
1948
+ {
1949
+ valarray<T> tmp_array(a.size());
1950
+
1951
+ for(size_t ind=0; ind< a.size(); ind++ )
1952
+ tmp_array[ind] = cosh(a[ind]);
1953
+
1954
+ // note: cosh need to be overloaded for
1955
+ // float, long double see (17.3.1.1)
1956
+
1957
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1958
+
1959
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1960
+ _tmp_ret->length = a.size();
1961
+
1962
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1963
+
1964
+ return _tmp_ret;
1965
+ }
1966
+
1967
+ template<class T>
1968
+ valarray<T> exp(const valarray<T>& a)
1969
+ {
1970
+ valarray<T> tmp_array(a.size());
1971
+
1972
+ for(size_t ind=0; ind< a.size(); ind++ )
1973
+ tmp_array[ind] = exp(a[ind]);
1974
+
1975
+ // note: exp need to be overloaded for
1976
+ // float, long double see (17.3.1.1)
1977
+
1978
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
1979
+
1980
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
1981
+ _tmp_ret->length = a.size();
1982
+
1983
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
1984
+
1985
+ return _tmp_ret;
1986
+ }
1987
+
1988
+ template<class T>
1989
+ valarray<T> log(const valarray<T>& a)
1990
+ {
1991
+ valarray<T> tmp_array(a.size());
1992
+
1993
+ for(size_t ind=0; ind< a.size(); ind++ )
1994
+ tmp_array[ind] = log(a[ind]);
1995
+
1996
+ // note: log need to be overloaded for
1997
+ // float, long double see (17.3.1.1)
1998
+
1999
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
2000
+
2001
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
2002
+ _tmp_ret->length = a.size();
2003
+
2004
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
2005
+
2006
+ return _tmp_ret;
2007
+ }
2008
+
2009
+ template<class T>
2010
+ valarray<T> log10(const valarray<T>& a)
2011
+ {
2012
+ valarray<T> tmp_array(a.size());
2013
+
2014
+ for(size_t ind=0; ind< a.size(); ind++ )
2015
+ tmp_array[ind] = log10(a[ind]);
2016
+
2017
+ // note: log10 need to be overloaded for
2018
+ // float, long double see (17.3.1.1)
2019
+
2020
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
2021
+
2022
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
2023
+ _tmp_ret->length = a.size();
2024
+
2025
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
2026
+
2027
+ return _tmp_ret;
2028
+ }
2029
+
2030
+ template<class T>
2031
+ valarray<T> sinh(const valarray<T>& a)
2032
+ {
2033
+ valarray<T> tmp_array(a.size());
2034
+
2035
+ for(size_t ind=0; ind< a.size(); ind++ )
2036
+ tmp_array[ind] = sinh(a[ind]);
2037
+
2038
+ // note: sinh need to be overloaded for
2039
+ // float, long double see (17.3.1.1)
2040
+
2041
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
2042
+
2043
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
2044
+ _tmp_ret->length = a.size();
2045
+
2046
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
2047
+
2048
+ return _tmp_ret;
2049
+ }
2050
+
2051
+ template<class T>
2052
+ valarray<T> sin(const valarray<T>& a)
2053
+ {
2054
+ valarray<T> tmp_array(a.size());
2055
+
2056
+ for(size_t ind=0; ind< a.size(); ind++ )
2057
+ tmp_array[ind] = sin(a[ind]);
2058
+
2059
+ // note: sin need to be overloaded for
2060
+ // float, long double see (17.3.1.1)
2061
+
2062
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
2063
+
2064
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
2065
+ _tmp_ret->length = a.size();
2066
+
2067
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
2068
+
2069
+ return _tmp_ret;
2070
+ }
2071
+
2072
+ template<class T>
2073
+ valarray<T> sqrt(const valarray<T>& a)
2074
+ {
2075
+ valarray<T> tmp_array(a.size());
2076
+
2077
+ for(size_t ind=0; ind< a.size(); ind++ )
2078
+ tmp_array[ind] = sqrt(a[ind]);
2079
+
2080
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
2081
+
2082
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
2083
+ _tmp_ret->length = a.size();
2084
+
2085
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
2086
+
2087
+ return _tmp_ret;
2088
+ }
2089
+
2090
+ template<class T>
2091
+ valarray<T> tan(const valarray<T>& a)
2092
+ {
2093
+ valarray<T> tmp_array(a.size());
2094
+
2095
+ for(size_t ind=0; ind< a.size(); ind++ )
2096
+ tmp_array[ind] = tan(a[ind]);
2097
+
2098
+ // note: tan need to be overloaded for
2099
+ // float, long double see (17.3.1.1)
2100
+
2101
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
2102
+
2103
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
2104
+ _tmp_ret->length = a.size();
2105
+
2106
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
2107
+
2108
+ return _tmp_ret;
2109
+ }
2110
+ template<class T>
2111
+ valarray<T> tanh(const valarray<T>& a)
2112
+ {
2113
+ valarray<T> tmp_array(a.size());
2114
+
2115
+ for(size_t ind=0; ind< a.size(); ind++ )
2116
+ tmp_array[ind] = tanh(a[ind]);
2117
+
2118
+ // note: tanh need to be overloaded for
2119
+ // float, long double see (17.3.1.1)
2120
+
2121
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
2122
+
2123
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
2124
+ _tmp_ret->length = a.size();
2125
+
2126
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
2127
+
2128
+ return _tmp_ret;
2129
+ }
2130
+
2131
+ template<class T>
2132
+ valarray<T> atan2(const valarray<T>& a, const valarray<T>& b)
2133
+ {
2134
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
2135
+ valarray<T> tmp_array(length);
2136
+
2137
+ for(size_t ind=0; ind< length; ind++ )
2138
+ tmp_array[ind] = atan2(a[ind],b[ind]);
2139
+
2140
+ // note: atan2 need to be overloaded for
2141
+ // float, long double see (17.3.1.1)
2142
+
2143
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
2144
+
2145
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
2146
+ _tmp_ret->length = length;
2147
+
2148
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
2149
+
2150
+ return _tmp_ret;
2151
+ }
2152
+
2153
+ template<class T>
2154
+ valarray<T> atan2(const valarray<T>& a, const T& b)
2155
+ {
2156
+ size_t length= a.size();
2157
+ valarray<T> tmp_array(length);
2158
+
2159
+ for(size_t ind=0; ind< length; ind++ )
2160
+ tmp_array[ind] = atan2(a[ind],b);
2161
+
2162
+ // note: atan2 need to be overloaded for
2163
+ // float, long double see (17.3.1.1)
2164
+
2165
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
2166
+
2167
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
2168
+ _tmp_ret->length = length;
2169
+
2170
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
2171
+
2172
+ return _tmp_ret;
2173
+ }
2174
+
2175
+ template<class T>
2176
+ valarray<T> atan2(const T& a, const valarray<T>& b)
2177
+ {
2178
+ size_t length= b.size();
2179
+ valarray<T> tmp_array(length);
2180
+
2181
+ for(size_t ind=0; ind< length; ind++ )
2182
+ tmp_array[ind] = atan2(a,b[ind]);
2183
+
2184
+ // note: atan2 need to be overloaded for
2185
+ // float, long double see (17.3.1.1)
2186
+
2187
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
2188
+
2189
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
2190
+ _tmp_ret->length = length;
2191
+
2192
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
2193
+
2194
+ return _tmp_ret;
2195
+ }
2196
+
2197
+ template<class T>
2198
+ valarray<T> pow(const valarray<T>& a, const valarray<T>& b)
2199
+ {
2200
+ size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
2201
+ valarray<T> tmp_array(length);
2202
+
2203
+ for(size_t ind=0; ind< length; ind++ )
2204
+ tmp_array[ind] = pow(a[ind],b[ind]);
2205
+
2206
+ // note: pow need to be overloaded for
2207
+ // float, long double see (17.3.1.1)
2208
+
2209
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
2210
+
2211
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
2212
+ _tmp_ret->length = length;
2213
+
2214
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
2215
+
2216
+ return _tmp_ret;
2217
+ }
2218
+
2219
+ template<class T>
2220
+ valarray<T> pow(const valarray<T>& a, const T& b)
2221
+ {
2222
+ size_t length= a.size();
2223
+ valarray<T> tmp_array(length);
2224
+
2225
+ for(size_t ind=0; ind< length; ind++ )
2226
+ tmp_array[ind] = pow(a[ind],b);
2227
+
2228
+ // note: pow need to be overloaded for
2229
+ // float, long double see (17.3.1.1)
2230
+
2231
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
2232
+
2233
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
2234
+ _tmp_ret->length = length;
2235
+
2236
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
2237
+
2238
+ return _tmp_ret;
2239
+ }
2240
+
2241
+ template<class T>
2242
+ valarray<T> pow(const T& a, const valarray<T>& b)
2243
+ {
2244
+ size_t length= b.size();
2245
+ valarray<T> tmp_array(length);
2246
+
2247
+ for(size_t ind=0; ind< length; ind++ )
2248
+ tmp_array[ind] = pow(a,b[ind]);
2249
+
2250
+ // note: pow need to be overloaded for
2251
+ // float, long double see (17.3.1.1)
2252
+
2253
+ _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);
2254
+
2255
+ _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
2256
+ _tmp_ret->length = length;
2257
+
2258
+ tmp_array._RW_get_memory_array_adr()->_RW_invalidate();
2259
+
2260
+ return _tmp_ret;
2261
+ }
2262
+ /*****************************************************************
2263
+ * *
2264
+ * SLICE_ARRAY MEMBER FUNCTIONS *
2265
+ * *
2266
+ ******************************************************************/
2267
+
2268
+ // slice_array inline member functions
2269
+
2270
+ template <class T>
2271
+ void slice_array<T>::operator= (const valarray<T>& array) const
2272
+ {
2273
+ size_t ind = slice_.start();
2274
+ size_t cpt = 0;
2275
+
2276
+ while( cpt < slice_.size() )
2277
+ {
2278
+ if ( (cpt<array.size()) && (ind<ref_mem_array->_get_length()) )
2279
+ (*ref_mem_array)[ind] = array[cpt];
2280
+ ind+= slice_.stride();
2281
+ cpt++;
2282
+ }
2283
+ }
2284
+
2285
+ template <class T>
2286
+ void slice_array<T>::operator= (const T& value) const
2287
+ {
2288
+ size_t ind = slice_.start();
2289
+ size_t cpt = 0;
2290
+
2291
+ while( cpt < slice_.size() )
2292
+ {
2293
+ if ( ind<ref_mem_array->_get_length() )
2294
+ (*ref_mem_array)[ind] = value;
2295
+ ind+= slice_.stride();
2296
+ cpt++;
2297
+ }
2298
+ }
2299
+ // computed assignment
2300
+
2301
+ template <class T>
2302
+ void slice_array<T>::operator*= (const valarray<T>& array) const
2303
+ {
2304
+ size_t ind = slice_.start();
2305
+ size_t cpt = 0;
2306
+
2307
+ while( cpt < slice_.size() )
2308
+ {
2309
+ if ( (cpt<array.size()) && (ind<ref_mem_array->_get_length()) )
2310
+ (*ref_mem_array)[ind] *= array[cpt];
2311
+ ind+= slice_.stride();
2312
+ cpt++;
2313
+ }
2314
+ }
2315
+
2316
+ template <class T>
2317
+ void slice_array<T>::operator/= (const valarray<T>& array) const
2318
+ {
2319
+ size_t ind = slice_.start();
2320
+ size_t cpt = 0;
2321
+
2322
+ while( cpt < slice_.size() )
2323
+ {
2324
+ if ( (cpt<array.size()) && (ind<ref_mem_array->_get_length()) )
2325
+ (*ref_mem_array)[ind] /= array[cpt];
2326
+ ind+= slice_.stride();
2327
+ cpt++;
2328
+ }
2329
+ }
2330
+
2331
+ template <class T>
2332
+ void slice_array<T>::operator+= (const valarray<T>& array) const
2333
+ {
2334
+ size_t ind = slice_.start();
2335
+ size_t cpt = 0;
2336
+
2337
+ while( cpt < slice_.size() )
2338
+ {
2339
+ if ( (cpt<array.size()) && (ind<ref_mem_array->_get_length()) )
2340
+ (*ref_mem_array)[ind] += array[cpt];
2341
+ ind+= slice_.stride();
2342
+ cpt++;
2343
+ }
2344
+ }
2345
+
2346
+ template <class T>
2347
+ void slice_array<T>::operator-= (const valarray<T>& array) const
2348
+ {
2349
+ size_t ind = slice_.start();
2350
+ size_t cpt = 0;
2351
+
2352
+ while( cpt < slice_.size() )
2353
+ {
2354
+ if ( (cpt<array.size()) && (ind<ref_mem_array->_get_length()) )
2355
+ (*ref_mem_array)[ind] -= array[cpt];
2356
+ ind+= slice_.stride();
2357
+ cpt++;
2358
+ }
2359
+ }
2360
+
2361
+ #ifndef _RWSTD_NO_ONLY_NEEDED_INSTANTIATION
2362
+ template <class T>
2363
+ void slice_array<T>::operator%= (const valarray<T>& array) const
2364
+ {
2365
+ size_t ind = slice_.start();
2366
+ size_t cpt = 0;
2367
+
2368
+ while( cpt < slice_.size() )
2369
+ {
2370
+ if ( (cpt<array.size()) && (ind<ref_mem_array->_get_length()) )
2371
+ (*ref_mem_array)[ind] %= array[cpt];
2372
+ ind+= slice_.stride();
2373
+ cpt++;
2374
+ }
2375
+ }
2376
+
2377
+ template <class T>
2378
+ void slice_array<T>::operator^= (const valarray<T>& array) const
2379
+ {
2380
+ size_t ind = slice_.start();
2381
+ size_t cpt = 0;
2382
+
2383
+ while( cpt < slice_.size() )
2384
+ {
2385
+ if ( (cpt<array.size()) && (ind<ref_mem_array->_get_length()) )
2386
+ (*ref_mem_array)[ind] ^= array[cpt];
2387
+ ind+= slice_.stride();
2388
+ cpt++;
2389
+ }
2390
+ }
2391
+
2392
+ template <class T>
2393
+ void slice_array<T>::operator&= (const valarray<T>& array) const
2394
+ {
2395
+ size_t ind = slice_.start();
2396
+ size_t cpt = 0;
2397
+
2398
+ while( cpt < slice_.size() )
2399
+ {
2400
+ if ( (cpt<array.size()) && (ind<ref_mem_array->_get_length()) )
2401
+ (*ref_mem_array)[ind] &= array[cpt];
2402
+ ind+= slice_.stride();
2403
+ cpt++;
2404
+ }
2405
+ }
2406
+
2407
+ template <class T>
2408
+ void slice_array<T>::operator|= (const valarray<T>& array) const
2409
+ {
2410
+ size_t ind = slice_.start();
2411
+ size_t cpt = 0;
2412
+
2413
+ while( cpt < slice_.size() )
2414
+ {
2415
+ if ( (cpt<array.size()) && (ind<ref_mem_array->_get_length()) )
2416
+ (*ref_mem_array)[ind] |= array[cpt];
2417
+ ind+= slice_.stride();
2418
+ cpt++;
2419
+ }
2420
+ }
2421
+
2422
+ template <class T>
2423
+ void slice_array<T>::operator<<= (const valarray<T>& array) const
2424
+ {
2425
+ size_t ind = slice_.start();
2426
+ size_t cpt = 0;
2427
+
2428
+ while( cpt < slice_.size() )
2429
+ {
2430
+ if ( (cpt<array.size()) && (ind<ref_mem_array->_get_length()) )
2431
+ (*ref_mem_array)[ind] <<= array[cpt];
2432
+ ind+= slice_.stride();
2433
+ cpt++;
2434
+ }
2435
+ }
2436
+
2437
+ template <class T>
2438
+ void slice_array<T>::operator>>= (const valarray<T>& array) const
2439
+ {
2440
+ size_t ind = slice_.start();
2441
+ size_t cpt = 0;
2442
+
2443
+ while( cpt < slice_.size() )
2444
+ {
2445
+ if ( (cpt<array.size()) && (ind<ref_mem_array->_get_length()) )
2446
+ (*ref_mem_array)[ind] >>= array[cpt];
2447
+ ind+= slice_.stride();
2448
+ cpt++;
2449
+ }
2450
+ }
2451
+ #endif
2452
+ /*****************************************************************
2453
+ * *
2454
+ * GSLICE_ARRAY MEMBER FUNCTIONS *
2455
+ * *
2456
+ ******************************************************************/
2457
+ // gslice_array inline member functions
2458
+
2459
+ template <class T>
2460
+ void gslice_array<T>::operator= (const valarray<T>& array) const
2461
+ {
2462
+ gslice *gsl = (gslice *)&slice_;
2463
+ size_t ind = gsl->next_ind();
2464
+ size_t cpt = 0;
2465
+
2466
+ while( (!gsl->is_reseted()) && (cpt < array.size()) )
2467
+ {
2468
+ (*ref_mem_array)[ind] = array[cpt];
2469
+ ind= gsl->next_ind();
2470
+ cpt++;
2471
+ }
2472
+ }
2473
+
2474
+ template <class T>
2475
+ void gslice_array<T>::operator= (const T& value) const
2476
+ {
2477
+ gslice *gsl = (gslice *)&slice_;
2478
+ size_t ind = gsl->next_ind();
2479
+
2480
+ while( !gsl->is_reseted() )
2481
+ {
2482
+ (*ref_mem_array)[ind] = value;
2483
+ ind= gsl->next_ind();
2484
+ }
2485
+ }
2486
+ // computed assignment
2487
+
2488
+ template <class T>
2489
+ void gslice_array<T>::operator*= (const valarray<T>& array) const
2490
+ {
2491
+ gslice *gsl = (gslice *)&slice_;
2492
+ size_t ind = gsl->next_ind();
2493
+ size_t cpt = 0;
2494
+
2495
+ while( (!gsl->is_reseted()) && (cpt < array.size()) )
2496
+ {
2497
+ (*ref_mem_array)[ind] *= array[cpt];
2498
+ ind= gsl->next_ind();
2499
+ cpt++;
2500
+ }
2501
+ }
2502
+
2503
+ template <class T>
2504
+ void gslice_array<T>::operator/= (const valarray<T>& array) const
2505
+ {
2506
+ gslice *gsl = (gslice *)&slice_;
2507
+ size_t ind = gsl->next_ind();
2508
+ size_t cpt = 0;
2509
+
2510
+ while( (!gsl->is_reseted()) && (cpt < array.size()) )
2511
+ {
2512
+ (*ref_mem_array)[ind] /= array[cpt];
2513
+ ind= gsl->next_ind();
2514
+ cpt++;
2515
+ }
2516
+ }
2517
+
2518
+ template <class T>
2519
+ void gslice_array<T>::operator+= (const valarray<T>& array) const
2520
+ {
2521
+ gslice *gsl = (gslice *)&slice_;
2522
+ size_t ind = gsl->next_ind();
2523
+ size_t cpt = 0;
2524
+
2525
+ while( (!gsl->is_reseted()) && (cpt < array.size()) )
2526
+ {
2527
+ (*ref_mem_array)[ind] += array[cpt];
2528
+ ind= gsl->next_ind();
2529
+ cpt++;
2530
+ }
2531
+ }
2532
+
2533
+ template <class T>
2534
+ void gslice_array<T>::operator-= (const valarray<T>& array) const
2535
+ {
2536
+ gslice *gsl = (gslice *)&slice_;
2537
+ size_t ind = gsl->next_ind();
2538
+ size_t cpt = 0;
2539
+
2540
+ while( (!gsl->is_reseted()) && (cpt < array.size()) )
2541
+ {
2542
+ (*ref_mem_array)[ind] -= array[cpt];
2543
+ ind= gsl->next_ind();
2544
+ cpt++;
2545
+ }
2546
+ }
2547
+
2548
+ #ifndef _RWSTD_NO_ONLY_NEEDED_INSTANTIATION
2549
+ template <class T>
2550
+ void gslice_array<T>::operator%= (const valarray<T>& array) const
2551
+ {
2552
+ gslice *gsl = (gslice *)&slice_;
2553
+ size_t ind = gsl->next_ind();
2554
+ size_t cpt = 0;
2555
+
2556
+ while( (!gsl->is_reseted()) && (cpt < array.size()) )
2557
+ {
2558
+ (*ref_mem_array)[ind] %= array[cpt];
2559
+ ind= gsl->next_ind();
2560
+ cpt++;
2561
+ }
2562
+ }
2563
+
2564
+ template <class T>
2565
+ void gslice_array<T>::operator^= (const valarray<T>& array) const
2566
+ {
2567
+ gslice *gsl = (gslice *)&slice_;
2568
+ size_t ind = gsl->next_ind();
2569
+ size_t cpt = 0;
2570
+
2571
+ while( (!gsl->is_reseted()) && (cpt < array.size()) )
2572
+ {
2573
+ (*ref_mem_array)[ind] ^= array[cpt];
2574
+ ind= gsl->next_ind();
2575
+ cpt++;
2576
+ }
2577
+ }
2578
+
2579
+ template <class T>
2580
+ void gslice_array<T>::operator&= (const valarray<T>& array) const
2581
+ {
2582
+ gslice *gsl = (gslice *)&slice_;
2583
+ size_t ind = gsl->next_ind();
2584
+ size_t cpt = 0;
2585
+
2586
+ while( (!gsl->is_reseted()) && (cpt < array.size()) )
2587
+ {
2588
+ (*ref_mem_array)[ind] &= array[cpt];
2589
+ ind= gsl->next_ind();
2590
+ cpt++;
2591
+ }
2592
+ }
2593
+
2594
+ template <class T>
2595
+ void gslice_array<T>::operator|= (const valarray<T>& array) const
2596
+ {
2597
+ gslice *gsl = (gslice *)&slice_;
2598
+ size_t ind = gsl->next_ind();
2599
+ size_t cpt = 0;
2600
+
2601
+ while( (!gsl->is_reseted()) && (cpt < array.size()) )
2602
+ {
2603
+ (*ref_mem_array)[ind] |= array[cpt];
2604
+ ind= gsl->next_ind();
2605
+ cpt++;
2606
+ }
2607
+ }
2608
+
2609
+ template <class T>
2610
+ void gslice_array<T>::operator<<= (const valarray<T>& array) const
2611
+ {
2612
+ gslice *gsl = (gslice *)&slice_;
2613
+ size_t ind = gsl->next_ind();
2614
+ size_t cpt = 0;
2615
+
2616
+ while( (!gsl->is_reseted()) && (cpt < array.size()) )
2617
+ {
2618
+ (*ref_mem_array)[ind] <<= array[cpt];
2619
+ ind= gsl->next_ind();
2620
+ cpt++;
2621
+ }
2622
+ }
2623
+
2624
+ template <class T>
2625
+ void gslice_array<T>::operator>>= (const valarray<T>& array) const
2626
+ {
2627
+ gslice *gsl = (gslice *)&slice_;
2628
+ size_t ind = gsl->next_ind();
2629
+ size_t cpt = 0;
2630
+
2631
+ while( (!gsl->is_reseted()) && (cpt < array.size()) )
2632
+ {
2633
+ (*ref_mem_array)[ind] >>= array[cpt];
2634
+ ind= gsl->next_ind();
2635
+ cpt++;
2636
+ }
2637
+ }
2638
+ #endif
2639
+ /*****************************************************************
2640
+ * *
2641
+ * MASK_ARRAY MEMBER FUNCTIONS *
2642
+ * *
2643
+ ******************************************************************/
2644
+
2645
+ // mask_array inline member functions
2646
+
2647
+ template <class T>
2648
+ void mask_array<T>::operator= (const valarray<T>& ar) const
2649
+ {
2650
+ size_t cpt = 0;
2651
+
2652
+ for(size_t iter=0; iter < array.size(); iter++ )
2653
+ if ( array[iter] )
2654
+ (*ref_mem_array)[iter]= ar[cpt++];
2655
+ }
2656
+
2657
+ template <class T>
2658
+ void mask_array<T>::operator= (const T& value) const
2659
+ {
2660
+ for(size_t iter=0; iter < array.size(); iter++ )
2661
+ if ( array[iter] )
2662
+ (*ref_mem_array)[iter]= value;
2663
+ }
2664
+ template <class T>
2665
+ void mask_array<T>::operator*= (const valarray<T>& ar) const
2666
+ {
2667
+ size_t cpt = 0;
2668
+
2669
+ for(size_t iter=0; iter < array.size(); iter++ )
2670
+ if ( array[iter] )
2671
+ (*ref_mem_array)[iter] *= ar[cpt++];
2672
+ }
2673
+
2674
+ template <class T>
2675
+ void mask_array<T>::operator/= (const valarray<T>& ar) const
2676
+ {
2677
+ size_t cpt = 0;
2678
+
2679
+ for(size_t iter=0; iter < array.size(); iter++ )
2680
+ if ( array[iter] )
2681
+ (*ref_mem_array)[iter]/= ar[cpt++];
2682
+ }
2683
+
2684
+ template <class T>
2685
+ void mask_array<T>::operator+= (const valarray<T>& ar) const
2686
+ {
2687
+ size_t cpt = 0;
2688
+
2689
+ for(size_t iter=0; iter < array.size(); iter++ )
2690
+ if ( array[iter] )
2691
+ (*ref_mem_array)[iter]+= ar[cpt++];
2692
+ }
2693
+
2694
+ template <class T>
2695
+ void mask_array<T>::operator-= (const valarray<T>& ar) const
2696
+ {
2697
+ size_t cpt = 0;
2698
+
2699
+ for(size_t iter=0; iter < array.size(); iter++ )
2700
+ if ( array[iter] )
2701
+ (*ref_mem_array)[iter]-= ar[cpt++];
2702
+ }
2703
+ #ifndef _RWSTD_NO_ONLY_NEEDED_INSTANTIATION
2704
+
2705
+ template <class T>
2706
+ void mask_array<T>::operator%= (const valarray<T>& ar) const
2707
+ {
2708
+ size_t cpt = 0;
2709
+
2710
+ for(size_t iter=0; iter < array.size(); iter++ )
2711
+ if ( array[iter] )
2712
+ (*ref_mem_array)[iter]%= ar[cpt++];
2713
+ }
2714
+
2715
+ template <class T>
2716
+ void mask_array<T>::operator^= (const valarray<T>& ar) const
2717
+ {
2718
+ size_t cpt = 0;
2719
+
2720
+ for(size_t iter=0; iter < array.size(); iter++ )
2721
+ if ( array[iter] )
2722
+ (*ref_mem_array)[iter]^= ar[cpt++];
2723
+ }
2724
+
2725
+ template <class T>
2726
+ void mask_array<T>::operator&= (const valarray<T>& ar) const
2727
+ {
2728
+ size_t cpt = 0;
2729
+
2730
+ for(size_t iter=0; iter < array.size(); iter++ )
2731
+ if ( array[iter] )
2732
+ (*ref_mem_array)[iter]&= ar[cpt++];
2733
+ }
2734
+
2735
+ template <class T>
2736
+ void mask_array<T>::operator|= (const valarray<T>& ar) const
2737
+ {
2738
+ size_t cpt = 0;
2739
+
2740
+ for(size_t iter=0; iter < array.size(); iter++ )
2741
+ if ( array[iter] )
2742
+ (*ref_mem_array)[iter]|= ar[cpt++];
2743
+ }
2744
+
2745
+ template <class T>
2746
+ void mask_array<T>::operator<<= (const valarray<T>& ar) const
2747
+ {
2748
+ size_t cpt = 0;
2749
+
2750
+ for(size_t iter=0; iter < array.size(); iter++ )
2751
+ if ( array[iter] )
2752
+ (*ref_mem_array)[iter]<<= ar[cpt++];
2753
+ }
2754
+
2755
+ template <class T>
2756
+ void mask_array<T>::operator>>= (const valarray<T>& ar) const
2757
+ {
2758
+ size_t cpt = 0;
2759
+
2760
+ for(size_t iter=0; iter < array.size(); iter++ )
2761
+ if ( array[iter] )
2762
+ (*ref_mem_array)[iter]>>= ar[cpt++];
2763
+ }
2764
+ #endif
2765
+
2766
+ /*****************************************************************
2767
+ * *
2768
+ * INDIRECT_ARRAY MEMBER FUNCTIONS *
2769
+ * *
2770
+ ******************************************************************/
2771
+
2772
+ // indirect_array inline member functions
2773
+
2774
+ template <class T>
2775
+ void indirect_array<T>::operator= (const valarray<T>& ar) const
2776
+ {
2777
+ size_t cpt=0;
2778
+
2779
+ for(size_t iter=0; iter < array.size(); iter++ )
2780
+ (*ref_mem_array)[array[iter]] = ar[cpt++];
2781
+ }
2782
+
2783
+ template <class T>
2784
+ void indirect_array<T>::operator= (const T& value) const
2785
+ {
2786
+ for(size_t iter=0; iter < array.size(); iter++ )
2787
+ (*ref_mem_array)[array[iter]] = value;
2788
+ }
2789
+ template <class T>
2790
+ void indirect_array<T>::operator*= (const valarray<T>& ar) const
2791
+ {
2792
+ size_t cpt=0;
2793
+
2794
+ for(size_t iter=0; iter < array.size(); iter++ )
2795
+ (*ref_mem_array)[array[iter]] *= ar[cpt++];
2796
+ }
2797
+
2798
+ template <class T>
2799
+ void indirect_array<T>::operator/= (const valarray<T>& ar) const
2800
+ {
2801
+ size_t cpt=0;
2802
+
2803
+ for(size_t iter=0; iter < array.size(); iter++ )
2804
+ (*ref_mem_array)[array[iter]] /= ar[cpt++];
2805
+ }
2806
+
2807
+ template <class T>
2808
+ void indirect_array<T>::operator+= (const valarray<T>& ar) const
2809
+ {
2810
+ size_t cpt=0;
2811
+
2812
+ for(size_t iter=0; iter < array.size(); iter++ )
2813
+ (*ref_mem_array)[array[iter]] += ar[cpt++];
2814
+ }
2815
+
2816
+ template <class T>
2817
+ void indirect_array<T>::operator-= (const valarray<T>& ar) const
2818
+ {
2819
+ size_t cpt=0;
2820
+
2821
+ for(size_t iter=0; iter < array.size(); iter++ )
2822
+ (*ref_mem_array)[array[iter]] -= ar[cpt++];
2823
+ }
2824
+ #ifndef _RWSTD_NO_ONLY_NEEDED_INSTANTIATION
2825
+
2826
+ template <class T>
2827
+ void indirect_array<T>::operator%= (const valarray<T>& ar) const
2828
+ {
2829
+ size_t cpt=0;
2830
+
2831
+ for(size_t iter=0; iter < array.size(); iter++ )
2832
+ (*ref_mem_array)[array[iter]] %= ar[cpt++];
2833
+ }
2834
+
2835
+ template <class T>
2836
+ void indirect_array<T>::operator^= (const valarray<T>& ar) const
2837
+ {
2838
+ size_t cpt=0;
2839
+
2840
+ for(size_t iter=0; iter < array.size(); iter++ )
2841
+ (*ref_mem_array)[array[iter]] ^= ar[cpt++];
2842
+ }
2843
+
2844
+ template <class T>
2845
+ void indirect_array<T>::operator&= (const valarray<T>& ar) const
2846
+ {
2847
+ size_t cpt=0;
2848
+
2849
+ for(size_t iter=0; iter < array.size(); iter++ )
2850
+ (*ref_mem_array)[array[iter]] &= ar[cpt++];
2851
+ }
2852
+
2853
+ template <class T>
2854
+ void indirect_array<T>::operator|= (const valarray<T>& ar) const
2855
+ {
2856
+ size_t cpt=0;
2857
+
2858
+ for(size_t iter=0; iter < array.size(); iter++ )
2859
+ (*ref_mem_array)[array[iter]] |= ar[cpt++];
2860
+ }
2861
+ template <class T>
2862
+ void indirect_array<T>::operator<<= (const valarray<T>& ar) const
2863
+ {
2864
+ size_t cpt=0;
2865
+
2866
+ for(size_t iter=0; iter < array.size(); iter++ )
2867
+ (*ref_mem_array)[array[iter]] <<= ar[cpt++];
2868
+ }
2869
+ template <class T>
2870
+ void indirect_array<T>::operator>>= (const valarray<T>& ar) const
2871
+ {
2872
+ size_t cpt=0;
2873
+
2874
+ for(size_t iter=0; iter < array.size(); iter++ )
2875
+ (*ref_mem_array)[array[iter]] >>= ar[cpt++];
2876
+ }
2877
+ #endif
2878
+ #ifndef _RWSTD_NO_NAMESPACE
2879
+ }
2880
+ #endif
2881
+
2882
+ #pragma option pop
2883
+ #endif /* __VALARRAY_CC */