matrix math speedup
This commit is contained in:
parent
6686784fa7
commit
1d09b0775b
1 changed files with 8 additions and 7 deletions
15
rank.js
15
rank.js
|
@ -79,7 +79,7 @@ function rankCalc(result, iterations = 10, main = [], domain_mode = false) {
|
|||
pr = [];
|
||||
matrixe = [];
|
||||
let msum = 1;
|
||||
let intv = Math.pow(0.01 / rl, Math.pow(0.09, i / mm));
|
||||
let intv = Math.pow(0.001 / rl, Math.pow(0.09, i / mm));
|
||||
console.log(`Completed ${i} iterations with ${intv} threshold`)
|
||||
|
||||
let th = -1;
|
||||
|
@ -95,28 +95,29 @@ function rankCalc(result, iterations = 10, main = [], domain_mode = false) {
|
|||
|
||||
let ar = Object.keys(result);
|
||||
let rf = pr[una];
|
||||
let muna = matrixe[una];
|
||||
|
||||
for (let unb of ar) {
|
||||
let prb = prold[unb];
|
||||
|
||||
matrixe[una][unb] = 0.03;
|
||||
let munb = muna[unb] = 0.03;
|
||||
|
||||
if (prb * matrixf[una][unb] < intv || fnc[unb] == 0) {
|
||||
let mfb = matrixf[una][unb];
|
||||
if (prb * munb < intv || fnc[unb] == 0) {
|
||||
let mfb = munb;
|
||||
if (isNaN(mfb) || !mfb) continue;
|
||||
pr[una] += prb * mfb;
|
||||
continue;
|
||||
}
|
||||
|
||||
for (let unc in result) {
|
||||
let mfc = matrixf[una][unc];
|
||||
let mfc = muna[unc];
|
||||
let mfb = matrixf[unc][unb];
|
||||
if (isNaN(mfc) || isNaN(mfb) || !mfc || !mfb) continue;
|
||||
matrixe[una][unb] += mfc * mfb;
|
||||
}
|
||||
|
||||
msum += matrixe[una][unb];
|
||||
pr[una] += prb * matrixe[una][unb];
|
||||
msum += munb;
|
||||
pr[una] += prb * munb;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue