Ian Jauslin
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jauslin <ian.jauslin@roma1.infn.it>2015-06-14 00:52:45 +0000
committerIan Jauslin <ian.jauslin@roma1.infn.it>2015-06-14 00:52:45 +0000
commitaa0f3ae2988d372b190b9bde2e75a6d17e744e93 (patch)
tree14482245c2fca27fcdad3078e97d0871352d52a7 /src/grouped_polynomial.h
Initial commitv1.2
Diffstat (limited to 'src/grouped_polynomial.h')
-rw-r--r--src/grouped_polynomial.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/grouped_polynomial.h b/src/grouped_polynomial.h
new file mode 100644
index 0000000..3c38f1b
--- /dev/null
+++ b/src/grouped_polynomial.h
@@ -0,0 +1,74 @@
+/*
+Copyright 2015 Ian Jauslin
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+/*
+Polynomials can be represented in a grouped way, by putting the terms
+ proportional to the same monomial together.
+
+The main part of a grouped polynomial is the list of coefficients,
+ each of which stands for the set of terms proportional to the
+ corresponding monomial, specified in indices and labels.
+
+*/
+
+#ifndef GROUPED_POLYNOMIAL_H
+#define GROUPED_POLYNOMIAL_H
+
+#include "types.h"
+
+// memory
+int init_Grouped_Polynomial(Grouped_Polynomial* gpolynomial, int size);
+int free_Grouped_Polynomial(Grouped_Polynomial gpolynomial);
+
+// resize the memory allocated to a grouped polynomial
+int resize_grouped_polynomial(Grouped_Polynomial* grouped_polynomial,int new_size);
+
+// copy a grouped polynomial
+int grouped_polynomial_cpy(Grouped_Polynomial input, Grouped_Polynomial* output);
+int grouped_polynomial_cpy_noinit(Grouped_Polynomial input, Grouped_Polynomial* output);
+
+// append an element to a polynomial
+int grouped_polynomial_append(int index, Coefficient coef, Grouped_Polynomial* output);
+int grouped_polynomial_append_noinit(int index, Coefficient coef, Grouped_Polynomial* output);
+
+// concatenate two polynomials
+int grouped_polynomial_concat(Grouped_Polynomial input, Grouped_Polynomial* output);
+int grouped_polynomial_concat_noinit(Grouped_Polynomial input, Grouped_Polynomial* output);
+
+// construct a grouped polynomial from a polynomial, grouping together the terms specified in the id table.
+int group_polynomial(Polynomial polynomial, Grouped_Polynomial* grouped_polynomial, Id_Table idtable, Fields_Table fields);
+// more naive and faster version in which the terms in polynomial corresponding to a polynomial in the id table are grouped together (does not allow parts of terms to be grouped together)
+int group_polynomial_pickandchoose(Polynomial polynomial, Grouped_Polynomial* grouped_polynomial, Id_Table idtable);
+
+// find the entry in the idtable containing monomial
+int find_id(Int_Array monomial, Id_Table idtable, int start);
+
+// simplify grouped polynomial
+int simplify_grouped_polynomial(Grouped_Polynomial* polynomial);
+
+// derive a flow equation with respect to an unknown variable
+int flow_equation_derivx(Grouped_Polynomial flow_equation, Int_Array indices, Grouped_Polynomial* dflow);
+
+// print a grouped polynomial
+int grouped_polynomial_print(Grouped_Polynomial grouped_polynomial, char lhs_pre, char rhs_pre);
+
+// read from string
+int char_array_to_Grouped_Polynomial(Char_Array str, Grouped_Polynomial* output);
+
+// evaluate an equation on an RCC
+int evaleq(RCC* rccs, Grouped_Polynomial poly);
+
+#endif