Research CommonsResearch Commons
cpptensor/Operations

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 bool tensors
Tensor c = a + b;
Tensor mask = a > b;   // bool tensor

Reductions

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

OpDescription
matmulMatrix multiplication.
dotDot product (widened accumulation).
tensordotGeneralized tensor contraction.
svdSingular value decomposition.
eigEigendecomposition.
OpenBLAS-backed

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.