clonedEigency --> gtsam_eigency. Update readme.

release/4.3a0
Duy-Nguyen Ta 2017-07-28 15:26:19 -04:00
parent 931405155e
commit 82531c561f
13 changed files with 29 additions and 30 deletions

View File

@ -4,8 +4,8 @@ include(GtsamCythonWrap)
# Create the cython toolbox for the gtsam library
if (GTSAM_INSTALL_CYTHON_TOOLBOX)
# build and include the eigency version of eigency
add_subdirectory(clonedEigency)
include_directories(${PROJECT_BINARY_DIR}/cython/clonedEigency)
add_subdirectory(gtsam_eigency)
include_directories(${PROJECT_BINARY_DIR}/cython/gtsam_eigency)
# wrap gtsam
add_custom_target(gtsam_header DEPENDS "../gtsam.h")

View File

@ -9,7 +9,7 @@ INSTALL
```
- For compatiblity with gtsam's Eigen version, it contains its own cloned version of [Eigency](https://github.com/wouterboomsma/eigency.git),
named **clonedEigency**, to interface between C++'s Eigen and Python's numpy.
named **gtsam_eigency**, to interface between C++'s Eigen and Python's numpy.
- 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
@ -71,8 +71,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${GTSAM_DIR}/../GTSAMCMakeTools")
# Wrap
include(GtsamCythonWrap)
find_package(clonedEigency REQUIRED)
include_directories(${CLONEDEIGENCY_INCLUDE_DIRS})
include_directories(${GTSAM_EIGENCY_INSTALL_PATH})
wrap_and_install_library_cython("your_project_interface.h"
"from gtsam.gtsam cimport *" # extra import of gtsam/gtsam.pxd Cython header
"your_install_path"

View File

@ -4,23 +4,23 @@ include(GtsamCythonWrap)
# so that the cython-generated header "conversions_api.h" can be found when cythonizing eigency's core
# and eigency's cython pxd headers can be found when cythonizing gtsam
file(COPY "." DESTINATION ".")
set(OUTPUT_DIR "${PROJECT_BINARY_DIR}/cython/clonedEigency")
set(OUTPUT_DIR "${PROJECT_BINARY_DIR}/cython/gtsam_eigency")
set(EIGENCY_INCLUDE_DIR ${OUTPUT_DIR})
# This is to make the build/cython/clonedEigency folder a python package
configure_file(__init__.py.in ${PROJECT_BINARY_DIR}/cython/clonedEigency/__init__.py)
# This is to make the build/cython/gtsam_eigency folder a python package
configure_file(__init__.py.in ${PROJECT_BINARY_DIR}/cython/gtsam_eigency/__init__.py)
# include eigency headers
include_directories(${EIGENCY_INCLUDE_DIR})
# Cythonize and build eigency
message(STATUS "Cythonize and build eigency")
# Important trick: use "../clonedEigency/conversions.pyx" to let cython know that the conversions module is
# a part of the clonedEigency package and generate the function call import_clonedEigency__conversions()
# Important trick: use "../gtsam_eigency/conversions.pyx" to let cython know that the conversions module is
# a part of the gtsam_eigency package and generate the function call import_gtsam_igency__conversions()
# in conversions_api.h correctly!!!
cythonize(cythonize_eigency_conversions "../clonedEigency/conversions.pyx" "conversions"
cythonize(cythonize_eigency_conversions "../gtsam_eigency/conversions.pyx" "conversions"
"${OUTPUT_DIR}" "${EIGENCY_INCLUDE_DIR}" "" "")
cythonize(cythonize_eigency_core "../clonedEigency/core.pyx" "core"
cythonize(cythonize_eigency_core "../gtsam_eigency/core.pyx" "core"
${OUTPUT_DIR} "${EIGENCY_INCLUDE_DIR}" "" "")
add_dependencies(cythonize_eigency_core cythonize_eigency_conversions)
add_custom_target(cythonize_eigency)
@ -29,6 +29,6 @@ add_dependencies(cythonize_eigency cythonize_eigency_conversions cythonize_eigen
# install
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${GTSAM_CYTHON_INSTALL_PATH})
install(TARGETS cythonize_eigency_core cythonize_eigency_conversions
DESTINATION "${GTSAM_CYTHON_INSTALL_PATH}/clonedEigency")
install(FILES "${OUTPUT_DIR}/conversions_api.h" DESTINATION ${GTSAM_CYTHON_INSTALL_PATH}/clonedEigency)
configure_file(__init__.py.in ${GTSAM_CYTHON_INSTALL_PATH}/clonedEigency/__init__.py)
DESTINATION "${GTSAM_CYTHON_INSTALL_PATH}/gtsam_eigency")
install(FILES "${OUTPUT_DIR}/conversions_api.h" DESTINATION ${GTSAM_CYTHON_INSTALL_PATH}/gtsam_eigency)
configure_file(__init__.py.in ${GTSAM_CYTHON_INSTALL_PATH}/gtsam_eigency/__init__.py)

View File

@ -215,7 +215,7 @@ inline PyArrayObject *_ndarray_copy<std::complex<float> >(const std::complex<flo
template <typename Derived>
inline PyArrayObject *ndarray(Eigen::PlainObjectBase<Derived> &m) {
import_clonedEigency__conversions();
import_gtsam_eigency__conversions();
return _ndarray_view(m.data(), m.rows(), m.cols(), m.IsRowMajor);
}
// If C++11 is available, check if m is an r-value reference, in
@ -223,56 +223,56 @@ inline PyArrayObject *ndarray(Eigen::PlainObjectBase<Derived> &m) {
#if __cplusplus >= 201103L
template <typename Derived>
inline PyArrayObject *ndarray(Eigen::PlainObjectBase<Derived> &&m) {
import_clonedEigency__conversions();
import_gtsam_eigency__conversions();
return _ndarray_copy(m.data(), m.rows(), m.cols(), m.IsRowMajor);
}
#endif
template <typename Derived>
inline PyArrayObject *ndarray(const Eigen::PlainObjectBase<Derived> &m) {
import_clonedEigency__conversions();
import_gtsam_eigency__conversions();
return _ndarray_copy(m.data(), m.rows(), m.cols(), m.IsRowMajor);
}
template <typename Derived>
inline PyArrayObject *ndarray_view(Eigen::PlainObjectBase<Derived> &m) {
import_clonedEigency__conversions();
import_gtsam_eigency__conversions();
return _ndarray_view(m.data(), m.rows(), m.cols(), m.IsRowMajor);
}
template <typename Derived>
inline PyArrayObject *ndarray_view(const Eigen::PlainObjectBase<Derived> &m) {
import_clonedEigency__conversions();
import_gtsam_eigency__conversions();
return _ndarray_view(const_cast<typename Derived::Scalar*>(m.data()), m.rows(), m.cols(), m.IsRowMajor);
}
template <typename Derived>
inline PyArrayObject *ndarray_copy(const Eigen::PlainObjectBase<Derived> &m) {
import_clonedEigency__conversions();
import_gtsam_eigency__conversions();
return _ndarray_copy(m.data(), m.rows(), m.cols(), m.IsRowMajor);
}
template <typename Derived, int MapOptions, typename Stride>
inline PyArrayObject *ndarray(Eigen::Map<Derived, MapOptions, Stride> &m) {
import_clonedEigency__conversions();
import_gtsam_eigency__conversions();
return _ndarray_view(m.data(), m.rows(), m.cols(), m.IsRowMajor, m.outerStride(), m.innerStride());
}
template <typename Derived, int MapOptions, typename Stride>
inline PyArrayObject *ndarray(const Eigen::Map<Derived, MapOptions, Stride> &m) {
import_clonedEigency__conversions();
import_gtsam_eigency__conversions();
// Since this is a map, we assume that ownership is correctly taken care
// of, and we avoid taking a copy
return _ndarray_view(const_cast<typename Derived::Scalar*>(m.data()), m.rows(), m.cols(), m.IsRowMajor, m.outerStride(), m.innerStride());
}
template <typename Derived, int MapOptions, typename Stride>
inline PyArrayObject *ndarray_view(Eigen::Map<Derived, MapOptions, Stride> &m) {
import_clonedEigency__conversions();
import_gtsam_eigency__conversions();
return _ndarray_view(m.data(), m.rows(), m.cols(), m.IsRowMajor, m.outerStride(), m.innerStride());
}
template <typename Derived, int MapOptions, typename Stride>
inline PyArrayObject *ndarray_view(const Eigen::Map<Derived, MapOptions, Stride> &m) {
import_clonedEigency__conversions();
import_gtsam_eigency__conversions();
return _ndarray_view(const_cast<typename Derived::Scalar*>(m.data()), m.rows(), m.cols(), m.IsRowMajor, m.outerStride(), m.innerStride());
}
template <typename Derived, int MapOptions, typename Stride>
inline PyArrayObject *ndarray_copy(const Eigen::Map<Derived, MapOptions, Stride> &m) {
import_clonedEigency__conversions();
import_gtsam_eigency__conversions();
return _ndarray_copy(m.data(), m.rows(), m.cols(), m.IsRowMajor, m.outerStride(), m.innerStride());
}

View File

@ -334,7 +334,7 @@ void Module::generate_cython_wrapper(const string& toolboxPath, const std::strin
/* ************************************************************************* */
void Module::emit_cython_pxd(FileWriter& pxdFile) const {
// headers
pxdFile.oss << "from clonedEigency.core cimport *\n"
pxdFile.oss << "from gtsam_eigency.core cimport *\n"
"from libcpp.string cimport string\n"
"from libcpp.vector cimport vector\n"
"from libcpp.pair cimport pair\n"
@ -416,7 +416,7 @@ void Module::emit_cython_pyx(FileWriter& pyxFile) const {
for(const Qualified& q: Qualified::BasicTypedefs) {
pyxFile.oss << "from " << pxdHeader << " cimport " << q.pxdClassName() << "\n";
}
pyxFile.oss << "from clonedEigency.core cimport *\n"
pyxFile.oss << "from gtsam_eigency.core cimport *\n"
"from libcpp cimport bool\n\n"
"from libcpp.pair cimport pair\n"
"from libcpp.string cimport string\n"

View File

@ -1,5 +1,5 @@
from clonedEigency.core cimport *
from gtsam_eigency.core cimport *
from libcpp.string cimport string
from libcpp.vector cimport vector
from libcpp.pair cimport pair

View File

@ -4,7 +4,7 @@ cimport geometry
from geometry cimport shared_ptr
from geometry cimport dynamic_pointer_cast
from geometry cimport make_shared
from clonedEigency.core cimport *
from gtsam_eigency.core cimport *
from libcpp cimport bool
from libcpp.pair cimport pair