summaryrefslogtreecommitdiff
path: root/useful_functions.m
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2009-12-21 20:31:15 +0000
committerEugeniy Mikhailov <evgmik@gmail.com>2009-12-21 20:31:15 +0000
commit00ea4f7ef1631a0e7e52320cc9780607f5678722 (patch)
treec2f609feb66a6a07d6514497600b350f5afceec6 /useful_functions.m
parent741f673411c596eacf4fb98f4ec93cf27ec04ddc (diff)
downloadmulti_mode_eit-00ea4f7ef1631a0e7e52320cc9780607f5678722.tar.gz
multi_mode_eit-00ea4f7ef1631a0e7e52320cc9780607f5678722.zip
vectorization of susceptibility calculations
Diffstat (limited to 'useful_functions.m')
-rw-r--r--useful_functions.m11
1 files changed, 4 insertions, 7 deletions
diff --git a/useful_functions.m b/useful_functions.m
index ce17071..34f1155 100644
--- a/useful_functions.m
+++ b/useful_functions.m
@@ -199,13 +199,10 @@ function kappa=susceptibility(wi, rhoLiouville, dipole_elements)
kappa.linear=0;
kappa.left=0;
kappa.right=0;
- for i=1:Nlevels
- for j=1:Nlevels
- kappa.linear += dipole_elements.linear(j,i) * rho(i,j);
- kappa.left += dipole_elements.left(j,i) * rho(i,j);
- kappa.right += dipole_elements.right(j,i) * rho(i,j);
- endfor
- endfor
+
+ kappa.linear = sum( sum( transpose(dipole_elements.linear) .* rho ) );
+ kappa.left = sum( sum( transpose(dipole_elements.left) .* rho ) );
+ kappa.right = sum( sum( transpose(dipole_elements.right) .* rho ) );
endfunction
function index=freq2index(freq, modulation_freq)