code: public static LUDecomposition<DoubleMatrix> lu(DoubleMatrix A) {
          int[] ipiv = new int[min(A.rows, A.columns)];
          DoubleMatrix result = A.dup();
          NativeBlas.dgetrf(A.rows, A.columns, result.data, 0, A.rows, ipiv, 0);
  
          // collect result
          DoubleMatrix l = new DoubleMatrix(A.rows, min(A.rows, A.columns));
          DoubleMatrix u = new DoubleMatrix(min(A.columns, A.rows), A.columns);
          decomposeLowerUpper(result, l, u);
          DoubleMatrix p = Permutations.permutationDoubleMatrixFromPivotIndices(A.rows, ipiv);
          return new LUDecomposition<DoubleMatrix>(l, u, p);
      }
docs: Compute LU Decomposition of a general matrix.
  
  Computes the LU decomposition using GETRF. Returns three matrices L, U, P,
  where L is lower diagonal, U is upper diagonal, and P is a permutation
  matrix such that A = P * L * U.
  
  @param A general matrix
  @return An LUDecomposition object.