Add mju_clip, mju_fill, mju_eye and mju_symmetrize to python bindings.

- Also change signatures of `mju_fill` and `mju_symmetrize` to conform to standard.

PiperOrigin-RevId: 485613824
Change-Id: I8dd618bac92ef40aa6c76380fa73302e81968687
This commit is contained in:
Yuval Tassa
2022-11-02 09:21:38 -07:00
committed by Copybara-Service
parent 7458a6e90f
commit c83be2bc05
9 changed files with 85 additions and 24 deletions
+9 -2
View File
@@ -57,7 +57,7 @@ TEST_F(EngineUtilBlasTest, MjuMulVecMatVec) {
TEST_F(EngineUtilBlasTest, MjuFill) {
mjtNum vec[] = {0, 1, 4};
mju_fill(vec, 3, 4.5);
mju_fill(vec, 4.5, 3);
EXPECT_EQ(vec[0], 4.5);
EXPECT_EQ(vec[1], 4.5);
@@ -82,7 +82,14 @@ TEST_F(EngineUtilBlasTest, MjuSymmetrize) {
1.5, 2, 4,
2.5, 3, 3
};
mju_symmetrize(mat, 3);
mjtNum res[9] = {0};
mju_symmetrize(res, mat, 3);
EXPECT_THAT(res, ElementsAre(1, 2, 3,
2, 2, 3.5,
3, 3.5, 3));
// test for the case res==mat
mju_symmetrize(mat, mat, 3);
EXPECT_THAT(mat, ElementsAre(1, 2, 3,
2, 2, 3.5,
3, 3.5, 3));