{"id":45868404,"url":"https://github.com/restgroup/rstsr","last_synced_at":"2026-04-10T10:07:29.933Z","repository":{"id":269430964,"uuid":"838247664","full_name":"RESTGroup/rstsr","owner":"RESTGroup","description":"An n-dimensional rust tensor library","archived":false,"fork":false,"pushed_at":"2025-11-14T04:55:37.000Z","size":2598,"stargazers_count":48,"open_issues_count":5,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-01T21:51:02.784Z","etag":null,"topics":["math-library","ndarray","rust","scientific-computing","tensor"],"latest_commit_sha":null,"homepage":"https://restgroup.github.io/rstsr-book/","language":"Rust","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/RESTGroup.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-08-05T08:53:31.000Z","updated_at":"2025-11-26T13:29:20.000Z","dependencies_parsed_at":"2025-01-15T12:29:10.095Z","dependency_job_id":"bc29ddae-bd1d-4266-99b5-5e84bb47e872","html_url":"https://github.com/RESTGroup/rstsr","commit_stats":null,"previous_names":["ajz34/rstsr","restgroup/rstsr"],"tags_count":207,"template":false,"template_full_name":null,"purl":"pkg:github/RESTGroup/rstsr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RESTGroup%2Frstsr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RESTGroup%2Frstsr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RESTGroup%2Frstsr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RESTGroup%2Frstsr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RESTGroup","download_url":"https://codeload.github.com/RESTGroup/rstsr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RESTGroup%2Frstsr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29888786,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T08:34:21.514Z","status":"ssl_error","status_checked_at":"2026-02-27T08:32:38.035Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["math-library","ndarray","rust","scientific-computing","tensor"],"created_at":"2026-02-27T09:01:51.251Z","updated_at":"2026-04-10T10:07:29.905Z","avatar_url":"https://github.com/RESTGroup.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"https://github.com/RESTGroup/rstsr/raw/master/assets/logo-3-white.png\" width=\"500px\" alt=\"Logo of RSTSR\" /\u003e\n\n\u003c/div\u003e\n\n# RSTSR: An n-Dimensional Rust Tensor Toolkit\n\n\u003cdiv align=\"center\"\u003e\n\n| Resources | Badges |\n|--|--|\n| User Document | [![User Documentation](https://readthedocs.org/projects/rstsr-book/badge/?version=latest)](https://rstsr-book.readthedocs.io/latest/) |\n| API Document | [![API Documentation](https://docs.rs/rstsr/badge.svg)](https://docs.rs/rstsr) |\n| Crate | [![Crate](https://img.shields.io/crates/v/rstsr.svg)](https://crates.io/crates/rstsr) |\n\n\u003c/div\u003e\n\nWelcome to RSTSR, an n-dimensional tensor toolkit library, in native rust.\n\nThis crate will be a building block for scientific computation in native Rust, similar to NumPy of Python.\n\nFor users comes from NumPy, the [NumPy-RSTSR Cheatsheet](https://restgroup.github.io/rstsr-book/docs/numpy-cheatsheet) ([简体中文](https://restgroup.github.io/rstsr-book/zh-hans/docs/numpy-cheatsheet)) will let you quickly be familiar with RSTSR.\n\n**This project is still in early stage, and radical code factorization could occur; dev-documentation can still be greatly improved.**\n\n## Features\n\n- Simple syntex (looks like NumPy, and some core concepts from rust crate [ndarray](https://github.com/rust-ndarray/ndarray/)).\n- % (remainder) as matrix multiplication (you can `\u0026a % \u0026b` to perform `a.matmul(\u0026b)`).\n- Allow different devices in framework.\n    - We will try to support CUDA and HIP in near future.\n- Full support of n-dimensional, broadcasting, basic slicing, reshape.\n- Fast on multi-threading CPU.\n    - Matmul is provided by backends (such as [faer](https://github.com/sarah-quinones/faer-rs/) or [OpenBLAS](https://github.com/OpenMathLib/OpenBLAS/)).\n    - Other cases (summation, element-wise operations) are on-par or even much faster than NumPy (by fast layout iterators and [rayon](https://github.com/rayon-rs/rayon/) threading).\n- Either row-major or column-major is supported (controled by cargo feature). Dynamic row/col-major control can also be performed by device setting.\n\n| Supported devices (backends) | Device type name | Crate | Cargo feature |\n|--|--|--|--|\n| Naive Serial CPU | `DeviceCpuSerial` | rstsr-core | (always built) |\n| Faer | `DeviceFaer` | rstsr-core | `rstsr/faer` |\n| OpenBLAS | `DeviceOpenBLAS` | rstsr-openblas | `rstsr/openblas` |\n| oneAPI MKL | `DeviceMKL` | rstsr-mkl | `rstsr/mkl` |\n| BLIS/FLAME | `DeviceBLIS` | rstsr-blis | `rstsr/blis` |\n| AOCL | `DeviceAOCL` | rstsr-aocl | `rstsr/aocl` |\n| KML | `DeviceKML` | rstsr-kml | `rstsr/kml` |\n\n## Illustrative Example\n\nTo start with, you may try to run the following code:\n\n```rust\nuse rstsr::prelude::*;\n\n// 3x2 matrix with c-contiguous memory layout\nlet a = rt::asarray((vec![6., 2., 7., 4., 8., 5.], [3, 2].c()));\n\n// 2x4x3 matrix by arange and reshaping\nlet b = rt::arange(24.);\nlet b = b.reshape((-1, 4, 3));\n// in one line, you can also\n// let b = rt::arange(24.).into_shape((-1, 4, 3));\n\n// broadcasted matrix multiplication\nlet c = \u0026b % \u0026a;\n\n// print the result\nprintln!(\"{:6.1}\", c);\n// output:\n// [[[   23.0   14.0]\n//   [   86.0   47.0]\n//   [  149.0   80.0]\n//   [  212.0  113.0]]\n//\n//  [[  275.0  146.0]\n//   [  338.0  179.0]\n//   [  401.0  212.0]\n//   [  464.0  245.0]]]\n\n// print layout of the result\nprintln!(\"{:?}\", c.layout());\n// output:\n// 3-Dim (dyn), contiguous: Cc\n// shape: [2, 4, 2], stride: [8, 2, 1], offset: 0\n```\n\n## Short FAQs\n\n\u003e **Why RSTSR? There seems many numeric and machine-learning libraries in rust already.**\n\nWe need a numeric library that supports\n- a data structure that supports arbitary types (including complex, half, and arbitary-precision)\n- a framework that supports different backends\n- fast, at least efficient on server CPU\n- supports parallel by threading (specifically rayon)\n- large dynamic dimension tensor and its reshape\n- functionality can be extended by other crates\n\nAnd further more,\n- the framework may not overwhelm chemist scientists\n\nMany crates in native rust done well in some aspects but not all.\n\nThis crate gets inspire from [NumPy](https://github.com/data-apis/array-api/), [Array API standard](https://github.com/data-apis/array-api/), [ndarray](https://github.com/rust-ndarray/ndarray/), [candle](https://github.com/huggingface/candle), [Burn](https://github.com/tracel-ai/burn).\n\n\u003e **What is supposed to be supported in near future?**\n\n- Plugins: Einstein summation, FFT\n- GPU devices: CUDA and HIP device support\n- `rstsr-sci-traits`: Optimization, ODE, special functions\n- `rstsr-core`: Full support of [Python array API standard](https://data-apis.org/array-api/latest/) (in native rust instead of python binding)\n    - searching functions\n    - manuplication functions (tile, roll, moveaxis)\n\n\u003e **What's RSTSR meaning?**\n\nRSTSR either refers to\n- its relationship with [REST](https://gitee.com/restgroup/rest): **R**EST (rust-based electronic structure toolkit) **S**ubproject for **T**en**s**o**r** support, or\n- the functionality itself: an *n*-dimensional **R**u**s**t **T**en**s**o**r** toolkit.\n\nThis crate was originally trying to developed a more dev-friendly experience for chemist programmer from numpy/scipy/pytorch. However, scientists and engineers from any discipline are welcomed to try this tensor toolkit.\n\n\u003e **Is there an illustrative project for using RSTSR in real-world project?**\n\nWe refer a project that developed before rstsr v0.1: [showcase of RI-CCSD](https://github.com/ajz34/showcase_rust_riccsd).\nFile [riccsd.rs](https://github.com/ajz34/showcase_rust_riccsd/blob/master/src/riccsd.rs) is a demonstration of code style to use RSTSR.\n\n\u003e 如果您能阅读简体中文，[REST Workshop：Rust 计算化学程序开发演示](https://github.com/RESTGroup/showcase-workshop-rstsr-ricc) 是更加完整的实战项目。它表明 RSTSR 在开发电子结构程序时，兼备开发效率与运行效率。该项目也可以作为 RSTSR 的代码风格展示。\n\n\u003e **What features will not be implemented?**\n\nWe do not support autodiff and lazy-evaluation in far future. In this mean time, we are not very concern on machine-learning applications, but focus more on traditional scientific computing, especially applications in electronic structure.\n\n## Acknowledge\n\nThis is a subproject of [REST](https://gitee.com/restgroup/rest). REST is supported by \n- NSFC (National Natural Science Foundation of China): 22125301, 22393911, 22393912, 22321003, 22233002;\n- Innovation Program for Quantum Science and Technology: 2021ZD0303305;\n- robotic AI-Scientist platform of Chinese Academy of Science.\n\nAdditionally, RSTSR is also funded by\n- NSFC (National Natural Science Foundation of China): 22503020.\n\n## Miscellaneous\n\nCurrent MSRV (minimal supported rust version) is\n- 1.84.1: with crate faer built;\n- 1.82.0: other cases (due to crate `half` and rust language usage of `unsafe extern \"C\"`).\n\nYou are welcomed to raise problems or suggestions in github repo issues or discussions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frestgroup%2Frstsr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frestgroup%2Frstsr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frestgroup%2Frstsr/lists"}