![]() All density matrices are "non-negative definite", so this is the only issue with eigenvalues you should run into. This is taken care of by the second function vn_eig_entropy. If your matrix has zero eigenvalues, the convention is to set 0*log(0) terms equal to zero. Obviously any square matrix will work, not just a 2x2, this is just to give you an example. Just feed one of these functions a square matrix using something like rho = np.matrix(, These will return the same value, so it does not matter which you use. # Drop zero eigenvalues so that log2 is defined R = rho*(la.logm(rho)/la.logm(np.matrix(])))įor the eigenvalue version def vn_eig_entropy(rho): Here are two functions in Python which can be used, one for each version of the definition of von Neumann entropy (of a density operator say):įor the trace version def von_neumann_entropy(rho): In order to do this you'll need a base change in your computation. The above examples all take logarithms base e, but you need base 2. ![]() It can be defined either in terms of (the negative of) the trace of the matrix times its own (matrix) logarithm.or.it can be defined in terms of the eigenvalues. You can define von Neumann entropy in one of two ways according to Nielsen & Chuang in "Quantum Computation and Quantum Information". Then log(M) could be computed from Jordan form using Gantmacher 1959 theorem, check this paper for simplified explanation, especially eqns 3.4-3.8īut I bet you a donut Jordan normal form of your matrix will be complex. In python it could be done via SymPy,, check Compute Jordan normal form of matrix in Python / NumPy also for details. If you don't want to go via eigenvalues/polynomials, then you could compute log of the matrix (everything else is trivial) using Jordan decomposition to get Jordan normal form of a matrix. Looking at companion site, this answer might be of an interest to you
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |