diff --git a/CMakeLists.txt b/CMakeLists.txt index 736a8f007c7528dc53592346bf73929c2c64d673..7e3efe2aafe05d1e4078f490d3569156bbe3236d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,7 @@ find_package(PkgConfig) find_package(Torch) if(DEFINED PKGCONFIG_FOUND) + pkg_search_module(TYPE libkisstype) pkg_search_module(EIS libeisgenerator) endif(DEFINED PKGCONFIG_FOUND) @@ -50,7 +51,7 @@ else (DOXYGEN_FOUND) endif (DOXYGEN_FOUND) add_library(${PROJECT_NAME} SHARED drt.cpp) -target_link_libraries(${PROJECT_NAME} ${EIGEN3_LIBRARIES} ${EIS_LIBRARIES} -leisgenerator) +target_link_libraries(${PROJECT_NAME} ${EIGEN3_LIBRARIES} ${EIS_LIBRARIES} ${TYPE_LIBRARIES}) target_include_directories(${PROJECT_NAME} PUBLIC ${EIGEN3_INCLUDE_DIRS} ${EIS_INCLUDE_DIRS} ./LBFG) set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-Wall -O2 -march=native -g" LINK_FLAGS "-flto") install(TARGETS ${PROJECT_NAME} DESTINATION lib) @@ -58,7 +59,7 @@ install(TARGETS ${PROJECT_NAME} DESTINATION lib) if(DEFINED TORCH_LIBRARIES) message("torch support enabled") add_library(${PROJECT_NAME}_torch SHARED torchdrt.cpp) - target_link_libraries(${PROJECT_NAME}_torch ${TORCH_LIBRARIES} ${EIGEN3_LIBRARIES} ${PROJECT_NAME} ${EIS_LIBRARIES}) + target_link_libraries(${PROJECT_NAME}_torch ${TORCH_LIBRARIES} ${EIGEN3_LIBRARIES} ${PROJECT_NAME} ${EIS_LIBRARIES} ${TYPE_LIBRARIES}) target_include_directories(${PROJECT_NAME}_torch PUBLIC ${TORCH_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS} ${EIS_INCLUDE_DIRS} ./LBFG) set_target_properties(${PROJECT_NAME}_torch PROPERTIES COMPILE_FLAGS "-Wall -O2 -march=native -g" LINK_FLAGS "-flto") install(TARGETS ${PROJECT_NAME}_torch DESTINATION lib) @@ -71,14 +72,14 @@ if(DEFINED EIS_FOUND) link_directories(${CMAKE_CURRENT_BINARY_DIR}) add_executable(${PROJECT_NAME}_test main.cpp) add_dependencies(${PROJECT_NAME}_test ${PROJECT_NAME}) - target_link_libraries(${PROJECT_NAME}_test -l${PROJECT_NAME} ${EIGEN3_LIBRARIES} ${EIS_LIBRARIES}) + target_link_libraries(${PROJECT_NAME}_test -l${PROJECT_NAME} ${EIGEN3_LIBRARIES} ${EIS_LIBRARIES} ${TYPE_LIBRARIES}) target_include_directories(${PROJECT_NAME}_test PRIVATE . ${EIGEN3_INCLUDE_DIRS} ${EIS_INCLUDE_DIRS}) set_target_properties(${PROJECT_NAME}_test PROPERTIES COMPILE_FLAGS "-Wall -O2 -march=native -g" LINK_FLAGS "-flto") link_directories(${CMAKE_CURRENT_BINARY_DIR}) add_executable(${PROJECT_NAME}_cli cli.cpp) add_dependencies(${PROJECT_NAME}_cli ${PROJECT_NAME}) - target_link_libraries(${PROJECT_NAME}_cli -l${PROJECT_NAME} ${EIGEN3_LIBRARIES} ${EIS_LIBRARIES}) + target_link_libraries(${PROJECT_NAME}_cli -l${PROJECT_NAME} ${EIGEN3_LIBRARIES} ${EIS_LIBRARIES} ${TYPE_LIBRARIES}) target_include_directories(${PROJECT_NAME}_cli PRIVATE . ${EIGEN3_INCLUDE_DIRS} ${EIS_INCLUDE_DIRS}) set_target_properties(${PROJECT_NAME}_cli PROPERTIES COMPILE_FLAGS "-Wall -O2 -march=native -g" LINK_FLAGS "-flto") install(TARGETS ${PROJECT_NAME}_cli DESTINATION bin) @@ -87,7 +88,7 @@ if(DEFINED EIS_FOUND) link_directories(${CMAKE_CURRENT_BINARY_DIR}) add_executable(${PROJECT_NAME}_test_torch testtorchdrt.cpp eistotorch.cpp) add_dependencies(${PROJECT_NAME}_test_torch ${PROJECT_NAME}) - target_link_libraries(${PROJECT_NAME}_test_torch ${PROJECT_NAME}_torch ${EIGEN3_LIBRARIES} ${EIS_LIBRARIES}) + target_link_libraries(${PROJECT_NAME}_test_torch ${PROJECT_NAME}_torch ${EIGEN3_LIBRARIES} ${EIS_LIBRARIES} ${TYPE_LIBRARIES}) target_include_directories(${PROJECT_NAME}_test_torch PRIVATE . ${EIGEN3_INCLUDE_DIRS} ${EIS_INCLUDE_DIRS}) set_target_properties(${PROJECT_NAME}_test_torch PROPERTIES COMPILE_FLAGS "-Wall -O2 -march=native -g" LINK_FLAGS "-flto") endif(DEFINED TORCH_LIBRARIES) diff --git a/cli.cpp b/cli.cpp index 2960bd71b6cd29bfa5699327333ee4012b1c4db2..b35653e77e23c631c7225aed7de760425ce7868e 100644 --- a/cli.cpp +++ b/cli.cpp @@ -19,7 +19,8 @@ // #include <iostream> -#include <eisgenerator/eistype.h> +#include <kisstype/type.h> +#include <kisstype/spectra.h> #include "eisdrt/eisdrt.h" @@ -40,10 +41,10 @@ static void print_drt(const std::vector<fvalue>& data) std::cout<<"]\n"; } -static eis::EisSpectra transform_to_drt_spectra(const std::vector<fvalue>& drt, const eis::EisSpectra& spectra) +static eis::Spectra transform_to_drt_spectra(const std::vector<fvalue>& drt, const eis::Spectra& spectra) { assert(spectra.data.size() == drt.size()); - eis::EisSpectra drtSpectra = spectra; + eis::Spectra drtSpectra = spectra; drtSpectra.data.clear(); drtSpectra.data.reserve(drt.size()); @@ -70,18 +71,18 @@ int main(int argc, char** argv) try { - eis::EisSpectra spectra; + eis::Spectra spectra; if(std::string(argv[1]) != "-") { if(!toStdout) std::cout<<"Loading spectra\n"; - spectra = eis::EisSpectra::loadFromDisk(argv[1]); + spectra = eis::Spectra::loadFromDisk(argv[1]); } else { if(!toStdout) std::cout<<"Waiting for spectra on stdin\n"; - spectra = eis::EisSpectra::loadFromStream(std::cin); + spectra = eis::Spectra::loadFromStream(std::cin); } if(!toStdout) @@ -95,17 +96,11 @@ int main(int argc, char** argv) print_drt(drt); } - eis::EisSpectra drtSpectra = transform_to_drt_spectra(drt, spectra); - bool ret = true; + eis::Spectra drtSpectra = transform_to_drt_spectra(drt, spectra); if(!toStdout) - ret = drtSpectra.saveToDisk(argv[2]); + drtSpectra.saveToDisk(argv[2]); else drtSpectra.saveToStream(std::cout); - if(!ret) - { - std::cerr<<"Could not save spectra to "<<argv[2]<<'\n'; - return 1; - } } catch(const eis::file_error& err) { diff --git a/drt.cpp b/drt.cpp index b74f4315897c03f77566da6ce67b991f19525272..3125f9c5113dd9c62370286c5e25cdb5db9e2d00 100644 --- a/drt.cpp +++ b/drt.cpp @@ -29,8 +29,6 @@ #include <Eigen/Core> #include <Eigen/StdVector> -#include <eisgenerator/eistype.h> -#include <iostream> #include "Eigen/src/Core/Matrix.h" #include "LBFG/LBFGSB.h" diff --git a/eigentorchconversions.h b/eigentorchconversions.h index 58340b0c2bc5a1cc377c0fa7ccd4657e3b45514b..7d946222b6bf85a88f5b11b31814c013879ee72f 100644 --- a/eigentorchconversions.h +++ b/eigentorchconversions.h @@ -19,7 +19,6 @@ #include <c10/core/ScalarType.h> #include <climits> -#include <eisgenerator/eistype.h> #include <sys/types.h> #include <torch/torch.h> #include <Eigen/Dense> diff --git a/eisdrt/eisdrt.h b/eisdrt/eisdrt.h index f31d00fdf5abdf338718fad880339dca7c1853b0..5b2e512f20555cb52ac2e0d0c7465f59ea58f6d5 100644 --- a/eisdrt/eisdrt.h +++ b/eisdrt/eisdrt.h @@ -17,7 +17,7 @@ * along with libeisdrt. If not, see <http://www.gnu.org/licenses/>. */ -#include <eisgenerator/eistype.h> +#include <kisstype/type.h> #include <vector> #include "types.h" diff --git a/eisdrt/eistorchdrt.h b/eisdrt/eistorchdrt.h index e300b8fc7d197ec0fde189fe124b39d489f5c778..238d1481aeb32c727b4e0c1513ea77daf96cbdea 100644 --- a/eisdrt/eistorchdrt.h +++ b/eisdrt/eistorchdrt.h @@ -17,7 +17,7 @@ * along with libeisdrt. If not, see <http://www.gnu.org/licenses/>. */ -#include <eisgenerator/eistype.h> +#include <kisstype/type.h> #include "torchdrt.h" diff --git a/eistoeigen.h b/eistoeigen.h index 1aca508385dcda716f0b64e6ca96c403a545d222..e7b29e5270a59c3f8ad51075b8ee50b79236341a 100644 --- a/eistoeigen.h +++ b/eistoeigen.h @@ -23,7 +23,7 @@ #include "Eigen/src/Core/Matrix.h" #include <Eigen/Core> -#include <eisgenerator/eistype.h> +#include <kisstype/type.h> #include <vector> Eigen::VectorX<std::complex<fvalue>> eistoeigen(const std::vector<eis::DataPoint>& data, Eigen::Vector<fvalue, Eigen::Dynamic>* omega = nullptr) diff --git a/eistotorch.h b/eistotorch.h index 20a724a6c3075fef6ff9dbe23a9f87624de29758..bde223a83409d7d53ee9656f16ea9aca038dcf76 100644 --- a/eistotorch.h +++ b/eistotorch.h @@ -19,7 +19,7 @@ #pragma once -#include <eisgenerator/eistype.h> +#include <kisstype/type.h> #include <torch/torch.h> #include <vector> diff --git a/main.cpp b/main.cpp index 169d59f17182695c6b4b4a36e6d99acfd67276e1..01a0f6210c2fcb1fbba53b119ff23dfee81290ae 100644 --- a/main.cpp +++ b/main.cpp @@ -20,7 +20,7 @@ #include <iostream> #include <eisgenerator/model.h> -#include <eisgenerator/eistype.h> +#include <kisstype/type.h> #include <eisgenerator/basicmath.h> #include "eisdrt/eisdrt.h"