Metadata-Version: 2.2
Name: sitta
Version: 2.0.0rc2
Summary: A lightweight, dynamic multi-dimensional array / view for C++20, with NumPy and DLPack zero-copy interop.
Author: The SittaArray developers
License: Copyright 2026 The Sitta developers
         
         Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: C++
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Scientific/Engineering
Project-URL: Homepage, https://git.aquila-consortium.org/guilhem_lavaux/sitta
Requires-Python: >=3.10
Requires-Dist: numpy>=1.23
Description-Content-Type: text/markdown

# Sitta

A lightweight, dynamic multi-dimensional array / view for C++20. Pure container: shape,
strides, memory ownership and zero-copy views, nothing else. Optional, opt-in interop with
xtensor, Kokkos, HDF5, TBB, Boost.MultiArray, and Python.

```cpp
#include <sitta/sitta.hpp>
using namespace sitta;
```

## Installation

Header-only with zero dependencies for the core functionality.

```bash
cmake -B build
cmake --build build
ctest --test-dir build
```

Interop features (xtensor, Kokkos, HDF5, TBB, Boost.MultiArray, Python) are auto-detected
and built only if their dependencies are found; pass `-DSITTA_ENABLE_<NAME>=OFF` to skip one
even when present.

## Usage example

Two flavors: **static rank** (`SittaArray<T, N>`, rank known at compile time, tightest
codegen) and **dynamic rank** (`SittaArray<T>`, rank known at runtime). Both share the
same API.

```cpp
// Owning allocation, static rank 2.
auto a = SittaArray<double, 2>::from_shape({3, 4});
a(1, 2) = 3.14;

// Views share the buffer (refcounted): no copy, no allocation.
auto t = a.transpose();                                        // shape (4, 3)
auto s = a.slice(std::array<Range,2>{Range{0, 2, 1}, Range{1, 3, 1}});
s(0, 0) = 42;   // writes through to `a`

// Wrap external memory without taking ownership.
std::vector<float> buf(6);
auto w = SittaArray<float, 2>::wrap(buf.data(), {2, 3});
```

See the [Getting Started guide](docs/getting_started.rst) for the full walkthrough:
element access, `reshape`/`squeeze`, the rank-reducing `drop_axis`/`subview`,
static/dynamic rank conversion, inspecting an array,
and the element-wise `for_each`/`transform` algorithms.

## Interop

- **xtensor**: zero-copy view for host math (`sitta::xt_interop::as_xtensor`)
- **Kokkos**: wraps a `Kokkos::View`'s refcount for host/device buffers
- **HDF5**: read/write full datasets or hyperslabs, including user structs
- **TBB**: parallel `for_each`/`transform`
- **Boost.MultiArray**: zero-copy or copying conversion, static rank only
- **Python**: nanobind module with NumPy and DLPack zero-copy interop

Full usage for each adapter is in [`docs/interop.rst`](docs/interop.rst).

## What this class is *not*

No arithmetic, no broadcasting, no iterators, no I/O beyond the HDF5 adapter, no automatic
host/device mirroring. It's a metadata + buffer-lifetime layer: build numeric operations on
top via the xtensor/Kokkos/Python adapters.

## Documentation

Full API reference (generated from source via clang-doc) and detailed guides build with
Sphinx:

```bash
cmake -B build -DSITTA_ENABLE_DOCS=ON
cmake --build build --target docs
```

See [`docs/README.md`](docs/README.md) for the doc-build pipeline, or browse the `.rst`
sources directly: [`docs/getting_started.rst`](docs/getting_started.rst),
[`docs/interop.rst`](docs/interop.rst).

## License

MIT. See [LICENSE](LICENSE).
