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 = [];
|
pr = [];
|
||||||
matrixe = [];
|
matrixe = [];
|
||||||
let msum = 1;
|
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`)
|
console.log(`Completed ${i} iterations with ${intv} threshold`)
|
||||||
|
|
||||||
let th = -1;
|
let th = -1;
|
||||||
|
@ -95,28 +95,29 @@ function rankCalc(result, iterations = 10, main = [], domain_mode = false) {
|
||||||
|
|
||||||
let ar = Object.keys(result);
|
let ar = Object.keys(result);
|
||||||
let rf = pr[una];
|
let rf = pr[una];
|
||||||
|
let muna = matrixe[una];
|
||||||
|
|
||||||
for (let unb of ar) {
|
for (let unb of ar) {
|
||||||
let prb = prold[unb];
|
let prb = prold[unb];
|
||||||
|
|
||||||
matrixe[una][unb] = 0.03;
|
let munb = muna[unb] = 0.03;
|
||||||
|
|
||||||
if (prb * matrixf[una][unb] < intv || fnc[unb] == 0) {
|
if (prb * munb < intv || fnc[unb] == 0) {
|
||||||
let mfb = matrixf[una][unb];
|
let mfb = munb;
|
||||||
if (isNaN(mfb) || !mfb) continue;
|
if (isNaN(mfb) || !mfb) continue;
|
||||||
pr[una] += prb * mfb;
|
pr[una] += prb * mfb;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let unc in result) {
|
for (let unc in result) {
|
||||||
let mfc = matrixf[una][unc];
|
let mfc = muna[unc];
|
||||||
let mfb = matrixf[unc][unb];
|
let mfb = matrixf[unc][unb];
|
||||||
if (isNaN(mfc) || isNaN(mfb) || !mfc || !mfb) continue;
|
if (isNaN(mfc) || isNaN(mfb) || !mfc || !mfb) continue;
|
||||||
matrixe[una][unb] += mfc * mfb;
|
matrixe[una][unb] += mfc * mfb;
|
||||||
}
|
}
|
||||||
|
|
||||||
msum += matrixe[una][unb];
|
msum += munb;
|
||||||
pr[una] += prb * matrixe[una][unb];
|
pr[una] += prb * munb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue