A JavaScript library for Lie-theoretic computations on partial flag varieties and homogeneous vector bundles. Translated from the Julia packages Lie.jl and PartialFlagVarieties.jl.
- Dynkin diagrams: all simple types A–G, product types, parsing
- Cartan matrices: matrix, symmetriser, inverse, bilinear forms
- Root systems: positive roots / coroots, Coxeter & dual Coxeter numbers
- Weyl groups: dimension formula, group order, Borel–Weil–Bott, longest element
- Characters: Freudenthal recursion, Brauer–Klimyk tensor products, Adams operators, symmetric/exterior powers
- Partial flag varieties: dimension, Euler characteristic, Betti numbers, Fano index, Hilbert series
- Homogeneous bundles: completely reducible bundles, standard bundles (tangent, cotangent, canonical, …)
- Sheaf cohomology: BWB-based cohomology dimensions and Euler characteristic
npm installRequires Node.js ≥ 18 (ESM + BigInt support).
import { Gr, dimension, eulerCharacteristic, bettiNumbers, fanoIndex } from './src/index.js';
const X = Gr(2, 5); // Grassmannian Gr(2, 5)
console.log(dimension(X)); // 6
console.log(eulerCharacteristic(X)); // 10n
console.log(bettiNumbers(X)); // [1, 1, 2, 2, 2, 1, 1]
console.log(fanoIndex(X)); // 5import { projectiveSpace, tangentBundle, cohomologyDimensions } from './src/index.js';
const X = projectiveSpace(3); // ℙ³
const T = tangentBundle(X);
console.log(cohomologyDimensions(T)); // [15n, 0n, 0n, 0n]import { SimpleDynkinType, ProductDynkinType, parseDynkinType } from './src/index.js';
const dt = new SimpleDynkinType('A', 3); // A₃
const dt2 = parseDynkinType('A3'); // same
const prod = new ProductDynkinType([dt, new SimpleDynkinType('B', 2)]);import { cartanMatrix, cartanMatrixInverse, cartanDeterminant } from './src/index.js';
const C = cartanMatrix(dt); // Int32Array (n×n row-major)
const Cinv = cartanMatrixInverse(dt); // Rational[][] (exact)import { rootSystem, coxeterCoefficients, degreesFundamentalInvariants } from './src/index.js';
const rs = rootSystem(dt);
console.log(rs.rank, rs.nPositiveRoots);
const coxeterNumber = coxeterCoefficients(dt).reduce((a,b)=>a+b) + 1;import {
fundamentalWeight, weylVector, isDominant,
conjugateDominantWeight, weightAdd, weightSub,
} from './src/index.js';Weights are Int32Array in the ω-basis (fundamental weight basis).
import { weylDimension, weylOrder, borelWeylBott, dominantWeights } from './src/index.js';
const dim = weylDimension(dt, Int32Array.from([1, 0, 0])); // BigInt
const order = weylOrder(dt); // BigInt
const bwb = borelWeylBott(dt, Int32Array.from([-1, 2, 0])); // {index, weight} or nullimport {
dominantCharacter, tensorProduct, dualWeight, dualChar,
symmetricPower, exteriorPower, charDimension,
} from './src/index.js';
const ch = dominantCharacter(dt, Int32Array.from([1, 1, 0])); // Map<string, number>
const tp = tensorProduct(dt, hw1, hw2); // Map
const dim = charDimension(dt, ch); // BigIntimport {
MarkedDynkinType, leviType, anticanonicalDegrees,
isCominuscule, isMinuscule, tangentWeights,
} from './src/index.js';
import {
Gr, projectiveSpace, quadric, OGr, SGr, LGr,
cayleyPlane, freudenthalVariety,
} from './src/index.js';
import {
partialFlagVariety, dimension, eulerCharacteristic,
bettiNumbers, fanoIndex, hilbertSeries,
} from './src/index.js';import {
tangentBundle, cotangentBundle, canonicalBundle,
lineBundle, structureSheaf, dualBundle,
tensorProductBundle, exteriorPowerBundle, symmetricPowerBundle,
detBundle, directSum, twist, rankBundle,
} from './src/index.js';import { cohomology, cohomologyDimensions, eulerCharacteristicBundle } from './src/index.js';
const dims = cohomologyDimensions(tangentBundle(X)); // BigInt[]
const chi = eulerCharacteristicBundle(E); // BigInt| Item | Convention |
|---|---|
| Node numbering | 1-based (Bourbaki) in MarkedDynkinType |
| Weights | Int32Array, ω-basis |
| Characters | Map<string, number> (weight key → multiplicity) |
| Dimensions | BigInt for weylDimension, weylOrder, cohomology, Euler characteristic |
| Matrices | Flat row-major Int32Array (access: C[i * n + j]) |
| Exact arithmetic | Rational class for Cartan inverse, decomposition matrices |
Execution of the full Jest suite is automated via GitHub Actions; see the badge above.
npm testUses Jest 29 with ESM support (--experimental-vm-modules).
Run the full benchmark suite:
node benchmark/bench.js
# or
npm run benchEach benchmark runs with warmup iterations followed by timed samples, reporting minimum and median times in milliseconds.
# JSON output (for automated regression tracking)
node benchmark/bench.js --json
# Run only benchmarks matching a keyword
node benchmark/bench.js --filter=dim # dimension-related
node benchmark/bench.js --filter=tensor # tensor product benchmarks
node benchmark/bench.js --filter=bwb # Borel–Weil–Bott
node benchmark/bench.js --filter=cohomology # cohomology benchmarks| # | Section | Description |
|---|---|---|
| 1 | Weyl dimension formula | Fundamental + high-weight representations across all types |
| 2 | Freudenthal formula | dominantCharacter for A–G₂, including E₇, E₈ |
| 3 | Tensor products | Brauer–Klimyk decomposition across all types |
| 4 | Exterior / symmetric powers | ∧ᵏ and Symᵏ for various representations |
| 5 | Borel–Weil–Bott | Box sweeps + deep non-dominant weights |
| 6 | PFV invariants | dimension, eulerCharacteristic, bettiNumbers |
| 7 | IrrepLevi | Construction, dual, fiber dimension |
| 8 | Bundle operations | Tangent/cotangent, exterior/symmetric powers, determinant |
| 9 | Cohomology | cohomology and cohomologyDimensions on ℙⁿ, Gr |
The JSON output includes a timestamp and Node.js version, suitable for storing as a baseline and comparing across runs or machines.
| Module | Description |
|---|---|
Rational.js |
Exact rational arithmetic (gcd, lcm, Rational class) |
DynkinType.js |
Dynkin type construction and parsing |
CartanMatrix.js |
Cartan matrix, symmetriser, inverse, bilinear forms |
RootSystem.js |
Positive roots/coroots, Coxeter numbers, degrees |
WeightLattice.js |
Weight operations (add, sub, reflect, conjugate) |
WeylGroup.js |
Dimension formula, BWB, group order, dominant weights |
Weylloop.js |
Hash-free Weyl orbit traversal |
Characters.js |
Freudenthal, Brauer–Klimyk, sym/ext powers |
MarkedDynkinType.js |
Levi subgroup type, anticanonical, classification |
PartialFlagVariety.js |
Dimension, Betti numbers, Fano index, Hilbert series |
IrrepLevi.js |
Irreducible Levi representations |
CompletelyReducibleBundle.js |
Completely reducible homogeneous bundles |
Cohomology.js |
Sheaf cohomology via BWB |
Constructions.js |
Named varieties (Gr, OGr, SGr, LGr, Q, …) |
index.js |
Re-exports all public APIs |
MIT