Git Product home page Git Product logo

mparray's People

Contributors

mdhaber avatar steppi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

steppi

mparray's Issues

Array API Compliance and dtypes

@seberg I'm trying to create an Array API-compliant collection for arbitrary precision floats (e.g. those of mpmath). The main use case I have in mind is the new univariate statistical distributions (gh-15928), which we'll design to accept any Array API-compliant type. (Full functionality will also need array-specific implementations of special functions, which we'll also provide here.) Besides allowing users to use statistical distributions with high precision, these will serve as a backup when straightforward implementations run into numerical issues, and they will help us test and benchmark the accuracy of the distribution functions when evaluated with np.float64.

As someone with a good overview of this stuff, I was hoping you could offer some insight.

  1. Does this approach seem crazy?
    The basic idea is to stitch together existing NumPy object array and mpmath features in an Array API compliant way.
  • mparray is a subclass of ndarray because it has most of the private methods we need and already works quite well with underlying mpmath context objects (with object dtype). The hope is that we can just override some things and add some new methods to be Array API compliant.
  • mparray.broadcast_to and many other functions are just aliases for the equivalents from NumPy. We'll add wrappers of other NumPy functions as needed to provide all the required functions.
  • mparray.sin and many other functions are just np.vectorized functions from mpmath.
  1. Can we take advantage of some of the dtype stuff you've worked on so that these are not just object dtype? I'm not sure that the behavior needs to be any different than that of object arrays that refer to mpmath objects, but I wonder if there are any features of the new dtype system that would be helpful so that this works with the system rather than around it.

  2. For all the Array API-required types (e.g. bool) for which mpmath offers no advantages, should we just use the existing NumPy types, and then mpmath objects would just be extra dtypes? Or could we implement our own float64 using, say, fp objects? I tend toward the latter, because I'd like to just run the standard Array API test suite to check the basic behavior of these things. (Higher-precision contexts would not really need complete tests separately .)

@asmeurer CCing you here because you already know what I'm trying to do - do the questions above make sense?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.