Skip to content

HomogeneousTools/Lie.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lie.js

CI

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.

Features

  • 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

Installation

npm install

Requires Node.js ≥ 18 (ESM + BigInt support).

Quick start

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));                 // 5
import { projectiveSpace, tangentBundle, cohomologyDimensions } from './src/index.js';

const X = projectiveSpace(3);              // ℙ³
const T = tangentBundle(X);
console.log(cohomologyDimensions(T));      // [15n, 0n, 0n, 0n]

API Overview

Dynkin types

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)]);

Cartan matrix

import { cartanMatrix, cartanMatrixInverse, cartanDeterminant } from './src/index.js';

const C = cartanMatrix(dt);                // Int32Array (n×n row-major)
const Cinv = cartanMatrixInverse(dt);      // Rational[][] (exact)

Root system

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;

Weight lattice

import {
  fundamentalWeight, weylVector, isDominant,
  conjugateDominantWeight, weightAdd, weightSub,
} from './src/index.js';

Weights are Int32Array in the ω-basis (fundamental weight basis).

Weyl group

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 null

Characters

import {
  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);                              // BigInt

Marked Dynkin types & partial flag varieties

import {
  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';

Bundles

import {
  tangentBundle, cotangentBundle, canonicalBundle,
  lineBundle, structureSheaf, dualBundle,
  tensorProductBundle, exteriorPowerBundle, symmetricPowerBundle,
  detBundle, directSum, twist, rankBundle,
} from './src/index.js';

Cohomology

import { cohomology, cohomologyDimensions, eulerCharacteristicBundle } from './src/index.js';

const dims = cohomologyDimensions(tangentBundle(X));  // BigInt[]
const chi = eulerCharacteristicBundle(E);             // BigInt

Conventions

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

Testing

Execution of the full Jest suite is automated via GitHub Actions; see the badge above.

npm test

Uses Jest 29 with ESM support (--experimental-vm-modules).

Benchmarks

Run the full benchmark suite:

node benchmark/bench.js
# or
npm run bench

Each benchmark runs with warmup iterations followed by timed samples, reporting minimum and median times in milliseconds.

Options

# 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

Benchmark sections

# 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.

Modules

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

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors