Skip to main content

A functional array class with elements computed on demand.

Project description

Functional Arrays

The funcarray package contains a class to construct arrays that generate values on demand, with optimised functions to iterate over it and perform specific operations.

  • Free software: GNU General Public License v3

Installation

Install using:

pip install funcarray

Usage

Functional arrays are instantiated by passing it a shape and a function that must return each element of the matrix given the index of the element and a set of arguments. The given function must therefore obey the format fun(*index, *args).

from funcarray import array
from numba import jit
import numpy as np
from numpy.random import default_rng

@jit(nopython=True)
def fun(i, j, x, y):
    return x[i]*y[j]

N = 10000
rnd = default_rng()
x = rnd.random(N, dtype='f8')
y = rnd.random(N, dtype='f8')
a = array((N, N), fun, x, y)

# Compute sum over all elements
print(a.sum())

Development

Please work on a feature branch and create a pull request to the development branch. If necessary to merge manually do so without fast forward:

git merge --no-ff myfeature

To build a development environment run:

python3 -m venv env
source env/bin/activate
pip install -e '.[dev]'

For testing:

pytest --cov

Credits

This is a project by Leonardo Niccolò Ialongo .

History

0.0.1 (2022-10-03)

  • First proof of concept release!

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

FuncArray-0.0.1.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

FuncArray-0.0.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file FuncArray-0.0.1.tar.gz.

File metadata

  • Download URL: FuncArray-0.0.1.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for FuncArray-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5909eb4f0dc97f1d92cccfe2103f67795cb8f22ac6fd423d39da5216123edee9
MD5 7d6002f0ce646ce770bc5c60c6f093d5
BLAKE2b-256 1a5d8f2e02fae2000065a627fd9881d311ceaf20c2eca9c247993f4114db403c

See more details on using hashes here.

File details

Details for the file FuncArray-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: FuncArray-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for FuncArray-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d6d4e7a001d5a548071bd0079602700ab55422a8ad3a4255c5f485cd25c6e500
MD5 8fdbefd41e7b83d7c7d19f112bcaef86
BLAKE2b-256 8b2dd771f1329cf7752d2a3a0313b2be7e3572cf3072169f5ee99db438b5bf5f

See more details on using hashes here.

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