Skip to main content

This is a user-friendly wrapper to numpy arrays

Project description

Vectorized2D

This is a user-friendly wrapper to numpy arrays, for dealing with numerical problems in a vectorized fashion - in the 2D world.

Provided objects include:

  1. Array2D - a user-friendly interface to numpy arrays of shape=Nx2.
  2. Vector2D - a user-friendly wrapper for arrays of 2D vectors that represent physical quantities.
  3. Point2D - a user-friendly wrapper to arrays of 2D points that represent spatial locations in a cartesian coordinate system.
  4. Coordinate - a user-friendly wrapper for arrays of 2D points that represent 2D spatial (geographical) coordinates (longitude and latitude) in radians.

Performance

Vectorized2d uses Numba to gain enhanced performance compared to vanilla numpy.

For example, (per-row) norm calculation:

  >>> import numpy as np
  >>> from vectorized2d import Array2D

  >>> a_np = np.random.random(size=(1000, 2))
  >>> a_2d = a_np.view(Array2D)

  >>> %timeit np.linalg.norm(a_np, axis=1)
  23.1 µs ± 1.25 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)
  >>> %timeit np.einsum('ij,ij->i', a_np, a_np)
  8.23 µs ± 167 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
  >>> %timeit a_2d.norm
  2.63 µs ± 67.9 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

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

vectorized2d-0.0.3.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vectorized2d-0.0.3-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file vectorized2d-0.0.3.tar.gz.

File metadata

  • Download URL: vectorized2d-0.0.3.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for vectorized2d-0.0.3.tar.gz
Algorithm Hash digest
SHA256 d534da331acd2a4e2d04812961112337db1f7453a873186ef017da66ecfed771
MD5 1288cdc7944472d81fd92f5e57b33c41
BLAKE2b-256 8903d3b642ed608b4d0ca8a25c3c3cc8b5fa75fa0df1ab7ffd653cf6c02f0537

See more details on using hashes here.

File details

Details for the file vectorized2d-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: vectorized2d-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for vectorized2d-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bbfc35b64d9109a7ab67c67f8a4551a8a0a86c189cc20249a1f640f97e1864a0
MD5 33f528096628badb8223e770d76d22d2
BLAKE2b-256 45b88666ba73f72cb7e540fc8360642487292e27f313c630a9d0b724ed2dee2d

See more details on using hashes here.

Supported by

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