From fd6ae2a580d48aa3c0720d093c5d1e87d6748daf Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Fri, 18 Dec 2009 23:28:15 +0000 Subject: inner loop if replaced with vector comparison --- useful_functions.m | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'useful_functions.m') diff --git a/useful_functions.m b/useful_functions.m index 8adbf86..bd8294c 100644 --- a/useful_functions.m +++ b/useful_functions.m @@ -132,33 +132,32 @@ function L=Liouville_operator_matrix( ... w_l=w_jk-w_mn; % lets search this frequency in the list of available frequencies % but since we not guaranteed to find it lets assign temporary 0 to Liouville matrix element - for w3i=1:Nfreq + w3i=(w_l == modulation_freq); + if (any(w3i)) + % yey, requested modulation frequency exist + % lets do L sub matrix filling % at most we should have only one matching frequency w_iner=modulation_freq(w3i); - if ((w_iner == w_l)) - % yey, requested modulation frequency exist - % lets do L sub matrix filling - %such frequency exist in the list of modulation frequencies - if ((w_iner == 0)) - % calculate unperturbed part (Hamiltonian without EM field) - L(p0:p0+rho_size-1,s0:s0+rho_size-1)=L0m; - else - % calculate perturbed part (Hamiltonian with EM field) - % in other word interactive part of Hamiltonian - L(p0:p0+rho_size-1,s0:s0+rho_size-1)= ... - -im_one/hbar*polarizability_m.linear * E_field.linear(w3i) ... - -im_one/hbar*polarizability_m.left * E_field.left(w3i) ... - -im_one/hbar*polarizability_m.right * E_field.right(w3i) ... - ; - endif - % diagonal elements are self modulated - % due to rotating wave approximation - if ((p0 == s0)) - L(p0:p0+rho_size-1,s0:s0+rho_size-1)+= -im_one*w_jk*eye(rho_size); - endif + %such frequency exist in the list of modulation frequencies + if ((w_iner == 0)) + % calculate unperturbed part (Hamiltonian without EM field) + L(p0:p0+rho_size-1,s0:s0+rho_size-1)=L0m; + else + % calculate perturbed part (Hamiltonian with EM field) + % in other word interactive part of Hamiltonian + L(p0:p0+rho_size-1,s0:s0+rho_size-1)= ... + -im_one/hbar*polarizability_m.linear * E_field.linear(w3i) ... + -im_one/hbar*polarizability_m.left * E_field.left(w3i) ... + -im_one/hbar*polarizability_m.right * E_field.right(w3i) ... + ; endif - endfor + % diagonal elements are self modulated + % due to rotating wave approximation + if ((p0 == s0)) + L(p0:p0+rho_size-1,s0:s0+rho_size-1)+= -im_one*w_jk*eye(rho_size); + endif + endif endfor endfor endfunction -- cgit v1.2.3