algenta-general-c

Domain kernels from model interop to risk. Compiled Mojo, loaded in-process.

100 modules · 1012 functions · CPU

Get started

pip install kernels torch
from kernels import get_kernel

kernel = get_kernel(
    "thyn-ai/algenta-general-c",
    version=1,
    backend="cpu",
    trust_remote_code=["thyn-ai/algenta-general-c"],
)
kernel.operations_research.eoq_quantity(1000, 50, 2)  # -> 223.6068  economic order quantity, units

backend="cpu" selects the CPU build. On a Mac the loader otherwise looks for a Metal build, which this family does not ship. trust_remote_code names the repositories you allow; Hugging Face's trusted publishers load without it.

Plain Python in, plain Python out. Lists, tuples, buffers and tensors are accepted wherever the contract expects a list; structured results are dictionaries. Some functions take a list and the number of elements to use from it, which may not exceed the list's length; multi-dimensional data is passed flattened, row-major, with its dimensions. Functions that update an argument do so in place, as help() says. Every call is checked against the published contract before it reaches native code. An invalid call raises KernelError with a stable code, never a crash. Engine kernels report shape and finiteness problems as a status; the wrapper raises KernelError named after it.

Any function can also be called by name, with args as a list or a dict of parameter names:

kernel.execute("optimization.assignment", "assign_status_name", [...])

What's inside

