multi-layer repository/Static Index/PQ_quantizer.cpp
bool PQ_quantizer::traversed(const idx_t * visited_index, const idx_t * index_check, const size_t index_num){
        for (size_t i = 0; i < index_num; i++){
            bool index_flag = true;
            for (size_t j = 0; j < this->M; j++){
                if (visited_index[i * M + j] != index_check[j]){
                    index_flag = false;
                    break;
                }
            }
            if (index_flag == true)
                return true;
        }
        return false;
    }
/**
     * This function is to check whether an index has already been visited
     * 
     * Input:
     * visited_index:        all visited index                                size: index_num * M
     * index_check:          index to be checked                              size: M
     * index_num:            number of index that has been stored             size_t
     * 
     * Output:
     * visited:             whether the index_check is visited                bool
     * 
     **/
This function is to check whether an index has already been visited

all visited index                                size: index_num * M
index_check:          index to be checked                              size: M
index_num:            number of index that has been stored             size_t

whether the index_check is visited                bool
This function is to check whether an index has already been visited all visited index size : index_num * M index_check : index to be checked size : M index_num : number of index that has been stored size_t whether the index_check is visited bool
bool PQ_quantizer::traversed(const idx_t * visited_index, const idx_t * index_check, const size_t index_num){
        for (size_t i = 0; i < index_num; i++){
            bool index_flag = true;
            for (size_t j = 0; j < this->M; j++){
                if (visited_index[i * M + j] != index_check[j]){
                    index_flag = false;
                    break;
                }
            }
            if (index_flag == true)
                return true;
        }
        return false;
    }
bool PQ_quantizer :: traversed ( const idx_t * visited_index , const idx_t * index_check , const size_t index_num ) { for ( size_t i = 0 ; i < index_num ; i ++ ) { bool index_flag = true ; for ( size_t j = 0 ; j < this -> M ; j ++ ) { if ( visited_index [ i * M + j ] != index_check [ j ] ) { index_flag = false ; break ; } } if ( index_flag == true ) return true ; } return false ; }
This function is to check whether an index has already been visited
This function is to check whether an index has already been visited