Remove use of diagnum in solver
PiperOrigin-RevId: 759021147 Change-Id: I9e5c85b6542380780fc487781398f406ddaad51b
This commit is contained in:
committed by
Copybara-Service
parent
dc4968506b
commit
e8c566bee1
@@ -392,7 +392,6 @@ struct mjData_ {
|
|||||||
mjtNum* iacc_smooth; // unconstrained acceleration (nidof x 1)
|
mjtNum* iacc_smooth; // unconstrained acceleration (nidof x 1)
|
||||||
int* iM_rownnz; // inertia: non-zeros in each row (nidof x 1)
|
int* iM_rownnz; // inertia: non-zeros in each row (nidof x 1)
|
||||||
int* iM_rowadr; // inertia: address of each row in iM_colind (nidof x 1)
|
int* iM_rowadr; // inertia: address of each row in iM_colind (nidof x 1)
|
||||||
int* iM_diagnum; // inertia: num of consecutive diagonal elements (nidof x 1)
|
|
||||||
int* iM_colind; // inertia: column indices of non-zeros (nC x 1)
|
int* iM_colind; // inertia: column indices of non-zeros (nC x 1)
|
||||||
mjtNum* iM; // total inertia (sparse) (nC x 1)
|
mjtNum* iM; // total inertia (sparse) (nC x 1)
|
||||||
mjtNum* iLD; // L'*D*L factorization of M (sparse) (nC x 1)
|
mjtNum* iLD; // L'*D*L factorization of M (sparse) (nC x 1)
|
||||||
|
|||||||
@@ -420,7 +420,6 @@ struct mjData_ {
|
|||||||
mjtNum* iacc_smooth; // unconstrained acceleration (nidof x 1)
|
mjtNum* iacc_smooth; // unconstrained acceleration (nidof x 1)
|
||||||
int* iM_rownnz; // inertia: non-zeros in each row (nidof x 1)
|
int* iM_rownnz; // inertia: non-zeros in each row (nidof x 1)
|
||||||
int* iM_rowadr; // inertia: address of each row in iM_colind (nidof x 1)
|
int* iM_rowadr; // inertia: address of each row in iM_colind (nidof x 1)
|
||||||
int* iM_diagnum; // inertia: num of consecutive diagonal elements (nidof x 1)
|
|
||||||
int* iM_colind; // inertia: column indices of non-zeros (nC x 1)
|
int* iM_colind; // inertia: column indices of non-zeros (nC x 1)
|
||||||
mjtNum* iM; // total inertia (sparse) (nC x 1)
|
mjtNum* iM; // total inertia (sparse) (nC x 1)
|
||||||
mjtNum* iLD; // L'*D*L factorization of M (sparse) (nC x 1)
|
mjtNum* iLD; // L'*D*L factorization of M (sparse) (nC x 1)
|
||||||
|
|||||||
@@ -758,7 +758,6 @@
|
|||||||
X( mjtNum, iacc_smooth, MJ_D(nidof), 1 ) \
|
X( mjtNum, iacc_smooth, MJ_D(nidof), 1 ) \
|
||||||
X( int, iM_rownnz, MJ_D(nidof), 1 ) \
|
X( int, iM_rownnz, MJ_D(nidof), 1 ) \
|
||||||
X( int, iM_rowadr, MJ_D(nidof), 1 ) \
|
X( int, iM_rowadr, MJ_D(nidof), 1 ) \
|
||||||
X( int, iM_diagnum, MJ_D(nidof), 1 ) \
|
|
||||||
X( int, iM_colind, MJ_M(nC), 1 ) \
|
X( int, iM_colind, MJ_M(nC), 1 ) \
|
||||||
X( mjtNum, iM, MJ_M(nC), 1 ) \
|
X( mjtNum, iM, MJ_M(nC), 1 ) \
|
||||||
X( mjtNum, iLD, MJ_M(nC), 1 ) \
|
X( mjtNum, iLD, MJ_M(nC), 1 ) \
|
||||||
|
|||||||
@@ -6024,14 +6024,6 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
|||||||
doc='inertia: address of each row in iM_colind',
|
doc='inertia: address of each row in iM_colind',
|
||||||
array_extent=('nidof',),
|
array_extent=('nidof',),
|
||||||
),
|
),
|
||||||
StructFieldDecl(
|
|
||||||
name='iM_diagnum',
|
|
||||||
type=PointerType(
|
|
||||||
inner_type=ValueType(name='int'),
|
|
||||||
),
|
|
||||||
doc='inertia: num of consecutive diagonal elements',
|
|
||||||
array_extent=('nidof',),
|
|
||||||
),
|
|
||||||
StructFieldDecl(
|
StructFieldDecl(
|
||||||
name='iM_colind',
|
name='iM_colind',
|
||||||
type=PointerType(
|
type=PointerType(
|
||||||
|
|||||||
@@ -544,25 +544,6 @@ void mj_island(const mjModel* m, mjData* d) {
|
|||||||
d->iM, d->M);
|
d->iM, d->M);
|
||||||
mju_gather(d->iLDiagInv, d->qLDiagInv, d->map_idof2dof, nidof);
|
mju_gather(d->iLDiagInv, d->qLDiagInv, d->map_idof2dof, nidof);
|
||||||
|
|
||||||
// compute iM_diagnum (dof_simplenum per island)
|
|
||||||
int count = 0;
|
|
||||||
int dof_next = d->map_idof2dof[nidof-1];
|
|
||||||
for (int i=nidof-1; i >= 0; i--) {
|
|
||||||
// check if island boundary was crossed
|
|
||||||
int dof = d->map_idof2dof[i];
|
|
||||||
int island_boundary = (d->dof_island[dof] != d->dof_island[dof_next]);
|
|
||||||
dof_next = dof;
|
|
||||||
|
|
||||||
// accumulate and set simple dof (diagonal row) counter
|
|
||||||
if (m->dof_simplenum[dof] && !island_boundary) {
|
|
||||||
count++; // increment counter
|
|
||||||
} else {
|
|
||||||
count = 0; // reset
|
|
||||||
}
|
|
||||||
d->iM_diagnum[i] = count;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------- constraints ---------------------------------------------
|
// ------------------------------------- constraints ---------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -786,7 +786,6 @@ struct _mjCGContext {
|
|||||||
// inertia
|
// inertia
|
||||||
const int* M_rownnz;
|
const int* M_rownnz;
|
||||||
const int* M_rowadr;
|
const int* M_rowadr;
|
||||||
const int* M_diagnum;
|
|
||||||
const int* M_colind;
|
const int* M_colind;
|
||||||
const mjtNum* M;
|
const mjtNum* M;
|
||||||
const mjtNum* qLD;
|
const mjtNum* qLD;
|
||||||
@@ -888,7 +887,6 @@ static void CGpointers(const mjModel* m, const mjData* d, mjCGContext* ctx, int
|
|||||||
// inertia
|
// inertia
|
||||||
ctx->M_rownnz = d->M_rownnz;
|
ctx->M_rownnz = d->M_rownnz;
|
||||||
ctx->M_rowadr = d->M_rowadr;
|
ctx->M_rowadr = d->M_rowadr;
|
||||||
ctx->M_diagnum = m->dof_simplenum;
|
|
||||||
ctx->M_colind = d->M_colind;
|
ctx->M_colind = d->M_colind;
|
||||||
ctx->M = d->M;
|
ctx->M = d->M;
|
||||||
ctx->qLD = d->qLD;
|
ctx->qLD = d->qLD;
|
||||||
@@ -937,7 +935,6 @@ static void CGpointers(const mjModel* m, const mjData* d, mjCGContext* ctx, int
|
|||||||
// inertia
|
// inertia
|
||||||
ctx->M_rownnz = d->iM_rownnz + idofadr;
|
ctx->M_rownnz = d->iM_rownnz + idofadr;
|
||||||
ctx->M_rowadr = d->iM_rowadr + idofadr;
|
ctx->M_rowadr = d->iM_rowadr + idofadr;
|
||||||
ctx->M_diagnum = d->iM_diagnum + idofadr;
|
|
||||||
ctx->M_colind = d->iM_colind;
|
ctx->M_colind = d->iM_colind;
|
||||||
ctx->M = d->iM;
|
ctx->M = d->iM;
|
||||||
ctx->qLD = d->iLD;
|
ctx->qLD = d->iLD;
|
||||||
|
|||||||
@@ -5004,7 +5004,6 @@ public unsafe struct mjData_ {
|
|||||||
public double* iacc_smooth;
|
public double* iacc_smooth;
|
||||||
public int* iM_rownnz;
|
public int* iM_rownnz;
|
||||||
public int* iM_rowadr;
|
public int* iM_rowadr;
|
||||||
public int* iM_diagnum;
|
|
||||||
public int* iM_colind;
|
public int* iM_colind;
|
||||||
public double* iM;
|
public double* iM;
|
||||||
public double* iLD;
|
public double* iLD;
|
||||||
|
|||||||
Reference in New Issue
Block a user