1 #ifndef CPPAD_CG_INDEX_PATTERN_IMPL_INCLUDED 2 #define CPPAD_CG_INDEX_PATTERN_IMPL_INCLUDED 21 template<
class VectorSizeT>
23 CPPADCG_ASSERT_UNKNOWN(x2y.size() > 0)
25 size_t maxCount = std::min<size_t>(std::max<size_t>(3ul, x2y.size() / 4), 8ul);
26 std::map<size_t, IndexPattern*> linearSections = SectionedIndexPattern::detectLinearSections(x2y, maxCount);
28 if (linearSections.size() == 1) {
29 return linearSections.begin()->second;
30 }
else if (!linearSections.empty()) {
39 CPPADCG_ASSERT_UNKNOWN(!x2y.empty())
41 size_t maxCount = std::min<size_t>(std::max<size_t>(3ul, x2y.size() / 4), 8ul);
42 std::map<size_t, IndexPattern*> linearSections = SectionedIndexPattern::detectLinearSections(x2y, maxCount);
44 if (linearSections.size() == 1) {
45 return linearSections.begin()->second;
46 }
else if (!linearSections.empty()) {
53 inline bool IndexPattern::isConstant(
const IndexPattern& ip) {
54 if (ip.getType() == IndexPatternType::Linear) {
56 return lip.getLinearSlopeDy() == 0;
static IndexPattern * detect(const VectorSizeT &x2y)