boost.cxx 0.0.2 → 1.90.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/README.md +29 -2
  2. package/boost/cast.hpp +20 -0
  3. package/boost/numeric/conversion/bounds.hpp +24 -0
  4. package/boost/numeric/conversion/cast.hpp +61 -0
  5. package/boost/numeric/conversion/conversion_traits.hpp +32 -0
  6. package/boost/numeric/conversion/converter.hpp +68 -0
  7. package/boost/numeric/conversion/converter_policies.hpp +194 -0
  8. package/boost/numeric/conversion/detail/bounds.hpp +58 -0
  9. package/boost/numeric/conversion/detail/conversion_traits.hpp +97 -0
  10. package/boost/numeric/conversion/detail/converter.hpp +593 -0
  11. package/boost/numeric/conversion/detail/int_float_mixture.hpp +72 -0
  12. package/boost/numeric/conversion/detail/is_subranged.hpp +234 -0
  13. package/boost/numeric/conversion/detail/meta.hpp +120 -0
  14. package/boost/numeric/conversion/detail/numeric_cast_traits.hpp +138 -0
  15. package/boost/numeric/conversion/detail/old_numeric_cast.hpp +308 -0
  16. package/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp +1741 -0
  17. package/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp +347 -0
  18. package/boost/numeric/conversion/detail/sign_mixture.hpp +72 -0
  19. package/boost/numeric/conversion/detail/udt_builtin_mixture.hpp +69 -0
  20. package/boost/numeric/conversion/int_float_mixture.hpp +30 -0
  21. package/boost/numeric/conversion/int_float_mixture_enum.hpp +29 -0
  22. package/boost/numeric/conversion/is_subranged.hpp +27 -0
  23. package/boost/numeric/conversion/numeric_cast_traits.hpp +31 -0
  24. package/boost/numeric/conversion/sign_mixture.hpp +30 -0
  25. package/boost/numeric/conversion/sign_mixture_enum.hpp +29 -0
  26. package/boost/numeric/conversion/udt_builtin_mixture.hpp +28 -0
  27. package/boost/numeric/conversion/udt_builtin_mixture_enum.hpp +26 -0
  28. package/boost/numeric/interval/arith.hpp +305 -0
  29. package/boost/numeric/interval/arith2.hpp +304 -0
  30. package/boost/numeric/interval/arith3.hpp +69 -0
  31. package/boost/numeric/interval/checking.hpp +130 -0
  32. package/boost/numeric/interval/compare/certain.hpp +113 -0
  33. package/boost/numeric/interval/compare/explicit.hpp +248 -0
  34. package/boost/numeric/interval/compare/lexicographic.hpp +122 -0
  35. package/boost/numeric/interval/compare/possible.hpp +113 -0
  36. package/boost/numeric/interval/compare/set.hpp +101 -0
  37. package/boost/numeric/interval/compare/tribool.hpp +138 -0
  38. package/boost/numeric/interval/compare.hpp +19 -0
  39. package/boost/numeric/interval/constants.hpp +85 -0
  40. package/boost/numeric/interval/detail/alpha_rounding_control.hpp +113 -0
  41. package/boost/numeric/interval/detail/bcc_rounding_control.hpp +57 -0
  42. package/boost/numeric/interval/detail/bugs.hpp +48 -0
  43. package/boost/numeric/interval/detail/c99_rounding_control.hpp +50 -0
  44. package/boost/numeric/interval/detail/c99sub_rounding_control.hpp +43 -0
  45. package/boost/numeric/interval/detail/division.hpp +194 -0
  46. package/boost/numeric/interval/detail/ia64_rounding_control.hpp +83 -0
  47. package/boost/numeric/interval/detail/interval_prototype.hpp +41 -0
  48. package/boost/numeric/interval/detail/msvc_rounding_control.hpp +113 -0
  49. package/boost/numeric/interval/detail/ppc_rounding_control.hpp +99 -0
  50. package/boost/numeric/interval/detail/sparc_rounding_control.hpp +112 -0
  51. package/boost/numeric/interval/detail/test_input.hpp +76 -0
  52. package/boost/numeric/interval/detail/x86_rounding_control.hpp +108 -0
  53. package/boost/numeric/interval/detail/x86gcc_rounding_control.hpp +51 -0
  54. package/boost/numeric/interval/ext/integer.hpp +70 -0
  55. package/boost/numeric/interval/ext/x86_fast_rounding_control.hpp +70 -0
  56. package/boost/numeric/interval/hw_rounding.hpp +73 -0
  57. package/boost/numeric/interval/interval.hpp +450 -0
  58. package/boost/numeric/interval/io.hpp +41 -0
  59. package/boost/numeric/interval/limits.hpp +49 -0
  60. package/boost/numeric/interval/policies.hpp +75 -0
  61. package/boost/numeric/interval/rounded_arith.hpp +120 -0
  62. package/boost/numeric/interval/rounded_transc.hpp +140 -0
  63. package/boost/numeric/interval/rounding.hpp +101 -0
  64. package/boost/numeric/interval/transc.hpp +232 -0
  65. package/boost/numeric/interval/utility.hpp +335 -0
  66. package/boost/numeric/interval/utility_fwd.hpp +172 -0
  67. package/boost/numeric/interval.hpp +32 -0
  68. package/boost/numeric/odeint/algebra/algebra_dispatcher.hpp +86 -0
  69. package/boost/numeric/odeint/algebra/array_algebra.hpp +293 -0
  70. package/boost/numeric/odeint/algebra/default_operations.hpp +599 -0
  71. package/boost/numeric/odeint/algebra/detail/extract_value_type.hpp +51 -0
  72. package/boost/numeric/odeint/algebra/detail/for_each.hpp +165 -0
  73. package/boost/numeric/odeint/algebra/detail/macros.hpp +35 -0
  74. package/boost/numeric/odeint/algebra/detail/norm_inf.hpp +46 -0
  75. package/boost/numeric/odeint/algebra/fusion_algebra.hpp +216 -0
  76. package/boost/numeric/odeint/algebra/fusion_algebra_dispatcher.hpp +48 -0
  77. package/boost/numeric/odeint/algebra/multi_array_algebra.hpp +146 -0
  78. package/boost/numeric/odeint/algebra/norm_result_type.hpp +33 -0
  79. package/boost/numeric/odeint/algebra/operations_dispatcher.hpp +41 -0
  80. package/boost/numeric/odeint/algebra/range_algebra.hpp +142 -0
  81. package/boost/numeric/odeint/algebra/vector_space_algebra.hpp +175 -0
  82. package/boost/numeric/odeint/config.hpp +53 -0
  83. package/boost/numeric/odeint/external/blaze/blaze_algebra_dispatcher.hpp +55 -0
  84. package/boost/numeric/odeint/external/blaze/blaze_resize.hpp +64 -0
  85. package/boost/numeric/odeint/external/compute/compute.hpp +27 -0
  86. package/boost/numeric/odeint/external/compute/compute_algebra.hpp +65 -0
  87. package/boost/numeric/odeint/external/compute/compute_algebra_dispatcher.hpp +41 -0
  88. package/boost/numeric/odeint/external/compute/compute_operations.hpp +198 -0
  89. package/boost/numeric/odeint/external/compute/compute_operations_dispatcher.hpp +44 -0
  90. package/boost/numeric/odeint/external/compute/compute_resize.hpp +92 -0
  91. package/boost/numeric/odeint/external/eigen/eigen.hpp +27 -0
  92. package/boost/numeric/odeint/external/eigen/eigen_algebra.hpp +98 -0
  93. package/boost/numeric/odeint/external/eigen/eigen_algebra_dispatcher.hpp +49 -0
  94. package/boost/numeric/odeint/external/eigen/eigen_resize.hpp +103 -0
  95. package/boost/numeric/odeint/external/gsl/gsl_wrapper.hpp +228 -0
  96. package/boost/numeric/odeint/external/mkl/mkl_operations.hpp +181 -0
  97. package/boost/numeric/odeint/external/mpi/mpi.hpp +25 -0
  98. package/boost/numeric/odeint/external/mpi/mpi_nested_algebra.hpp +62 -0
  99. package/boost/numeric/odeint/external/mpi/mpi_state.hpp +113 -0
  100. package/boost/numeric/odeint/external/mpi/mpi_vector_state.hpp +95 -0
  101. package/boost/numeric/odeint/external/mtl4/implicit_euler_mtl4.hpp +161 -0
  102. package/boost/numeric/odeint/external/mtl4/mtl4.hpp +23 -0
  103. package/boost/numeric/odeint/external/mtl4/mtl4_algebra_dispatcher.hpp +99 -0
  104. package/boost/numeric/odeint/external/mtl4/mtl4_resize.hpp +134 -0
  105. package/boost/numeric/odeint/external/nt2/nt2_algebra_dispatcher.hpp +25 -0
  106. package/boost/numeric/odeint/external/nt2/nt2_copy.hpp +33 -0
  107. package/boost/numeric/odeint/external/nt2/nt2_norm_inf.hpp +31 -0
  108. package/boost/numeric/odeint/external/nt2/nt2_resize.hpp +54 -0
  109. package/boost/numeric/odeint/external/openmp/openmp.hpp +31 -0
  110. package/boost/numeric/odeint/external/openmp/openmp_nested_algebra.hpp +281 -0
  111. package/boost/numeric/odeint/external/openmp/openmp_range_algebra.hpp +276 -0
  112. package/boost/numeric/odeint/external/openmp/openmp_state.hpp +172 -0
  113. package/boost/numeric/odeint/external/thrust/thrust.hpp +27 -0
  114. package/boost/numeric/odeint/external/thrust/thrust_algebra.hpp +217 -0
  115. package/boost/numeric/odeint/external/thrust/thrust_algebra_dispatcher.hpp +118 -0
  116. package/boost/numeric/odeint/external/thrust/thrust_operations.hpp +233 -0
  117. package/boost/numeric/odeint/external/thrust/thrust_operations_dispatcher.hpp +118 -0
  118. package/boost/numeric/odeint/external/thrust/thrust_resize.hpp +197 -0
  119. package/boost/numeric/odeint/external/vexcl/vexcl.hpp +28 -0
  120. package/boost/numeric/odeint/external/vexcl/vexcl_abs.hpp +61 -0
  121. package/boost/numeric/odeint/external/vexcl/vexcl_algebra_dispatcher.hpp +51 -0
  122. package/boost/numeric/odeint/external/vexcl/vexcl_copy.hpp +55 -0
  123. package/boost/numeric/odeint/external/vexcl/vexcl_norm_inf.hpp +68 -0
  124. package/boost/numeric/odeint/external/vexcl/vexcl_resize.hpp +96 -0
  125. package/boost/numeric/odeint/external/vexcl/vexcl_same_instance.hpp +58 -0
  126. package/boost/numeric/odeint/external/viennacl/viennacl_operations.hpp +226 -0
  127. package/boost/numeric/odeint/external/viennacl/viennacl_resize.hpp +68 -0
  128. package/boost/numeric/odeint/integrate/check_adapter.hpp +222 -0
  129. package/boost/numeric/odeint/integrate/detail/functors.hpp +70 -0
  130. package/boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp +161 -0
  131. package/boost/numeric/odeint/integrate/detail/integrate_const.hpp +167 -0
  132. package/boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp +161 -0
  133. package/boost/numeric/odeint/integrate/detail/integrate_times.hpp +179 -0
  134. package/boost/numeric/odeint/integrate/integrate.hpp +133 -0
  135. package/boost/numeric/odeint/integrate/integrate_adaptive.hpp +127 -0
  136. package/boost/numeric/odeint/integrate/integrate_const.hpp +195 -0
  137. package/boost/numeric/odeint/integrate/integrate_n_steps.hpp +178 -0
  138. package/boost/numeric/odeint/integrate/integrate_times.hpp +220 -0
  139. package/boost/numeric/odeint/integrate/max_step_checker.hpp +114 -0
  140. package/boost/numeric/odeint/integrate/null_observer.hpp +38 -0
  141. package/boost/numeric/odeint/integrate/observer_collection.hpp +55 -0
  142. package/boost/numeric/odeint/iterator/adaptive_iterator.hpp +183 -0
  143. package/boost/numeric/odeint/iterator/adaptive_time_iterator.hpp +175 -0
  144. package/boost/numeric/odeint/iterator/const_step_iterator.hpp +180 -0
  145. package/boost/numeric/odeint/iterator/const_step_time_iterator.hpp +173 -0
  146. package/boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp +199 -0
  147. package/boost/numeric/odeint/iterator/impl/adaptive_iterator_impl.hpp +251 -0
  148. package/boost/numeric/odeint/iterator/impl/const_step_iterator_impl.hpp +228 -0
  149. package/boost/numeric/odeint/iterator/impl/n_step_iterator_impl.hpp +239 -0
  150. package/boost/numeric/odeint/iterator/impl/times_iterator_impl.hpp +369 -0
  151. package/boost/numeric/odeint/iterator/integrate/detail/functors.hpp +70 -0
  152. package/boost/numeric/odeint/iterator/integrate/detail/integrate_adaptive.hpp +121 -0
  153. package/boost/numeric/odeint/iterator/integrate/detail/integrate_const.hpp +111 -0
  154. package/boost/numeric/odeint/iterator/integrate/detail/integrate_n_steps.hpp +107 -0
  155. package/boost/numeric/odeint/iterator/integrate/detail/integrate_times.hpp +67 -0
  156. package/boost/numeric/odeint/iterator/integrate/integrate.hpp +111 -0
  157. package/boost/numeric/odeint/iterator/integrate/integrate_adaptive.hpp +127 -0
  158. package/boost/numeric/odeint/iterator/integrate/integrate_const.hpp +158 -0
  159. package/boost/numeric/odeint/iterator/integrate/integrate_n_steps.hpp +123 -0
  160. package/boost/numeric/odeint/iterator/integrate/integrate_times.hpp +131 -0
  161. package/boost/numeric/odeint/iterator/integrate/null_observer.hpp +38 -0
  162. package/boost/numeric/odeint/iterator/integrate/observer_collection.hpp +55 -0
  163. package/boost/numeric/odeint/iterator/n_step_iterator.hpp +168 -0
  164. package/boost/numeric/odeint/iterator/n_step_time_iterator.hpp +169 -0
  165. package/boost/numeric/odeint/iterator/times_iterator.hpp +189 -0
  166. package/boost/numeric/odeint/iterator/times_time_iterator.hpp +193 -0
  167. package/boost/numeric/odeint/stepper/adams_bashforth.hpp +418 -0
  168. package/boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp +313 -0
  169. package/boost/numeric/odeint/stepper/adams_moulton.hpp +201 -0
  170. package/boost/numeric/odeint/stepper/adaptive_adams_bashforth_moulton.hpp +237 -0
  171. package/boost/numeric/odeint/stepper/base/algebra_stepper_base.hpp +91 -0
  172. package/boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp +588 -0
  173. package/boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp +677 -0
  174. package/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp +415 -0
  175. package/boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp +431 -0
  176. package/boost/numeric/odeint/stepper/bulirsch_stoer.hpp +642 -0
  177. package/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp +838 -0
  178. package/boost/numeric/odeint/stepper/controlled_adams_bashforth_moulton.hpp +322 -0
  179. package/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp +1018 -0
  180. package/boost/numeric/odeint/stepper/controlled_step_result.hpp +42 -0
  181. package/boost/numeric/odeint/stepper/dense_output_runge_kutta.hpp +476 -0
  182. package/boost/numeric/odeint/stepper/detail/adams_bashforth_call_algebra.hpp +148 -0
  183. package/boost/numeric/odeint/stepper/detail/adams_bashforth_coefficients.hpp +168 -0
  184. package/boost/numeric/odeint/stepper/detail/adams_moulton_call_algebra.hpp +148 -0
  185. package/boost/numeric/odeint/stepper/detail/adams_moulton_coefficients.hpp +168 -0
  186. package/boost/numeric/odeint/stepper/detail/adaptive_adams_coefficients.hpp +207 -0
  187. package/boost/numeric/odeint/stepper/detail/generic_rk_algorithm.hpp +247 -0
  188. package/boost/numeric/odeint/stepper/detail/generic_rk_call_algebra.hpp +263 -0
  189. package/boost/numeric/odeint/stepper/detail/generic_rk_operations.hpp +252 -0
  190. package/boost/numeric/odeint/stepper/detail/pid_step_adjuster.hpp +199 -0
  191. package/boost/numeric/odeint/stepper/detail/pid_step_adjuster_coefficients.hpp +180 -0
  192. package/boost/numeric/odeint/stepper/detail/rotating_buffer.hpp +84 -0
  193. package/boost/numeric/odeint/stepper/euler.hpp +166 -0
  194. package/boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp +255 -0
  195. package/boost/numeric/odeint/stepper/explicit_generic_rk.hpp +246 -0
  196. package/boost/numeric/odeint/stepper/extrapolation_stepper.hpp +288 -0
  197. package/boost/numeric/odeint/stepper/generation/generation_controlled_adams_bashforth_moulton.hpp +59 -0
  198. package/boost/numeric/odeint/stepper/generation/generation_controlled_runge_kutta.hpp +61 -0
  199. package/boost/numeric/odeint/stepper/generation/generation_dense_output_runge_kutta.hpp +65 -0
  200. package/boost/numeric/odeint/stepper/generation/generation_rosenbrock4.hpp +79 -0
  201. package/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54.hpp +47 -0
  202. package/boost/numeric/odeint/stepper/generation/generation_runge_kutta_cash_karp54_classic.hpp +48 -0
  203. package/boost/numeric/odeint/stepper/generation/generation_runge_kutta_dopri5.hpp +56 -0
  204. package/boost/numeric/odeint/stepper/generation/generation_runge_kutta_fehlberg78.hpp +46 -0
  205. package/boost/numeric/odeint/stepper/generation/make_controlled.hpp +103 -0
  206. package/boost/numeric/odeint/stepper/generation/make_dense_output.hpp +100 -0
  207. package/boost/numeric/odeint/stepper/generation.hpp +37 -0
  208. package/boost/numeric/odeint/stepper/implicit_euler.hpp +170 -0
  209. package/boost/numeric/odeint/stepper/modified_midpoint.hpp +315 -0
  210. package/boost/numeric/odeint/stepper/rosenbrock4.hpp +346 -0
  211. package/boost/numeric/odeint/stepper/rosenbrock4_controller.hpp +240 -0
  212. package/boost/numeric/odeint/stepper/rosenbrock4_dense_output.hpp +204 -0
  213. package/boost/numeric/odeint/stepper/runge_kutta4.hpp +181 -0
  214. package/boost/numeric/odeint/stepper/runge_kutta4_classic.hpp +232 -0
  215. package/boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp +231 -0
  216. package/boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp +289 -0
  217. package/boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp +403 -0
  218. package/boost/numeric/odeint/stepper/runge_kutta_fehlberg78.hpp +374 -0
  219. package/boost/numeric/odeint/stepper/stepper_categories.hpp +66 -0
  220. package/boost/numeric/odeint/stepper/symplectic_euler.hpp +136 -0
  221. package/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_m4_mclachlan.hpp +160 -0
  222. package/boost/numeric/odeint/stepper/symplectic_rkn_sb3a_mclachlan.hpp +162 -0
  223. package/boost/numeric/odeint/stepper/velocity_verlet.hpp +375 -0
  224. package/boost/numeric/odeint/tools/assert.hpp +30 -0
  225. package/boost/numeric/odeint/tools/is_standalone.hpp +21 -0
  226. package/boost/numeric/odeint/tools/traits.hpp +39 -0
  227. package/boost/numeric/odeint/util/bind.hpp +35 -0
  228. package/boost/numeric/odeint/util/copy.hpp +88 -0
  229. package/boost/numeric/odeint/util/detail/is_range.hpp +127 -0
  230. package/boost/numeric/odeint/util/detail/less_with_sign.hpp +78 -0
  231. package/boost/numeric/odeint/util/is_pair.hpp +42 -0
  232. package/boost/numeric/odeint/util/is_resizeable.hpp +84 -0
  233. package/boost/numeric/odeint/util/multi_array_adaption.hpp +131 -0
  234. package/boost/numeric/odeint/util/n_ary_helper.hpp +96 -0
  235. package/boost/numeric/odeint/util/odeint_error.hpp +77 -0
  236. package/boost/numeric/odeint/util/resize.hpp +120 -0
  237. package/boost/numeric/odeint/util/resizer.hpp +94 -0
  238. package/boost/numeric/odeint/util/same_instance.hpp +56 -0
  239. package/boost/numeric/odeint/util/same_size.hpp +117 -0
  240. package/boost/numeric/odeint/util/split.hpp +64 -0
  241. package/boost/numeric/odeint/util/split_adaptor.hpp +103 -0
  242. package/boost/numeric/odeint/util/state_wrapper.hpp +50 -0
  243. package/boost/numeric/odeint/util/stepper_traits.hpp +63 -0
  244. package/boost/numeric/odeint/util/ublas_matrix_expression.patch +6 -0
  245. package/boost/numeric/odeint/util/ublas_wrapper.hpp +297 -0
  246. package/boost/numeric/odeint/util/unit_helper.hpp +151 -0
  247. package/boost/numeric/odeint/util/unwrap_reference.hpp +141 -0
  248. package/boost/numeric/odeint/version.hpp +55 -0
  249. package/boost/numeric/odeint.hpp +87 -0
  250. package/boost/numeric/ublas/assignment.hpp +1288 -0
  251. package/boost/numeric/ublas/banded.hpp +2372 -0
  252. package/boost/numeric/ublas/blas.hpp +499 -0
  253. package/boost/numeric/ublas/detail/concepts.hpp +1465 -0
  254. package/boost/numeric/ublas/detail/config.hpp +304 -0
  255. package/boost/numeric/ublas/detail/definitions.hpp +212 -0
  256. package/boost/numeric/ublas/detail/documentation.hpp +33 -0
  257. package/boost/numeric/ublas/detail/duff.hpp +56 -0
  258. package/boost/numeric/ublas/detail/iterator.hpp +1448 -0
  259. package/boost/numeric/ublas/detail/matrix_assign.hpp +1785 -0
  260. package/boost/numeric/ublas/detail/raw.hpp +878 -0
  261. package/boost/numeric/ublas/detail/returntype_deduction.hpp +174 -0
  262. package/boost/numeric/ublas/detail/temporary.hpp +33 -0
  263. package/boost/numeric/ublas/detail/vector_assign.hpp +609 -0
  264. package/boost/numeric/ublas/doxydoc.hpp +58 -0
  265. package/boost/numeric/ublas/exception.hpp +297 -0
  266. package/boost/numeric/ublas/experimental/sparse_view.hpp +317 -0
  267. package/boost/numeric/ublas/expression_types.hpp +506 -0
  268. package/boost/numeric/ublas/functional.hpp +2112 -0
  269. package/boost/numeric/ublas/fwd.hpp +229 -0
  270. package/boost/numeric/ublas/hermitian.hpp +2633 -0
  271. package/boost/numeric/ublas/io.hpp +355 -0
  272. package/boost/numeric/ublas/lu.hpp +350 -0
  273. package/boost/numeric/ublas/matrix.hpp +6013 -0
  274. package/boost/numeric/ublas/matrix_expression.hpp +5693 -0
  275. package/boost/numeric/ublas/matrix_proxy.hpp +5457 -0
  276. package/boost/numeric/ublas/matrix_sparse.hpp +5773 -0
  277. package/boost/numeric/ublas/matrix_vector.hpp +406 -0
  278. package/boost/numeric/ublas/opencl/elementwise.hpp +508 -0
  279. package/boost/numeric/ublas/opencl/library.hpp +38 -0
  280. package/boost/numeric/ublas/opencl/matrix.hpp +123 -0
  281. package/boost/numeric/ublas/opencl/misc.hpp +182 -0
  282. package/boost/numeric/ublas/opencl/operations.hpp +18 -0
  283. package/boost/numeric/ublas/opencl/prod.hpp +364 -0
  284. package/boost/numeric/ublas/opencl/transpose.hpp +142 -0
  285. package/boost/numeric/ublas/opencl/vector.hpp +90 -0
  286. package/boost/numeric/ublas/opencl.hpp +16 -0
  287. package/boost/numeric/ublas/operation/begin.hpp +318 -0
  288. package/boost/numeric/ublas/operation/c_array.hpp +41 -0
  289. package/boost/numeric/ublas/operation/end.hpp +318 -0
  290. package/boost/numeric/ublas/operation/num_columns.hpp +45 -0
  291. package/boost/numeric/ublas/operation/num_rows.hpp +44 -0
  292. package/boost/numeric/ublas/operation/size.hpp +350 -0
  293. package/boost/numeric/ublas/operation.hpp +830 -0
  294. package/boost/numeric/ublas/operation_blocked.hpp +266 -0
  295. package/boost/numeric/ublas/operation_sparse.hpp +198 -0
  296. package/boost/numeric/ublas/operations.hpp +26 -0
  297. package/boost/numeric/ublas/storage.hpp +2131 -0
  298. package/boost/numeric/ublas/storage_sparse.hpp +578 -0
  299. package/boost/numeric/ublas/symmetric.hpp +2309 -0
  300. package/boost/numeric/ublas/tags.hpp +37 -0
  301. package/boost/numeric/ublas/tensor/algorithms.hpp +345 -0
  302. package/boost/numeric/ublas/tensor/expression.hpp +181 -0
  303. package/boost/numeric/ublas/tensor/expression_evaluation.hpp +288 -0
  304. package/boost/numeric/ublas/tensor/extents.hpp +335 -0
  305. package/boost/numeric/ublas/tensor/functions.hpp +558 -0
  306. package/boost/numeric/ublas/tensor/index.hpp +89 -0
  307. package/boost/numeric/ublas/tensor/multi_index.hpp +110 -0
  308. package/boost/numeric/ublas/tensor/multi_index_utility.hpp +364 -0
  309. package/boost/numeric/ublas/tensor/multiplication.hpp +945 -0
  310. package/boost/numeric/ublas/tensor/operators_arithmetic.hpp +244 -0
  311. package/boost/numeric/ublas/tensor/operators_comparison.hpp +175 -0
  312. package/boost/numeric/ublas/tensor/ostream.hpp +122 -0
  313. package/boost/numeric/ublas/tensor/storage_traits.hpp +84 -0
  314. package/boost/numeric/ublas/tensor/strides.hpp +251 -0
  315. package/boost/numeric/ublas/tensor/tensor.hpp +734 -0
  316. package/boost/numeric/ublas/tensor.hpp +26 -0
  317. package/boost/numeric/ublas/traits/c_array.hpp +110 -0
  318. package/boost/numeric/ublas/traits/const_iterator_type.hpp +127 -0
  319. package/boost/numeric/ublas/traits/iterator_type.hpp +126 -0
  320. package/boost/numeric/ublas/traits.hpp +753 -0
  321. package/boost/numeric/ublas/triangular.hpp +2775 -0
  322. package/boost/numeric/ublas/vector.hpp +2947 -0
  323. package/boost/numeric/ublas/vector_expression.hpp +1762 -0
  324. package/boost/numeric/ublas/vector_of_vector.hpp +1347 -0
  325. package/boost/numeric/ublas/vector_proxy.hpp +1697 -0
  326. package/boost/numeric/ublas/vector_sparse.hpp +2246 -0
  327. package/package.json +3 -7
