/// Return a Histogram based on previously set information. Throws if /// information is incomplete are inconsisten. Histogram HistogramBuilder::build() const { if (!m_x) throw std::runtime_error("HistogramBuilder: No X data has been set"); if (!m_y) throw std::runtime_error("HistogramBuilder: No Y data has been set"); std::unique_ptr<Histogram> histogram; if (getHistogramXMode(m_x->size(), m_y->size()) == Histogram::XMode::BinEdges) { if (m_isDistribution) histogram = Kernel::make_unique<Histogram>(BinEdges(m_x), Frequencies(m_y)); else histogram = Kernel::make_unique<Histogram>(BinEdges(m_x), Counts(m_y)); } else { if (m_isDistribution) histogram = Kernel::make_unique<Histogram>(Points(m_x), Frequencies(m_y)); else histogram = Kernel::make_unique<Histogram>(Points(m_x), Counts(m_y)); } if (m_e) histogram->setSharedE(m_e); return *histogram; }
string generateLowPattern(int patternLenght, char * text){ shiftTableT frequencies; char * pattern; int i; int * frequenciesTemp; frequencies = Frequencies(text); pattern = NewArray(patternLenght + 1, char); frequenciesTemp = NewArray(StringLength(frequencies->alphabet), int); for (i = 0; i < StringLength(frequencies->alphabet); i++){ frequenciesTemp[i] = frequencies->shift[i]; } for (i = 0; i < patternLenght; i++){ pattern[i] = frequencies->alphabet[minArr(frequenciesTemp, StringLength(frequencies->alphabet))]; } pattern[i] = '\0'; return pattern; }