FAISS Adaptive Sampling Quantile (impl/AdSampling.cpp)

faiss · faiss/impl/AdSampling.cpp · cpp · MIT
ai, search, lang:cpp, tag:math, tag:faiss

Provides statistical normal quantile calculations using rational polynomial approximations for adaptive sampling in similarity search.

// Source: https://github.com/facebookresearch/faiss | License: MIT | Copyright Facebook, Inc. and its affiliates
// Provided via justclaw.it.com; keep this notice with the code.
/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#include <faiss/impl/AdSampling.h>

#include <cmath>

#include <faiss/impl/FaissAssert.h>

namespace faiss {
namespace detail {

double normal_quantile(double p) {
    // Three-branch rational polynomial; branch breakpoint p_low = 0.02425.
    static constexpr double a[] = {
            -3.969683028665376e+01,
            2.209460984245205e+02,
            -2.759285104469687e+02,
            1.383577518672690e+02,
            

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key