From 4daef98a6d4f4561865ecbe8be585f00ce8dee25 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 14 Apr 2010 22:49:39 +0000 Subject: [PATCH] Add kernel_pca (which required sparse) to default build, modify a few things (ticket #13 is related) so it compiles fine --- fastlib/trunk/mlpack/CMakeLists.txt | 17 +++++++++++++++-- fastlib/trunk/mlpack/kernel_pca/kernel_pca.h | 9 ++++++--- .../trunk/mlpack/kernel_pca/kernel_pca_test.cc | 5 +++-- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/fastlib/trunk/mlpack/CMakeLists.txt b/fastlib/trunk/mlpack/CMakeLists.txt index a18b4c476b..35f5214638 100644 --- a/fastlib/trunk/mlpack/CMakeLists.txt +++ b/fastlib/trunk/mlpack/CMakeLists.txt @@ -38,7 +38,7 @@ set(MLPACK_STD_LIBS fastlib lapack blas ) ##! this ordering matters :( set( DIRS allkfn allknn allnn - # disk_allnn #requires mmanager +# disk_allnn # does not compile, perhaps due to an API change emst fastica hmm @@ -46,7 +46,7 @@ set( DIRS # isonmf ## nothing here yet kalman kde - # kernel_pca # requires sparse +# kernel_pca # requires sparse #mog # requires optimization # mlpackdemo ## matlab routines #mvu # requires optimization @@ -59,6 +59,10 @@ set( DIRS svm ) +if(WITH_SPARSE) + set(DIRS ${DIRS} kernel_pca) +endif() + foreach(dir ${DIRS}) add_subdirectory(${dir}) endforeach() @@ -66,6 +70,15 @@ endforeach() # MLPACK_SRCS is set in the subdirectories add_library(mlpack ${MLPACK_SRCS}) add_dependencies(mlpack fastlib) +target_link_libraries(mlpack + fastlib +) + +if(WITH_SPARSE) + target_link_libraries(mlpack + ${TRILINOS_LIBS} + ) +endif() # move header files to the right directory file(GLOB_RECURSE INCLUDE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) diff --git a/fastlib/trunk/mlpack/kernel_pca/kernel_pca.h b/fastlib/trunk/mlpack/kernel_pca/kernel_pca.h index eb9856fdd2..e5607084b6 100644 --- a/fastlib/trunk/mlpack/kernel_pca/kernel_pca.h +++ b/fastlib/trunk/mlpack/kernel_pca/kernel_pca.h @@ -10,11 +10,14 @@ #include #include #include -#include "fastlib/fastlib.h" -#include "fastlib/la/matrix.h" -#include "fastlib/sparse/sparse_matrix.h" +#include +#include #include "mlpack/allknn/allknn.h" +// sparse_matrix.h undefines LI; see #13 +// so we must include allknn.h (which uses LI) first +#include + class KernelPCATest; /** * KernelPCA class is the main class that implements several spectral methods diff --git a/fastlib/trunk/mlpack/kernel_pca/kernel_pca_test.cc b/fastlib/trunk/mlpack/kernel_pca/kernel_pca_test.cc index 4f7195adda..f6acdb028e 100644 --- a/fastlib/trunk/mlpack/kernel_pca/kernel_pca_test.cc +++ b/fastlib/trunk/mlpack/kernel_pca/kernel_pca_test.cc @@ -17,9 +17,10 @@ */ #include "kernel_pca.h" -#include "fastlib/fastlib.h" -#include "fastlib/base/test.h" #include +#include +#include +#include class KernelPCATest { public: