I am thinking of having a custom multiplication operation CenterDot[A,B] for non-commutative operators, and some rules that should commute the operators to a desired ordering. The calculation would be very time intensive, while manipulations would just be trivial swapping of entries and addition of other entries. Therefore, I wonder if there is any (perhaps hacky?) way to Compile a code of this type in Mathematica? Thanks for any suggestion!

  • $\begingroup$ Let's say you could compile it. You are aware of the fact that a compiled function only takes numerical arguments of a specific, pre-determined type, yes? Can you provide the code for CenterDot and a small example on how to use it? $\endgroup$ – halirutan Dec 6 '17 at 9:13
  • $\begingroup$ @halirutan Yes, now I'm thinking of some way to only use lists and integers as labels, since AppendTo is compilable. I'll have to think more about it. $\endgroup$ – Kagaratsch Dec 6 '17 at 14:48
  • 2
    $\begingroup$ When you have a minimal example that works without compiling, then we can have a look at it and discuss if it is compilable. $\endgroup$ – halirutan Dec 6 '17 at 15:15
  • 2
    $\begingroup$ Perhaps Dispatch would be useful? $\endgroup$ – WReach Dec 6 '17 at 15:45
  • $\begingroup$ @WReach It is indeed interesting. Unfortunately it does not appear in the list of compilable functions though. mathematica.stackexchange.com/questions/1096/… $\endgroup$ – Kagaratsch Dec 6 '17 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.