Cython wrapper

Merged
#284 · Created  · Last updated

Merged pull request

Merged in feature/cython_wrapper (pull request #284)

211724a·Author: ·Closed by: ·2017-12-03

Description

A Python wrapper for gtsam using Cython. This can wrap [a modified version of] gtsam.h.

  • Created branch /branches/2.0 from /trunk:10596

  • Removed old code from current release branch

  • Removing empty folders from unstable

  • Fixed vISAMexample in 2.0 release branch

  • Disabled timing scripts for now (they are outdated and do not compile)

  • Created branch /branches/2.2 from /trunk:13925

  • Moved cmake ext pointer in 2.2 branch

  • Created branch /branches/2.3.0 from /trunk:16345

  • Parallel compilation flags in package scripts

  • Partial fix for compiling statically on Windows

  • Created branch /branches/2.3.1 from /trunk:18250

  • Set version number to 2.3.1

  • Revert "comment on how to pass this test"

    This reverts commit 8ef24f645f80cf7dd01174027cc09cc81c0bb1ff.

  • Revert "failed unit test of BetweenFactor<Rot3> when the measurement is not the ground truth"

    This reverts commit bd85aa68d8bf7267214ea9df5687fbae78e76fae.

  • Moved ImuFactor and CombinedImuFactor into main gtsam, and moved InertialNavFactor family into gtsam_unstable.

  • Set version number in package script to 2.3.1

  • Moved VO and advanced Kitti IMU matlab examples to unstable

  • Fixed dataset search in IMUKittiExampleGPS

  • Committing correct dataset files for Kitti IMU example

  • Bug fix in SolverComparer

  • Added relinSkip option to SolverComparer, trapping/printing exceptions, and changed default batch mode to Cholesky

  • Added w20000 dataset and simplified names of w100 and w10000

  • Added cmake-libs snapshot to 2.3.1 branch

  • Using boost random from 'boost' namespace instead of boost::random for compatibility with boost < 1.47

  • Start 3.0.0 branch, strip out Metis

  • update version etc.

  • Start 3.1.0 branch, strip out Metis

  • Cherry-picked Boost 1.57 fixes from develop

  • Cherry-picked Boost 1.57 l-value assignment fix

  • fix ambiguous call to boost::bind (with VS 2012, Boost 1.55)

  • Cherry-pick: Fixed another issue with volatile and boost::format

  • Version numbers

  • [mEstimator] virtualize and implementing sqrtWeight instead of weight to speed up a bit

  • [msys] Disable dllexport/dllimport on msys2

  • split M-Estimators out from NoiseModel

  • Revert "[msys] Disable dllexport/dllimport on msys2"

    This reverts commit b955a0b715acee4b245e41dca1d994c199a8a3cc.

  • fix include

  • correct name for Welsch

  • [inprogress] cython wrapper

  • pxd staticmethod

  • pxd return value

  • pxd returntype

  • bug fix

  • test pxd ReturnValue and ReturnType

  • remove unused function

  • emit methods to pxd, change the way template methods are handled

    pxd allows template methods, whereas the current scheme instantiates/expands all template methods and add them to the same methods_ container. The new scheme treats them all separately: nontemplated methods in methods_, template methods in templateMethods_, and template methods after instantiation in expandedTemplateMethods_.

  • emit template class to Cython pxd with test

    Cython allows template class.

  • revert changes in methods_, handle template methods for Cython pxd in a less instrusive way

  • test wrapping JacobianFactor

  • standardize function name to emit_cython_[pxd/pyx]. Remove first level namespace from Cython object names.

    Examples: gtsam_Point3 --> Point3, gtsam_noiseModel_Base --> noiseModel_Base

  • pyx: add constructors and fixing inheritance

  • use Create as name for "constructors" instead of the object name

    so we call : Class.Create(...) to create a python object, instead of Class.Class(...) which seems duplicated and complicated if Class is long, e.g. "mEstimator_noiseModel_GemanMcClure"

  • pyx wrapper for static methods

  • pyx class methods with arguments/return type casting

  • ctypedefs for all instantiated classes

  • add headers, small refactor, test FastContainers

  • check if default constructor exists. Autogenerate copy constructor by default

  • call new function name

  • first version ever compiled.

    ... Not without some changes: - add traits<size_t> in Key.h - add these to JacobianFactor: explicit JacobianFactor(const Eigen::Map<Vector>& b_in); Vector py_getb() { return getb(); } Matrix py_getA() { return getA(); }

    ... Remaining corner cases: ☐ Eigency: Map[] to Block ☐ Eigency: ambiguous call: A(const T&) A(const Vector& v) and Eigency A(Map[Vector]& v) ☐ Fix return properly ☐ handle pair ☐ Fix method template of Vector/Matrix: template argument is [Vector] while arugment is Map[Vector] ☐ Constructor: generate default constructor? (hack: if it's serializable?) ☐ Constructor: ambiguous construct from Vector/Matrix ☐ Key and size_t: traits<size_t> doesn't exist ☐ [Nice to have] Auto delete duplicate methods in derived class

  • fix testWrap: revert experimental changes

  • fix Vector/Matrix and Map[Vector/Matrix] ambiguity.

    That also fixes the problem of function templated on Matrix/Vector

  • wrap pair. Improve return.

  • unify and simplify function call in Method and StaticMethod

  • handle "This". Wrap all geometry

  • remove inherited functions for Cython classes. Testing HessianFactor with debug info...

  • improve inherited method removal

    Checking nontemplateMethods_ against parent's methods_ because: 1. Only nontemplateMethods_ are serialized to Cython's pxd, which doesn't like duplicate methods 2. Parent's methods_ list has every methods inherited from grand and grand-grand parents, etc., so we don't need to check higher levels. Also refactor to reduce nested code

  • handle Key by adding noninstantiating normal typedef rule. Fix copy constructor in template classes: using This.

  • Cython pxd: putting template instantiations at the correct place right after a template class

  • enable all Key containers

  • pxd hack: always add copy constructor by default

  • add python version for getA/getb as cython can't convert constABlock/BVector to Matrix/Vector automatically.

  • Remove copy constructor assumption. Manually add copy constructors. Remove dependency on default constructor (some like Optimizers and Marginals don't have the default constructor). Remove cyCreateFromValue. Ignore variable name when checking overload similarity.

  • correct Eigency name for Eigen type

  • remove extra Xd of Eigen types in Argument and ReturnType

  • correct cython wrapper module name in pyx import

  • add setup script

  • add setup scripts, fix tests

  • ignore generated files

  • simplify python constructor call

  • print_() insteads of _print() (easier to type)

  • Use class name as ctor for static construction calls

    Longer, but more conventional

  • Vector in template param: works! Also fix tests for recent changes...

  • check in TODO list

  • add option for matlab wrapper

  • require Cython 0.25.1

    Cython 0.24.1 has problems with instantiating template types. FastVector<Key> in instantiated template classes (e.g. PriorFactorPose2) is understood as FastVector<size_t>, hence can't be casted to KeyVector. Moving to 0.25 solves the problem.

  • update TODO

  • enable KeyVector keys() for NonlinearFactor

  • format

  • add typedefs to the list of validTypes

  • remove unused

  • collect typedefs of basic (non-class) types to treat them as basic types

  • wrap push_back and at for FastVector (hence, KeyVector)

  • more detailed comments

    Cython/Python pxd/pyx class names and argument types are a mess... Hopefully these comments help clarify something.

  • support python print for classes with print_ function

  • proper overloading constructors

  • update TODO

  • support dynamic cast from all parents/virtual base

  • fix white spaces

  • big refactoring, support method/static method overloading

  • update TODO

  • fix bugs on returned values

  • [refactor] more understandable function names

    Clearing confusions between pxd and pyx classes and objects!

  • support global functions (no overload)

  • support global function overloads

  • move matlab.h, containing matlab ultility functions, to nonlinear/utilities.h so it can be installed properly and can be used with the cython wrapper

  • not needed anymore: casting is now done in cython

  • bring cython gtsam.h closer to the original version for matlab

  • update todo

  • standardize names for classes with inner namespace

  • add missing constructors and copy constructors

  • unfinished attempt to add typedef for matlab wrapper

  • replace matlab.h in gtsam.h for matlab wrapper by its new file nonlinear/utilities.h

  • Port all matlab tests to python. All passed.

  • put generated files in subfolder, run unittests by default

  • a mini version for testing

  • remove obsolete tests

  • now can build and install with cmake

  • fix variable names. They are important to resolve overloads!

  • update and rename TODO to README. Add basic installation and usage instructions.

  • fix test

  • update readme format, delete install.sh

0 attachments

0 comments

Loading commits...