Re: partial transpose

*To*: mathgroup at smc.vnet.net*Subject*: [mg125506] Re: partial transpose*From*: Bill Rowe <readnews at sbcglobal.net>*Date*: Fri, 16 Mar 2012 06:31:56 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com

On 3/15/12 at 12:26 AM, kjsalini at gmail.com (jay) wrote: >how to find partial transpose of a density matrix How about defining what you mean by a partial transpose? Perhaps something like: In[5]:= a = RandomInteger[10, {5, 5}] Out[5]= {{9, 2, 6, 5, 3}, {5, 2, 10, 6, 2}, {4, 7, 8, 6, 9}, {4, 10, 8, 3, 4}, {0, 0, 0, 9, 2}} In[6]:= mask = Unitize[1 - SparseArray[{Band[{3, 3}] -> Unitize[a[[;; 3, ;; 3]]]}]]; In[7]:= a mask + SparseArray[{Band[{3, 3}] -> Transpose[a[[3 ;;, 3 ;;]]]}] // Normal Out[7]= {{9, 2, 6, 5, 3}, {5, 2, 10, 6, 2}, {4, 7, 8, 8, 0}, {4, 10, 6, 3, 9}, {0, 0, 9, 4, 2}}