multi-layer repository/Static Index/VQ_quantizer.cpp
VQ_quantizer::VQ_quantizer(size_t dimension, size_t nc_upper, size_t max_nc_per_group, size_t M, size_t efConstruction, bool use_HNSW):
        Base_quantizer(dimension, nc_upper, max_nc_per_group){
            this->use_HNSW = use_HNSW;
            this->M = M;
            this->efConstruction = efConstruction;

            this->exact_nc_in_groups.resize(nc_upper);

            if (this->use_HNSW){
                this->HNSW_quantizers.resize(nc_upper);
            }
            else{
                this->L2_quantizers.resize(nc_upper);
            }
        }
/**
     * This is the initialize function for VQ function:
     * 
     * Input: 
     * nc_upper:        number of groups = number of centroids in upper layer
     * nc_per_group:    number of subcentroids per group, might be shrinked if no enough training points
     * use_HNSW:        use HNSW for searching or L2 exhaustive search
     * M:               for HNSW construction, 16 in default
     * efConstruction:  for HNSW construction
     * efSearch:        for efSearch: keep_space < efSearch < nc_per_group
     * 
     **/
This is the initialize function for VQ function.


This is the initialize function for VQ function .
VQ_quantizer::VQ_quantizer(size_t dimension, size_t nc_upper, size_t max_nc_per_group, size_t M, size_t efConstruction, bool use_HNSW):
        Base_quantizer(dimension, nc_upper, max_nc_per_group){
            this->use_HNSW = use_HNSW;
            this->M = M;
            this->efConstruction = efConstruction;
            this->exact_nc_in_groups.resize(nc_upper);
            if (this->use_HNSW){
                this->HNSW_quantizers.resize(nc_upper);
            }
            else{
                this->L2_quantizers.resize(nc_upper);
            }
        }
VQ_quantizer :: VQ_quantizer ( size_t dimension , size_t nc_upper , size_t max_nc_per_group , size_t M , size_t efConstruction , bool use_HNSW ) : Base_quantizer ( dimension , nc_upper , max_nc_per_group ) { this -> use_HNSW = use_HNSW ; this -> M = M ; this -> efConstruction = efConstruction ; this -> exact_nc_in_groups . resize ( nc_upper ) ; if ( this -> use_HNSW ) { this -> HNSW_quantizers . resize ( nc_upper ) ; } else { this -> L2_quantizers . resize ( nc_upper ) ; } }
This is the initialize function for VQ function:
This is the initialize function for VQ function :