6869707172737475767778
// identify 0-columns IIntList zeros = Ints.create.list(0); for (int j=0; j<A.columns(); j++) { boolean colzero = true; for (int i=0; i<A.rows(); i++) if (A.get(i,j) != 0) colzero = false; if (colzero) zeros.append(j); }
8182838485868788899091
{ if (!Ints.util.contains(target, j) && A.get(j,j) == 0) zeros.append(j); } IIntArray nonzeros = Ints.util.removeValueToNew(Ints.create.listRange(0, A.rows()), zeros); // clean matrix IDoubleArray Aclean = A.view(nonzeros.getArray(), nonzeros.getArray()); // rhs
979899100101102103104105106107
calculateAlgebra(); IDoubleArray P = prop.propagate(t); double res = 0; for (int i=0; i<P.rows(); i++) { for (int j=0; j<P.columns(); j++) { res += p0.get(i) * P.get(i,j) * a.get(j); }
127128129130131132133134135136137
calculateAlgebra(); IDoubleArray P = prop.propagate(t); double res = 0; for (int i=0; i<P.rows(); i++) { for (int j=0; j<P.columns(); j++) { res += a.get(i) * pi.get(i) * P.get(i,j) * b.get(j); }
5556575859606162636465
} public Grid(IDoubleArray bounds, double _step) { IDoubleArray griddef = doublesNew.matrix(bounds.rows(), 3); for (int i=0; i<griddef.rows(); i++) { griddef.set(i,0,bounds.get(i,0)); griddef.set(i,1,_step); griddef.set(i,2,bounds.get(i,1)); }
1718192021222324252627
{ public static IDoubleArray tuneMetastability(IDoubleArray T, double timescaleFactor) { IDoubleArray Tnew = T.copy(); //IDoubleArray Pi = doublesNew.diag(msm.stationaryDistribution(T)); for (int i=0; i<Tnew.rows(); i++) { // scale diagonal Tnew.set(i,i, Math.pow(Tnew.get(i,i), 1.0/timescaleFactor)); // compute off-diagonal scaling factor
173174175176177178179180181182183
private void estimateErrorByPureness() { IDoubleArray chinorm = hmmChi.copy(); alg.normalizeRows(chinorm,1); errors = doublesNew.array(chinorm.rows()); for (int i=0; i<chinorm.rows(); i++) { IDoubleArray row = chinorm.viewRow(i); int imax = doubles.maxIndex(row);
175176177178179180181182183184185
IDoubleArray chinorm = hmmChi.copy(); alg.normalizeRows(chinorm,1); errors = doublesNew.array(chinorm.rows()); for (int i=0; i<chinorm.rows(); i++) { IDoubleArray row = chinorm.viewRow(i); int imax = doubles.maxIndex(row); row.set(imax, row.get(imax)-1); errors.set(i, msmPi.get(i)*alg.norm(row));
2829303132333435363738
{0, 3, 1000, 3, 0, 0}, {0, 0, 3, 1000, 3, 0}, {0, 0, 0, 3, 1000, 3}, {0, 0, 0, 0, 3, 90000}}); for (int i = 0; i < C.rows(); i++) { double[] row = C.getRow(i); double sum = 0; for (int j = 0; j < row.length; j++) { sum += row[j];
2324252627282930313233