warp-lang 1.9.1__py3-none-manylinux_2_34_aarch64.whl → 1.10.0rc2__py3-none-manylinux_2_34_aarch64.whl

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.

Potentially problematic release.


This version of warp-lang might be problematic. Click here for more details.

Files changed (346) hide show
  1. warp/__init__.py +301 -287
  2. warp/__init__.pyi +794 -305
  3. warp/_src/__init__.py +14 -0
  4. warp/_src/autograd.py +1075 -0
  5. warp/_src/build.py +618 -0
  6. warp/_src/build_dll.py +640 -0
  7. warp/{builtins.py → _src/builtins.py} +1382 -377
  8. warp/_src/codegen.py +4359 -0
  9. warp/{config.py → _src/config.py} +178 -169
  10. warp/_src/constants.py +57 -0
  11. warp/_src/context.py +8294 -0
  12. warp/_src/dlpack.py +462 -0
  13. warp/_src/fabric.py +355 -0
  14. warp/_src/fem/__init__.py +14 -0
  15. warp/_src/fem/adaptivity.py +508 -0
  16. warp/_src/fem/cache.py +687 -0
  17. warp/_src/fem/dirichlet.py +188 -0
  18. warp/{fem → _src/fem}/domain.py +40 -30
  19. warp/_src/fem/field/__init__.py +131 -0
  20. warp/_src/fem/field/field.py +701 -0
  21. warp/{fem → _src/fem}/field/nodal_field.py +30 -15
  22. warp/{fem → _src/fem}/field/restriction.py +1 -1
  23. warp/{fem → _src/fem}/field/virtual.py +53 -27
  24. warp/_src/fem/geometry/__init__.py +32 -0
  25. warp/{fem → _src/fem}/geometry/adaptive_nanogrid.py +77 -163
  26. warp/_src/fem/geometry/closest_point.py +97 -0
  27. warp/{fem → _src/fem}/geometry/deformed_geometry.py +14 -22
  28. warp/{fem → _src/fem}/geometry/element.py +32 -10
  29. warp/{fem → _src/fem}/geometry/geometry.py +48 -20
  30. warp/{fem → _src/fem}/geometry/grid_2d.py +12 -23
  31. warp/{fem → _src/fem}/geometry/grid_3d.py +12 -23
  32. warp/{fem → _src/fem}/geometry/hexmesh.py +40 -63
  33. warp/{fem → _src/fem}/geometry/nanogrid.py +255 -248
  34. warp/{fem → _src/fem}/geometry/partition.py +121 -63
  35. warp/{fem → _src/fem}/geometry/quadmesh.py +26 -45
  36. warp/{fem → _src/fem}/geometry/tetmesh.py +40 -63
  37. warp/{fem → _src/fem}/geometry/trimesh.py +26 -45
  38. warp/{fem → _src/fem}/integrate.py +164 -158
  39. warp/_src/fem/linalg.py +383 -0
  40. warp/_src/fem/operator.py +396 -0
  41. warp/_src/fem/polynomial.py +229 -0
  42. warp/{fem → _src/fem}/quadrature/pic_quadrature.py +15 -20
  43. warp/{fem → _src/fem}/quadrature/quadrature.py +95 -47
  44. warp/_src/fem/space/__init__.py +248 -0
  45. warp/{fem → _src/fem}/space/basis_function_space.py +20 -11
  46. warp/_src/fem/space/basis_space.py +679 -0
  47. warp/{fem → _src/fem}/space/dof_mapper.py +3 -3
  48. warp/{fem → _src/fem}/space/function_space.py +14 -13
  49. warp/{fem → _src/fem}/space/grid_2d_function_space.py +4 -7
  50. warp/{fem → _src/fem}/space/grid_3d_function_space.py +4 -4
  51. warp/{fem → _src/fem}/space/hexmesh_function_space.py +4 -10
  52. warp/{fem → _src/fem}/space/nanogrid_function_space.py +3 -9
  53. warp/{fem → _src/fem}/space/partition.py +117 -60
  54. warp/{fem → _src/fem}/space/quadmesh_function_space.py +4 -10
  55. warp/{fem → _src/fem}/space/restriction.py +66 -33
  56. warp/_src/fem/space/shape/__init__.py +152 -0
  57. warp/{fem → _src/fem}/space/shape/cube_shape_function.py +9 -9
  58. warp/{fem → _src/fem}/space/shape/shape_function.py +8 -9
  59. warp/{fem → _src/fem}/space/shape/square_shape_function.py +6 -6
  60. warp/{fem → _src/fem}/space/shape/tet_shape_function.py +3 -3
  61. warp/{fem → _src/fem}/space/shape/triangle_shape_function.py +3 -3
  62. warp/{fem → _src/fem}/space/tetmesh_function_space.py +3 -9
  63. warp/_src/fem/space/topology.py +459 -0
  64. warp/{fem → _src/fem}/space/trimesh_function_space.py +3 -9
  65. warp/_src/fem/types.py +112 -0
  66. warp/_src/fem/utils.py +486 -0
  67. warp/_src/jax.py +186 -0
  68. warp/_src/jax_experimental/__init__.py +14 -0
  69. warp/_src/jax_experimental/custom_call.py +387 -0
  70. warp/_src/jax_experimental/ffi.py +1284 -0
  71. warp/_src/jax_experimental/xla_ffi.py +656 -0
  72. warp/_src/marching_cubes.py +708 -0
  73. warp/_src/math.py +414 -0
  74. warp/_src/optim/__init__.py +14 -0
  75. warp/_src/optim/adam.py +163 -0
  76. warp/_src/optim/linear.py +1606 -0
  77. warp/_src/optim/sgd.py +112 -0
  78. warp/_src/paddle.py +406 -0
  79. warp/_src/render/__init__.py +14 -0
  80. warp/_src/render/imgui_manager.py +289 -0
  81. warp/_src/render/render_opengl.py +3636 -0
  82. warp/_src/render/render_usd.py +937 -0
  83. warp/_src/render/utils.py +160 -0
  84. warp/_src/sparse.py +2716 -0
  85. warp/_src/tape.py +1206 -0
  86. warp/{thirdparty → _src/thirdparty}/unittest_parallel.py +9 -2
  87. warp/_src/torch.py +391 -0
  88. warp/_src/types.py +5870 -0
  89. warp/_src/utils.py +1693 -0
  90. warp/autograd.py +12 -1054
  91. warp/bin/warp-clang.so +0 -0
  92. warp/bin/warp.so +0 -0
  93. warp/build.py +8 -588
  94. warp/build_dll.py +6 -721
  95. warp/codegen.py +6 -4251
  96. warp/constants.py +6 -39
  97. warp/context.py +12 -8062
  98. warp/dlpack.py +6 -444
  99. warp/examples/distributed/example_jacobi_mpi.py +4 -5
  100. warp/examples/fem/example_adaptive_grid.py +1 -1
  101. warp/examples/fem/example_apic_fluid.py +1 -1
  102. warp/examples/fem/example_burgers.py +8 -8
  103. warp/examples/fem/example_diffusion.py +1 -1
  104. warp/examples/fem/example_distortion_energy.py +1 -1
  105. warp/examples/fem/example_mixed_elasticity.py +2 -2
  106. warp/examples/fem/example_navier_stokes.py +1 -1
  107. warp/examples/fem/example_nonconforming_contact.py +7 -7
  108. warp/examples/fem/example_stokes.py +1 -1
  109. warp/examples/fem/example_stokes_transfer.py +1 -1
  110. warp/examples/fem/utils.py +2 -2
  111. warp/examples/interop/example_jax_callable.py +1 -1
  112. warp/examples/interop/example_jax_ffi_callback.py +1 -1
  113. warp/examples/interop/example_jax_kernel.py +1 -1
  114. warp/examples/tile/example_tile_mcgp.py +191 -0
  115. warp/fabric.py +6 -337
  116. warp/fem/__init__.py +159 -97
  117. warp/fem/adaptivity.py +7 -489
  118. warp/fem/cache.py +9 -648
  119. warp/fem/dirichlet.py +6 -184
  120. warp/fem/field/__init__.py +8 -109
  121. warp/fem/field/field.py +7 -652
  122. warp/fem/geometry/__init__.py +7 -18
  123. warp/fem/geometry/closest_point.py +11 -77
  124. warp/fem/linalg.py +18 -366
  125. warp/fem/operator.py +11 -369
  126. warp/fem/polynomial.py +9 -209
  127. warp/fem/space/__init__.py +5 -211
  128. warp/fem/space/basis_space.py +6 -662
  129. warp/fem/space/shape/__init__.py +41 -118
  130. warp/fem/space/topology.py +6 -437
  131. warp/fem/types.py +6 -81
  132. warp/fem/utils.py +11 -444
  133. warp/jax.py +8 -165
  134. warp/jax_experimental/__init__.py +14 -1
  135. warp/jax_experimental/custom_call.py +8 -365
  136. warp/jax_experimental/ffi.py +17 -873
  137. warp/jax_experimental/xla_ffi.py +5 -605
  138. warp/marching_cubes.py +5 -689
  139. warp/math.py +16 -393
  140. warp/native/array.h +385 -37
  141. warp/native/builtin.h +314 -37
  142. warp/native/bvh.cpp +43 -9
  143. warp/native/bvh.cu +62 -27
  144. warp/native/bvh.h +310 -309
  145. warp/native/clang/clang.cpp +102 -97
  146. warp/native/coloring.cpp +0 -1
  147. warp/native/crt.h +208 -0
  148. warp/native/exports.h +156 -0
  149. warp/native/hashgrid.cu +2 -0
  150. warp/native/intersect.h +24 -1
  151. warp/native/intersect_tri.h +44 -35
  152. warp/native/mat.h +1456 -276
  153. warp/native/mesh.cpp +4 -4
  154. warp/native/mesh.cu +4 -2
  155. warp/native/mesh.h +176 -61
  156. warp/native/quat.h +0 -52
  157. warp/native/scan.cu +2 -0
  158. warp/native/sparse.cu +7 -3
  159. warp/native/spatial.h +12 -0
  160. warp/native/tile.h +681 -89
  161. warp/native/tile_radix_sort.h +1 -1
  162. warp/native/tile_reduce.h +394 -46
  163. warp/native/tile_scan.h +4 -4
  164. warp/native/vec.h +469 -0
  165. warp/native/version.h +23 -0
  166. warp/native/volume.cpp +1 -1
  167. warp/native/volume.cu +1 -0
  168. warp/native/volume.h +1 -1
  169. warp/native/volume_builder.cu +2 -0
  170. warp/native/warp.cpp +57 -29
  171. warp/native/warp.cu +253 -171
  172. warp/native/warp.h +11 -8
  173. warp/optim/__init__.py +6 -3
  174. warp/optim/adam.py +6 -145
  175. warp/optim/linear.py +14 -1585
  176. warp/optim/sgd.py +6 -94
  177. warp/paddle.py +6 -388
  178. warp/render/__init__.py +8 -4
  179. warp/render/imgui_manager.py +7 -267
  180. warp/render/render_opengl.py +6 -3618
  181. warp/render/render_usd.py +6 -919
  182. warp/render/utils.py +6 -142
  183. warp/sparse.py +37 -2563
  184. warp/tape.py +6 -1188
  185. warp/tests/__main__.py +1 -1
  186. warp/tests/cuda/test_async.py +4 -4
  187. warp/tests/cuda/test_conditional_captures.py +1 -1
  188. warp/tests/cuda/test_multigpu.py +1 -1
  189. warp/tests/cuda/test_streams.py +58 -1
  190. warp/tests/geometry/test_bvh.py +157 -22
  191. warp/tests/geometry/test_marching_cubes.py +0 -1
  192. warp/tests/geometry/test_mesh.py +5 -3
  193. warp/tests/geometry/test_mesh_query_aabb.py +5 -12
  194. warp/tests/geometry/test_mesh_query_point.py +5 -2
  195. warp/tests/geometry/test_mesh_query_ray.py +15 -3
  196. warp/tests/geometry/test_volume_write.py +5 -5
  197. warp/tests/interop/test_dlpack.py +14 -14
  198. warp/tests/interop/test_jax.py +772 -49
  199. warp/tests/interop/test_paddle.py +1 -1
  200. warp/tests/test_adam.py +0 -1
  201. warp/tests/test_arithmetic.py +9 -9
  202. warp/tests/test_array.py +527 -100
  203. warp/tests/test_array_reduce.py +3 -3
  204. warp/tests/test_atomic.py +12 -8
  205. warp/tests/test_atomic_bitwise.py +209 -0
  206. warp/tests/test_atomic_cas.py +4 -4
  207. warp/tests/test_bool.py +2 -2
  208. warp/tests/test_builtins_resolution.py +5 -571
  209. warp/tests/test_codegen.py +33 -14
  210. warp/tests/test_conditional.py +1 -1
  211. warp/tests/test_context.py +6 -6
  212. warp/tests/test_copy.py +242 -161
  213. warp/tests/test_ctypes.py +3 -3
  214. warp/tests/test_devices.py +24 -2
  215. warp/tests/test_examples.py +16 -84
  216. warp/tests/test_fabricarray.py +35 -35
  217. warp/tests/test_fast_math.py +0 -2
  218. warp/tests/test_fem.py +56 -10
  219. warp/tests/test_fixedarray.py +3 -3
  220. warp/tests/test_func.py +8 -5
  221. warp/tests/test_generics.py +1 -1
  222. warp/tests/test_indexedarray.py +24 -24
  223. warp/tests/test_intersect.py +39 -9
  224. warp/tests/test_large.py +1 -1
  225. warp/tests/test_lerp.py +3 -1
  226. warp/tests/test_linear_solvers.py +1 -1
  227. warp/tests/test_map.py +35 -4
  228. warp/tests/test_mat.py +52 -62
  229. warp/tests/test_mat_constructors.py +4 -5
  230. warp/tests/test_mat_lite.py +1 -1
  231. warp/tests/test_mat_scalar_ops.py +121 -121
  232. warp/tests/test_math.py +34 -0
  233. warp/tests/test_module_aot.py +4 -4
  234. warp/tests/test_modules_lite.py +28 -2
  235. warp/tests/test_print.py +11 -11
  236. warp/tests/test_quat.py +93 -58
  237. warp/tests/test_runlength_encode.py +1 -1
  238. warp/tests/test_scalar_ops.py +38 -10
  239. warp/tests/test_smoothstep.py +1 -1
  240. warp/tests/test_sparse.py +126 -15
  241. warp/tests/test_spatial.py +105 -87
  242. warp/tests/test_special_values.py +6 -6
  243. warp/tests/test_static.py +7 -7
  244. warp/tests/test_struct.py +13 -2
  245. warp/tests/test_triangle_closest_point.py +48 -1
  246. warp/tests/test_types.py +27 -15
  247. warp/tests/test_utils.py +52 -52
  248. warp/tests/test_vec.py +29 -29
  249. warp/tests/test_vec_constructors.py +5 -5
  250. warp/tests/test_vec_scalar_ops.py +97 -97
  251. warp/tests/test_version.py +75 -0
  252. warp/tests/tile/test_tile.py +178 -0
  253. warp/tests/tile/test_tile_atomic_bitwise.py +403 -0
  254. warp/tests/tile/test_tile_cholesky.py +7 -4
  255. warp/tests/tile/test_tile_load.py +26 -2
  256. warp/tests/tile/test_tile_mathdx.py +3 -3
  257. warp/tests/tile/test_tile_matmul.py +1 -1
  258. warp/tests/tile/test_tile_mlp.py +2 -4
  259. warp/tests/tile/test_tile_reduce.py +214 -13
  260. warp/tests/unittest_suites.py +6 -14
  261. warp/tests/unittest_utils.py +10 -9
  262. warp/tests/walkthrough_debug.py +3 -1
  263. warp/torch.py +6 -373
  264. warp/types.py +29 -5764
  265. warp/utils.py +10 -1659
  266. {warp_lang-1.9.1.dist-info → warp_lang-1.10.0rc2.dist-info}/METADATA +46 -99
  267. warp_lang-1.10.0rc2.dist-info/RECORD +468 -0
  268. warp_lang-1.10.0rc2.dist-info/licenses/licenses/Gaia-LICENSE.txt +6 -0
  269. warp_lang-1.10.0rc2.dist-info/licenses/licenses/appdirs-LICENSE.txt +22 -0
  270. warp_lang-1.10.0rc2.dist-info/licenses/licenses/asset_pixel_jpg-LICENSE.txt +3 -0
  271. warp_lang-1.10.0rc2.dist-info/licenses/licenses/cuda-LICENSE.txt +1582 -0
  272. warp_lang-1.10.0rc2.dist-info/licenses/licenses/dlpack-LICENSE.txt +201 -0
  273. warp_lang-1.10.0rc2.dist-info/licenses/licenses/fp16-LICENSE.txt +28 -0
  274. warp_lang-1.10.0rc2.dist-info/licenses/licenses/libmathdx-LICENSE.txt +220 -0
  275. warp_lang-1.10.0rc2.dist-info/licenses/licenses/llvm-LICENSE.txt +279 -0
  276. warp_lang-1.10.0rc2.dist-info/licenses/licenses/moller-LICENSE.txt +16 -0
  277. warp_lang-1.10.0rc2.dist-info/licenses/licenses/nanovdb-LICENSE.txt +2 -0
  278. warp_lang-1.10.0rc2.dist-info/licenses/licenses/nvrtc-LICENSE.txt +1592 -0
  279. warp_lang-1.10.0rc2.dist-info/licenses/licenses/svd-LICENSE.txt +23 -0
  280. warp_lang-1.10.0rc2.dist-info/licenses/licenses/unittest_parallel-LICENSE.txt +21 -0
  281. warp_lang-1.10.0rc2.dist-info/licenses/licenses/usd-LICENSE.txt +213 -0
  282. warp_lang-1.10.0rc2.dist-info/licenses/licenses/windingnumber-LICENSE.txt +21 -0
  283. warp/examples/assets/cartpole.urdf +0 -110
  284. warp/examples/assets/crazyflie.usd +0 -0
  285. warp/examples/assets/nv_ant.xml +0 -92
  286. warp/examples/assets/nv_humanoid.xml +0 -183
  287. warp/examples/assets/quadruped.urdf +0 -268
  288. warp/examples/optim/example_bounce.py +0 -266
  289. warp/examples/optim/example_cloth_throw.py +0 -228
  290. warp/examples/optim/example_drone.py +0 -870
  291. warp/examples/optim/example_inverse_kinematics.py +0 -182
  292. warp/examples/optim/example_inverse_kinematics_torch.py +0 -191
  293. warp/examples/optim/example_softbody_properties.py +0 -400
  294. warp/examples/optim/example_spring_cage.py +0 -245
  295. warp/examples/optim/example_trajectory.py +0 -227
  296. warp/examples/sim/example_cartpole.py +0 -143
  297. warp/examples/sim/example_cloth.py +0 -225
  298. warp/examples/sim/example_cloth_self_contact.py +0 -316
  299. warp/examples/sim/example_granular.py +0 -130
  300. warp/examples/sim/example_granular_collision_sdf.py +0 -202
  301. warp/examples/sim/example_jacobian_ik.py +0 -244
  302. warp/examples/sim/example_particle_chain.py +0 -124
  303. warp/examples/sim/example_quadruped.py +0 -203
  304. warp/examples/sim/example_rigid_chain.py +0 -203
  305. warp/examples/sim/example_rigid_contact.py +0 -195
  306. warp/examples/sim/example_rigid_force.py +0 -133
  307. warp/examples/sim/example_rigid_gyroscopic.py +0 -115
  308. warp/examples/sim/example_rigid_soft_contact.py +0 -140
  309. warp/examples/sim/example_soft_body.py +0 -196
  310. warp/examples/tile/example_tile_walker.py +0 -327
  311. warp/sim/__init__.py +0 -74
  312. warp/sim/articulation.py +0 -793
  313. warp/sim/collide.py +0 -2570
  314. warp/sim/graph_coloring.py +0 -307
  315. warp/sim/import_mjcf.py +0 -791
  316. warp/sim/import_snu.py +0 -227
  317. warp/sim/import_urdf.py +0 -579
  318. warp/sim/import_usd.py +0 -898
  319. warp/sim/inertia.py +0 -357
  320. warp/sim/integrator.py +0 -245
  321. warp/sim/integrator_euler.py +0 -2000
  322. warp/sim/integrator_featherstone.py +0 -2101
  323. warp/sim/integrator_vbd.py +0 -2487
  324. warp/sim/integrator_xpbd.py +0 -3295
  325. warp/sim/model.py +0 -4821
  326. warp/sim/particles.py +0 -121
  327. warp/sim/render.py +0 -431
  328. warp/sim/utils.py +0 -431
  329. warp/tests/sim/disabled_kinematics.py +0 -244
  330. warp/tests/sim/test_cloth.py +0 -863
  331. warp/tests/sim/test_collision.py +0 -743
  332. warp/tests/sim/test_coloring.py +0 -347
  333. warp/tests/sim/test_inertia.py +0 -161
  334. warp/tests/sim/test_model.py +0 -226
  335. warp/tests/sim/test_sim_grad.py +0 -287
  336. warp/tests/sim/test_sim_grad_bounce_linear.py +0 -212
  337. warp/tests/sim/test_sim_kinematics.py +0 -98
  338. warp/thirdparty/__init__.py +0 -0
  339. warp_lang-1.9.1.dist-info/RECORD +0 -456
  340. /warp/{fem → _src/fem}/quadrature/__init__.py +0 -0
  341. /warp/{tests/sim → _src/thirdparty}/__init__.py +0 -0
  342. /warp/{thirdparty → _src/thirdparty}/appdirs.py +0 -0
  343. /warp/{thirdparty → _src/thirdparty}/dlpack.py +0 -0
  344. {warp_lang-1.9.1.dist-info → warp_lang-1.10.0rc2.dist-info}/WHEEL +0 -0
  345. {warp_lang-1.9.1.dist-info → warp_lang-1.10.0rc2.dist-info}/licenses/LICENSE.md +0 -0
  346. {warp_lang-1.9.1.dist-info → warp_lang-1.10.0rc2.dist-info}/top_level.txt +0 -0
