replace empty sparse calls with spzeros

issue#70
Houtan Bastani 2015-08-19 17:12:06 +02:00
parent 22f409af4f
commit a10efd7c4b
2 changed files with 4 additions and 4 deletions

View File

@ -2373,7 +2373,7 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia
<< hessian_output.str()
<< " g2 = sparse(v2(:,1),v2(:,2),v2(:,3)," << nrows << "," << hessianColsNbr << ");" << endl;
else // Either hessian is all zero, or we didn't compute it
DynamicOutput << " g2 = sparse([],[],[]," << nrows << "," << hessianColsNbr << ");" << endl;
DynamicOutput << " g2 = spzeros(" << nrows << "," << hessianColsNbr << ")" << endl;
// Initialize g3 matrix
DynamicOutput << "end" << endl << endl
@ -2393,7 +2393,7 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia
<< third_derivatives_output.str()
<< " g3 = sparse(v3(:,1),v3(:,2),v3(:,3)," << nrows << "," << ncols << ");" << endl;
else // Either 3rd derivatives is all zero, or we didn't compute it
DynamicOutput << " g3 = sparse([],[],[]," << nrows << "," << ncols << ");" << endl;
DynamicOutput << " g3 = spzeros(" << nrows << "," << ncols << ")" << endl;
DynamicOutput << "end" << endl;
}
}

View File

@ -1449,7 +1449,7 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
<< " g2 = sparse(v2(:,1),v2(:,2),v2(:,3)," << equations.size() << ","
<< g2ncols << ");" << endl;
else
StaticOutput << " g2 = sparse([],[],[]," << equations.size() << "," << g2ncols << ");" << endl;
StaticOutput << " g2 = spzeros(" << equations.size() << "," << g2ncols << ")" << endl;
// Initialize g3 matrix
StaticOutput << "end" << endl << endl
@ -1471,7 +1471,7 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
<< " g3 = sparse(v3(:,1),v3(:,2),v3(:,3)," << nrows << "," << ncols << ");"
<< endl;
else // Either 3rd derivatives is all zero, or we didn't compute it
StaticOutput << " g3 = sparse([],[],[]," << nrows << "," << ncols << ");" << endl;
StaticOutput << " g3 = spzeros(" << nrows << "," << ncols << ")" << endl;
StaticOutput << "end" << endl;
}
}