Instructions to use ReasoningKingdom/LITOperator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LeRobot
How to use ReasoningKingdom/LITOperator with LeRobot:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Download lit_operator/lit_core.h from ReasoningKingdom/LITOperator: direct link, hf CLI and curl.
- Browser
- Download file 4.83 kB
-
https://huggingface.co/ReasoningKingdom/LITOperator/resolve/main/lit_operator/lit_core.h
- Command line
-
hf download hf://ReasoningKingdom/LITOperator/lit_operator/lit_core.h
-
curl -L -o lit_core.h https://huggingface.co/ReasoningKingdom/LITOperator/resolve/main/lit_operator/lit_core.h
4.83 kB
| /* | |
| * lit_core.h — LITCORE: the LIT algebraic core, language-agnostic C. | |
| * | |
| * LITCORE is brainless: broadcast the graph, multiply, reduce, | |
| * rewire, repeat. It never interprets what a symbol means; there is | |
| * no semantics inside the core. | |
| * | |
| * Six is the optimal operation; DO NOT TOUCH IT. | |
| */ | |
| extern "C" { | |
| /* LIT bytecode: LOAD slot:u32 value:u64; WIRE slot:u32 src:u32 | |
| * gain:u64 weight:u64; everything else is one byte. Little-endian. */ | |
| /* lit flat: 2^LIT_FLAT = 64, the 64/65 halt edge. */ | |
| /* The hard halt bound: 65 ticks at L=64. A run is one tick by | |
| * default (one tick applies F^64, so the step is already the whole | |
| * job) and never exceeds LIT_HALT ticks even if asked. */ | |
| typedef struct lit_machine { | |
| uint32_t n; /* slots per cluster */ | |
| uint32_t k; /* clusters */ | |
| uint64_t *a; /* owned state when owns_state */ | |
| uint64_t *b; /* transition buffer */ | |
| uint64_t *V; /* current state (a or a borrowed buffer) */ | |
| uint64_t *prev; /* state before the last transfer (b) */ | |
| uint32_t *src; /* k*n wiring */ | |
| uint64_t *gain; /* k*n */ | |
| uint64_t *weight; /* k*n */ | |
| uint64_t *dist; /* k, last per-cluster distance */ | |
| uint64_t *diff; /* k*n, last strict-less difference mask */ | |
| uint32_t *flat_src; /* k*LIT_FLAT*n */ | |
| uint64_t *flat_gain; /* k*LIT_FLAT*n */ | |
| uint32_t *flat_as; /* n-word recurrence scratch */ | |
| uint32_t *flat_bs; | |
| uint64_t *flat_ag; | |
| uint64_t *flat_bg; | |
| int flat_dirty; /* the base graph changed; rebuild on the tick */ | |
| int pending; /* a VF_TRANSFER awaits HAMMING_REDUCE */ | |
| int owns_state; /* a was allocated by the core */ | |
| uint32_t bits; /* L: symbol width, 1..64 */ | |
| uint64_t mask; /* (1<<L)-1, or ~0 for L=64 */ | |
| uint32_t levels; /* flat exponent: ceil(log2(n)); 6 for n=64 */ | |
| uint32_t halt; /* hard halt: n + 1; 65 for n=64 */ | |
| } lit_machine; | |
| /* Copy `state` (n*k words) into the machine. Returns 0, or -1 on OOM. */ | |
| int lit_machine_init(lit_machine *m, const uint64_t *state, | |
| uint32_t n, uint32_t k, uint32_t bits); | |
| /* Borrow caller-owned `state` (n*k words); the core never frees it. */ | |
| int lit_machine_init_borrowed(lit_machine *m, uint64_t *state, | |
| uint32_t n, uint32_t k, uint32_t bits); | |
| /* Release every array the core owns; the borrowed state is untouched. */ | |
| void lit_machine_free(lit_machine *m); | |
| /* One complete tick: transfer then strict-less Hamming reduce. */ | |
| void lit_machine_step(lit_machine *m); | |
| /* Run one tick (F^64) with early halt; max_cycles 0 means one tick, | |
| * any larger request is clamped to LIT_HALT. Writes the ticks taken | |
| * and whether every cluster's d reached 0. */ | |
| void lit_machine_run(lit_machine *m, uint64_t max_cycles, | |
| uint64_t *cycles, int *converged); | |
| /* Rewire one slot (weight NULL keeps the existing weight). 0 or -1/-2. */ | |
| int lit_machine_connect(lit_machine *m, uint32_t slot, uint32_t src, | |
| uint64_t gain, const uint64_t *weight, int cluster); | |
| /* Rewrite a cluster's or every cluster's wiring. 0 or -1/-2. */ | |
| int lit_machine_graph(lit_machine *m, const uint32_t *src, | |
| const uint64_t *gain, const uint64_t *weight, | |
| int cluster); | |
| /* Load one n-word window into every cluster; no tick, no commit. */ | |
| void lit_machine_load(lit_machine *m, const uint64_t *words); | |
| /* Wire every cluster as a ring: slot i reads slot i-1, gain/weight 1. */ | |
| void lit_machine_ring(lit_machine *m); | |
| /* Copy cluster 0's committed V into out (n words). */ | |
| void lit_machine_copy_v(const lit_machine *m, uint64_t *out); | |
| /* | |
| * Execute LIT bytecode. On success returns 0 and writes a malloc'ed | |
| * history (reductions*k words), the reduction count, ticks, halted and | |
| * broadcast flags. The caller frees *history. On failure returns -1 | |
| * and writes a message into err (if err is non-NULL). | |
| */ | |
| int lit_machine_run_bytecode(lit_machine *m, const uint8_t *code, size_t len, | |
| uint64_t **history, size_t *reductions, | |
| uint64_t *ticks, int *halted, int *broadcast, | |
| char *err, size_t errlen); | |
| /* One in-place forward-ring tick over a writable uint64 buffer. */ | |
| uint64_t lit_ring_tick(uint64_t *v, size_t n, uint32_t bits, int wrap); | |
| } | |