[GiNaC-list] GiNaC Match Documentation

Mark Round mround at risc.jku.at
Tue Aug 13 11:35:45 CEST 2013

I have been encountering problems with the GiNaC function match. 
Basically I can not understand the documentation. I wanted to detail my 
story in the hope that perhaps my problems are solved and in the future 
someone else can avoid my pitfalls.

The documentation informs me that I need an associative array. I can not 
find how to construct such an array elsewhere in the documentation so I 
assume that I am supposed to use exhashmap. That was a point of 
confusion for me. Then I designed the following code snipet,

symbol x("x"), y("y");
ex tmp=x+y;
exhashmap <ex> array;


which apparently works fine. Now I wish to fill 'array' with the 
replacement table. So I modified to,


which returned the following compiler messages,

momentum_integration.cpp: In function ‘GiNaC::ex 
momentum_integration.cpp:13:33: error: no matching function for call to 
‘GiNaC::ex::match(const GiNaC::ex, GiNaC::exhashmap<GiNaC::ex>&)’
momentum_integration.cpp:13:33: note: candidates are:
In file included from /usr/include/ginac/ginac.h:30:0,
from momentum_integration.h:14,
from momentum_integration.cpp:1:
/usr/include/ginac/ex.h:150:7: note: bool GiNaC::ex::match(const 
GiNaC::ex&) const
/usr/include/ginac/ex.h:150:7: note: candidate expects 1 argument, 2 
/usr/include/ginac/ex.h:151:7: note: bool GiNaC::ex::match(const 
GiNaC::ex&, GiNaC::exmap&) const
/usr/include/ginac/ex.h:151:7: note: no known conversion for argument 2 
from ‘GiNaC::exhashmap<GiNaC::ex>’ to ‘GiNaC::exmap& {aka 
std::map<GiNaC::ex, GiNaC::ex, GiNaC::ex_is_less>&}’
make: *** [momentum_integration.o] Error 1

I attempted to use the command exmap but I can not find anything on that 
in the documentation. I tried several permutations around,

exmap <ex,ex> array;

which made the compiler return,

momentum_integration.cpp: In function ‘GiNaC::ex 
momentum_integration.cpp:11:8: error: ‘GiNaC::exmap {aka 
std::map<GiNaC::ex, GiNaC::ex, GiNaC::ex_is_less>}’ is not a template
make: *** [momentum_integration.o] Error 1

At which point it is unclear to me what else I should try.

The code was ran on a 64-bit Linux Mint-Debian distribution with 

More information about the GiNaC-list mailing list