void ParameterStudyAlgorithmOptions_Impl::setListOfPoints(const std::vector<double>& value) { Attribute option = createAttributeFromVector("listOfPoints",value); if (OptionalAttribute currentOption = getOption("listOfPoints")) { currentOption->setValue(option.valueAsAttributeVector()); } else { saveOption(option); } }
bool HistogramPointDistribution::setAbscissas(const std::vector<double>& value) { for(std::vector<double>::size_type i = 1; i != value.size(); i++) { double previousValue = value[i-1]; double currentValue = value[i]; if (previousValue >= currentValue) { LOG(Warn,"Abscissas values must be strictly increasing."); return false; } } impl()->setAttribute(createAttributeFromVector("abscissas",value),false); return true; }
bool HistogramPointDistribution::setCounts(const std::vector<double>& value) { double minValue = *std::min_element(value.begin(), value.end()); if (minValue <= 0) { LOG(Warn,"All values of counts must be positive."); return false; } else { impl()->setAttribute(createAttributeFromVector("counts",value),false); int numPairs = value.size(); impl()->setAttribute(Attribute("num_pairs",numPairs),false); return true; } }
bool ParameterStudyAlgorithmOptions_Impl::setPartitions(const std::vector<int>& value) { int minValue = *std::min_element(value.begin(), value.end()); if (minValue < 0) { LOG(Warn,"Cannot set ParameterStudyAlgorithmOptions partitions to a value less than zero."); return false; } Attribute option = createAttributeFromVector("partitions",value); if (OptionalAttribute currentOption = getOption("partitions")) { currentOption->setValue(option.valueAsAttributeVector()); } else { saveOption(option); } return true; }
bool HistogramBinDistribution::setCounts(const std::vector<double>& value) { int minValue = *std::min_element(value.begin(), value.end() - 1); if (value.back() != 0.0) { LOG(Warn,"The last value of counts must be zero."); return false; } else if (minValue < 0) { LOG(Warn,"All values of counts must be positive (except for the last value, which should be zero)."); return false; } else { impl()->setAttribute(createAttributeFromVector("counts",value),false); int numPairs = value.size(); impl()->setAttribute(Attribute("num_pairs",numPairs),false); resetOrdinates(); return true; } }