#ifndef CACTUS_FULLMODE_KERNELS_H
#define CACTUS_FULLMODE_KERNELS_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h>
#include <stdint.h>

/*  Full Mode C reference kernels.
 *
 *  These are the canonical small-footprint kernels that ship identically on:
 *    - Heltec WiFi LoRa 32 V4 (ESP32-S3, RadioBox-Nano S3 sensor)
 *    - ESP32-C5 gateway nodes
 *    - Any Linux host (Jetson, Pi5, DGX, laptop) via libcactus_fullmode.so
 *
 *  Every host ends up running the *same math*. That is the whole point of
 *  Full Mode: a neural network is an algorithm, not a framework.
 *
 *  Matrix layout: row-major. Y = X @ W + b  where
 *      X: (N, K)  W: (K, M)  b: (M)  Y: (N, M)
 */

/* fp32 dense layer: y = x @ W + b */
void cactus_fullmode_gemm_fp32(
    const float *x, const float *w, const float *b,
    float *y, int N, int K, int M);

/* fp32 ReLU in place: x[i] = max(0, x[i]) */
void cactus_fullmode_relu_fp32(float *x, int n);

/* fp32 softmax over last dim (N rows x M cols), numerically stable */
void cactus_fullmode_softmax_fp32(
    const float *x, float *y, int N, int M);

/* int8 dense layer: W is int8 sym-quantized with scale s_w, b is fp32,
 * y = (x @ dequant(W)) + b. Optimized for MCU flash budget. */
void cactus_fullmode_gemm_int8(
    const float *x, const int8_t *w, float w_scale, const float *b,
    float *y, int N, int K, int M);

/* Argmax over last dim — returns class index per row into out[] */
void cactus_fullmode_argmax(const float *x, int32_t *out, int N, int M);

#ifdef __cplusplus
}
#endif

#endif
