High performance multidimensional vectors in C++17, with optional OpenMP acceleration.
 
 
 
Go to file
Bensuperpc 9febb9c84e
Update code
Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
2022-10-20 11:23:01 +02:00
.github Fix Error on CI 2022-07-15 13:52:24 +02:00
cmake Fix coverage repport and add graph build on Makefile 2022-07-06 11:27:39 +02:00
docs Add files 2022-07-01 22:07:01 +02:00
example Update CMakeLists.txt 2022-07-09 17:59:32 +02:00
include/vector Update code 2022-10-20 11:23:01 +02:00
test Update code 2022-07-15 17:08:45 +02:00
.clang-format Update readme, functions names, add examples, update makefile 2022-07-04 15:13:50 +02:00
.clang-tidy Add files 2022-07-01 22:07:01 +02:00
.codespellrc Add files 2022-07-01 22:07:01 +02:00
.gitignore Add files 2022-07-01 22:07:01 +02:00
BUILDING.md Add files 2022-07-01 22:07:01 +02:00
CMakeLists.txt Update CMakeLists.txt 2022-07-09 17:59:21 +02:00
CMakePresets.json Update CMakePresets.json 2022-07-09 17:58:59 +02:00
CODE_OF_CONDUCT.md Add files 2022-07-01 22:07:01 +02:00
CONTRIBUTING.md Add files 2022-07-01 22:07:01 +02:00
HACKING.md Update tests and code 2022-07-02 21:05:10 +02:00
LICENSE Initial commit 2022-07-01 21:55:43 +02:00
Makefile Upate code 2022-07-13 18:04:29 +02:00
README.md Update README.md 2022-07-15 13:59:12 +02:00
codespell.ignore-words.txt Add files 2022-07-01 22:07:01 +02:00

README.md

vector

High performance vectors and multidimensional vectors in C++17, with optional OpenMP acceleration and no external dependencies (Except for testing).

stability-experimental GitHub

Examples

The number of dimension is almost infinite (1 to 18 446 744 073 709 551 615).

2D example

#include <iostream>
#include <vector>

#include "vector/multi_array.hpp"

int main()
{
  // Set dimensions, 2D array with 5x5 elements
  std::vector<uint64_t> vecDim = {5, 5};
  auto vec2D_A = benlib::multi_array<uint32_t>(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<uint64_t> 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

#include <iostream>
#include <vector>

#include "vector/multi_array.hpp"

int main()
{
  // Set dimensions, 3D array with 5x5x5 elements
  std::vector<uint64_t> vecDim = {5, 5, 5};
  auto vec3D_A = benlib::multi_array<uint32_t>(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<uint64_t> 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 document.

Contributing

See the CONTRIBUTING document.

Licensing

See the LICENSE document.