@@ -13,7 +13,6 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
 
16
- import contextlib
17
16
  import unittest
18
17
 
19
18
  import numpy as np
@@ -27,28 +26,8 @@ def nps(dtype, value):
27
26
  return np.array((value,)).astype(dtype)[0]
28
27
 
29
28
 
30
- def npv(dtype, values):
31
- """Creates a vector of NumPy scalar values based on the given data type."""
32
- return tuple(nps(dtype, x) for x in values)
33
-
34
-
35
- def npm(dtype, dim, values):
36
- """Creates a matrix of NumPy scalar values based on the given data type."""
37
- return tuple(npv(dtype, values[i * dim : (i + 1) * dim]) for i in range(dim))
38
-
39
-
40
- def wpv(dtype, values):
41
- """Creates a vector of Warp scalar values based on the given data type."""
42
- return tuple(dtype(x) for x in values)
43
-
44
-
45
- def wpm(dtype, dim, values):
46
- """Creates a matrix of Warp scalar values based on the given data type."""
47
- return tuple(wpv(dtype, values[i * dim : (i + 1) * dim]) for i in range(dim))
48
-
49
-
50
29
  def test_int_arg_support(test, device, dtype):
51
- np_type = wp.types.warp_type_to_np_dtype[dtype]
30
+ np_type = wp._src.types.warp_type_to_np_dtype[dtype]
52
31
  value = -1234567890123456789
