diff options
Diffstat (limited to 'src/Kernels/example')
-rw-r--r-- | src/Kernels/example/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/Kernels/example/kernel.txt | 8 | ||||
-rw-r--r-- | src/Kernels/example/kernel_basic_example.cpp | 65 |
3 files changed, 0 insertions, 83 deletions
diff --git a/src/Kernels/example/CMakeLists.txt b/src/Kernels/example/CMakeLists.txt deleted file mode 100644 index d8ad4b42..00000000 --- a/src/Kernels/example/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 2.6) -project(Kernels_examples) - -add_executable ( BasicEx kernel_basic_example.cpp ) - -if (TBB_FOUND) - target_link_libraries(BasicEx ${TBB_LIBRARIES}) -endif() - -add_test(NAME Kernels_example_basicex COMMAND $<TARGET_FILE:BasicEx> "${CMAKE_SOURCE_DIR}/data/persistence_diagram/PD1" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/PD2")
\ No newline at end of file diff --git a/src/Kernels/example/kernel.txt b/src/Kernels/example/kernel.txt deleted file mode 100644 index 5fb8b504..00000000 --- a/src/Kernels/example/kernel.txt +++ /dev/null @@ -1,8 +0,0 @@ -SWK exact = 0.875446 -SWK approx = 0.875204 -PSSK exact = 0.0218669 -PSSK approx = 0.0213766 -LPWGK exact = 2.57351 -LPWGK approx = 2.49102 -GPWGK exact = 0.98783 -GPWGK approx = 0.987591
\ No newline at end of file diff --git a/src/Kernels/example/kernel_basic_example.cpp b/src/Kernels/example/kernel_basic_example.cpp deleted file mode 100644 index 7ecbe401..00000000 --- a/src/Kernels/example/kernel_basic_example.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Authors: Mathieu Carrière - * - * Copyright (C) 2017 INRIA - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <gudhi/kernel.h> -#include <iostream> -#include <string> -#include <fstream> -#include <sstream> - - -void usage(int nbArgs, char *const progName) { - std::cerr << "Error: Number of arguments (" << nbArgs << ") is not correct\n"; - std::cerr << "Usage: " << progName << " PD1 PD2 \n"; - std::cerr << " i.e.: " << progName << " ../../../../data/persistence_diagram/PD1.pers ../../../../data/persistence_diagram/PD2.pers \n"; - exit(-1); // ----- >> -} - -int main(int argc, char **argv) { - - if (argc != 3) usage(argc, argv[0]); - - double sigma = 2; double tau = 5; - - std::string PDname1(argv[1]); std::string PDname2(argv[2]); - std::vector< std::pair<double, double> > v1, v2; std::string line; double b,d; - - std::ifstream input1(PDname1); - while(std::getline(input1,line)){ - std::stringstream stream(line); stream >> b; stream >> d; v1.push_back(std::pair<double,double>(b,d)); - } - - std::ifstream input2(PDname2); - while(std::getline(input2,line)){ - std::stringstream stream(line); stream >> b; stream >> d; v2.push_back(std::pair<double,double>(b,d)); - } - - std::cout << "SWK exact = " << Gudhi::kernel::sliced_wasserstein_kernel (v1,v2,sigma,-1) << std::endl; - std::cout << "SWK approx = " << Gudhi::kernel::sliced_wasserstein_kernel (v1,v2,sigma) << std::endl; - std::cout << "PSSK exact = " << Gudhi::kernel::persistence_scale_space_kernel (v1,v2,sigma,-1) << std::endl; - std::cout << "PSSK approx = " << Gudhi::kernel::persistence_scale_space_kernel (v1,v2,sigma) << std::endl; - std::cout << "LPWGK exact = " << Gudhi::kernel::linear_persistence_weighted_gaussian_kernel (v1,v2,sigma,Gudhi::kernel::arctan_weight,-1) << std::endl; - std::cout << "LPWGK approx = " << Gudhi::kernel::linear_persistence_weighted_gaussian_kernel (v1,v2,sigma,Gudhi::kernel::arctan_weight) << std::endl; - std::cout << "GPWGK exact = " << Gudhi::kernel::gaussian_persistence_weighted_gaussian_kernel (v1,v2,sigma,tau,Gudhi::kernel::arctan_weight,-1) << std::endl; - std::cout << "GPWGK approx = " << Gudhi::kernel::gaussian_persistence_weighted_gaussian_kernel (v1,v2,sigma,tau,Gudhi::kernel::arctan_weight) << std::endl; - -} |