carl  24.04
Computer ARithmetic Library
katsura.h
Go to the documentation of this file.
1 /**
2  * @file katsura.h
3  * @author Sebastian Junges
4  *
5  */
6 
7 #pragma once
8 
9 #include <cassert>
11 #include <carl-io/StringParser.h>
12 
13 namespace carl
14 {
15 namespace benchmarks
16 {
17 
18 
19 
20 template<typename C, typename O, typename P>
21 std::vector<MultivariatePolynomial<C, O, P>> katsura2()
22 {
24  sp.setVariables({"x", "y"});
25  std::vector<MultivariatePolynomial<C, O, P>> res;
26  //x + 2*y - 1,
27  res.push_back(sp.parseMultivariatePolynomial<C, O, P>("x + 2*y + -1"));
28  //x^2 + 2*y^2 - x
29  res.push_back(sp.parseMultivariatePolynomial<C, O, P>("x^2 + 2*y^2 + -1*x"));
30  return res;
31 }
32 
33 template<typename C, typename O, typename P>
34 std::vector<MultivariatePolynomial<C, O, P>> katsura3()
35 {
37  sp.setVariables({"x", "y", "z"});
38  std::vector<MultivariatePolynomial<C, O, P>> res;
39  //x + 2*y + 2*z - 1,
40  res.push_back(sp.parseMultivariatePolynomial<C, O, P>("x + 2*y + 2*z + -1"));
41  //x^2 + 2*y^2 + 2*z^2 - x,
42  res.push_back(sp.parseMultivariatePolynomial<C, O, P>("x^2 + 2*y^2 + 2*z^2 + -1*x"));
43  //2*x*y + 2*y*z - y
44  res.push_back(sp.parseMultivariatePolynomial<C, O, P>("2*x*y + 2*y*z + -1*y"));
45  return res;
46 }
47 
48 
49 template<typename C, typename O, typename P>
50 std::vector<MultivariatePolynomial<C, O, P>> katsura4()
51 {
53  sp.setVariables({"x", "y", "z", "t"});
54  std::vector<MultivariatePolynomial<C, O, P>> res;
55  //x + 2*y + 2*z + 2*t - 1,
56  res.push_back(sp.parseMultivariatePolynomial<C, O, P>("x + 2*y + 2*z + 2*t + -1"));
57  //x^2 + 2*y^2 + 2*z^2 + 2*t^2 - x,
58  res.push_back(sp.parseMultivariatePolynomial<C, O, P>("x^2 + 2*y^2 + 2*z^2 + 2*t^2 + -1*x"));
59  //2*x*y + 2*y*z + 2*z*t - y,
60  res.push_back(sp.parseMultivariatePolynomial<C, O, P>("2*x*y + 2*y*z + 2*z*t + -1*y"));
61  //y^2 + 2*x*z + 2*y*t - z
62  res.push_back(sp.parseMultivariatePolynomial<C, O, P>("y^2 + 2*x*z + 2*y*t + -1*z"));
63  return res;
64 }
65 
66 
67 
68 template<typename C, typename O, typename P>
69 std::vector<MultivariatePolynomial<C, O, P>> katsura5()
70 {
72  sp.setVariables({"x", "y", "z", "t", "u"});
73  std::vector<MultivariatePolynomial<C, O, P>> res;
74  //x + 2*y + 2*z + 2*t + 2*u - 1,
75  res.push_back(sp.parseMultivariatePolynomial<C, O, P>("x + 2*y + 2*z + 2*t + 2*u + -1"));
76  //x^2 + 2*y^2 + 2*z^2 + 2*t^2 + 2*u^2 - x,
77  res.push_back(sp.parseMultivariatePolynomial<C, O, P>("x^2 + 2*y^2 + 2*z^2 + 2*t^2 + 2*u^2 + -1*x"));
78  //2*x*y + 2*y*z + 2*z*t + 2*t*u - y,
79  res.push_back(sp.parseMultivariatePolynomial<C, O, P>("2*x*y + 2*y*z + 2*z*t + 2*t*u + -1*y"));
80  //y^2 + 2*x*z + 2*y*t + 2*z*u - z,
81  res.push_back(sp.parseMultivariatePolynomial<C, O, P>("y^2 + 2*x*z + 2*y*t + 2*z*u + -1*z"));
82  //2*y*z + 2*x*t + 2*y*u - t
83  res.push_back(sp.parseMultivariatePolynomial<C, O, P>("2*y*z + 2*x*t + 2*y*u + -1*t"));
84  return res;
85 }
86 
87 
88 
89 
90 #define run_katsura_case(INDEX) case INDEX: return katsura##INDEX<C, O, P>()
91 
92 template<typename C, typename O, typename P>
93 std::vector<MultivariatePolynomial<C, O, P>> katsura(unsigned index)
94 {
95  switch(index)
96  {
100  run_katsura_case(5);
101  //run_katsura_case(6);
102  //run_katsura_case(4);
103  default:
104  assert(index > 1);
105  assert(index < 6);
106  }
107  return std::vector<MultivariatePolynomial<C, O, P>>();
108 }
109 
110 
111 }
112 }
#define run_katsura_case(INDEX)
Definition: katsura.h:90
carl is the main namespace for the library.
std::vector< MultivariatePolynomial< C, O, P > > katsura(unsigned index)
Definition: katsura.h:93
std::vector< MultivariatePolynomial< C, O, P > > katsura3()
Definition: katsura.h:34
std::vector< MultivariatePolynomial< C, O, P > > katsura4()
Definition: katsura.h:50
std::vector< MultivariatePolynomial< C, O, P > > katsura5()
Definition: katsura.h:69
std::vector< MultivariatePolynomial< C, O, P > > katsura2()
Definition: katsura.h:21
void setVariables(std::list< std::string > variables)
Definition: StringParser.h:90
MultivariatePolynomial< C, O, P > parseMultivariatePolynomial(const std::string &inputString) const
Definition: StringParser.h:160