Ian Jauslin
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jauslin <ian@jauslin.org>2022-06-14 09:26:07 +0200
committerIan Jauslin <ian@jauslin.org>2022-06-14 09:46:36 +0200
commit3f0510629e422e979b57d3f93791937912a4183a (patch)
treebf2589b2689044261b0cd4d9e6b3082194fdd9e9 /src/kondo.c
parent469bdc80712dbf9c12562059dc4594620b59a076 (diff)
Update to v1.5.HEADmaster
The update to version 1.5 is rather substantial, and introduces some minor backward-incompatibilities: * The header "#!symbols" has been replaced by "#!virtual_fields" * Multiplying polynomials using the '*' symbol is no longer supported (or, rather, the symbolic capabilities of meankondo were enhanced, and the syntax has been changed). * 'meantools exp' has been removed (its functionality is now handled by other means) * 'meantoolds derive' has been replaced by 'meantools differentiate' * The symbolic capabilities were enhanced: polynomials can now be multiplied, added, exponentiated, and their logarithms can be taken directly in the configuration file. * The flow equation can now be processed after being computed using the various "#!postprocess_*" entries. * Deprecated kondo_preprocess. * Compute the mean using an LU decomposition if possible. * More detailed checks for syntax errors in configuration file. * Check that different '#!group' entries are indeed uncorrelated. * New flags in meankondo: '-p' and '-A'. * New tool: meantools expand. * Improve conversion to LaTeX using meantools-convert * Assign terms randomly to different threads. * Created vim files to implement syntax highlighting for configuration files. * Multiple bug fixes
Diffstat (limited to 'src/kondo.c')
-rw-r--r--src/kondo.c69
1 files changed, 37 insertions, 32 deletions
diff --git a/src/kondo.c b/src/kondo.c
index 79b7c56..93318d5 100644
--- a/src/kondo.c
+++ b/src/kondo.c
@@ -1,5 +1,5 @@
/*
-Copyright 2015 Ian Jauslin
+Copyright 2015-2022 Ian Jauslin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ limitations under the License.
#define KONDO_SPIN 2
// offsets for indices of A, B, h and t
-// order matters for symbols table
+// order matters for virtual_fields table
#define KONDO_A_OFFSET 1
#define KONDO_B_OFFSET 2
#define KONDO_H_OFFSET 3
@@ -72,6 +72,7 @@ limitations under the License.
int kondo_generate_conf(Str_Array* str_args, int box_count){
Str_Array new_args;
Fields_Table fields;
+ Variables variables;
Char_Array tmp_str;
int arg_index;
int i;
@@ -83,16 +84,19 @@ int kondo_generate_conf(Str_Array* str_args, int box_count){
kondo_fields_table(box_count, &tmp_str, &fields);
str_array_append_noinit(tmp_str, &new_args);
- // symbols
- kondo_symbols(&tmp_str, box_count, &fields);
- arg_index=find_str_arg("symbols", *str_args);
+ // dummy variables
+ init_Variables(&variables,1);
+
+ // virtual fields
+ kondo_virtual_fields(&tmp_str, box_count, &fields);
+ arg_index=find_str_arg("virtual_fields", *str_args);
if(arg_index>=0){
if(tmp_str.length>0){
char_array_snprintf(&tmp_str,",\n");
}
char_array_concat((*str_args).strs[arg_index], &tmp_str);
}
- parse_input_symbols(tmp_str, &fields);
+ parse_input_virtual_fields(tmp_str, &fields, variables);
str_array_append_noinit(tmp_str, &new_args);
// identities
@@ -104,7 +108,7 @@ int kondo_generate_conf(Str_Array* str_args, int box_count){
}
char_array_concat((*str_args).strs[arg_index], &tmp_str);
}
- parse_input_identities(tmp_str, &fields);
+ parse_input_identities(tmp_str, &fields, variables);
str_array_append_noinit(tmp_str, &new_args);
// groups
@@ -136,7 +140,7 @@ int kondo_generate_conf(Str_Array* str_args, int box_count){
// copy remaining entries
for(i=0;i<(*str_args).length;i++){
get_str_arg_title((*str_args).strs[i], &title);
- if(str_cmp(title.str, "symbols")==0 &&\
+ if(str_cmp(title.str, "virtual_fields")==0 &&\
str_cmp(title.str, "identities")==0 &&\
str_cmp(title.str, "propagator")==0 &&\
str_cmp(title.str, "input_polynomial")==0 &&\
@@ -149,6 +153,7 @@ int kondo_generate_conf(Str_Array* str_args, int box_count){
}
free_Fields_Table(fields);
+ free_Variables(variables);
free_Str_Array(*str_args);
*str_args=new_args;
@@ -250,15 +255,15 @@ int kondo_fields_table(int box_count, Char_Array* str_fields, Fields_Table* fiel
}
-// generate Kondo symbols
-int kondo_symbols(Char_Array* str_symbols, int box_count, Fields_Table* fields){
+// generate Kondo virtual_fields
+int kondo_virtual_fields(Char_Array* str_virtual_fields, int box_count, Fields_Table* fields){
int i,j,k,l;
Char_Array tmp_str;
Polynomial poly;
char letters[3]={'A','B','h'};
- init_Char_Array(str_symbols, STR_SIZE);
- char_array_snprintf(str_symbols, "#!symbols\n");
+ init_Char_Array(str_virtual_fields, STR_SIZE);
+ char_array_snprintf(str_virtual_fields, "#!virtual_fields\n");
// loop over box index
for(i=1;i<=box_count;i++){
@@ -267,7 +272,7 @@ int kondo_symbols(Char_Array* str_symbols, int box_count, Fields_Table* fields){
// loop over space dimension
for(k=0;k<KONDO_DIM;k++){
// write index
- char_array_snprintf(str_symbols, "%d=", 100*(10*(KONDO_A_OFFSET+j)+k)+i);
+ char_array_snprintf(str_virtual_fields, "%d=", 100*(10*(KONDO_A_OFFSET+j)+k)+i);
// write the name of the scalar product
init_Char_Array(&tmp_str, 6);
char_array_snprintf(&tmp_str, "%c%d%d", letters[j], k, i);
@@ -275,10 +280,10 @@ int kondo_symbols(Char_Array* str_symbols, int box_count, Fields_Table* fields){
kondo_resolve_ABht(tmp_str.str, &poly, *fields);
free_Char_Array(tmp_str);
// write to output
- polynomial_sprint(poly, str_symbols);
+ polynomial_sprint(poly, str_virtual_fields);
free_Polynomial(poly);
// add ,
- char_array_snprintf(str_symbols,",\n");
+ char_array_snprintf(str_virtual_fields,",\n");
}
}
}
@@ -290,46 +295,46 @@ int kondo_symbols(Char_Array* str_symbols, int box_count, Fields_Table* fields){
for(j=0;j<3;j++){
for(k=0;k<3;k++){
// write index
- char_array_snprintf(str_symbols, "%d=", 1000*(10*(KONDO_A_OFFSET+j)+KONDO_A_OFFSET+k)+i);
+ char_array_snprintf(str_virtual_fields, "%d=", 1000*(10*(KONDO_A_OFFSET+j)+KONDO_A_OFFSET+k)+i);
for(l=0;l<KONDO_DIM;l++){
- char_array_snprintf(str_symbols, "(1)");
+ char_array_snprintf(str_virtual_fields, "(1)");
if(j<2){
- char_array_snprintf(str_symbols,"[f%d]", 100*(10*(KONDO_A_OFFSET+j)+l)+i);
+ char_array_snprintf(str_virtual_fields,"[f%d]", 100*(10*(KONDO_A_OFFSET+j)+l)+i);
}
else{
- char_array_snprintf(str_symbols,"[f%d]", 10*(10*(KONDO_A_OFFSET+j)+l));
+ char_array_snprintf(str_virtual_fields,"[f%d]", 10*(10*(KONDO_A_OFFSET+j)+l));
}
if(k<2){
- char_array_snprintf(str_symbols,"[f%d]", 100*(10*(KONDO_A_OFFSET+k)+l)+i);
+ char_array_snprintf(str_virtual_fields,"[f%d]", 100*(10*(KONDO_A_OFFSET+k)+l)+i);
}
else{
- char_array_snprintf(str_symbols,"[f%d]", 10*(10*(KONDO_A_OFFSET+k)+l));
+ char_array_snprintf(str_virtual_fields,"[f%d]", 10*(10*(KONDO_A_OFFSET+k)+l));
}
if(l<KONDO_DIM-1){
- char_array_append('+',str_symbols);
+ char_array_append('+',str_virtual_fields);
}
}
// add ,
- char_array_snprintf(str_symbols,",\n");
+ char_array_snprintf(str_virtual_fields,",\n");
}
}
}
// vector products
for(i=1;i<=box_count;i++){
- char_array_snprintf(str_symbols, "%d=", 100*(100*(KONDO_A_OFFSET)+10*KONDO_B_OFFSET+KONDO_H_OFFSET)+i);
+ char_array_snprintf(str_virtual_fields, "%d=", 100*(100*(KONDO_A_OFFSET)+10*KONDO_B_OFFSET+KONDO_H_OFFSET)+i);
for(l=0;l<KONDO_DIM;l++){
// remember (-1 %3 = -1)
- char_array_snprintf(str_symbols, "(1)[f%d][f%d][f%d]+(-1)[f%d][f%d][f%d]", 100*(10*KONDO_A_OFFSET+((l+1)%KONDO_DIM))+i, 100*(10*KONDO_B_OFFSET+((l+2)%KONDO_DIM))+i, 10*(10*KONDO_H_OFFSET+l), 100*(10*KONDO_A_OFFSET+((l+2)%KONDO_DIM))+i, 100*(10*KONDO_B_OFFSET+((l+1)%KONDO_DIM))+i, 10*(10*KONDO_H_OFFSET+l));
+ char_array_snprintf(str_virtual_fields, "(1)[f%d][f%d][f%d]+(-1)[f%d][f%d][f%d]", 100*(10*KONDO_A_OFFSET+((l+1)%KONDO_DIM))+i, 100*(10*KONDO_B_OFFSET+((l+2)%KONDO_DIM))+i, 10*(10*KONDO_H_OFFSET+l), 100*(10*KONDO_A_OFFSET+((l+2)%KONDO_DIM))+i, 100*(10*KONDO_B_OFFSET+((l+1)%KONDO_DIM))+i, 10*(10*KONDO_H_OFFSET+l));
if(l<KONDO_DIM-1){
- char_array_append('+',str_symbols);
+ char_array_append('+',str_virtual_fields);
}
}
// add ,
if(i<box_count){
- char_array_snprintf(str_symbols,",\n");
+ char_array_snprintf(str_virtual_fields,",\n");
}
}
@@ -778,13 +783,13 @@ int parse_kondo_polynomial_str(char* str_polynomial, Polynomial* output, Fields_
// if polynomial exists, add to each monomial
if(tmp_poly.length>0){
for(i=0;i<tmp_poly.length;i++){
- int_array_append(get_symbol_index(buffer), tmp_poly.monomials+i);
+ int_array_append(get_virtual_field_index(buffer), tmp_poly.monomials+i);
}
}
// if not, create a new term in the polynomial
else{
init_Int_Array(&tmp_monomial, MONOMIAL_SIZE);
- int_array_append(get_symbol_index(buffer), &tmp_monomial);
+ int_array_append(get_virtual_field_index(buffer), &tmp_monomial);
init_Int_Array(&dummy_factor, 1);
polynomial_append_noinit(tmp_monomial, dummy_factor, number_one(), &tmp_poly);
}
@@ -1387,8 +1392,8 @@ int get_offsets_index(char* str, int* offset1, int* offset2, int* index){
return(0);
}
-// get the index of the symbol corresponding to a given string
-int get_symbol_index(char* str){
+// get the index of the virtual_field corresponding to a given string
+int get_virtual_field_index(char* str){
char* ptr;
int offset=-1;
int index=0;
@@ -1439,7 +1444,7 @@ int get_symbol_index(char* str){
if(offset==-1){
return(-1);
}
- // no symbol for h or t
+ // no virtual field for h or t
if(offset==KONDO_H_OFFSET || offset==KONDO_T_OFFSET){
return(10*(10*offset+dim));
}