In general, is there a partial trace algorithm (ideally for systems of any size) that can be coded using basic matrix operations found in software like Mathematica or Maple? All of the methods I'm aware of seem to be suited for humans, and I am struggling to think of a way of implementing them in any programming language I know. I would appreciate any kind of help with this.
Thank you.