Remove mjData.C_diag, no longer required as C is now lower triangular.
PiperOrigin-RevId: 712514204 Change-Id: I8293f65ebc09c6a8fed76b0e59d2e2a667e01a43
This commit is contained in:
committed by
Copybara-Service
parent
ac11e5faa6
commit
b5df2c10bf
@@ -313,7 +313,6 @@ struct mjData_ {
|
||||
int* B_colind; // body-dof: column indices of non-zeros (nB x 1)
|
||||
int* C_rownnz; // reduced dof-dof: non-zeros in each row (nv x 1)
|
||||
int* C_rowadr; // reduced dof-dof: address of each row in C_colind (nv x 1)
|
||||
int* C_diag; // reduced dof-dof: index of diagonal element (nv x 1)
|
||||
int* C_colind; // reduced dof-dof: column indices of non-zeros (nC x 1)
|
||||
int* mapM2C; // index mapping from M to C (nC x 1)
|
||||
int* D_rownnz; // dof-dof: non-zeros in each row (nv x 1)
|
||||
|
||||
@@ -341,7 +341,6 @@ struct mjData_ {
|
||||
int* B_colind; // body-dof: column indices of non-zeros (nB x 1)
|
||||
int* C_rownnz; // reduced dof-dof: non-zeros in each row (nv x 1)
|
||||
int* C_rowadr; // reduced dof-dof: address of each row in C_colind (nv x 1)
|
||||
int* C_diag; // reduced dof-dof: index of diagonal element (nv x 1)
|
||||
int* C_colind; // reduced dof-dof: column indices of non-zeros (nC x 1)
|
||||
int* mapM2C; // index mapping from M to C (nC x 1)
|
||||
int* D_rownnz; // dof-dof: non-zeros in each row (nv x 1)
|
||||
|
||||
@@ -654,7 +654,6 @@
|
||||
X ( int, B_colind, nB, 1 ) \
|
||||
X ( int, C_rownnz, nv, 1 ) \
|
||||
X ( int, C_rowadr, nv, 1 ) \
|
||||
X ( int, C_diag, nv, 1 ) \
|
||||
X ( int, C_colind, nC, 1 ) \
|
||||
X ( int, mapM2C, nC, 1 ) \
|
||||
X ( int, D_rownnz, nv, 1 ) \
|
||||
|
||||
@@ -5388,14 +5388,6 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
),
|
||||
doc='reduced dof-dof: address of each row in C_colind (nv x 1)', # pylint: disable=line-too-long
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='C_diag',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='int'),
|
||||
),
|
||||
doc='reduced dof-dof: index of diagonal element',
|
||||
array_extent=('nv',),
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='C_colind',
|
||||
type=PointerType(
|
||||
|
||||
@@ -332,7 +332,6 @@ def make_data(
|
||||
'B_colind': (m.nB, jp.int32),
|
||||
'C_rownnz': (m.nv, jp.int32),
|
||||
'C_rowadr': (m.nv, jp.int32),
|
||||
'C_diag': (m.nv, jp.int32),
|
||||
'C_colind': (m.nC, jp.int32),
|
||||
'mapM2C': (m.nC, jp.int32),
|
||||
'D_rownnz': (m.nv, jp.int32),
|
||||
|
||||
@@ -1296,7 +1296,6 @@ class Data(PyTreeNode):
|
||||
B_colind: body-dof: column indices of non-zeros (nB,)
|
||||
C_rownnz: reduced dof-dof: non-zeros in each row (nv,)
|
||||
C_rowadr: reduced dof-dof: address of each row in C_colind (nv,)
|
||||
C_diag: reduced dof-dof: index of diagonal element (nv,)
|
||||
C_colind: reduced dof-dof: column indices of non-zeros (nC,)
|
||||
mapM2C: index mapping from M to C (nC,)
|
||||
D_rownnz: dof-dof: non-zeros in each row (nv,)
|
||||
@@ -1426,7 +1425,6 @@ class Data(PyTreeNode):
|
||||
B_colind: jax.Array = _restricted_to('mujoco') # pylint:disable=invalid-name
|
||||
C_rownnz: jax.Array = _restricted_to('mujoco') # pylint:disable=invalid-name
|
||||
C_rowadr: jax.Array = _restricted_to('mujoco') # pylint:disable=invalid-name
|
||||
C_diag: jax.Array = _restricted_to('mujoco') # pylint:disable=invalid-name
|
||||
C_colind: jax.Array = _restricted_to('mujoco') # pylint:disable=invalid-name
|
||||
mapM2C: jax.Array = _restricted_to('mujoco') # pylint:disable=invalid-name
|
||||
D_rownnz: jax.Array = _restricted_to('mujoco') # pylint:disable=invalid-name
|
||||
|
||||
+12
-10
@@ -994,16 +994,18 @@ static void makeDofDofSparse(const mjModel* m, mjData* d,
|
||||
}
|
||||
|
||||
// find diagonal indices
|
||||
for (int i = 0; i < nv; i++) {
|
||||
int adr = rowadr[i];
|
||||
int j = 0;
|
||||
while (colind[adr + j] < i && j < rownnz[i]) {
|
||||
j++;
|
||||
if (diag) {
|
||||
for (int i = 0; i < nv; i++) {
|
||||
int adr = rowadr[i];
|
||||
int j = 0;
|
||||
while (colind[adr + j] < i && j < rownnz[i]) {
|
||||
j++;
|
||||
}
|
||||
if (colind[adr + j] != i) {
|
||||
mjERROR("diagonal index not found");
|
||||
}
|
||||
diag[i] = j;
|
||||
}
|
||||
if (colind[adr + j] != i) {
|
||||
mjERROR("diagonal index not found");
|
||||
}
|
||||
diag[i] = j;
|
||||
}
|
||||
|
||||
mj_freeStack(d);
|
||||
@@ -1963,7 +1965,7 @@ static void _resetData(const mjModel* m, mjData* d, unsigned char debug_value) {
|
||||
checkDBSparse(m, d);
|
||||
|
||||
// make C
|
||||
makeDofDofSparse(m, d, d->C_rownnz, d->C_rowadr, d->C_diag, d->C_colind, /*reduced=*/1);
|
||||
makeDofDofSparse(m, d, d->C_rownnz, d->C_rowadr, NULL, d->C_colind, /*reduced=*/1);
|
||||
makeDofDofmap(m, d);
|
||||
}
|
||||
|
||||
|
||||
@@ -1135,7 +1135,7 @@ void mj_printFormattedData(const mjModel* m, mjData* d, const char* filename,
|
||||
fprintf(fp, "\n\n");
|
||||
|
||||
// C sparse structure
|
||||
mj_printSparsity("C: reduced dof-dof matrix", m->nv, m->nv, d->C_rowadr, d->C_diag, d->C_rownnz,
|
||||
mj_printSparsity("C: reduced dof-dof matrix", m->nv, m->nv, d->C_rowadr, NULL, d->C_rownnz,
|
||||
NULL, d->C_colind, fp);
|
||||
|
||||
fprintf(fp, NAME_FORMAT, "C_rownnz");
|
||||
|
||||
@@ -4939,7 +4939,6 @@ public unsafe struct mjData_ {
|
||||
public int* B_colind;
|
||||
public int* C_rownnz;
|
||||
public int* C_rowadr;
|
||||
public int* C_diag;
|
||||
public int* C_colind;
|
||||
public int* mapM2C;
|
||||
public int* D_rownnz;
|
||||
|
||||
Reference in New Issue
Block a user