[SciPy-user] using STL in scipy weave inline

Michael ODonnell odonnems@yahoo....
Mon Dec 10 12:47:36 CST 2007


OS Microsoft XP SP2 x86
python 2.5.1
compiler: mingw

Does anyone have experience using multimap or the standard template library within weave inline? I need to create a map that contains numeric keys which are paired to a string, but I get an error when declaring the multimap function. If i include <map> I get other errors about namespace and if don't then I get an error for not declaring the multimap. Neither method works.

TIA,
Michael

Example of code:

total = (winx * winy * 1.0) #Total number of cells to evaluate in kernel

code = r"""
            double ND, NNW, WNW, WSW,SSW, SSE, ESE, ENE, NNE, Flat;
            ND = 22.0;
            NNW = 11.0;
            WNW = 10.0;
            WSW = 30.0;
            SSW = 8.0;
            SSE = 2.0;
            ESE = 1.0;
            ENE = 5.0;
            NNE = 5.0;
            Flat = 3.0;

            //Calculate the frequency of the counts
            fND = (ND / total);    
            fNNW = (NNW / total);   
            fWNW = (WNW / total);  
            fWSW = (WSW / total);  
            fSSW = (SSW / total);   
            fSSE = (SSE / total);   
            fESE = (ESE / total);  
            fENE = (ENE / total);  
            fNNE = (NNE / total);   
            fFlat = (Flat / total);  
        
            //Create a map for pairs: frequency, string
            multimap<double, string> map_freq; //Create empty map
        
            map_freq[fND) = 'fND';
            map_freq[fNNW] = 'fNNW';
            map_freq[fWNW] = 'fWNW';
            map_freq[fWSW] = 'fWSW';
            map_freq[fSSW] = 'fSSW';
            map_freq[fSSE] = 'fSSE';
            map_freq[fESE] = 'fESE';
            map_freq[fENE] = 'fENE';
            map_freq[fNNE] = 'fNNE';
            map_freq[fFlat] = 'fFlat';
             """

weave.inline(code,['total'], type_converters=converters.blitz, compiler='gcc')




      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20071210/b8e983c7/attachment.html 


More information about the SciPy-user mailing list