{"id":24105085,"url":"https://github.com/symisc/sy-numpy-cpp","last_synced_at":"2025-08-10T21:12:07.980Z","repository":{"id":271312968,"uuid":"913044724","full_name":"symisc/sy-numpy-cpp","owner":"symisc","description":"A C++17 library for reading and writing NumPy .npy files, with optional .npz (zip) archive support","archived":false,"fork":false,"pushed_at":"2025-01-06T23:52:52.000Z","size":15,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T07:04:32.343Z","etag":null,"topics":["cpp-library","cpp17","numpy","numpy-library","serialization"],"latest_commit_sha":null,"homepage":"https://pixlab.io/numpy-cpp-library","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/symisc.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":"2025-01-06T23:19:54.000Z","updated_at":"2025-01-12T18:36:47.000Z","dependencies_parsed_at":"2025-01-07T04:15:22.954Z","dependency_job_id":null,"html_url":"https://github.com/symisc/sy-numpy-cpp","commit_stats":null,"previous_names":["symisc/sy-numpy-cpp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/symisc/sy-numpy-cpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/symisc%2Fsy-numpy-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/symisc%2Fsy-numpy-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/symisc%2Fsy-numpy-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/symisc%2Fsy-numpy-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/symisc","download_url":"https://codeload.github.com/symisc/sy-numpy-cpp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/symisc%2Fsy-numpy-cpp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269788193,"owners_count":24475887,"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-08-10T02:00:08.965Z","response_time":71,"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":["cpp-library","cpp17","numpy","numpy-library","serialization"],"created_at":"2025-01-10T20:25:14.939Z","updated_at":"2025-08-10T21:12:07.954Z","avatar_url":"https://github.com/symisc.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# syNumpy\n\n### A **C++17** library for **reading and writing** [NumPy](https://numpy.org/) `.npy` files, with **optional** `.npz` (zip) archive support\n#### Documentation \u0026 Homepage: [https://pixlab.io/numpy-cpp-library](https://pixlab.io/numpy-cpp-library).\n\n## Features\n\n- **NpyArray**: A container that stores the loaded array’s shape, word size, fortran order, and data in memory.  \n- **Load \u0026 Save**:  \n  - `syNumpy::loadNpy(...)` reads from a file.  \n  - `syNumpy::loadNpyBuffer(...)` reads from a raw memory buffer.  \n  - `syNumpy::saveNpy(...)` writes or appends data.  \n- **Append Mode**: Save with `mode = \"a\"` to extend the first dimension of an existing file (if shapes match).  \n- **Endian Checks**: Warn if the file is big-endian while the system is little-endian (or vice versa). No auto-swapping.  \n- **Optional NPZ**: `-DSYNUMPY_ENABLE_NPZ=1` enables zip-based `.npz` archiving (requires **zlib**). Minimal example included.\n\n## Quick Start\n\n1. **Include** `syNumpy.hpp` in your C++17 project.\n2. **Compile** with `-std=c++17`.\n3. **(Optional)** Define `SYNUMPY_ENABLE_NPZ=1` and link **zlib** (`-lz`) for `.npz` archiving.\n\n### Minimal Example\n\n```cpp\n#include \"syNumpy.hpp\"\n#include \u003ciostream\u003e\n\nint main() {\n    // 1) Save a float array\n    {\n        std::vector\u003cfloat\u003e data = {1.0f, 2.0f, 3.0f};\n        syNumpy::saveNpy(\"floats.npy\", data); // overwrites if file exists\n    }\n\n    // 2) Load it back\n    {\n        syNumpy::NpyArray arr = syNumpy::loadNpy(\"floats.npy\");\n        std::vector\u003cfloat\u003e loaded = arr.asVector\u003cfloat\u003e();\n        std::cout \u003c\u003c \"Loaded \" \u003c\u003c loaded.size() \u003c\u003c \" floats: \";\n        for (auto f : loaded) std::cout \u003c\u003c f \u003c\u003c \" \";\n        std::cout \u003c\u003c \"\\n\";\n    }\n\n#if SYNUMPY_ENABLE_NPZ\n    // 3) Create a .npz archive with multiple arrays\n    {\n        syNumpy::NpzArchive zip;\n        std::vector\u003cint\u003e arr1 = {10, 20, 30};\n        std::vector\u003cdouble\u003e arr2 = {3.14, 2.71};\n        zip.addArray(\"ints\", arr1);\n        zip.addArray(\"doubles\", arr2);\n        zip.save(\"arrays.npz\");\n    }\n#endif\n    return 0;\n}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsymisc%2Fsy-numpy-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsymisc%2Fsy-numpy-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsymisc%2Fsy-numpy-cpp/lists"}