Skip to main content

A tiny bit of NumPy for Transcrypt using JavaScript typed arrays

Project description

Requires Transcrypt commit ba2c278 (not pip-installable, get it from GitHub)

Numscrypt is a port of a small part of NumPy to Transcrypt using JavaScript typed arrays. While some attention is paid to speed, e.g. by optimizing for-loops and operators in Transcrypt, that is currently not the main focus.

Whereas NumPy often has multiple way to do things, Numscrypt focuses on one obvious way. The clearest example is the NumPy type matrix type, that is a specialization of ndarray with confusingly deviating use of some operators. In Transcrypt matrix is deliberately left out, to keep it lean.

One thing Numscrypt does support is the use of views, i.e. references to parts of existing arrays rather than copies. As with NumPy, views are implemented using strides and offsets.

Parts of the code can later be replaced by things like asm.js and simd.js, or, better even, GPGPU code. There’s not yet a clear winner in this area. This implementation is usable as a skeleton to try out those new technologies in parts of the code where speed matters most.

It may seem attractive to compile everything from C++ to asm.js, but the downloads would become very bulky and the readability approaching zero. Or wouldn’t it? Forking and experimenting highly encouraged!!

As with Transcrypt, the eventual goal is not to completely copy a desktop programming environment. Rather a lean and mean subset is sought that can still be very useful, e.g. for science demo’s in the browser.

Jacques de Hooge, Rotterdam, Netherlands

Logo

The first computers were used… to compute

What’s new

N.B. Always use the newest version of Transcrypt to be able to use the newest features of Numscrypt.

  • Examples in documentation fixed

  • Low hanging fruit optimizations done for complex and real arrays, e.g. multiplication in natural order 30x faster

  • For educational and demonstration purposes a simple, non-optimized implementation of complex arrays was added

  • Ndarray’s mixable with scalars for overloaded ops

  • Overloaded unary minus added

  • Preliminary optimizations, speedup 70x for inversion, 10x for multiplication (default: optimize for speed)

  • Several bugs fixed for working with non-default strides

  • Start made with module linalg, matrix inversion added + testcase

  • Overloaded LHS and RHS slicing added to ndarray

  • Readme adapted

  • Hsplit, vsplit, hstack, vstack added

  • Transpose can now deal with non-default strides

  • Tuple stripping optimization added for simple indices

  • Overloaded operators added for simple indices e.g. matrix [2, 3, 2] + autotest

  • Overloaded operators added for +, -, *, / and @, not yet mixable with scalars + autotest

  • Setup adapted to Linux’ case sensitivity

  • Dependencies added to setup.py

  • Changes package name to lowercase

  • Modest beginning made with ndarray + autotest for it

Other packages you might like

Licence

Copyright 2016 Jacques de Hooge, GEATEC engineering, www.geatec.com

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Numscrypt-0.0.30.zip (9.2 MB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page