diff --git a/CMakeLists.txt b/CMakeLists.txt index 94e768e..3383943 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,228 +1,92 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.16) - -SET(CARMA_VERSION_MAJOR 0) -SET(CARMA_VERSION_MINOR 6) -SET(CARMA_VERSION_PATCH 6) -SET(CARMA_VERSION_INFO "${CARMA_VERSION_MAJOR}.${CARMA_VERSION_MINOR}.${CARMA_VERSION_PATCH}") - -PROJECT( - carma - VERSION ${CARMA_VERSION_INFO} - LANGUAGES CXX -) -INCLUDE(GNUInstallDirs) - -SET(CMAKE_MODULE_PATH_SAVED ${CMAKE_MODULE_PATH}) -LIST(INSERT CMAKE_MODULE_PATH 0 "${PROJECT_SOURCE_DIR}/cmake") -# ############################################################################## -# SETTINGS # -# ############################################################################## -OPTION(CARMA_INSTALL_LIB "Install CARMA headers" OFF) -SET(CARMA_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/carma") - -SET(DEFAULT_BUILD_TYPE "Release") -# Set build type to Release if not specified -INCLUDE(BuildType) - -IF (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - # workaround like https://github.com/nlohmann/json/issues/1408 - # to avoid error like: carma\...\include\armadillo_bits/arma_str.hpp(194): - # error C2039: '_snprintf': is not a member of 'std' - ADD_DEFINITIONS(-DHAVE_SNPRINTF) -ENDIF () - -OPTION(CARMA_DEV_MODE "Enable additional definitions for development" OFF) -OPTION(CARMA_DEV_DEBUG_MODE "Turn on all debugging definitions" OFF) -OPTION(CARMA_BUILD_TESTS "Build tests for carma" OFF) -OPTION(CARMA_BUILD_EXAMPLES "Build examples for carma" OFF) - -# collect user settable options -INCLUDE(${PROJECT_SOURCE_DIR}/carma_config.cmake) -INCLUDE(ParseOptions) -CONFIGURE_FILE( - ${PROJECT_SOURCE_DIR}/include/carma_bits/config.h.in - ${PROJECT_BINARY_DIR}/include/carma_bits/generated_config.h - @ONLY -) +cmake_minimum_required(VERSION 3.20) + +set(CARMA_VERSION_MAJOR 1) +set(CARMA_VERSION_MINOR 0) +set(CARMA_VERSION_PATCH 0) +set(CARMA_VERSION_INFO + "${CARMA_VERSION_MAJOR}.${CARMA_VERSION_MINOR}.${CARMA_VERSION_PATCH}") + +project( + carma + VERSION ${CARMA_VERSION_INFO} + LANGUAGES CXX) +include(GNUInstallDirs) # ############################################################################## -# TARGET # +# SETTINGS # # ############################################################################## -ADD_LIBRARY(carma INTERFACE) -ADD_LIBRARY(carma::carma ALIAS carma) - -TARGET_COMPILE_DEFINITIONS(carma - INTERFACE - CARMA_USE_GENERATED_CONFIG=1 - CARMA_VERSION_MAJOR=${CARMA_VERSION_MAJOR} - CARMA_VERSION_MINOR=${CARMA_VERSION_MINOR} - CARMA_VERSION_PATCH=${CARMA_VERSION_PATCH} - CARMA_VERSION_NAME=${CARMA_VERSION_INFO} - "$<$:${CARMA_RELEASE_DEFINITIONS}>" -) -TARGET_COMPILE_FEATURES(carma INTERFACE cxx_std_14) - -IF(CARMA_DEV_MODE) - TARGET_COMPILE_OPTIONS(carma - INTERFACE - -Wall - -Wextra - -Wunused-variable - -Wunused-const-variable - ) -ENDIF() - -TARGET_INCLUDE_DIRECTORIES(carma - INTERFACE - $ - $ - $ -) - -TARGET_LINK_LIBRARIES(carma - INTERFACE - armadillo::armadillo - Python3::NumPy - Python3::Module - pybind11::pybind11 -) - -ADD_LIBRARY(carma_headers INTERFACE) -ADD_LIBRARY(carma::headers ALIAS carma_headers) - -TARGET_COMPILE_DEFINITIONS(carma_headers - INTERFACE - CARMA_VERSION_MAJOR=${CARMA_VERSION_MAJOR} - CARMA_VERSION_MINOR=${CARMA_VERSION_MINOR} - CARMA_VERSION_PATCH=${CARMA_VERSION_PATCH} - CARMA_VERSION_NAME=${CARMA_VERSION_INFO} -) -TARGET_COMPILE_FEATURES(carma_headers INTERFACE cxx_std_14) - -TARGET_INCLUDE_DIRECTORIES(carma_headers - INTERFACE - $ - $ - $ -) - - -# Only install the headers -IF (CARMA_INSTALL_LIB) - # modified from https://dominikberner.ch/cmake-interface-lib/ - - # locations are provided by GNUInstallDirs - INSTALL( - TARGETS carma - EXPORT carma_Targets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ) - - INSTALL( - TARGETS carma_headers - EXPORT carma_Header_Targets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ) - - INCLUDE(CMakePackageConfigHelpers) - write_basic_package_version_file( - "carmaConfigVersion.cmake" - VERSION ${PROJECT_VERSION} - COMPATIBILITY SameMinorVersion - ) - - configure_package_config_file( - "${PROJECT_SOURCE_DIR}/cmake/carmaConfig.cmake.in" - "${PROJECT_BINARY_DIR}/carmaConfig.cmake" - INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/carma/cmake - ) - - INSTALL( - EXPORT carma_Targets - FILE carmaCarmaTargets.cmake - NAMESPACE carma:: - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/carma/cmake - ) - - INSTALL( - EXPORT carma_Header_Targets - FILE carmaHeaderTargets.cmake - NAMESPACE carma:: - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/carma/cmake - ) - - INSTALL( - FILES - "${PROJECT_BINARY_DIR}/carmaConfig.cmake" - "${PROJECT_BINARY_DIR}/carmaConfigVersion.cmake" - "${PROJECT_SOURCE_DIR}/cmake/carmaDependencyTargets.cmake" - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/carma/cmake - ) - - INSTALL( - FILES "${PROJECT_SOURCE_DIR}/include/carma" - DESTINATION ${CARMA_INCLUDE_INSTALL_DIR} - ) - - INSTALL( - DIRECTORY ${PROJECT_SOURCE_DIR}/include/carma_bits - DESTINATION ${CARMA_INCLUDE_INSTALL_DIR} - FILES_MATCHING - PATTERN "*.h" - ) - - INSTALL( - FILES ${PROJECT_BINARY_DIR}/include/carma_bits/generated_config.h - DESTINATION ${CARMA_INCLUDE_INSTALL_DIR}/carma_bits - ) - -ELSE() - # ############################################################################## - # REQUIREMENTS # - # ############################################################################## - FIND_PACKAGE(Python3 COMPONENTS Development NumPy QUIET) - IF (NOT Python3_FOUND) - FIND_PACKAGE(Python3 COMPONENTS Development.Module NumPy REQUIRED) - ENDIF() - - # Needed to ensure the same Python executable is found by Pybind11 - IF (NOT DEFINED PYTHON_EXECUTABLE) - SET(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) - ENDIF () - - # create armadillo and or pybind11 target if not defined - INCLUDE(ThirdPartyTargets) - - TARGET_PRECOMPILE_HEADERS(carma - INTERFACE - ${PROJECT_SOURCE_DIR}/include/carma_bits/cnalloc.h - ) -ENDIF() +# add_subdirectory(${PROJECT_SOURCE_DIR}/extern/armadillo-code) +set(CMAKE_CXX_STANDARD + 17 + CACHE STRING "C++ version selection") +set(CMAKE_CXX_STANDARD_REQUIRED ON) # optional, ensure standard is supported +set(CMAKE_CXX_EXTENSIONS OFF) # optional, keep compiler extensions off + +if(NOT DEFINED CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif() + +# find_program(CCACHE_FOUND ccache) if(CCACHE_FOUND) set_property(GLOBAL +# PROPERTY RULE_LAUNCH_COMPILE ccache) endif(CCACHE_FOUND) + +# if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") # workaround like +# https://github.com/nlohmann/json/issues/1408 # to avoid error like: +# carma\...\include\armadillo_bits/arma_str.hpp(194): # error C2039: +# '_snprintf': is not a member of 'std' add_definitions(-DHAVE_SNPRINTF) endif +# () + +# Create the public carma header +# configure_file("${PROJECT_SOURCE_DIR}/include/carma.hpp" +# "${PROJECT_SOURCE_DIR}/include/carma" COPYONLY) + # ############################################################################## -# TEST TARGETS # +# REQUIREMENTS # # ############################################################################## -IF(CARMA_BUILD_TESTS OR CARMA_BUILD_EXAMPLES) - SET(CMAKE_CXX_STANDARD 14) -ENDIF() - -IF(CARMA_BUILD_TESTS) - INCLUDE(CTest) - ENABLE_TESTING() - INCLUDE(GetCatch2) - ADD_SUBDIRECTORY(tests) - INCLUDE(ClangFormatTarget) - INCLUDE(CoverageTarget) -ENDIF() - -IF(CARMA_BUILD_EXAMPLES) - ADD_SUBDIRECTORY(examples) -ENDIF() -#------------------------------------------------------ -INCLUDE(ClearOptions) -SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH_SAVED}) -UNSET(CMAKE_MODULE_PATH_SAVED) +find_package( + Python3 + COMPONENTS Interpreter Development NumPy + REQUIRED) +if(NOT DEFINED PYTHON_EXECUTABLE) + set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) +endif() +find_package(pybind11 REQUIRED) +find_package(Armadillo REQUIRED) + +add_library(carma INTERFACE) +add_library(carma_expansion INTERFACE) +add_library(carma_headers INTERFACE) +add_library(carma::carma ALIAS carma) +add_library(carma::headers ALIAS carma_headers) +add_library(carma::expansion ALIAS carma_expansion) + +target_compile_definitions( + carma + INTERFACE CARMA_VERSION_MAJOR=${CARMA_VERSION_MAJOR} + CARMA_VERSION_MINOR=${CARMA_VERSION_MINOR} + CARMA_VERSION_PATCH=${CARMA_VERSION_PATCH} + CARMA_VERSION_NAME=${CARMA_VERSION_INFO}) +set_target_properties(carma PROPERTIES CXX_STANDARD_REQUIRED ON) + +target_compile_options(carma INTERFACE -Wall -Wextra -Wunused-variable + -Wunused-const-variable) +if(CARMA_ENABLE_EXTRA_DEBUG) + target_compile_definitions(carma INTERFACE CARMA_EXTRA_DEBUG=true + CARMA_DEBUG=true) + set(ignoreMe "${CARMA_ENABLE_DEBUG}") +elseif(CARMA_ENABLE_DEBUG) + target_compile_definitions(carma INTERFACE CARMA_DEBUG=true) +endif() + +target_include_directories( + carma INTERFACE $ + ${ARMADILLO_INCLUDE_DIRS}) + +target_link_libraries(carma INTERFACE ${ARMADILLO_LIBRARIES} pybind11::pybind11 + Python3::NumPy Python3::Module) + +add_executable(main ${PROJECT_SOURCE_DIR}/src/main.cpp) + +target_link_libraries(main carma pybind11::embed) + +install(TARGETS main DESTINATION "${PROJECT_SOURCE_DIR}/bin") diff --git a/CMakeLists_bu.txt b/CMakeLists_bu.txt new file mode 100644 index 0000000..94e768e --- /dev/null +++ b/CMakeLists_bu.txt @@ -0,0 +1,228 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 3.16) + +SET(CARMA_VERSION_MAJOR 0) +SET(CARMA_VERSION_MINOR 6) +SET(CARMA_VERSION_PATCH 6) +SET(CARMA_VERSION_INFO "${CARMA_VERSION_MAJOR}.${CARMA_VERSION_MINOR}.${CARMA_VERSION_PATCH}") + +PROJECT( + carma + VERSION ${CARMA_VERSION_INFO} + LANGUAGES CXX +) +INCLUDE(GNUInstallDirs) + +SET(CMAKE_MODULE_PATH_SAVED ${CMAKE_MODULE_PATH}) +LIST(INSERT CMAKE_MODULE_PATH 0 "${PROJECT_SOURCE_DIR}/cmake") +# ############################################################################## +# SETTINGS # +# ############################################################################## +OPTION(CARMA_INSTALL_LIB "Install CARMA headers" OFF) +SET(CARMA_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/carma") + +SET(DEFAULT_BUILD_TYPE "Release") +# Set build type to Release if not specified +INCLUDE(BuildType) + +IF (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + # workaround like https://github.com/nlohmann/json/issues/1408 + # to avoid error like: carma\...\include\armadillo_bits/arma_str.hpp(194): + # error C2039: '_snprintf': is not a member of 'std' + ADD_DEFINITIONS(-DHAVE_SNPRINTF) +ENDIF () + +OPTION(CARMA_DEV_MODE "Enable additional definitions for development" OFF) +OPTION(CARMA_DEV_DEBUG_MODE "Turn on all debugging definitions" OFF) +OPTION(CARMA_BUILD_TESTS "Build tests for carma" OFF) +OPTION(CARMA_BUILD_EXAMPLES "Build examples for carma" OFF) + +# collect user settable options +INCLUDE(${PROJECT_SOURCE_DIR}/carma_config.cmake) +INCLUDE(ParseOptions) +CONFIGURE_FILE( + ${PROJECT_SOURCE_DIR}/include/carma_bits/config.h.in + ${PROJECT_BINARY_DIR}/include/carma_bits/generated_config.h + @ONLY +) + +# ############################################################################## +# TARGET # +# ############################################################################## +ADD_LIBRARY(carma INTERFACE) +ADD_LIBRARY(carma::carma ALIAS carma) + +TARGET_COMPILE_DEFINITIONS(carma + INTERFACE + CARMA_USE_GENERATED_CONFIG=1 + CARMA_VERSION_MAJOR=${CARMA_VERSION_MAJOR} + CARMA_VERSION_MINOR=${CARMA_VERSION_MINOR} + CARMA_VERSION_PATCH=${CARMA_VERSION_PATCH} + CARMA_VERSION_NAME=${CARMA_VERSION_INFO} + "$<$:${CARMA_RELEASE_DEFINITIONS}>" +) +TARGET_COMPILE_FEATURES(carma INTERFACE cxx_std_14) + +IF(CARMA_DEV_MODE) + TARGET_COMPILE_OPTIONS(carma + INTERFACE + -Wall + -Wextra + -Wunused-variable + -Wunused-const-variable + ) +ENDIF() + +TARGET_INCLUDE_DIRECTORIES(carma + INTERFACE + $ + $ + $ +) + +TARGET_LINK_LIBRARIES(carma + INTERFACE + armadillo::armadillo + Python3::NumPy + Python3::Module + pybind11::pybind11 +) + +ADD_LIBRARY(carma_headers INTERFACE) +ADD_LIBRARY(carma::headers ALIAS carma_headers) + +TARGET_COMPILE_DEFINITIONS(carma_headers + INTERFACE + CARMA_VERSION_MAJOR=${CARMA_VERSION_MAJOR} + CARMA_VERSION_MINOR=${CARMA_VERSION_MINOR} + CARMA_VERSION_PATCH=${CARMA_VERSION_PATCH} + CARMA_VERSION_NAME=${CARMA_VERSION_INFO} +) +TARGET_COMPILE_FEATURES(carma_headers INTERFACE cxx_std_14) + +TARGET_INCLUDE_DIRECTORIES(carma_headers + INTERFACE + $ + $ + $ +) + + +# Only install the headers +IF (CARMA_INSTALL_LIB) + # modified from https://dominikberner.ch/cmake-interface-lib/ + + # locations are provided by GNUInstallDirs + INSTALL( + TARGETS carma + EXPORT carma_Targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) + + INSTALL( + TARGETS carma_headers + EXPORT carma_Header_Targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) + + INCLUDE(CMakePackageConfigHelpers) + write_basic_package_version_file( + "carmaConfigVersion.cmake" + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMinorVersion + ) + + configure_package_config_file( + "${PROJECT_SOURCE_DIR}/cmake/carmaConfig.cmake.in" + "${PROJECT_BINARY_DIR}/carmaConfig.cmake" + INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/carma/cmake + ) + + INSTALL( + EXPORT carma_Targets + FILE carmaCarmaTargets.cmake + NAMESPACE carma:: + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/carma/cmake + ) + + INSTALL( + EXPORT carma_Header_Targets + FILE carmaHeaderTargets.cmake + NAMESPACE carma:: + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/carma/cmake + ) + + INSTALL( + FILES + "${PROJECT_BINARY_DIR}/carmaConfig.cmake" + "${PROJECT_BINARY_DIR}/carmaConfigVersion.cmake" + "${PROJECT_SOURCE_DIR}/cmake/carmaDependencyTargets.cmake" + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/carma/cmake + ) + + INSTALL( + FILES "${PROJECT_SOURCE_DIR}/include/carma" + DESTINATION ${CARMA_INCLUDE_INSTALL_DIR} + ) + + INSTALL( + DIRECTORY ${PROJECT_SOURCE_DIR}/include/carma_bits + DESTINATION ${CARMA_INCLUDE_INSTALL_DIR} + FILES_MATCHING + PATTERN "*.h" + ) + + INSTALL( + FILES ${PROJECT_BINARY_DIR}/include/carma_bits/generated_config.h + DESTINATION ${CARMA_INCLUDE_INSTALL_DIR}/carma_bits + ) + +ELSE() + # ############################################################################## + # REQUIREMENTS # + # ############################################################################## + FIND_PACKAGE(Python3 COMPONENTS Development NumPy QUIET) + IF (NOT Python3_FOUND) + FIND_PACKAGE(Python3 COMPONENTS Development.Module NumPy REQUIRED) + ENDIF() + + # Needed to ensure the same Python executable is found by Pybind11 + IF (NOT DEFINED PYTHON_EXECUTABLE) + SET(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) + ENDIF () + + # create armadillo and or pybind11 target if not defined + INCLUDE(ThirdPartyTargets) + + TARGET_PRECOMPILE_HEADERS(carma + INTERFACE + ${PROJECT_SOURCE_DIR}/include/carma_bits/cnalloc.h + ) +ENDIF() +# ############################################################################## +# TEST TARGETS # +# ############################################################################## + +IF(CARMA_BUILD_TESTS OR CARMA_BUILD_EXAMPLES) + SET(CMAKE_CXX_STANDARD 14) +ENDIF() + +IF(CARMA_BUILD_TESTS) + INCLUDE(CTest) + ENABLE_TESTING() + INCLUDE(GetCatch2) + ADD_SUBDIRECTORY(tests) + INCLUDE(ClangFormatTarget) + INCLUDE(CoverageTarget) +ENDIF() + +IF(CARMA_BUILD_EXAMPLES) + ADD_SUBDIRECTORY(examples) +ENDIF() +#------------------------------------------------------ +INCLUDE(ClearOptions) +SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH_SAVED}) +UNSET(CMAKE_MODULE_PATH_SAVED) diff --git a/mbuild.sh b/mbuild.sh new file mode 100755 index 0000000..3c42880 --- /dev/null +++ b/mbuild.sh @@ -0,0 +1,10 @@ +cmake -S . -G Ninja -B build \ + -DCARMA_ENABLE_DEBUG=true \ + -DCARMA_ENABLE_EXTRA_DEBUG=true \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=13.3 \ + -DCMAKE_BUILD_TYPE=Debug \ + -DPython3_EXECUTABLE=$(python3 -c 'import sys; print(sys.executable)') \ + -Dpybind11_ROOT=$(pybind11-config --cmakedir) \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + +cmake --build build --target install --parallel 2 diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..dbe2de4 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,118 @@ +// #define ARMA_EXTRA_DEBUG true +// #define CARMA_EXTENSION_MODE + +#include +#include +#include + +#define CARMA_DEFAULT_MEMORY_ORDER carma::TransposedRowOrder +#include +#include +// block reordering +#include +#include + +namespace py = pybind11; + +int main() { + py::scoped_interpreter guard{}; + + py::module_ sys = py::module_::import("sys"); + sys.attr("path").attr("append")("/Users/rurlus/.pyenv/versions/3.10.9/envs/CARMA/lib/python3.10/site-packages"); + + py::module np = py::module::import("numpy"); + py::module np_rand = py::module::import("numpy.random"); + py::array_t arr = np_rand.attr("normal")(0, 1, py::make_tuple(10, 10)); + py::array_t carr = py::array_t(arr); + py::array_t farr = py::array_t(arr); + + std::cout << "carma version: " << carma::carma_version().as_string() << "\n"; + + // using config = carma::NumpyConversionConfig; using my_custom_converter = carma::NumpyConverter, + // py::array_t&&, config>; auto mat = my_custom_converter()(std::move(arr)); auto mat2 = + // my_custom_converter()(std::move(farr)); + // + auto mat = carma::arr_to_mat(arr); + auto mat2 = carma::arr_to_mat(std::move(farr)); + + // auto mat = my_custom_converter()(std::move(arr)); + // auto mat2 = my_custom_converter()(std::move(farr)); + + // py::array_t farr = fArr(np_rand.attr("normal")(0, 1, py::make_tuple(2, 100))); + // mat = carma::arr_to_mat(farr); + + // auto dtype = py::detail::npy_format_descriptor::dtype(); + + // using config = carma::ConversionConfig; + // using my_custom_converter = carma::npConverter, const py::array_t&, config>; + // auto mat = my_custom_converter()(arr); + + // auto mat = carma::arr_to_mat(carr); + + // std::cout << "arr second element: " << *((const double*)(arr.data(0, 1))) + // << "\n"; std::cout << "mat second element: " << mat.at(1, 0) << "\n"; + // mat.at(1, 0) = -1.111111; + // std::cout << "arr second element: " << *((const double*)(arr.data(0, 1))) + // << "\n"; std::cout << "mat second element: " << mat.at(1, 0) << "\n"; + + // auto my_custom_converter2 = carma::npConverter, + // arma::Mat, config>(); auto mat2 = my_custom_converter2(arr); + + std::cout << "n_rows: " << mat.n_rows << "\n"; + std::cout << "n_cols: " << mat.n_cols << "\n"; + std::cout << "n_elem: " << mat.n_elem << "\n"; + std::cout << "arr second element: " << arr.at(0, 1) << "\n"; + std::cout << "mat second element: " << mat.at(0, 1) << "\n"; + std::cout << mat << "\n"; + + // using config = carma::ConversionConfig; auto converter = + // carma::npConverter, const py::array_t&, + // config>(); + // // auto view = carma::internal::ArrayView(arr); + // // carma::ColumnOrder().check>(view); + // // auto mat = carma::ViewConverter().get>(view); + // auto mat = carma::to_arma>(arr); + // auto mat = carma::arr_to_mat(arr); + // auto mat0 = carma::to_arma>(arr); + // auto mat1 = carma::to_arma>(std::move(arr)); + // auto mat2 = carma::to_arma>(carr); + + // using config = carma::ConversionConfig; + // auto converter = carma::npConverter, const + // py::array_t&, config>(); auto converter = + // carma::internal::npConverterImpl, carma::MoveConverter, + // carma::CopyResolution, + // carma::ColumnOrder>(); + // auto converter = carma::internal::toArma>(); + // auto mat2 = converter(carr); + // auto mat2 = carma::to_arma>(std::move(arr)); + // using config = carma::ConversionConfig; + // auto converter = carma::npConverter, + // py::array_t&&, config>(); auto mat = converter(std::move(arr)); + + // auto mat = carma::internal::arr_to_mat>(arr); + // auto mat = carma::internal::toArma>()(arr); + + // using config = carma::ConversionConfig; + // auto converter = carma::npConverter, const + // py::array_t&, config>(); + // // auto converter = carma::internal::toArma, const + // py::array_t&>(); auto mat2 = converter(arr); + // // FIXME add more checks + // carma::static_conversion_assert(arr, mat2, converter); + + // auto mat = converter(arr); + // auto mat = converter(arr); + // carma::static_conversion_assert(arr, mat, converter); + + // auto mat = carma::arr_to_mat(arr); + // std::cout << mat << "\n"; + // std::cout << "arr second element: " << arr.at(0, 1) << "\n"; + // std::cout << "mat second element: " << mat.at(0, 1) << "\n"; + // mat.at(0, 1) = 2.0; + // std::cout << "arr second element: " << arr.at(0, 1) << "\n"; + // std::cout << "mat second element: " << mat.at(0, 1) << "\n"; + return 0; +};