53
32
  expected = wp.invert(dtype(value))
54
33
 
@@ -56,7 +35,7 @@ def test_int_arg_support(test, device, dtype):
56
35
 
57
36
 
58
37
  def test_float_arg_support(test, device, dtype):
59
- np_type = wp.types.warp_type_to_np_dtype[dtype]
38
+ np_type = wp._src.types.warp_type_to_np_dtype[dtype]
60
39
  value = 1.23
61
40
  expected = wp.sin(dtype(value))
62
41
 
@@ -64,7 +43,7 @@ def test_float_arg_support(test, device, dtype):
64
43
 
65
44
 
66
45
  def test_int_int_args_support(test, device, dtype):
67
- np_type = wp.types.warp_type_to_np_dtype[dtype]
46
+ np_type = wp._src.types.warp_type_to_np_dtype[dtype]
68
47
  value = -1234567890
69
48
  expected = wp.mul(dtype(value), dtype(value))
70
49
 
@@ -107,414 +86,6 @@ def test_int_int_args_support(test, device, dtype):
107
86
  wp.mul(value, nps(np_type, value))
108
87
 
109
88
 
110
- def test_mat_arg_support(test, device, dtype):
111
- np_type = wp.types.warp_type_to_np_dtype[dtype]
112
- mat_cls = wp.types.matrix((3, 3), dtype)
113
- values = (1.23, 2.34, 3.45, 4.56, 5.67, 6.78, 7.89, 8.90, 9.01)
114
- expected = wp.trace(mat_cls(*values))
115
-
116
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
117
- test.assertEqual(wp.trace(wpv(dtype, values)), expected)
118
- test.assertEqual(wp.trace(wpm(dtype, 3, values)), expected)
119
- test.assertEqual(wp.trace(npv(np_type, values)), expected)
120
- test.assertEqual(wp.trace(npm(np_type, 3, values)), expected)
121
- test.assertEqual(wp.trace(np.array(npv(np_type, values))), expected)
122
-
123
-
124
- def test_mat_mat_args_support(test, device, dtype):
125
- np_type = wp.types.warp_type_to_np_dtype[dtype]
126
- mat_cls = wp.types.matrix((3, 3), dtype)
127
- a_values = (0.12, 1.23, 2.34, 0.12, 1.23, 2.34, 0.12, 1.23, 2.34)
128
- b_values = (2.34, 1.23, 0.12, 2.34, 1.23, 0.12, 2.34, 1.23, 0.12)
129
- expected = wp.ddot(mat_cls(*a_values), mat_cls(*b_values))
130
-
131
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
132
- test.assertEqual(wp.ddot(mat_cls(*a_values), mat_cls(*b_values)), expected)
133
- test.assertEqual(wp.ddot(mat_cls(*a_values), wpv(dtype, b_values)), expected)
134
- test.assertEqual(wp.ddot(mat_cls(*a_values), wpm(dtype, 3, b_values)), expected)
135
- test.assertEqual(wp.ddot(mat_cls(*a_values), npv(np_type, b_values)), expected)
136
- test.assertEqual(wp.ddot(mat_cls(*a_values), npm(np_type, 3, b_values)), expected)
137
- test.assertEqual(wp.ddot(mat_cls(*a_values), np.array(npv(np_type, b_values))), expected)
138
-
139
- test.assertEqual(wp.ddot(wpv(dtype, a_values), mat_cls(*b_values)), expected)
140
- test.assertEqual(wp.ddot(wpv(dtype, a_values), wpv(dtype, b_values)), expected)
141
- test.assertEqual(wp.ddot(wpv(dtype, a_values), wpm(dtype, 3, b_values)), expected)
142
- test.assertEqual(wp.ddot(wpv(dtype, a_values), npv(np_type, b_values)), expected)
143
- test.assertEqual(wp.ddot(wpv(dtype, a_values), npm(np_type, 3, b_values)), expected)
144
- test.assertEqual(wp.ddot(wpv(dtype, a_values), np.array(npv(np_type, b_values))), expected)
145
-
146
- test.assertEqual(wp.ddot(wpm(dtype, 3, a_values), mat_cls(*b_values)), expected)
147
- test.assertEqual(wp.ddot(wpm(dtype, 3, a_values), wpv(dtype, b_values)), expected)
148
- test.assertEqual(wp.ddot(wpm(dtype, 3, a_values), wpm(dtype, 3, b_values)), expected)
149
- test.assertEqual(wp.ddot(wpm(dtype, 3, a_values), npv(np_type, b_values)), expected)
150
- test.assertEqual(wp.ddot(wpm(dtype, 3, a_values), npm(np_type, 3, b_values)), expected)
151
- test.assertEqual(wp.ddot(wpm(dtype, 3, a_values), np.array(npv(np_type, b_values))), expected)
152
-
153
- test.assertEqual(wp.ddot(npv(np_type, a_values), mat_cls(*b_values)), expected)
154
- test.assertEqual(wp.ddot(npv(np_type, a_values), wpv(dtype, b_values)), expected)
155
- test.assertEqual(wp.ddot(npv(np_type, a_values), wpm(dtype, 3, b_values)), expected)
156
- test.assertEqual(wp.ddot(npv(np_type, a_values), npv(np_type, b_values)), expected)
157
- test.assertEqual(wp.ddot(npv(np_type, a_values), npm(np_type, 3, b_values)), expected)
158
- test.assertEqual(wp.ddot(npv(np_type, a_values), np.array(npv(np_type, b_values))), expected)
159
-
160
- test.assertEqual(wp.ddot(npm(np_type, 3, a_values), mat_cls(*b_values)), expected)
161
- test.assertEqual(wp.ddot(npm(np_type, 3, a_values), wpv(dtype, b_values)), expected)
162
- test.assertEqual(wp.ddot(npm(np_type, 3, a_values), wpm(dtype, 3, b_values)), expected)
163
- test.assertEqual(wp.ddot(npm(np_type, 3, a_values), npv(np_type, b_values)), expected)
164
- test.assertEqual(wp.ddot(npm(np_type, 3, a_values), npm(np_type, 3, b_values)), expected)
165
- test.assertEqual(wp.ddot(npm(np_type, 3, a_values), np.array(npv(np_type, b_values))), expected)
166
-
167
- test.assertEqual(wp.ddot(np.array(npv(np_type, a_values)), mat_cls(*b_values)), expected)
168
- test.assertEqual(wp.ddot(np.array(npv(np_type, a_values)), wpv(dtype, b_values)), expected)
169
- test.assertEqual(wp.ddot(np.array(npv(np_type, a_values)), wpm(dtype, 3, b_values)), expected)
170
- test.assertEqual(wp.ddot(np.array(npv(np_type, a_values)), npv(np_type, b_values)), expected)
171
- test.assertEqual(wp.ddot(np.array(npv(np_type, a_values)), npm(np_type, 3, b_values)), expected)
172
- test.assertEqual(wp.ddot(np.array(npv(np_type, a_values)), np.array(npv(np_type, b_values))), expected)
173
-
174
- if dtype is wp.float32:
175
- test.assertEqual(wp.ddot(mat_cls(*a_values), b_values), expected)
176
- test.assertEqual(wp.ddot(wpv(dtype, a_values), b_values), expected)
177
- test.assertEqual(wp.ddot(wpm(dtype, 3, a_values), b_values), expected)
178
- test.assertEqual(wp.ddot(npv(np_type, a_values), b_values), expected)
179
- test.assertEqual(wp.ddot(npm(np_type, 3, a_values), b_values), expected)
180
- test.assertEqual(wp.ddot(a_values, b_values), expected)
181
- test.assertEqual(wp.ddot(np.array(npv(np_type, a_values)), b_values), expected)
182
-
183
- test.assertEqual(wp.ddot(a_values, mat_cls(*b_values)), expected)
184
- test.assertEqual(wp.ddot(a_values, wpv(dtype, b_values)), expected)
185
- test.assertEqual(wp.ddot(a_values, wpm(dtype, 3, b_values)), expected)
186
- test.assertEqual(wp.ddot(a_values, npv(np_type, b_values)), expected)
187
- test.assertEqual(wp.ddot(a_values, npm(np_type, 3, b_values)), expected)
188
- test.assertEqual(wp.ddot(a_values, np.array(npv(np_type, b_values))), expected)
189
- else:
190
- with test.assertRaisesRegex(
191
- RuntimeError,
192
- r"Couldn't find a function 'ddot' compatible with the arguments 'mat_t, tuple'$",
193
- ):
194
- wp.ddot(mat_cls(*a_values), b_values)
195
-
196
- with test.assertRaisesRegex(
197
- RuntimeError,
198
- r"Couldn't find a function 'ddot' compatible with the arguments 'tuple, tuple'$",
199
- ):
200
- wp.ddot(wpv(dtype, a_values), b_values)
201
-
202
- with test.assertRaisesRegex(
203
- RuntimeError,
204
- r"Couldn't find a function 'ddot' compatible with the arguments 'tuple, tuple'$",
205
- ):
206
- wp.ddot(wpm(dtype, 3, a_values), b_values)
207
-
208
- with test.assertRaisesRegex(
209
- RuntimeError,
210
- r"Couldn't find a function 'ddot' compatible with the arguments 'tuple, tuple'$",
211
- ):
212
- wp.ddot(npv(np_type, a_values), b_values)
213
-
214
- with test.assertRaisesRegex(
215
- RuntimeError,
216
- r"Couldn't find a function 'ddot' compatible with the arguments 'tuple, tuple'$",
217
- ):
218
- wp.ddot(npm(np_type, 3, a_values), b_values)
219
-
220
- with test.assertRaisesRegex(
221
- RuntimeError,
222
- r"Couldn't find a function 'ddot' compatible with the arguments 'ndarray, tuple'$",
223
- ):
224
- wp.ddot(np.array(npv(np_type, a_values)), b_values)
225
-
226
- with test.assertRaisesRegex(
227
- RuntimeError,
228
- r"Couldn't find a function 'ddot' compatible with the arguments 'tuple, mat_t'$",
229
- ):
230
- wp.ddot(a_values, mat_cls(*b_values))
231
-
232
- with test.assertRaisesRegex(
233
- RuntimeError,
234
- r"Couldn't find a function 'ddot' compatible with the arguments 'tuple, tuple'$",
235
- ):
236
- wp.ddot(a_values, wpv(dtype, b_values))
237
-
238
- with test.assertRaisesRegex(
239
- RuntimeError,
240
- r"Couldn't find a function 'ddot' compatible with the arguments 'tuple, tuple'$",
241
- ):
242
- wp.ddot(a_values, wpm(dtype, 3, b_values))
243
-
244
- with test.assertRaisesRegex(
245
- RuntimeError,
246
- r"Couldn't find a function 'ddot' compatible with the arguments 'tuple, tuple'$",
247
- ):
248
- wp.ddot(a_values, npv(np_type, b_values))
249
-
250
- with test.assertRaisesRegex(
251
- RuntimeError,
252
- r"Couldn't find a function 'ddot' compatible with the arguments 'tuple, tuple'$",
253
- ):
254
- wp.ddot(a_values, npm(np_type, 3, b_values))
255
-
256
- with test.assertRaisesRegex(
257
- RuntimeError,
258
- r"Couldn't find a function 'ddot' compatible with the arguments 'tuple, ndarray'$",
259
- ):
260
- wp.ddot(a_values, np.array(npv(np_type, b_values)))
261
-
262
-
263
- def test_mat_float_args_support(test, device, dtype):
264
- np_type = wp.types.warp_type_to_np_dtype[dtype]
265
- mat_cls = wp.types.matrix((3, 3), dtype)
266
- a_values = (1.23, 2.34, 3.45, 4.56, 5.67, 6.78, 7.89, 8.90, 9.01)
267
- b_value = 0.12
268
- expected = wp.mul(mat_cls(*a_values), dtype(b_value))
269
-
270
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
271
- test.assertEqual(wp.mul(mat_cls(*a_values), dtype(b_value)), expected)
272
- test.assertEqual(wp.mul(mat_cls(*a_values), nps(np_type, b_value)), expected)
273
-
274
- test.assertEqual(wp.mul(wpv(dtype, a_values), dtype(b_value)), expected)
275
- test.assertEqual(wp.mul(wpv(dtype, a_values), nps(np_type, b_value)), expected)
276
-
277
- test.assertEqual(wp.mul(wpm(dtype, 3, a_values), dtype(b_value)), expected)
278
- test.assertEqual(wp.mul(wpm(dtype, 3, a_values), nps(np_type, b_value)), expected)
279
-
280
- test.assertEqual(wp.mul(npv(np_type, a_values), dtype(b_value)), expected)
281
- test.assertEqual(wp.mul(npv(np_type, a_values), nps(np_type, b_value)), expected)
282
-
283
- test.assertEqual(wp.mul(npm(np_type, 3, a_values), dtype(b_value)), expected)
284
- test.assertEqual(wp.mul(npm(np_type, 3, a_values), nps(np_type, b_value)), expected)
285
-
286
- test.assertEqual(wp.mul(np.array(npv(np_type, a_values)), dtype(b_value)), expected)
287
- test.assertEqual(wp.mul(np.array(npv(np_type, a_values)), nps(np_type, b_value)), expected)
288
-
289
- if dtype is wp.float32:
290
- test.assertEqual(wp.mul(mat_cls(*a_values), b_value), expected)
291
- test.assertEqual(wp.mul(wpv(dtype, a_values), b_value), expected)
292
- test.assertEqual(wp.mul(wpm(dtype, 3, a_values), b_value), expected)
293
- test.assertEqual(wp.mul(npv(np_type, a_values), b_value), expected)
294
- test.assertEqual(wp.mul(npm(np_type, 3, a_values), b_value), expected)
295
- test.assertEqual(wp.mul(a_values, b_value), expected)
296
- test.assertEqual(wp.mul(np.array(npv(np_type, a_values)), b_value), expected)
297
-
298
- test.assertEqual(wp.mul(a_values, dtype(b_value)), expected)
299
- test.assertEqual(wp.mul(a_values, nps(np_type, b_value)), expected)
300
- else:
301
- with test.assertRaisesRegex(
302
- RuntimeError,
303
- r"Couldn't find a function 'mul' compatible with the arguments 'mat_t, float'$",
304
- ):
305
- wp.mul(mat_cls(*a_values), b_value)
306
-
307
- with test.assertRaisesRegex(
308
- RuntimeError,
309
- r"Couldn't find a function 'mul' compatible with the arguments 'tuple, float'$",
310
- ):
311
- wp.mul(wpv(dtype, a_values), b_value)
312
-
313
- with test.assertRaisesRegex(
314
- RuntimeError,
315
- r"Couldn't find a function 'mul' compatible with the arguments 'tuple, float'$",
316
- ):
317
- wp.mul(wpm(dtype, 3, a_values), b_value)
318
-
319
- with test.assertRaisesRegex(
320
- RuntimeError,
321
- r"Couldn't find a function 'mul' compatible with the arguments 'tuple, float'$",
322
- ):
323
- wp.mul(npv(np_type, a_values), b_value)
324
-
325
- with test.assertRaisesRegex(
326
- RuntimeError,
327
- r"Couldn't find a function 'mul' compatible with the arguments 'tuple, float'$",
328
- ):
329
- wp.mul(npm(np_type, 3, a_values), b_value)
330
-
331
- with test.assertRaisesRegex(
332
- RuntimeError,
333
- r"Couldn't find a function 'mul' compatible with the arguments 'ndarray, float'$",
334
- ):
335
- wp.mul(np.array(npv(np_type, a_values)), b_value)
336
-
337
- with test.assertRaisesRegex(
338
- RuntimeError,
339
- rf"Couldn't find a function 'mul' compatible with the arguments 'tuple, {dtype.__name__}'$",
340
- ):
341
- wp.mul(a_values, dtype(b_value))
342
-
343
- with test.assertRaisesRegex(
344
- RuntimeError,
345
- rf"Couldn't find a function 'mul' compatible with the arguments 'tuple, {np_type.__name__}'$",
346
- ):
347
- wp.mul(a_values, nps(np_type, b_value))
348
-
349
-
350
- def test_vec_arg_support(test, device, dtype):
351
- np_type = wp.types.warp_type_to_np_dtype[dtype]
352
- vec_cls = wp.types.vector(3, dtype)
353
- values = (1.23, 2.34, 3.45)
354
- expected = wp.length(vec_cls(*values))
355
-
356
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
357
- test.assertAlmostEqual(wp.length(wpv(dtype, values)), expected)
358
- test.assertAlmostEqual(wp.length(npv(np_type, values)), expected)
359
- test.assertAlmostEqual(wp.length(np.array(npv(np_type, values))), expected)
360
-
361
-
362
- def test_vec_vec_args_support(test, device, dtype):
363
- np_type = wp.types.warp_type_to_np_dtype[dtype]
364
- vec_cls = wp.types.vector(3, dtype)
365
- a_values = (1.23, 2.34, 3.45)
366
- b_values = (4.56, 5.67, 6.78)
367
- expected = wp.dot(vec_cls(*a_values), vec_cls(*b_values))
368
-
369
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
370
- test.assertEqual(wp.dot(vec_cls(*a_values), vec_cls(*b_values)), expected)
371
- test.assertEqual(wp.dot(vec_cls(*a_values), wpv(dtype, b_values)), expected)
372
- test.assertEqual(wp.dot(vec_cls(*a_values), npv(np_type, b_values)), expected)
373
- test.assertEqual(wp.dot(vec_cls(*a_values), np.array(npv(np_type, b_values))), expected)
374
-
375
- test.assertEqual(wp.dot(wpv(dtype, a_values), vec_cls(*b_values)), expected)
376
- test.assertEqual(wp.dot(wpv(dtype, a_values), wpv(dtype, b_values)), expected)
377
- test.assertEqual(wp.dot(wpv(dtype, a_values), npv(np_type, b_values)), expected)
378
- test.assertEqual(wp.dot(wpv(dtype, a_values), np.array(npv(np_type, b_values))), expected)
379
-
380
- test.assertEqual(wp.dot(npv(np_type, a_values), vec_cls(*b_values)), expected)
381
- test.assertEqual(wp.dot(npv(np_type, a_values), wpv(dtype, b_values)), expected)
382
- test.assertEqual(wp.dot(npv(np_type, a_values), npv(np_type, b_values)), expected)
383
- test.assertEqual(wp.dot(npv(np_type, a_values), np.array(npv(np_type, b_values))), expected)
384
-
385
- test.assertEqual(wp.dot(np.array(npv(np_type, a_values)), vec_cls(*b_values)), expected)
386
- test.assertEqual(wp.dot(np.array(npv(np_type, a_values)), wpv(dtype, b_values)), expected)
387
- test.assertEqual(wp.dot(np.array(npv(np_type, a_values)), npv(np_type, b_values)), expected)
388
- test.assertEqual(wp.dot(np.array(npv(np_type, a_values)), np.array(npv(np_type, b_values))), expected)
389
-
390
- if dtype is wp.float32:
391
- test.assertEqual(wp.dot(vec_cls(*a_values), b_values), expected)
392
- test.assertEqual(wp.dot(wpv(dtype, a_values), b_values), expected)
393
- test.assertEqual(wp.dot(npv(np_type, a_values), b_values), expected)
394
- test.assertEqual(wp.dot(a_values, b_values), expected)
395
- test.assertEqual(wp.dot(np.array(npv(np_type, a_values)), b_values), expected)
396
-
397
- test.assertEqual(wp.dot(a_values, vec_cls(*b_values)), expected)
398
- test.assertEqual(wp.dot(a_values, wpv(dtype, b_values)), expected)
399
- test.assertEqual(wp.dot(a_values, npv(np_type, b_values)), expected)
400
- test.assertEqual(wp.dot(a_values, np.array(npv(np_type, b_values))), expected)
401
- else:
402
- with test.assertRaisesRegex(
403
- RuntimeError,
404
- r"Couldn't find a function 'dot' compatible with the arguments 'vec_t, tuple'$",
405
- ):
406
- wp.dot(vec_cls(*a_values), b_values)
407
-
408
- with test.assertRaisesRegex(
409
- RuntimeError,
410
- r"Couldn't find a function 'dot' compatible with the arguments 'tuple, tuple'$",
411
- ):
412
- wp.dot(wpv(dtype, a_values), b_values)
413
-
414
- with test.assertRaisesRegex(
415
- RuntimeError,
416
- r"Couldn't find a function 'dot' compatible with the arguments 'tuple, tuple'$",
417
- ):
418
- wp.dot(npv(np_type, a_values), b_values)
419
-
420
- with test.assertRaisesRegex(
421
- RuntimeError,
422
- r"Couldn't find a function 'dot' compatible with the arguments 'ndarray, tuple'$",
423
- ):
424
- wp.dot(np.array(npv(np_type, a_values)), b_values)
425
-
426
- with test.assertRaisesRegex(
427
- RuntimeError,
428
- r"Couldn't find a function 'dot' compatible with the arguments 'tuple, vec_t'$",
429
- ):
430
- wp.dot(a_values, vec_cls(*b_values))
431
-
432
- with test.assertRaisesRegex(
433
- RuntimeError,
434
- r"Couldn't find a function 'dot' compatible with the arguments 'tuple, tuple'$",
435
- ):
436
- wp.dot(a_values, wpv(dtype, b_values))
437
-
438
- with test.assertRaisesRegex(
439
- RuntimeError,
440
- r"Couldn't find a function 'dot' compatible with the arguments 'tuple, tuple'$",
441
- ):
442
- wp.dot(a_values, npv(np_type, b_values))
443
-
444
- with test.assertRaisesRegex(
445
- RuntimeError,
446
- r"Couldn't find a function 'dot' compatible with the arguments 'tuple, ndarray'$",
447
- ):
448
- wp.dot(a_values, np.array(npv(np_type, b_values)))
449
-
450
-
451
- def test_vec_float_args_support(test, device, dtype):
452
- np_type = wp.types.warp_type_to_np_dtype[dtype]
453
- vec_cls = wp.types.vector(3, dtype)
454
- a_values = (1.23, 2.34, 3.45)
455
- b_value = 4.56
456
- expected = wp.mul(vec_cls(*a_values), dtype(b_value))
457
-
458
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
459
- test.assertEqual(wp.mul(vec_cls(*a_values), dtype(b_value)), expected)
460
- test.assertEqual(wp.mul(vec_cls(*a_values), nps(np_type, b_value)), expected)
461
-
462
- test.assertEqual(wp.mul(wpv(dtype, a_values), dtype(b_value)), expected)
463
- test.assertEqual(wp.mul(wpv(dtype, a_values), nps(np_type, b_value)), expected)
464
-
465
- test.assertEqual(wp.mul(npv(np_type, a_values), dtype(b_value)), expected)
466
- test.assertEqual(wp.mul(npv(np_type, a_values), nps(np_type, b_value)), expected)
467
-
468
- test.assertEqual(wp.mul(np.array(npv(np_type, a_values)), dtype(b_value)), expected)
469
- test.assertEqual(wp.mul(np.array(npv(np_type, a_values)), nps(np_type, b_value)), expected)
470
-
471
- if dtype is wp.float32:
472
- test.assertEqual(wp.mul(vec_cls(*a_values), b_value), expected)
473
- test.assertEqual(wp.mul(wpv(dtype, a_values), b_value), expected)
474
- test.assertEqual(wp.mul(npv(np_type, a_values), b_value), expected)
475
- test.assertEqual(wp.mul(a_values, b_value), expected)
476
- test.assertEqual(wp.mul(np.array(npv(np_type, a_values)), b_value), expected)
477
-
478
- test.assertEqual(wp.mul(a_values, dtype(b_value)), expected)
479
- test.assertEqual(wp.mul(a_values, nps(np_type, b_value)), expected)
480
- else:
481
- with test.assertRaisesRegex(
482
- RuntimeError,
483
- r"Couldn't find a function 'mul' compatible with the arguments 'vec_t, float'$",
484
- ):
485
- wp.mul(vec_cls(*a_values), b_value)
486
-
487
- with test.assertRaisesRegex(
488
- RuntimeError,
489
- r"Couldn't find a function 'mul' compatible with the arguments 'tuple, float'$",
490
- ):
491
- wp.mul(wpv(dtype, a_values), b_value)
492
-
493
- with test.assertRaisesRegex(
494
- RuntimeError,
495
- r"Couldn't find a function 'mul' compatible with the arguments 'tuple, float'$",
496
- ):
497
- wp.mul(npv(np_type, a_values), b_value)
498
-
499
- with test.assertRaisesRegex(
500
- RuntimeError,
501
- r"Couldn't find a function 'mul' compatible with the arguments 'ndarray, float'$",
502
- ):
503
- wp.mul(np.array(npv(np_type, a_values)), b_value)
504
-
505
- with test.assertRaisesRegex(
506
- RuntimeError,
507
- rf"Couldn't find a function 'mul' compatible with the arguments 'tuple, {dtype.__name__}'$",
508
- ):
509
- wp.mul(a_values, dtype(b_value))
510
-
511
- with test.assertRaisesRegex(
512
- RuntimeError,
513
- rf"Couldn't find a function 'mul' compatible with the arguments 'tuple, {np_type.__name__}'$",
514
- ):
515
- wp.mul(a_values, nps(np_type, b_value))
516
-
517
-
518
89
  class TestBuiltinsResolution(unittest.TestCase):
