Skip to main content

Modern scientific array library for C++20 with Python bindings.

Project description

Stratax

Stratax is a modern scientific computing library built around modern C++20 containers, shape metadata, and element-wise array operations. The core library is header-first, with Python bindings powered by pybind11.

The project is still young: vectors, matrices, tensors, shape/stride metadata, indexing, slicing, reshaping, conversions, creation helpers, printing, comparison, and arithmetic are active. Linear algebra, calculus, random, and statistics modules are currently reserved API areas.

Current Features

  • C++20 Vector, Matrix, and Tensor containers
  • Contiguous Buffer storage with shape and stride metadata
  • Bounds-checked at(...) and multidimensional operator(...) access
  • Element-wise arithmetic and comparison operators
  • Reshape, flatten, slicing, and container conversion helpers
  • Tensor creation helpers such as zeros, ones, full, and identity
  • Stream printing for vectors, matrices, tensors, shapes, and strides
  • Python bindings for Shape, Vector, Matrix, and Tensor
  • Doxygen API documentation

Requirements

  • C++20 compiler
  • CMake 3.20 or newer
  • Python 3.10 or newer for bindings
  • pybind11 2.12 or newer
  • scikit-build-core 0.10 or newer
  • pytest 8 or newer for Python tests
  • Doxygen 1.17 or newer for API docs

Quick C++ Example

#include <stratax.h>
#include <iostream>

int main()
{
    stratax::container::Vector<double> a{1.0, 2.0, 3.0};
    stratax::container::Vector<double> b{4.0, 5.0, 6.0};

    auto c = a + b;

    std::cout << c << '\n'; // [5, 7, 9]
}

Quick Python Example

from stratax import Matrix, Shape, Tensor, Vector

shape = Shape([2, 2])
vector = Vector([1.0, 2.0, 3.0])
matrix = Matrix([[1.0, 2.0], [3.0, 4.0]])
tensor = Tensor([2, 2], 1.0)

tensor[1, 1] = 9.0

print(shape.elements)
print(vector.tolist())
print(matrix.tolist())
print(tensor.tolist())

Python bindings currently expose double-based Shape, Vector, Matrix, and Tensor wrappers. The C++ API remains the primary interface while the binding surface grows.

Build From Source

Configure and build with CMake:

cmake -S . -B build
cmake --build build

For editable Python installation, use pip from an environment with the build dependencies available:

python -m pip install -e .

Run Tests

The C++ tests live under tests/cpp/ and are registered with CTest through GoogleTest:

cmake -S . -B build
cmake --build build
ctest --test-dir build --output-on-failure

The Python tests live under tests/python/ and use pytest:

python -m pytest tests/python

Generate Documentation

Generate API documentation with Doxygen:

doxygen Doxyfile

The generated HTML entry point is:

docs/cpp/html/index.html

If you configure through CMake and Doxygen is available, you can also run:

cmake --build build --target docs

Repository Layout

include/stratax/      Public C++ headers
bindings/             pybind11 binding sources
python/stratax/       Python package
tests/cpp/            C++ tests
tests/python/         Python tests
examples/cpp/         C++ examples
examples/python/      Python examples
docs/cpp/             C++ API documentation
docs/python/          Python documentation

Installation

Python

pip install stratax

C++

Stratax is header-first for C++. Include the repository include/ directory in your build and include the umbrella header:

#include <stratax.h>

License

Stratax is licensed under the MIT License.

Contributing

Contributions, bug reports, and feature requests are welcome through GitHub Issues and Pull Requests.

Project Status

Implemented:

  • Core storage and metadata: Buffer, Shape, Strides, Slice
  • Containers: Vector, Matrix, Tensor
  • Operations: arithmetic, comparison, indexing, reshape, slicing
  • Container helpers: creation and conversions
  • I/O: stream printing
  • Python bindings: Shape, Vector, Matrix, Tensor

Roadmap

  • Broadcasting
  • Logical operations
  • Linear algebra algorithms
  • Calculus helpers
  • Random sampling and distributions
  • Statistics routines
  • CSV and binary I/O

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stratax-0.1.0.tar.gz (635.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stratax-0.1.0-cp313-cp313-win_amd64.whl (174.6 kB view details)

Uploaded CPython 3.13Windows x86-64

File details

Details for the file stratax-0.1.0.tar.gz.

File metadata

  • Download URL: stratax-0.1.0.tar.gz
  • Upload date:
  • Size: 635.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for stratax-0.1.0.tar.gz
Algorithm Hash digest
SHA256 51c95ca0c2d56e65dabb512f01d7734ba31b0c4629907e1bc49532a47561ef14
MD5 92d5db87ce0042d919c1764557fc0820
BLAKE2b-256 0d8a317fa35553497c8540290e0f0ab93873757077a3e760a708d296854c2366

See more details on using hashes here.

File details

Details for the file stratax-0.1.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: stratax-0.1.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 174.6 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for stratax-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 70bd69775cdaa62db0b001d952467063afeb53052521108c80f2c0422bc1d1c1
MD5 cdc5795637f6a1e8d6aa6e7c4c174b73
BLAKE2b-256 795043ce65cb00194368d6b081530aad68cb930e795218946946fb8647ea6023

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page