diff --git a/CITATION.cff b/CITATION.cff index 58f92510..72b7685d 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -5,20 +5,20 @@ cff-version: 1.2.0 title: Monotone Parameterization Toolkit (MParT) message: 'If you use MParT, please cite it as below.' type: software -version: 1.4.0 +version: 2.1.1 authors: - given-names: Matthew family-names: Parno email: parnomd@gmail.com orcid: https://orcid.org/0000-0002-9419-2693 - - given-names: Paul-Baptiste - family-names: Rubio - email: rubiop@mit.edu - orcid: https://orcid.org/0000-0002-9765-1162 - given-names: Daniel family-names: Sharp email: dannys4@vt.edu orcid: https://orcid.org/0000-0002-0439-5084 + - given-names: Paul-Baptiste + family-names: Rubio + email: rubiop@mit.edu + orcid: https://orcid.org/0000-0002-9765-1162 - given-names: Michael family-names: Brennan email: mcbrenn@mit.edu diff --git a/CMakeLists.txt b/CMakeLists.txt index f7edc515..ad93fc40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.13) -project(MParT VERSION 2.0.2) +project(MParT VERSION 2.1.1) message(STATUS "Will install MParT to ${CMAKE_INSTALL_PREFIX}") diff --git a/MParT/TrainMapAdaptive.h b/MParT/TrainMapAdaptive.h index 9a21ae9b..e4d2e838 100644 --- a/MParT/TrainMapAdaptive.h +++ b/MParT/TrainMapAdaptive.h @@ -20,7 +20,7 @@ struct ATMOptions: public MapOptions, public TrainOptions { /** Maximum number of iterations that do not improve error */ unsigned int maxPatience = 10; /** Maximum number of coefficients in final expansion (including ALL dimensions of map) */ - unsigned int maxSize = std::numeric_limits::infinity(); + unsigned int maxSize = std::numeric_limits::max(); // <- use this instead of infinity because python doesn't have infinite ints /** Multiindex representing the maximum degree in each input dimension */ MultiIndex maxDegrees; diff --git a/MParT/Utilities/ArrayConversions.h b/MParT/Utilities/ArrayConversions.h index 0c03b87b..c2ca1cc1 100644 --- a/MParT/Utilities/ArrayConversions.h +++ b/MParT/Utilities/ArrayConversions.h @@ -145,7 +145,7 @@ namespace mpart{ template StridedVector ConstVecToKokkos(const std::vector &vec) { - double* ptr = const_cast(vec.data()); + ScalarType* ptr = const_cast(vec.data()); return Kokkos::View(ptr, vec.size()); } diff --git a/bindings/python/src/MultiIndex.cpp b/bindings/python/src/MultiIndex.cpp index b5631220..72885841 100644 --- a/bindings/python/src/MultiIndex.cpp +++ b/bindings/python/src/MultiIndex.cpp @@ -164,14 +164,23 @@ void mpart::binding::MultiIndexWrapper(py::module &m) })) .def(py::init( [](unsigned int dim, - Eigen::Matrix &nzStarts, - Eigen::Matrix &nzDims, - Eigen::Matrix &nzOrders) - { - return new FixedMultiIndexSet(dim, - VecToKokkos(nzStarts), - VecToKokkos(nzDims), - VecToKokkos(nzOrders)); + Eigen::Matrix nzStartsIn, + Eigen::Matrix nzDimsIn, + Eigen::Matrix nzOrdersIn) + { + // Deep copy the arrays into Kokkos + Kokkos::View nzStarts("nzStarts", nzStartsIn.rows()); + Kokkos::View nzDims("nzDims", nzDimsIn.rows()); + Kokkos::View nzOrders("nzOrders", nzOrdersIn.rows()); + + for(unsigned int i=0; i(dim, nzStarts, nzDims, nzOrders); })) .def(py::init()) @@ -189,6 +198,9 @@ void mpart::binding::MultiIndexWrapper(py::module &m) .def("__len__", &FixedMultiIndexSet::Length) .def("Length", &FixedMultiIndexSet::Length) .def("Size", &FixedMultiIndexSet::Size) + .def("IndexToMulti", &FixedMultiIndexSet::IndexToMulti) + .def("MultiToIndex", &FixedMultiIndexSet::MultiToIndex) + #if defined(MPART_HAS_CEREAL) .def("Serialize", [](FixedMultiIndexSet const &mset, std::string const &filename){ std::ofstream os(filename); diff --git a/pyproject.toml b/pyproject.toml index 679ba838..8af537e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ license={file="LICENSE.txt"} readme="README.md" requires-python = ">=3.7" description="A Monotone Parameterization Toolkit" -version="2.0.2" +version="2.1.1" keywords=["Measure Transport", "Monotone", "Transport Map", "Isotonic Regression", "Triangular", "Knothe-Rosenblatt"] [project.urls] diff --git a/setup.py b/setup.py index 0c55b3d1..4c33e623 100644 --- a/setup.py +++ b/setup.py @@ -37,5 +37,5 @@ def get_install_locations(): package_dir={'mpart': 'bindings/python/package'}, package_data={'mpart':['**/*pympart*']}, include_package_data=True, - cmake_args=['-DKokkos_ENABLE_THREADS:BOOL=ON', f'-DSKBUILD_LIB_RPATH={lib_folder}', f'-DSKBUILD_SITE_PATH={site_folder}', '-DPYTHON_INSTALL_SUFFIX=bindings/python/package/', '-DMPART_JULIA:BOOL=OFF', '-DMPART_MATLAB:BOOL=OFF', '-DMPART_BUILD_TESTS:BOOL=OFF', '-DMPART_PYTHON:BOOL=ON', '-DPYTHON_INSTALL_PREFIX='] + cmake_args=['-DKokkos_ENABLE_THREADS:BOOL=ON', '-DKokkos_ENABLE_THREADS=ON', f'-DSKBUILD_LIB_RPATH={lib_folder}', f'-DSKBUILD_SITE_PATH={site_folder}', '-DPYTHON_INSTALL_SUFFIX=bindings/python/package/', '-DMPART_JULIA:BOOL=OFF', '-DMPART_MATLAB:BOOL=OFF', '-DMPART_BUILD_TESTS:BOOL=OFF', '-DMPART_PYTHON:BOOL=ON', '-DPYTHON_INSTALL_PREFIX='] ) \ No newline at end of file