code: public static Dcs cs_spalloc(int m, int n, int nzmax, boolean values, boolean triplet) {
          Dcs A = new Dcs(); /* allocate the Dcs struct */
          A.m = m; /* define dimensions and nzmax */
          A.n = n;
          A.nzmax = nzmax = Math.max(nzmax, 1);
          A.nz = triplet ? 0 : -1; /* allocate triplet or comp.col */
          A.p = triplet ? new int[nzmax] : new int[n + 1];
          A.i = new int[nzmax];
          A.x = values ? new double[nzmax] : null;
          return A;
      }
docs: Allocate a sparse matrix (triplet form or compressed-column form).
  
  @param m
  number of rows
  @param n
  number of columns
  @param nzmax
  maximum number of entries
  @param values
  allocate pattern only if false, values and pattern otherwise
  @param triplet
  compressed-column if false, triplet form otherwise
  @return sparse matrix