Add an early out in writing jacobian.

Split from previous large 'Eigen library integration' commit.
pull/1159/head
EvilSpirit 2021-12-23 10:14:27 -06:00 committed by phkahler
parent aec46b608e
commit e528fabbe4
1 changed files with 2 additions and 0 deletions

View File

@ -63,6 +63,8 @@ bool System::WriteJacobian(int tag) {
if(j == paramToIndex.end()) continue; if(j == paramToIndex.end()) continue;
Expr *pd = f->PartialWrt(p); Expr *pd = f->PartialWrt(p);
pd = pd->FoldConstants(); pd = pd->FoldConstants();
if(pd->IsZeroConst())
continue;
mat.A.sym[i][j->second] = pd; mat.A.sym[i][j->second] = pd;
} }
paramsUsed.Clear(); paramsUsed.Clear();