{"id":29886083,"url":"https://github.com/hakkelt/ndarrays","last_synced_at":"2025-07-31T16:23:13.139Z","repository":{"id":57733393,"uuid":"374997079","full_name":"hakkelt/NDArrays","owner":"hakkelt","description":"N-dimensional arrays holding either complex or real values.","archived":false,"fork":false,"pushed_at":"2023-03-07T13:07:14.000Z","size":3283,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-09-16T09:28:12.500Z","etag":null,"topics":["complex-numbers","java","multi-dimensional-array"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hakkelt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-08T12:14:30.000Z","updated_at":"2023-03-31T14:23:17.000Z","dependencies_parsed_at":"2023-01-23T16:00:35.564Z","dependency_job_id":null,"html_url":"https://github.com/hakkelt/NDArrays","commit_stats":null,"previous_names":[],"tags_count":5,"template":null,"template_full_name":null,"purl":"pkg:github/hakkelt/NDArrays","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakkelt%2FNDArrays","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakkelt%2FNDArrays/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakkelt%2FNDArrays/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakkelt%2FNDArrays/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hakkelt","download_url":"https://codeload.github.com/hakkelt/NDArrays/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakkelt%2FNDArrays/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268070461,"owners_count":24190898,"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","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["complex-numbers","java","multi-dimensional-array"],"created_at":"2025-07-31T16:23:04.529Z","updated_at":"2025-07-31T16:23:13.129Z","avatar_url":"https://github.com/hakkelt.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# General Multi-dimensional arrays\n\n[![Documentation](https://img.shields.io/badge/Documentation-latest-blue)](https://hakkelt.github.io/NDArrays/)\n[![Tutorial](https://img.shields.io/badge/Tutorial-Description%20%2B%20examples-brightgreen)](https://hakkelt.github.io/NDArrays/tutorial/NDArrays.html)\n\nGeneral framework for multi-dimensional arrays holding either complex, floating point and integer values.\n\n## Goals\n 1. Provide an easy way to create minimal wrappers for n-dimensinal array implementations,\n 2. Give a rich interface to query and modify data, and\n 3. Allow effortless conversion between wrapped data structures.\n\n## Features\n - Can be parametrized with Float, Double, Byte, Short, Integer, Long, BigInteger, BigDecimal, and Complex from org.apache.commons.math3 package\n - Easy initialization: copying data from (multi-dimensional) arrays of primitive values or NDArrays of any kind, and also filling with a scalar value\n - Lightweight views: slice (select a specific slice or range of slices along arbitrary dimension), permuteDims (change order of indexing), reshape (change shape of data)\n - Basic linear algebra operations: add, subtract, multiply, and divide an NDArray with scalar or another NDArray (element-wise)\n - Implements streaming and iterations of values or indices\n - Implemented fully in native Java\n\n## Examples\n\n```java\nComplexNDArray\u003cDouble\u003e array = new ComplexDoubleNDArray(4, 5, 3)\n    .fillUsingLinearIndices(i -\u003e new Complex(Math.random(), Math.random()));\n\narray.slice(\"2:3\", \":\", 1).fill(2); // updates the selected range in the original array\nComplexNDArray\u003cDouble\u003e sum = array.sum(2); // Calculates sum along axis 2, producing a 4 x 5 NDarray\n\n// Euclidean norm of element-wise product of two slices:\narray.slice(\"0:2\", \":\", 1).multiply(array.slice(\"2:4\", \":\", 1)).norm();\n\n// Assign zero to elements where the first coordinate is an even number:\narray.streamCartesianIndices() \n    .filter(idx -\u003e idx[0] % 2 == 0)\n    .forEach(idx -\u003e array.set(0, idx));\n// Alternative solution:\narray.applyWithCartesianIndices((value, idx) -\u003e idx[0] % 2 == 0 ? 0 : value);\n\narray.addInplace(new Complex(1, 3.5)); // Adds 1 + 3.5i to all elements\n```\n\n## Documentation\n\n - It presents NDArray features through examples, and illustrates how the task would be solved in Matlab, Python and Julia: [Tutorial](https://hakkelt.github.io/NDArrays/tutorial/)\n\n - For more examples, see tests in [src/test/java/com/github/hakkelt/ndarrays/basic](https://github.com/hakkelt/NDArrays/tree/main/src/test/java/io/github/hakkelt/ndarrays/basic).\n\n - For a complete list of features, please refer to the [javadoc documentation](https://hakkelt.github.io/NDArrays/).\n\n## Installation\n\n### Maven\n```\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003eio.github.hakkelt\u003c/groupId\u003e\n        \u003cartifactId\u003endarrays\u003c/artifactId\u003e\n        \u003cversion\u003e2.2.0\u003c/version\u003e\n    \u003c/dependency\u003e\n    ...\n\u003c/dependencies\u003e\n```\n\n### Manual\n\nDownload jar files from [latest release](https://github.com/hakkelt/NDArrays/releases/latest), and add their path to java path. You should also take care of the dependencies (`org.apache.commons.commons-math3`, `org.apache.commons.commons-lang3`).\n\n## Similar packages\n - [Vectorz](https://github.com/mikera/vectorz)\n - [DeepJavaLibrary](https://github.com/deepjavalibrary/djl) -\u003e [documentation](https://javadoc.io/doc/ai.djl/api/latest/ai/djl/ndarray/NDArray.html)\n - [Jep - Java Embedded Python](https://github.com/ninia/jep) -\u003e [Numpy Usage](https://github.com/ninia/jep/wiki/Numpy-Usage)\n\n## Inspiration from other languages\n - Python's [numpy.ndarray](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html)\n - Julia's native [multidimensional array type](https://docs.julialang.org/en/v1/manual/arrays/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhakkelt%2Fndarrays","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhakkelt%2Fndarrays","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhakkelt%2Fndarrays/lists"}