-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Master' into 47-job-sceduler
- Loading branch information
Showing
16 changed files
with
545 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
#include "Dimension.h" | ||
#ifndef MATHEMATICAL_FUNCTIONS_H | ||
#define MATHEMATICAL_FUNCTIONS_H | ||
|
||
#include <math.h> | ||
#include <stddef.h> | ||
#include <stdio.h> | ||
#include "Node.h" | ||
#include "common_types.h" | ||
#include <string.h> | ||
|
||
double euclidean_distance(Dimension* nodeDimension1 , Dimension* nodeDimension2); | ||
|
||
double manhattan_distance(Dimension* nodeDimension1 , Dimension* nodeDimension2); | ||
|
||
double distance(Dimension* nodeDimension1 , Dimension* nodeDimension2, String distance_function); | ||
double calculate_norm(Dimension* head); | ||
|
||
double euclidean_distance_improved(Node* node1, Node* node2); | ||
|
||
double distance(Node* node1, Node* node2, String distance_function); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#ifndef PROJECTIONTREES_H | ||
#define PROJECTIONTREES_H | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include "common_types.h" | ||
#include "Node.h" | ||
#include "Graph.h" | ||
#include "MathematicalFunctions.h" | ||
#include "knn.h" | ||
|
||
// Define a data structure for a node in the tree | ||
typedef struct TreeNode { | ||
int* projection; // Random projection vector | ||
struct TreeNode* left; | ||
struct TreeNode* right; | ||
Node* data; // Only for leaf nodes | ||
} TreeNode; | ||
|
||
|
||
int* generateRandomProjection(int dimension); | ||
|
||
double computeProjection(Node* point, int* projection); | ||
|
||
void addData(Node** headData, Node* data); | ||
|
||
TreeNode* buildRandomProjectionTree(Node* data, int dimension, int D, int numNodes); | ||
|
||
Node* searchTree(TreeNode* root, Node* node); | ||
|
||
void randomNeighbors(Graph** graph, TreeNode* root, int K, String distance_function); | ||
|
||
void remainingRandomNodes(Graph** graph, Node* currentNode, int* usedNumbers, int remainingNodes, int K, String distance_function); | ||
|
||
void freeTree(TreeNode* root); | ||
|
||
void freeNodeProj(Node* node); | ||
|
||
void freeDimensionProj(Dimension* dimension); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.