Some optimization

1. We are making FoldConstants first, so we are copying less amount of data in DeepCopyWithParamsAsPointers.
2. Since we already perform DeepCopyWithParamsAsPointers, PartialWrt already produces params as pointers
This commit is contained in:
EvilSpirit 2017-05-12 10:02:33 +07:00 committed by phkahler
parent 2f31673708
commit 3ba40230dd

View File

@ -48,8 +48,8 @@ bool System::WriteJacobian(int tag) {
continue;
mat.eq[i] = e.h;
Expr *f = e.e->DeepCopyWithParamsAsPointers(&param, &(SK.param));
f = f->FoldConstants();
Expr *f = e.e->FoldConstants();
f = f->DeepCopyWithParamsAsPointers(&param, &(SK.param));
for(j = 0; j < mat.n; j++) {
mat.A.sym[i][j] = zero;
@ -63,7 +63,6 @@ bool System::WriteJacobian(int tag) {
if(j == paramToIndex.end()) continue;
Expr *pd = f->PartialWrt(p);
pd = pd->FoldConstants();
pd = pd->DeepCopyWithParamsAsPointers(&param, &(SK.param));
mat.A.sym[i][j->second] = pd;
}
paramsUsed.Clear();