On Thursday, November 22, 2012 4:21:02 PM UTC, Simon King wrote: > Can you give me a pointer for that trickery? I am not so good in C++. > And actually my plan was to implement it in Cython. >
Basically you can use integers as template parameters template<typename Coeff, int Nints> class Monomial { Coeff coefficient; int exponent[Nints]; } then explicitly instantiate it for a range of sizes and wrap Cython around the whole thing. > You could even use variable bit sizes for the different nodes, that is, > let > > n = n(node) depend on the node where you are starting from. > > Which would involve a big overhead when translating it into a list > of arrows. The question is whether that's critical. See below. > Yes, which is why we should first sit down and think about which operations are important. Hopefully you never have to actually unwrap it into a list of arrows on the C/C++ level, only when you go back into Python to show the result to the user ;-) > But half of the time I want to know > whether there are monomials a and b such that m=a*n*b. It is *not* enough > to know that the bit pattern of n is a sub-pattern of the bit pattern of > m, > with shift s: You additionally need to test whether the starting point of > n coincides with vertex number s in the path corresponding to m. Hence, > you need to iterate over the initial part of m, which has some overhead > - in particular if you use variable bit sizes. > Ok now I understand what you mean by divisible, you mean anywhere in the middle as opposed to left/right divisible. I just want to posit that you should first find the possible offsets and then check whether it is allowed. If n is a moderately complicated path then there shouldn't be too many potential matches. I've glanced at the KBmag sources but didn't see any evidence of bit packing the words. But then there is a certain lack of documentation to the source code, I don't even know what the 8.3 source file names stand for ;-) -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To view this discussion on the web visit https://groups.google.com/d/msg/sage-combinat-devel/-/4OkH6zIrW8wJ. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.