algenta-general-d

Domain kernels from rlhf dpo to wind energy. Compiled Mojo, loaded in-process.

100 modules · 1049 functions · CPU

Get started

pip install kernels torch
from kernels import get_kernel

kernel = get_kernel(
    "thyn-ai/algenta-general-d",
    version=1,
    backend="cpu",
    trust_remote_code=["thyn-ai/algenta-general-d"],
)
kernel.set_ops.jaccard_index([1, 2, 3, 4], [3, 4, 5, 6])  # -> 0.3333  Jaccard similarity

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("sheet.api", "sheet_eval_cell", [...])

What's inside

Module Functions What it does
rlhf_dpo 10 RLHF losses: DPO, IPO, ORPO, PPO clipping, Bradley-Terry reward, GAE and GRPO advantages
robotics 12 Two-link arm kinematics, one Jacobian entry, PID control, dead reckoning, odometry, diff drive
robustness 8 Sensitivity on built-in test functions: one-at-a-time, Morris, Sobol first-order, tornado data
root_finding 9 Scalar roots of built-in test functions: bisection, Newton, secant, regula falsi, bracketing
rubber 12 Elastomer tests: Shore A to modulus, tensile and compression set, rebound, crosslink density
scheduler_ops 10 Queue scheduling: fair priority, WFQ credit, token bucket, backpressure, backoff with jitter
scheduling_algo 9 CPU scheduling: FCFS, SJF, priority, time-quantum cycling, plus wait and throughput metrics
scipy_optimize_ops 10 Optimizer steps: BFGS update term, Fletcher-Reeves and Polak-Ribiere CG, Armijo and Wolfe tests
scoring 11 Credit scoring: logit, weight of evidence, information value, Gini from AUC, KS, score bands
security_governance 10 Governance heuristics: prompt and output safety, PII sensitivity, Gaussian DP noise scale, RBAC
sedimentology 10 Sediment transport: Stokes settling, Shields stress, Meyer-Peter Muller bedload, Rouse profile
seismology 12 Earthquakes: Richter and moment magnitude, energy, P and S travel times, PGA, Gutenberg-Richter
semiconductors 12 Device physics: carrier density, drift, resistivity, depletion width, diode and MOSFET currents
seq_nn 9 LSTM and GRU cells with exact forward and backward passes, parameter counts, seeded Xavier init
series 10 Forecasts: moving average, OLS trend, exponential smoothing, seasonal naive, drift, MAE, RMSE
set_ops 12 Sorted-integer sets: union, intersection, difference, subset tests, Jaccard index, membership
sheet.api 2 Recalculate an extracted Excel workbook and compare every formula cell against its cached value
sheet.engine 1 Demand-driven topological recalculation of spreadsheet formulas with named circular references
sheet.formula 3 Tokenizer and recursive-descent parser for Excel formula text with Excel operator precedence
sheet.grid 1 Loads extracted workbook text into sheets, defined names, constant cells and shared formulas
sheet.refs 7 A1 cell and range references: column letters, packed coordinates, absolute markers, parsing
sheet.values 19 Typed cell values: Excel errors, 15-digit number formatting, wildcard and case-insensitive text
silviculture 10 Forest stand metrics: basal area, site index, Scribner volume, Reineke SDI, increment, thinning
simulation 8 Discrete-event simulation: schedule, pop and cancel events, run to a deadline, M/M/1 queue
sketch 9 Probabilistic sketches: Count-Min Sketch frequency and HyperLogLog cardinality estimates
soil_mechanics 10 Geotechnics: Terzaghi bearing capacity, consolidation, Mohr-Coulomb shear, Rankine Ka, Hazen k
soil_science 12 Soil physics: porosity, water content, field capacity, wilting point, CEC, Horton infiltration
solar_energy 12 Solar PV: irradiance, panel output, NOCT cell temperature, sun position, capacity factor, LCOE
sorting 10 Sorting: quicksort, mergesort, heapsort, insertion, selection, bubble and counting sort
sparse 6 Sparse COO matrices: from dense, matrix-vector product, addition, transpose, density, trace
sparse_numerics.csr 34 CSR and CSC sparse layouts: build from triplets or dense, validate, merge duplicates, transpose
sparse_numerics.diagnostics 21 Sparse matrix health: density, duplicates, NaN/Inf entries, symmetry defect, condition estimate
sparse_numerics.factor 11 Direct sparse solves: pivoted LU, Cholesky for SPD systems, triangular solves, least squares
sparse_numerics.iterative 18 Krylov solvers on CSR: CG, Jacobi or Gauss-Seidel preconditioned CG, CGLS, restarted GMRES
sparse_numerics.spmv 16 CSR kernels: transpose and Kahan-compensated matvec, Gustavson SpGEMM, add, Frobenius norm
sparse_vector 10 Sparse vectors as index/value lists: dot product, merge-add, scale, L2 norm, cosine similarity
special_functions 12 Gamma, beta, digamma, incomplete gamma, erf, erfc, Bessel J0, factorials, binomial coefficients
speculative_decoding 10 Speculative decoding: acceptance, expected tokens, speedup, Medusa, grammar mask, watermarking
speleology 10 Cave science: calcite saturation, stalactite growth, karst spring discharge, U-Th age, radon
sports_analytics 12 Sports stats: OBP, SLG, OPS, ERA, WHIP, NFL passer rating, Pythagorean wins, Elo, TS%, PER
stochastic 10 Simulated paths: random walks, Brownian motion, GBM, Poisson, Ornstein-Uhlenbeck, birth-death
strategy.contract 42 Strategy comparison vocabulary: status names, tolerances, shape and budget checks, RNG streams
strategy.crn 17 Common random numbers: shared scenario tapes, paired policy evaluation, pairing audits
strategy.equilibrium 22 Normal-form games: pure and 2x2 mixed Nash, regret matching, fictitious play, exploitability
strategy.policy 8 Policies: constant, threshold, tabular, mixed and linear rules, greedy from Q, MDP evaluation
strategy.tournament 8 Strategy ranking: paired t-tests, percentile bootstrap, Bonferroni, Holm or BH corrections
streaming.contract 21 Sketch building blocks: keyed Philox hashing, HyperLogLog, Count-Min and KLL error bounds
streaming.distinct 11 HyperLogLog distinct counting: ingest, estimate, register-wise merge, flat snapshot and restore
streaming.drift 8 Stream change detection: resumable two-sided Page-Hinkley and Drift Detection Method (DDM)
streaming.frequency 16 Count-Min sketch: weighted ingest, count queries with bounds, heavy hitters, merge, snapshot
streaming.quantiles 15 Streaming quantiles with a KLL sketch: add, merge, rank, quantile lookup, snapshots, min/max
streaming.windows 10 Rolling windows: mean, standard deviation, min, max, range, EWMA, EW variance, window summary
structs.containers 2 Histogram bin counts over a value range and sorted unique values
structural 12 Structural analysis: bending, shear, axial stress, beam deflection, Euler buckling, von Mises
structured_output 10 Structured output scoring: JSON token validity, SQL clause order, XML depth, field recall
supply_chain 12 Supply chain: bullwhip ratio, MAE, MAPE, bias, tracking signal, EPQ, fill rate, moving average
survival 8 Survival analysis: Kaplan-Meier, Nelson-Aalen, log-rank test, smoothed hazard, RMST, life table
survival_analysis.base 9 Right-censored survival data: validation, time ordering, risk tables, Greenwood terms, z values
survival_analysis.competing 3 Competing risks: Aalen-Johansen cumulative incidence per cause, with step-function lookup
survival_analysis.cox 3 Cox proportional hazards: Newton-Raphson fit with Efron ties, relative risk, Breslow baseline
survival_analysis.hazard 2 Nelson-Aalen cumulative hazard with Aalen variance, log-scale band and Epanechnikov smoothing
survival_analysis.km 3 Kaplan-Meier with Greenwood standard errors, log-log confidence band, median, RMST, step lookup
survival_analysis.parametric 2 Weibull and lognormal maximum likelihood under right censoring: profile likelihood, EM
sustainability 12 ESG metrics: transport carbon, GHG scopes 1 to 3, energy and water intensity, waste diversion
svm_kernel 7 SVM kernels: linear, RBF, polynomial, sigmoid, Gram matrix, centering, alignment, PSD heuristic
svm_solver 5 Support vector machine training by simplified SMO (Platt), linear and RBF kernels, prediction
taphonomy 10 Fossil preservation: soft-tissue decay, bone density loss, completeness, hydraulic sorting, C:N
telecommunications 12 Telecom links: Shannon capacity, Erlang-B blocking, BPSK bit error rate, noise, link margin
thermodynamics 11 Thermodynamics: ideal gas law, Carnot efficiency, entropy, adiabatic and isothermal processes
timber 12 Wood science: board feet, moisture content, allowable stress, moment capacity, fire charring
toxicology 12 Toxicology risk: LD50 dosing, therapeutic index, hazard quotient, cancer risk, Hill response
transform 12 Feature transforms: log, Box-Cox, z-score, min-max, robust and quantile scaling, rank, clamp
transportation 12 Traffic analysis: density, capacity, Webster signal delay, stopping distance, headway, crashes
tribochemistry 10 Sliding contacts: Archard wear, Hertz contact, flash temperature, EHD film, lambda ratio
tribology 12 Friction and wear: Coulomb friction, Hertz pressure, Archard wear, Sommerfeld number, Stribeck
ultrasonics 10 Ultrasound physics: impedance, reflection, attenuation, Doppler shift, PRF, resolution, TI
units 8 Unit conversion for length, mass, temperature, time, area, volume, speed and data sizes
urban_planning 12 Urban planning ratios: density, floor area ratio, lot coverage, walk decay, V/C, affordability
vector_search 10 Approximate nearest-neighbour math: HNSW levels, IVF and PQ distances, LSH buckets, recall@k
vector_similarity 10 Distance and similarity from precomputed sums: cosine, Euclidean, Minkowski, Hamming, Jaccard
veterinary 12 Veterinary dosing and fluids: mg/kg dose, fluid deficit and rate, RER calories, MAC, gestation
video_accessibility 9 WCAG AA text checks for video frames and subtitle bands: worst-case contrast, colour, backplate
video_color 9 Clip colour features: frame and clip mean RGB, dominant colour, saturation, warm ratio, drift
video_features 5 Scene-change scores from frame differences, cut count and rate, peak-motion frame, keyframes
video_gate 6 Routing for video requests: cache reuse, quality and flicker checks, static test, keyframes
video_ops 8 Frame-buffer basics: frame count, mean intensity, frame differences, static ratio, sampling
video_quality 6 Clip usability score from sampled per-frame quality and brightness flicker, plus stability
video_regions 7 Motion regions between frames: difference masks, connected-component boxes, peak and union
video_similarity 7 Clip-to-clip duplicate detection: aligned frame scores, dHash Hamming distance, temporal match
video_storyboard 6 Scene spans from cut detection: start, end and length per scene, midpoint frames, storyboard
virology 10 Virology: R0 and herd immunity threshold, doubling time, PFU titre, burst size, NT50, IC50
viticulture 12 Grape growing and winemaking: Brix to alcohol, chaptalization, GDD, Ravaz index, molecular SO2
volcanology 12 Volcanology: VEI energy, lava and lahar speed, eruption column height, tephra, viscosity
voting 11 Voting methods: plurality, Borda, Condorcet pairwise, approval, Droop and Hare quotas, Banzhaf
wastewater 12 Wastewater treatment: BOD removal, HRT and SRT, F/M ratio, SVI, oxygen demand, CT disinfection
watchmaking 12 Mechanical watch maths: gear ratios, beats per hour, balance period, mainspring torque, reserve
water_chemistry 10 Water quality: pH and hydrogen ion, hardness and alkalinity as CaCO3, Langelier index, TDS
weight_loader 10 Checkpoint maths: file offsets, safetensors header size, GGUF block bytes, LoRA merge, hash
welding 12 Welding: heat input, IIW carbon equivalent, cooling rate, dilution, fillet throat, crack risk
wind_energy 12 Wind energy: available power, Betz limit, Cp, tip-speed ratio, capacity factor, Jensen wake

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

Not included

  • svm_kernel.is_positive_semidefinite — reads its matrix argument as square; a non-square nested list is not expressible as a length rule.
  • svm_kernel.kernel_center — reads its matrix argument as square; a non-square nested list is not expressible as a length rule.

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