Stratax
Scientific computing containers and operations
Loading...
Searching...
No Matches
Stratax

Stratax is a small scientific computing library built around modern C++20 containers, shape metadata, and element-wise array operations. The core library is header-first, with early 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.

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
  • Experimental Python bindings for Shape, Vector, Matrix, and Tensor
  • Doxygen API documentation with rendered complexity sections

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
  • Doxygen 1.17 or newer for API docs

Quick C++ Example

#include <stratax.hpp>
#include <iostream>
int main()
{
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.out())
print(vector.tolist())
print(matrix.tolist())
print(tensor.tolist())

Python bindings are currently a thin experimental layer over double-based containers. The C++ API is the primary interface while the binding surface grows.

Build

Configure and build with CMake:

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

For Python packaging, use a normal PEP 517 frontend from an environment with Python and build dependencies available:

python -m pip install -e .

Tests

The current tests are standalone C++ files under tests/. A simple local check can compile each test with g++ and run the produced executable:

g++ -std=c++20 -Wall -Wextra -Iinclude tests/core/Shape.cpp -o shape_test
.\shape_test.exe

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

Project Layout

include/stratax/ C++ headers
bindings/ pybind11 bindings
python/stratax/ Python package files and type markers
tests/ C++ test programs
docs/dev/ Developer notes
docs/cpp/html/ Generated Doxygen HTML output
examples/ Example entry points

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: early Shape, Vector, Matrix, Tensor

Reserved for future work:

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