Giter VIP home page Giter VIP logo

sparsegrad's Introduction

sparsegrad

Travis-CI-badge Readthedocs-badge

sparsegrad automatically and efficiently calculates analytical sparse Jacobian of arbitrary numpy vector valued functions. It is designed to be useful for solving large systems of non-linear equations. sparsegrad is memory efficient because it does not use the graph of computation. Arbitrary computations are supported through indexing, matrix multiplication, branching, and custom functions.

Taking Jacobian with respect to variable x is done by replacing numerical value of x with sparsegrad seed

>>> import numpy as np
>>> import sparsegrad.forward as ad
>>> def f(x):
...       return x-x[::-1]
>>> x=np.linspace(0,1,3)
>>> print(f(ad.seed(x)).dvalue)
(0, 0)      1.0
(0, 2)      -1.0
(2, 0)      -1.0
(2, 2)      1.0

sparsegrad is written in pure Python. For easy installation and best portability, it does not contain extension modules. In realistic problems, it can provide similar or better performance than ADOL-C best case of repeated calculation. This is possible thanks to algorithmic optimizations and optimizations to avoid slow parts of scipy.sparse.

sparsegrad relies on numpy and scipy for computations. It is compatible with both Python 2.7 and 3.x.

Installation

pip install sparsegrad

It is recommended to run test suite after installing

python -c "import sparsegrad; sparsegrad.test()"

sparsegrad's People

Contributors

mzszym avatar

Watchers

James Cloos avatar WeichaoZhou avatar

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.