Commit e9669ad6 authored by David Bommes's avatar David Bommes
Browse files

fixed sizing function

git-svn-id: http://www.openflipper.org/svnrepo/CoMISo/trunk@235 1355f012-dd97-4b2f-ae87-10fa9f823a57
parent a92180f4
......@@ -45,7 +45,22 @@ int LinearConstraint::n_unknowns()
void LinearConstraint::resize(const unsigned int _n)
{
coeffs_.resize(_n);
if(coeffs_.innerSize() != _n)
{
// resize while maintaining all values in range
SVectorNC coeffs_new(_n);
coeffs_new.setZero();
coeffs_new.reserve(coeffs_.nonZeros());
SVectorNC::InnerIterator it(coeffs_);
for(; it; ++it)
if(it.index() < SVectorNC::Index(_n))
coeffs_new.insertBack(it.index()) = it.value();
coeffs_.swap(coeffs_new);
// coeffs_.m_size = _n;
// coeffs_.resize(_n);
}
}
void LinearConstraint::clear()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment