/** * Returns the "global" index of an active parameter. * @param i :: The index of an active parameter * @return the global index of the requested parameter */ size_t ParamFunction::indexOfActive(size_t i)const { if (i >= nActive()) throw std::out_of_range("ParamFunction parameter index out of range."); return m_indexMap[i]; }
bool GenSetBase::generateAllActive(Matrix& M, ColumnVector& X, double D){ if (Size<=0 || Vdim<=0 || nActive()<=0) { cerr << "***ERROR: GenSetBase::generateAllActive(Matrix,...) " << "called with size=" << Size << ", vdim=" << Vdim << " nActive = " << nActive() << endl; return false; } if (M.Ncols() != nActive() || M.Nrows() != Vdim ) { cerr << "***ERROR: GenSetBase::generateAllActive(Matrix,...) " << "dimesion of M expected to be " << Vdim << "-by-" << nActive() << " but is " << M.Nrows() << "-by-" << M.Ncols() << endl; return false; } ColumnVector xi(Vdim); for (int i=1; i<=nActive(); i++) { generateActive(i, D, X, xi); M.Column(i) = xi; } return true; }
/** Makes a parameter active again. It doesn't change the parameter's tie. * @param i :: A declared parameter index to be restored to active */ void ParamFunction::restoreActive(size_t i) { if (i >= nParams()) throw std::out_of_range("ParamFunction parameter index out of range."); if (nParams() == nActive()) return; std::vector<size_t >::iterator it = std::find_if(m_indexMap.begin(),m_indexMap.end(),std::bind2nd(std::greater<size_t>(),i)); if (it != m_indexMap.end()) { m_indexMap.insert(it,i); } else { m_indexMap.push_back(i); } }