public double getLOF(Double[][] knn, Double[] x, int length) {
    double sum = 0;
    for (int i = 0; i < length; i++) {
      Double[] o = knn[i];
      sum += getLocDens(knn, o, length) / getLocDens(knn, x, length);
    }
    return sum / multipleK;
  }
This function is used to detect density anomaly of time series.
library-udf/src/main/java/org/apache/iotdb/library/anomaly/UDTFLOF.java