Module Functions What it does
model_interop 10 Model file math: safetensors offsets, GGUF metadata size, ONNX FLOPs, RoPE scaling, perplexity
model_parallel 10 Parallel training math: pipeline bubble, ring all-reduce bytes, ZeRO-3 memory, DDP overhead
model_router 10 Model routing: request fit, endpoint load, fallback triggers, ensemble weights, latency tiers
model_selection 5 Cross-validation splits: k-fold, stratified k-fold, walk-forward, purged/embargoed windows
moe_production 10 Mixture-of-experts serving: token drop rate, expert load imbalance, routing entropy, capacity
moe_routing 10 Mixture-of-experts gating: noisy top-k, Switch top-1, smooth top-2, expert-choice, cosine
multi_objective 7 Multi-objective ranking: Pareto dominance and fronts, weighted sums, TOPSIS, ideal and nadir
multimodal 10 Vision and audio math: ViT patches, image tokens, mel scale, STFT magnitude, CLIP similarity
museum 12 Collection care: lux-hours, UV exposure, preservation index, climate stability, valuation
music_theory 12 Music theory: MIDI-to-Hz, cents and semitones, scale membership, just intonation, tempo
mycology 10 Mycology: spore dispersal, mycelial growth, Vanderplank epidemic rate, germination probability
nanotechnology 12 Nanoscale physics: surface-to-volume, quantum confinement, mean free path, Stokes-Einstein
nephrology 10 Kidney function: CKD-EPI eGFR, Cockcroft-Gault, FENa, TTKG, osmolar and free-water clearance
neuropharmacology 10 CNS drug action: brain receptor occupancy, Cheng-Prusoff Ki, brain-to-plasma ratios, Emax dose
neurophysics 10 Neuron biophysics: Nernst and Goldman potentials, leaky integrate-and-fire, 1/f spectral power
nlp 11 Text basics: tokenization, n-grams, TF-IDF, cosine and Jaccard similarity, word counts
nuclear 12 Nuclear physics: decay and half-life, activity, mass defect, Q-value, dose fall-off, shielding
numerical_stability 12 Stable numerics: log-sum-exp, softmax, Kahan summation, Welford mean and variance, softplus
numismatics 12 Coin collecting: melt value and premium, troy-ounce bullion, scarcity, survival, annual return
numpy_ops 10 Element-wise math: clip, stable log(1+x) and exp(x)-1, sign, Heaviside step, sinc, hypotenuse
nutrition 12 Nutrition: BMI, Mifflin-St Jeor BMR, TDEE, caloric deficit, macro split, ideal weight, VO2max
observability 10 Serving telemetry: p99 latency, throughput EMA, cache miss rate, drift alert, health score
ode 8 ODE solvers: Euler and RK4 integration, plus exact exponential decay and logistic growth
online_learning 10 Streaming updates: EMA, online SGD, perceptron, passive-aggressive, AdaGrad, FTRL, DDM drift
operations_research 13 Operations research: EOQ, newsvendor critical ratio, Little's law, M/M/1 queue length and wait
ophthalmology 10 Eye optics: Snellen acuity, lensmaker's equation, Goldmann pressure, Ferry-Porter flicker
optics 10 Optics: Snell's law, critical and Brewster angles, thin lens, Fresnel reflectance, Airy limit
optimization.assignment 7 Assignment problem: Hungarian shortest augmenting paths with dual proofs, forbidden pairs
optimization.explain 12 Linear program diagnostics: binding rows, shadow prices, infeasibility cores, cost breakdown
optimization.flow 10 Network flow: Dinic max flow with min cut, min-cost flow by successive shortest paths
optimization.integer 6 Mixed-integer linear programs: branch and bound on LP relaxations, 0/1 knapsack
optimization.linear 9 Linear programming: tableau simplex with Bland's rule, duals, reduced costs, RHS ranging
optimization.model 37 Optimization models: bounded continuous, integer and binary variables, expression trees
optimization.multiobjective 14 Multi-objective: nondominated sort, crowding, NSGA-II, Monte Carlo hypervolume, lexicographic
optimization.quadratic 8 Convex quadratic programming: active-set solve, KKT verification, convexity check, bounds
optimization.robust 9 Robust linear programs: scenario sampling, wait-and-see optima with CVaR, min-max, chance rates
optimization.routing 15 Vehicle routing: TSP 2-opt, Or-opt and iterated local search, capacity and time-window VRP
optimization.scheduling 10 Scheduling: job-shop tabu search, RCPSP serial schedule generation, critical-path bounds
optimization_meta 7 Simulated annealing, particle swarm, hill climbing and random search on built-in test functions
optimize 8 Scalar optimization: golden section, Brent, bisection, Newton, gradient descent, line fit
optmodel.formulation 5 LP and MILP formulations: dimension and bound checks, lowering to nonnegative variables, audits
optmodel.judge 3 Benchmark judging: solve a formulation and compare its objective to a known optimum
optmodel.solve 2 Formulation solving: simplex or branch and bound, optimality certificates, infeasibility cores
orthodontics 10 Orthodontics: tooth movement rate, wire beam forces, Bolton ratio, Pont's index, force decay
packaging 12 Packaging: box geometry, McKee compression, stacking load, cushion G, Arrhenius shelf life
paleontology 12 Paleontology: C-14, K-Ar and U-Pb dating, Margalef diversity, extinction rates, femur body mass
palynology 10 Palynology: exotic-spike pollen concentration, accumulation rate, tree pollen ratio, R-values
pandas_groupby 10 Group aggregation: Welford mean and variance updates, running min, max, sum, approximate median
paper_science 12 Paper and pulp: basis weight, bulk, tear, tensile and burst indices, kappa lignin, pulp yield
pattern 12 String utilities: glob matching, template substitution, split, join, trim, pad, replace, count
pde 10 Heat and wave equations in 1D by explicit finite differences, 2D Laplace by Jacobi, CFL limits
pedology 10 Soil formation indices: base saturation, clay illuviation, Munsell redness, profile development
pension 12 Retirement planning: replacement ratio, defined benefit, defined contribution, annuity factor
perfumery 12 Fragrance formulation: concentration, dilution, note durations, accord balance, cost per ml
persistence 11 In-memory key-value store, integer keys to numeric values: put, get, delete, snapshot, restore
pest_control 12 Integrated pest management: economic threshold, injury level, trap catch rate, residual decay
pharmacology 10 Pharmacokinetics and dose-response: Hill equation, therapeutic index, clearance, loading dose
photonics 12 Optics: Snell's law, critical and Brewster angles, Fresnel reflectance, Beer-Lambert, Rayleigh
photovoltaics 10 Solar PV: cell efficiency, fill factor, temperature correction, energy yield, performance ratio
physics 12 Classical mechanics: kinematics, energy, momentum, projectile motion, work, elastic collisions
phytochemistry 10 Plant assays: Folin-Ciocalteu phenolics, AlCl3 flavonoids, pH-differential anthocyanins, DPPH
pipeline 12 List processing primitives: map, filter, reduce, batch, sliding window, flatten, zip, unique
pipelines 5 Preprocessing chains: standardize, min-max, log1p, clip, median imputation, inverse transform
plasma_physics 10 Plasma physics: Debye length, plasma frequency, Larmor radius, Alfvén speed, Lawson criterion
pls 4 Partial least squares regression (PLS1) by NIPALS: fit, predict, R-squared
plumbing 12 Pipe hydraulics: Reynolds number, Darcy-Weisbach head loss, pump power, sizing, water hammer
pneumatics 12 Compressed air: Boyle's law, orifice flow, compressor power, cylinder force, receiver volume
polymer 12 Polymer science: molecular weight averages, PDI, Mark-Houwink, Fox equation, Flory-Huggins
polynomial 10 Polynomials: Horner evaluation, multiply, derivative, integral, composition, quadratic roots
population 10 Population dynamics: exponential, logistic, Lotka-Volterra predator-prey and competition models
positional_encoding 10 Transformer position encodings: sinusoidal, RoPE, ALiBi, T5 relative buckets, xPos scaling
power_systems 12 AC power: active, reactive and apparent power, power factor, transformer ratio, line loss
printing 12 Print production: DPI to LPI, pixel count, bleed area, spine width, ink coverage, CIE76 delta E
privacy 10 Differential privacy: Laplace and Gaussian noise, exponential mechanism, randomized response
procurement 12 Procurement: EOQ, reorder point, safety stock, inventory turnover, cost of ownership, scoring
progexec.contract 1 Operation codes, operand kinds and status names for the FinQA arithmetic program executor
progexec.exec 1 FinQA program execution: arithmetic, greater-than, table max/min/sum/average, step references
progexec.roundexact 1 Exact half-to-even decimal quantization at a power-of-ten scale, matching Python bit for bit
project_management 12 Earned value management (SV, CV, SPI, CPI, EAC, ETC, VAC, TCPI), PERT estimate, schedule float
proteomics 10 Protein mass spectrometry: molecular weight, pI, extinction, m/z, coverage, PAI, emPAI, FDR
protocol 10 Protocol Buffers wire format: base-128 varints, ZigZag integers, tagged fields, message codec
psychometrics 12 Test theory and IRT: item difficulty, KR-20, Cronbach's alpha, SEM, z, T and stanine, 1PL, 2PL
pulmonology 10 Lung function: minute and alveolar ventilation, FEV1/FVC, alveolar gas equation, compliance
quantum 11 Qubit state vectors: Hadamard, Pauli X and Z gates, measurement, Bloch sphere, Bell state
quantum_computing 12 Quantum computing estimates: gate error, surface-code qubits, quantum volume, Grover, Shor
queue_ds 12 Min-heap priority queue and fixed-capacity circular buffer with push, pop and peek
queueing 11 Queueing theory: M/M/1 and M/M/c metrics, Erlang B blocking, Erlang C waiting, Little's law
radar 12 Radar: range equation, Doppler shift, unambiguous range and velocity, resolution, gain, noise
radiometry 10 Radiometry: Planck spectral radiance, Stefan-Boltzmann, photon energy and flux, solid angle
random_utils 7 Random sampling: weighted choice, Fisher-Yates shuffle, permutation, bootstrap, stratified
real_estate 12 Real estate metrics: cap rate, GRM, cash-on-cash, DSCR, LTV, NOI, mortgage payment, break-even
recommender 9 Collaborative filtering: user cosine similarity, k-NN rating prediction, popularity, RMSE
refrigeration 12 Refrigeration cycles: COP and Carnot limits, superheat, subcooling, compressor work, EER, SEER
regex_engine 9 Regex matching with wildcards, quantifiers, anchors and character classes; search, find, split
reinforcement 8 Reinforcement learning: Q-learning, SARSA, value iteration, policy evaluation, epsilon-greedy
reliability 11 Reliability: exponential and Weibull survival, MTBF, availability, series, parallel, k-of-n
rerank_eval 9 Ranking metrics: precision, recall, hit rate, MRR, MAP and NDCG at k, pairwise margin accuracy
reservoir 7 Streaming samplers: Vitter's Algorithm R, Efraimidis-Spirakis weighted reservoir, bootstrap
rheology 10 Rheology: shear stress and rate, power-law and Bingham fluids, Maxwell relaxation, creep
risk 11 Portfolio risk: VaR, CVaR, drawdown, Sharpe, Sortino, Calmar, information ratio, beta, alpha

