# How to faster map density matrix element to make differential equations

I have a time dependent matrix $M(t)$ of $L^n \times L^n$ size and want to write differential equations like D[M[i,j][t],t] = H[i,j][t]

Here is my code:

L=3; n=3;
Rho[t_] = Table[M[i,j][t], {i,L^n}, {j,L^n}]; //Timing(*Rho2[t]//MatrixForm*)
(* {0.00100,Null} *)

Hop[t_, i_] =
Transpose[
Table[If[i == j, 1, Cos[t]], {i, {1}}, {j, L}]]
. Table[If[i == j, 1, Sin[t]], {i, {2}}, {j, L}]

I1[i_Integer] := I1[i]=IdentityMatrix[L^(i-1)];
I2[i_Integer] := I2[i]=IdentityMatrix[L^(n-i)];

H[t_] = Sum[FixedPoint[ArrayFlatten, I1[i] \[TensorProduct] Hop[t,i]
\[TensorProduct]I2[i]],{i,n}];

Rho1[t_] =
Table[
D[Rho[t],t][[i,j]] == H[t][[i,j]],
{i,L^n}, {j,L^n}]; // Timing(*Rho1[t]//MatrixForm*)
(* {0.33500,Null} *)

I can make it faster by using the Parallel command:

Rho2[t_] =
ParallelTable[
D[Rho[t],t][[i,j]] == H[t][[i,j]],
{i,L^n}, {j,L^n}]; // Timing(*Rho1[t]//MatrixForm*)
(* {0.08100,Null} *)

Is there any other way by using Map or Transpose to make it more efficient?

-
In your formulation of Rho1[t_] you should be able to simply use Map[D[#, t] &, Rho[t]]. On my machine using Table gives a timing of 0.277257, while using Map gives a timing of 0.001321. Is this the operation you are trying to speed up? Maybe I misunderstood the question. –  leibs Jan 27 '14 at 18:08
There's no need to Table in your Rho1[t_] = .... D is Listable so you can just write Rho1[t_] = D[Rho[t], t]. –  Silvia Jan 27 '14 at 18:14
@Silvia right you are. I forgot about the Listable nature of D[…]. Your solution reads better. –  leibs Jan 27 '14 at 18:21
@Silvia I made a mistake before, please look at the edited version. I want to make set of differential equations in this form D[M[i,j][t],t]=H[i,j][t]. @leibs Map make it good but still not that efficient because I need to create set of diff. equations. –  santosh Jan 27 '14 at 18:26
Do you want your Rho2 a matrix shape or a 1-dimension list with all equations is ok? –  Silvia Jan 27 '14 at 18:36