Yuval Tassa
2810edd27a
Rename mjtnum.h to mjtype.h, move enum types to mjtype.h
...
PiperOrigin-RevId: 919020039
Change-Id: I441295c0baa0b7456f78239fbd5478d32ffc07c1
2026-05-21 06:43:29 -07:00
Yuval Tassa
767c607f58
Add mju_sym2dense, document future breakage of mj_fullM
...
PiperOrigin-RevId: 910242375
Change-Id: Ibfbdef9cfb66088723499ea257da09aee0d80938
2026-05-04 14:25:53 -07:00
Yuval Tassa
f7d31e06f0
Refactor utility functions for block extraction.
...
PiperOrigin-RevId: 908744392
Change-Id: I8d1323946870c90d5e37b1853697fb35d5291e11
2026-05-01 08:24:38 -07:00
Yuval Tassa
e6d77650f7
Refactor mju_combineSparse to eliminate temporary buffers.
...
Combine sparse vectors in-place by first counting total `nnz` and then working backwards from the end. This removes the need for temporary buffers in `mju_combineSparse` and its callers and speeds up the function by ~10%.
PiperOrigin-RevId: 902530210
Change-Id: I4f48c327103552ab968d3915399c6067367bec9f
2026-04-20 03:10:18 -07:00
Yuval Tassa
a2d0e33c0f
2-3x speedup of sparse matrix squaring.
...
Split symbolic and numeric phases for sparse `M'*diag*M` computation. Microseconds per call for the monolithic vs the split approach for the 100_humanoids and 2humanoid100 models:
```
+-------+------+----------+------------+---------+
| Model | Arch | Col (µs) | Split (µs) | Speedup |
+-------+------+----------+------------+---------+
| 2H100 | x86 | 238.3 | 74.5 | 3.2x |
+-------+------+----------+------------+---------+
| | ARM | 111.6 | 53.2 | 2.1x |
+-------+------+----------+------------+---------+
| 100H | x86 | 1325.3 | 656.2 | 2.0x |
+-------+------+----------+------------+---------+
| | ARM | 594.8 | 306.6 | 1.9x |
+-------+------+----------+------------+---------+
```
PiperOrigin-RevId: 900154308
Change-Id: Ia6e9b8e196e2ed37b723a0faf60e9731303a9619
2026-04-15 07:19:41 -07:00
Yuval Tassa
412cee2059
Add Jdot correction for connect and weld constaints
...
Measured reduction in constraint violations before/after this change:
| Model | Correction ON (Avg Viol) | Correction OFF (Avg Viol) | Reduction |
| :--- | :--- | :--- | :--- |
| `jdotv_connect_2d.xml` | 3.959e-4 | 1.699e-3 | **76.7%** |
| `jdotv_connect_3d.xml` | 1.399e-3 | 5.493e-3 | **74.5%** |
| `jdotv_weld_3d.xml` | 9.472e-3 | 1.148e-2 | **17.5%** |
PiperOrigin-RevId: 899137525
Change-Id: Ic3e33764ebd64239bab916289c23d80c3da0b51b
2026-04-13 12:48:03 -07:00
Yuval Tassa
769f37b653
Implement sleeping in engine
...
PiperOrigin-RevId: 829361787
Change-Id: I6f64d8e25c4248cf32c18cd94d37ff5def78946e
2025-11-07 03:33:07 -08:00
Yuval Tassa
998769a995
Return the total non-zeros from mju_sqrMatTDSparseCount.
...
PiperOrigin-RevId: 772414653
Change-Id: Ic1cac868af0034196f33d08b2456be77c72cbd50
2025-06-17 04:27:15 -07:00
Yuval Tassa
45fc15b844
Speed up sparse supernode detection by combining it with transposition.
...
PiperOrigin-RevId: 760673008
Change-Id: I6d66580e675fd86e5b974859383f93f87482ca16
2025-05-19 10:14:15 -07:00
Yuval Tassa
ee8abdf854
Speed up mju_sqrMatTDSparse
...
PiperOrigin-RevId: 759593417
Change-Id: I0168e1f96333769d09d61e835560910d43aac608
2025-05-16 06:42:17 -07:00
Yuval Tassa
e1baa15776
Remove unnecessary argument in mju_mulSymVecSparse
...
PiperOrigin-RevId: 758688536
Change-Id: Ife1099b948215363ddaa6d0b0edcf3492edcddcc
2025-05-14 08:12:15 -07:00
Yuval Tassa
436b5a8e1f
Add mju_addToSymSparse
...
- Internal engine function to add a symmetric sparse matrix to a dense matrix.
- Also minor refactors to related functions.
PiperOrigin-RevId: 757954336
Change-Id: I8d8a48bcbbd5d6c618ae097a87df2bc1e6f5ef1d
2025-05-12 16:19:43 -07:00
Yuval Tassa
755564a348
Remove unused code related to legacy island implementation.
...
Also fix a docstring.
PiperOrigin-RevId: 757939564
Change-Id: I3a970fd38c63886d34cd23b1fb45617a9ce5c147
2025-05-12 15:39:16 -07:00
Yuval Tassa
7742f62803
Add mju_mulSymVecSparse, private engine function
...
Multiply sparse symmetric matrix (only lower triangle represented) by vector
PiperOrigin-RevId: 752926934
Change-Id: I5aaae1266256aa88aee8c25e242b7a7c51ea8dd7
2025-04-29 16:33:54 -07:00
Yuval Tassa
8078a45727
Add private functions mju_blockDiag and mju_blockDiagSparse
...
PiperOrigin-RevId: 752815446
Change-Id: Ia7f73160315ce57b78a2c34bc781f00e1b0f05c4
2025-04-29 11:31:03 -07:00
Yuval Tassa
25126e88c7
Move mju_cholFactorCount to engine_util_solve.
...
PiperOrigin-RevId: 746011856
Change-Id: If9812251420053644f4eca81adb5116d370ee524
2025-04-10 06:56:31 -07:00
Yuval Tassa
e39a5df06a
mju_compressSparse(): add option to compress away small elements.
...
PiperOrigin-RevId: 726010576
Change-Id: Ib6458037a5cf9a9d82abb364b7dda7aab2f36807
2025-02-12 05:08:20 -08:00
Yuval Tassa
6a23841aad
manually inline mju_combineSparse
...
PiperOrigin-RevId: 720326669
Change-Id: I03727291f133e3d481e73ad88735e54af8f62f1f
2025-01-27 15:22:18 -08:00
Yuval Tassa
d86900aac1
Speed up mju_cholUpdateSparse by not checking for varying sparsity pattern where it is guaranteed to not vary.
...
PiperOrigin-RevId: 720126576
Change-Id: I3a43bdd0259656fab462b1cd155cb422982e970d
2025-01-27 05:07:28 -08:00
Yuval Tassa
00010f5848
Compute diagonal indices in mj_sqrMatTDSparse
...
PiperOrigin-RevId: 713714087
Change-Id: Icc8eae74e6e47ba1d12a6e9aa0d774ab006cfe38
2025-01-09 10:17:31 -08:00
Yuval Tassa
4d82ab5762
Add function to merge chains of indices.
...
PiperOrigin-RevId: 712863690
Change-Id: I15652bec03dc9ce90e230788bd12b44b1a2b8217
2025-01-07 04:42:11 -08:00
Yuval Tassa
674d227050
Standardize names of sparse fill-in pre-counting functions
...
PiperOrigin-RevId: 712835830
Change-Id: I8e90dfa52af56ede917e1fd90b8d551898c244e5
2025-01-07 02:39:46 -08:00
Yuval Tassa
7eb8231fda
Represent only the lower triangle in Newton solver's reduced dof-dof matrix.
...
PiperOrigin-RevId: 712488529
Change-Id: Iad91c72654376539791d7856765a0d0ac9088251
2025-01-06 04:58:55 -08:00
Yuval Tassa
abe8ffdee7
Enable AVX for inlined mju_dotSparse.
...
PiperOrigin-RevId: 711858423
Change-Id: Id2d06a9e87085e9f810779fba4e8ed9c19a4cba9
2025-01-03 14:42:00 -08:00
Yuval Tassa
e42370c982
Avoid allocation and copying in implicit solver's addJTBJSparse
...
PiperOrigin-RevId: 710679558
Change-Id: Ie75fdcd1127ff619c2668f568ab6a8a11e079dda
2024-12-30 04:19:10 -08:00
Yuval Tassa
a8a9607712
Inline mju_dotSparse in engine_util_sparse.h
...
PiperOrigin-RevId: 709577108
Change-Id: I76547122b5780bec76a12384effcb66315f84e13
2024-12-25 08:09:42 -08:00
Taylor Howell
a51f346059
Use sparse (uncompressed) actuator_moment in mj_transmission.
...
PiperOrigin-RevId: 692179704
Change-Id: Ic30ac5a98dc13de2028e378df65dc88ba3912bf5
2024-11-01 08:06:28 -07:00
Taylor Howell
a36f2cccb6
Add nnz argument for size of allocated memory to mju_dense2sparse and check if this number is too small for number of non-zeros.
...
PiperOrigin-RevId: 690545825
Change-Id: I0e31cb907a1151cb2e4766d5f0cdfecb5629a2a6
2024-10-28 03:46:50 -07:00
Yuval Tassa
e14aebfd16
Expose mju_sparse2dense to public API.
...
PiperOrigin-RevId: 688985153
Change-Id: I9559f1d47363d0afada80c86abdc729cd1910b63
2024-10-23 09:01:25 -07:00
Taylor Howell
94e9912d28
Add mju_mulMatTVecSparse to multiply transposed sparse matrix and dense vector.
...
PiperOrigin-RevId: 688535240
Change-Id: I0bacf1e911cde99014b2dcb0a1434e61a4f41d51
2024-10-22 07:06:29 -07:00
Yuval Tassa
7ec94f46d4
Refactor Newton solver: move Hessian from arena back to the stack.
...
The changes in 9a0dc20821 , moving the Hessian from the stack to the arena, should be rolled back: they prevent future threading over islands. Unlike the stack, arena allocations are not thread-friendly. The reason for the original move was to save memory, but the savings are small: `O(ctx->nH)` and only linear in `nv`. The significant reduction of the Cholesky factor, from quadratic in `nv` to quadratic in the largest dof island — the reduction afforded by 2dd518734f — remains in place.
Also refactor and improve readability.
PiperOrigin-RevId: 685717356
Change-Id: Ia9ec3e44a62d459a3b9cffb578cf6479d5aa1d7f
2024-10-14 08:34:16 -07:00
Yuval Tassa
3f3fe92860
Remove unused argument in mju_sqrMatTDSparseInit
...
PiperOrigin-RevId: 682375566
Change-Id: If05f5d15a2f8925eee9dd0ebc5d485164d90d787
2024-10-04 10:45:33 -07:00
Yuval Tassa
176345b4e1
Remove meaningless const qualifier for scalar arguments in sparse function signatures.
...
PiperOrigin-RevId: 679568516
Change-Id: I910626cd9555966c3b0a9ffba4064d263b2c16e1
2024-09-27 06:37:18 -07:00
Taylor Howell
6a6e10d779
Add mju_cholFactorNNZ to compute the number of non-zeros per row for sparse Cholesky factorization.
...
PiperOrigin-RevId: 679553197
Change-Id: I6f92deec347dae97d2e219cfb5376f92e777da1a
2024-09-27 05:39:08 -07:00
Alessio Quaglino
5a70ad08ab
Add Flex component.
...
PiperOrigin-RevId: 572830650
Change-Id: I6908228087b7b9683be3506c8d9cdc725ed5dcd5
2023-10-12 10:49:35 +01:00
Yuval Tassa
29aa5e4a41
Allow dot products with sparse vectors to specify that one vector uses uncompressed memory.
...
PiperOrigin-RevId: 561951337
Change-Id: I1310d7c09d9a85ad9b43877155844a9d0ce6edab
2023-09-01 07:40:16 -07:00
Kyle Bayes
ea5e00cad8
Move mju_combineSparseCount into engine_util_sparse.
...
PiperOrigin-RevId: 561025741
Change-Id: I0bdc48554928fc4545a38a8cea3bdeb593bd7ecd
2023-08-29 07:40:53 -07:00
Kyle Bayes
ba12a1354b
Optimize and refactor combineSparse and combineSparseCount.
...
PiperOrigin-RevId: 558126391
Change-Id: Iead14c31136e789560f3c8124b84bd4e383158f4
2023-08-18 06:14:09 -07:00
Kyle Bayes
8ea690ed70
Remove unused parameters from mju_sqrMatTDSparseInit.
...
PiperOrigin-RevId: 557114227
Change-Id: Ia7d3fedfba612a68ff01d68f1b9dadb45bd76e85
2023-08-15 06:30:19 -07:00
Yuval Tassa
a063e2f0ef
Add private functions and associated tests related to constraint island discovery.
...
PiperOrigin-RevId: 553156672
Change-Id: Ifd73e3df443f7955359c5243d5f7756069335c05
2023-08-02 08:43:11 -07:00
Kyle Bayes
9924cce4b7
Add nnz per row precount method for mju_sqrMatTDSparse.
...
PiperOrigin-RevId: 521744893
Change-Id: Ie0fbfab552a680127f4acf9041b07916f8a2a490
2023-04-04 06:21:22 -07:00
Kyle Bayes
056e849273
Provide improved mju_sqrMatTDSparse implementation that doesn't require dense memory allocation for sparse matrices.
...
PiperOrigin-RevId: 516812783
Change-Id: Ieb43337831d8d3b2c7f18a7facd8e0a0f2b0eff5
2023-03-15 06:56:16 -07:00
Kyle Bayes
c741dfce7d
Implement a more performant mju_transposeSparse that doesn't require dense memory allocation.
...
PiperOrigin-RevId: 505044194
Change-Id: Ibe0e39e3ad711b2b5bdad45180ca4f83b5c8fc82
2023-01-27 00:20:01 -08:00
Alessio Quaglino
2d304d65e5
Use memcmp for mju_compare if no AVX. 15% faster on Humanoid.
...
PiperOrigin-RevId: 493324356
Change-Id: I5f71dc1a8ae40c18864ea80f00a5f86ff952f72c
2022-12-06 09:14:33 -08:00
Alessio Quaglino
7b0fbc63f8
Speed improvement with no AVX. 40% on Linux Intel Xeon and 60% on ARM Mac.
...
PiperOrigin-RevId: 488360660
Change-Id: I423269cd362fdcc2434393b691638ac6ed778ef2
2022-11-14 07:31:32 -08:00
Saran Tunyasuvunakool
1913a02b40
Initial open sourcing of MuJoCo.
...
PiperOrigin-RevId: 450374687
Change-Id: Ie3225a46ce095fc28ae8e63c326a640261f562bb
2022-05-23 01:08:49 -07:00