Ian Jauslin
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jauslin <ian.jauslin@roma1.infn.it>2015-07-22 13:55:29 +0000
committerIan Jauslin <ian.jauslin@roma1.infn.it>2015-07-22 13:55:29 +0000
commitf13eacbc8e5ab714dd3544adab8189c313382c77 (patch)
treeefd35fca778e6e343206f48918898a8b4cda9977 /src/kondo.c
parent3b591888b5dad7cef02170743a92e2bf9c5831db (diff)
Support for non-commuting fieldsv1.3
Diffstat (limited to 'src/kondo.c')
-rw-r--r--src/kondo.c150
1 files changed, 73 insertions, 77 deletions
diff --git a/src/kondo.c b/src/kondo.c
index 39d74bb..79b7c56 100644
--- a/src/kondo.c
+++ b/src/kondo.c
@@ -29,16 +29,17 @@ limitations under the License.
#include "definitions.cpp"
#include "rational.h"
-// dimension of A, B and h (must be <10)
+// dimension of A, B, h and t (must be <10)
#define KONDO_DIM 3
// number of spin components
#define KONDO_SPIN 2
-// offsets for indices of A, B and h
+// offsets for indices of A, B, h and t
// order matters for symbols table
#define KONDO_A_OFFSET 1
#define KONDO_B_OFFSET 2
#define KONDO_H_OFFSET 3
+#define KONDO_T_OFFSET 4
// parsing modes (from parse_file.c)
#define PP_NULL_MODE 0
@@ -193,13 +194,19 @@ int kondo_fields_table(int box_count, Char_Array* str_fields, Fields_Table* fiel
// parameters
char_array_append_str("h:",str_fields);
+ // h
for(i=0;i<KONDO_DIM;i++){
- char_array_snprintf(str_fields, "%d", 10*(i+10*KONDO_H_OFFSET));
+ char_array_snprintf(str_fields, "%d,", 10*(i+10*KONDO_H_OFFSET));
+ }
+ // t
+ for(i=0;i<KONDO_DIM;i++){
+ char_array_snprintf(str_fields, "%d", 10*(i+10*KONDO_T_OFFSET));
if(i<KONDO_DIM-1){
- char_array_append(',',str_fields);
+ char_array_append(',', str_fields);
}
}
- char_array_append('\n',str_fields);
+ char_array_append('\n', str_fields);
+
// declare Fermions
char_array_append_str("f:",str_fields);
@@ -226,6 +233,16 @@ int kondo_fields_table(int box_count, Char_Array* str_fields, Fields_Table* fiel
}
char_array_append('\n',str_fields);
+ // declare noncommuting
+ char_array_append_str("a:",str_fields);
+ for(i=0;i<KONDO_DIM;i++){
+ char_array_snprintf(str_fields, "%d", 10*(i+10*KONDO_T_OFFSET));
+ if(i<KONDO_DIM-1){
+ char_array_append(',',str_fields);
+ }
+ }
+ char_array_append('\n', str_fields);
+
// parse fields table
parse_input_fields(*str_fields, fields);
@@ -245,7 +262,7 @@ int kondo_symbols(Char_Array* str_symbols, int box_count, Fields_Table* fields){
// loop over box index
for(i=1;i<=box_count;i++){
- // loop over letters
+ // loop over letters (A and B)
for(j=0;j<2;j++){
// loop over space dimension
for(k=0;k<KONDO_DIM;k++){
@@ -255,7 +272,7 @@ int kondo_symbols(Char_Array* str_symbols, int box_count, Fields_Table* fields){
init_Char_Array(&tmp_str, 6);
char_array_snprintf(&tmp_str, "%c%d%d", letters[j], k, i);
// compute corresponding polynomial
- kondo_resolve_ABh(tmp_str.str, &poly, *fields);
+ kondo_resolve_ABht(tmp_str.str, &poly, *fields);
free_Char_Array(tmp_str);
// write to output
polynomial_sprint(poly, str_symbols);
@@ -320,45 +337,6 @@ int kondo_symbols(Char_Array* str_symbols, int box_count, Fields_Table* fields){
return(0);
}
-// generate Kondo symbols (older method: one symbol for each scalar product)
-int kondo_symbols_scalarprod(Char_Array* str_symbols, int box_count, Fields_Table* fields){
- int i,j,k;
- 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");
-
- // loop over box index
- for(i=1;i<=box_count;i++){
- // loop over letters
- for(j=0;j<3;j++){
- for(k=0;k<3;k++){
- // write index
- char_array_snprintf(str_symbols, "%d=", 100*(10*(KONDO_A_OFFSET+j)+KONDO_A_OFFSET+k)+i);
- // write the name of the scalar product
- init_Char_Array(&tmp_str, 6);
- char_array_snprintf(&tmp_str, "%c%d.%c%d", letters[j], i, letters[k], i);
- // compute corresponding polynomial
- kondo_resolve_scalar_prod(tmp_str.str, &poly, *fields);
- free_Char_Array(tmp_str);
- // write to output
- polynomial_sprint(poly, str_symbols);
- free_Polynomial(poly);
- // add ,
- if(i<box_count || j<2 || k<2){
- char_array_snprintf(str_symbols,",\n");
- }
- }
- }
- }
-
- parse_input_symbols(*str_symbols, fields);
-
- return(0);
-}
-
// generate Kondo groups (groups of independent variables)
int kondo_groups(Char_Array* str_groups, int box_count){
@@ -395,12 +373,21 @@ int kondo_groups(Char_Array* str_groups, int box_count){
// generate Kondo identities
// h_3^2=1-h_1^2-h_2^2
+// and Pauli matrices
int kondo_identities(Char_Array* str_identities){
int i;
init_Char_Array(str_identities,STR_SIZE);
char_array_snprintf(str_identities, "#!identities\n");
+ // Pauli matrices
+ for(i=0;i<KONDO_DIM;i++){
+ char_array_snprintf(str_identities,"[f%d][f%d]=(1),\n",10*(10*KONDO_T_OFFSET+i),10*(10*KONDO_T_OFFSET+i));
+ char_array_snprintf(str_identities,"[f%d][f%d]=(s{-1})[f%d],\n",10*(10*KONDO_T_OFFSET+i),10*(10*KONDO_T_OFFSET+(i+1)%3),10*(10*KONDO_T_OFFSET+(i+2)%3));
+ char_array_snprintf(str_identities,"[f%d][f%d]=((-1)s{-1})[f%d],\n",10*(10*KONDO_T_OFFSET+(i+2)%3),10*(10*KONDO_T_OFFSET+(i+1)%3),10*(10*KONDO_T_OFFSET+i));
+ }
+
+ // h
char_array_snprintf(str_identities, "[f%d][f%d]=(1)",10*(KONDO_DIM-1+10*KONDO_H_OFFSET),10*(KONDO_DIM-1+10*KONDO_H_OFFSET));
for(i=0;i<KONDO_DIM-1;i++){
char_array_snprintf(str_identities, "+(-1)[f%d][f%d]",10*(i+10*KONDO_H_OFFSET),10*(i+10*KONDO_H_OFFSET));
@@ -809,11 +796,10 @@ int parse_kondo_polynomial_str(char* str_polynomial, Polynomial* output, Fields_
if(tmp_poly.length>0){
for(i=0;i<tmp_poly.length;i++){
if(mode==PP_FIELD_SCALAR_MODE){
- if(offset1!=KONDO_H_OFFSET || offset2!=KONDO_H_OFFSET){
- int_array_append(1000*(10*offset1+offset2)+index, tmp_poly.monomials+i);
- }
+ int_array_append(1000*(10*offset1+offset2)+index, tmp_poly.monomials+i);
}
else{
+ // vector product
int_array_append(100*(100*KONDO_A_OFFSET+10*KONDO_B_OFFSET+KONDO_H_OFFSET)+index, tmp_poly.monomials+i);
}
}
@@ -822,28 +808,15 @@ int parse_kondo_polynomial_str(char* str_polynomial, Polynomial* output, Fields_
else{
init_Int_Array(&tmp_monomial, MONOMIAL_SIZE);
if(mode==PP_FIELD_SCALAR_MODE){
- if(offset1!=KONDO_H_OFFSET || offset2!=KONDO_H_OFFSET){
- int_array_append(1000*(10*offset1+offset2)+index, &tmp_monomial);
- }
+ int_array_append(1000*(10*offset1+offset2)+index, &tmp_monomial);
}
else{
+ // vector product
int_array_append(100*(100*KONDO_A_OFFSET+10*KONDO_B_OFFSET+KONDO_H_OFFSET)+index, &tmp_monomial);
}
init_Int_Array(&dummy_factor, 1);
polynomial_append_noinit(tmp_monomial, dummy_factor, number_one(), &tmp_poly);
}
- /* // older method in which a scalar product was expanded in A, B and h
- // resolve scalar product
- kondo_resolve_scalar_prod_symbols(buffer, &scalar_prod_poly);
- // add to tmp_poly
- if(tmp_poly.length==0){
- polynomial_concat(scalar_prod_poly,&tmp_poly);
- }
- else{
- polynomial_prod_chain(scalar_prod_poly,&tmp_poly,fields);
- }
- free_Polynomial(scalar_prod_poly);
- */
}
// switch back to null mode
mode=PP_NULL_MODE;
@@ -941,10 +914,10 @@ int parse_kondo_polynomial(Char_Array kondo_polynomial_str, Polynomial* polynomi
}
-// read Aij, Bij, hi where i is a space dimension and j is a box index
-int kondo_resolve_ABh(char* str, Polynomial* output, Fields_Table fields){
+// read Aij, Bij, hi, ti where i is a space dimension and j is a box index
+int kondo_resolve_ABht(char* str, Polynomial* output, Fields_Table fields){
char* ptr;
- // offset (A,B or H)
+ // offset (A,B, H or T)
int offset=-1;
// dimension
int dim=-1;
@@ -978,6 +951,9 @@ int kondo_resolve_ABh(char* str, Polynomial* output, Fields_Table fields){
case 'h':
offset=KONDO_H_OFFSET;
break;
+ case 't':
+ offset=KONDO_T_OFFSET;
+ break;
default:
// set index if dim was already set
if(dim>=0){
@@ -1001,8 +977,8 @@ int kondo_resolve_ABh(char* str, Polynomial* output, Fields_Table fields){
}
}
- // h's
- if(offset==KONDO_H_OFFSET){
+ // h's and t's
+ if(offset==KONDO_H_OFFSET || offset==KONDO_T_OFFSET){
// external field
init_Int_Array(&monomial,1);
init_Int_Array(&factor,1);
@@ -1062,7 +1038,7 @@ int kondo_resolve_ABh(char* str, Polynomial* output, Fields_Table fields){
// read a Kondo scalar product (generalized to vector products as well)
int kondo_resolve_scalar_prod(char* str, Polynomial* output, Fields_Table fields){
char* ptr;
- // offset of each term (A,B or H)
+ // offset of each term (A,B,H or T)
int offset=-1;
// index of each term (0,...,box_count)
int index=0;
@@ -1091,6 +1067,9 @@ int kondo_resolve_scalar_prod(char* str, Polynomial* output, Fields_Table fields
case 'h':
offset=KONDO_H_OFFSET;
break;
+ case 't':
+ offset=KONDO_T_OFFSET;
+ break;
// scalar product
case '.':
@@ -1195,8 +1174,8 @@ int kondo_polynomial_vector(int offset, int index, Polynomial (*polys)[3], Field
init_Polynomial((*polys)+i,POLY_SIZE);
}
- // h's
- if(offset==KONDO_H_OFFSET){
+ // h's and t's
+ if(offset==KONDO_H_OFFSET || offset==KONDO_T_OFFSET){
// construct every component field
for(i=0;i<KONDO_DIM;i++){
// external field
@@ -1261,7 +1240,7 @@ int kondo_resolve_scalar_prod_symbols(char* str, Polynomial* output){
char* ptr;
// first or second term
int term=0;
- // offset of each term (A,B or H)
+ // offset of each term (A,B,H or T)
int offset[2];
// index of each term (0,...,box_count)
int index[2]={0,0};
@@ -1289,6 +1268,9 @@ int kondo_resolve_scalar_prod_symbols(char* str, Polynomial* output){
case 'h':
offset[term]=KONDO_H_OFFSET;
break;
+ case 't':
+ offset[term]=KONDO_T_OFFSET;
+ break;
// switch term
case '.':
term=1-term;
@@ -1304,13 +1286,13 @@ int kondo_resolve_scalar_prod_symbols(char* str, Polynomial* output){
init_Int_Array(&monomial,2);
init_Int_Array(&factor, 1);
- if(offset[0]==KONDO_H_OFFSET){
+ if(offset[0]==KONDO_H_OFFSET || offset[0]==KONDO_T_OFFSET){
int_array_append(10*(10*offset[0]+i)+index[0], &monomial);
}
else{
int_array_append(100*(10*offset[0]+i)+index[0], &monomial);
}
- if(offset[1]==KONDO_H_OFFSET){
+ if(offset[1]==KONDO_H_OFFSET || offset[1]==KONDO_T_OFFSET){
int_array_append(10*(10*offset[1]+i)+index[1], &monomial);
}
else{
@@ -1344,6 +1326,9 @@ int get_offset_index(char* str, int* offset, int* index){
case 'h':
*offset=KONDO_H_OFFSET;
break;
+ case 't':
+ *offset=KONDO_T_OFFSET;
+ break;
default:
// char to int
*index=*ptr-'0';
@@ -1378,6 +1363,9 @@ int get_offsets_index(char* str, int* offset1, int* offset2, int* index){
case 'h':
offset[term]=KONDO_H_OFFSET;
break;
+ case 't':
+ offset[term]=KONDO_T_OFFSET;
+ break;
// switch term
case '.':
term=1-term;
@@ -1391,6 +1379,11 @@ int get_offsets_index(char* str, int* offset1, int* offset2, int* index){
*offset1=offset[0];
*offset2=offset[1];
+ // if no A's or B's, then index=0
+ if((offset[0]==KONDO_H_OFFSET || offset[0]==KONDO_T_OFFSET) && (offset[1]==KONDO_H_OFFSET || offset[1]==KONDO_T_OFFSET)){
+ *index=0;
+ }
+
return(0);
}
@@ -1429,6 +1422,9 @@ int get_symbol_index(char* str){
case 'h':
offset=KONDO_H_OFFSET;
break;
+ case 't':
+ offset=KONDO_T_OFFSET;
+ break;
default:
// set index if dim was already set
if(dim>=0){
@@ -1443,8 +1439,8 @@ int get_symbol_index(char* str){
if(offset==-1){
return(-1);
}
- // no symbol for h
- if(offset==KONDO_H_OFFSET){
+ // no symbol for h or t
+ if(offset==KONDO_H_OFFSET || offset==KONDO_T_OFFSET){
return(10*(10*offset+dim));
}
else{