diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-11-17 10:52:25 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2020-09-21 16:29:52 -0400 |
commit | 776725153e8e86dc327e1a3d401f529aff94e39c (patch) | |
tree | f9f66f23affc91c3c4db19eb19d7c04fc7aee57c | |
parent | bbb2889bbaccf3605a72765d27dfe3ea6937e7cf (diff) | |
download | multi_mode_eit-776725153e8e86dc327e1a3d401f529aff94e39c.tar.gz multi_mode_eit-776725153e8e86dc327e1a3d401f529aff94e39c.zip |
Increased speed up
Since function had a lot of Kroneker symbol multiplications, we
calculated only elements which multiplied by non zero delta(i,j)
-rw-r--r-- | useful_functions.m | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/useful_functions.m b/useful_functions.m index b9668b0..5492609 100644 --- a/useful_functions.m +++ b/useful_functions.m @@ -79,8 +79,6 @@ function [L0m, polarizability_m]=L0_and_polarization_submatrices( ... m=rhoLiouville_r(s); n=rhoLiouville_c(s); - % calculate unperturbed part (Hamiltonian without EM field) - L0m(p,s)=H0(j,m)*kron_delta_m(k,n)-H0(n,k)*kron_delta_m(j,m); decay_part_m(p,s)= ... ( ... decay_total(g_decay,k)/2 ... @@ -88,9 +86,16 @@ function [L0m, polarizability_m]=L0_and_polarization_submatrices( ... + g_dephasing(j,k) ... )* kron_delta_m(j,m)*kron_delta_m(k,n) ... - kron_delta_m(m,n)*kron_delta_m(j,k)*g_decay(m,j) ; - polarizability_m.linear(p,s)= ( dipole_elements.linear(j,m)*kron_delta_m(k,n)-dipole_elements.linear(n,k)*kron_delta_m(j,m) ); - polarizability_m.left(p,s)= ( dipole_elements.left(j,m)*kron_delta_m(k,n)-dipole_elements.left(n,k)*kron_delta_m(j,m) ); - polarizability_m.right(p,s)= ( dipole_elements.right(j,m)*kron_delta_m(k,n)-dipole_elements.right(n,k)*kron_delta_m(j,m) ); + + % speed up avoiding guaranteed to be zero calculations + if ( kron_delta_m(k,n) || kron_delta_m(j,m) ) + % calculate unperturbed part (Hamiltonian without EM field) + L0m(p,s)=H0(j,m)*kron_delta_m(k,n)-H0(n,k)*kron_delta_m(j,m); + + polarizability_m.linear(p,s)= ( dipole_elements.linear(j,m)*kron_delta_m(k,n)-dipole_elements.linear(n,k)*kron_delta_m(j,m) ); + polarizability_m.left(p,s)= ( dipole_elements.left(j,m)*kron_delta_m(k,n)-dipole_elements.left(n,k)*kron_delta_m(j,m) ); + polarizability_m.right(p,s)= ( dipole_elements.right(j,m)*kron_delta_m(k,n)-dipole_elements.right(n,k)*kron_delta_m(j,m) ); + endif endfor endfor L0m=-im_one/hbar*L0m - decay_part_m; |