519
90
  def test_int_arg_overflow(self):
520
91
  value = -1234567890123456789
@@ -565,7 +136,6 @@ class TestBuiltinsResolution(unittest.TestCase):
565
136
 
566
137
  def test_mat22_arg_precision(self):
567
138
  values = (1.23, 2.34, 3.45, 4.56)
568
- values_2d = (values[0:2], values[2:4])
569
139
  expected = 5.78999999999999914735
570
140
 
571
141
  result = wp.trace(wp.mat22d(*values))
@@ -579,13 +149,8 @@ class TestBuiltinsResolution(unittest.TestCase):
579
149
  self.assertNotAlmostEqual(result, expected, places=5)
580
150
  self.assertAlmostEqual(result, expected, places=1)
581
151
 
582
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
583
- self.assertEqual(wp.trace(values), wp.trace(wp.mat22f(*values)))
584
- self.assertEqual(wp.trace(values_2d), wp.trace(wp.mat22f(*values)))
585
-
586
152
  def test_mat33_arg_precision(self):
587
153
  values = (1.23, 2.34, 3.45, 4.56, 5.67, 6.78, 7.89, 8.90, 9.01)
588
- values_2d = (values[0:3], values[3:6], values[6:9])
589
154
  expected = 15.91000000000000014211
590
155
 
591
156
  result = wp.trace(wp.mat33d(*values))
@@ -599,13 +164,8 @@ class TestBuiltinsResolution(unittest.TestCase):
599
164
  self.assertNotAlmostEqual(result, expected, places=5)
600
165
  self.assertAlmostEqual(result, expected, places=1)
601
166
 
602
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
603
- self.assertEqual(wp.trace(values), wp.trace(wp.mat33f(*values)))
604
- self.assertEqual(wp.trace(values_2d), wp.trace(wp.mat33f(*values)))
605
-
606
167
  def test_mat44_arg_precision(self):
607
168
  values = (1.23, 2.34, 3.45, 4.56, 5.67, 6.78, 7.89, 8.90, 9.01, 10.12, 11.23, 12.34, 13.45, 14.56, 15.67, 16.78)
608
- values_2d = (values[0:4], values[4:8], values[8:12], values[12:16])
609
169
  expected = 36.02000000000000312639
610
170
 
611
171
  result = wp.trace(wp.mat44d(*values))
@@ -619,15 +179,9 @@ class TestBuiltinsResolution(unittest.TestCase):
619
179
  self.assertNotAlmostEqual(result, expected, places=5)
620
180
  self.assertAlmostEqual(result, expected, places=1)
621
181
 
622
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
623
- self.assertEqual(wp.trace(values), wp.trace(wp.mat44f(*values)))
624
- self.assertEqual(wp.trace(values_2d), wp.trace(wp.mat44f(*values)))
625
-
626
182
  def test_mat22_mat22_args_precision(self):
