From c8dec5d8dcb8471df7ef7d91a3f0b19bbd843880 Mon Sep 17 00:00:00 2001 From: dellaert Date: Sat, 20 May 2017 12:23:41 -0700 Subject: [PATCH] Small changes in comments and docs --- cython/README.md | 13 ++++++++----- gtsam/CMakeLists.txt | 2 +- wrap/Module.cpp | 2 ++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cython/README.md b/cython/README.md index 544154f58..bc616ec7f 100644 --- a/cython/README.md +++ b/cython/README.md @@ -2,15 +2,14 @@ This is the Cython/Python wrapper around the GTSAM C++ library. INSTALL ======= -- This wrapper needs Cython(>=0.25.2), backports_abc>=0.5, numpy, which can be installed -as follows: +- This wrapper needs Cython(>=0.25.2), backports_abc>=0.5, and numpy. These can be installed as follows: ```bash pip install -r /cython/requirements.txt ``` - It also needs Eigency, a package that interfaces between C++'s Eigen and Python's numpy. -You can try to install via pip: "pip install eigency". If that fails, install it from source as follows: +You can try to install via pip: "pip install eigency". If that fails, please install it from source as follows: ```bash git clone https://github.com/wouterboomsma/eigency.git @@ -19,10 +18,14 @@ python setup.py -v build python setup.py install ``` -- Build and install gtsam using cmake with GTSAM_INSTALL_CYTHON_TOOLBOX enabled -Note: The wrapped module will be installed to GTSAM_CYTHON_INSTALL_PATH, which is +- Build and install gtsam using cmake with GTSAM_INSTALL_CYTHON_TOOLBOX enabled. The wrapped module will be installed to GTSAM_CYTHON_INSTALL_PATH, which is by default: /cython +- Modify your PYTHONPATH to include the GTSAM_CYTHON_INSTALL_PATH: +```bash +export PYTHONPATH = $PYTHONPATH: +``` + UNIT TESTS ========== diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index a5438c6d0..eb9154091 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -166,7 +166,7 @@ if (GTSAM_INSTALL_MATLAB_TOOLBOX) wrap_and_install_library(../gtsam.h "${GTSAM_ADDITIONAL_LIBRARIES}" "" "${mexFlags}") endif () -# Create the matlab toolbox for the gtsam library +# Create the cython toolbox for the gtsam library if (GTSAM_INSTALL_CYTHON_TOOLBOX) # Set up codegen include(GtsamCythonWrap) diff --git a/wrap/Module.cpp b/wrap/Module.cpp index a6d9a72f6..d071a5e2e 100644 --- a/wrap/Module.cpp +++ b/wrap/Module.cpp @@ -411,6 +411,7 @@ void Module::emit_cython_pyx(FileWriter& pyxFile) const { "from "<< pxdHeader << " cimport shared_ptr\n" "from "<< pxdHeader << " cimport dynamic_pointer_cast\n" "from "<< pxdHeader << " cimport make_shared\n"; + // import all typedefs, e.g. from gtsam_wrapper cimport Key, so we don't need to say gtsam.Key for(const Qualified& q: Qualified::BasicTypedefs) { pyxFile.oss << "from " << pxdHeader << " cimport " << q.pxdClassName() << "\n"; @@ -429,6 +430,7 @@ void Module::emit_cython_pyx(FileWriter& pyxFile) const { for(const Class& cls: expandedClasses) cls.emit_cython_pyx(pyxFile, allClasses); pyxFile.oss << "\n"; + //... wrap global functions for(const GlobalFunctions::value_type& p: global_functions) p.second.emit_cython_pyx(pyxFile);