Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial support for the Eigen library #120

Merged
merged 6 commits into from
Feb 1, 2023
Merged

Initial support for the Eigen library #120

merged 6 commits into from
Feb 1, 2023

Commits on Jan 31, 2023

  1. Configuration menu
    Copy the full SHA
    aaca26d View commit details
    Browse the repository at this point in the history
  2. update limitations list

    wjakob committed Jan 31, 2023
    Configuration menu
    Copy the full SHA
    9365297 View commit details
    Browse the repository at this point in the history
  3. Fix nb_tensor stride check logic

    The step responsible for checking whether a tensor has the right strides
    to invoke a C++ routine was incorrect and always accepted C-style NumPy
    arrays (because they leave the 'stride' field set to NULL).
    
    The whole conversion logic will be more heavily tested in a subsequent
    commit that adds a type caster for Eigen arrays.
    wjakob committed Jan 31, 2023
    Configuration menu
    Copy the full SHA
    3df8986 View commit details
    Browse the repository at this point in the history
  4. nb_tensor: use buffer protocol for writeable NumPy arrays, RVP support

    - Prefer the buffer protocol over DLPack when converting C++ tensors
      into NumPy arrays. This makes it possible to wrap C++ memory through
      arrays that have their 'write' bit still enabled (NumPy is somewhat
      conservative here and disables the write bit when the conversion is
      done via DLPack).
    
    - Simplified the implementation of the internally used `nb_tensor`
      buffer protocol wrapper. This change requires a nanobind ABI bump.
    
    - Copy the contents when `rv_policy::copy/move` is specified
      to the tensor caster.
    wjakob committed Jan 31, 2023
    Configuration menu
    Copy the full SHA
    cc9cc11 View commit details
    Browse the repository at this point in the history

Commits on Feb 1, 2023

  1. Initial support for the Eigen library

    This commit adds custom casters for the Eigen linear algebra library. It
    uses the existing `nb_tensor` infrastructure to implement a conversion
    between Eigen types and NumPy arrays that currently supports:
    
    - Eigen::Matrix/Array<..> and derived types (row/column vectors)
    - Eigen::Map<..>
    - Eigen::Ref<..>
    - Expression templates (CwiseBinaryOp, etc.)
    
    There are a few limitations:
    
    - Eigen tensors are not supported yet.
    - Sparse matrix types are not supported yet.
    wjakob committed Feb 1, 2023
    Configuration menu
    Copy the full SHA
    683124a View commit details
    Browse the repository at this point in the history
  2. changelog update

    wjakob committed Feb 1, 2023
    Configuration menu
    Copy the full SHA
    660eedc View commit details
    Browse the repository at this point in the history