Ian Jauslin
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/meantools_deriv.c')
-rw-r--r--src/meantools_deriv.c42
1 files changed, 39 insertions, 3 deletions
diff --git a/src/meantools_deriv.c b/src/meantools_deriv.c
index 28d8641..b096380 100644
--- a/src/meantools_deriv.c
+++ b/src/meantools_deriv.c
@@ -46,6 +46,8 @@ int tool_deriv_read_args(int argc, const char* argv[], Str_Array* str_args, Mean
(*opts).deriv_derivs=1;
// derive with respect to all variables
(*opts).deriv_vars.length=-1;
+ // do not chain
+ (*opts).chain=0;
// loop over arguments
@@ -61,6 +63,10 @@ int tool_deriv_read_args(int argc, const char* argv[], Str_Array* str_args, Mean
case 'V':
flag=CP_FLAG_VARS;
break;
+ // chain
+ case 'C':
+ (*opts).chain=1;
+ break;
}
}
}
@@ -104,6 +110,8 @@ int tool_deriv(Str_Array str_args, Meantools_Options opts){
// flow equation for the derivatives
Grouped_Polynomial flow_equation_deriv;
int i;
+ // header of the entry
+ Char_Array arg_header;
// parse flow equation
@@ -142,6 +150,29 @@ int tool_deriv(Str_Array str_args, Meantools_Options opts){
// compute derivatives
flow_equation_derivative(opts.deriv_derivs, opts.deriv_vars, flow_equation, &flow_equation_deriv);
+ // print
+ // if chain then print config file
+ if(opts.chain==1){
+ for(i=0;i<str_args.length;i++){
+ // check whether to print the str_arg
+ get_str_arg_title(str_args.strs[i], &arg_header);
+ if (\
+ str_cmp(arg_header.str, "flow_equation")==0 &&\
+ str_cmp(arg_header.str, "symbols")==0 &&\
+ str_cmp(arg_header.str, "groups")==0 &&\
+ str_cmp(arg_header.str, "fields")==0 &&\
+ str_cmp(arg_header.str, "identities")==0 &&\
+ str_cmp(arg_header.str, "propagator")==0 &&\
+ str_cmp(arg_header.str, "input_polynomial")==0 &&\
+ str_cmp(arg_header.str, "id_table")==0 ){
+
+ printf("%s\n&\n",str_args.strs[i].str);
+ }
+ free_Char_Array(arg_header);
+ }
+ // print flow equation
+ printf("#!flow_equation\n");
+ }
grouped_polynomial_print(flow_equation_deriv,'%','%');
// free memory
@@ -164,12 +195,17 @@ int flow_equation_derivative(int n, Int_Array variables, Grouped_Polynomial flow
// output polynomial
grouped_polynomial_cpy(flow_equation, flow_equation_derivs);
- for(j=0,dflow=flow_equation;j<n;j++){
+ // init dflow to flow_equation
+ grouped_polynomial_cpy(flow_equation, &dflow);
+
+ for(j=0;j<n;j++){
// tmp flow contains the result of the previous derivative
grouped_polynomial_cpy(dflow, &tmpflow);
- // derive
+ // free dflow
+ free_Grouped_Polynomial(dflow);
+ // next derivative
flow_equation_derivx(tmpflow, indices, &dflow);
- // free
+ // free tmpflow
free_Grouped_Polynomial(tmpflow);
// add the derived indices as variables for the next derivative