Skip to content

Instantly share code, notes, and snippets.

View c4goldsw's full-sized avatar

Chris Goldsworthy c4goldsw

View GitHub Profile
chris:~/programming/shogun/build/tests/unit$ valgrind ctest -R LDA
==9073== Memcheck, a memory error detector
==9073== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==9073== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==9073== Command: ctest -R LDA
==9073==
Test project /home/chris/programming/shogun/build/tests/unit
Start 99: unit-FLDATest
1/4 Test #99: unit-FLDATest .................... Passed 0.10 sec
Start 100: unit-FLDATesti
[ 92%] Building CXX object tests/unit/CMakeFiles/shogun-unit-test.dir/classifier/LDA_unittest.cc.o
Linking CXX executable shogun-unit-test
CMakeFiles/shogun-unit-test.dir/features/StreamingSparseFeatures_unittest.cc.o: In function `testing::internal::FloatingPoint<double>::DistanceBetweenSignAndMagnitudeNumbers(unsigned long long const&, unsigned long long const&)':
/home/chris/programming/shogun/tests/unit/features/StreamingSparseFeatures_unittest.cc:22: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
CMakeFiles/shogun-unit-test.dir/DynamicObjectArray_unittest.cc.o: In function `__static_initialization_and_destruction_0':
/home/chris/programming/shogun/tests/unit/DynamicObjectArray_unittest.cc:16: undefined reference to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
/home/chris/programming/shogun/tests/unit/DynamicObjectArray_unittest.cc:37: undefined refere
chris@Pure-Gold:~/programming/shogun/build$ make
[ 0%] Built target Eigen3
[ 1%] Built target class_list
[ 2%] Generating version header
[ 2%] Built target version
[ 66%] Built target libshogun
[ 66%] Built target shogun
[ 66%] copying SWIG files
[ 66%] Built target python_modular_src
[ 66%] Building CXX object src/interfaces/python_modular/CMakeFiles/_python_modular.dir/modshogunPYTHON_wrap.cxx.o
#include <shogun/features/DenseFeatures.h>
#include <shogun/features/DataGenerator.h>
#include <shogun/labels/BinaryLabels.h>
#include <shogun/classifier/LDA.h>
int main(argc, argv**)
{
...
return 0;
@c4goldsw
c4goldsw / LDA.cpp
Created July 29, 2016 15:52
Templated LDA train
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 1999-2009 Soeren Sonnenburg
* Written (W) 2014 Abhijeet Kislay
* Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
*/
chris@Pure-Gold:~/programming/shogun/build$ make
[ 0%] Built target Eigen3
[ 1%] Built target GoogleMock
[ 1%] Built target discover_gtest_tests
[ 1%] Built target class_list
[ 2%] Generating version header
[ 2%] Built target version
Scanning dependencies of target libshogun
[ 2%] Building CXX object src/shogun/CMakeFiles/libshogun.dir/regression/LeastAngleRegression.cpp.o
[ 66%] Built target libshogun
template <class ST> SGMatrix<ST> CLeastAngleRegression<ST>::cholesky_insert(const SGMatrix<ST>& X,
const SGMatrix<ST>& X_active, SGMatrix<ST>& R, int32_t i_max_corr, int32_t num_active)
{
Map<Matrix<ST,-1,-1,0,-1,-1>> map_X(X.matrix, X.num_rows, X.num_cols); //Map<VectorXd>
Map<Matrix<ST,-1,-1,0,-1,-1>> map_X_active(X_active.matrix, X.num_rows, num_active); //Map<MatrixXd>
ST diag_k = map_X.col(i_max_corr).dot(map_X.col(i_max_corr));
// col_k is the k-th column of (X'X)
Map<Matrix<ST, -1, 1, 0,-1, 1>> map_i_max(X.get_column_vector(i_max_corr), X.num_rows);//Map<VectorXd>
Matrix<ST, -1, 1, 0,-1, 1> R_k = map_X_active.transpose()*map_i_max;//VectorXd
chris@Pure-Gold:~/programming/shogun/build$ cmake -DENABLE_TESTING=on -DCMAKE_BUILD_TYPE=Debug ..
-- Could not determine Eclipse version, assuming at least 3.6 (Helios). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.
-- Using system's malloc
-- Could NOT find MOSEK (missing: MOSEK_DIR MOSEK_INCLUDE_DIR MOSEK_LIBRARY)
-- A library with BLAS API found.
-- A library with LAPACK API found.
-- Could NOT find Atlas (missing: Atlas_BLAS_LIBRARY Atlas_LAPACK_LIBRARY)
-- Could NOT find CBLAS (missing: CBLAS_LIBRARY)
-- Could NOT find GLPK (missing: GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_PROPER_VERSION_FOUND)
-- Could NOT find CPLEX (missing: CPLEX_LIBRARY CPLEX_INCLUDE_DIR)
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 2012 Chiyuan Zhang
* Copyright (C) 2012 Chiyuan Zhang
*/
chris@Pure-Gold:~/programming/shogun/build$ make
[ 0%] Built target Eigen3
[ 1%] Built target GoogleMock
[ 1%] Built target discover_gtest_tests
[ 1%] Built target class_list
[ 2%] Generating version header
[ 2%] Built target version
[ 64%] Built target libshogun
[ 64%] Built target shogun
[ 88%] Built target shogun-unit-test