627
183
  a_values = (0.12, 1.23, 0.12, 1.23)
628
- a_values_2d = (a_values[0:2], a_values[2:4])
629
184
  b_values = (1.23, 0.12, 1.23, 0.12)
630
- b_values_2d = (b_values[0:2], b_values[2:4])
631
185
  expected = 0.59039999999999992486
632
186
 
633
187
  result = wp.ddot(wp.mat22d(*a_values), wp.mat22d(*b_values))
@@ -641,17 +195,9 @@ class TestBuiltinsResolution(unittest.TestCase):
641
195
  self.assertNotAlmostEqual(result, expected, places=5)
642
196
  self.assertAlmostEqual(result, expected, places=1)
643
197
 
644
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
645
- self.assertEqual(wp.ddot(a_values, b_values), wp.ddot(wp.mat22f(*a_values), wp.mat22f(*b_values)))
646
- self.assertEqual(wp.ddot(a_values_2d, b_values_2d), wp.ddot(wp.mat22f(*a_values), wp.mat22f(*b_values)))
647
- self.assertEqual(wp.ddot(a_values, b_values_2d), wp.ddot(wp.mat22f(*a_values), wp.mat22f(*b_values)))
648
- self.assertEqual(wp.ddot(a_values_2d, b_values), wp.ddot(wp.mat22f(*a_values), wp.mat22f(*b_values)))
649
-
650
198
  def test_mat33_mat33_args_precision(self):