kernel.CONTRACT holds every signature, including the length rules for list arguments; help(kernel.model_interop) documents each function.

Requirements

  • Apple silicon: macOS 15 or later for the CPU build.
  • Linux arm64 and x86-64, glibc 2.35 or later.
  • kernels 0.17 or later and PyTorch 2.5 to 2.14. PyTorch has to be installed: the loader picks the build for your PyTorch version. The kernel itself never imports it.

Windows is not supported.

Notes

Calls into one kernel instance run one at a time; use processes for parallelism. Runtime state does not survive fork(); start worker processes with spawn.

License

Algenta Community License 1.1 (LICENSE). Free for personal, research and open-source use, and for internal use at organizations with fewer than 50 employees and under $5M in annual revenue. Beyond that, a commercial license is required: https://algenta.ai/pricing.

Enforced in the compiled library, not just in this text: one concurrent native worker per device (ABI §9). A second process, family or thread waits its turn rather than running in parallel. That is the Community licence's worker floor made real; parallel execution comes with a commercial license.

Support

Generally Available on the platforms listed under Requirements. Within v1, functions are only added; removals or signature changes ship as v2. Platforms, accelerators and PyTorch releases not listed are not supported. Documentation: https://docs.algenta.ai (the kernels guide: https://docs.algenta.ai/guides/kernels-on-hugging-face). Community: https://discord.gg/w8NDsph9an or this repository's Community tab. Commercial licences and support: https://algenta.ai/pricing.

Downloads last month
2
algenta
mojo
cpu
other
Torch
2.14
OS
macoslinux
Arch
x86_64aarch64