use of mikera.matrixx.AMatrix in project PhenomeScape by soulj.
the class TransitionMatrix method pageRank.
public double[] pageRank(double alpha) {
AVector probAlpha = prob.copy();
double eps = 0.000001;
int iter = 0;
AVector pi0 = Vector.of(new double[prob.length()]);
AVector pi1 = prob.copy();
probAlpha.multiply(alpha);
AMatrix transitionMatrixT = transitionMatrix.getTranspose();
while ((distance(pi0, pi1) > eps) && iter < 100000) {
pi0 = pi1.copy();
pi1.multiply((1 - alpha));
pi1 = pi1.innerProduct(transitionMatrixT);
pi1.add(probAlpha);
iter++;
}
return (pi1.asDoubleArray());
}
Aggregations