Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added test for fibonacci heap
  • Loading branch information
lisitsyn committed Aug 23, 2011
1 parent a3f2933 commit ff913e7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/undocumented/libshogun/Makefile
Expand Up @@ -35,6 +35,7 @@ TARGETS = basic_minimal classifier_libsvm classifier_minimal_svm \
clustering_kmeans base_parameter_map \
splitting_stratified_crossvalidation \
mathematics_arpack \
library_fibonacci_heap \

all: $(TARGETS)

Expand Down
31 changes: 31 additions & 0 deletions examples/undocumented/libshogun/library_fibonacci_heap.cpp
@@ -0,0 +1,31 @@
#include <shogun/lib/FibonacciHeap.h>
#include <stdio.h>

using namespace shogun;

int main(int argc, char** argv)
{
init_shogun();
double v[8] = {0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7};
int k[8] = {0,1,2,3,4,5,6,7};

CFibonacciHeap* heap = new CFibonacciHeap(8);

for (int i=0; i<8; i++)
heap->insert(k[i],v[i]);

int k_extract;
double v_extract;
for (int i=0; i<8; i++)
{
k_extract = heap->extract_min(v_extract);
if (v[k_extract]!=v_extract)
{
printf("Fibonacci heap goes wrong.\n");
}
}

exit_shogun();
return 0;
}

0 comments on commit ff913e7

Please sign in to comment.