651
199
  a_values = (0.12, 1.23, 2.34, 0.12, 1.23, 2.34, 0.12, 1.23, 2.34)
652
- a_values_2d = (a_values[0:3], a_values[3:6], a_values[6:9])
653
200
  b_values = (2.34, 1.23, 0.12, 2.34, 1.23, 0.12, 2.34, 1.23, 0.12)
654
- b_values_2d = (b_values[0:3], b_values[3:6], b_values[6:9])
655
201
  expected = 6.22350000000000047606
656
202
 
657
203
  result = wp.ddot(wp.mat33d(*a_values), wp.mat33d(*b_values))
@@ -665,17 +211,9 @@ class TestBuiltinsResolution(unittest.TestCase):
665
211
  self.assertNotAlmostEqual(result, expected, places=5)
666
212
  self.assertAlmostEqual(result, expected, places=1)
667
213
 
668
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
669
- self.assertEqual(wp.ddot(a_values, b_values), wp.ddot(wp.mat33f(*a_values), wp.mat33f(*b_values)))
670
- self.assertEqual(wp.ddot(a_values_2d, b_values_2d), wp.ddot(wp.mat33f(*a_values), wp.mat33f(*b_values)))
671
- self.assertEqual(wp.ddot(a_values, b_values_2d), wp.ddot(wp.mat33f(*a_values), wp.mat33f(*b_values)))
672
- self.assertEqual(wp.ddot(a_values_2d, b_values), wp.ddot(wp.mat33f(*a_values), wp.mat33f(*b_values)))
673
-
674
214
  def test_mat44_mat44_args(self):
675
215
  a_values = (0.12, 1.23, 2.34, 3.45, 0.12, 1.23, 2.34, 3.45, 0.12, 1.23, 2.34, 3.45, 0.12, 1.23, 2.34, 3.45)
676
- a_values_2d = (a_values[0:4], a_values[4:8], a_values[8:12], a_values[12:16])
677
216
  b_values = (3.45, 2.34, 1.23, 0.12, 3.45, 2.34, 1.23, 0.12, 3.45, 2.34, 1.23, 0.12, 3.45, 2.34, 1.23, 0.12)
678
- b_values_2d = (b_values[0:4], b_values[4:8], b_values[8:12], b_values[12:16])
679
217
  expected = 26.33760000000000189857
680
218
 
681
219
  result = wp.ddot(wp.mat44d(*a_values), wp.mat44d(*b_values))
@@ -689,15 +227,8 @@ class TestBuiltinsResolution(unittest.TestCase):
689
227
  self.assertNotAlmostEqual(result, expected, places=5)
690
228
  self.assertAlmostEqual(result, expected, places=1)
691
229
 
692
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
693
- self.assertEqual(wp.ddot(a_values, b_values), wp.ddot(wp.mat44f(*a_values), wp.mat44f(*b_values)))
694
- self.assertEqual(wp.ddot(a_values_2d, b_values_2d), wp.ddot(wp.mat44f(*a_values), wp.mat44f(*b_values)))
695
- self.assertEqual(wp.ddot(a_values, b_values_2d), wp.ddot(wp.mat44f(*a_values), wp.mat44f(*b_values)))
696
- self.assertEqual(wp.ddot(a_values_2d, b_values), wp.ddot(wp.mat44f(*a_values), wp.mat44f(*b_values)))
697
-
698
230
  def test_mat22_float_args_precision(self):
699
231
  a_values = (1.23, 2.34, 3.45, 4.56)
700
- a_values_2d = (a_values[0:2], a_values[2:4])
701
232
  b_value = 0.12
702
233
  expected_00 = 0.14759999999999998122
703
234
  expected_01 = 0.28079999999999999405
@@ -730,15 +261,8 @@ class TestBuiltinsResolution(unittest.TestCase):
730
261
  self.assertAlmostEqual(result[1][0], expected_10, places=1)
731
262
  self.assertAlmostEqual(result[1][1], expected_11, places=1)
732
263
 
733
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
734
- # Multiplying a 1-D tuple of length 4 is ambiguous because it could match
735
- # either the `vec4f` or `mat22f` overload. As a result, only the 2-D variant
736
- # of the tuple is expected to resolve correctly.
737
- self.assertEqual(wp.mul(a_values_2d, b_value), wp.mul(wp.mat22f(*a_values), wp.float32(b_value)))
738
-
739
264
  def test_mat33_float_args_precision(self):
740
265
  a_values = (1.23, 2.34, 3.45, 4.56, 5.67, 6.78, 7.89, 8.90, 9.01)
741
- a_values_2d = (a_values[0:3], a_values[3:6], a_values[6:9])
742
266
  b_value = 0.12
743
267
  expected_00 = 0.14759999999999998122
744
268
  expected_01 = 0.28079999999999999405
@@ -801,10 +325,6 @@ class TestBuiltinsResolution(unittest.TestCase):
801
325
  self.assertAlmostEqual(result[2][1], expected_21, places=1)
802
326
  self.assertAlmostEqual(result[2][2], expected_22, places=1)
803
327
 
804
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
805
- self.assertEqual(wp.mul(a_values, b_value), wp.mul(wp.mat33f(*a_values), wp.float32(b_value)))
806
- self.assertEqual(wp.mul(a_values_2d, b_value), wp.mul(wp.mat33f(*a_values), wp.float32(b_value)))
807
-
808
328
  def test_mat44_float_args_precision(self):
809
329
  a_values = (
810
330
  1.23,
@@ -824,7 +344,6 @@ class TestBuiltinsResolution(unittest.TestCase):
824
344
  15.67,
825
345
  16.78,
826
346
  )
827
- a_values_2d = (a_values[0:4], a_values[4:8], a_values[8:12], a_values[12:16])
828
347
  b_value = 0.12
829
348
  expected_00 = 0.14759999999999998122
830
349
  expected_01 = 0.28079999999999999405
@@ -929,10 +448,6 @@ class TestBuiltinsResolution(unittest.TestCase):
929
448
  self.assertAlmostEqual(result[3][2], expected_32, places=1)
930
449
  self.assertAlmostEqual(result[3][3], expected_33, places=1)
931
450
 
932
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
933
- self.assertEqual(wp.mul(a_values, b_value), wp.mul(wp.mat44f(*a_values), wp.float32(b_value)))
934
- self.assertEqual(wp.mul(a_values_2d, b_value), wp.mul(wp.mat44f(*a_values), wp.float32(b_value)))
935
-
936
451
  def test_vec2_arg_precision(self):
937
452
  values = (1.23, 2.34)
938
453
  expected = 2.64357712200722438922
@@ -948,9 +463,6 @@ class TestBuiltinsResolution(unittest.TestCase):
948
463
  self.assertNotAlmostEqual(result, expected, places=5)
949
464
  self.assertAlmostEqual(result, expected, places=1)
950
465
 
951
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
952
- self.assertEqual(wp.length(values), wp.length(wp.vec2f(*values)))
953
-
954
466
  def test_vec2_arg_overflow(self):
955
467
  values = (-1234567890, -1234567890)
956
468
 
@@ -964,9 +476,6 @@ class TestBuiltinsResolution(unittest.TestCase):
964
476
  self.assertEqual(wp.length_sq(wp.vec2ui(*values)), 608168072)
965
477
  self.assertEqual(wp.length_sq(wp.vec2ul(*values)), 3048315750038104200)
966
478
 
967
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
968
- self.assertEqual(wp.length_sq(values), wp.length_sq(wp.vec2i(*values)))
969
-
970
479
  def test_vec3_arg_precision(self):
971
480
  values = (1.23, 2.34, 3.45)
972
481
  expected = 4.34637780226247727455
@@ -982,9 +491,6 @@ class TestBuiltinsResolution(unittest.TestCase):
982
491
  self.assertNotAlmostEqual(result, expected, places=5)
983
492
  self.assertAlmostEqual(result, expected, places=1)
984
493
 
985
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
986
- self.assertEqual(wp.length(values), wp.length(wp.vec3f(*values)))
987
-
988
494
  def test_vec3_arg_overflow(self):
989
495
  values = (-1234567890, -1234567890, -1234567890)
990
496
 
@@ -998,9 +504,6 @@ class TestBuiltinsResolution(unittest.TestCase):
998
504
  self.assertEqual(wp.length_sq(wp.vec3ui(*values)), 912252108)
999
505
  self.assertEqual(wp.length_sq(wp.vec3ul(*values)), 4572473625057156300)
1000
506
 
1001
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
1002
- self.assertEqual(wp.length_sq(values), wp.length_sq(wp.vec3i(*values)))
1003
-
1004
507
  def test_vec4_arg_precision(self):
1005
508
  values = (1.23, 2.34, 3.45, 4.56)
1006
509
  expected = 6.29957141399317777086
