* partial pivoting threshold (1 for partial pivoting)
* @return numeric LU factorization, null on error
*/
public static Dcsn cs_lu(Dcs A, Dcss S, double tol) {
Dcs L, U;
Dcsn N;
double pivot, Lx[], Ux[], x[], a, t;
int Lp[], Li[], Up[], Ui[], pinv[], xi[], q[], n, ipiv, k, top, p, i, col, lnz, unz;
if (!Dcs_util.CS_CSC(A) || S == null)
return (null); /* check inputs */
n = A.n;
q = S.q;
lnz = S.lnz;
unz = S.unz;
x = new double[n]; /* get double workspace */
xi = new int[2 * n]; /* get int workspace */
N = new Dcsn(); /* allocate result */
N.L = L = Dcs_util.cs_spalloc(n, n, lnz, true, false); /* allocate result L */
N.U = U = Dcs_util.cs_spalloc(n, n, unz, true, false); /* allocate result U */
N.pinv = pinv = new int[n]; /* allocate result pinv */
Lp = L.p;
Up = U.p;