Skip to content
rizkirakasiwi edited this page Mar 14, 2026 · 3 revisions

numc

numc is a high-performance N-dimensional tensor library written in pure C23. It provides NumPy-like array operations with zero external dependencies, targeting scientific computing, machine learning, and high-frequency data processing.

Why numc?

  • Pure C, zero dependencies -- no BLAS, Fortran, or Python required. Just a C23 compiler.
  • 10 numeric types -- int8 through uint64, float32, float64. Every operation works on all types.
  • Arena memory management -- all arrays are owned by a context. Free the context, free everything. No leaks.
  • SIMD-accelerated -- AVX2, AVX-512, NEON, SVE/SVE2, and RISC-V Vector with automatic dispatch.
  • NumPy-compatible broadcasting -- binary operations broadcast shapes just like NumPy.
  • Cross-platform -- compiles on GCC, Clang, and MSVC. Runs on x86, ARM, and RISC-V.

Quick Example

#include <numc/numc.h>
#include <stdio.h>

int main() {
  // Create a context -- all arrays live here
  NumcCtx *ctx = numc_ctx_create();

  // Create a 3x3 matrix filled with 2.0
  size_t shape[] = {3, 3};
  NumcArray *a = numc_array_fill(ctx, shape, 2, NUMC_DTYPE_FLOAT32,
                                 &(float){2.0f});

  // Create a random 3x3 matrix
  NumcArray *b = numc_array_rand(ctx, shape, 2, NUMC_DTYPE_FLOAT32);

  // Element-wise addition
  NumcArray *sum = numc_array_create(ctx, shape, 2, NUMC_DTYPE_FLOAT32);
  numc_add(a, b, sum);

  // Matrix multiplication
  NumcArray *prod = numc_array_create(ctx, shape, 2, NUMC_DTYPE_FLOAT32);
  numc_matmul(a, b, prod);

  printf("a + b:\n");
  numc_array_print(sum);
  printf("\na @ b:\n");
  numc_array_print(prod);

  // Free everything at once
  numc_ctx_free(ctx);
  return 0;
}

Documentation

Getting Started

Core Concepts

Operations

Reference

Clone this wiki locally