https://github.com/bensuperpc/vector
High performance multidimensional vectors in C++17, with optional OpenMP acceleration.
https://github.com/bensuperpc/vector
cmake cmake-init cpp cpp17 openmp vector
Last synced: 3 months ago
JSON representation
High performance multidimensional vectors in C++17, with optional OpenMP acceleration.
- Host: GitHub
- URL: https://github.com/bensuperpc/vector
- Owner: bensuperpc
- License: mit
- Created: 2022-07-01T19:55:43.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-09-14T18:48:10.000Z (over 2 years ago)
- Last Synced: 2025-04-06T15:51:06.041Z (about 1 year ago)
- Topics: cmake, cmake-init, cpp, cpp17, openmp, vector
- Language: C++
- Homepage:
- Size: 132 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# vector
High performance vectors and multidimensional vectors in **C++17**, with **optional OpenMP acceleration** and **no external dependencies** (Except for testing).
[](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#experimental) 
## Examples
The number of dimension is almost infinite (1 to 18 446 744 073 709 551 615).
### 2D example
```cpp
#include
#include
#include "vector/multi_array.hpp"
int main()
{
// Set dimensions, 2D array with 5x5 elements
std::vector vecDim = {5, 5};
auto vec2D_A = benlib::multi_array(vecDim);
// fill with 1
vec2D_A.fill(1);
// print
std::cout << "Must be equal to 1: " << vec2D_A[0][0] << std::endl;
// set value
vec2D_A[1][1] = 2;
// get value (Faster than using [] operator)
std::vector vecCoor = {1, 1};
std::cout << "Must be equal to 2: " << vec2D_A.get_value(vecCoor) << std::endl;
// set value (Faster than using [] operator)
vec2D_A.set_value(vecCoor, 3);
std::cout << "Must be equal to 3: " << vec2D_A.get_value(vecCoor) << std::endl;
return 0;
}
```
### 3D example
```cpp
#include
#include
#include "vector/multi_array.hpp"
int main()
{
// Set dimensions, 3D array with 5x5x5 elements
std::vector vecDim = {5, 5, 5};
auto vec3D_A = benlib::multi_array(vecDim);
// fill with 1
vec3D_A.fill(1);
// print
std::cout << "Must be equal to 1: " << vec3D_A[0][0][0] << std::endl;
// set value
vec3D_A[1][1][1] = 2;
// get value (Faster than using [] operator)
std::vector vecCoor = {1, 1, 1};
std::cout << "Must be equal to 2: " << vec3D_A.get_value(vecCoor) << std::endl;
// set value (Faster than using [] operator)
vec3D_A.set_value(vecCoor, 3);
std::cout << "Must be equal to 3: " << vec3D_A.get_value(vecCoor) << std::endl;
return 0;
}
```
## Building and installing
See the [BUILDING](BUILDING.md) document.
## Contributing
See the [CONTRIBUTING](CONTRIBUTING.md) document.
## Licensing
See the [LICENSE](LICENSE) document.