bufferkdtree (C sources)
C source code for the Python bufferkdtree implementation
|
#include "include/cpu.h"
void brute_force_leaf_cpu | ( | INT_TYPE | fr_idx, |
INT_TYPE | to_idx, | ||
FLOAT_TYPE * | test_patterns, | ||
INT_TYPE | ntest_patterns, | ||
FLOAT_TYPE * | d_min, | ||
INT_TYPE * | idx_min, | ||
TREE_RECORD * | tree_record, | ||
TREE_PARAMETERS * | params | ||
) |
Brute-force nearest neigbhor search in a leaf of the tree (determined by fr_idx, to_idx, and XI).
fr_idx | The "from" index w.r.t. the training indices |
to_idx | The "to" index w.r.t. the training indices |
*test_patterns | Array of test patterns |
ntest_patterns | Number of test patterns |
*d_min | Array of distance values that can be updated |
*idx_min | Array of indices that can be updated |
*tree_record | Pointer to struct instance storing the model |
*params | Pointer to struct instance storing all model parameters |
void do_bruteforce_all_leaves_cpu | ( | INT_TYPE * | test_indices_removed_from_all_buffers, |
INT_TYPE | total_number_test_indices_removed, | ||
INT_TYPE * | fr_indices, | ||
INT_TYPE * | to_indices, | ||
TREE_RECORD * | tree_record, | ||
TREE_PARAMETERS * | params | ||
) |
Performs a brute-force in the leaves.
*test_indices_removed_from_all_buffers | Array of indices that were removed from all buffers |
total_number_test_indices_removed | Number of removed indices |
*fr_indices | Array of "from" indices (see paper) |
*to_indices | Array of "to" indices (see paper) |
*tree_record | Pointer to struct instance storing the model |
*params | Pointer to struct instance storing all model parameters |
void find_leaf_idx_batch_cpu | ( | INT_TYPE * | all_next_indices, |
INT_TYPE | num_all_next_indices, | ||
INT_TYPE * | ret_vals, | ||
TREE_RECORD * | tree_record, | ||
TREE_PARAMETERS * | params | ||
) |
Finds the next leaf indices for all test patterns indixed by all_next_indices.
all_next_indices | Array containing indices to be processed |
num_all_next_indices | Number of indices |
*ret_vals | For each index, the next leaf buffer that needs to be processed |
*tree_record | Pointer to struct instance storing the model |
*params | Pointer to struct instance storing all model parameters |
void get_distances_and_indices_cpu | ( | TREE_RECORD * | tree_record, |
TREE_PARAMETERS * | params | ||
) |
Copies the arrays dist_min_global and idx_min_global from GPU to CPU Updates the distances and indices (w.r.t the original indices)
*tree_record | Pointer to struct instance storing the model |
*params | Pointer to struct instance storing all model parameters |
void init_arrays_cpu | ( | TREE_RECORD * | tree_record, |
TREE_PARAMETERS * | params | ||
) |
Initializes all arrays.
*tree_record | Pointer to struct instance storing the model |
*params | Pointer to struct instance storing all model parameters |
void process_all_buffers_cpu | ( | TREE_RECORD * | tree_record, |
TREE_PARAMETERS * | params | ||
) |
Processes all buffers on the CPU.
*tree_record | Pointer to struct instance storing the model |
*params | Pointer to struct instance storing all model parameters |
void process_queue_via_brute_force_cpu | ( | TREE_RECORD * | tree_record, |
TREE_PARAMETERS * | params | ||
) |
If only few elements are left in the queues after the buffers have been emptied, we do a simple brute force step to compute the nearest neighbors.
*tree_record | Pointer to struct instance storing the model |
*params | Pointer to struct instance storing all model parameters |
void write_sorted_training_patterns_cpu | ( | TREE_RECORD * | tree_record, |
TREE_PARAMETERS * | params | ||
) |
Writes the training patterns in a specific ordering.
*tree_record | Pointer to struct instance storing the model |
*params | Pointer to struct instance storing all model parameters |