code: public static Dcss cs_sqr(int order, Dcs A, boolean qr) {
          int n, k, post[];
          Dcss S;
          boolean ok = true;
          if (!Dcs_util.CS_CSC(A))
              return (null); /* check inputs */
          n = A.n;
          S = new Dcss(); /* allocate result S */
          S.q = Dcs_amd.cs_amd(order, A); /* fill-reducing ordering */
          if (order > 0 && S.q == null)
              return (null);
          if (qr) /* QR symbolic analysis */
          {
              Dcs C = order > 0 ? Dcs_permute.cs_permute(A, null, S.q, false) : A;
              S.parent = Dcs_etree.cs_etree(C, true); /* etree of C'*C, where C=A(:,q) */
              post = Dcs_post.cs_post(S.parent, n);
              S.cp = Dcs_counts.cs_counts(C, S.parent, post, true); /* col counts chol(C'*C) */
              ok = C != null && S.parent != null && S.cp != null && cs_vcount(C, S);
              if (ok)
                  for (S.unz = 0, k = 0; k < n; k++)
                      S.unz += S.cp[k];
              ok = ok && S.lnz >= 0 && S.unz >= 0; /* int overflow guard */
          } else {
              S.unz = 4 * (A.p[n]) + n; /* for LU factorization only, */
              S.lnz = S.unz; /* guess nnz(L) and nnz(U) */
          }
          return (ok ? S : null); /* return result S */
      }
docs: Symbolic QR or LU ordering and analysis.
  
  @param order
  ordering method to use (0 to 3)
  @param A
  column-compressed matrix
  @param qr
  analyze for QR if true or LU if false
  @return symbolic analysis for QR or LU, null on error