/** * This file is part of Gomu. * * Copyright 2016 by Jean Fromentin * * Gomu is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Gomu is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Gomu. If not, see . */ #include "braids.hpp" #include "init.hpp" //****************** //* Global objects * //****************** MonoidFamily ArtinA_mf("Artin A-type",ArtinA_disp,ArtinA_gnum); MonoidFamily dualA_mf("Dual A-type",DualA_disp,DualA_gnum); //*********************** //* Auxiliary functions * //*********************** //--------------- // braids_init() //--------------- void braids_init(){ ArtinA_mf.set_left_complement(&ArtinA_left_sc); ArtinA_mf.set_right_complement(&ArtinA_right_sc); ArtinA_mf.data=(void*)type_ArtinWordA; dualA_mf.set_left_complement(&DualA_left_sc); dualA_mf.set_right_complement(&DualA_right_sc); dualA_mf.data=(void*)type_DualWordA; } //------------------------------------------------ // ArtinA_left_sc(Generator,Generator,Generator*) //------------------------------------------------ int ArtinA_left_sc(const Generator& x,const Generator& y,Generator* comp){ //Comp statisfy comp*x=...*y if(x==y) return 0; if(abs(x-y)==1){ comp[0]=x; comp[1]=y; return 2; } else{ comp[0]=y; return 1; } } //------------------------------------------------- // ArtinA_rigth_sc(Generator,Generator,Generator*) //------------------------------------------------- int ArtinA_right_sc(const Generator& x,const Generator& y,Generator* comp){ //Comp satisfy x*comp=y*... if(x==y) return 0; if(abs(x-y)==1){ comp[0]=y; comp[1]=x; return 2; } else{ comp[0]=y; return 1; } } //-------------------- // DualA_gnum(size_t) //-------------------- inline size_t DualA_gnum(size_t n){ size_t res=0; for(size_t i=1;i