Yuval Tassa
4a03a61734
Fix engine_util_sparse_test on MSVC
...
error C2466: cannot allocate an array of constant size 0
PiperOrigin-RevId: 945988439
Change-Id: Iceb4c536665a4bb42a603a17c41b083a4b6abeea
2026-07-10 18:28:23 -07:00
Kyle Bayes
1490336955
Change LoadModelFromString to return a smart pointer, add MakeData, and update tests to have C++ RAII clean up model and data.
...
PiperOrigin-RevId: 935980153
Change-Id: I41d25bfab4935494dc984168820cb7cad123cadf
2026-06-22 04:19:01 -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
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
174a50442d
Allow transposing of sparse sub-matrices whose first row is > 0
...
PiperOrigin-RevId: 797728559
Change-Id: I3c825118dae198333d357d2e4f248d00b0f5d8ce
2025-08-21 05:56:33 -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
9ac5fff41d
Move local function to top of test file.
...
PiperOrigin-RevId: 757722664
Change-Id: Ief7d8ca9fda990bf582ca0feaa4b645f0a4bb6e7
2025-05-12 05:36:38 -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
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
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
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
0ffaeb4d56
Improve comments in mju_cholFactorNNZ, clarify that this function reads from the upper triangle of the source matrix.
...
PiperOrigin-RevId: 686113654
Change-Id: I029f9279d177f4cb9ff60396a26d64821aee3a6c
2024-10-15 08:26:07 -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
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
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
8ea690ed70
Remove unused parameters from mju_sqrMatTDSparseInit.
...
PiperOrigin-RevId: 557114227
Change-Id: Ia7d3fedfba612a68ff01d68f1b9dadb45bd76e85
2023-08-15 06:30:19 -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
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