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 pointerspull/1159/head
parent
2f31673708
commit
3ba40230dd
|
@ -48,8 +48,8 @@ bool System::WriteJacobian(int tag) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mat.eq[i] = e.h;
|
mat.eq[i] = e.h;
|
||||||
Expr *f = e.e->DeepCopyWithParamsAsPointers(¶m, &(SK.param));
|
Expr *f = e.e->FoldConstants();
|
||||||
f = f->FoldConstants();
|
f = f->DeepCopyWithParamsAsPointers(¶m, &(SK.param));
|
||||||
|
|
||||||
for(j = 0; j < mat.n; j++) {
|
for(j = 0; j < mat.n; j++) {
|
||||||
mat.A.sym[i][j] = zero;
|
mat.A.sym[i][j] = zero;
|
||||||
|
@ -63,7 +63,6 @@ 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();
|
||||||
pd = pd->DeepCopyWithParamsAsPointers(¶m, &(SK.param));
|
|
||||||
mat.A.sym[i][j->second] = pd;
|
mat.A.sym[i][j->second] = pd;
|
||||||
}
|
}
|
||||||
paramsUsed.Clear();
|
paramsUsed.Clear();
|
||||||
|
|
Loading…
Reference in New Issue