warp-lang 1.0.2__py3-none-manylinux2014_x86_64.whl → 1.1.0__py3-none-manylinux2014_x86_64.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 +108 -97
  2. warp/__init__.pyi +1 -1
  3. warp/bin/warp-clang.so +0 -0
  4. warp/bin/warp.so +0 -0
  5. warp/build.py +115 -113
  6. warp/build_dll.py +383 -375
  7. warp/builtins.py +3425 -3354
  8. warp/codegen.py +2878 -2792
  9. warp/config.py +40 -36
  10. warp/constants.py +45 -45
  11. warp/context.py +5194 -5102
  12. warp/dlpack.py +442 -442
  13. warp/examples/__init__.py +16 -16
  14. warp/examples/assets/bear.usd +0 -0
  15. warp/examples/assets/bunny.usd +0 -0
  16. warp/examples/assets/cartpole.urdf +110 -110
  17. warp/examples/assets/crazyflie.usd +0 -0
  18. warp/examples/assets/cube.usd +0 -0
  19. warp/examples/assets/nv_ant.xml +92 -92
  20. warp/examples/assets/nv_humanoid.xml +183 -183
  21. warp/examples/assets/quadruped.urdf +267 -267
  22. warp/examples/assets/rocks.nvdb +0 -0
  23. warp/examples/assets/rocks.usd +0 -0
  24. warp/examples/assets/sphere.usd +0 -0
  25. warp/examples/benchmarks/benchmark_api.py +383 -383
  26. warp/examples/benchmarks/benchmark_cloth.py +278 -277
  27. warp/examples/benchmarks/benchmark_cloth_cupy.py +88 -88
  28. warp/examples/benchmarks/benchmark_cloth_jax.py +97 -100
  29. warp/examples/benchmarks/benchmark_cloth_numba.py +146 -142
  30. warp/examples/benchmarks/benchmark_cloth_numpy.py +77 -77
  31. warp/examples/benchmarks/benchmark_cloth_pytorch.py +86 -86
  32. warp/examples/benchmarks/benchmark_cloth_taichi.py +112 -112
  33. warp/examples/benchmarks/benchmark_cloth_warp.py +146 -146
  34. warp/examples/benchmarks/benchmark_launches.py +295 -295
  35. warp/examples/browse.py +29 -29
  36. warp/examples/core/example_dem.py +234 -219
  37. warp/examples/core/example_fluid.py +293 -267
  38. warp/examples/core/example_graph_capture.py +144 -126
  39. warp/examples/core/example_marching_cubes.py +188 -174
  40. warp/examples/core/example_mesh.py +174 -155
  41. warp/examples/core/example_mesh_intersect.py +205 -193
  42. warp/examples/core/example_nvdb.py +176 -170
  43. warp/examples/core/example_raycast.py +105 -90
  44. warp/examples/core/example_raymarch.py +199 -178
  45. warp/examples/core/example_render_opengl.py +185 -141
  46. warp/examples/core/example_sph.py +405 -387
  47. warp/examples/core/example_torch.py +222 -181
  48. warp/examples/core/example_wave.py +263 -248
  49. warp/examples/fem/bsr_utils.py +378 -380
  50. warp/examples/fem/example_apic_fluid.py +407 -389
  51. warp/examples/fem/example_convection_diffusion.py +182 -168
  52. warp/examples/fem/example_convection_diffusion_dg.py +219 -209
  53. warp/examples/fem/example_convection_diffusion_dg0.py +204 -194
  54. warp/examples/fem/example_deformed_geometry.py +177 -159
  55. warp/examples/fem/example_diffusion.py +201 -173
  56. warp/examples/fem/example_diffusion_3d.py +177 -152
  57. warp/examples/fem/example_diffusion_mgpu.py +221 -214
  58. warp/examples/fem/example_mixed_elasticity.py +244 -222
  59. warp/examples/fem/example_navier_stokes.py +259 -243
  60. warp/examples/fem/example_stokes.py +220 -192
  61. warp/examples/fem/example_stokes_transfer.py +265 -249
  62. warp/examples/fem/mesh_utils.py +133 -109
  63. warp/examples/fem/plot_utils.py +292 -287
  64. warp/examples/optim/example_bounce.py +260 -246
  65. warp/examples/optim/example_cloth_throw.py +222 -209
  66. warp/examples/optim/example_diffray.py +566 -536
  67. warp/examples/optim/example_drone.py +864 -835
  68. warp/examples/optim/example_inverse_kinematics.py +176 -168
  69. warp/examples/optim/example_inverse_kinematics_torch.py +185 -169
  70. warp/examples/optim/example_spring_cage.py +239 -231
  71. warp/examples/optim/example_trajectory.py +223 -199
  72. warp/examples/optim/example_walker.py +306 -293
  73. warp/examples/sim/example_cartpole.py +139 -129
  74. warp/examples/sim/example_cloth.py +196 -186
  75. warp/examples/sim/example_granular.py +124 -111
  76. warp/examples/sim/example_granular_collision_sdf.py +197 -186
  77. warp/examples/sim/example_jacobian_ik.py +236 -214
  78. warp/examples/sim/example_particle_chain.py +118 -105
  79. warp/examples/sim/example_quadruped.py +193 -180
  80. warp/examples/sim/example_rigid_chain.py +197 -187
  81. warp/examples/sim/example_rigid_contact.py +189 -177
  82. warp/examples/sim/example_rigid_force.py +127 -125
  83. warp/examples/sim/example_rigid_gyroscopic.py +109 -95
  84. warp/examples/sim/example_rigid_soft_contact.py +134 -122
  85. warp/examples/sim/example_soft_body.py +190 -177
  86. warp/fabric.py +337 -335
  87. warp/fem/__init__.py +60 -27
  88. warp/fem/cache.py +401 -388
  89. warp/fem/dirichlet.py +178 -179
  90. warp/fem/domain.py +262 -263
  91. warp/fem/field/__init__.py +100 -101
  92. warp/fem/field/field.py +148 -149
  93. warp/fem/field/nodal_field.py +298 -299
  94. warp/fem/field/restriction.py +22 -21
  95. warp/fem/field/test.py +180 -181
  96. warp/fem/field/trial.py +183 -183
  97. warp/fem/geometry/__init__.py +15 -19
  98. warp/fem/geometry/closest_point.py +69 -70
  99. warp/fem/geometry/deformed_geometry.py +270 -271
  100. warp/fem/geometry/element.py +744 -744
  101. warp/fem/geometry/geometry.py +184 -186
  102. warp/fem/geometry/grid_2d.py +380 -373
  103. warp/fem/geometry/grid_3d.py +441 -435
  104. warp/fem/geometry/hexmesh.py +953 -953
  105. warp/fem/geometry/partition.py +374 -376
  106. warp/fem/geometry/quadmesh_2d.py +532 -532
  107. warp/fem/geometry/tetmesh.py +840 -840
  108. warp/fem/geometry/trimesh_2d.py +577 -577
  109. warp/fem/integrate.py +1630 -1615
  110. warp/fem/operator.py +190 -191
  111. warp/fem/polynomial.py +214 -213
  112. warp/fem/quadrature/__init__.py +2 -2
  113. warp/fem/quadrature/pic_quadrature.py +243 -245
  114. warp/fem/quadrature/quadrature.py +295 -294
  115. warp/fem/space/__init__.py +294 -292
  116. warp/fem/space/basis_space.py +488 -489
  117. warp/fem/space/collocated_function_space.py +100 -105
  118. warp/fem/space/dof_mapper.py +236 -236
  119. warp/fem/space/function_space.py +148 -145
  120. warp/fem/space/grid_2d_function_space.py +267 -267
  121. warp/fem/space/grid_3d_function_space.py +305 -306
  122. warp/fem/space/hexmesh_function_space.py +350 -352
  123. warp/fem/space/partition.py +350 -350
  124. warp/fem/space/quadmesh_2d_function_space.py +368 -369
  125. warp/fem/space/restriction.py +158 -160
  126. warp/fem/space/shape/__init__.py +13 -15
  127. warp/fem/space/shape/cube_shape_function.py +738 -738
  128. warp/fem/space/shape/shape_function.py +102 -103
  129. warp/fem/space/shape/square_shape_function.py +611 -611
  130. warp/fem/space/shape/tet_shape_function.py +565 -567
  131. warp/fem/space/shape/triangle_shape_function.py +429 -429
  132. warp/fem/space/tetmesh_function_space.py +294 -292
  133. warp/fem/space/topology.py +297 -295
  134. warp/fem/space/trimesh_2d_function_space.py +223 -221
  135. warp/fem/types.py +77 -77
  136. warp/fem/utils.py +495 -495
  137. warp/jax.py +166 -141
  138. warp/jax_experimental.py +341 -339
  139. warp/native/array.h +1072 -1025
  140. warp/native/builtin.h +1560 -1560
  141. warp/native/bvh.cpp +398 -398
  142. warp/native/bvh.cu +525 -525
  143. warp/native/bvh.h +429 -429
  144. warp/native/clang/clang.cpp +495 -464
  145. warp/native/crt.cpp +31 -31
  146. warp/native/crt.h +334 -334
  147. warp/native/cuda_crt.h +1049 -1049
  148. warp/native/cuda_util.cpp +549 -540
  149. warp/native/cuda_util.h +288 -203
  150. warp/native/cutlass_gemm.cpp +34 -34
  151. warp/native/cutlass_gemm.cu +372 -372
  152. warp/native/error.cpp +66 -66
  153. warp/native/error.h +27 -27
  154. warp/native/fabric.h +228 -228
  155. warp/native/hashgrid.cpp +301 -278
  156. warp/native/hashgrid.cu +78 -77
  157. warp/native/hashgrid.h +227 -227
  158. warp/native/initializer_array.h +32 -32
  159. warp/native/intersect.h +1204 -1204
  160. warp/native/intersect_adj.h +365 -365
  161. warp/native/intersect_tri.h +322 -322
  162. warp/native/marching.cpp +2 -2
  163. warp/native/marching.cu +497 -497
  164. warp/native/marching.h +2 -2
  165. warp/native/mat.h +1498 -1498
  166. warp/native/matnn.h +333 -333
  167. warp/native/mesh.cpp +203 -203
  168. warp/native/mesh.cu +293 -293
  169. warp/native/mesh.h +1887 -1887
  170. warp/native/nanovdb/NanoVDB.h +4782 -4782
  171. warp/native/nanovdb/PNanoVDB.h +2553 -2553
  172. warp/native/nanovdb/PNanoVDBWrite.h +294 -294
  173. warp/native/noise.h +850 -850
  174. warp/native/quat.h +1084 -1084
  175. warp/native/rand.h +299 -299
  176. warp/native/range.h +108 -108
  177. warp/native/reduce.cpp +156 -156
  178. warp/native/reduce.cu +348 -348
  179. warp/native/runlength_encode.cpp +61 -61
  180. warp/native/runlength_encode.cu +46 -46
  181. warp/native/scan.cpp +30 -30
  182. warp/native/scan.cu +36 -36
  183. warp/native/scan.h +7 -7
  184. warp/native/solid_angle.h +442 -442
  185. warp/native/sort.cpp +94 -94
  186. warp/native/sort.cu +97 -97
  187. warp/native/sort.h +14 -14
  188. warp/native/sparse.cpp +337 -337
  189. warp/native/sparse.cu +544 -544
  190. warp/native/spatial.h +630 -630
  191. warp/native/svd.h +562 -562
  192. warp/native/temp_buffer.h +30 -30
  193. warp/native/vec.h +1132 -1132
  194. warp/native/volume.cpp +297 -297
  195. warp/native/volume.cu +32 -32
  196. warp/native/volume.h +538 -538
  197. warp/native/volume_builder.cu +425 -425
  198. warp/native/volume_builder.h +19 -19
  199. warp/native/warp.cpp +1057 -1052
  200. warp/native/warp.cu +2943 -2828
  201. warp/native/warp.h +313 -305
  202. warp/optim/__init__.py +9 -9
  203. warp/optim/adam.py +120 -120
  204. warp/optim/linear.py +1104 -939
  205. warp/optim/sgd.py +104 -92
  206. warp/render/__init__.py +10 -10
  207. warp/render/render_opengl.py +3217 -3204
  208. warp/render/render_usd.py +768 -749
  209. warp/render/utils.py +152 -150
  210. warp/sim/__init__.py +52 -59
  211. warp/sim/articulation.py +685 -685
  212. warp/sim/collide.py +1594 -1590
  213. warp/sim/import_mjcf.py +489 -481
  214. warp/sim/import_snu.py +220 -221
  215. warp/sim/import_urdf.py +536 -516
  216. warp/sim/import_usd.py +887 -881
  217. warp/sim/inertia.py +316 -317
  218. warp/sim/integrator.py +234 -233
  219. warp/sim/integrator_euler.py +1956 -1956
  220. warp/sim/integrator_featherstone.py +1910 -1991
  221. warp/sim/integrator_xpbd.py +3294 -3312
  222. warp/sim/model.py +4473 -4314
  223. warp/sim/particles.py +113 -112
  224. warp/sim/render.py +417 -403
  225. warp/sim/utils.py +413 -410
  226. warp/sparse.py +1227 -1227
  227. warp/stubs.py +2109 -2469
  228. warp/tape.py +1162 -225
  229. warp/tests/__init__.py +1 -1
  230. warp/tests/__main__.py +4 -4
  231. warp/tests/assets/torus.usda +105 -105
  232. warp/tests/aux_test_class_kernel.py +26 -26
  233. warp/tests/aux_test_compile_consts_dummy.py +10 -10
  234. warp/tests/aux_test_conditional_unequal_types_kernels.py +21 -21
  235. warp/tests/aux_test_dependent.py +22 -22
  236. warp/tests/aux_test_grad_customs.py +23 -23
  237. warp/tests/aux_test_reference.py +11 -11
  238. warp/tests/aux_test_reference_reference.py +10 -10
  239. warp/tests/aux_test_square.py +17 -17
  240. warp/tests/aux_test_unresolved_func.py +14 -14
  241. warp/tests/aux_test_unresolved_symbol.py +14 -14
  242. warp/tests/disabled_kinematics.py +239 -239
  243. warp/tests/run_coverage_serial.py +31 -31
  244. warp/tests/test_adam.py +157 -157
  245. warp/tests/test_arithmetic.py +1124 -1124
  246. warp/tests/test_array.py +2417 -2326
  247. warp/tests/test_array_reduce.py +150 -150
  248. warp/tests/test_async.py +668 -656
  249. warp/tests/test_atomic.py +141 -141
  250. warp/tests/test_bool.py +204 -149
  251. warp/tests/test_builtins_resolution.py +1292 -1292
  252. warp/tests/test_bvh.py +164 -171
  253. warp/tests/test_closest_point_edge_edge.py +228 -228
  254. warp/tests/test_codegen.py +566 -553
  255. warp/tests/test_compile_consts.py +97 -101
  256. warp/tests/test_conditional.py +246 -246
  257. warp/tests/test_copy.py +232 -215
  258. warp/tests/test_ctypes.py +632 -632
  259. warp/tests/test_dense.py +67 -67
  260. warp/tests/test_devices.py +91 -98
  261. warp/tests/test_dlpack.py +530 -529
  262. warp/tests/test_examples.py +400 -378
  263. warp/tests/test_fabricarray.py +955 -955
  264. warp/tests/test_fast_math.py +62 -54
  265. warp/tests/test_fem.py +1277 -1278
  266. warp/tests/test_fp16.py +130 -130
  267. warp/tests/test_func.py +338 -337
  268. warp/tests/test_generics.py +571 -571
  269. warp/tests/test_grad.py +746 -640
  270. warp/tests/test_grad_customs.py +333 -336
  271. warp/tests/test_hash_grid.py +210 -164
  272. warp/tests/test_import.py +39 -39
  273. warp/tests/test_indexedarray.py +1134 -1134
  274. warp/tests/test_intersect.py +67 -67
  275. warp/tests/test_jax.py +307 -307
  276. warp/tests/test_large.py +167 -164
  277. warp/tests/test_launch.py +354 -354
  278. warp/tests/test_lerp.py +261 -261
  279. warp/tests/test_linear_solvers.py +191 -171
  280. warp/tests/test_lvalue.py +421 -493
  281. warp/tests/test_marching_cubes.py +65 -65
  282. warp/tests/test_mat.py +1801 -1827
  283. warp/tests/test_mat_lite.py +115 -115
  284. warp/tests/test_mat_scalar_ops.py +2907 -2889
  285. warp/tests/test_math.py +126 -193
  286. warp/tests/test_matmul.py +500 -499
  287. warp/tests/test_matmul_lite.py +410 -410
  288. warp/tests/test_mempool.py +188 -190
  289. warp/tests/test_mesh.py +284 -324
  290. warp/tests/test_mesh_query_aabb.py +228 -241
  291. warp/tests/test_mesh_query_point.py +692 -702
  292. warp/tests/test_mesh_query_ray.py +292 -303
  293. warp/tests/test_mlp.py +276 -276
  294. warp/tests/test_model.py +110 -110
  295. warp/tests/test_modules_lite.py +39 -39
  296. warp/tests/test_multigpu.py +163 -163
  297. warp/tests/test_noise.py +248 -248
  298. warp/tests/test_operators.py +250 -250
  299. warp/tests/test_options.py +123 -125
  300. warp/tests/test_peer.py +133 -137
  301. warp/tests/test_pinned.py +78 -78
  302. warp/tests/test_print.py +54 -54
  303. warp/tests/test_quat.py +2086 -2086
  304. warp/tests/test_rand.py +288 -288
  305. warp/tests/test_reload.py +217 -217
  306. warp/tests/test_rounding.py +179 -179
  307. warp/tests/test_runlength_encode.py +190 -190
  308. warp/tests/test_sim_grad.py +243 -0
  309. warp/tests/test_sim_kinematics.py +91 -97
  310. warp/tests/test_smoothstep.py +168 -168
  311. warp/tests/test_snippet.py +305 -266
  312. warp/tests/test_sparse.py +468 -460
  313. warp/tests/test_spatial.py +2148 -2148
  314. warp/tests/test_streams.py +486 -473
  315. warp/tests/test_struct.py +710 -675
  316. warp/tests/test_tape.py +173 -148
  317. warp/tests/test_torch.py +743 -743
  318. warp/tests/test_transient_module.py +87 -87
  319. warp/tests/test_types.py +556 -659
  320. warp/tests/test_utils.py +490 -499
  321. warp/tests/test_vec.py +1264 -1268
  322. warp/tests/test_vec_lite.py +73 -73
  323. warp/tests/test_vec_scalar_ops.py +2099 -2099
  324. warp/tests/test_verify_fp.py +94 -94
  325. warp/tests/test_volume.py +737 -736
  326. warp/tests/test_volume_write.py +255 -265
  327. warp/tests/unittest_serial.py +37 -37
  328. warp/tests/unittest_suites.py +363 -359
  329. warp/tests/unittest_utils.py +603 -578
  330. warp/tests/unused_test_misc.py +71 -71
  331. warp/tests/walkthrough_debug.py +85 -85
  332. warp/thirdparty/appdirs.py +598 -598
  333. warp/thirdparty/dlpack.py +143 -143
  334. warp/thirdparty/unittest_parallel.py +566 -561
  335. warp/torch.py +321 -295
  336. warp/types.py +4504 -4450
  337. warp/utils.py +1008 -821
  338. {warp_lang-1.0.2.dist-info → warp_lang-1.1.0.dist-info}/LICENSE.md +126 -126
  339. {warp_lang-1.0.2.dist-info → warp_lang-1.1.0.dist-info}/METADATA +338 -400
  340. warp_lang-1.1.0.dist-info/RECORD +352 -0
  341. warp/examples/assets/cube.usda +0 -42
  342. warp/examples/assets/sphere.usda +0 -56
  343. warp/examples/assets/torus.usda +0 -105
  344. warp_lang-1.0.2.dist-info/RECORD +0 -352
  345. {warp_lang-1.0.2.dist-info → warp_lang-1.1.0.dist-info}/WHEEL +0 -0
  346. {warp_lang-1.0.2.dist-info → warp_lang-1.1.0.dist-info}/top_level.txt +0 -0
