Operations
Arithmetic, unary math, reductions, comparisons, shape ops, and linear algebra in cpptensor.
cpptensor ships a broad operation set. Most ops register kernels in the
runtime registry, which initializes lazily on first use.
Elementwise & unary
- Arithmetic:
+,-,*,/ - Unary math: elementwise functions over a tensor
- Comparisons: produce
booltensors
Tensor c = a + b;
Tensor mask = a > b; // bool tensorReductions
sum, mean, and other reductions collapse along dimensions. These are
numerically careful — see Numerics & dtypes.
Tensor s = a.sum();
Tensor m = a.mean();Shape operations
reshape, transpose, concat, and stack rearrange data. Many return views
where possible; materialize a contiguous copy when needed (see
Tensors & views).
Linear algebra
| Op | Description |
|---|---|
matmul | Matrix multiplication. |
dot | Dot product (widened accumulation). |
tensordot | Generalized tensor contraction. |
svd | Singular value decomposition. |
eig | Eigendecomposition. |
With OpenBLAS available, matmul and dot can use BLAS-backed paths, and
svd / eig require OpenBLAS/LAPACK support. See
Backends & ISA.
Adding new ops
The repo documents how to add new ops and kernels (docs/HowToAddNewOpsWithKernel.md)
and tracks operator status and semantics (docs/Ops_Status.md) in the source
tree.