@@ -1016,9 +519,6 @@ class TestBuiltinsResolution(unittest.TestCase):
1016
519
  self.assertNotAlmostEqual(result, expected, places=5)
1017
520
  self.assertAlmostEqual(result, expected, places=1)
1018
521
 
1019
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
1020
- self.assertEqual(wp.length(values), wp.length(wp.vec4f(*values)))
1021
-
1022
522
  def test_vec4_arg_overflow(self):
1023
523
  values = (-1234567890, -1234567890, -1234567890, -1234567890)
1024
524
 
@@ -1032,9 +532,6 @@ class TestBuiltinsResolution(unittest.TestCase):
1032
532
  self.assertEqual(wp.length_sq(wp.vec4ui(*values)), 1216336144)
1033
533
  self.assertEqual(wp.length_sq(wp.vec4ul(*values)), 6096631500076208400)
1034
534
 
1035
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
1036
- self.assertEqual(wp.length_sq(values), wp.length_sq(wp.vec4i(*values)))
1037
-
1038
535
  def test_vec2_vec2_args_precision(self):
1039
536
  a_values = (1.23, 2.34)
1040
537
  b_values = (3.45, 4.56)
@@ -1051,9 +548,6 @@ class TestBuiltinsResolution(unittest.TestCase):
1051
548
  self.assertNotAlmostEqual(result, expected, places=5)
1052
549
  self.assertAlmostEqual(result, expected, places=1)
1053
550
 
1054
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
1055
- self.assertEqual(wp.dot(a_values, b_values), wp.dot(wp.vec2f(*a_values), wp.vec2f(*b_values)))
1056
-
1057
551
  def test_vec2_vec2_args_overflow(self):
1058
552
  values = (-1234567890, -1234567890)
1059
553
 
@@ -1067,9 +561,6 @@ class TestBuiltinsResolution(unittest.TestCase):
1067
561
  self.assertEqual(wp.dot(wp.vec2ui(*values), wp.vec2ui(*values)), 608168072)
1068
562
  self.assertEqual(wp.dot(wp.vec2ul(*values), wp.vec2ul(*values)), 3048315750038104200)
1069
563
 
1070
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
1071
- self.assertEqual(wp.dot(values, values), wp.dot(wp.vec2i(*values), wp.vec2i(*values)))
1072
-
1073
564
  def test_vec3_vec3_args_precision(self):
1074
565
  a_values = (1.23, 2.34, 3.45)
1075
566
  b_values = (4.56, 5.67, 6.78)
@@ -1086,9 +577,6 @@ class TestBuiltinsResolution(unittest.TestCase):
1086
577
  self.assertNotAlmostEqual(result, expected, places=5)
1087
578
  self.assertAlmostEqual(result, expected, places=1)
1088
579
 
1089
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
1090
- self.assertEqual(wp.dot(a_values, b_values), wp.dot(wp.vec3f(*a_values), wp.vec3f(*b_values)))
1091
-
1092
580
  def test_vec3_vec3_args_overflow(self):
1093
581
  values = (-1234567890, -1234567890, -1234567890)
1094
582
 
@@ -1102,9 +590,6 @@ class TestBuiltinsResolution(unittest.TestCase):
1102
590
  self.assertEqual(wp.dot(wp.vec3ui(*values), wp.vec3ui(*values)), 912252108)
1103
591
  self.assertEqual(wp.dot(wp.vec3ul(*values), wp.vec3ul(*values)), 4572473625057156300)
1104
592
 
1105
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
1106
- self.assertEqual(wp.dot(values, values), wp.dot(wp.vec3i(*values), wp.vec3i(*values)))
1107
-
1108
593
  def test_vec4_vec4_args_precision(self):
1109
594
  a_values = (1.23, 2.34, 3.45, 4.56)
1110
595
  b_values = (5.67, 6.78, 7.89, 8.90)
@@ -1121,9 +606,6 @@ class TestBuiltinsResolution(unittest.TestCase):
1121
606
  self.assertNotAlmostEqual(result, expected, places=5)
1122
607
  self.assertAlmostEqual(result, expected, places=1)
1123
608
 
1124
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
1125
- self.assertEqual(wp.dot(a_values, b_values), wp.dot(wp.vec4f(*a_values), wp.vec4f(*b_values)))
1126
-
1127
609
  def test_vec4_vec4_args_overflow(self):
1128
610
  values = (-1234567890, -1234567890, -1234567890, -1234567890)
1129
611
 
@@ -1137,9 +619,6 @@ class TestBuiltinsResolution(unittest.TestCase):
1137
619
  self.assertEqual(wp.dot(wp.vec4ui(*values), wp.vec4ui(*values)), 1216336144)
1138
620
  self.assertEqual(wp.dot(wp.vec4ul(*values), wp.vec4ul(*values)), 6096631500076208400)
1139
621
 
1140
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
1141
- self.assertEqual(wp.dot(values, values), wp.dot(wp.vec4i(*values), wp.vec4i(*values)))
1142
-
1143
622
  def test_vec2_float_args_precision(self):
1144
623
  a_values = (1.23, 2.34)
1145
624
  b_value = 3.45
@@ -1162,9 +641,6 @@ class TestBuiltinsResolution(unittest.TestCase):
1162
641
  self.assertAlmostEqual(result[0], expected_x, places=1)
1163
642
  self.assertAlmostEqual(result[1], expected_y, places=1)
1164
643
 
1165
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
1166
- self.assertEqual(wp.mul(a_values, b_value), wp.mul(wp.vec2f(*a_values), wp.float32(b_value)))
1167
-
1168
644
  def test_vec3_float_args_precision(self):
1169
645
  a_values = (1.23, 2.34, 3.45)
1170
646
  b_value = 4.56
@@ -1193,9 +669,6 @@ class TestBuiltinsResolution(unittest.TestCase):
1193
669
  self.assertAlmostEqual(result[1], expected_y, places=1)
1194
670
  self.assertAlmostEqual(result[2], expected_z, places=1)
1195
671
 
1196
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
1197
- self.assertEqual(wp.mul(a_values, b_value), wp.mul(wp.vec3f(*a_values), wp.float32(b_value)))
1198
-
1199
672
  def test_vec4_float_args_precision(self):
1200
673
  a_values = (1.23, 2.34, 3.45, 4.56)
1201
674
  b_value = 5.67
@@ -1230,11 +703,8 @@ class TestBuiltinsResolution(unittest.TestCase):
1230
703
  self.assertAlmostEqual(result[2], expected_z, places=1)
1231
704
  self.assertAlmostEqual(result[3], expected_w, places=1)
1232
705
 
1233
- with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
1234
- self.assertEqual(wp.mul(a_values, b_value), wp.mul(wp.vec4f(*a_values), wp.float32(b_value)))
1235
706
 
1236
-
1237
- for dtype in wp.types.int_types:
707
+ for dtype in wp._src.types.int_types:
1238
708
  add_function_test(
1239
709
  TestBuiltinsResolution,
1240
710
  f"test_int_arg_support_{dtype.__name__}",
@@ -1248,49 +718,13 @@ for dtype in wp.types.int_types:
1248
718
  dtype=dtype,
1249
719
  )
1250
720
 
1251
- for dtype in wp.types.float_types:
721
+ for dtype in wp._src.types.float_types:
1252
722
  add_function_test(
1253
723
  TestBuiltinsResolution,
1254
724
  f"test_float_arg_support_{dtype.__name__}",
1255
725
  test_float_arg_support,
1256
726
  dtype=dtype,
1257
727
  )
1258
- add_function_test(
1259
- TestBuiltinsResolution,
1260
- f"test_mat_arg_support_{dtype.__name__}",
1261
- test_mat_arg_support,
1262
- dtype=dtype,
1263
- )
1264
- add_function_test(
1265
- TestBuiltinsResolution,
1266
- f"test_mat_mat_args_support_{dtype.__name__}",
1267
- test_mat_mat_args_support,
1268
- dtype=dtype,
1269
- )
1270
- add_function_test(
1271
- TestBuiltinsResolution,
1272
- f"test_mat_float_args_support_{dtype.__name__}",
1273
- test_mat_float_args_support,
1274
- dtype=dtype,
1275
- )
1276
- add_function_test(
1277
- TestBuiltinsResolution,
1278
- f"test_vec_arg_support_{dtype.__name__}",
1279
- test_vec_arg_support,
1280
- dtype=dtype,
1281
- )
1282
- add_function_test(
1283
- TestBuiltinsResolution,
1284
- f"test_vec_vec_args_support_{dtype.__name__}",
1285
- test_vec_vec_args_support,
1286
- dtype=dtype,
1287
- )
1288
- add_function_test(
1289
- TestBuiltinsResolution,
1290
- f"test_vec_float_args_support_{dtype.__name__}",
1291
- test_vec_float_args_support,
1292
- dtype=dtype,
1293
- )
1294
728
 
1295
729
 
1296
730
  if __name__ == "__main__":