code: public static void solveU(DMatrixSparseCSC U , double []x )
      {
          final int N = U.numCols;
  
          int idx1 = U.col_idx[N];
          for (int col = N-1; col >= 0; col--) {
              int idx0 = U.col_idx[col];
              double x_j = x[col] /= U.nz_values[idx1-1];
  
              for (int i = idx0; i < idx1 - 1; i++) {
                  int row = U.nz_rows[i];
                  x[row] -= U.nz_values[i] * x_j;
              }
  
              idx1 = idx0;
          }
      }
docs: Solves for an upper triangular matrix against a dense vector. U*x = b
  
  @param U Upper triangular matrix.  Diagonal elements are assumed to be non-zero
  @param x (Input) Solution matrix 'b'.  (Output) matrix 'x'