@@ -0,0 +1,1448 @@
1
+ //
2
+ // Copyright (c) 2000-2002
3
+ // Joerg Walter, Mathias Koch
4
+ //
5
+ // Distributed under the Boost Software License, Version 1.0. (See
6
+ // accompanying file LICENSE_1_0.txt or copy at
7
+ // http://www.boost.org/LICENSE_1_0.txt)
8
+ //
9
+ // The authors gratefully acknowledge the support of
10
+ // GeNeSys mbH & Co. KG in producing this work.
11
+ //
12
+
13
+ #ifndef _BOOST_UBLAS_ITERATOR_
14
+ #define _BOOST_UBLAS_ITERATOR_
15
+
16
+ #include <boost/numeric/ublas/exception.hpp>
17
+ #include <iterator>
18
+
19
+
20
+ namespace boost { namespace numeric { namespace ublas {
21
+
22
+ /** \brief Base class of all proxy classes that contain
23
+ * a (redirectable) reference to an immutable object.
24
+ *
25
+ * \param C the type of the container referred to
26
+ */
27
+ template<class C>
28
+ class container_const_reference:
29
+ private nonassignable {
30
+ public:
31
+ typedef C container_type;
32
+
33
+ BOOST_UBLAS_INLINE
34
+ container_const_reference ():
35
+ c_ (0) {}
36
+ BOOST_UBLAS_INLINE
37
+ container_const_reference (const container_type &c):
38
+ c_ (&c) {}
39
+
40
+ BOOST_UBLAS_INLINE
41
+ const container_type &operator () () const {
42
+ return *c_;
43
+ }
44
+
45
+ BOOST_UBLAS_INLINE
46
+ container_const_reference &assign (const container_type *c) {
47
+ c_ = c;
48
+ return *this;
49
+ }
50
+
51
+ // Closure comparison
52
+ BOOST_UBLAS_INLINE
53
+ bool same_closure (const container_const_reference &cr) const {
54
+ return c_ == cr.c_;
55
+ }
56
+
57
+ private:
58
+ const container_type *c_;
59
+ };
60
+
61
+ /** \brief Base class of all proxy classes that contain
62
+ * a (redirectable) reference to a mutable object.
63
+ *
64
+ * \param C the type of the container referred to
65
+ */
66
+ template<class C>
67
+ class container_reference:
68
+ private nonassignable {
69
+ public:
70
+ typedef C container_type;
71
+
72
+ BOOST_UBLAS_INLINE
73
+ container_reference ():
74
+ c_ (0) {}
75
+ BOOST_UBLAS_INLINE
76
+ container_reference (container_type &c):
77
+ c_ (&c) {}
78
+
79
+ BOOST_UBLAS_INLINE
80
+ container_type &operator () () const {
81
+ return *c_;
82
+ }
83
+
84
+ BOOST_UBLAS_INLINE
85
+ container_reference &assign (container_type *c) {
86
+ c_ = c;
87
+ return *this;
88
+ }
89
+
90
+ // Closure comparison
91
+ BOOST_UBLAS_INLINE
92
+ bool same_closure (const container_reference &cr) const {
93
+ return c_ == cr.c_;
94
+ }
95
+
96
+ private:
97
+ container_type *c_;
98
+ };
99
+
100
+ /** \brief Base class of all forward iterators.
101
+ *
102
+ * \param IC the iterator category
103
+ * \param I the derived iterator type
104
+ * \param T the value type
105
+ *
106
+ * The forward iterator can only proceed in one direction
107
+ * via the post increment operator.
108
+ */
109
+ template<class IC, class I, class T>
110
+ struct forward_iterator_base {
111
+ typedef IC iterator_category;
112
+ typedef T value_type;
113
+ typedef std::ptrdiff_t difference_type;
114
+ typedef T* pointer;
115
+ typedef T& reference;
116
+ typedef I derived_iterator_type;
117
+ typedef T derived_value_type;
118
+
119
+ // Arithmetic
120
+ BOOST_UBLAS_INLINE
121
+ derived_iterator_type operator ++ (int) {
122
+ derived_iterator_type &d (*static_cast<const derived_iterator_type *> (this));
123
+ derived_iterator_type tmp (d);
124
+ ++ d;
125
+ return tmp;
126
+ }
127
+ BOOST_UBLAS_INLINE
128
+ friend derived_iterator_type operator ++ (derived_iterator_type &d, int) {
129
+ derived_iterator_type tmp (d);
130
+ ++ d;
131
+ return tmp;
132
+ }
133
+
134
+ // Comparison
135
+ BOOST_UBLAS_INLINE
136
+ bool operator != (const derived_iterator_type &it) const {
137
+ const derived_iterator_type *d = static_cast<const derived_iterator_type *> (this);
138
+ return ! (*d == it);
139
+ }
140
+ };
141
+
142
+ /** \brief Base class of all bidirectional iterators.
143
+ *
144
+ * \param IC the iterator category
145
+ * \param I the derived iterator type
146
+ * \param T the value type
147
+ *
148
+ * The bidirectional iterator can proceed in both directions
149
+ * via the post increment and post decrement operator.
150
+ */
151
+ template<class IC, class I, class T>
152
+ struct bidirectional_iterator_base {
153
+ typedef IC iterator_category;
154
+ typedef T value_type;
155
+ typedef std::ptrdiff_t difference_type;
156
+ typedef T* pointer;
157
+ typedef T& reference;
158
+ typedef I derived_iterator_type;
159
+ typedef T derived_value_type;
160
+
161
+ // Arithmetic
162
+ BOOST_UBLAS_INLINE
163
+ derived_iterator_type operator ++ (int) {
164
+ derived_iterator_type &d (*static_cast<const derived_iterator_type *> (this));
165
+ derived_iterator_type tmp (d);
166
+ ++ d;
167
+ return tmp;
168
+ }
169
+ BOOST_UBLAS_INLINE
170
+ friend derived_iterator_type operator ++ (derived_iterator_type &d, int) {
171
+ derived_iterator_type tmp (d);
172
+ ++ d;
173
+ return tmp;
174
+ }
175
+ BOOST_UBLAS_INLINE
176
+ derived_iterator_type operator -- (int) {
177
+ derived_iterator_type &d (*static_cast<const derived_iterator_type *> (this));
178
+ derived_iterator_type tmp (d);
179
+ -- d;
180
+ return tmp;
181
+ }
182
+ BOOST_UBLAS_INLINE
183
+ friend derived_iterator_type operator -- (derived_iterator_type &d, int) {
184
+ derived_iterator_type tmp (d);
185
+ -- d;
186
+ return tmp;
187
+ }
188
+
189
+ // Comparison
190
+ BOOST_UBLAS_INLINE
191
+ bool operator != (const derived_iterator_type &it) const {
192
+ const derived_iterator_type *d = static_cast<const derived_iterator_type *> (this);
193
+ return ! (*d == it);
194
+ }
195
+ };
196
+
197
+ /** \brief Base class of all random access iterators.
198
+ *
199
+ * \param IC the iterator category
200
+ * \param I the derived iterator type
201
+ * \param T the value type
202
+ * \param D the difference type, default: std::ptrdiff_t
203
+ *
204
+ * The random access iterator can proceed in both directions
205
+ * via the post increment/decrement operator or in larger steps
206
+ * via the +, - and +=, -= operators. The random access iterator
207
+ * is LessThan Comparable.
208
+ */
209
+ template<class IC, class I, class T, class D = std::ptrdiff_t>
210
+ // ISSUE the default for D seems rather dangerous as it can easily be (silently) incorrect
211
+ struct random_access_iterator_base {
212
+ typedef IC iterator_category;
213
+ typedef T value_type;
214
+ typedef D difference_type;
215
+ typedef T* pointer;
216
+ typedef T& reference;
217
+ typedef I derived_iterator_type;
218
+ typedef T derived_value_type;
219
+ typedef D derived_difference_type;
220
+
221
+ /* FIXME Need to explicitly pass derived_reference_type as otherwise I undefined type or forward declared
222
+ typedef typename derived_iterator_type::reference derived_reference_type;
223
+ // Indexed element
224
+ BOOST_UBLAS_INLINE
225
+ derived_reference_type operator [] (derived_difference_type n) {
226
+ return *(*this + n);
227
+ }
228
+ */
229
+
230
+ // Arithmetic
231
+ BOOST_UBLAS_INLINE
232
+ derived_iterator_type operator ++ (int) {
233
+ derived_iterator_type &d (*static_cast<derived_iterator_type *> (this));
234
+ derived_iterator_type tmp (d);
235
+ ++ d;
236
+ return tmp;
237
+ }
238
+ BOOST_UBLAS_INLINE
239
+ friend derived_iterator_type operator ++ (derived_iterator_type &d, int) {
240
+ derived_iterator_type tmp (d);
241
+ ++ d;
242
+ return tmp;
243
+ }
244
+ BOOST_UBLAS_INLINE
245
+ derived_iterator_type operator -- (int) {
246
+ derived_iterator_type &d (*static_cast<derived_iterator_type *> (this));
247
+ derived_iterator_type tmp (d);
248
+ -- d;
249
+ return tmp;
250
+ }
251
+ BOOST_UBLAS_INLINE
252
+ friend derived_iterator_type operator -- (derived_iterator_type &d, int) {
253
+ derived_iterator_type tmp (d);
254
+ -- d;
255
+ return tmp;
256
+ }
257
+ BOOST_UBLAS_INLINE
258
+ derived_iterator_type operator + (derived_difference_type n) const {
259
+ derived_iterator_type tmp (*static_cast<const derived_iterator_type *> (this));
260
+ return tmp += n;
261
+ }
262
+ BOOST_UBLAS_INLINE
263
+ friend derived_iterator_type operator + (const derived_iterator_type &d, derived_difference_type n) {
264
+ derived_iterator_type tmp (d);
265
+ return tmp += n;
266
+ }
267
+ BOOST_UBLAS_INLINE
268
+ friend derived_iterator_type operator + (derived_difference_type n, const derived_iterator_type &d) {
269
+ derived_iterator_type tmp (d);
270
+ return tmp += n;
271
+ }
272
+ BOOST_UBLAS_INLINE
273
+ derived_iterator_type operator - (derived_difference_type n) const {
274
+ derived_iterator_type tmp (*static_cast<const derived_iterator_type *> (this));
275
+ return tmp -= n;
276
+ }
277
+ BOOST_UBLAS_INLINE
278
+ friend derived_iterator_type operator - (const derived_iterator_type &d, derived_difference_type n) {
279
+ derived_iterator_type tmp (d);
280
+ return tmp -= n;
281
+ }
282
+
283
+ // Comparison
284
+ BOOST_UBLAS_INLINE
285
+ bool operator != (const derived_iterator_type &it) const {
286
+ const derived_iterator_type *d = static_cast<const derived_iterator_type *> (this);
287
+ return ! (*d == it);
288
+ }
289
+ BOOST_UBLAS_INLINE
290
+ bool operator <= (const derived_iterator_type &it) const {
291
+ const derived_iterator_type *d = static_cast<const derived_iterator_type *> (this);
292
+ return ! (it < *d);
293
+ }
294
+ BOOST_UBLAS_INLINE
295
+ bool operator >= (const derived_iterator_type &it) const {
296
+ const derived_iterator_type *d = static_cast<const derived_iterator_type *> (this);
297
+ return ! (*d < it);
298
+ }
299
+ BOOST_UBLAS_INLINE
300
+ bool operator > (const derived_iterator_type &it) const {
301
+ const derived_iterator_type *d = static_cast<const derived_iterator_type *> (this);
302
+ return it < *d;
303
+ }
304
+ };
305
+
306
+ /** \brief Base class of all reverse iterators. (non-MSVC version)
307
+ *
308
+ * \param I the derived iterator type
309
+ * \param T the value type
310
+ * \param R the reference type
311
+ *
312
+ * The reverse iterator implements a bidirectional iterator
313
+ * reversing the elements of the underlying iterator. It
314
+ * implements most operators of a random access iterator.
315
+ *
316
+ * uBLAS extension: it.index()
317
+ */
318
+
319
+ // Renamed this class from reverse_iterator to get
320
+ // typedef reverse_iterator<...> reverse_iterator
321
+ // working. Thanks to Gabriel Dos Reis for explaining this.
322
+ template <class I>
323
+ class reverse_iterator_base:
324
+ public std::reverse_iterator<I> {
325
+ public:
326
+ typedef typename I::container_type container_type;
327
+ typedef typename container_type::size_type size_type;
328
+ typedef typename I::difference_type difference_type;
329
+ typedef I iterator_type;
330
+
331
+ // Construction and destruction
332
+ BOOST_UBLAS_INLINE
333
+ reverse_iterator_base ():
334
+ std::reverse_iterator<iterator_type> () {}
335
+ BOOST_UBLAS_INLINE
336
+ reverse_iterator_base (const iterator_type &it):
337
+ std::reverse_iterator<iterator_type> (it) {}
338
+
339
+ // Arithmetic
340
+ BOOST_UBLAS_INLINE
341
+ reverse_iterator_base &operator ++ () {
342
+ return *this = -- this->base ();
343
+ }
344
+ BOOST_UBLAS_INLINE
345
+ reverse_iterator_base operator ++ (int) {
346
+ reverse_iterator_base tmp (*this);
347
+ *this = -- this->base ();
348
+ return tmp;
349
+ }
350
+ BOOST_UBLAS_INLINE
351
+ reverse_iterator_base &operator -- () {
352
+ return *this = ++ this->base ();
353
+ }
354
+ BOOST_UBLAS_INLINE
355
+ reverse_iterator_base operator -- (int) {
356
+ reverse_iterator_base tmp (*this);
357
+ *this = ++ this->base ();
358
+ return tmp;
359
+ }
360
+ BOOST_UBLAS_INLINE
361
+ reverse_iterator_base &operator += (difference_type n) {
362
+ return *this = this->base () - n;
363
+ }
364
+ BOOST_UBLAS_INLINE
365
+ reverse_iterator_base &operator -= (difference_type n) {
366
+ return *this = this->base () + n;
367
+ }
368
+
369
+ BOOST_UBLAS_INLINE
370
+ friend reverse_iterator_base operator + (const reverse_iterator_base &it, difference_type n) {
371
+ reverse_iterator_base tmp (it);
372
+ return tmp += n;
373
+ }
374
+ BOOST_UBLAS_INLINE
375
+ friend reverse_iterator_base operator + (difference_type n, const reverse_iterator_base &it) {
376
+ reverse_iterator_base tmp (it);
377
+ return tmp += n;
378
+ }
379
+ BOOST_UBLAS_INLINE
380
+ friend reverse_iterator_base operator - (const reverse_iterator_base &it, difference_type n) {
381
+ reverse_iterator_base tmp (it);
382
+ return tmp -= n;
383
+ }
384
+ BOOST_UBLAS_INLINE
385
+ friend difference_type operator - (const reverse_iterator_base &it1, const reverse_iterator_base &it2) {
386
+ return it2.base () - it1.base ();
387
+ }
388
+
389
+ BOOST_UBLAS_INLINE
390
+ const container_type &operator () () const {
391
+ return this->base () ();
392
+ }
393
+
394
+ BOOST_UBLAS_INLINE
395
+ size_type index () const {
396
+ iterator_type tmp (this->base ());
397
+ return (-- tmp).index ();
398
+ }
399
+ };
400
+
401
+ /** \brief 1st base class of all matrix reverse iterators. (non-MSVC version)
402
+ *
403
+ * \param I the derived iterator type
404
+ *
405
+ * The reverse iterator implements a bidirectional iterator
406
+ * reversing the elements of the underlying iterator. It
407
+ * implements most operators of a random access iterator.
408
+ *
409
+ * uBLAS extension: it.index1(), it.index2() and access to
410
+ * the dual iterator via begin(), end(), rbegin(), rend()
411
+ */
412
+
413
+ // Renamed this class from reverse_iterator1 to get
414
+ // typedef reverse_iterator1<...> reverse_iterator1
415
+ // working. Thanks to Gabriel Dos Reis for explaining this.
416
+ template <class I>
417
+ class reverse_iterator_base1:
418
+ public std::reverse_iterator<I> {
419
+ public:
420
+ typedef typename I::container_type container_type;
421
+ typedef typename container_type::size_type size_type;
422
+ typedef typename I::difference_type difference_type;
423
+ typedef I iterator_type;
424
+ typedef typename I::dual_iterator_type dual_iterator_type;
425
+ typedef typename I::dual_reverse_iterator_type dual_reverse_iterator_type;
426
+
427
+ // Construction and destruction
428
+ BOOST_UBLAS_INLINE
429
+ reverse_iterator_base1 ():
430
+ std::reverse_iterator<iterator_type> () {}
431
+ BOOST_UBLAS_INLINE
432
+ reverse_iterator_base1 (const iterator_type &it):
433
+ std::reverse_iterator<iterator_type> (it) {}
434
+
435
+ // Arithmetic
436
+ BOOST_UBLAS_INLINE
437
+ reverse_iterator_base1 &operator ++ () {
438
+ return *this = -- this->base ();
439
+ }
440
+ BOOST_UBLAS_INLINE
441
+ reverse_iterator_base1 operator ++ (int) {
442
+ reverse_iterator_base1 tmp (*this);
443
+ *this = -- this->base ();
444
+ return tmp;
445
+ }
446
+ BOOST_UBLAS_INLINE
447
+ reverse_iterator_base1 &operator -- () {
448
+ return *this = ++ this->base ();
449
+ }
450
+ BOOST_UBLAS_INLINE
451
+ reverse_iterator_base1 operator -- (int) {
452
+ reverse_iterator_base1 tmp (*this);
453
+ *this = ++ this->base ();
454
+ return tmp;
455
+ }
456
+ BOOST_UBLAS_INLINE
457
+ reverse_iterator_base1 &operator += (difference_type n) {
458
+ return *this = this->base () - n;
459
+ }
460
+ BOOST_UBLAS_INLINE
461
+ reverse_iterator_base1 &operator -= (difference_type n) {
462
+ return *this = this->base () + n;
463
+ }
464
+
465
+ BOOST_UBLAS_INLINE
466
+ friend reverse_iterator_base1 operator + (const reverse_iterator_base1 &it, difference_type n) {
467
+ reverse_iterator_base1 tmp (it);
468
+ return tmp += n;
469
+ }
470
+ BOOST_UBLAS_INLINE
471
+ friend reverse_iterator_base1 operator + (difference_type n, const reverse_iterator_base1 &it) {
472
+ reverse_iterator_base1 tmp (it);
473
+ return tmp += n;
474
+ }
475
+ BOOST_UBLAS_INLINE
476
+ friend reverse_iterator_base1 operator - (const reverse_iterator_base1 &it, difference_type n) {
477
+ reverse_iterator_base1 tmp (it);
478
+ return tmp -= n;
479
+ }
480
+ BOOST_UBLAS_INLINE
481
+ friend difference_type operator - (const reverse_iterator_base1 &it1, const reverse_iterator_base1 &it2) {
482
+ return it2.base () - it1.base ();
483
+ }
484
+
485
+ BOOST_UBLAS_INLINE
486
+ const container_type &operator () () const {
487
+ return this->base () ();
488
+ }
489
+
490
+ BOOST_UBLAS_INLINE
491
+ size_type index1 () const {
492
+ iterator_type tmp (this->base ());
493
+ return (-- tmp).index1 ();
494
+ }
495
+ BOOST_UBLAS_INLINE
496
+ size_type index2 () const {
497
+ iterator_type tmp (this->base ());
498
+ return (-- tmp).index2 ();
499
+ }
500
+
501
+ BOOST_UBLAS_INLINE
502
+ dual_iterator_type begin () const {
503
+ iterator_type tmp (this->base ());
504
+ return (-- tmp).begin ();
505
+ }
506
+ BOOST_UBLAS_INLINE
507
+ dual_iterator_type end () const {
508
+ iterator_type tmp (this->base ());
509
+ return (-- tmp).end ();
510
+ }
511
+ BOOST_UBLAS_INLINE
512
+ dual_reverse_iterator_type rbegin () const {
513
+ return dual_reverse_iterator_type (end ());
514
+ }
515
+ BOOST_UBLAS_INLINE
516
+ dual_reverse_iterator_type rend () const {
517
+ return dual_reverse_iterator_type (begin ());
518
+ }
519
+ };
520
+
521
+ /** \brief 2nd base class of all matrix reverse iterators. (non-MSVC version)
522
+ *
523
+ * \param I the derived iterator type
524
+ *
525
+ * The reverse iterator implements a bidirectional iterator
526
+ * reversing the elements of the underlying iterator. It
527
+ * implements most operators of a random access iterator.
528
+ *
529
+ * uBLAS extension: it.index1(), it.index2() and access to
530
+ * the dual iterator via begin(), end(), rbegin(), rend()
531
+ *
532
+ * Note: this type is _identical_ to reverse_iterator_base1
533
+ */
534
+
535
+ // Renamed this class from reverse_iterator2 to get
536
+ // typedef reverse_iterator2<...> reverse_iterator2
537
+ // working. Thanks to Gabriel Dos Reis for explaining this.
538
+ template <class I>
539
+ class reverse_iterator_base2:
540
+ public std::reverse_iterator<I> {
541
+ public:
542
+ typedef typename I::container_type container_type;
543
+ typedef typename container_type::size_type size_type;
544
+ typedef typename I::difference_type difference_type;
545
+ typedef I iterator_type;
546
+ typedef typename I::dual_iterator_type dual_iterator_type;
547
+ typedef typename I::dual_reverse_iterator_type dual_reverse_iterator_type;
548
+
549
+ // Construction and destruction
550
+ BOOST_UBLAS_INLINE
551
+ reverse_iterator_base2 ():
552
+ std::reverse_iterator<iterator_type> () {}
553
+ BOOST_UBLAS_INLINE
554
+ reverse_iterator_base2 (const iterator_type &it):
555
+ std::reverse_iterator<iterator_type> (it) {}
556
+
557
+ // Arithmetic
558
+ BOOST_UBLAS_INLINE
559
+ reverse_iterator_base2 &operator ++ () {
560
+ return *this = -- this->base ();
561
+ }
562
+ BOOST_UBLAS_INLINE
563
+ reverse_iterator_base2 operator ++ (int) {
564
+ reverse_iterator_base2 tmp (*this);
565
+ *this = -- this->base ();
566
+ return tmp;
567
+ }
568
+ BOOST_UBLAS_INLINE
569
+ reverse_iterator_base2 &operator -- () {
570
+ return *this = ++ this->base ();
571
+ }
572
+ BOOST_UBLAS_INLINE
573
+ reverse_iterator_base2 operator -- (int) {
574
+ reverse_iterator_base2 tmp (*this);
575
+ *this = ++ this->base ();
576
+ return tmp;
577
+ }
578
+ BOOST_UBLAS_INLINE
579
+ reverse_iterator_base2 &operator += (difference_type n) {
580
+ return *this = this->base () - n;
581
+ }
582
+ BOOST_UBLAS_INLINE
583
+ reverse_iterator_base2 &operator -= (difference_type n) {
584
+ return *this = this->base () + n;
585
+ }
586
+
587
+ BOOST_UBLAS_INLINE
588
+ friend reverse_iterator_base2 operator + (const reverse_iterator_base2 &it, difference_type n) {
589
+ reverse_iterator_base2 tmp (it);
590
+ return tmp += n;
591
+ }
592
+ BOOST_UBLAS_INLINE
593
+ friend reverse_iterator_base2 operator + (difference_type n, const reverse_iterator_base2 &it) {
594
+ reverse_iterator_base2 tmp (it);
595
+ return tmp += n;
596
+ }
597
+ BOOST_UBLAS_INLINE
598
+ friend reverse_iterator_base2 operator - (const reverse_iterator_base2 &it, difference_type n) {
599
+ reverse_iterator_base2 tmp (it);
600
+ return tmp -= n;
601
+ }
602
+ BOOST_UBLAS_INLINE
603
+ friend difference_type operator - (const reverse_iterator_base2 &it1, const reverse_iterator_base2 &it2) {
604
+ return it2.base () - it1.base ();
605
+ }
606
+
607
+ BOOST_UBLAS_INLINE
608
+ const container_type &operator () () const {
609
+ return this->base () ();
610
+ }
611
+
612
+ BOOST_UBLAS_INLINE
613
+ size_type index1 () const {
614
+ iterator_type tmp (this->base ());
615
+ return (-- tmp).index1 ();
616
+ }
617
+ BOOST_UBLAS_INLINE
618
+ size_type index2 () const {
619
+ iterator_type tmp (this->base ());
620
+ return (-- tmp).index2 ();
621
+ }
622
+
623
+ BOOST_UBLAS_INLINE
624
+ dual_iterator_type begin () const {
625
+ iterator_type tmp (this->base ());
626
+ return (-- tmp).begin ();
627
+ }
628
+ BOOST_UBLAS_INLINE
629
+ dual_iterator_type end () const {
630
+ iterator_type tmp (this->base ());
631
+ return (-- tmp).end ();
632
+ }
633
+ BOOST_UBLAS_INLINE
634
+ dual_reverse_iterator_type rbegin () const {
635
+ return dual_reverse_iterator_type (end ());
636
+ }
637
+ BOOST_UBLAS_INLINE
638
+ dual_reverse_iterator_type rend () const {
639
+ return dual_reverse_iterator_type (begin ());
640
+ }
641
+ };
642
+
643
+ /** \brief A class implementing an indexed random access iterator.
644
+ *
645
+ * \param C the (mutable) container type
646
+ * \param IC the iterator category
647
+ *
648
+ * This class implements a random access iterator. The current
649
+ * position is stored as the unsigned integer it_ and the
650
+ * values are accessed via operator()(it_) of the container.
651
+ *
652
+ * uBLAS extension: index()
653
+ */
654
+
655
+ template<class C, class IC>
656
+ class indexed_iterator:
657
+ public container_reference<C>,
658
+ public random_access_iterator_base<IC,
659
+ indexed_iterator<C, IC>,
660
+ typename C::value_type,
661
+ typename C::difference_type> {
662
+ public:
663
+ typedef C container_type;
664
+ typedef IC iterator_category;
665
+ typedef typename container_type::size_type size_type;
666
+ typedef typename container_type::difference_type difference_type;
667
+ typedef typename container_type::value_type value_type;
668
+ typedef typename container_type::reference reference;
669
+
670
+ // Construction and destruction
671
+ BOOST_UBLAS_INLINE
672
+ indexed_iterator ():
673
+ container_reference<container_type> (), it_ () {}
674
+ BOOST_UBLAS_INLINE
675
+ indexed_iterator (container_type &c, size_type it):
676
+ container_reference<container_type> (c), it_ (it) {}
677
+
678
+ // Arithmetic
679
+ BOOST_UBLAS_INLINE
680
+ indexed_iterator &operator ++ () {
681
+ ++ it_;
682
+ return *this;
683
+ }
684
+ BOOST_UBLAS_INLINE
685
+ indexed_iterator &operator -- () {
686
+ -- it_;
687
+ return *this;
688
+ }
689
+ BOOST_UBLAS_INLINE
690
+ indexed_iterator &operator += (difference_type n) {
691
+ it_ += n;
692
+ return *this;
693
+ }
694
+ BOOST_UBLAS_INLINE
695
+ indexed_iterator &operator -= (difference_type n) {
696
+ it_ -= n;
697
+ return *this;
698
+ }
699
+ BOOST_UBLAS_INLINE
700
+ difference_type operator - (const indexed_iterator &it) const {
701
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
702
+ return it_ - it.it_;
703
+ }
704
+
705
+ // Dereference
706
+ BOOST_UBLAS_INLINE
707
+ reference operator * () const {
708
+ BOOST_UBLAS_CHECK (index () < (*this) ().size (), bad_index ());
709
+ return (*this) () (it_);
710
+ }
711
+ BOOST_UBLAS_INLINE
712
+ reference operator [] (difference_type n) const {
713
+ return *((*this) + n);
714
+ }
715
+
716
+ // Index
717
+ BOOST_UBLAS_INLINE
718
+ size_type index () const {
719
+ return it_;
720
+ }
721
+
722
+ // Assignment
723
+ BOOST_UBLAS_INLINE
724
+ indexed_iterator &operator = (const indexed_iterator &it) {
725
+ // FIX: ICC needs full qualification?!
726
+ // assign (&it ());
727
+ container_reference<C>::assign (&it ());
728
+ it_ = it.it_;
729
+ return *this;
730
+ }
731
+
732
+ // Comparison
733
+ BOOST_UBLAS_INLINE
734
+ bool operator == (const indexed_iterator &it) const {
735
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
736
+ return it_ == it.it_;
737
+ }
738
+ BOOST_UBLAS_INLINE
739
+ bool operator < (const indexed_iterator &it) const {
740
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
741
+ return it_ < it.it_;
742
+ }
743
+
744
+ private:
745
+ size_type it_;
746
+ };
747
+
748
+ /** \brief A class implementing an indexed random access iterator.
749
+ *
750
+ * \param C the (immutable) container type
751
+ * \param IC the iterator category
752
+ *
753
+ * This class implements a random access iterator. The current
754
+ * position is stored as the unsigned integer \c it_ and the
755
+ * values are accessed via \c operator()(it_) of the container.
756
+ *
757
+ * uBLAS extension: \c index()
758
+ *
759
+ * Note: there is an automatic conversion from
760
+ * \c indexed_iterator to \c indexed_const_iterator
761
+ */
762
+
763
+ template<class C, class IC>
764
+ class indexed_const_iterator:
765
+ public container_const_reference<C>,
766
+ public random_access_iterator_base<IC,
767
+ indexed_const_iterator<C, IC>,
768
+ typename C::value_type,
769
+ typename C::difference_type> {
770
+ public:
771
+ typedef C container_type;
772
+ typedef IC iterator_category;
773
+ typedef typename container_type::size_type size_type;
774
+ typedef typename container_type::difference_type difference_type;
775
+ typedef typename container_type::value_type value_type;
776
+ typedef typename container_type::const_reference reference;
777
+ typedef indexed_iterator<container_type, iterator_category> iterator_type;
778
+
779
+ // Construction and destruction
780
+ BOOST_UBLAS_INLINE
781
+ indexed_const_iterator ():
782
+ container_const_reference<container_type> (), it_ () {}
783
+ BOOST_UBLAS_INLINE
784
+ indexed_const_iterator (const container_type &c, size_type it):
785
+ container_const_reference<container_type> (c), it_ (it) {}
786
+ BOOST_UBLAS_INLINE
787
+ indexed_const_iterator (const iterator_type &it):
788
+ container_const_reference<container_type> (it ()), it_ (it.index ()) {}
789
+
790
+ // Arithmetic
791
+ BOOST_UBLAS_INLINE
792
+ indexed_const_iterator &operator ++ () {
793
+ ++ it_;
794
+ return *this;
795
+ }
796
+ BOOST_UBLAS_INLINE
797
+ indexed_const_iterator &operator -- () {
798
+ -- it_;
799
+ return *this;
800
+ }
801
+ BOOST_UBLAS_INLINE
802
+ indexed_const_iterator &operator += (difference_type n) {
803
+ it_ += n;
804
+ return *this;
805
+ }
806
+ BOOST_UBLAS_INLINE
807
+ indexed_const_iterator &operator -= (difference_type n) {
808
+ it_ -= n;
809
+ return *this;
810
+ }
811
+ BOOST_UBLAS_INLINE
812
+ difference_type operator - (const indexed_const_iterator &it) const {
813
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
814
+ return it_ - it.it_;
815
+ }
816
+
817
+ // Dereference
818
+ BOOST_UBLAS_INLINE
819
+ reference operator * () const {
820
+ BOOST_UBLAS_CHECK (index () < (*this) ().size (), bad_index ());
821
+ return (*this) () (it_);
822
+ }
823
+ BOOST_UBLAS_INLINE
824
+ reference operator [] (difference_type n) const {
825
+ return *((*this) + n);
826
+ }
827
+
828
+ // Index
829
+ BOOST_UBLAS_INLINE
830
+ size_type index () const {
831
+ return it_;
832
+ }
833
+
834
+ // Assignment
835
+ BOOST_UBLAS_INLINE
836
+ indexed_const_iterator &operator = (const indexed_const_iterator &it) {
837
+ // FIX: ICC needs full qualification?!
838
+ // assign (&it ());
839
+ container_const_reference<C>::assign (&it ());
840
+ it_ = it.it_;
841
+ return *this;
842
+ }
843
+
844
+ // Comparison
845
+ BOOST_UBLAS_INLINE
846
+ bool operator == (const indexed_const_iterator &it) const {
847
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
848
+ return it_ == it.it_;
849
+ }
850
+ BOOST_UBLAS_INLINE
851
+ bool operator < (const indexed_const_iterator &it) const {
852
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
853
+ return it_ < it.it_;
854
+ }
855
+
856
+ private:
857
+ size_type it_;
858
+
859
+ friend class indexed_iterator<container_type, iterator_category>;
860
+ };
861
+
862
+ template<class C, class IC>
863
+ class indexed_iterator2;
864
+
865
+ /** \brief A class implementing an indexed random access iterator
866
+ * of a matrix.
867
+ *
868
+ * \param C the (mutable) container type
869
+ * \param IC the iterator category
870
+ *
871
+ * This class implements a random access iterator. The current
872
+ * position is stored as two unsigned integers \c it1_ and \c it2_
873
+ * and the values are accessed via \c operator()(it1_, it2_) of the
874
+ * container. The iterator changes the first index.
875
+ *
876
+ * uBLAS extension: \c index1(), \c index2() and access to the
877
+ * dual iterator via \c begin(), \c end(), \c rbegin() and \c rend()
878
+ *
879
+ * Note: The container has to support the \code find2(rank, i, j) \endcode
880
+ * method
881
+ */
882
+
883
+ template<class C, class IC>
884
+ class indexed_iterator1:
885
+ public container_reference<C>,
886
+ public random_access_iterator_base<IC,
887
+ indexed_iterator1<C, IC>,
888
+ typename C::value_type,
889
+ typename C::difference_type> {
890
+ public:
891
+ typedef C container_type;
892
+ typedef IC iterator_category;
893
+ typedef typename container_type::size_type size_type;
894
+ typedef typename container_type::difference_type difference_type;
895
+ typedef typename container_type::value_type value_type;
896
+ typedef typename container_type::reference reference;
897
+
898
+ typedef indexed_iterator2<container_type, iterator_category> dual_iterator_type;
899
+ typedef reverse_iterator_base2<dual_iterator_type> dual_reverse_iterator_type;
900
+
901
+ // Construction and destruction
902
+ BOOST_UBLAS_INLINE
903
+ indexed_iterator1 ():
904
+ container_reference<container_type> (), it1_ (), it2_ () {}
905
+ BOOST_UBLAS_INLINE
906
+ indexed_iterator1 (container_type &c, size_type it1, size_type it2):
907
+ container_reference<container_type> (c), it1_ (it1), it2_ (it2) {}
908
+
909
+ // Arithmetic
910
+ BOOST_UBLAS_INLINE
911
+ indexed_iterator1 &operator ++ () {
912
+ ++ it1_;
913
+ return *this;
914
+ }
915
+ BOOST_UBLAS_INLINE
916
+ indexed_iterator1 &operator -- () {
917
+ -- it1_;
918
+ return *this;
919
+ }
920
+ BOOST_UBLAS_INLINE
921
+ indexed_iterator1 &operator += (difference_type n) {
922
+ it1_ += n;
923
+ return *this;
924
+ }
925
+ BOOST_UBLAS_INLINE
926
+ indexed_iterator1 &operator -= (difference_type n) {
927
+ it1_ -= n;
928
+ return *this;
929
+ }
930
+ BOOST_UBLAS_INLINE
931
+ difference_type operator - (const indexed_iterator1 &it) const {
932
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
933
+ BOOST_UBLAS_CHECK (it2_ == it.it2_, external_logic ());
934
+ return it1_ - it.it1_;
935
+ }
936
+
937
+ // Dereference
938
+ BOOST_UBLAS_INLINE
939
+ reference operator * () const {
940
+ BOOST_UBLAS_CHECK (index1 () < (*this) ().size1 (), bad_index ());
941
+ BOOST_UBLAS_CHECK (index2 () < (*this) ().size2 (), bad_index ());
942
+ return (*this) () (it1_, it2_);
943
+ }
944
+ BOOST_UBLAS_INLINE
945
+ reference operator [] (difference_type n) const {
946
+ return *((*this) + n);
947
+ }
948
+
949
+ // Index
950
+ BOOST_UBLAS_INLINE
951
+ size_type index1 () const {
952
+ return it1_;
953
+ }
954
+ BOOST_UBLAS_INLINE
955
+ size_type index2 () const {
956
+ return it2_;
957
+ }
958
+
959
+ BOOST_UBLAS_INLINE
960
+ dual_iterator_type begin () const {
961
+ return (*this) ().find2 (1, index1 (), 0);
962
+ }
963
+ BOOST_UBLAS_INLINE
964
+ dual_iterator_type end () const {
965
+ return (*this) ().find2 (1, index1 (), (*this) ().size2 ());
966
+ }
967
+ BOOST_UBLAS_INLINE
968
+ dual_reverse_iterator_type rbegin () const {
969
+ return dual_reverse_iterator_type (end ());
970
+ }
971
+ BOOST_UBLAS_INLINE
972
+ dual_reverse_iterator_type rend () const {
973
+ return dual_reverse_iterator_type (begin ());
974
+ }
975
+
976
+ // Assignment
977
+ BOOST_UBLAS_INLINE
978
+ indexed_iterator1 &operator = (const indexed_iterator1 &it) {
979
+ // FIX: ICC needs full qualification?!
980
+ // assign (&it ());
981
+ container_reference<C>::assign (&it ());
982
+ it1_ = it.it1_;
983
+ it2_ = it.it2_;
984
+ return *this;
985
+ }
986
+
987
+ // Comparison
988
+ BOOST_UBLAS_INLINE
989
+ bool operator == (const indexed_iterator1 &it) const {
990
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
991
+ BOOST_UBLAS_CHECK (it2_ == it.it2_, external_logic ());
992
+ return it1_ == it.it1_;
993
+ }
994
+ BOOST_UBLAS_INLINE
995
+ bool operator < (const indexed_iterator1 &it) const {
996
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
997
+ BOOST_UBLAS_CHECK (it2_ == it.it2_, external_logic ());
998
+ return it1_ < it.it1_;
999
+ }
1000
+
1001
+ private:
1002
+ size_type it1_;
1003
+ size_type it2_;
1004
+ };
1005
+
1006
+ template<class C, class IC>
1007
+ class indexed_const_iterator2;
1008
+
1009
+ /** \brief A class implementing an indexed random access iterator
1010
+ * of a matrix.
1011
+ *
1012
+ * \param C the (immutable) container type
1013
+ * \param IC the iterator category
1014
+ *
1015
+ * This class implements a random access iterator. The current
1016
+ * position is stored as two unsigned integers \c it1_ and \c it2_
1017
+ * and the values are accessed via \c operator()(it1_, it2_) of the
1018
+ * container. The iterator changes the first index.
1019
+ *
1020
+ * uBLAS extension: \c index1(), \c index2() and access to the
1021
+ * dual iterator via \c begin(), \c end(), \c rbegin() and \c rend()
1022
+ *
1023
+ * Note 1: The container has to support the find2(rank, i, j) method
1024
+ *
1025
+ * Note 2: there is an automatic conversion from
1026
+ * \c indexed_iterator1 to \c indexed_const_iterator1
1027
+ */
1028
+
1029
+ template<class C, class IC>
1030
+ class indexed_const_iterator1:
1031
+ public container_const_reference<C>,
1032
+ public random_access_iterator_base<IC,
1033
+ indexed_const_iterator1<C, IC>,
1034
+ typename C::value_type,
1035
+ typename C::difference_type> {
1036
+ public:
1037
+ typedef C container_type;
1038
+ typedef IC iterator_category;
1039
+ typedef typename container_type::size_type size_type;
1040
+ typedef typename container_type::difference_type difference_type;
1041
+ typedef typename container_type::value_type value_type;
1042
+ typedef typename container_type::const_reference reference;
1043
+
1044
+ typedef indexed_iterator1<container_type, iterator_category> iterator_type;
1045
+ typedef indexed_const_iterator2<container_type, iterator_category> dual_iterator_type;
1046
+ typedef reverse_iterator_base2<dual_iterator_type> dual_reverse_iterator_type;
1047
+
1048
+ // Construction and destruction
1049
+ BOOST_UBLAS_INLINE
1050
+ indexed_const_iterator1 ():
1051
+ container_const_reference<container_type> (), it1_ (), it2_ () {}
1052
+ BOOST_UBLAS_INLINE
1053
+ indexed_const_iterator1 (const container_type &c, size_type it1, size_type it2):
1054
+ container_const_reference<container_type> (c), it1_ (it1), it2_ (it2) {}
1055
+ BOOST_UBLAS_INLINE
1056
+ indexed_const_iterator1 (const iterator_type &it):
1057
+ container_const_reference<container_type> (it ()), it1_ (it.index1 ()), it2_ (it.index2 ()) {}
1058
+
1059
+ // Arithmetic
1060
+ BOOST_UBLAS_INLINE
1061
+ indexed_const_iterator1 &operator ++ () {
1062
+ ++ it1_;
1063
+ return *this;
1064
+ }
1065
+ BOOST_UBLAS_INLINE
1066
+ indexed_const_iterator1 &operator -- () {
1067
+ -- it1_;
1068
+ return *this;
1069
+ }
1070
+ BOOST_UBLAS_INLINE
1071
+ indexed_const_iterator1 &operator += (difference_type n) {
1072
+ it1_ += n;
1073
+ return *this;
1074
+ }
1075
+ BOOST_UBLAS_INLINE
1076
+ indexed_const_iterator1 &operator -= (difference_type n) {
1077
+ it1_ -= n;
1078
+ return *this;
1079
+ }
1080
+ BOOST_UBLAS_INLINE
1081
+ difference_type operator - (const indexed_const_iterator1 &it) const {
1082
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
1083
+ BOOST_UBLAS_CHECK (it2_ == it.it2_, external_logic ());
1084
+ return it1_ - it.it1_;
1085
+ }
1086
+
1087
+ // Dereference
1088
+ BOOST_UBLAS_INLINE
1089
+ reference operator * () const {
1090
+ BOOST_UBLAS_CHECK (index1 () < (*this) ().size1 (), bad_index ());
1091
+ BOOST_UBLAS_CHECK (index2 () < (*this) ().size2 (), bad_index ());
1092
+ return (*this) () (it1_, it2_);
1093
+ }
1094
+ BOOST_UBLAS_INLINE
1095
+ reference operator [] (difference_type n) const {
1096
+ return *((*this) + n);
1097
+ }
1098
+
1099
+ // Index
1100
+ BOOST_UBLAS_INLINE
1101
+ size_type index1 () const {
1102
+ return it1_;
1103
+ }
1104
+ BOOST_UBLAS_INLINE
1105
+ size_type index2 () const {
1106
+ return it2_;
1107
+ }
1108
+
1109
+ BOOST_UBLAS_INLINE
1110
+ dual_iterator_type begin () const {
1111
+ return (*this) ().find2 (1, index1 (), 0);
1112
+ }
1113
+ BOOST_UBLAS_INLINE
1114
+ dual_iterator_type end () const {
1115
+ return (*this) ().find2 (1, index1 (), (*this) ().size2 ());
1116
+ }
1117
+ BOOST_UBLAS_INLINE
1118
+ dual_reverse_iterator_type rbegin () const {
1119
+ return dual_reverse_iterator_type (end ());
1120
+ }
1121
+ BOOST_UBLAS_INLINE
1122
+ dual_reverse_iterator_type rend () const {
1123
+ return dual_reverse_iterator_type (begin ());
1124
+ }
1125
+
1126
+ // Assignment
1127
+ BOOST_UBLAS_INLINE
1128
+ indexed_const_iterator1 &operator = (const indexed_const_iterator1 &it) {
1129
+ // FIX: ICC needs full qualification?!
1130
+ // assign (&it ());
1131
+ container_const_reference<C>::assign (&it ());
1132
+ it1_ = it.it1_;
1133
+ it2_ = it.it2_;
1134
+ return *this;
1135
+ }
1136
+
1137
+ // Comparison
1138
+ BOOST_UBLAS_INLINE
1139
+ bool operator == (const indexed_const_iterator1 &it) const {
1140
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
1141
+ BOOST_UBLAS_CHECK (it2_ == it.it2_, external_logic ());
1142
+ return it1_ == it.it1_;
1143
+ }
1144
+ BOOST_UBLAS_INLINE
1145
+ bool operator < (const indexed_const_iterator1 &it) const {
1146
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
1147
+ BOOST_UBLAS_CHECK (it2_ == it.it2_, external_logic ());
1148
+ return it1_ < it.it1_;
1149
+ }
1150
+
1151
+ private:
1152
+ size_type it1_;
1153
+ size_type it2_;
1154
+
1155
+ friend class indexed_iterator1<container_type, iterator_category>;
1156
+ };
1157
+
1158
+ /** \brief A class implementing an indexed random access iterator
1159
+ * of a matrix.
1160
+ *
1161
+ * \param C the (mutable) container type
1162
+ * \param IC the iterator category
1163
+ *
1164
+ * This class implements a random access iterator. The current
1165
+ * position is stored as two unsigned integers \c it1_ and \c it2_
1166
+ * and the values are accessed via \c operator()(it1_, it2_) of the
1167
+ * container. The iterator changes the second index.
1168
+ *
1169
+ * uBLAS extension: \c index1(), \c index2() and access to the
1170
+ * dual iterator via \c begin(), \c end(), \c rbegin() and \c rend()
1171
+ *
1172
+ * Note: The container has to support the find1(rank, i, j) method
1173
+ */
1174
+ template<class C, class IC>
1175
+ class indexed_iterator2:
1176
+ public container_reference<C>,
1177
+ public random_access_iterator_base<IC,
1178
+ indexed_iterator2<C, IC>,
1179
+ typename C::value_type,
1180
+ typename C::difference_type> {
1181
+ public:
1182
+ typedef C container_type;
1183
+ typedef IC iterator_category;
1184
+ typedef typename container_type::size_type size_type;
1185
+ typedef typename container_type::difference_type difference_type;
1186
+ typedef typename container_type::value_type value_type;
1187
+ typedef typename container_type::reference reference;
1188
+
1189
+ typedef indexed_iterator1<container_type, iterator_category> dual_iterator_type;
1190
+ typedef reverse_iterator_base1<dual_iterator_type> dual_reverse_iterator_type;
1191
+
1192
+ // Construction and destruction
1193
+ BOOST_UBLAS_INLINE
1194
+ indexed_iterator2 ():
1195
+ container_reference<container_type> (), it1_ (), it2_ () {}
1196
+ BOOST_UBLAS_INLINE
1197
+ indexed_iterator2 (container_type &c, size_type it1, size_type it2):
1198
+ container_reference<container_type> (c), it1_ (it1), it2_ (it2) {}
1199
+
1200
+ // Arithmetic
1201
+ BOOST_UBLAS_INLINE
1202
+ indexed_iterator2 &operator ++ () {
1203
+ ++ it2_;
1204
+ return *this;
1205
+ }
1206
+ BOOST_UBLAS_INLINE
1207
+ indexed_iterator2 &operator -- () {
1208
+ -- it2_;
1209
+ return *this;
1210
+ }
1211
+ BOOST_UBLAS_INLINE
1212
+ indexed_iterator2 &operator += (difference_type n) {
1213
+ it2_ += n;
1214
+ return *this;
1215
+ }
1216
+ BOOST_UBLAS_INLINE
1217
+ indexed_iterator2 &operator -= (difference_type n) {
1218
+ it2_ -= n;
1219
+ return *this;
1220
+ }
1221
+ BOOST_UBLAS_INLINE
1222
+ difference_type operator - (const indexed_iterator2 &it) const {
1223
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
1224
+ BOOST_UBLAS_CHECK (it1_ == it.it1_, external_logic ());
1225
+ return it2_ - it.it2_;
1226
+ }
1227
+
1228
+ // Dereference
1229
+ BOOST_UBLAS_INLINE
1230
+ reference operator * () const {
1231
+ BOOST_UBLAS_CHECK (index1 () < (*this) ().size1 (), bad_index ());
1232
+ BOOST_UBLAS_CHECK (index2 () < (*this) ().size2 (), bad_index ());
1233
+ return (*this) () (it1_, it2_);
1234
+ }
1235
+ BOOST_UBLAS_INLINE
1236
+ reference operator [] (difference_type n) const {
1237
+ return *((*this) + n);
1238
+ }
1239
+
1240
+ // Index
1241
+ BOOST_UBLAS_INLINE
1242
+ size_type index1 () const {
1243
+ return it1_;
1244
+ }
1245
+ BOOST_UBLAS_INLINE
1246
+ size_type index2 () const {
1247
+ return it2_;
1248
+ }
1249
+
1250
+ BOOST_UBLAS_INLINE
1251
+ dual_iterator_type begin () const {
1252
+ return (*this) ().find1 (1, 0, index2 ());
1253
+ }
1254
+ BOOST_UBLAS_INLINE
1255
+ dual_iterator_type end () const {
1256
+ return (*this) ().find1 (1, (*this) ().size1 (), index2 ());
1257
+ }
1258
+ BOOST_UBLAS_INLINE
1259
+ dual_reverse_iterator_type rbegin () const {
1260
+ return dual_reverse_iterator_type (end ());
1261
+ }
1262
+ BOOST_UBLAS_INLINE
1263
+ dual_reverse_iterator_type rend () const {
1264
+ return dual_reverse_iterator_type (begin ());
1265
+ }
1266
+
1267
+ // Assignment
1268
+ BOOST_UBLAS_INLINE
1269
+ indexed_iterator2 &operator = (const indexed_iterator2 &it) {
1270
+ // FIX: ICC needs full qualification?!
1271
+ // assign (&it ());
1272
+ container_reference<C>::assign (&it ());
1273
+ it1_ = it.it1_;
1274
+ it2_ = it.it2_;
1275
+ return *this;
1276
+ }
1277
+
1278
+ // Comparison
1279
+ BOOST_UBLAS_INLINE
1280
+ bool operator == (const indexed_iterator2 &it) const {
1281
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
1282
+ BOOST_UBLAS_CHECK (it1_ == it.it1_, external_logic ());
1283
+ return it2_ == it.it2_;
1284
+ }
1285
+ BOOST_UBLAS_INLINE
1286
+ bool operator < (const indexed_iterator2 &it) const {
1287
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
1288
+ BOOST_UBLAS_CHECK (it1_ == it.it1_, external_logic ());
1289
+ return it2_ < it.it2_;
1290
+ }
1291
+
1292
+ private:
1293
+ size_type it1_;
1294
+ size_type it2_;
1295
+ };
1296
+
1297
+ /** \brief A class implementing an indexed random access iterator
1298
+ * of a matrix.
1299
+ *
1300
+ * \param C the (immutable) container type
1301
+ * \param IC the iterator category
1302
+ *
1303
+ * This class implements a random access iterator. The current
1304
+ * position is stored as two unsigned integers \c it1_ and \c it2_
1305
+ * and the values are accessed via \c operator()(it1_, it2_) of the
1306
+ * container. The iterator changes the second index.
1307
+ *
1308
+ * uBLAS extension: \c index1(), \c index2() and access to the
1309
+ * dual iterator via \c begin(), \c end(), \c rbegin() and \c rend()
1310
+ *
1311
+ * Note 1: The container has to support the \c find2(rank, i, j) method
1312
+ *
1313
+ * Note 2: there is an automatic conversion from
1314
+ * \c indexed_iterator2 to \c indexed_const_iterator2
1315
+ */
1316
+
1317
+ template<class C, class IC>
1318
+ class indexed_const_iterator2:
1319
+ public container_const_reference<C>,
1320
+ public random_access_iterator_base<IC,
1321
+ indexed_const_iterator2<C, IC>,
1322
+ typename C::value_type,
1323
+ typename C::difference_type> {
1324
+ public:
1325
+ typedef C container_type;
1326
+ typedef IC iterator_category;
1327
+ typedef typename container_type::size_type size_type;
1328
+ typedef typename container_type::difference_type difference_type;
1329
+ typedef typename container_type::value_type value_type;
1330
+ typedef typename container_type::const_reference reference;
1331
+
1332
+ typedef indexed_iterator2<container_type, iterator_category> iterator_type;
1333
+ typedef indexed_const_iterator1<container_type, iterator_category> dual_iterator_type;
1334
+ typedef reverse_iterator_base1<dual_iterator_type> dual_reverse_iterator_type;
1335
+
1336
+ // Construction and destruction
1337
+ BOOST_UBLAS_INLINE
1338
+ indexed_const_iterator2 ():
1339
+ container_const_reference<container_type> (), it1_ (), it2_ () {}
1340
+ BOOST_UBLAS_INLINE
1341
+ indexed_const_iterator2 (const container_type &c, size_type it1, size_type it2):
1342
+ container_const_reference<container_type> (c), it1_ (it1), it2_ (it2) {}
1343
+ BOOST_UBLAS_INLINE
1344
+ indexed_const_iterator2 (const iterator_type &it):
1345
+ container_const_reference<container_type> (it ()), it1_ (it.index1 ()), it2_ (it.index2 ()) {}
1346
+
1347
+ // Arithmetic
1348
+ BOOST_UBLAS_INLINE
1349
+ indexed_const_iterator2 &operator ++ () {
1350
+ ++ it2_;
1351
+ return *this;
1352
+ }
1353
+ BOOST_UBLAS_INLINE
1354
+ indexed_const_iterator2 &operator -- () {
1355
+ -- it2_;
1356
+ return *this;
1357
+ }
1358
+ BOOST_UBLAS_INLINE
1359
+ indexed_const_iterator2 &operator += (difference_type n) {
1360
+ it2_ += n;
1361
+ return *this;
1362
+ }
1363
+ BOOST_UBLAS_INLINE
1364
+ indexed_const_iterator2 &operator -= (difference_type n) {
1365
+ it2_ -= n;
1366
+ return *this;
1367
+ }
1368
+ BOOST_UBLAS_INLINE
1369
+ difference_type operator - (const indexed_const_iterator2 &it) const {
1370
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
1371
+ BOOST_UBLAS_CHECK (it1_ == it.it1_, external_logic ());
1372
+ return it2_ - it.it2_;
1373
+ }
1374
+
1375
+ // Dereference
1376
+ BOOST_UBLAS_INLINE
1377
+ reference operator * () const {
1378
+ BOOST_UBLAS_CHECK (index1 () < (*this) ().size1 (), bad_index ());
1379
+ BOOST_UBLAS_CHECK (index2 () < (*this) ().size2 (), bad_index ());
1380
+ return (*this) () (it1_, it2_);
1381
+ }
1382
+ BOOST_UBLAS_INLINE
1383
+ reference operator [] (difference_type n) const {
1384
+ return *((*this) + n);
1385
+ }
1386
+
1387
+ // Index
1388
+ BOOST_UBLAS_INLINE
1389
+ size_type index1 () const {
1390
+ return it1_;
1391
+ }
1392
+ BOOST_UBLAS_INLINE
1393
+ size_type index2 () const {
1394
+ return it2_;
1395
+ }
1396
+
1397
+ BOOST_UBLAS_INLINE
1398
+ dual_iterator_type begin () const {
1399
+ return (*this) ().find1 (1, 0, index2 ());
1400
+ }
1401
+ BOOST_UBLAS_INLINE
1402
+ dual_iterator_type end () const {
1403
+ return (*this) ().find1 (1, (*this) ().size1 (), index2 ());
1404
+ }
1405
+ BOOST_UBLAS_INLINE
1406
+ dual_reverse_iterator_type rbegin () const {
1407
+ return dual_reverse_iterator_type (end ());
1408
+ }
1409
+ BOOST_UBLAS_INLINE
1410
+ dual_reverse_iterator_type rend () const {
1411
+ return dual_reverse_iterator_type (begin ());
1412
+ }
1413
+
1414
+ // Assignment
1415
+ BOOST_UBLAS_INLINE
1416
+ indexed_const_iterator2 &operator = (const indexed_const_iterator2 &it) {
1417
+ // FIX: ICC needs full qualification?!
1418
+ // assign (&it ());
1419
+ container_const_reference<C>::assign (&it ());
1420
+ it1_ = it.it1_;
1421
+ it2_ = it.it2_;
1422
+ return *this;
1423
+ }
1424
+
1425
+ // Comparison
1426
+ BOOST_UBLAS_INLINE
1427
+ bool operator == (const indexed_const_iterator2 &it) const {
1428
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
1429
+ BOOST_UBLAS_CHECK (it1_ == it.it1_, external_logic ());
1430
+ return it2_ == it.it2_;
1431
+ }
1432
+ BOOST_UBLAS_INLINE
1433
+ bool operator < (const indexed_const_iterator2 &it) const {
1434
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
1435
+ BOOST_UBLAS_CHECK (it1_ == it.it1_, external_logic ());
1436
+ return it2_ < it.it2_;
1437
+ }
1438
+
1439
+ private:
1440
+ size_type it1_;
1441
+ size_type it2_;
1442
+
1443
+ friend class indexed_iterator2<container_type, iterator_category>;
1444
+ };
1445
+
1446
+ }}}
1447
+
1448
+ #endif