/** * Adds an entry to a triplet matrix. Memory-space and dimension of T are * increased if necessary. * * @param T * triplet matrix; new entry added on output * @param i * row index of new entry * @param j * column index of new entry * @param x * numerical value of new entry * @return true if successful, false otherwise */ public static boolean cs_entry(Dcs T, int i, int j, double x) { if (!Dcs_util.CS_TRIPLET(T) || i < 0 || j < 0) return (false); /* check inputs */ if (T.nz >= T.nzmax) { Dcs_util.cs_sprealloc(T, 2 * (T.nzmax)); } if (T.x != null) T.x[T.nz] = x; T.i[T.nz] = i; T.p[T.nz++] = j; T.m = Math.max(T.m, i + 1); T.n = Math.max(T.n, j + 1); return (true); } }
System.arraycopy(A.i, 0, Ainew, 0, length); A.i = Ainew; if (Dcs_util.CS_TRIPLET(A)) { int[] Apnew = new int[nzmax]; length = Math.min(nzmax, A.p.length);
double Cx[], Tx[]; Dcs C; if (!Dcs_util.CS_TRIPLET(T)) return (null); /* check inputs */ m = T.m;