Created
September 11, 2013 14:18
-
-
Save 9il/6524262 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach(d; 0..dl) | |
{ | |
auto pt = pdt[d]; | |
auto nw = ndw[d]; | |
auto qw = qdw[d]; | |
foreach(w; 0..wl) | |
qwd[w, d] = qw[w] = nw[w] / dotProduct(pt, pwt[w]); | |
} | |
foreach(t; 0..tl) | |
{ | |
auto pd = ptd[t]; | |
auto pw = ptw[t]; | |
auto rw = rtw[t]; | |
foreach(w; 0..wl) | |
rw[w] = pw[w] * dotProduct(pd, qwd[w]); | |
foreach(d; 0..dl) | |
rdt[d, t] = pdt[d, t] * dotProduct(pw, qdw[d]); | |
} | |
foreach(t; 0..tl) | |
{ | |
auto rw = rtw[t]; | |
auto pw = ptw[t]; | |
const s = rw.sum(); | |
foreach(w; 0..wl) | |
pwt[w, t] = pw[w] = rw[w] / s; | |
} | |
foreach(d; 0..dl) | |
{ | |
auto rt = rdt[d]; | |
auto pt = pdt[d]; | |
const s = rt.sum(); | |
foreach(t; 0..tl) | |
ptd[t, d] = pt[t] = rt[t] / s; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment