{"id":19975898,"url":"https://github.com/jfjlaros/online-array","last_synced_at":"2026-05-13T04:04:24.670Z","repository":{"id":80229636,"uuid":"123427486","full_name":"jfjlaros/online-array","owner":"jfjlaros","description":"Online array, pass a function as a NumPy array.","archived":false,"fork":false,"pushed_at":"2018-03-25T20:31:14.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-12T09:47:19.211Z","etag":null,"topics":["array","function","numpy","online","unbounded"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jfjlaros.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-01T11:42:42.000Z","updated_at":"2018-03-25T20:34:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"521418dd-1a1f-4304-8eb1-20d9da18b3d5","html_url":"https://github.com/jfjlaros/online-array","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfjlaros%2Fonline-array","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfjlaros%2Fonline-array/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfjlaros%2Fonline-array/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfjlaros%2Fonline-array/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jfjlaros","download_url":"https://codeload.github.com/jfjlaros/online-array/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241411476,"owners_count":19958746,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["array","function","numpy","online","unbounded"],"created_at":"2024-11-13T03:20:51.584Z","updated_at":"2026-05-13T04:04:19.641Z","avatar_url":"https://github.com/jfjlaros.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Online array: A function that behaves like a NumPy array.\nThis package provides a class that mimics a multidimensional NumPy array. These\narrays however, do not contain any data, all values are calculated on the fly\ninstead. In this way, a function can be passed as an array to any function that\nonly accepts arrays.\n\nThe function that gives the values of the online array is passed to the\nconstructor of the class. The online array supports indexing, slicing and\nvarious arithmetic operations. Additionally, *unbounded* arrays can be defined.\n\n\n## Installation\nVia [PyPI](https://pypi.python.org/pypi/online-array):\n\n    pip install online-array\n\nFrom source:\n\n    git clone https://github.com/jfjlaros/online-array.git\n    cd online-array\n    pip install .\n\n\n## Usage\nSuppose we have the following function that we want to pass as an array to an\nother function:\n\n```python\ndef f(x, y):\n    return x + y + 1\n```\n\nThe easiest way to use the `OnlineArray` class is to pass a function and a\nshape to the convenience function `online_array`:\n\n```python\n\u003e\u003e\u003e from online_array import online_array\n\u003e\u003e\u003e a = online_array(f, (3, 3))\n```\n\nWe now have a 3 by 3 online array. Values can be retrieved in the standard way\nby using indexes:\n\n```python\n\u003e\u003e\u003e a[1][2]\n4\n\u003e\u003e\u003e a[1,2]\n4\n```\n\nSlicing and stepping is supported:\n\n```python\n\u003e\u003e\u003e a[1:]\nOnlineArray([[             2,              3,              4],\n             [             3,              4,              5]])\n\u003e\u003e\u003e a[::2]\nOnlineArray([[              1,               2,               3],\n             [              3,               4,               5]])\n\u003e\u003e\u003e a[::2][1][0]\n3\n```\n\nTo create an unbounded array, the convenience function `unbounded_online_array`\ncan be used:\n\n```python\n\u003e\u003e\u003e from online_array import unbounded_online_array\n\u003e\u003e\u003e a = unbounded_online_array(f)\n\u003e\u003e\u003e a[31415926535897932384626433][27182818284590452353602874]\n58598744820488384738229308L\n```\n\nFinally, the class `OnlineArray` can be used directly.\n```python\n\u003e\u003e\u003e from online_array import OnlineArray\n\u003e\u003e\u003e help(OnlineArray)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfjlaros%2Fonline-array","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjfjlaros%2Fonline-array","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfjlaros%2Fonline-array/lists"}