warp/stubs.py CHANGED
@@ -1,2469 +1,2109 @@
1
- # Autogenerated file, do not edit, this file provides stubs for builtins autocomplete in VSCode, PyCharm, etc
2
-
3
- from typing import Any
4
- from typing import Tuple
5
- from typing import Callable
6
- from typing import TypeVar
7
- from typing import Generic
8
- from typing import overload as over
9
-
10
- Length = TypeVar("Length", bound=int)
11
- Rows = TypeVar("Rows", bound=int)
12
- Cols = TypeVar("Cols", bound=int)
13
- DType = TypeVar("DType")
14
- Int = TypeVar("Int")
15
- Float = TypeVar("Float")
16
- Scalar = TypeVar("Scalar")
17
- Vector = Generic[Length, Scalar]
18
- Matrix = Generic[Rows, Cols, Scalar]
19
- Quaternion = Generic[Float]
20
- Transformation = Generic[Float]
21
- Array = Generic[DType]
22
- FabricArray = Generic[DType]
23
- IndexedFabricArray = Generic[DType]
24
-
25
-
26
- from warp.types import array, array1d, array2d, array3d, array4d, constant
27
- from warp.types import indexedarray, indexedarray1d, indexedarray2d, indexedarray3d, indexedarray4d
28
- from warp.fabric import fabricarray, fabricarrayarray, indexedfabricarray, indexedfabricarrayarray
29
-
30
- from warp.types import bool, int8, uint8, int16, uint16, int32, uint32, int64, uint64, float16, float32, float64
31
- from warp.types import vec2, vec2b, vec2ub, vec2s, vec2us, vec2i, vec2ui, vec2l, vec2ul, vec2h, vec2f, vec2d
32
- from warp.types import vec3, vec3b, vec3ub, vec3s, vec3us, vec3i, vec3ui, vec3l, vec3ul, vec3h, vec3f, vec3d
33
- from warp.types import vec4, vec4b, vec4ub, vec4s, vec4us, vec4i, vec4ui, vec4l, vec4ul, vec4h, vec4f, vec4d
34
- from warp.types import mat22, mat22h, mat22f, mat22d
35
- from warp.types import mat33, mat33h, mat33f, mat33d
36
- from warp.types import mat44, mat44h, mat44f, mat44d
37
- from warp.types import quat, quath, quatf, quatd
38
- from warp.types import transform, transformh, transformf, transformd
39
- from warp.types import spatial_vector, spatial_vectorh, spatial_vectorf, spatial_vectord
40
- from warp.types import spatial_matrix, spatial_matrixh, spatial_matrixf, spatial_matrixd
41
-
42
- from warp.types import Bvh, Mesh, HashGrid, Volume, MarchingCubes
43
- from warp.types import bvh_query_t, hash_grid_query_t, mesh_query_aabb_t, mesh_query_point_t, mesh_query_ray_t
44
-
45
- from warp.types import matmul, adj_matmul, batched_matmul, adj_batched_matmul, from_ptr
46
-
47
- from warp.types import vector as vec
48
- from warp.types import matrix as mat
49
-
50
- from warp.types import dtype_from_numpy, dtype_to_numpy
51
-
52
- from warp.context import init, func, func_grad, func_replay, func_native, kernel, struct, overload
53
- from warp.context import is_cpu_available, is_cuda_available, is_device_available
54
- from warp.context import get_devices, get_preferred_device
55
- from warp.context import get_cuda_devices, get_cuda_device_count, get_cuda_device, map_cuda_device, unmap_cuda_device
56
- from warp.context import get_device, set_device, synchronize_device
57
- from warp.context import (
58
- zeros,
59
- zeros_like,
60
- ones,
61
- ones_like,
62
- full,
63
- full_like,
64
- clone,
65
- empty,
66
- empty_like,
67
- copy,
68
- from_numpy,
69
- launch,
70
- synchronize,
71
- force_load,
72
- load_module,
73
- )
74
- from warp.context import set_module_options, get_module_options, get_module
75
- from warp.context import capture_begin, capture_end, capture_launch
76
- from warp.context import Kernel, Function, Launch
77
- from warp.context import Stream, get_stream, set_stream, wait_stream, synchronize_stream
78
- from warp.context import Event, record_event, wait_event, synchronize_event
79
- from warp.context import RegisteredGLBuffer
80
- from warp.context import is_mempool_supported, is_mempool_enabled, set_mempool_enabled
81
- from warp.context import set_mempool_release_threshold, get_mempool_release_threshold
82
- from warp.context import is_mempool_access_supported, is_mempool_access_enabled, set_mempool_access_enabled
83
- from warp.context import is_peer_access_supported, is_peer_access_enabled, set_peer_access_enabled
84
-
85
- from warp.tape import Tape
86
- from warp.utils import ScopedTimer, ScopedDevice, ScopedStream
87
- from warp.utils import ScopedMempool, ScopedMempoolAccess, ScopedPeerAccess
88
- from warp.utils import ScopedCapture
89
- from warp.utils import transform_expand, quat_between_vectors
90
-
91
- from warp.torch import from_torch, to_torch
92
- from warp.torch import dtype_from_torch, dtype_to_torch
93
- from warp.torch import device_from_torch, device_to_torch
94
- from warp.torch import stream_from_torch, stream_to_torch
95
-
96
- from warp.jax import from_jax, to_jax
97
- from warp.jax import dtype_from_jax, dtype_to_jax
98
- from warp.jax import device_from_jax, device_to_jax
99
-
100
- from warp.dlpack import from_dlpack, to_dlpack
101
-
102
- from warp.constants import *
103
-
104
- from . import builtins
105
-
106
- import warp.config
107
-
108
- __version__ = warp.config.version
109
-
110
-
111
- @over
112
- def min(x: Scalar, y: Scalar) -> Scalar:
113
- """
114
- Return the minimum of two scalars.
115
- """
116
- ...
117
-
118
-
119
- @over
120
- def min(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
121
- """
122
- Return the element-wise minimum of two vectors.
123
- """
124
- ...
125
-
126
-
127
- @over
128
- def min(v: Vector[Any, Scalar]) -> Scalar:
129
- """
130
- Return the minimum element of a vector ``v``.
131
- """
132
- ...
133
-
134
-
135
- @over
136
- def max(x: Scalar, y: Scalar) -> Scalar:
137
- """
138
- Return the maximum of two scalars.
139
- """
140
- ...
141
-
142
-
143
- @over
144
- def max(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
145
- """
146
- Return the element-wise maximum of two vectors.
147
- """
148
- ...
149
-
150
-
151
- @over
152
- def max(v: Vector[Any, Scalar]) -> Scalar:
153
- """
154
- Return the maximum element of a vector ``v``.
155
- """
156
- ...
157
-
158
-
159
- @over
160
- def clamp(x: Scalar, a: Scalar, b: Scalar) -> Scalar:
161
- """
162
- Clamp the value of ``x`` to the range [a, b].
163
- """
164
- ...
165
-
166
-
167
- @over
168
- def abs(x: Scalar) -> Scalar:
169
- """
170
- Return the absolute value of ``x``.
171
- """
172
- ...
173
-
174
-
175
- @over
176
- def sign(x: Scalar) -> Scalar:
177
- """
178
- Return -1 if ``x`` < 0, return 1 otherwise.
179
- """
180
- ...
181
-
182
-
183
- @over
184
- def step(x: Scalar) -> Scalar:
185
- """
186
- Return 1.0 if ``x`` < 0.0, return 0.0 otherwise.
187
- """
188
- ...
189
-
190
-
191
- @over
192
- def nonzero(x: Scalar) -> Scalar:
193
- """
194
- Return 1.0 if ``x`` is not equal to zero, return 0.0 otherwise.
195
- """
196
- ...
197
-
198
-
199
- @over
200
- def sin(x: Float) -> Float:
201
- """
202
- Return the sine of ``x`` in radians.
203
- """
204
- ...
205
-
206
-
207
- @over
208
- def cos(x: Float) -> Float:
209
- """
210
- Return the cosine of ``x`` in radians.
211
- """
212
- ...
213
-
214
-
215
- @over
216
- def acos(x: Float) -> Float:
217
- """
218
- Return arccos of ``x`` in radians. Inputs are automatically clamped to [-1.0, 1.0].
219
- """
220
- ...
221
-
222
-
223
- @over
224
- def asin(x: Float) -> Float:
225
- """
226
- Return arcsin of ``x`` in radians. Inputs are automatically clamped to [-1.0, 1.0].
227
- """
228
- ...
229
-
230
-
231
- @over
232
- def sqrt(x: Float) -> Float:
233
- """
234
- Return the square root of ``x``, where ``x`` is positive.
235
- """
236
- ...
237
-
238
-
239
- @over
240
- def cbrt(x: Float) -> Float:
241
- """
242
- Return the cube root of ``x``.
243
- """
244
- ...
245
-
246
-
247
- @over
248
- def tan(x: Float) -> Float:
249
- """
250
- Return the tangent of ``x`` in radians.
251
- """
252
- ...
253
-
254
-
255
- @over
256
- def atan(x: Float) -> Float:
257
- """
258
- Return the arctangent of ``x`` in radians.
259
- """
260
- ...
261
-
262
-
263
- @over
264
- def atan2(y: Float, x: Float) -> Float:
265
- """
266
- Return the 2-argument arctangent, atan2, of the point ``(x, y)`` in radians.
267
- """
268
- ...
269
-
270
-
271
- @over
272
- def sinh(x: Float) -> Float:
273
- """
274
- Return the sinh of ``x``.
275
- """
276
- ...
277
-
278
-
279
- @over
280
- def cosh(x: Float) -> Float:
281
- """
282
- Return the cosh of ``x``.
283
- """
284
- ...
285
-
286
-
287
- @over
288
- def tanh(x: Float) -> Float:
289
- """
290
- Return the tanh of ``x``.
291
- """
292
- ...
293
-
294
-
295
- @over
296
- def degrees(x: Float) -> Float:
297
- """
298
- Convert ``x`` from radians into degrees.
299
- """
300
- ...
301
-
302
-
303
- @over
304
- def radians(x: Float) -> Float:
305
- """
306
- Convert ``x`` from degrees into radians.
307
- """
308
- ...
309
-
310
-
311
- @over
312
- def log(x: Float) -> Float:
313
- """
314
- Return the natural logarithm (base-e) of ``x``, where ``x`` is positive.
315
- """
316
- ...
317
-
318
-
319
- @over
320
- def log2(x: Float) -> Float:
321
- """
322
- Return the binary logarithm (base-2) of ``x``, where ``x`` is positive.
323
- """
324
- ...
325
-
326
-
327
- @over
328
- def log10(x: Float) -> Float:
329
- """
330
- Return the common logarithm (base-10) of ``x``, where ``x`` is positive.
331
- """
332
- ...
333
-
334
-
335
- @over
336
- def exp(x: Float) -> Float:
337
- """
338
- Return the value of the exponential function :math:`e^x`.
339
- """
340
- ...
341
-
342
-
343
- @over
344
- def pow(x: Float, y: Float) -> Float:
345
- """
346
- Return the result of ``x`` raised to power of ``y``.
347
- """
348
- ...
349
-
350
-
351
- @over
352
- def round(x: Float) -> Float:
353
- """
354
- Return the nearest integer value to ``x``, rounding halfway cases away from zero.
355
- This is the most intuitive form of rounding in the colloquial sense, but can be slower than other options like :func:`warp.rint()`.
356
- Differs from :func:`numpy.round()`, which behaves the same way as :func:`numpy.rint()`.
357
- """
358
- ...
359
-
360
-
361
- @over
362
- def rint(x: Float) -> Float:
363
- """
364
- Return the nearest integer value to ``x``, rounding halfway cases to nearest even integer.
365
- It is generally faster than :func:`warp.round()`. Equivalent to :func:`numpy.rint()`.
366
- """
367
- ...
368
-
369
-
370
- @over
371
- def trunc(x: Float) -> Float:
372
- """
373
- Return the nearest integer that is closer to zero than ``x``.
374
- In other words, it discards the fractional part of ``x``.
375
- It is similar to casting ``float(int(x))``, but preserves the negative sign when x is in the range [-0.0, -1.0).
376
- Equivalent to :func:`numpy.trunc()` and :func:`numpy.fix()`.
377
- """
378
- ...
379
-
380
-
381
- @over
382
- def floor(x: Float) -> Float:
383
- """
384
- Return the largest integer that is less than or equal to ``x``.
385
- """
386
- ...
387
-
388
-
389
- @over
390
- def ceil(x: Float) -> Float:
391
- """
392
- Return the smallest integer that is greater than or equal to ``x``.
393
- """
394
- ...
395
-
396
-
397
- @over
398
- def frac(x: Float) -> Float:
399
- """
400
- Retrieve the fractional part of x.
401
- In other words, it discards the integer part of x and is equivalent to ``x - trunc(x)``.
402
- """
403
- ...
404
-
405
-
406
- @over
407
- def dot(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Scalar:
408
- """
409
- Compute the dot product between two vectors.
410
- """
411
- ...
412
-
413
-
414
- @over
415
- def dot(x: Quaternion[Float], y: Quaternion[Float]) -> Scalar:
416
- """
417
- Compute the dot product between two quaternions.
418
- """
419
- ...
420
-
421
-
422
- @over
423
- def ddot(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Scalar:
424
- """
425
- Compute the double dot product between two matrices.
426
- """
427
- ...
428
-
429
-
430
- @over
431
- def argmin(v: Vector[Any, Scalar]) -> uint32:
432
- """
433
- Return the index of the minimum element of a vector ``v``.
434
- """
435
- ...
436
-
437
-
438
- @over
439
- def argmax(v: Vector[Any, Scalar]) -> uint32:
440
- """
441
- Return the index of the maximum element of a vector ``v``.
442
- """
443
- ...
444
-
445
-
446
- @over
447
- def outer(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Matrix[Any, Any, Scalar]:
448
- """
449
- Compute the outer product ``x*y^T`` for two vectors.
450
- """
451
- ...
452
-
453
-
454
- @over
455
- def cross(x: Vector[3, Scalar], y: Vector[3, Scalar]) -> Vector[3, Scalar]:
456
- """
457
- Compute the cross product of two 3D vectors.
458
- """
459
- ...
460
-
461
-
462
- @over
463
- def skew(x: Vector[3, Scalar]):
464
- """
465
- Compute the skew-symmetric 3x3 matrix for a 3D vector ``x``.
466
- """
467
- ...
468
-
469
-
470
- @over
471
- def length(x: Vector[Any, Float]) -> Scalar:
472
- """
473
- Compute the length of a vector ``x``.
474
- """
475
- ...
476
-
477
-
478
- @over
479
- def length(x: Quaternion[Float]) -> Scalar:
480
- """
481
- Compute the length of a quaternion ``x``.
482
- """
483
- ...
484
-
485
-
486
- @over
487
- def length_sq(x: Vector[Any, Scalar]) -> Scalar:
488
- """
489
- Compute the squared length of a 2D vector ``x``.
490
- """
491
- ...
492
-
493
-
494
- @over
495
- def length_sq(x: Quaternion[Scalar]) -> Scalar:
496
- """
497
- Compute the squared length of a quaternion ``x``.
498
- """
499
- ...
500
-
501
-
502
- @over
503
- def normalize(x: Vector[Any, Float]) -> Vector[Any, Scalar]:
504
- """
505
- Compute the normalized value of ``x``. If ``length(x)`` is 0 then the zero vector is returned.
506
- """
507
- ...
508
-
509
-
510
- @over
511
- def normalize(x: Quaternion[Float]) -> Quaternion[Scalar]:
512
- """
513
- Compute the normalized value of ``x``. If ``length(x)`` is 0, then the zero quaternion is returned.
514
- """
515
- ...
516
-
517
-
518
- @over
519
- def transpose(m: Matrix[Any, Any, Scalar]):
520
- """
521
- Return the transpose of the matrix ``m``.
522
- """
523
- ...
524
-
525
-
526
- @over
527
- def inverse(m: Matrix[2, 2, Float]) -> Matrix[Any, Any, Float]:
528
- """
529
- Return the inverse of a 2x2 matrix ``m``.
530
- """
531
- ...
532
-
533
-
534
- @over
535
- def inverse(m: Matrix[3, 3, Float]) -> Matrix[Any, Any, Float]:
536
- """
537
- Return the inverse of a 3x3 matrix ``m``.
538
- """
539
- ...
540
-
541
-
542
- @over
543
- def inverse(m: Matrix[4, 4, Float]) -> Matrix[Any, Any, Float]:
544
- """
545
- Return the inverse of a 4x4 matrix ``m``.
546
- """
547
- ...
548
-
549
-
550
- @over
551
- def determinant(m: Matrix[2, 2, Float]) -> Scalar:
552
- """
553
- Return the determinant of a 2x2 matrix ``m``.
554
- """
555
- ...
556
-
557
-
558
- @over
559
- def determinant(m: Matrix[3, 3, Float]) -> Scalar:
560
- """
561
- Return the determinant of a 3x3 matrix ``m``.
562
- """
563
- ...
564
-
565
-
566
- @over
567
- def determinant(m: Matrix[4, 4, Float]) -> Scalar:
568
- """
569
- Return the determinant of a 4x4 matrix ``m``.
570
- """
571
- ...
572
-
573
-
574
- @over
575
- def trace(m: Matrix[Any, Any, Scalar]) -> Scalar:
576
- """
577
- Return the trace of the matrix ``m``.
578
- """
579
- ...
580
-
581
-
582
- @over
583
- def diag(d: Vector[Any, Scalar]) -> Matrix[Any, Any, Scalar]:
584
- """
585
- Returns a matrix with the components of the vector ``d`` on the diagonal.
586
- """
587
- ...
588
-
589
-
590
- @over
591
- def get_diag(m: Matrix[Any, Any, Scalar]) -> Vector[Any, Scalar]:
592
- """
593
- Returns a vector containing the diagonal elements of the square matrix ``m``.
594
- """
595
- ...
596
-
597
-
598
- @over
599
- def cw_mul(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
600
- """
601
- Component-wise multiplication of two 2D vectors.
602
- """
603
- ...
604
-
605
-
606
- @over
607
- def cw_mul(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
608
- """
609
- Component-wise multiplication of two 2D vectors.
610
- """
611
- ...
612
-
613
-
614
- @over
615
- def cw_div(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
616
- """
617
- Component-wise division of two 2D vectors.
618
- """
619
- ...
620
-
621
-
622
- @over
623
- def cw_div(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
624
- """
625
- Component-wise division of two 2D vectors.
626
- """
627
- ...
628
-
629
-
630
- @over
631
- def quat_identity() -> quatf:
632
- """
633
- Construct an identity quaternion with zero imaginary part and real part of 1.0
634
- """
635
- ...
636
-
637
-
638
- @over
639
- def quat_from_axis_angle(axis: Vector[3, Float], angle: Float) -> Quaternion[Scalar]:
640
- """
641
- Construct a quaternion representing a rotation of angle radians around the given axis.
642
- """
643
- ...
644
-
645
-
646
- @over
647
- def quat_to_axis_angle(q: Quaternion[Float], axis: Vector[3, Float], angle: Float):
648
- """
649
- Extract the rotation axis and angle radians a quaternion represents.
650
- """
651
- ...
652
-
653
-
654
- @over
655
- def quat_from_matrix(m: Matrix[3, 3, Float]) -> Quaternion[Scalar]:
656
- """
657
- Construct a quaternion from a 3x3 matrix.
658
- """
659
- ...
660
-
661
-
662
- @over
663
- def quat_rpy(roll: Float, pitch: Float, yaw: Float) -> Quaternion[Scalar]:
664
- """
665
- Construct a quaternion representing a combined roll (z), pitch (x), yaw rotations (y) in radians.
666
- """
667
- ...
668
-
669
-
670
- @over
671
- def quat_inverse(q: Quaternion[Float]) -> Quaternion[Scalar]:
672
- """
673
- Compute quaternion conjugate.
674
- """
675
- ...
676
-
677
-
678
- @over
679
- def quat_rotate(q: Quaternion[Float], p: Vector[3, Float]) -> Vector[3, Scalar]:
680
- """
681
- Rotate a vector by a quaternion.
682
- """
683
- ...
684
-
685
-
686
- @over
687
- def quat_rotate_inv(q: Quaternion[Float], p: Vector[3, Float]) -> Vector[3, Scalar]:
688
- """
689
- Rotate a vector by the inverse of a quaternion.
690
- """
691
- ...
692
-
693
-
694
- @over
695
- def quat_slerp(q0: Quaternion[Float], q1: Quaternion[Float], t: Float) -> Quaternion[Scalar]:
696
- """
697
- Linearly interpolate between two quaternions.
698
- """
699
- ...
700
-
701
-
702
- @over
703
- def quat_to_matrix(q: Quaternion[Float]) -> Matrix[3, 3, Scalar]:
704
- """
705
- Convert a quaternion to a 3x3 rotation matrix.
706
- """
707
- ...
708
-
709
-
710
- @over
711
- def transform_identity() -> transformf:
712
- """
713
- Construct an identity transform with zero translation and identity rotation.
714
- """
715
- ...
716
-
717
-
718
- @over
719
- def transform_get_translation(t: Transformation[Float]) -> Vector[3, Scalar]:
720
- """
721
- Return the translational part of a transform ``t``.
722
- """
723
- ...
724
-
725
-
726
- @over
727
- def transform_get_rotation(t: Transformation[Float]) -> Quaternion[Scalar]:
728
- """
729
- Return the rotational part of a transform ``t``.
730
- """
731
- ...
732
-
733
-
734
- @over
735
- def transform_multiply(a: Transformation[Float], b: Transformation[Float]) -> Transformation[Scalar]:
736
- """
737
- Multiply two rigid body transformations together.
738
- """
739
- ...
740
-
741
-
742
- @over
743
- def transform_point(t: Transformation[Scalar], p: Vector[3, Scalar]) -> Vector[3, Scalar]:
744
- """
745
- Apply the transform to a point ``p`` treating the homogeneous coordinate as w=1 (translation and rotation).
746
- """
747
- ...
748
-
749
-
750
- @over
751
- def transform_point(m: Matrix[4, 4, Scalar], p: Vector[3, Scalar]) -> Vector[3, Scalar]:
752
- """
753
- Apply the transform to a point ``p`` treating the homogeneous coordinate as w=1.
754
- The transformation is applied treating ``p`` as a column vector, e.g.: ``y = M*p``.
755
- Note this is in contrast to some libraries, notably USD, which applies transforms to row vectors, ``y^T = p^T*M^T``.
756
- If the transform is coming from a library that uses row-vectors, then users should transpose the transformation
757
- matrix before calling this method.
758
- """
759
- ...
760
-
761
-
762
- @over
763
- def transform_vector(t: Transformation[Scalar], v: Vector[3, Scalar]) -> Vector[3, Scalar]:
764
- """
765
- Apply the transform to a vector ``v`` treating the homogeneous coordinate as w=0 (rotation only).
766
- """
767
- ...
768
-
769
-
770
- @over
771
- def transform_vector(m: Matrix[4, 4, Scalar], v: Vector[3, Scalar]) -> Vector[3, Scalar]:
772
- """
773
- Apply the transform to a vector ``v`` treating the homogeneous coordinate as w=0.
774
- The transformation is applied treating ``v`` as a column vector, e.g.: ``y = M*v``
775
- note this is in contrast to some libraries, notably USD, which applies transforms to row vectors, ``y^T = v^T*M^T``.
776
- If the transform is coming from a library that uses row-vectors, then users should transpose the transformation
777
- matrix before calling this method.
778
- """
779
- ...
780
-
781
-
782
- @over
783
- def transform_inverse(t: Transformation[Float]) -> Transformation[Float]:
784
- """
785
- Compute the inverse of the transformation ``t``.
786
- """
787
- ...
788
-
789
-
790
- @over
791
- def spatial_dot(a: Vector[6, Float], b: Vector[6, Float]) -> Scalar:
792
- """
793
- Compute the dot product of two 6D screw vectors.
794
- """
795
- ...
796
-
797
-
798
- @over
799
- def spatial_cross(a: Vector[6, Float], b: Vector[6, Float]) -> Vector[6, Float]:
800
- """
801
- Compute the cross product of two 6D screw vectors.
802
- """
803
- ...
804
-
805
-
806
- @over
807
- def spatial_cross_dual(a: Vector[6, Float], b: Vector[6, Float]) -> Vector[6, Float]:
808
- """
809
- Compute the dual cross product of two 6D screw vectors.
810
- """
811
- ...
812
-
813
-
814
- @over
815
- def spatial_top(a: Vector[6, Float]):
816
- """
817
- Return the top (first) part of a 6D screw vector.
818
- """
819
- ...
820
-
821
-
822
- @over
823
- def spatial_bottom(a: Vector[6, Float]):
824
- """
825
- Return the bottom (second) part of a 6D screw vector.
826
- """
827
- ...
828
-
829
-
830
- @over
831
- def spatial_jacobian(
832
- S: Array[Vector[6, Float]],
833
- joint_parents: Array[int32],
834
- joint_qd_start: Array[int32],
835
- joint_start: int32,
836
- joint_count: int32,
837
- J_start: int32,
838
- J_out: Array[Float],
839
- ):
840
- """ """
841
- ...
842
-
843
-
844
- @over
845
- def spatial_mass(
846
- I_s: Array[Matrix[6, 6, Float]], joint_start: int32, joint_count: int32, M_start: int32, M: Array[Float]
847
- ):
848
- """ """
849
- ...
850
-
851
-
852
- @over
853
- def mlp(
854
- weights: Array[float32],
855
- bias: Array[float32],
856
- activation: Callable,
857
- index: int32,
858
- x: Array[float32],
859
- out: Array[float32],
860
- ):
861
- """
862
- Evaluate a multi-layer perceptron (MLP) layer in the form: ``out = act(weights*x + bias)``.
863
-
864
- :param weights: A layer's network weights with dimensions ``(m, n)``.
865
- :param bias: An array with dimensions ``(n)``.
866
- :param activation: A ``wp.func`` function that takes a single scalar float as input and returns a scalar float as output
867
- :param index: The batch item to process, typically each thread will process one item in the batch, in which case
868
- index should be ``wp.tid()``
869
- :param x: The feature matrix with dimensions ``(n, b)``
870
- :param out: The network output with dimensions ``(m, b)``
871
-
872
- :note: Feature and output matrices are transposed compared to some other frameworks such as PyTorch.
873
- All matrices are assumed to be stored in flattened row-major memory layout (NumPy default).
874
- """
875
- ...
876
-
877
-
878
- @over
879
- def bvh_query_aabb(id: uint64, lower: vec3f, upper: vec3f) -> bvh_query_t:
880
- """
881
- Construct an axis-aligned bounding box query against a BVH object. This query can be used to iterate over all bounds
882
- inside a BVH.
883
-
884
- :param id: The BVH identifier
885
- :param lower: The lower bound of the bounding box in BVH space
886
- :param upper: The upper bound of the bounding box in BVH space
887
- """
888
- ...
889
-
890
-
891
- @over
892
- def bvh_query_ray(id: uint64, start: vec3f, dir: vec3f) -> bvh_query_t:
893
- """
894
- Construct a ray query against a BVH object. This query can be used to iterate over all bounds
895
- that intersect the ray.
896
-
897
- :param id: The BVH identifier
898
- :param start: The start of the ray in BVH space
899
- :param dir: The direction of the ray in BVH space
900
- """
901
- ...
902
-
903
-
904
- @over
905
- def bvh_query_next(query: bvh_query_t, index: int32) -> bool:
906
- """
907
- Move to the next bound returned by the query.
908
- The index of the current bound is stored in ``index``, returns ``False`` if there are no more overlapping bound.
909
- """
910
- ...
911
-
912
-
913
- @over
914
- def mesh_query_point(id: uint64, point: vec3f, max_dist: float32) -> mesh_query_point_t:
915
- """
916
- Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
917
-
918
- Identifies the sign of the distance using additional ray-casts to determine if the point is inside or outside.
919
- This method is relatively robust, but does increase computational cost.
920
- See below for additional sign determination methods.
921
-
922
- :param id: The mesh identifier
923
- :param point: The point in space to query
924
- :param max_dist: Mesh faces above this distance will not be considered by the query
925
- """
926
- ...
927
-
928
-
929
- @over
930
- def mesh_query_point_no_sign(id: uint64, point: vec3f, max_dist: float32) -> mesh_query_point_t:
931
- """
932
- Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
933
-
934
- This method does not compute the sign of the point (inside/outside) which makes it faster than other point query methods.
935
-
936
- :param id: The mesh identifier
937
- :param point: The point in space to query
938
- :param max_dist: Mesh faces above this distance will not be considered by the query
939
- """
940
- ...
941
-
942
-
943
- @over
944
- def mesh_query_furthest_point_no_sign(id: uint64, point: vec3f, min_dist: float32) -> mesh_query_point_t:
945
- """
946
- Computes the furthest point on the mesh with identifier `id` to the given point in space.
947
-
948
- This method does not compute the sign of the point (inside/outside).
949
-
950
- :param id: The mesh identifier
951
- :param point: The point in space to query
952
- :param min_dist: Mesh faces below this distance will not be considered by the query
953
- """
954
- ...
955
-
956
-
957
- @over
958
- def mesh_query_point_sign_normal(id: uint64, point: vec3f, max_dist: float32, epsilon: float32) -> mesh_query_point_t:
959
- """
960
- Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
961
-
962
- Identifies the sign of the distance (inside/outside) using the angle-weighted pseudo normal.
963
- This approach to sign determination is robust for well conditioned meshes that are watertight and non-self intersecting.
964
- It is also comparatively fast to compute.
965
-
966
- :param id: The mesh identifier
967
- :param point: The point in space to query
968
- :param max_dist: Mesh faces above this distance will not be considered by the query
969
- :param epsilon: Epsilon treating distance values as equal, when locating the minimum distance vertex/face/edge, as a
970
- fraction of the average edge length, also for treating closest point as being on edge/vertex default 1e-3
971
- """
972
- ...
973
-
974
-
975
- @over
976
- def mesh_query_point_sign_winding_number(
977
- id: uint64, point: vec3f, max_dist: float32, accuracy: float32, threshold: float32
978
- ) -> mesh_query_point_t:
979
- """
980
- Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given point in space.
981
-
982
- Identifies the sign using the winding number of the mesh relative to the query point. This method of sign determination is robust for poorly conditioned meshes
983
- and provides a smooth approximation to sign even when the mesh is not watertight. This method is the most robust and accurate of the sign determination meshes
984
- but also the most expensive.
985
-
986
- .. note:: The :class:`Mesh` object must be constructed with ``support_winding_number=True`` for this method to return correct results.
987
-
988
- :param id: The mesh identifier
989
- :param point: The point in space to query
990
- :param max_dist: Mesh faces above this distance will not be considered by the query
991
- :param accuracy: Accuracy for computing the winding number with fast winding number method utilizing second-order dipole approximation, default 2.0
992
- :param threshold: The threshold of the winding number to be considered inside, default 0.5
993
- """
994
- ...
995
-
996
-
997
- @over
998
- def mesh_query_ray(id: uint64, start: vec3f, dir: vec3f, max_t: float32) -> mesh_query_ray_t:
999
- """
1000
- Computes the closest ray hit on the :class:`Mesh` with identifier ``id``.
1001
-
1002
- :param id: The mesh identifier
1003
- :param start: The start point of the ray
1004
- :param dir: The ray direction (should be normalized)
1005
- :param max_t: The maximum distance along the ray to check for intersections
1006
- """
1007
- ...
1008
-
1009
-
1010
- @over
1011
- def mesh_query_aabb(id: uint64, lower: vec3f, upper: vec3f) -> mesh_query_aabb_t:
1012
- """
1013
- Construct an axis-aligned bounding box query against a :class:`Mesh`.
1014
- This query can be used to iterate over all triangles inside a volume.
1015
-
1016
- :param id: The mesh identifier
1017
- :param lower: The lower bound of the bounding box in mesh space
1018
- :param upper: The upper bound of the bounding box in mesh space
1019
- """
1020
- ...
1021
-
1022
-
1023
- @over
1024
- def mesh_query_aabb_next(query: mesh_query_aabb_t, index: int32) -> bool:
1025
- """
1026
- Move to the next triangle overlapping the query bounding box.
1027
- The index of the current face is stored in ``index``, returns ``False`` if there are no more overlapping triangles.
1028
- """
1029
- ...
1030
-
1031
-
1032
- @over
1033
- def mesh_eval_position(id: uint64, face: int32, bary_u: float32, bary_v: float32) -> vec3f:
1034
- """
1035
- Evaluates the position on the :class:`Mesh` given a face index and barycentric coordinates.
1036
- """
1037
- ...
1038
-
1039
-
1040
- @over
1041
- def mesh_eval_velocity(id: uint64, face: int32, bary_u: float32, bary_v: float32) -> vec3f:
1042
- """
1043
- Evaluates the velocity on the :class:`Mesh` given a face index and barycentric coordinates.
1044
- """
1045
- ...
1046
-
1047
-
1048
- @over
1049
- def hash_grid_query(id: uint64, point: vec3f, max_dist: float32) -> hash_grid_query_t:
1050
- """
1051
- Construct a point query against a :class:`HashGrid`. This query can be used to iterate over all neighboring points within a fixed radius from the query point.
1052
- """
1053
- ...
1054
-
1055
-
1056
- @over
1057
- def hash_grid_query_next(query: hash_grid_query_t, index: int32) -> bool:
1058
- """
1059
- Move to the next point in the hash grid query. The index of the current neighbor is stored in ``index``, returns ``False``
1060
- if there are no more neighbors.
1061
- """
1062
- ...
1063
-
1064
-
1065
- @over
1066
- def hash_grid_point_id(id: uint64, index: int32) -> int:
1067
- """
1068
- Return the index of a point in the :class:`HashGrid`. This can be used to reorder threads such that grid
1069
- traversal occurs in a spatially coherent order.
1070
-
1071
- Returns -1 if the :class:`HashGrid` has not been reserved.
1072
- """
1073
- ...
1074
-
1075
-
1076
- @over
1077
- def intersect_tri_tri(v0: vec3f, v1: vec3f, v2: vec3f, u0: vec3f, u1: vec3f, u2: vec3f) -> int:
1078
- """
1079
- Tests for intersection between two triangles (v0, v1, v2) and (u0, u1, u2) using Moller's method. Returns > 0 if triangles intersect.
1080
- """
1081
- ...
1082
-
1083
-
1084
- @over
1085
- def mesh_get(id: uint64) -> Mesh:
1086
- """
1087
- Retrieves the mesh given its index.
1088
- """
1089
- ...
1090
-
1091
-
1092
- @over
1093
- def mesh_eval_face_normal(id: uint64, face: int32) -> vec3f:
1094
- """
1095
- Evaluates the face normal the mesh given a face index.
1096
- """
1097
- ...
1098
-
1099
-
1100
- @over
1101
- def mesh_get_point(id: uint64, index: int32) -> vec3f:
1102
- """
1103
- Returns the point of the mesh given a index.
1104
- """
1105
- ...
1106
-
1107
-
1108
- @over
1109
- def mesh_get_velocity(id: uint64, index: int32) -> vec3f:
1110
- """
1111
- Returns the velocity of the mesh given a index.
1112
- """
1113
- ...
1114
-
1115
-
1116
- @over
1117
- def mesh_get_index(id: uint64, index: int32) -> int:
1118
- """
1119
- Returns the point-index of the mesh given a face-vertex index.
1120
- """
1121
- ...
1122
-
1123
-
1124
- @over
1125
- def closest_point_edge_edge(p1: vec3f, q1: vec3f, p2: vec3f, q2: vec3f, epsilon: float32) -> vec3f:
1126
- """
1127
- Finds the closest points between two edges. Returns barycentric weights to the points on each edge, as well as the closest distance between the edges.
1128
-
1129
- :param p1: First point of first edge
1130
- :param q1: Second point of first edge
1131
- :param p2: First point of second edge
1132
- :param q2: Second point of second edge
1133
- :param epsilon: Zero tolerance for determining if points in an edge are degenerate.
1134
- :param out: vec3 output containing (s,t,d), where `s` in [0,1] is the barycentric weight for the first edge, `t` is the barycentric weight for the second edge, and `d` is the distance between the two edges at these two closest points.
1135
- """
1136
- ...
1137
-
1138
-
1139
- @over
1140
- def volume_sample_f(id: uint64, uvw: vec3f, sampling_mode: int32) -> float:
1141
- """
1142
- Sample the volume given by ``id`` at the volume local-space point ``uvw``.
1143
- Interpolation should be :attr:`warp.Volume.CLOSEST` or :attr:`wp.Volume.LINEAR.`
1144
- """
1145
- ...
1146
-
1147
-
1148
- @over
1149
- def volume_sample_grad_f(id: uint64, uvw: vec3f, sampling_mode: int32, grad: vec3f) -> float:
1150
- """
1151
- Sample the volume and its gradient given by ``id`` at the volume local-space point ``uvw``.
1152
- Interpolation should be :attr:`warp.Volume.CLOSEST` or :attr:`wp.Volume.LINEAR.`
1153
- """
1154
- ...
1155
-
1156
-
1157
- @over
1158
- def volume_lookup_f(id: uint64, i: int32, j: int32, k: int32) -> float:
1159
- """
1160
- Returns the value of voxel with coordinates ``i``, ``j``, ``k``.
1161
- If the voxel at this index does not exist, this function returns the background value
1162
- """
1163
- ...
1164
-
1165
-
1166
- @over
1167
- def volume_store_f(id: uint64, i: int32, j: int32, k: int32, value: float32):
1168
- """
1169
- Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``.
1170
- """
1171
- ...
1172
-
1173
-
1174
- @over
1175
- def volume_sample_v(id: uint64, uvw: vec3f, sampling_mode: int32) -> vec3f:
1176
- """
1177
- Sample the vector volume given by ``id`` at the volume local-space point ``uvw``.
1178
- Interpolation should be :attr:`warp.Volume.CLOSEST` or :attr:`wp.Volume.LINEAR.`
1179
- """
1180
- ...
1181
-
1182
-
1183
- @over
1184
- def volume_lookup_v(id: uint64, i: int32, j: int32, k: int32) -> vec3f:
1185
- """
1186
- Returns the vector value of voxel with coordinates ``i``, ``j``, ``k``.
1187
- If the voxel at this index does not exist, this function returns the background value.
1188
- """
1189
- ...
1190
-
1191
-
1192
- @over
1193
- def volume_store_v(id: uint64, i: int32, j: int32, k: int32, value: vec3f):
1194
- """
1195
- Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``.
1196
- """
1197
- ...
1198
-
1199
-
1200
- @over
1201
- def volume_sample_i(id: uint64, uvw: vec3f) -> int:
1202
- """
1203
- Sample the :class:`int32` volume given by ``id`` at the volume local-space point ``uvw``.
1204
- """
1205
- ...
1206
-
1207
-
1208
- @over
1209
- def volume_lookup_i(id: uint64, i: int32, j: int32, k: int32) -> int:
1210
- """
1211
- Returns the :class:`int32` value of voxel with coordinates ``i``, ``j``, ``k``.
1212
- If the voxel at this index does not exist, this function returns the background value.
1213
- """
1214
- ...
1215
-
1216
-
1217
- @over
1218
- def volume_store_i(id: uint64, i: int32, j: int32, k: int32, value: int32):
1219
- """
1220
- Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``.
1221
- """
1222
- ...
1223
-
1224
-
1225
- @over
1226
- def volume_index_to_world(id: uint64, uvw: vec3f) -> vec3f:
1227
- """
1228
- Transform a point ``uvw`` defined in volume index space to world space given the volume's intrinsic affine transformation.
1229
- """
1230
- ...
1231
-
1232
-
1233
- @over
1234
- def volume_world_to_index(id: uint64, xyz: vec3f) -> vec3f:
1235
- """
1236
- Transform a point ``xyz`` defined in volume world space to the volume's index space given the volume's intrinsic affine transformation.
1237
- """
1238
- ...
1239
-
1240
-
1241
- @over
1242
- def volume_index_to_world_dir(id: uint64, uvw: vec3f) -> vec3f:
1243
- """
1244
- Transform a direction ``uvw`` defined in volume index space to world space given the volume's intrinsic affine transformation.
1245
- """
1246
- ...
1247
-
1248
-
1249
- @over
1250
- def volume_world_to_index_dir(id: uint64, xyz: vec3f) -> vec3f:
1251
- """
1252
- Transform a direction ``xyz`` defined in volume world space to the volume's index space given the volume's intrinsic affine transformation.
1253
- """
1254
- ...
1255
-
1256
-
1257
- @over
1258
- def rand_init(seed: int32) -> uint32:
1259
- """
1260
- Initialize a new random number generator given a user-defined seed. Returns a 32-bit integer representing the RNG state.
1261
- """
1262
- ...
1263
-
1264
-
1265
- @over
1266
- def rand_init(seed: int32, offset: int32) -> uint32:
1267
- """
1268
- Initialize a new random number generator given a user-defined seed and an offset.
1269
- This alternative constructor can be useful in parallel programs, where a kernel as a whole should share a seed,
1270
- but each thread should generate uncorrelated values. In this case usage should be ``r = rand_init(seed, tid)``
1271
- """
1272
- ...
1273
-
1274
-
1275
- @over
1276
- def randi(state: uint32) -> int:
1277
- """
1278
- Return a random integer in the range [0, 2^32).
1279
- """
1280
- ...
1281
-
1282
-
1283
- @over
1284
- def randi(state: uint32, min: int32, max: int32) -> int:
1285
- """
1286
- Return a random integer between [min, max).
1287
- """
1288
- ...
1289
-
1290
-
1291
- @over
1292
- def randf(state: uint32) -> float:
1293
- """
1294
- Return a random float between [0.0, 1.0).
1295
- """
1296
- ...
1297
-
1298
-
1299
- @over
1300
- def randf(state: uint32, min: float32, max: float32) -> float:
1301
- """
1302
- Return a random float between [min, max).
1303
- """
1304
- ...
1305
-
1306
-
1307
- @over
1308
- def randn(state: uint32) -> float:
1309
- """
1310
- Sample a normal distribution.
1311
- """
1312
- ...
1313
-
1314
-
1315
- @over
1316
- def sample_cdf(state: uint32, cdf: Array[float32]) -> int:
1317
- """
1318
- Inverse-transform sample a cumulative distribution function.
1319
- """
1320
- ...
1321
-
1322
-
1323
- @over
1324
- def sample_triangle(state: uint32) -> vec2f:
1325
- """
1326
- Uniformly sample a triangle. Returns sample barycentric coordinates.
1327
- """
1328
- ...
1329
-
1330
-
1331
- @over
1332
- def sample_unit_ring(state: uint32) -> vec2f:
1333
- """
1334
- Uniformly sample a ring in the xy plane.
1335
- """
1336
- ...
1337
-
1338
-
1339
- @over
1340
- def sample_unit_disk(state: uint32) -> vec2f:
1341
- """
1342
- Uniformly sample a disk in the xy plane.
1343
- """
1344
- ...
1345
-
1346
-
1347
- @over
1348
- def sample_unit_sphere_surface(state: uint32) -> vec3f:
1349
- """
1350
- Uniformly sample a unit sphere surface.
1351
- """
1352
- ...
1353
-
1354
-
1355
- @over
1356
- def sample_unit_sphere(state: uint32) -> vec3f:
1357
- """
1358
- Uniformly sample a unit sphere.
1359
- """
1360
- ...
1361
-
1362
-
1363
- @over
1364
- def sample_unit_hemisphere_surface(state: uint32) -> vec3f:
1365
- """
1366
- Uniformly sample a unit hemisphere surface.
1367
- """
1368
- ...
1369
-
1370
-
1371
- @over
1372
- def sample_unit_hemisphere(state: uint32) -> vec3f:
1373
- """
1374
- Uniformly sample a unit hemisphere.
1375
- """
1376
- ...
1377
-
1378
-
1379
- @over
1380
- def sample_unit_square(state: uint32) -> vec2f:
1381
- """
1382
- Uniformly sample a unit square.
1383
- """
1384
- ...
1385
-
1386
-
1387
- @over
1388
- def sample_unit_cube(state: uint32) -> vec3f:
1389
- """
1390
- Uniformly sample a unit cube.
1391
- """
1392
- ...
1393
-
1394
-
1395
- @over
1396
- def poisson(state: uint32, lam: float32) -> uint32:
1397
- """
1398
- Generate a random sample from a Poisson distribution.
1399
-
1400
- :param state: RNG state
1401
- :param lam: The expected value of the distribution
1402
- """
1403
- ...
1404
-
1405
-
1406
- @over
1407
- def noise(state: uint32, x: float32) -> float:
1408
- """
1409
- Non-periodic Perlin-style noise in 1D.
1410
- """
1411
- ...
1412
-
1413
-
1414
- @over
1415
- def noise(state: uint32, xy: vec2f) -> float:
1416
- """
1417
- Non-periodic Perlin-style noise in 2D.
1418
- """
1419
- ...
1420
-
1421
-
1422
- @over
1423
- def noise(state: uint32, xyz: vec3f) -> float:
1424
- """
1425
- Non-periodic Perlin-style noise in 3D.
1426
- """
1427
- ...
1428
-
1429
-
1430
- @over
1431
- def noise(state: uint32, xyzt: vec4f) -> float:
1432
- """
1433
- Non-periodic Perlin-style noise in 4D.
1434
- """
1435
- ...
1436
-
1437
-
1438
- @over
1439
- def pnoise(state: uint32, x: float32, px: int32) -> float:
1440
- """
1441
- Periodic Perlin-style noise in 1D.
1442
- """
1443
- ...
1444
-
1445
-
1446
- @over
1447
- def pnoise(state: uint32, xy: vec2f, px: int32, py: int32) -> float:
1448
- """
1449
- Periodic Perlin-style noise in 2D.
1450
- """
1451
- ...
1452
-
1453
-
1454
- @over
1455
- def pnoise(state: uint32, xyz: vec3f, px: int32, py: int32, pz: int32) -> float:
1456
- """
1457
- Periodic Perlin-style noise in 3D.
1458
- """
1459
- ...
1460
-
1461
-
1462
- @over
1463
- def pnoise(state: uint32, xyzt: vec4f, px: int32, py: int32, pz: int32, pt: int32) -> float:
1464
- """
1465
- Periodic Perlin-style noise in 4D.
1466
- """
1467
- ...
1468
-
1469
-
1470
- @over
1471
- def curlnoise(state: uint32, xy: vec2f, octaves: uint32, lacunarity: float32, gain: float32) -> vec2f:
1472
- """
1473
- Divergence-free vector field based on the gradient of a Perlin noise function.
1474
- """
1475
- ...
1476
-
1477
-
1478
- @over
1479
- def curlnoise(state: uint32, xyz: vec3f, octaves: uint32, lacunarity: float32, gain: float32) -> vec3f:
1480
- """
1481
- Divergence-free vector field based on the curl of three Perlin noise functions.
1482
- """
1483
- ...
1484
-
1485
-
1486
- @over
1487
- def curlnoise(state: uint32, xyzt: vec4f, octaves: uint32, lacunarity: float32, gain: float32) -> vec3f:
1488
- """
1489
- Divergence-free vector field based on the curl of three Perlin noise functions.
1490
- """
1491
- ...
1492
-
1493
-
1494
- @over
1495
- def printf():
1496
- """
1497
- Allows printing formatted strings using C-style format specifiers.
1498
- """
1499
- ...
1500
-
1501
-
1502
- @over
1503
- def tid() -> Tuple[int, int]:
1504
- """
1505
- Return the current thread indices for a 2D kernel launch. Use ``i,j = wp.tid()`` syntax to retrieve the
1506
- coordinates inside the kernel thread grid. This function may not be called from user-defined Warp functions.
1507
- """
1508
- ...
1509
-
1510
-
1511
- @over
1512
- def tid() -> Tuple[int, int, int]:
1513
- """
1514
- Return the current thread indices for a 3D kernel launch. Use ``i,j,k = wp.tid()`` syntax to retrieve the
1515
- coordinates inside the kernel thread grid. This function may not be called from user-defined Warp functions.
1516
- """
1517
- ...
1518
-
1519
-
1520
- @over
1521
- def tid() -> Tuple[int, int, int, int]:
1522
- """
1523
- Return the current thread indices for a 4D kernel launch. Use ``i,j,k,l = wp.tid()`` syntax to retrieve the
1524
- coordinates inside the kernel thread grid. This function may not be called from user-defined Warp functions.
1525
- """
1526
- ...
1527
-
1528
-
1529
- @over
1530
- def select(cond: bool, arg1: Any, arg2: Any):
1531
- """
1532
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1533
- """
1534
- ...
1535
-
1536
-
1537
- @over
1538
- def select(cond: bool, arg1: Any, arg2: Any):
1539
- """
1540
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1541
- """
1542
- ...
1543
-
1544
-
1545
- @over
1546
- def select(cond: int8, arg1: Any, arg2: Any):
1547
- """
1548
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1549
- """
1550
- ...
1551
-
1552
-
1553
- @over
1554
- def select(cond: uint8, arg1: Any, arg2: Any):
1555
- """
1556
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1557
- """
1558
- ...
1559
-
1560
-
1561
- @over
1562
- def select(cond: int16, arg1: Any, arg2: Any):
1563
- """
1564
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1565
- """
1566
- ...
1567
-
1568
-
1569
- @over
1570
- def select(cond: uint16, arg1: Any, arg2: Any):
1571
- """
1572
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1573
- """
1574
- ...
1575
-
1576
-
1577
- @over
1578
- def select(cond: int32, arg1: Any, arg2: Any):
1579
- """
1580
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1581
- """
1582
- ...
1583
-
1584
-
1585
- @over
1586
- def select(cond: uint32, arg1: Any, arg2: Any):
1587
- """
1588
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1589
- """
1590
- ...
1591
-
1592
-
1593
- @over
1594
- def select(cond: int64, arg1: Any, arg2: Any):
1595
- """
1596
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1597
- """
1598
- ...
1599
-
1600
-
1601
- @over
1602
- def select(cond: uint64, arg1: Any, arg2: Any):
1603
- """
1604
- Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``
1605
- """
1606
- ...
1607
-
1608
-
1609
- @over
1610
- def select(arr: Array[Any], arg1: Any, arg2: Any):
1611
- """
1612
- Select between two arguments, if ``arr`` is null then return ``arg1``, otherwise return ``arg2``
1613
- """
1614
- ...
1615
-
1616
-
1617
- @over
1618
- def atomic_add(a: Array[Any], i: int32, value: Any):
1619
- """
1620
- Atomically add ``value`` onto ``a[i]``.
1621
- """
1622
- ...
1623
-
1624
-
1625
- @over
1626
- def atomic_add(a: Array[Any], i: int32, j: int32, value: Any):
1627
- """
1628
- Atomically add ``value`` onto ``a[i,j]``.
1629
- """
1630
- ...
1631
-
1632
-
1633
- @over
1634
- def atomic_add(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
1635
- """
1636
- Atomically add ``value`` onto ``a[i,j,k]``.
1637
- """
1638
- ...
1639
-
1640
-
1641
- @over
1642
- def atomic_add(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1643
- """
1644
- Atomically add ``value`` onto ``a[i,j,k,l]``.
1645
- """
1646
- ...
1647
-
1648
-
1649
- @over
1650
- def atomic_add(a: FabricArray[Any], i: int32, value: Any):
1651
- """
1652
- Atomically add ``value`` onto ``a[i]``.
1653
- """
1654
- ...
1655
-
1656
-
1657
- @over
1658
- def atomic_add(a: FabricArray[Any], i: int32, j: int32, value: Any):
1659
- """
1660
- Atomically add ``value`` onto ``a[i,j]``.
1661
- """
1662
- ...
1663
-
1664
-
1665
- @over
1666
- def atomic_add(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1667
- """
1668
- Atomically add ``value`` onto ``a[i,j,k]``.
1669
- """
1670
- ...
1671
-
1672
-
1673
- @over
1674
- def atomic_add(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1675
- """
1676
- Atomically add ``value`` onto ``a[i,j,k,l]``.
1677
- """
1678
- ...
1679
-
1680
-
1681
- @over
1682
- def atomic_add(a: IndexedFabricArray[Any], i: int32, value: Any):
1683
- """
1684
- Atomically add ``value`` onto ``a[i]``.
1685
- """
1686
- ...
1687
-
1688
-
1689
- @over
1690
- def atomic_add(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
1691
- """
1692
- Atomically add ``value`` onto ``a[i,j]``.
1693
- """
1694
- ...
1695
-
1696
-
1697
- @over
1698
- def atomic_add(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1699
- """
1700
- Atomically add ``value`` onto ``a[i,j,k]``.
1701
- """
1702
- ...
1703
-
1704
-
1705
- @over
1706
- def atomic_add(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1707
- """
1708
- Atomically add ``value`` onto ``a[i,j,k,l]``.
1709
- """
1710
- ...
1711
-
1712
-
1713
- @over
1714
- def atomic_sub(a: Array[Any], i: int32, value: Any):
1715
- """
1716
- Atomically subtract ``value`` onto ``a[i]``.
1717
- """
1718
- ...
1719
-
1720
-
1721
- @over
1722
- def atomic_sub(a: Array[Any], i: int32, j: int32, value: Any):
1723
- """
1724
- Atomically subtract ``value`` onto ``a[i,j]``.
1725
- """
1726
- ...
1727
-
1728
-
1729
- @over
1730
- def atomic_sub(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
1731
- """
1732
- Atomically subtract ``value`` onto ``a[i,j,k]``.
1733
- """
1734
- ...
1735
-
1736
-
1737
- @over
1738
- def atomic_sub(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1739
- """
1740
- Atomically subtract ``value`` onto ``a[i,j,k,l]``.
1741
- """
1742
- ...
1743
-
1744
-
1745
- @over
1746
- def atomic_sub(a: FabricArray[Any], i: int32, value: Any):
1747
- """
1748
- Atomically subtract ``value`` onto ``a[i]``.
1749
- """
1750
- ...
1751
-
1752
-
1753
- @over
1754
- def atomic_sub(a: FabricArray[Any], i: int32, j: int32, value: Any):
1755
- """
1756
- Atomically subtract ``value`` onto ``a[i,j]``.
1757
- """
1758
- ...
1759
-
1760
-
1761
- @over
1762
- def atomic_sub(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1763
- """
1764
- Atomically subtract ``value`` onto ``a[i,j,k]``.
1765
- """
1766
- ...
1767
-
1768
-
1769
- @over
1770
- def atomic_sub(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1771
- """
1772
- Atomically subtract ``value`` onto ``a[i,j,k,l]``.
1773
- """
1774
- ...
1775
-
1776
-
1777
- @over
1778
- def atomic_sub(a: IndexedFabricArray[Any], i: int32, value: Any):
1779
- """
1780
- Atomically subtract ``value`` onto ``a[i]``.
1781
- """
1782
- ...
1783
-
1784
-
1785
- @over
1786
- def atomic_sub(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
1787
- """
1788
- Atomically subtract ``value`` onto ``a[i,j]``.
1789
- """
1790
- ...
1791
-
1792
-
1793
- @over
1794
- def atomic_sub(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1795
- """
1796
- Atomically subtract ``value`` onto ``a[i,j,k]``.
1797
- """
1798
- ...
1799
-
1800
-
1801
- @over
1802
- def atomic_sub(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1803
- """
1804
- Atomically subtract ``value`` onto ``a[i,j,k,l]``.
1805
- """
1806
- ...
1807
-
1808
-
1809
- @over
1810
- def atomic_min(a: Array[Any], i: int32, value: Any):
1811
- """
1812
- Compute the minimum of ``value`` and ``a[i]`` and atomically update the array.
1813
-
1814
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1815
- """
1816
- ...
1817
-
1818
-
1819
- @over
1820
- def atomic_min(a: Array[Any], i: int32, j: int32, value: Any):
1821
- """
1822
- Compute the minimum of ``value`` and ``a[i,j]`` and atomically update the array.
1823
-
1824
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1825
- """
1826
- ...
1827
-
1828
-
1829
- @over
1830
- def atomic_min(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
1831
- """
1832
- Compute the minimum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1833
-
1834
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1835
- """
1836
- ...
1837
-
1838
-
1839
- @over
1840
- def atomic_min(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1841
- """
1842
- Compute the minimum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1843
-
1844
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1845
- """
1846
- ...
1847
-
1848
-
1849
- @over
1850
- def atomic_min(a: FabricArray[Any], i: int32, value: Any):
1851
- """
1852
- Compute the minimum of ``value`` and ``a[i]`` and atomically update the array.
1853
-
1854
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1855
- """
1856
- ...
1857
-
1858
-
1859
- @over
1860
- def atomic_min(a: FabricArray[Any], i: int32, j: int32, value: Any):
1861
- """
1862
- Compute the minimum of ``value`` and ``a[i,j]`` and atomically update the array.
1863
-
1864
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1865
- """
1866
- ...
1867
-
1868
-
1869
- @over
1870
- def atomic_min(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1871
- """
1872
- Compute the minimum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1873
-
1874
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1875
- """
1876
- ...
1877
-
1878
-
1879
- @over
1880
- def atomic_min(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1881
- """
1882
- Compute the minimum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1883
-
1884
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1885
- """
1886
- ...
1887
-
1888
-
1889
- @over
1890
- def atomic_min(a: IndexedFabricArray[Any], i: int32, value: Any):
1891
- """
1892
- Compute the minimum of ``value`` and ``a[i]`` and atomically update the array.
1893
-
1894
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1895
- """
1896
- ...
1897
-
1898
-
1899
- @over
1900
- def atomic_min(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
1901
- """
1902
- Compute the minimum of ``value`` and ``a[i,j]`` and atomically update the array.
1903
-
1904
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1905
- """
1906
- ...
1907
-
1908
-
1909
- @over
1910
- def atomic_min(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1911
- """
1912
- Compute the minimum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1913
-
1914
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1915
- """
1916
- ...
1917
-
1918
-
1919
- @over
1920
- def atomic_min(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1921
- """
1922
- Compute the minimum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1923
-
1924
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1925
- """
1926
- ...
1927
-
1928
-
1929
- @over
1930
- def atomic_max(a: Array[Any], i: int32, value: Any):
1931
- """
1932
- Compute the maximum of ``value`` and ``a[i]`` and atomically update the array.
1933
-
1934
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1935
- """
1936
- ...
1937
-
1938
-
1939
- @over
1940
- def atomic_max(a: Array[Any], i: int32, j: int32, value: Any):
1941
- """
1942
- Compute the maximum of ``value`` and ``a[i,j]`` and atomically update the array.
1943
-
1944
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1945
- """
1946
- ...
1947
-
1948
-
1949
- @over
1950
- def atomic_max(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
1951
- """
1952
- Compute the maximum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1953
-
1954
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1955
- """
1956
- ...
1957
-
1958
-
1959
- @over
1960
- def atomic_max(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1961
- """
1962
- Compute the maximum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1963
-
1964
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1965
- """
1966
- ...
1967
-
1968
-
1969
- @over
1970
- def atomic_max(a: FabricArray[Any], i: int32, value: Any):
1971
- """
1972
- Compute the maximum of ``value`` and ``a[i]`` and atomically update the array.
1973
-
1974
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1975
- """
1976
- ...
1977
-
1978
-
1979
- @over
1980
- def atomic_max(a: FabricArray[Any], i: int32, j: int32, value: Any):
1981
- """
1982
- Compute the maximum of ``value`` and ``a[i,j]`` and atomically update the array.
1983
-
1984
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1985
- """
1986
- ...
1987
-
1988
-
1989
- @over
1990
- def atomic_max(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1991
- """
1992
- Compute the maximum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1993
-
1994
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
1995
- """
1996
- ...
1997
-
1998
-
1999
- @over
2000
- def atomic_max(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
2001
- """
2002
- Compute the maximum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
2003
-
2004
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
2005
- """
2006
- ...
2007
-
2008
-
2009
- @over
2010
- def atomic_max(a: IndexedFabricArray[Any], i: int32, value: Any):
2011
- """
2012
- Compute the maximum of ``value`` and ``a[i]`` and atomically update the array.
2013
-
2014
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
2015
- """
2016
- ...
2017
-
2018
-
2019
- @over
2020
- def atomic_max(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
2021
- """
2022
- Compute the maximum of ``value`` and ``a[i,j]`` and atomically update the array.
2023
-
2024
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
2025
- """
2026
- ...
2027
-
2028
-
2029
- @over
2030
- def atomic_max(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
2031
- """
2032
- Compute the maximum of ``value`` and ``a[i,j,k]`` and atomically update the array.
2033
-
2034
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
2035
- """
2036
- ...
2037
-
2038
-
2039
- @over
2040
- def atomic_max(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
2041
- """
2042
- Compute the maximum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
2043
-
2044
- Note that for vectors and matrices the operation is only atomic on a per-component basis.
2045
- """
2046
- ...
2047
-
2048
-
2049
- @over
2050
- def lerp(a: Float, b: Float, t: Float) -> Float:
2051
- """
2052
- Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``
2053
- """
2054
- ...
2055
-
2056
-
2057
- @over
2058
- def lerp(a: Vector[Any, Float], b: Vector[Any, Float], t: Float) -> Vector[Any, Float]:
2059
- """
2060
- Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``
2061
- """
2062
- ...
2063
-
2064
-
2065
- @over
2066
- def lerp(a: Matrix[Any, Any, Float], b: Matrix[Any, Any, Float], t: Float) -> Matrix[Any, Any, Float]:
2067
- """
2068
- Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``
2069
- """
2070
- ...
2071
-
2072
-
2073
- @over
2074
- def lerp(a: Quaternion[Float], b: Quaternion[Float], t: Float) -> Quaternion[Float]:
2075
- """
2076
- Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``
2077
- """
2078
- ...
2079
-
2080
-
2081
- @over
2082
- def lerp(a: Transformation[Float], b: Transformation[Float], t: Float) -> Transformation[Float]:
2083
- """
2084
- Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``
2085
- """
2086
- ...
2087
-
2088
-
2089
- @over
2090
- def smoothstep(edge0: Float, edge1: Float, x: Float) -> Float:
2091
- """
2092
- Smoothly interpolate between two values ``edge0`` and ``edge1`` using a factor ``x``,
2093
- and return a result between 0 and 1 using a cubic Hermite interpolation after clamping.
2094
- """
2095
- ...
2096
-
2097
-
2098
- @over
2099
- def expect_near(arg1: Float, arg2: Float, tolerance: Float):
2100
- """
2101
- Prints an error to stdout if ``arg1`` and ``arg2`` are not closer than tolerance in magnitude
2102
- """
2103
- ...
2104
-
2105
-
2106
- @over
2107
- def expect_near(arg1: vec3f, arg2: vec3f, tolerance: float32):
2108
- """
2109
- Prints an error to stdout if any element of ``arg1`` and ``arg2`` are not closer than tolerance in magnitude
2110
- """
2111
- ...
2112
-
2113
-
2114
- @over
2115
- def lower_bound(arr: Array[Scalar], value: Scalar) -> int:
2116
- """
2117
- Search a sorted array ``arr`` for the closest element greater than or equal to ``value``.
2118
- """
2119
- ...
2120
-
2121
-
2122
- @over
2123
- def lower_bound(arr: Array[Scalar], arr_begin: int32, arr_end: int32, value: Scalar) -> int:
2124
- """
2125
- Search a sorted array ``arr`` in the range [arr_begin, arr_end) for the closest element greater than or equal to ``value``.
2126
- """
2127
- ...
2128
-
2129
-
2130
- @over
2131
- def add(x: Scalar, y: Scalar) -> Scalar:
2132
- """ """
2133
- ...
2134
-
2135
-
2136
- @over
2137
- def add(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2138
- """ """
2139
- ...
2140
-
2141
-
2142
- @over
2143
- def add(x: Quaternion[Scalar], y: Quaternion[Scalar]) -> Quaternion[Scalar]:
2144
- """ """
2145
- ...
2146
-
2147
-
2148
- @over
2149
- def add(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2150
- """ """
2151
- ...
2152
-
2153
-
2154
- @over
2155
- def add(x: Transformation[Scalar], y: Transformation[Scalar]) -> Transformation[Scalar]:
2156
- """ """
2157
- ...
2158
-
2159
-
2160
- @over
2161
- def sub(x: Scalar, y: Scalar) -> Scalar:
2162
- """ """
2163
- ...
2164
-
2165
-
2166
- @over
2167
- def sub(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2168
- """ """
2169
- ...
2170
-
2171
-
2172
- @over
2173
- def sub(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2174
- """ """
2175
- ...
2176
-
2177
-
2178
- @over
2179
- def sub(x: Quaternion[Scalar], y: Quaternion[Scalar]) -> Quaternion[Scalar]:
2180
- """ """
2181
- ...
2182
-
2183
-
2184
- @over
2185
- def sub(x: Transformation[Scalar], y: Transformation[Scalar]) -> Transformation[Scalar]:
2186
- """ """
2187
- ...
2188
-
2189
-
2190
- @over
2191
- def bit_and(x: Int, y: Int) -> Int:
2192
- """ """
2193
- ...
2194
-
2195
-
2196
- @over
2197
- def bit_or(x: Int, y: Int) -> Int:
2198
- """ """
2199
- ...
2200
-
2201
-
2202
- @over
2203
- def bit_xor(x: Int, y: Int) -> Int:
2204
- """ """
2205
- ...
2206
-
2207
-
2208
- @over
2209
- def lshift(x: Int, y: Int) -> Int:
2210
- """ """
2211
- ...
2212
-
2213
-
2214
- @over
2215
- def rshift(x: Int, y: Int) -> Int:
2216
- """ """
2217
- ...
2218
-
2219
-
2220
- @over
2221
- def invert(x: Int) -> Int:
2222
- """ """
2223
- ...
2224
-
2225
-
2226
- @over
2227
- def mul(x: Scalar, y: Scalar) -> Scalar:
2228
- """ """
2229
- ...
2230
-
2231
-
2232
- @over
2233
- def mul(x: Vector[Any, Scalar], y: Scalar) -> Vector[Any, Scalar]:
2234
- """ """
2235
- ...
2236
-
2237
-
2238
- @over
2239
- def mul(x: Scalar, y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2240
- """ """
2241
- ...
2242
-
2243
-
2244
- @over
2245
- def mul(x: Quaternion[Scalar], y: Scalar) -> Quaternion[Scalar]:
2246
- """ """
2247
- ...
2248
-
2249
-
2250
- @over
2251
- def mul(x: Scalar, y: Quaternion[Scalar]) -> Quaternion[Scalar]:
2252
- """ """
2253
- ...
2254
-
2255
-
2256
- @over
2257
- def mul(x: Quaternion[Scalar], y: Quaternion[Scalar]) -> Quaternion[Scalar]:
2258
- """ """
2259
- ...
2260
-
2261
-
2262
- @over
2263
- def mul(x: Scalar, y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2264
- """ """
2265
- ...
2266
-
2267
-
2268
- @over
2269
- def mul(x: Matrix[Any, Any, Scalar], y: Scalar) -> Matrix[Any, Any, Scalar]:
2270
- """ """
2271
- ...
2272
-
2273
-
2274
- @over
2275
- def mul(x: Matrix[Any, Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2276
- """ """
2277
- ...
2278
-
2279
-
2280
- @over
2281
- def mul(x: Vector[Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Vector[Any, Scalar]:
2282
- """ """
2283
- ...
2284
-
2285
-
2286
- @over
2287
- def mul(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]):
2288
- """ """
2289
- ...
2290
-
2291
-
2292
- @over
2293
- def mul(x: Transformation[Scalar], y: Transformation[Scalar]) -> Transformation[Scalar]:
2294
- """ """
2295
- ...
2296
-
2297
-
2298
- @over
2299
- def mul(x: Scalar, y: Transformation[Scalar]) -> Transformation[Scalar]:
2300
- """ """
2301
- ...
2302
-
2303
-
2304
- @over
2305
- def mul(x: Transformation[Scalar], y: Scalar) -> Transformation[Scalar]:
2306
- """ """
2307
- ...
2308
-
2309
-
2310
- @over
2311
- def mod(x: Scalar, y: Scalar) -> Scalar:
2312
- """ """
2313
- ...
2314
-
2315
-
2316
- @over
2317
- def div(x: Scalar, y: Scalar) -> Scalar:
2318
- """ """
2319
- ...
2320
-
2321
-
2322
- @over
2323
- def div(x: Vector[Any, Scalar], y: Scalar) -> Vector[Any, Scalar]:
2324
- """ """
2325
- ...
2326
-
2327
-
2328
- @over
2329
- def div(x: Scalar, y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2330
- """ """
2331
- ...
2332
-
2333
-
2334
- @over
2335
- def div(x: Matrix[Any, Any, Scalar], y: Scalar) -> Matrix[Any, Any, Scalar]:
2336
- """ """
2337
- ...
2338
-
2339
-
2340
- @over
2341
- def div(x: Scalar, y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2342
- """ """
2343
- ...
2344
-
2345
-
2346
- @over
2347
- def div(x: Quaternion[Scalar], y: Scalar) -> Quaternion[Scalar]:
2348
- """ """
2349
- ...
2350
-
2351
-
2352
- @over
2353
- def div(x: Scalar, y: Quaternion[Scalar]) -> Quaternion[Scalar]:
2354
- """ """
2355
- ...
2356
-
2357
-
2358
- @over
2359
- def floordiv(x: Scalar, y: Scalar) -> Scalar:
2360
- """ """
2361
- ...
2362
-
2363
-
2364
- @over
2365
- def pos(x: Scalar) -> Scalar:
2366
- """ """
2367
- ...
2368
-
2369
-
2370
- @over
2371
- def pos(x: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2372
- """ """
2373
- ...
2374
-
2375
-
2376
- @over
2377
- def pos(x: Quaternion[Scalar]) -> Quaternion[Scalar]:
2378
- """ """
2379
- ...
2380
-
2381
-
2382
- @over
2383
- def pos(x: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2384
- """ """
2385
- ...
2386
-
2387
-
2388
- @over
2389
- def neg(x: Scalar) -> Scalar:
2390
- """ """
2391
- ...
2392
-
2393
-
2394
- @over
2395
- def neg(x: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2396
- """ """
2397
- ...
2398
-
2399
-
2400
- @over
2401
- def neg(x: Quaternion[Scalar]) -> Quaternion[Scalar]:
2402
- """ """
2403
- ...
2404
-
2405
-
2406
- @over
2407
- def neg(x: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2408
- """ """
2409
- ...
2410
-
2411
-
2412
- @over
2413
- def unot(b: bool) -> bool:
2414
- """ """
2415
- ...
2416
-
2417
-
2418
- @over
2419
- def unot(b: int8) -> bool:
2420
- """ """
2421
- ...
2422
-
2423
-
2424
- @over
2425
- def unot(b: uint8) -> bool:
2426
- """ """
2427
- ...
2428
-
2429
-
2430
- @over
2431
- def unot(b: int16) -> bool:
2432
- """ """
2433
- ...
2434
-
2435
-
2436
- @over
2437
- def unot(b: uint16) -> bool:
2438
- """ """
2439
- ...
2440
-
2441
-
2442
- @over
2443
- def unot(b: int32) -> bool:
2444
- """ """
2445
- ...
2446
-
2447
-
2448
- @over
2449
- def unot(b: uint32) -> bool:
2450
- """ """
2451
- ...
2452
-
2453
-
2454
- @over
2455
- def unot(b: int64) -> bool:
2456
- """ """
2457
- ...
2458
-
2459
-
2460
- @over
2461
- def unot(b: uint64) -> bool:
2462
- """ """
2463
- ...
2464
-
2465
-
2466
- @over
2467
- def unot(a: Array[Any]) -> bool:
2468
- """ """
2469
- ...
1
+ # Autogenerated file, do not edit, this file provides stubs for builtins autocomplete in VSCode, PyCharm, etc
2
+
3
+ from typing import Any
4
+ from typing import Tuple
5
+ from typing import Callable
6
+ from typing import TypeVar
7
+ from typing import Generic
8
+ from typing import overload as over
9
+
10
+ Length = TypeVar("Length", bound=int)
11
+ Rows = TypeVar("Rows", bound=int)
12
+ Cols = TypeVar("Cols", bound=int)
13
+ DType = TypeVar("DType")
14
+ Int = TypeVar("Int")
15
+ Float = TypeVar("Float")
16
+ Scalar = TypeVar("Scalar")
17
+ Vector = Generic[Length, Scalar]
18
+ Matrix = Generic[Rows, Cols, Scalar]
19
+ Quaternion = Generic[Float]
20
+ Transformation = Generic[Float]
21
+ Array = Generic[DType]
22
+ FabricArray = Generic[DType]
23
+ IndexedFabricArray = Generic[DType]
24
+
25
+
26
+ from warp.types import array, array1d, array2d, array3d, array4d, constant
27
+ from warp.types import indexedarray, indexedarray1d, indexedarray2d, indexedarray3d, indexedarray4d
28
+ from warp.fabric import fabricarray, fabricarrayarray, indexedfabricarray, indexedfabricarrayarray
29
+
30
+ from warp.types import bool, int8, uint8, int16, uint16, int32, uint32, int64, uint64, float16, float32, float64
31
+ from warp.types import vec2, vec2b, vec2ub, vec2s, vec2us, vec2i, vec2ui, vec2l, vec2ul, vec2h, vec2f, vec2d
32
+ from warp.types import vec3, vec3b, vec3ub, vec3s, vec3us, vec3i, vec3ui, vec3l, vec3ul, vec3h, vec3f, vec3d
33
+ from warp.types import vec4, vec4b, vec4ub, vec4s, vec4us, vec4i, vec4ui, vec4l, vec4ul, vec4h, vec4f, vec4d
34
+ from warp.types import mat22, mat22h, mat22f, mat22d
35
+ from warp.types import mat33, mat33h, mat33f, mat33d
36
+ from warp.types import mat44, mat44h, mat44f, mat44d
37
+ from warp.types import quat, quath, quatf, quatd
38
+ from warp.types import transform, transformh, transformf, transformd
39
+ from warp.types import spatial_vector, spatial_vectorh, spatial_vectorf, spatial_vectord
40
+ from warp.types import spatial_matrix, spatial_matrixh, spatial_matrixf, spatial_matrixd
41
+
42
+ from warp.types import Bvh, Mesh, HashGrid, Volume, MarchingCubes
43
+ from warp.types import bvh_query_t, hash_grid_query_t, mesh_query_aabb_t, mesh_query_point_t, mesh_query_ray_t
44
+
45
+ from warp.types import matmul, adj_matmul, batched_matmul, adj_batched_matmul, from_ptr
46
+
47
+ from warp.types import vector as vec
48
+ from warp.types import matrix as mat
49
+
50
+ from warp.types import dtype_from_numpy, dtype_to_numpy
51
+
52
+ from warp.context import init, func, func_grad, func_replay, func_native, kernel, struct, overload
53
+ from warp.context import is_cpu_available, is_cuda_available, is_device_available
54
+ from warp.context import get_devices, get_preferred_device
55
+ from warp.context import get_cuda_devices, get_cuda_device_count, get_cuda_device, map_cuda_device, unmap_cuda_device
56
+ from warp.context import get_device, set_device, synchronize_device
57
+ from warp.context import (
58
+ zeros,
59
+ zeros_like,
60
+ ones,
61
+ ones_like,
62
+ full,
63
+ full_like,
64
+ clone,
65
+ empty,
66
+ empty_like,
67
+ copy,
68
+ from_numpy,
69
+ launch,
70
+ synchronize,
71
+ force_load,
72
+ load_module,
73
+ )
74
+ from warp.context import set_module_options, get_module_options, get_module
75
+ from warp.context import capture_begin, capture_end, capture_launch
76
+ from warp.context import Kernel, Function, Launch
77
+ from warp.context import Stream, get_stream, set_stream, wait_stream, synchronize_stream
78
+ from warp.context import Event, record_event, wait_event, synchronize_event, get_event_elapsed_time
79
+ from warp.context import RegisteredGLBuffer
80
+ from warp.context import is_mempool_supported, is_mempool_enabled, set_mempool_enabled
81
+ from warp.context import set_mempool_release_threshold, get_mempool_release_threshold
82
+ from warp.context import is_mempool_access_supported, is_mempool_access_enabled, set_mempool_access_enabled
83
+ from warp.context import is_peer_access_supported, is_peer_access_enabled, set_peer_access_enabled
84
+
85
+ from warp.tape import Tape
86
+ from warp.utils import ScopedTimer, ScopedDevice, ScopedStream
87
+ from warp.utils import ScopedMempool, ScopedMempoolAccess, ScopedPeerAccess
88
+ from warp.utils import ScopedCapture
89
+ from warp.utils import transform_expand, quat_between_vectors
90
+ from warp.utils import TimingResult, timing_begin, timing_end, timing_print
91
+ from warp.utils import (
92
+ TIMING_KERNEL,
93
+ TIMING_KERNEL_BUILTIN,
94
+ TIMING_MEMCPY,
95
+ TIMING_MEMSET,
96
+ TIMING_GRAPH,
97
+ TIMING_ALL,
98
+ )
99
+
100
+ from warp.torch import from_torch, to_torch
101
+ from warp.torch import dtype_from_torch, dtype_to_torch
102
+ from warp.torch import device_from_torch, device_to_torch
103
+ from warp.torch import stream_from_torch, stream_to_torch
104
+
105
+ from warp.jax import from_jax, to_jax
106
+ from warp.jax import dtype_from_jax, dtype_to_jax
107
+ from warp.jax import device_from_jax, device_to_jax
108
+
109
+ from warp.dlpack import from_dlpack, to_dlpack
110
+
111
+ from warp.constants import *
112
+
113
+ from . import builtins
114
+
115
+ import warp.config
116
+
117
+ __version__ = warp.config.version
118
+
119
+
120
+ @over
121
+ def min(x: Scalar, y: Scalar) -> Scalar:
122
+ """Return the minimum of two scalars."""
123
+ ...
124
+
125
+
126
+ @over
127
+ def min(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
128
+ """Return the element-wise minimum of two vectors."""
129
+ ...
130
+
131
+
132
+ @over
133
+ def min(v: Vector[Any, Scalar]) -> Scalar:
134
+ """Return the minimum element of a vector ``v``."""
135
+ ...
136
+
137
+
138
+ @over
139
+ def max(x: Scalar, y: Scalar) -> Scalar:
140
+ """Return the maximum of two scalars."""
141
+ ...
142
+
143
+
144
+ @over
145
+ def max(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
146
+ """Return the element-wise maximum of two vectors."""
147
+ ...
148
+
149
+
150
+ @over
151
+ def max(v: Vector[Any, Scalar]) -> Scalar:
152
+ """Return the maximum element of a vector ``v``."""
153
+ ...
154
+
155
+
156
+ @over
157
+ def clamp(x: Scalar, a: Scalar, b: Scalar) -> Scalar:
158
+ """Clamp the value of ``x`` to the range [a, b]."""
159
+ ...
160
+
161
+
162
+ @over
163
+ def abs(x: Scalar) -> Scalar:
164
+ """Return the absolute value of ``x``."""
165
+ ...
166
+
167
+
168
+ @over
169
+ def sign(x: Scalar) -> Scalar:
170
+ """Return -1 if ``x`` < 0, return 1 otherwise."""
171
+ ...
172
+
173
+
174
+ @over
175
+ def step(x: Scalar) -> Scalar:
176
+ """Return 1.0 if ``x`` < 0.0, return 0.0 otherwise."""
177
+ ...
178
+
179
+
180
+ @over
181
+ def nonzero(x: Scalar) -> Scalar:
182
+ """Return 1.0 if ``x`` is not equal to zero, return 0.0 otherwise."""
183
+ ...
184
+
185
+
186
+ @over
187
+ def sin(x: Float) -> Float:
188
+ """Return the sine of ``x`` in radians."""
189
+ ...
190
+
191
+
192
+ @over
193
+ def cos(x: Float) -> Float:
194
+ """Return the cosine of ``x`` in radians."""
195
+ ...
196
+
197
+
198
+ @over
199
+ def acos(x: Float) -> Float:
200
+ """Return arccos of ``x`` in radians. Inputs are automatically clamped to [-1.0, 1.0]."""
201
+ ...
202
+
203
+
204
+ @over
205
+ def asin(x: Float) -> Float:
206
+ """Return arcsin of ``x`` in radians. Inputs are automatically clamped to [-1.0, 1.0]."""
207
+ ...
208
+
209
+
210
+ @over
211
+ def sqrt(x: Float) -> Float:
212
+ """Return the square root of ``x``, where ``x`` is positive."""
213
+ ...
214
+
215
+
216
+ @over
217
+ def cbrt(x: Float) -> Float:
218
+ """Return the cube root of ``x``."""
219
+ ...
220
+
221
+
222
+ @over
223
+ def tan(x: Float) -> Float:
224
+ """Return the tangent of ``x`` in radians."""
225
+ ...
226
+
227
+
228
+ @over
229
+ def atan(x: Float) -> Float:
230
+ """Return the arctangent of ``x`` in radians."""
231
+ ...
232
+
233
+
234
+ @over
235
+ def atan2(y: Float, x: Float) -> Float:
236
+ """Return the 2-argument arctangent, atan2, of the point ``(x, y)`` in radians."""
237
+ ...
238
+
239
+
240
+ @over
241
+ def sinh(x: Float) -> Float:
242
+ """Return the sinh of ``x``."""
243
+ ...
244
+
245
+
246
+ @over
247
+ def cosh(x: Float) -> Float:
248
+ """Return the cosh of ``x``."""
249
+ ...
250
+
251
+
252
+ @over
253
+ def tanh(x: Float) -> Float:
254
+ """Return the tanh of ``x``."""
255
+ ...
256
+
257
+
258
+ @over
259
+ def degrees(x: Float) -> Float:
260
+ """Convert ``x`` from radians into degrees."""
261
+ ...
262
+
263
+
264
+ @over
265
+ def radians(x: Float) -> Float:
266
+ """Convert ``x`` from degrees into radians."""
267
+ ...
268
+
269
+
270
+ @over
271
+ def log(x: Float) -> Float:
272
+ """Return the natural logarithm (base-e) of ``x``, where ``x`` is positive."""
273
+ ...
274
+
275
+
276
+ @over
277
+ def log2(x: Float) -> Float:
278
+ """Return the binary logarithm (base-2) of ``x``, where ``x`` is positive."""
279
+ ...
280
+
281
+
282
+ @over
283
+ def log10(x: Float) -> Float:
284
+ """Return the common logarithm (base-10) of ``x``, where ``x`` is positive."""
285
+ ...
286
+
287
+
288
+ @over
289
+ def exp(x: Float) -> Float:
290
+ """Return the value of the exponential function :math:`e^x`."""
291
+ ...
292
+
293
+
294
+ @over
295
+ def pow(x: Float, y: Float) -> Float:
296
+ """Return the result of ``x`` raised to power of ``y``."""
297
+ ...
298
+
299
+
300
+ @over
301
+ def round(x: Float) -> Float:
302
+ """Return the nearest integer value to ``x``, rounding halfway cases away from zero.
303
+
304
+ This is the most intuitive form of rounding in the colloquial sense, but can be slower than other options like :func:`warp.rint()`.
305
+ Differs from :func:`numpy.round()`, which behaves the same way as :func:`numpy.rint()`.
306
+ """
307
+ ...
308
+
309
+
310
+ @over
311
+ def rint(x: Float) -> Float:
312
+ """Return the nearest integer value to ``x``, rounding halfway cases to nearest even integer.
313
+
314
+ It is generally faster than :func:`warp.round()`. Equivalent to :func:`numpy.rint()`.
315
+ """
316
+ ...
317
+
318
+
319
+ @over
320
+ def trunc(x: Float) -> Float:
321
+ """Return the nearest integer that is closer to zero than ``x``.
322
+
323
+ In other words, it discards the fractional part of ``x``.
324
+ It is similar to casting ``float(int(x))``, but preserves the negative sign when x is in the range [-0.0, -1.0).
325
+ Equivalent to :func:`numpy.trunc()` and :func:`numpy.fix()`.
326
+ """
327
+ ...
328
+
329
+
330
+ @over
331
+ def floor(x: Float) -> Float:
332
+ """Return the largest integer that is less than or equal to ``x``."""
333
+ ...
334
+
335
+
336
+ @over
337
+ def ceil(x: Float) -> Float:
338
+ """Return the smallest integer that is greater than or equal to ``x``."""
339
+ ...
340
+
341
+
342
+ @over
343
+ def frac(x: Float) -> Float:
344
+ """Retrieve the fractional part of x.
345
+
346
+ In other words, it discards the integer part of x and is equivalent to ``x - trunc(x)``.
347
+ """
348
+ ...
349
+
350
+
351
+ @over
352
+ def dot(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Scalar:
353
+ """Compute the dot product between two vectors."""
354
+ ...
355
+
356
+
357
+ @over
358
+ def dot(x: Quaternion[Float], y: Quaternion[Float]) -> Scalar:
359
+ """Compute the dot product between two quaternions."""
360
+ ...
361
+
362
+
363
+ @over
364
+ def ddot(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Scalar:
365
+ """Compute the double dot product between two matrices."""
366
+ ...
367
+
368
+
369
+ @over
370
+ def argmin(v: Vector[Any, Scalar]) -> uint32:
371
+ """Return the index of the minimum element of a vector ``v``."""
372
+ ...
373
+
374
+
375
+ @over
376
+ def argmax(v: Vector[Any, Scalar]) -> uint32:
377
+ """Return the index of the maximum element of a vector ``v``."""
378
+ ...
379
+
380
+
381
+ @over
382
+ def outer(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Matrix[Any, Any, Scalar]:
383
+ """Compute the outer product ``x*y^T`` for two vectors."""
384
+ ...
385
+
386
+
387
+ @over
388
+ def cross(x: Vector[3, Scalar], y: Vector[3, Scalar]) -> Vector[3, Scalar]:
389
+ """Compute the cross product of two 3D vectors."""
390
+ ...
391
+
392
+
393
+ @over
394
+ def skew(x: Vector[3, Scalar]):
395
+ """Compute the skew-symmetric 3x3 matrix for a 3D vector ``x``."""
396
+ ...
397
+
398
+
399
+ @over
400
+ def length(x: Vector[Any, Float]) -> Scalar:
401
+ """Compute the length of a floating-point vector ``x``."""
402
+ ...
403
+
404
+
405
+ @over
406
+ def length(x: Quaternion[Float]) -> Scalar:
407
+ """Compute the length of a quaternion ``x``."""
408
+ ...
409
+
410
+
411
+ @over
412
+ def length_sq(x: Vector[Any, Scalar]) -> Scalar:
413
+ """Compute the squared length of a vector ``x``."""
414
+ ...
415
+
416
+
417
+ @over
418
+ def length_sq(x: Quaternion[Scalar]) -> Scalar:
419
+ """Compute the squared length of a quaternion ``x``."""
420
+ ...
421
+
422
+
423
+ @over
424
+ def normalize(x: Vector[Any, Float]) -> Vector[Any, Scalar]:
425
+ """Compute the normalized value of ``x``. If ``length(x)`` is 0 then the zero vector is returned."""
426
+ ...
427
+
428
+
429
+ @over
430
+ def normalize(x: Quaternion[Float]) -> Quaternion[Scalar]:
431
+ """Compute the normalized value of ``x``. If ``length(x)`` is 0, then the zero quaternion is returned."""
432
+ ...
433
+
434
+
435
+ @over
436
+ def transpose(m: Matrix[Any, Any, Scalar]):
437
+ """Return the transpose of the matrix ``m``."""
438
+ ...
439
+
440
+
441
+ @over
442
+ def inverse(m: Matrix[2, 2, Float]) -> Matrix[Any, Any, Float]:
443
+ """Return the inverse of a 2x2 matrix ``m``."""
444
+ ...
445
+
446
+
447
+ @over
448
+ def inverse(m: Matrix[3, 3, Float]) -> Matrix[Any, Any, Float]:
449
+ """Return the inverse of a 3x3 matrix ``m``."""
450
+ ...
451
+
452
+
453
+ @over
454
+ def inverse(m: Matrix[4, 4, Float]) -> Matrix[Any, Any, Float]:
455
+ """Return the inverse of a 4x4 matrix ``m``."""
456
+ ...
457
+
458
+
459
+ @over
460
+ def determinant(m: Matrix[2, 2, Float]) -> Scalar:
461
+ """Return the determinant of a 2x2 matrix ``m``."""
462
+ ...
463
+
464
+
465
+ @over
466
+ def determinant(m: Matrix[3, 3, Float]) -> Scalar:
467
+ """Return the determinant of a 3x3 matrix ``m``."""
468
+ ...
469
+
470
+
471
+ @over
472
+ def determinant(m: Matrix[4, 4, Float]) -> Scalar:
473
+ """Return the determinant of a 4x4 matrix ``m``."""
474
+ ...
475
+
476
+
477
+ @over
478
+ def trace(m: Matrix[Any, Any, Scalar]) -> Scalar:
479
+ """Return the trace of the matrix ``m``."""
480
+ ...
481
+
482
+
483
+ @over
484
+ def diag(d: Vector[Any, Scalar]) -> Matrix[Any, Any, Scalar]:
485
+ """Returns a matrix with the components of the vector ``d`` on the diagonal."""
486
+ ...
487
+
488
+
489
+ @over
490
+ def get_diag(m: Matrix[Any, Any, Scalar]) -> Vector[Any, Scalar]:
491
+ """Returns a vector containing the diagonal elements of the square matrix ``m``."""
492
+ ...
493
+
494
+
495
+ @over
496
+ def cw_mul(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
497
+ """Component-wise multiplication of two vectors."""
498
+ ...
499
+
500
+
501
+ @over
502
+ def cw_mul(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
503
+ """Component-wise multiplication of two matrices."""
504
+ ...
505
+
506
+
507
+ @over
508
+ def cw_div(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
509
+ """Component-wise division of two vectors."""
510
+ ...
511
+
512
+
513
+ @over
514
+ def cw_div(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
515
+ """Component-wise division of two matrices."""
516
+ ...
517
+
518
+
519
+ @over
520
+ def quat_identity() -> quatf:
521
+ """Construct an identity quaternion with zero imaginary part and real part of 1.0"""
522
+ ...
523
+
524
+
525
+ @over
526
+ def quat_from_axis_angle(axis: Vector[3, Float], angle: Float) -> Quaternion[Scalar]:
527
+ """Construct a quaternion representing a rotation of angle radians around the given axis."""
528
+ ...
529
+
530
+
531
+ @over
532
+ def quat_to_axis_angle(q: Quaternion[Float], axis: Vector[3, Float], angle: Float):
533
+ """Extract the rotation axis and angle radians a quaternion represents."""
534
+ ...
535
+
536
+
537
+ @over
538
+ def quat_from_matrix(m: Matrix[3, 3, Float]) -> Quaternion[Scalar]:
539
+ """Construct a quaternion from a 3x3 matrix."""
540
+ ...
541
+
542
+
543
+ @over
544
+ def quat_rpy(roll: Float, pitch: Float, yaw: Float) -> Quaternion[Scalar]:
545
+ """Construct a quaternion representing a combined roll (z), pitch (x), yaw rotations (y) in radians."""
546
+ ...
547
+
548
+
549
+ @over
550
+ def quat_inverse(q: Quaternion[Float]) -> Quaternion[Scalar]:
551
+ """Compute quaternion conjugate."""
552
+ ...
553
+
554
+
555
+ @over
556
+ def quat_rotate(q: Quaternion[Float], p: Vector[3, Float]) -> Vector[3, Scalar]:
557
+ """Rotate a vector by a quaternion."""
558
+ ...
559
+
560
+
561
+ @over
562
+ def quat_rotate_inv(q: Quaternion[Float], p: Vector[3, Float]) -> Vector[3, Scalar]:
563
+ """Rotate a vector by the inverse of a quaternion."""
564
+ ...
565
+
566
+
567
+ @over
568
+ def quat_slerp(q0: Quaternion[Float], q1: Quaternion[Float], t: Float) -> Quaternion[Scalar]:
569
+ """Linearly interpolate between two quaternions."""
570
+ ...
571
+
572
+
573
+ @over
574
+ def quat_to_matrix(q: Quaternion[Float]) -> Matrix[3, 3, Scalar]:
575
+ """Convert a quaternion to a 3x3 rotation matrix."""
576
+ ...
577
+
578
+
579
+ @over
580
+ def transform_identity() -> transformf:
581
+ """Construct an identity transform with zero translation and identity rotation."""
582
+ ...
583
+
584
+
585
+ @over
586
+ def transform_get_translation(t: Transformation[Float]) -> Vector[3, Scalar]:
587
+ """Return the translational part of a transform ``t``."""
588
+ ...
589
+
590
+
591
+ @over
592
+ def transform_get_rotation(t: Transformation[Float]) -> Quaternion[Scalar]:
593
+ """Return the rotational part of a transform ``t``."""
594
+ ...
595
+
596
+
597
+ @over
598
+ def transform_multiply(a: Transformation[Float], b: Transformation[Float]) -> Transformation[Scalar]:
599
+ """Multiply two rigid body transformations together."""
600
+ ...
601
+
602
+
603
+ @over
604
+ def transform_point(t: Transformation[Scalar], p: Vector[3, Scalar]) -> Vector[3, Scalar]:
605
+ """Apply the transform to a point ``p`` treating the homogeneous coordinate as w=1 (translation and rotation)."""
606
+ ...
607
+
608
+
609
+ @over
610
+ def transform_point(m: Matrix[4, 4, Scalar], p: Vector[3, Scalar]) -> Vector[3, Scalar]:
611
+ """Apply the transform to a point ``p`` treating the homogeneous coordinate as w=1.
612
+
613
+ The transformation is applied treating ``p`` as a column vector, e.g.: ``y = M*p``.
614
+ Note this is in contrast to some libraries, notably USD, which applies transforms to row vectors, ``y^T = p^T*M^T``.
615
+ If the transform is coming from a library that uses row-vectors, then users should transpose the transformation
616
+ matrix before calling this method.
617
+ """
618
+ ...
619
+
620
+
621
+ @over
622
+ def transform_vector(t: Transformation[Scalar], v: Vector[3, Scalar]) -> Vector[3, Scalar]:
623
+ """Apply the transform to a vector ``v`` treating the homogeneous coordinate as w=0 (rotation only)."""
624
+ ...
625
+
626
+
627
+ @over
628
+ def transform_vector(m: Matrix[4, 4, Scalar], v: Vector[3, Scalar]) -> Vector[3, Scalar]:
629
+ """Apply the transform to a vector ``v`` treating the homogeneous coordinate as w=0.
630
+
631
+ The transformation is applied treating ``v`` as a column vector, e.g.: ``y = M*v``
632
+ note this is in contrast to some libraries, notably USD, which applies transforms to row vectors, ``y^T = v^T*M^T``.
633
+ If the transform is coming from a library that uses row-vectors, then users should transpose the transformation
634
+ matrix before calling this method.
635
+ """
636
+ ...
637
+
638
+
639
+ @over
640
+ def transform_inverse(t: Transformation[Float]) -> Transformation[Float]:
641
+ """Compute the inverse of the transformation ``t``."""
642
+ ...
643
+
644
+
645
+ @over
646
+ def spatial_dot(a: Vector[6, Float], b: Vector[6, Float]) -> Scalar:
647
+ """Compute the dot product of two 6D screw vectors."""
648
+ ...
649
+
650
+
651
+ @over
652
+ def spatial_cross(a: Vector[6, Float], b: Vector[6, Float]) -> Vector[6, Float]:
653
+ """Compute the cross product of two 6D screw vectors."""
654
+ ...
655
+
656
+
657
+ @over
658
+ def spatial_cross_dual(a: Vector[6, Float], b: Vector[6, Float]) -> Vector[6, Float]:
659
+ """Compute the dual cross product of two 6D screw vectors."""
660
+ ...
661
+
662
+
663
+ @over
664
+ def spatial_top(a: Vector[6, Float]):
665
+ """Return the top (first) part of a 6D screw vector."""
666
+ ...
667
+
668
+
669
+ @over
670
+ def spatial_bottom(a: Vector[6, Float]):
671
+ """Return the bottom (second) part of a 6D screw vector."""
672
+ ...
673
+
674
+
675
+ @over
676
+ def spatial_jacobian(
677
+ S: Array[Vector[6, Float]],
678
+ joint_parents: Array[int32],
679
+ joint_qd_start: Array[int32],
680
+ joint_start: int32,
681
+ joint_count: int32,
682
+ J_start: int32,
683
+ J_out: Array[Float],
684
+ ):
685
+ """ """
686
+ ...
687
+
688
+
689
+ @over
690
+ def spatial_mass(
691
+ I_s: Array[Matrix[6, 6, Float]], joint_start: int32, joint_count: int32, M_start: int32, M: Array[Float]
692
+ ):
693
+ """ """
694
+ ...
695
+
696
+
697
+ @over
698
+ def mlp(
699
+ weights: Array[float32],
700
+ bias: Array[float32],
701
+ activation: Callable,
702
+ index: int32,
703
+ x: Array[float32],
704
+ out: Array[float32],
705
+ ):
706
+ """Evaluate a multi-layer perceptron (MLP) layer in the form: ``out = act(weights*x + bias)``.
707
+
708
+ :param weights: A layer's network weights with dimensions ``(m, n)``.
709
+ :param bias: An array with dimensions ``(n)``.
710
+ :param activation: A ``wp.func`` function that takes a single scalar float as input and returns a scalar float as output
711
+ :param index: The batch item to process, typically each thread will process one item in the batch, in which case
712
+ index should be ``wp.tid()``
713
+ :param x: The feature matrix with dimensions ``(n, b)``
714
+ :param out: The network output with dimensions ``(m, b)``
715
+
716
+ :note: Feature and output matrices are transposed compared to some other frameworks such as PyTorch.
717
+ All matrices are assumed to be stored in flattened row-major memory layout (NumPy default).
718
+ """
719
+ ...
720
+
721
+
722
+ @over
723
+ def bvh_query_aabb(id: uint64, lower: vec3f, upper: vec3f) -> bvh_query_t:
724
+ """Construct an axis-aligned bounding box query against a BVH object.
725
+
726
+ This query can be used to iterate over all bounds inside a BVH.
727
+
728
+ :param id: The BVH identifier
729
+ :param lower: The lower bound of the bounding box in BVH space
730
+ :param upper: The upper bound of the bounding box in BVH space
731
+ """
732
+ ...
733
+
734
+
735
+ @over
736
+ def bvh_query_ray(id: uint64, start: vec3f, dir: vec3f) -> bvh_query_t:
737
+ """Construct a ray query against a BVH object.
738
+
739
+ This query can be used to iterate over all bounds that intersect the ray.
740
+
741
+ :param id: The BVH identifier
742
+ :param start: The start of the ray in BVH space
743
+ :param dir: The direction of the ray in BVH space
744
+ """
745
+ ...
746
+
747
+
748
+ @over
749
+ def bvh_query_next(query: bvh_query_t, index: int32) -> bool:
750
+ """Move to the next bound returned by the query.
751
+ The index of the current bound is stored in ``index``, returns ``False`` if there are no more overlapping bound.
752
+ """
753
+ ...
754
+
755
+
756
+ @over
757
+ def mesh_query_point(id: uint64, point: vec3f, max_dist: float32) -> mesh_query_point_t:
758
+ """Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
759
+
760
+ Identifies the sign of the distance using additional ray-casts to determine if the point is inside or outside.
761
+ This method is relatively robust, but does increase computational cost.
762
+ See below for additional sign determination methods.
763
+
764
+ :param id: The mesh identifier
765
+ :param point: The point in space to query
766
+ :param max_dist: Mesh faces above this distance will not be considered by the query
767
+ """
768
+ ...
769
+
770
+
771
+ @over
772
+ def mesh_query_point_no_sign(id: uint64, point: vec3f, max_dist: float32) -> mesh_query_point_t:
773
+ """Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
774
+
775
+ This method does not compute the sign of the point (inside/outside) which makes it faster than other point query methods.
776
+
777
+ :param id: The mesh identifier
778
+ :param point: The point in space to query
779
+ :param max_dist: Mesh faces above this distance will not be considered by the query
780
+ """
781
+ ...
782
+
783
+
784
+ @over
785
+ def mesh_query_furthest_point_no_sign(id: uint64, point: vec3f, min_dist: float32) -> mesh_query_point_t:
786
+ """Computes the furthest point on the mesh with identifier `id` to the given point in space.
787
+
788
+ This method does not compute the sign of the point (inside/outside).
789
+
790
+ :param id: The mesh identifier
791
+ :param point: The point in space to query
792
+ :param min_dist: Mesh faces below this distance will not be considered by the query
793
+ """
794
+ ...
795
+
796
+
797
+ @over
798
+ def mesh_query_point_sign_normal(id: uint64, point: vec3f, max_dist: float32, epsilon: float32) -> mesh_query_point_t:
799
+ """Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given ``point`` in space.
800
+
801
+ Identifies the sign of the distance (inside/outside) using the angle-weighted pseudo normal.
802
+ This approach to sign determination is robust for well conditioned meshes that are watertight and non-self intersecting.
803
+ It is also comparatively fast to compute.
804
+
805
+ :param id: The mesh identifier
806
+ :param point: The point in space to query
807
+ :param max_dist: Mesh faces above this distance will not be considered by the query
808
+ :param epsilon: Epsilon treating distance values as equal, when locating the minimum distance vertex/face/edge, as a
809
+ fraction of the average edge length, also for treating closest point as being on edge/vertex default 1e-3
810
+ """
811
+ ...
812
+
813
+
814
+ @over
815
+ def mesh_query_point_sign_winding_number(
816
+ id: uint64, point: vec3f, max_dist: float32, accuracy: float32, threshold: float32
817
+ ) -> mesh_query_point_t:
818
+ """Computes the closest point on the :class:`Mesh` with identifier ``id`` to the given point in space.
819
+
820
+ Identifies the sign using the winding number of the mesh relative to the query point. This method of sign determination is robust for poorly conditioned meshes
821
+ and provides a smooth approximation to sign even when the mesh is not watertight. This method is the most robust and accurate of the sign determination meshes
822
+ but also the most expensive.
823
+
824
+ .. note:: The :class:`Mesh` object must be constructed with ``support_winding_number=True`` for this method to return correct results.
825
+
826
+ :param id: The mesh identifier
827
+ :param point: The point in space to query
828
+ :param max_dist: Mesh faces above this distance will not be considered by the query
829
+ :param accuracy: Accuracy for computing the winding number with fast winding number method utilizing second-order dipole approximation, default 2.0
830
+ :param threshold: The threshold of the winding number to be considered inside, default 0.5
831
+ """
832
+ ...
833
+
834
+
835
+ @over
836
+ def mesh_query_ray(id: uint64, start: vec3f, dir: vec3f, max_t: float32) -> mesh_query_ray_t:
837
+ """Computes the closest ray hit on the :class:`Mesh` with identifier ``id``.
838
+
839
+ :param id: The mesh identifier
840
+ :param start: The start point of the ray
841
+ :param dir: The ray direction (should be normalized)
842
+ :param max_t: The maximum distance along the ray to check for intersections
843
+ """
844
+ ...
845
+
846
+
847
+ @over
848
+ def mesh_query_aabb(id: uint64, lower: vec3f, upper: vec3f) -> mesh_query_aabb_t:
849
+ """Construct an axis-aligned bounding box query against a :class:`Mesh`.
850
+
851
+ This query can be used to iterate over all triangles inside a volume.
852
+
853
+ :param id: The mesh identifier
854
+ :param lower: The lower bound of the bounding box in mesh space
855
+ :param upper: The upper bound of the bounding box in mesh space
856
+ """
857
+ ...
858
+
859
+
860
+ @over
861
+ def mesh_query_aabb_next(query: mesh_query_aabb_t, index: int32) -> bool:
862
+ """Move to the next triangle overlapping the query bounding box.
863
+
864
+ The index of the current face is stored in ``index``, returns ``False`` if there are no more overlapping triangles.
865
+ """
866
+ ...
867
+
868
+
869
+ @over
870
+ def mesh_eval_position(id: uint64, face: int32, bary_u: float32, bary_v: float32) -> vec3f:
871
+ """Evaluates the position on the :class:`Mesh` given a face index and barycentric coordinates."""
872
+ ...
873
+
874
+
875
+ @over
876
+ def mesh_eval_velocity(id: uint64, face: int32, bary_u: float32, bary_v: float32) -> vec3f:
877
+ """Evaluates the velocity on the :class:`Mesh` given a face index and barycentric coordinates."""
878
+ ...
879
+
880
+
881
+ @over
882
+ def hash_grid_query(id: uint64, point: vec3f, max_dist: float32) -> hash_grid_query_t:
883
+ """Construct a point query against a :class:`HashGrid`.
884
+
885
+ This query can be used to iterate over all neighboring point within a fixed radius from the query point.
886
+ """
887
+ ...
888
+
889
+
890
+ @over
891
+ def hash_grid_query_next(query: hash_grid_query_t, index: int32) -> bool:
892
+ """Move to the next point in the hash grid query.
893
+
894
+ The index of the current neighbor is stored in ``index``, returns ``False`` if there are no more neighbors.
895
+ """
896
+ ...
897
+
898
+
899
+ @over
900
+ def hash_grid_point_id(id: uint64, index: int32) -> int:
901
+ """Return the index of a point in the :class:`HashGrid`.
902
+
903
+ This can be used to reorder threads such that grid traversal occurs in a spatially coherent order.
904
+
905
+ Returns -1 if the :class:`HashGrid` has not been reserved.
906
+ """
907
+ ...
908
+
909
+
910
+ @over
911
+ def intersect_tri_tri(v0: vec3f, v1: vec3f, v2: vec3f, u0: vec3f, u1: vec3f, u2: vec3f) -> int:
912
+ """Tests for intersection between two triangles (v0, v1, v2) and (u0, u1, u2) using Moller's method.
913
+
914
+ Returns > 0 if triangles intersect.
915
+ """
916
+ ...
917
+
918
+
919
+ @over
920
+ def mesh_get(id: uint64) -> Mesh:
921
+ """Retrieves the mesh given its index."""
922
+ ...
923
+
924
+
925
+ @over
926
+ def mesh_eval_face_normal(id: uint64, face: int32) -> vec3f:
927
+ """Evaluates the face normal the mesh given a face index."""
928
+ ...
929
+
930
+
931
+ @over
932
+ def mesh_get_point(id: uint64, index: int32) -> vec3f:
933
+ """Returns the point of the mesh given a index."""
934
+ ...
935
+
936
+
937
+ @over
938
+ def mesh_get_velocity(id: uint64, index: int32) -> vec3f:
939
+ """Returns the velocity of the mesh given a index."""
940
+ ...
941
+
942
+
943
+ @over
944
+ def mesh_get_index(id: uint64, index: int32) -> int:
945
+ """Returns the point-index of the mesh given a face-vertex index."""
946
+ ...
947
+
948
+
949
+ @over
950
+ def closest_point_edge_edge(p1: vec3f, q1: vec3f, p2: vec3f, q2: vec3f, epsilon: float32) -> vec3f:
951
+ """Finds the closest points between two edges.
952
+
953
+ Returns barycentric weights to the points on each edge, as well as the closest distance between the edges.
954
+
955
+ :param p1: First point of first edge
956
+ :param q1: Second point of first edge
957
+ :param p2: First point of second edge
958
+ :param q2: Second point of second edge
959
+ :param epsilon: Zero tolerance for determining if points in an edge are degenerate.
960
+ :param out: vec3 output containing (s,t,d), where `s` in [0,1] is the barycentric weight for the first edge, `t` is the barycentric weight for the second edge, and `d` is the distance between the two edges at these two closest points.
961
+ """
962
+ ...
963
+
964
+
965
+ @over
966
+ def volume_sample_f(id: uint64, uvw: vec3f, sampling_mode: int32) -> float:
967
+ """Sample the volume given by ``id`` at the volume local-space point ``uvw``.
968
+
969
+ Interpolation should be :attr:`warp.Volume.CLOSEST` or :attr:`wp.Volume.LINEAR.`
970
+ """
971
+ ...
972
+
973
+
974
+ @over
975
+ def volume_sample_grad_f(id: uint64, uvw: vec3f, sampling_mode: int32, grad: vec3f) -> float:
976
+ """Sample the volume and its gradient given by ``id`` at the volume local-space point ``uvw``.
977
+
978
+ Interpolation should be :attr:`warp.Volume.CLOSEST` or :attr:`wp.Volume.LINEAR.`
979
+ """
980
+ ...
981
+
982
+
983
+ @over
984
+ def volume_lookup_f(id: uint64, i: int32, j: int32, k: int32) -> float:
985
+ """Returns the value of voxel with coordinates ``i``, ``j``, ``k``.
986
+
987
+ If the voxel at this index does not exist, this function returns the background value
988
+ """
989
+ ...
990
+
991
+
992
+ @over
993
+ def volume_store_f(id: uint64, i: int32, j: int32, k: int32, value: float32):
994
+ """Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``."""
995
+ ...
996
+
997
+
998
+ @over
999
+ def volume_sample_v(id: uint64, uvw: vec3f, sampling_mode: int32) -> vec3f:
1000
+ """Sample the vector volume given by ``id`` at the volume local-space point ``uvw``.
1001
+
1002
+ Interpolation should be :attr:`warp.Volume.CLOSEST` or :attr:`wp.Volume.LINEAR.`
1003
+ """
1004
+ ...
1005
+
1006
+
1007
+ @over
1008
+ def volume_lookup_v(id: uint64, i: int32, j: int32, k: int32) -> vec3f:
1009
+ """Returns the vector value of voxel with coordinates ``i``, ``j``, ``k``.
1010
+
1011
+ If the voxel at this index does not exist, this function returns the background value.
1012
+ """
1013
+ ...
1014
+
1015
+
1016
+ @over
1017
+ def volume_store_v(id: uint64, i: int32, j: int32, k: int32, value: vec3f):
1018
+ """Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``."""
1019
+ ...
1020
+
1021
+
1022
+ @over
1023
+ def volume_sample_i(id: uint64, uvw: vec3f) -> int:
1024
+ """Sample the :class:`int32` volume given by ``id`` at the volume local-space point ``uvw``."""
1025
+ ...
1026
+
1027
+
1028
+ @over
1029
+ def volume_lookup_i(id: uint64, i: int32, j: int32, k: int32) -> int:
1030
+ """Returns the :class:`int32` value of voxel with coordinates ``i``, ``j``, ``k``.
1031
+
1032
+ If the voxel at this index does not exist, this function returns the background value.
1033
+ """
1034
+ ...
1035
+
1036
+
1037
+ @over
1038
+ def volume_store_i(id: uint64, i: int32, j: int32, k: int32, value: int32):
1039
+ """Store ``value`` at the voxel with coordinates ``i``, ``j``, ``k``."""
1040
+ ...
1041
+
1042
+
1043
+ @over
1044
+ def volume_index_to_world(id: uint64, uvw: vec3f) -> vec3f:
1045
+ """Transform a point ``uvw`` defined in volume index space to world space given the volume's intrinsic affine transformation."""
1046
+ ...
1047
+
1048
+
1049
+ @over
1050
+ def volume_world_to_index(id: uint64, xyz: vec3f) -> vec3f:
1051
+ """Transform a point ``xyz`` defined in volume world space to the volume's index space given the volume's intrinsic affine transformation."""
1052
+ ...
1053
+
1054
+
1055
+ @over
1056
+ def volume_index_to_world_dir(id: uint64, uvw: vec3f) -> vec3f:
1057
+ """Transform a direction ``uvw`` defined in volume index space to world space given the volume's intrinsic affine transformation."""
1058
+ ...
1059
+
1060
+
1061
+ @over
1062
+ def volume_world_to_index_dir(id: uint64, xyz: vec3f) -> vec3f:
1063
+ """Transform a direction ``xyz`` defined in volume world space to the volume's index space given the volume's intrinsic affine transformation."""
1064
+ ...
1065
+
1066
+
1067
+ @over
1068
+ def rand_init(seed: int32) -> uint32:
1069
+ """Initialize a new random number generator given a user-defined seed. Returns a 32-bit integer representing the RNG state."""
1070
+ ...
1071
+
1072
+
1073
+ @over
1074
+ def rand_init(seed: int32, offset: int32) -> uint32:
1075
+ """Initialize a new random number generator given a user-defined seed and an offset.
1076
+
1077
+ This alternative constructor can be useful in parallel programs, where a kernel as a whole should share a seed,
1078
+ but each thread should generate uncorrelated values. In this case usage should be ``r = rand_init(seed, tid)``
1079
+ """
1080
+ ...
1081
+
1082
+
1083
+ @over
1084
+ def randi(state: uint32) -> int:
1085
+ """Return a random integer in the range [0, 2^32)."""
1086
+ ...
1087
+
1088
+
1089
+ @over
1090
+ def randi(state: uint32, min: int32, max: int32) -> int:
1091
+ """Return a random integer between [min, max)."""
1092
+ ...
1093
+
1094
+
1095
+ @over
1096
+ def randf(state: uint32) -> float:
1097
+ """Return a random float between [0.0, 1.0)."""
1098
+ ...
1099
+
1100
+
1101
+ @over
1102
+ def randf(state: uint32, min: float32, max: float32) -> float:
1103
+ """Return a random float between [min, max)."""
1104
+ ...
1105
+
1106
+
1107
+ @over
1108
+ def randn(state: uint32) -> float:
1109
+ """Sample a normal distribution."""
1110
+ ...
1111
+
1112
+
1113
+ @over
1114
+ def sample_cdf(state: uint32, cdf: Array[float32]) -> int:
1115
+ """Inverse-transform sample a cumulative distribution function."""
1116
+ ...
1117
+
1118
+
1119
+ @over
1120
+ def sample_triangle(state: uint32) -> vec2f:
1121
+ """Uniformly sample a triangle. Returns sample barycentric coordinates."""
1122
+ ...
1123
+
1124
+
1125
+ @over
1126
+ def sample_unit_ring(state: uint32) -> vec2f:
1127
+ """Uniformly sample a ring in the xy plane."""
1128
+ ...
1129
+
1130
+
1131
+ @over
1132
+ def sample_unit_disk(state: uint32) -> vec2f:
1133
+ """Uniformly sample a disk in the xy plane."""
1134
+ ...
1135
+
1136
+
1137
+ @over
1138
+ def sample_unit_sphere_surface(state: uint32) -> vec3f:
1139
+ """Uniformly sample a unit sphere surface."""
1140
+ ...
1141
+
1142
+
1143
+ @over
1144
+ def sample_unit_sphere(state: uint32) -> vec3f:
1145
+ """Uniformly sample a unit sphere."""
1146
+ ...
1147
+
1148
+
1149
+ @over
1150
+ def sample_unit_hemisphere_surface(state: uint32) -> vec3f:
1151
+ """Uniformly sample a unit hemisphere surface."""
1152
+ ...
1153
+
1154
+
1155
+ @over
1156
+ def sample_unit_hemisphere(state: uint32) -> vec3f:
1157
+ """Uniformly sample a unit hemisphere."""
1158
+ ...
1159
+
1160
+
1161
+ @over
1162
+ def sample_unit_square(state: uint32) -> vec2f:
1163
+ """Uniformly sample a unit square."""
1164
+ ...
1165
+
1166
+
1167
+ @over
1168
+ def sample_unit_cube(state: uint32) -> vec3f:
1169
+ """Uniformly sample a unit cube."""
1170
+ ...
1171
+
1172
+
1173
+ @over
1174
+ def poisson(state: uint32, lam: float32) -> uint32:
1175
+ """Generate a random sample from a Poisson distribution.
1176
+
1177
+ :param state: RNG state
1178
+ :param lam: The expected value of the distribution
1179
+ """
1180
+ ...
1181
+
1182
+
1183
+ @over
1184
+ def noise(state: uint32, x: float32) -> float:
1185
+ """Non-periodic Perlin-style noise in 1D."""
1186
+ ...
1187
+
1188
+
1189
+ @over
1190
+ def noise(state: uint32, xy: vec2f) -> float:
1191
+ """Non-periodic Perlin-style noise in 2D."""
1192
+ ...
1193
+
1194
+
1195
+ @over
1196
+ def noise(state: uint32, xyz: vec3f) -> float:
1197
+ """Non-periodic Perlin-style noise in 3D."""
1198
+ ...
1199
+
1200
+
1201
+ @over
1202
+ def noise(state: uint32, xyzt: vec4f) -> float:
1203
+ """Non-periodic Perlin-style noise in 4D."""
1204
+ ...
1205
+
1206
+
1207
+ @over
1208
+ def pnoise(state: uint32, x: float32, px: int32) -> float:
1209
+ """Periodic Perlin-style noise in 1D."""
1210
+ ...
1211
+
1212
+
1213
+ @over
1214
+ def pnoise(state: uint32, xy: vec2f, px: int32, py: int32) -> float:
1215
+ """Periodic Perlin-style noise in 2D."""
1216
+ ...
1217
+
1218
+
1219
+ @over
1220
+ def pnoise(state: uint32, xyz: vec3f, px: int32, py: int32, pz: int32) -> float:
1221
+ """Periodic Perlin-style noise in 3D."""
1222
+ ...
1223
+
1224
+
1225
+ @over
1226
+ def pnoise(state: uint32, xyzt: vec4f, px: int32, py: int32, pz: int32, pt: int32) -> float:
1227
+ """Periodic Perlin-style noise in 4D."""
1228
+ ...
1229
+
1230
+
1231
+ @over
1232
+ def curlnoise(state: uint32, xy: vec2f, octaves: uint32, lacunarity: float32, gain: float32) -> vec2f:
1233
+ """Divergence-free vector field based on the gradient of a Perlin noise function."""
1234
+ ...
1235
+
1236
+
1237
+ @over
1238
+ def curlnoise(state: uint32, xyz: vec3f, octaves: uint32, lacunarity: float32, gain: float32) -> vec3f:
1239
+ """Divergence-free vector field based on the curl of three Perlin noise functions."""
1240
+ ...
1241
+
1242
+
1243
+ @over
1244
+ def curlnoise(state: uint32, xyzt: vec4f, octaves: uint32, lacunarity: float32, gain: float32) -> vec3f:
1245
+ """Divergence-free vector field based on the curl of three Perlin noise functions."""
1246
+ ...
1247
+
1248
+
1249
+ @over
1250
+ def printf():
1251
+ """Allows printing formatted strings using C-style format specifiers."""
1252
+ ...
1253
+
1254
+
1255
+ @over
1256
+ def tid() -> Tuple[int, int]:
1257
+ """Return the current thread indices for a 2D kernel launch.
1258
+
1259
+ Use ``i,j = wp.tid()`` syntax to retrieve the coordinates inside the kernel thread grid.
1260
+
1261
+ This function may not be called from user-defined Warp functions.
1262
+ """
1263
+ ...
1264
+
1265
+
1266
+ @over
1267
+ def tid() -> Tuple[int, int, int]:
1268
+ """Return the current thread indices for a 3D kernel launch.
1269
+
1270
+ Use ``i,j,k = wp.tid()`` syntax to retrieve the coordinates inside the kernel thread grid.
1271
+
1272
+ This function may not be called from user-defined Warp functions.
1273
+ """
1274
+ ...
1275
+
1276
+
1277
+ @over
1278
+ def tid() -> Tuple[int, int, int, int]:
1279
+ """Return the current thread indices for a 4D kernel launch.
1280
+
1281
+ Use ``i,j,k,l = wp.tid()`` syntax to retrieve the coordinates inside the kernel thread grid.
1282
+
1283
+ This function may not be called from user-defined Warp functions.
1284
+ """
1285
+ ...
1286
+
1287
+
1288
+ @over
1289
+ def select(cond: bool, arg1: Any, arg2: Any):
1290
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1291
+ ...
1292
+
1293
+
1294
+ @over
1295
+ def select(cond: int8, arg1: Any, arg2: Any):
1296
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1297
+ ...
1298
+
1299
+
1300
+ @over
1301
+ def select(cond: uint8, arg1: Any, arg2: Any):
1302
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1303
+ ...
1304
+
1305
+
1306
+ @over
1307
+ def select(cond: int16, arg1: Any, arg2: Any):
1308
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1309
+ ...
1310
+
1311
+
1312
+ @over
1313
+ def select(cond: uint16, arg1: Any, arg2: Any):
1314
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1315
+ ...
1316
+
1317
+
1318
+ @over
1319
+ def select(cond: int32, arg1: Any, arg2: Any):
1320
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1321
+ ...
1322
+
1323
+
1324
+ @over
1325
+ def select(cond: uint32, arg1: Any, arg2: Any):
1326
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1327
+ ...
1328
+
1329
+
1330
+ @over
1331
+ def select(cond: int64, arg1: Any, arg2: Any):
1332
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1333
+ ...
1334
+
1335
+
1336
+ @over
1337
+ def select(cond: uint64, arg1: Any, arg2: Any):
1338
+ """Select between two arguments, if ``cond`` is ``False`` then return ``arg1``, otherwise return ``arg2``"""
1339
+ ...
1340
+
1341
+
1342
+ @over
1343
+ def select(arr: Array[Any], arg1: Any, arg2: Any):
1344
+ """Select between two arguments, if ``arr`` is null then return ``arg1``, otherwise return ``arg2``"""
1345
+ ...
1346
+
1347
+
1348
+ @over
1349
+ def atomic_add(a: Array[Any], i: int32, value: Any):
1350
+ """Atomically add ``value`` onto ``a[i]``."""
1351
+ ...
1352
+
1353
+
1354
+ @over
1355
+ def atomic_add(a: Array[Any], i: int32, j: int32, value: Any):
1356
+ """Atomically add ``value`` onto ``a[i,j]``."""
1357
+ ...
1358
+
1359
+
1360
+ @over
1361
+ def atomic_add(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
1362
+ """Atomically add ``value`` onto ``a[i,j,k]``."""
1363
+ ...
1364
+
1365
+
1366
+ @over
1367
+ def atomic_add(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1368
+ """Atomically add ``value`` onto ``a[i,j,k,l]``."""
1369
+ ...
1370
+
1371
+
1372
+ @over
1373
+ def atomic_add(a: FabricArray[Any], i: int32, value: Any):
1374
+ """Atomically add ``value`` onto ``a[i]``."""
1375
+ ...
1376
+
1377
+
1378
+ @over
1379
+ def atomic_add(a: FabricArray[Any], i: int32, j: int32, value: Any):
1380
+ """Atomically add ``value`` onto ``a[i,j]``."""
1381
+ ...
1382
+
1383
+
1384
+ @over
1385
+ def atomic_add(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1386
+ """Atomically add ``value`` onto ``a[i,j,k]``."""
1387
+ ...
1388
+
1389
+
1390
+ @over
1391
+ def atomic_add(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1392
+ """Atomically add ``value`` onto ``a[i,j,k,l]``."""
1393
+ ...
1394
+
1395
+
1396
+ @over
1397
+ def atomic_add(a: IndexedFabricArray[Any], i: int32, value: Any):
1398
+ """Atomically add ``value`` onto ``a[i]``."""
1399
+ ...
1400
+
1401
+
1402
+ @over
1403
+ def atomic_add(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
1404
+ """Atomically add ``value`` onto ``a[i,j]``."""
1405
+ ...
1406
+
1407
+
1408
+ @over
1409
+ def atomic_add(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1410
+ """Atomically add ``value`` onto ``a[i,j,k]``."""
1411
+ ...
1412
+
1413
+
1414
+ @over
1415
+ def atomic_add(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1416
+ """Atomically add ``value`` onto ``a[i,j,k,l]``."""
1417
+ ...
1418
+
1419
+
1420
+ @over
1421
+ def atomic_sub(a: Array[Any], i: int32, value: Any):
1422
+ """Atomically subtract ``value`` onto ``a[i]``."""
1423
+ ...
1424
+
1425
+
1426
+ @over
1427
+ def atomic_sub(a: Array[Any], i: int32, j: int32, value: Any):
1428
+ """Atomically subtract ``value`` onto ``a[i,j]``."""
1429
+ ...
1430
+
1431
+
1432
+ @over
1433
+ def atomic_sub(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
1434
+ """Atomically subtract ``value`` onto ``a[i,j,k]``."""
1435
+ ...
1436
+
1437
+
1438
+ @over
1439
+ def atomic_sub(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1440
+ """Atomically subtract ``value`` onto ``a[i,j,k,l]``."""
1441
+ ...
1442
+
1443
+
1444
+ @over
1445
+ def atomic_sub(a: FabricArray[Any], i: int32, value: Any):
1446
+ """Atomically subtract ``value`` onto ``a[i]``."""
1447
+ ...
1448
+
1449
+
1450
+ @over
1451
+ def atomic_sub(a: FabricArray[Any], i: int32, j: int32, value: Any):
1452
+ """Atomically subtract ``value`` onto ``a[i,j]``."""
1453
+ ...
1454
+
1455
+
1456
+ @over
1457
+ def atomic_sub(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1458
+ """Atomically subtract ``value`` onto ``a[i,j,k]``."""
1459
+ ...
1460
+
1461
+
1462
+ @over
1463
+ def atomic_sub(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1464
+ """Atomically subtract ``value`` onto ``a[i,j,k,l]``."""
1465
+ ...
1466
+
1467
+
1468
+ @over
1469
+ def atomic_sub(a: IndexedFabricArray[Any], i: int32, value: Any):
1470
+ """Atomically subtract ``value`` onto ``a[i]``."""
1471
+ ...
1472
+
1473
+
1474
+ @over
1475
+ def atomic_sub(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
1476
+ """Atomically subtract ``value`` onto ``a[i,j]``."""
1477
+ ...
1478
+
1479
+
1480
+ @over
1481
+ def atomic_sub(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1482
+ """Atomically subtract ``value`` onto ``a[i,j,k]``."""
1483
+ ...
1484
+
1485
+
1486
+ @over
1487
+ def atomic_sub(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1488
+ """Atomically subtract ``value`` onto ``a[i,j,k,l]``."""
1489
+ ...
1490
+
1491
+
1492
+ @over
1493
+ def atomic_min(a: Array[Any], i: int32, value: Any):
1494
+ """Compute the minimum of ``value`` and ``a[i]`` and atomically update the array.
1495
+
1496
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1497
+ """
1498
+ ...
1499
+
1500
+
1501
+ @over
1502
+ def atomic_min(a: Array[Any], i: int32, j: int32, value: Any):
1503
+ """Compute the minimum of ``value`` and ``a[i,j]`` and atomically update the array.
1504
+
1505
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1506
+ """
1507
+ ...
1508
+
1509
+
1510
+ @over
1511
+ def atomic_min(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
1512
+ """Compute the minimum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1513
+
1514
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1515
+ """
1516
+ ...
1517
+
1518
+
1519
+ @over
1520
+ def atomic_min(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1521
+ """Compute the minimum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1522
+
1523
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1524
+ """
1525
+ ...
1526
+
1527
+
1528
+ @over
1529
+ def atomic_min(a: FabricArray[Any], i: int32, value: Any):
1530
+ """Compute the minimum of ``value`` and ``a[i]`` and atomically update the array.
1531
+
1532
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1533
+ """
1534
+ ...
1535
+
1536
+
1537
+ @over
1538
+ def atomic_min(a: FabricArray[Any], i: int32, j: int32, value: Any):
1539
+ """Compute the minimum of ``value`` and ``a[i,j]`` and atomically update the array.
1540
+
1541
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1542
+ """
1543
+ ...
1544
+
1545
+
1546
+ @over
1547
+ def atomic_min(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1548
+ """Compute the minimum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1549
+
1550
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1551
+ """
1552
+ ...
1553
+
1554
+
1555
+ @over
1556
+ def atomic_min(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1557
+ """Compute the minimum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1558
+
1559
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1560
+ """
1561
+ ...
1562
+
1563
+
1564
+ @over
1565
+ def atomic_min(a: IndexedFabricArray[Any], i: int32, value: Any):
1566
+ """Compute the minimum of ``value`` and ``a[i]`` and atomically update the array.
1567
+
1568
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1569
+ """
1570
+ ...
1571
+
1572
+
1573
+ @over
1574
+ def atomic_min(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
1575
+ """Compute the minimum of ``value`` and ``a[i,j]`` and atomically update the array.
1576
+
1577
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1578
+ """
1579
+ ...
1580
+
1581
+
1582
+ @over
1583
+ def atomic_min(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1584
+ """Compute the minimum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1585
+
1586
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1587
+ """
1588
+ ...
1589
+
1590
+
1591
+ @over
1592
+ def atomic_min(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1593
+ """Compute the minimum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1594
+
1595
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1596
+ """
1597
+ ...
1598
+
1599
+
1600
+ @over
1601
+ def atomic_max(a: Array[Any], i: int32, value: Any):
1602
+ """Compute the maximum of ``value`` and ``a[i]`` and atomically update the array.
1603
+
1604
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1605
+ """
1606
+ ...
1607
+
1608
+
1609
+ @over
1610
+ def atomic_max(a: Array[Any], i: int32, j: int32, value: Any):
1611
+ """Compute the maximum of ``value`` and ``a[i,j]`` and atomically update the array.
1612
+
1613
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1614
+ """
1615
+ ...
1616
+
1617
+
1618
+ @over
1619
+ def atomic_max(a: Array[Any], i: int32, j: int32, k: int32, value: Any):
1620
+ """Compute the maximum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1621
+
1622
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1623
+ """
1624
+ ...
1625
+
1626
+
1627
+ @over
1628
+ def atomic_max(a: Array[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1629
+ """Compute the maximum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1630
+
1631
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1632
+ """
1633
+ ...
1634
+
1635
+
1636
+ @over
1637
+ def atomic_max(a: FabricArray[Any], i: int32, value: Any):
1638
+ """Compute the maximum of ``value`` and ``a[i]`` and atomically update the array.
1639
+
1640
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1641
+ """
1642
+ ...
1643
+
1644
+
1645
+ @over
1646
+ def atomic_max(a: FabricArray[Any], i: int32, j: int32, value: Any):
1647
+ """Compute the maximum of ``value`` and ``a[i,j]`` and atomically update the array.
1648
+
1649
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1650
+ """
1651
+ ...
1652
+
1653
+
1654
+ @over
1655
+ def atomic_max(a: FabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1656
+ """Compute the maximum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1657
+
1658
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1659
+ """
1660
+ ...
1661
+
1662
+
1663
+ @over
1664
+ def atomic_max(a: FabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1665
+ """Compute the maximum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1666
+
1667
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1668
+ """
1669
+ ...
1670
+
1671
+
1672
+ @over
1673
+ def atomic_max(a: IndexedFabricArray[Any], i: int32, value: Any):
1674
+ """Compute the maximum of ``value`` and ``a[i]`` and atomically update the array.
1675
+
1676
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1677
+ """
1678
+ ...
1679
+
1680
+
1681
+ @over
1682
+ def atomic_max(a: IndexedFabricArray[Any], i: int32, j: int32, value: Any):
1683
+ """Compute the maximum of ``value`` and ``a[i,j]`` and atomically update the array.
1684
+
1685
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1686
+ """
1687
+ ...
1688
+
1689
+
1690
+ @over
1691
+ def atomic_max(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, value: Any):
1692
+ """Compute the maximum of ``value`` and ``a[i,j,k]`` and atomically update the array.
1693
+
1694
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1695
+ """
1696
+ ...
1697
+
1698
+
1699
+ @over
1700
+ def atomic_max(a: IndexedFabricArray[Any], i: int32, j: int32, k: int32, l: int32, value: Any):
1701
+ """Compute the maximum of ``value`` and ``a[i,j,k,l]`` and atomically update the array.
1702
+
1703
+ .. note:: The operation is only atomic on a per-component basis for vectors and matrices.
1704
+ """
1705
+ ...
1706
+
1707
+
1708
+ @over
1709
+ def lerp(a: Float, b: Float, t: Float) -> Float:
1710
+ """Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``"""
1711
+ ...
1712
+
1713
+
1714
+ @over
1715
+ def lerp(a: Vector[Any, Float], b: Vector[Any, Float], t: Float) -> Vector[Any, Float]:
1716
+ """Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``"""
1717
+ ...
1718
+
1719
+
1720
+ @over
1721
+ def lerp(a: Matrix[Any, Any, Float], b: Matrix[Any, Any, Float], t: Float) -> Matrix[Any, Any, Float]:
1722
+ """Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``"""
1723
+ ...
1724
+
1725
+
1726
+ @over
1727
+ def lerp(a: Quaternion[Float], b: Quaternion[Float], t: Float) -> Quaternion[Float]:
1728
+ """Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``"""
1729
+ ...
1730
+
1731
+
1732
+ @over
1733
+ def lerp(a: Transformation[Float], b: Transformation[Float], t: Float) -> Transformation[Float]:
1734
+ """Linearly interpolate two values ``a`` and ``b`` using factor ``t``, computed as ``a*(1-t) + b*t``"""
1735
+ ...
1736
+
1737
+
1738
+ @over
1739
+ def smoothstep(edge0: Float, edge1: Float, x: Float) -> Float:
1740
+ """Smoothly interpolate between two values ``edge0`` and ``edge1`` using a factor ``x``,
1741
+ and return a result between 0 and 1 using a cubic Hermite interpolation after clamping.
1742
+ """
1743
+ ...
1744
+
1745
+
1746
+ @over
1747
+ def expect_near(arg1: Float, arg2: Float, tolerance: Float):
1748
+ """Prints an error to stdout if ``arg1`` and ``arg2`` are not closer than tolerance in magnitude"""
1749
+ ...
1750
+
1751
+
1752
+ @over
1753
+ def expect_near(arg1: vec3f, arg2: vec3f, tolerance: float32):
1754
+ """Prints an error to stdout if any element of ``arg1`` and ``arg2`` are not closer than tolerance in magnitude"""
1755
+ ...
1756
+
1757
+
1758
+ @over
1759
+ def lower_bound(arr: Array[Scalar], value: Scalar) -> int:
1760
+ """Search a sorted array ``arr`` for the closest element greater than or equal to ``value``."""
1761
+ ...
1762
+
1763
+
1764
+ @over
1765
+ def lower_bound(arr: Array[Scalar], arr_begin: int32, arr_end: int32, value: Scalar) -> int:
1766
+ """Search a sorted array ``arr`` in the range [arr_begin, arr_end) for the closest element greater than or equal to ``value``."""
1767
+ ...
1768
+
1769
+
1770
+ @over
1771
+ def add(x: Scalar, y: Scalar) -> Scalar:
1772
+ """ """
1773
+ ...
1774
+
1775
+
1776
+ @over
1777
+ def add(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
1778
+ """ """
1779
+ ...
1780
+
1781
+
1782
+ @over
1783
+ def add(x: Quaternion[Scalar], y: Quaternion[Scalar]) -> Quaternion[Scalar]:
1784
+ """ """
1785
+ ...
1786
+
1787
+
1788
+ @over
1789
+ def add(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
1790
+ """ """
1791
+ ...
1792
+
1793
+
1794
+ @over
1795
+ def add(x: Transformation[Scalar], y: Transformation[Scalar]) -> Transformation[Scalar]:
1796
+ """ """
1797
+ ...
1798
+
1799
+
1800
+ @over
1801
+ def sub(x: Scalar, y: Scalar) -> Scalar:
1802
+ """ """
1803
+ ...
1804
+
1805
+
1806
+ @over
1807
+ def sub(x: Vector[Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
1808
+ """ """
1809
+ ...
1810
+
1811
+
1812
+ @over
1813
+ def sub(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
1814
+ """ """
1815
+ ...
1816
+
1817
+
1818
+ @over
1819
+ def sub(x: Quaternion[Scalar], y: Quaternion[Scalar]) -> Quaternion[Scalar]:
1820
+ """ """
1821
+ ...
1822
+
1823
+
1824
+ @over
1825
+ def sub(x: Transformation[Scalar], y: Transformation[Scalar]) -> Transformation[Scalar]:
1826
+ """ """
1827
+ ...
1828
+
1829
+
1830
+ @over
1831
+ def bit_and(x: Int, y: Int) -> Int:
1832
+ """ """
1833
+ ...
1834
+
1835
+
1836
+ @over
1837
+ def bit_or(x: Int, y: Int) -> Int:
1838
+ """ """
1839
+ ...
1840
+
1841
+
1842
+ @over
1843
+ def bit_xor(x: Int, y: Int) -> Int:
1844
+ """ """
1845
+ ...
1846
+
1847
+
1848
+ @over
1849
+ def lshift(x: Int, y: Int) -> Int:
1850
+ """ """
1851
+ ...
1852
+
1853
+
1854
+ @over
1855
+ def rshift(x: Int, y: Int) -> Int:
1856
+ """ """
1857
+ ...
1858
+
1859
+
1860
+ @over
1861
+ def invert(x: Int) -> Int:
1862
+ """ """
1863
+ ...
1864
+
1865
+
1866
+ @over
1867
+ def mul(x: Scalar, y: Scalar) -> Scalar:
1868
+ """ """
1869
+ ...
1870
+
1871
+
1872
+ @over
1873
+ def mul(x: Vector[Any, Scalar], y: Scalar) -> Vector[Any, Scalar]:
1874
+ """ """
1875
+ ...
1876
+
1877
+
1878
+ @over
1879
+ def mul(x: Scalar, y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
1880
+ """ """
1881
+ ...
1882
+
1883
+
1884
+ @over
1885
+ def mul(x: Quaternion[Scalar], y: Scalar) -> Quaternion[Scalar]:
1886
+ """ """
1887
+ ...
1888
+
1889
+
1890
+ @over
1891
+ def mul(x: Scalar, y: Quaternion[Scalar]) -> Quaternion[Scalar]:
1892
+ """ """
1893
+ ...
1894
+
1895
+
1896
+ @over
1897
+ def mul(x: Quaternion[Scalar], y: Quaternion[Scalar]) -> Quaternion[Scalar]:
1898
+ """ """
1899
+ ...
1900
+
1901
+
1902
+ @over
1903
+ def mul(x: Scalar, y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
1904
+ """ """
1905
+ ...
1906
+
1907
+
1908
+ @over
1909
+ def mul(x: Matrix[Any, Any, Scalar], y: Scalar) -> Matrix[Any, Any, Scalar]:
1910
+ """ """
1911
+ ...
1912
+
1913
+
1914
+ @over
1915
+ def mul(x: Matrix[Any, Any, Scalar], y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
1916
+ """ """
1917
+ ...
1918
+
1919
+
1920
+ @over
1921
+ def mul(x: Vector[Any, Scalar], y: Matrix[Any, Any, Scalar]) -> Vector[Any, Scalar]:
1922
+ """ """
1923
+ ...
1924
+
1925
+
1926
+ @over
1927
+ def mul(x: Matrix[Any, Any, Scalar], y: Matrix[Any, Any, Scalar]):
1928
+ """ """
1929
+ ...
1930
+
1931
+
1932
+ @over
1933
+ def mul(x: Transformation[Scalar], y: Transformation[Scalar]) -> Transformation[Scalar]:
1934
+ """ """
1935
+ ...
1936
+
1937
+
1938
+ @over
1939
+ def mul(x: Scalar, y: Transformation[Scalar]) -> Transformation[Scalar]:
1940
+ """ """
1941
+ ...
1942
+
1943
+
1944
+ @over
1945
+ def mul(x: Transformation[Scalar], y: Scalar) -> Transformation[Scalar]:
1946
+ """ """
1947
+ ...
1948
+
1949
+
1950
+ @over
1951
+ def mod(x: Scalar, y: Scalar) -> Scalar:
1952
+ """ """
1953
+ ...
1954
+
1955
+
1956
+ @over
1957
+ def div(x: Scalar, y: Scalar) -> Scalar:
1958
+ """ """
1959
+ ...
1960
+
1961
+
1962
+ @over
1963
+ def div(x: Vector[Any, Scalar], y: Scalar) -> Vector[Any, Scalar]:
1964
+ """ """
1965
+ ...
1966
+
1967
+
1968
+ @over
1969
+ def div(x: Scalar, y: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
1970
+ """ """
1971
+ ...
1972
+
1973
+
1974
+ @over
1975
+ def div(x: Matrix[Any, Any, Scalar], y: Scalar) -> Matrix[Any, Any, Scalar]:
1976
+ """ """
1977
+ ...
1978
+
1979
+
1980
+ @over
1981
+ def div(x: Scalar, y: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
1982
+ """ """
1983
+ ...
1984
+
1985
+
1986
+ @over
1987
+ def div(x: Quaternion[Scalar], y: Scalar) -> Quaternion[Scalar]:
1988
+ """ """
1989
+ ...
1990
+
1991
+
1992
+ @over
1993
+ def div(x: Scalar, y: Quaternion[Scalar]) -> Quaternion[Scalar]:
1994
+ """ """
1995
+ ...
1996
+
1997
+
1998
+ @over
1999
+ def floordiv(x: Scalar, y: Scalar) -> Scalar:
2000
+ """ """
2001
+ ...
2002
+
2003
+
2004
+ @over
2005
+ def pos(x: Scalar) -> Scalar:
2006
+ """ """
2007
+ ...
2008
+
2009
+
2010
+ @over
2011
+ def pos(x: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2012
+ """ """
2013
+ ...
2014
+
2015
+
2016
+ @over
2017
+ def pos(x: Quaternion[Scalar]) -> Quaternion[Scalar]:
2018
+ """ """
2019
+ ...
2020
+
2021
+
2022
+ @over
2023
+ def pos(x: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2024
+ """ """
2025
+ ...
2026
+
2027
+
2028
+ @over
2029
+ def neg(x: Scalar) -> Scalar:
2030
+ """ """
2031
+ ...
2032
+
2033
+
2034
+ @over
2035
+ def neg(x: Vector[Any, Scalar]) -> Vector[Any, Scalar]:
2036
+ """ """
2037
+ ...
2038
+
2039
+
2040
+ @over
2041
+ def neg(x: Quaternion[Scalar]) -> Quaternion[Scalar]:
2042
+ """ """
2043
+ ...
2044
+
2045
+
2046
+ @over
2047
+ def neg(x: Matrix[Any, Any, Scalar]) -> Matrix[Any, Any, Scalar]:
2048
+ """ """
2049
+ ...
2050
+
2051
+
2052
+ @over
2053
+ def unot(b: bool) -> bool:
2054
+ """ """
2055
+ ...
2056
+
2057
+
2058
+ @over
2059
+ def unot(b: int8) -> bool:
2060
+ """ """
2061
+ ...
2062
+
2063
+
2064
+ @over
2065
+ def unot(b: uint8) -> bool:
2066
+ """ """
2067
+ ...
2068
+
2069
+
2070
+ @over
2071
+ def unot(b: int16) -> bool:
2072
+ """ """
2073
+ ...
2074
+
2075
+
2076
+ @over
2077
+ def unot(b: uint16) -> bool:
2078
+ """ """
2079
+ ...
2080
+
2081
+
2082
+ @over
2083
+ def unot(b: int32) -> bool:
2084
+ """ """
2085
+ ...
2086
+
2087
+
2088
+ @over
2089
+ def unot(b: uint32) -> bool:
2090
+ """ """
2091
+ ...
2092
+
2093
+
2094
+ @over
2095
+ def unot(b: int64) -> bool:
2096
+ """ """
2097
+ ...
2098
+
2099
+
2100
+ @over
2101
+ def unot(b: uint64) -> bool:
2102
+ """ """
2103
+ ...
2104
+
2105
+
2106
+ @over
2107
+ def unot(a: Array[Any]) -> bool:
2108
+ """ """
2109
+ ...