From 32648d980195e97da34668b49ce721f67463084e Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Wed, 16 Dec 2009 05:12:22 +0000 Subject: vectorization in rhoOfFreq --- useful_functions.m | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'useful_functions.m') diff --git a/useful_functions.m b/useful_functions.m index b7156cf..10afb69 100644 --- a/useful_functions.m +++ b/useful_functions.m @@ -18,11 +18,8 @@ function rho=rhoOfFreq(rhoLiouville, freqIndex, Nlevels) % this function create from Liouville density vector % the density matrix with given modulation frequency rho=zeros(Nlevels); - for r=1:Nlevels - for c=1:Nlevels - rho(r,c)=rhoLiouville((freqIndex-1)*Nlevels^2+(r-1)*Nlevels+c); - endfor - endfor + rho(:)=rhoLiouville((freqIndex-1)*Nlevels^2+1:(freqIndex)*Nlevels^2); + rho=rho.'; endfunction function [N, rhoLiouville_w, rhoLiouville_r, rhoLiouville_c]=unfold_density_matrix(Nlevels,Nfreq) -- cgit v1.2.3