multi-layer repository/Static Index/PQ_quantizer.cpp
void PQ_quantizer::compute_final_centroid(const idx_t label, float * final_centroid){
        
        std::vector<idx_t> group_index(this->M);
        idx_t group_id = label_2_spaceID(label, group_index.data());

        for (size_t i = 0; i < this->M; i++){
            for (size_t j = 0; j < this->dsub; j++){
                final_centroid[i * dsub + j] = this->PQs[group_id]->centroids[i * exact_ksubs[group_id] * dsub + group_index[i] * dsub + j];
            }
        }
    }
/**
     * 
     * This is the function for computing final centroid in the PQ layer
     * 
     * Input:
     * label:    the id for target centroid        idx_t 
     * 
     * Output:
     * final_centroid:  the final out centroid required   size: dimension 
     * 
     **/
This is the function for computing final centroid in the PQ layer

the id for target centroid        idx_t

the final out centroid required   size: dimension
This is the function for computing final centroid in the PQ layer the id for target centroid idx_t the final out centroid required size : dimension
void PQ_quantizer::compute_final_centroid(const idx_t label, float * final_centroid){
        std::vector<idx_t> group_index(this->M);
        idx_t group_id = label_2_spaceID(label, group_index.data());
        for (size_t i = 0; i < this->M; i++){
            for (size_t j = 0; j < this->dsub; j++){
                final_centroid[i * dsub + j] = this->PQs[group_id]->centroids[i * exact_ksubs[group_id] * dsub + group_index[i] * dsub + j];
            }
        }
    }
void PQ_quantizer :: compute_final_centroid ( const idx_t label , float * final_centroid ) { std :: vector < idx_t > group_index ( this -> M ) ; idx_t group_id = label_2_spaceID ( label , group_index . data ( ) ) ; for ( size_t i = 0 ; i < this -> M ; i ++ ) { for ( size_t j = 0 ; j < this -> dsub ; j ++ ) { final_centroid [ i * dsub + j ] = this -> PQs [ group_id ] -> centroids [ i * exact_ksubs [ group_id ] * dsub + group_index [ i ] * dsub + j ] ; } } }
This is the function for computing final centroid in the PQ layer
This is the function for computing final centroid in the PQ layer