Sector decomposition
code_generation.h
Go to the documentation of this file.
1
8#ifndef __GINAC_CODE_GENERATION_H__
9#define __GINAC_CODE_GENERATION_H__
10
11#include <iostream>
12#include <string>
13
14#include "ginac/ex.h"
15#include "ginac/lst.h"
16
17namespace GiNaC {
18
25 class subex_type {
26 public:
27 enum {
28 add = 0x00000001,
29 mul = 0x00000002,
30 power = 0x00000004,
31 function = 0x00000008,
32 all = 0xFFFFFFFF
33 };
34 };
35
80 class assign_lst {
81
82 public:
83 assign_lst(const std::string & T, const std::string & temp_var_base_name);
84 assign_lst(const std::string & T, const std::string & temp_var_base_name, const lst & lhs, const lst & rhs);
85
86 public:
87 void append(const ex & a, const ex & b);
88 void prepend(const ex & a, const ex & b);
89 void replace_common_subex(unsigned flag_type = subex_type::all);
90 void split_large_subex(size_t nmax);
91 void print(std::ostream & os) const;
92 ex get_temporary_variables() const;
93
94 private:
95 std::string itos(int arg) const;
96 bool check_substitution_type(const ex & expr, unsigned flag_type) const;
97 bool check_large_subex(const ex & expr, size_t max_nops, lst & subexpr_lst) const;
98 void split_large_line(const ex & a, const ex & b, lst & new_lhs_lst, lst & new_rhs_lst, size_t max_nops);
99
100 public:
101 // I/O operators
102 friend std::ostream & operator<< (std::ostream & os, const assign_lst & arg);
103
104
105 private:
107 ex lhs;
109 ex rhs;
110
112 std::string T;
115
117 std::vector<symbol> temp_var;
118 };
119
120 std::ostream & operator<< (std::ostream & os, const assign_lst & arg);
121
122} // namespace GiNaC
123
124#endif // ndef __GINAC_CODE_GENERATION_H__
125
Definition: code_generation.h:80
void split_large_line(const ex &a, const ex &b, lst &new_lhs_lst, lst &new_rhs_lst, size_t max_nops)
Definition: code_generation.cc:322
void split_large_subex(size_t nmax)
Definition: code_generation.cc:202
std::string temp_var_base_name
string used as a base for labelling temporary variables.
Definition: code_generation.h:114
std::vector< symbol > temp_var
vector holding intermediate variables, used internally.
Definition: code_generation.h:117
friend std::ostream & operator<<(std::ostream &os, const assign_lst &arg)
Definition: code_generation.cc:438
void prepend(const ex &a, const ex &b)
Definition: code_generation.cc:65
std::string T
string giving the data type in C of the expressions, usually something like "double" or "float".
Definition: code_generation.h:112
std::string itos(int arg) const
Definition: code_generation.cc:225
ex lhs
a list containing the l.h.s. of the assignment list
Definition: code_generation.h:107
bool check_large_subex(const ex &expr, size_t max_nops, lst &subexpr_lst) const
Definition: code_generation.cc:259
ex get_temporary_variables() const
Definition: code_generation.cc:387
void append(const ex &a, const ex &b)
Definition: code_generation.cc:49
ex rhs
a list containing the r.h.s. of the assignment list
Definition: code_generation.h:109
void print(std::ostream &os) const
Definition: code_generation.cc:402
void replace_common_subex(unsigned flag_type=subex_type::all)
Definition: code_generation.cc:85
bool check_substitution_type(const ex &expr, unsigned flag_type) const
Definition: code_generation.cc:240
Definition: code_generation.h:25