{"id":27013986,"url":"https://github.com/burgundytora/mdvector","last_synced_at":"2025-04-04T13:19:29.919Z","repository":{"id":281138823,"uuid":"944308621","full_name":"Burgundytora/mdvector","owner":"Burgundytora","description":"A high-performance multidimensional SIMD vector library for C++  (auto-type-simd/expression-template/python-style-slice)","archived":false,"fork":false,"pushed_at":"2025-04-03T00:48:01.000Z","size":218,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T01:28:35.419Z","etag":null,"topics":["cplusplus","cpp","cpp17","header-only","high-performance-computing","python-style-slicing","simd"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Burgundytora.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-03-07T06:00:01.000Z","updated_at":"2025-04-03T00:48:04.000Z","dependencies_parsed_at":"2025-03-26T06:34:37.116Z","dependency_job_id":null,"html_url":"https://github.com/Burgundytora/mdvector","commit_stats":null,"previous_names":["burgundytora/cpp_ndarray","burgundytora/mdvector"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Burgundytora%2Fmdvector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Burgundytora%2Fmdvector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Burgundytora%2Fmdvector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Burgundytora%2Fmdvector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Burgundytora","download_url":"https://codeload.github.com/Burgundytora/mdvector/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247182427,"owners_count":20897381,"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":["cplusplus","cpp","cpp17","header-only","high-performance-computing","python-style-slicing","simd"],"created_at":"2025-04-04T13:19:28.989Z","updated_at":"2025-04-04T13:19:29.911Z","avatar_url":"https://github.com/Burgundytora.png","language":"C++","readme":"# mdvector - 多维高性能SIMD向量库\n\n\n**mdvector** 是一个**C++17**标准下、**轻量级头文件**形式、基于现代C++的多维数组计算库，通过 **SIMD指令集优化** 和 **表达式模板技术**，在元素级运算（Element-wise）场景下达到**接近手写汇编极限性能**，同时支持**python风格切片操作**与切片之间高性能计算。\n\n**mdvector** is a **C++17** based **lightweight header-only** multidimensional array computing library based on modern C++. Through **SIMD instruction set optimization** and **expression template techniques**, it achieves **near hand-written assembly performance** in element-wise operations while supporting **Python-style slicing operations** and high-performance computation on slices.\n\n\n## 🚀 核心特性\n\n### 1. 极致性能优化【已支持】\n- **SIMD 全指令集支持**：SSE/AVX2/AVX512（x86）、NEON（ARM）、RISC-V自动适配，内存对齐与尾部掩码处理，相比手写指令集无性能损失\n- **表达式模板**：复杂运算（如 `res = a + b - c * d / e`）零临时变量开销\n\n### 2. 多维与视图的灵活操作【已支持】\n- **任意维度支持**：通过自定义实现（C++17）实现多维索引功能，对标 `std::mdspan`（C++23）特性\n- **安全索引**：`vec.at(d1,d2,d3)`（边界检查）与 **快速索引** `vec(d1,d2,d3)` ，需指出`vec[d1,d2,d3]`形式的[]索引重载需要C++23才能支持\n- **惰性视图**：支持自定义指针偏移实现切片（`subspan`） 切片同样支持高性能表达式模板计算操作\n\n### 3. 内存安全设计【评估中】\n- **Rust风格安全证明**：所有 `unsafe` 操作可以绑定维度类型来静态验证\n- **编译期形状检查**：通过类型系统确保维度一致性\n\n### 4. 跨平台兼容【已支持】\n- **指令集自动适配**：x86/ARM/RISC-V 架构无缝切换\n- **编译器友好**：GCC/Clang/MSVC 全支持\n- **轻量级**：头文件形式\n- **兼容性**：只需要C++17标准即可，无需C++23的标准库mdspan等特性\n\n### 5. 未来特性\n- **高性能三角函数**：集成simd形式高性能三角函数，扩展mdvector在科学计算领域的适用性\n- **更多灵活切片方法**：更多切片方法，如python风格跨步长子视图，以及降维等实用操作\n- **更多类型支持**：目前mdvector支持float与double，未来考虑兼容int以及自定义类型（但是会要求类型POD，同时会去掉表达式模板运算功能，保留多维索引与子视图功能）\n- **基本科学计算功能扩展**：三维坐标计算、四元数计算等基础功能\n- **单头文件使用**：single_include形式，只需引入单个头文件，指令集检测选择内嵌到单头文件代码中，同时提供手动指定指令集功能\n- **关于C++23及以上标准**：目前`mdspan`与`subspan`为自定义实现，给予C++17标准，未来考虑使用C++23及以上标准时，自动替换自定义实现为标准库实现方式\n- **接口**：与eigen等库的无开销映射\n\n### 6. 目前不考虑的特性\n- **复杂矩阵运算**：GEMM等不在考虑范围，建议使用eigen\n- **稀疏矩阵**：同样建议使用eigen、blas、mkl等\n- **复杂科学计算**：复数运算、频域计算暂不在考虑范围内\n\n## 📊 性能对比\n- **md expr为此项目**   \n- **hwy为google-highway**\n- **expr为基于for循环的表达式模板**\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"docs/images/win-2d.png\" width=\"90%\"\u003e\n  \u003cp\u003e\u003cem\u003e性能对比(越高越好)\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"docs/images/linux-2d.png\" width=\"90%\"\u003e\n  \u003cp\u003e\u003cem\u003e性能对比(越高越好)\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"docs/images/win-3d.png\" width=\"90%\"\u003e\n  \u003cp\u003e\u003cem\u003e性能对比(越高越好)\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"docs/images/linux-3d.png\" width=\"90%\"\u003e\n  \u003cp\u003e\u003cem\u003e性能对比(越高越好)\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\n## 📦 快速开始\n\n### 使用\n- git clone https://github.com/Burgundytora/mdvector.git\n- cmake中添加次仓库目录 然后include mdvector.h头文件即可 cmake指令集与编译选项参考附带cmake文件夹 或者引入simd的cmake\n- 未来会适配single_include形式\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fburgundytora%2Fmdvector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fburgundytora%2Fmdvector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fburgundytora%2Fmdvector/lists"}