Copy disabled (too large)
Download .txt
Showing preview only (13,063K chars total). Download the full file to get everything.
Repository: raven-ml/raven
Branch: main
Commit: d0c4657ebb99
Files: 1398
Total size: 12.2 MB
Directory structure:
gitextract__969s3jl/
├── .github/
│ └── workflows/
│ ├── changelog.yml
│ └── ci.yml
├── .gitignore
├── .ocamlformat
├── AGENTS.md
├── CHANGES.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── TODO.md
├── dev/
│ ├── README.md
│ ├── mimir/
│ │ ├── README.md
│ │ ├── dune-project
│ │ └── lib/
│ │ ├── dune
│ │ ├── mimir.ml
│ │ ├── mimir.mli
│ │ ├── sampler.ml
│ │ ├── sampler.mli
│ │ └── string_util.ml
│ └── umbra/
│ ├── README.md
│ ├── dune-project
│ ├── examples/
│ │ ├── 01-constants-and-units/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 02-cosmological-distances/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 03-blackbody-fitting/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 04-extinction-and-magnitudes/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 05-sed-fitting/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 06-coordinates-and-time/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 07-batch-photometry/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 08-photometric-redshifts/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 09-gravitational-lensing/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 10-uncertainty-propagation/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 11-bayesian-sed/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 12-survey-optimization/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ └── README.md
│ ├── lib/
│ │ ├── altaz.ml
│ │ ├── altaz.mli
│ │ ├── const.ml
│ │ ├── const.mli
│ │ ├── coord.ml
│ │ ├── coord.mli
│ │ ├── cosmo.ml
│ │ ├── cosmo.mli
│ │ ├── dune
│ │ ├── extinction.ml
│ │ ├── extinction.mli
│ │ ├── filter_data.ml
│ │ ├── filters.ml
│ │ ├── filters.mli
│ │ ├── fits/
│ │ │ ├── dune
│ │ │ ├── fits_parser.ml
│ │ │ ├── fits_parser.mli
│ │ │ ├── umbra_fits.ml
│ │ │ └── umbra_fits.mli
│ │ ├── galactocentric.ml
│ │ ├── galactocentric.mli
│ │ ├── kdtree.ml
│ │ ├── kdtree.mli
│ │ ├── photometry.ml
│ │ ├── photometry.mli
│ │ ├── spectrum.ml
│ │ ├── spectrum.mli
│ │ ├── survey.ml
│ │ ├── survey.mli
│ │ ├── time.ml
│ │ ├── time.mli
│ │ ├── umbra.ml
│ │ ├── umbra.mli
│ │ ├── unit.ml
│ │ ├── unit.mli
│ │ └── vega_data.ml
│ ├── papers/
│ │ └── perlmutter1999/
│ │ ├── .gitignore
│ │ ├── download_data.sh
│ │ └── perlmutter1999.md
│ └── test/
│ ├── dune
│ └── test_umbra.ml
├── doc/
│ ├── coming-from-python.md
│ ├── ecosystem-overview.md
│ ├── index.md
│ ├── installation.md
│ ├── introduction.md
│ ├── quickstart.md
│ ├── roadmap.md
│ └── support-raven.md
├── dune-project
├── dune-workspace.tsan
├── opam/
│ ├── brot.opam
│ ├── fehu.opam
│ ├── hugin.opam
│ ├── kaun-board.opam
│ ├── kaun.opam
│ ├── munin.opam
│ ├── norn.opam
│ ├── nx.opam
│ ├── nx.opam.template
│ ├── quill.opam
│ ├── raven.opam
│ ├── rune.opam
│ ├── sowilo.opam
│ ├── talon.opam
│ ├── tolk.opam
│ └── vega.opam
├── packages/
│ ├── brot/
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── README.md
│ │ │ ├── bench_brot.ml
│ │ │ ├── bench_rust/
│ │ │ │ ├── .gitignore
│ │ │ │ ├── Cargo.toml
│ │ │ │ └── main.rs
│ │ │ ├── bench_tokenizers.py
│ │ │ ├── brot.thumper
│ │ │ ├── data/
│ │ │ │ ├── .gitignore
│ │ │ │ ├── news_1k.txt
│ │ │ │ └── wiki_64k.txt
│ │ │ ├── download_data.sh
│ │ │ └── dune
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-pipeline.md
│ │ │ ├── 03-pretrained.md
│ │ │ ├── 04-batch-processing.md
│ │ │ ├── 05-algorithms.md
│ │ │ ├── 06-hf-tokenizers-comparison.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-encode-decode/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-encoding-fields/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-normalizers/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 04-pre-tokenizers/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 05-algorithms/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 06-special-tokens/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 07-padding-truncation/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 08-decoders/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 09-training/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 10-bert-pipeline/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── README.md
│ │ │ └── x-gpt2-tokenizer/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── lib/
│ │ │ ├── bpe.ml
│ │ │ ├── bpe.mli
│ │ │ ├── brot.ml
│ │ │ ├── brot.mli
│ │ │ ├── chars.ml
│ │ │ ├── chars.mli
│ │ │ ├── decoder.ml
│ │ │ ├── decoder.mli
│ │ │ ├── dune
│ │ │ ├── encoding.ml
│ │ │ ├── encoding.mli
│ │ │ ├── normalizer.ml
│ │ │ ├── normalizer.mli
│ │ │ ├── post_processor.ml
│ │ │ ├── post_processor.mli
│ │ │ ├── pre_tokenizer.ml
│ │ │ ├── pre_tokenizer.mli
│ │ │ ├── unigram.ml
│ │ │ ├── unigram.mli
│ │ │ ├── word_level.ml
│ │ │ ├── word_level.mli
│ │ │ ├── wordpiece.ml
│ │ │ └── wordpiece.mli
│ │ └── test/
│ │ ├── dune
│ │ ├── fixtures/
│ │ │ └── .gitignore
│ │ ├── scripts/
│ │ │ └── download_hf_tokenizers.py
│ │ ├── test_bpe.ml
│ │ ├── test_encoding.ml
│ │ ├── test_hf_tokenizers.ml
│ │ ├── test_pretokenizers.ml
│ │ ├── test_processors.ml
│ │ ├── test_tokenization.ml
│ │ ├── test_unicode.ml
│ │ ├── test_vocab.ml
│ │ └── test_wordpiece.ml
│ ├── dune
│ ├── fehu/
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── bench_fehu.ml
│ │ │ ├── dune
│ │ │ └── fehu.thumper
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-environments.md
│ │ │ ├── 03-collection-and-evaluation.md
│ │ │ ├── 04-gymnasium-comparison.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-random-agent/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-q-learning/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-reinforce/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ └── 04-dqn/
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── lib/
│ │ │ ├── buffer.ml
│ │ │ ├── buffer.mli
│ │ │ ├── collect.ml
│ │ │ ├── collect.mli
│ │ │ ├── dune
│ │ │ ├── env.ml
│ │ │ ├── env.mli
│ │ │ ├── envs/
│ │ │ │ ├── cartpole.ml
│ │ │ │ ├── dune
│ │ │ │ ├── fehu_envs.ml
│ │ │ │ ├── fehu_envs.mli
│ │ │ │ ├── grid_world.ml
│ │ │ │ ├── mountain_car.ml
│ │ │ │ └── random_walk.ml
│ │ │ ├── eval.ml
│ │ │ ├── eval.mli
│ │ │ ├── fehu.ml
│ │ │ ├── fehu.mli
│ │ │ ├── gae.ml
│ │ │ ├── gae.mli
│ │ │ ├── info.ml
│ │ │ ├── info.mli
│ │ │ ├── render.ml
│ │ │ ├── render.mli
│ │ │ ├── space.ml
│ │ │ ├── space.mli
│ │ │ ├── value.ml
│ │ │ ├── value.mli
│ │ │ ├── vec_env.ml
│ │ │ └── vec_env.mli
│ │ └── test/
│ │ ├── dune
│ │ ├── test_buffer.ml
│ │ ├── test_collect.ml
│ │ ├── test_env.ml
│ │ ├── test_env_wrappers.ml
│ │ ├── test_envs.ml
│ │ ├── test_eval.ml
│ │ ├── test_gae.ml
│ │ ├── test_info.ml
│ │ ├── test_render.ml
│ │ ├── test_space.ml
│ │ ├── test_value.ml
│ │ └── test_vec_env.ml
│ ├── hugin/
│ │ ├── README.md
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-marks-and-styling.md
│ │ │ ├── 03-layout-and-decorations.md
│ │ │ ├── 04-colors-and-colormaps.md
│ │ │ ├── 05-matplotlib-comparison.md
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-line-plot/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-styling/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-scatter/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 04-bar-chart/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 05-histogram/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 06-layers/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 07-decorations/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 08-grid-layout/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 09-themes/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 10-showcase/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 11-errorbar/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ └── README.md
│ │ ├── lib/
│ │ │ ├── axis.ml
│ │ │ ├── axis.mli
│ │ │ ├── cairo_backend.ml
│ │ │ ├── cairo_backend.mli
│ │ │ ├── cairo_sdl.ml
│ │ │ ├── cairo_sdl.mli
│ │ │ ├── cmap.ml
│ │ │ ├── cmap.mli
│ │ │ ├── cmap_data.ml
│ │ │ ├── color.ml
│ │ │ ├── color.mli
│ │ │ ├── dune
│ │ │ ├── hugin.ml
│ │ │ ├── hugin.mli
│ │ │ ├── image_util.ml
│ │ │ ├── image_util.mli
│ │ │ ├── prepared.ml
│ │ │ ├── prepared.mli
│ │ │ ├── resolve.ml
│ │ │ ├── resolve.mli
│ │ │ ├── scale.ml
│ │ │ ├── scale.mli
│ │ │ ├── scene.ml
│ │ │ ├── scene.mli
│ │ │ ├── spec.ml
│ │ │ ├── spec.mli
│ │ │ ├── svg_backend.ml
│ │ │ ├── svg_backend.mli
│ │ │ ├── theme.ml
│ │ │ ├── theme.mli
│ │ │ ├── ticks.ml
│ │ │ └── ticks.mli
│ │ ├── test/
│ │ │ ├── dune
│ │ │ ├── test_cmap.ml
│ │ │ ├── test_color.ml
│ │ │ ├── test_image_util.ml
│ │ │ ├── test_resolve.ml
│ │ │ ├── test_scale.ml
│ │ │ ├── test_svg_backend.ml
│ │ │ └── test_ticks.ml
│ │ ├── top/
│ │ │ ├── dune
│ │ │ └── hugin_top.ml
│ │ ├── ucairo/
│ │ │ ├── discover/
│ │ │ │ ├── discover.ml
│ │ │ │ └── dune
│ │ │ ├── dune
│ │ │ ├── ucairo.ml
│ │ │ ├── ucairo.mli
│ │ │ └── ucairo_stubs.c
│ │ └── usdl/
│ │ ├── discover/
│ │ │ ├── discover.ml
│ │ │ └── dune
│ │ ├── dune
│ │ ├── usdl.ml
│ │ ├── usdl.mli
│ │ └── usdl_stubs.c
│ ├── kaun/
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── bench_kaun.ml
│ │ │ ├── dune
│ │ │ └── kaun.thumper
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-layers-and-models.md
│ │ │ ├── 03-training.md
│ │ │ ├── 04-checkpoints-and-pretrained.md
│ │ │ ├── 06-pytorch-comparison.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-xor/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-mnist/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-bert/
│ │ │ │ ├── bert.ml
│ │ │ │ ├── bert.mli
│ │ │ │ ├── dune
│ │ │ │ ├── main.ml
│ │ │ │ └── reference_hf_output.py
│ │ │ └── 04-gpt2/
│ │ │ ├── dune
│ │ │ ├── gpt2.ml
│ │ │ ├── gpt2.mli
│ │ │ ├── main.ml
│ │ │ └── reference_hf_output.py
│ │ ├── lib/
│ │ │ ├── activation.ml
│ │ │ ├── activation.mli
│ │ │ ├── attention.ml
│ │ │ ├── attention.mli
│ │ │ ├── checkpoint.ml
│ │ │ ├── checkpoint.mli
│ │ │ ├── context.ml
│ │ │ ├── context.mli
│ │ │ ├── data.ml
│ │ │ ├── data.mli
│ │ │ ├── datasets/
│ │ │ │ ├── cifar10.ml
│ │ │ │ ├── dataset_utils.ml
│ │ │ │ ├── dune
│ │ │ │ ├── kaun_datasets.ml
│ │ │ │ ├── kaun_datasets.mli
│ │ │ │ └── mnist.ml
│ │ │ ├── dune
│ │ │ ├── fn.ml
│ │ │ ├── fn.mli
│ │ │ ├── grad.ml
│ │ │ ├── grad.mli
│ │ │ ├── hf/
│ │ │ │ ├── dune
│ │ │ │ ├── kaun_hf.ml
│ │ │ │ └── kaun_hf.mli
│ │ │ ├── init.ml
│ │ │ ├── init.mli
│ │ │ ├── layer.ml
│ │ │ ├── layer.mli
│ │ │ ├── loss.ml
│ │ │ ├── loss.mli
│ │ │ ├── metric.ml
│ │ │ ├── metric.mli
│ │ │ ├── optim.ml
│ │ │ ├── optim.mli
│ │ │ ├── ptree.ml
│ │ │ ├── ptree.mli
│ │ │ ├── train.ml
│ │ │ └── train.mli
│ │ └── test/
│ │ ├── dune
│ │ ├── test_attention.ml
│ │ ├── test_checkpoint.ml
│ │ ├── test_data.ml
│ │ ├── test_fn.ml
│ │ ├── test_grad.ml
│ │ ├── test_init.ml
│ │ ├── test_layer.ml
│ │ ├── test_loss.ml
│ │ ├── test_metric.ml
│ │ ├── test_optim.ml
│ │ ├── test_ptree.ml
│ │ └── test_train.ml
│ ├── munin/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-tracking.md
│ │ │ ├── 03-artifacts.md
│ │ │ ├── 04-cli.md
│ │ │ ├── 05-dashboard.md
│ │ │ ├── 06-system-monitoring.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-basic/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-metrics/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-artifacts/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 04-media/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 05-parameter-sweep/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 06-inspect/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 07-system-monitor/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── README.md
│ │ │ └── x-kaun-mnist/
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── lib/
│ │ │ ├── artifact.ml
│ │ │ ├── artifact.mli
│ │ │ ├── dune
│ │ │ ├── env.ml
│ │ │ ├── event_log.ml
│ │ │ ├── fs.ml
│ │ │ ├── index.ml
│ │ │ ├── json_utils.ml
│ │ │ ├── munin.ml
│ │ │ ├── munin.mli
│ │ │ ├── run.ml
│ │ │ ├── run.mli
│ │ │ ├── run_monitor.ml
│ │ │ ├── run_monitor.mli
│ │ │ ├── session.ml
│ │ │ ├── session.mli
│ │ │ ├── store.ml
│ │ │ ├── store.mli
│ │ │ ├── sys/
│ │ │ │ ├── config/
│ │ │ │ │ ├── discover.ml
│ │ │ │ │ └── dune
│ │ │ │ ├── dune
│ │ │ │ ├── munin_sys.ml
│ │ │ │ ├── munin_sys.mli
│ │ │ │ ├── sysstat.ml
│ │ │ │ ├── sysstat.mli
│ │ │ │ └── sysstat_stubs.c
│ │ │ ├── tui/
│ │ │ │ ├── detail.ml
│ │ │ │ ├── dune
│ │ │ │ ├── footer.ml
│ │ │ │ ├── header.ml
│ │ │ │ ├── info.ml
│ │ │ │ ├── metrics.ml
│ │ │ │ ├── munin_tui.ml
│ │ │ │ ├── munin_tui.mli
│ │ │ │ ├── overview.ml
│ │ │ │ ├── system.ml
│ │ │ │ └── theme.ml
│ │ │ ├── value.ml
│ │ │ └── value.mli
│ │ └── test/
│ │ ├── dune
│ │ └── test_munin.ml
│ ├── norn/
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── bench_norn.ml
│ │ │ ├── dune
│ │ │ └── norn.thumper
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-adaptation-and-diagnostics.md
│ │ │ ├── 03-advanced-usage.md
│ │ │ ├── 04-pymc-comparison.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-sampling-basics/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-bayesian-regression/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-diagnostics/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ └── README.md
│ │ ├── lib/
│ │ │ ├── adapt.ml
│ │ │ ├── dune
│ │ │ ├── internal.ml
│ │ │ ├── norn.ml
│ │ │ ├── norn.mli
│ │ │ └── nuts.ml
│ │ └── test/
│ │ ├── debug_nuts.ml
│ │ ├── dune
│ │ ├── test_blackjax_ref.py
│ │ └── test_norn.ml
│ ├── nx/
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── README.md
│ │ │ ├── bench_numpy.py
│ │ │ ├── bench_nx.ml
│ │ │ ├── conv2d/
│ │ │ │ ├── README.md
│ │ │ │ ├── bench_conv2d_nx.ml
│ │ │ │ ├── bench_conv2d_pytorch.py
│ │ │ │ ├── dune
│ │ │ │ └── nx_conv2d.thumper
│ │ │ ├── dune
│ │ │ ├── einsum/
│ │ │ │ ├── README.md
│ │ │ │ ├── bench_einsum_numpy.py
│ │ │ │ ├── bench_einsum_nx.ml
│ │ │ │ ├── dune
│ │ │ │ └── nx_einsum.thumper
│ │ │ ├── matmul/
│ │ │ │ ├── README.md
│ │ │ │ ├── bench_matmul_numpy.py
│ │ │ │ ├── bench_matmul_nx.ml
│ │ │ │ ├── dune
│ │ │ │ └── nx_matmul.thumper
│ │ │ └── nx.thumper
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-array-operations.md
│ │ │ ├── 03-linear-algebra.md
│ │ │ ├── 04-io.md
│ │ │ ├── 05-numpy-comparison.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-creating-arrays/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-infix-and-arithmetic/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-indexing-and-slicing/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 04-reshaping-and-broadcasting/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 05-reductions-and-statistics/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 06-random-numbers/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 07-linear-algebra/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 08-signal-processing/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 09-image-processing/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 10-machine-learning/
│ │ │ │ ├── README.md
│ │ │ │ ├── dbscan.ml
│ │ │ │ ├── dune
│ │ │ │ ├── kmeans.ml
│ │ │ │ ├── pca.ml
│ │ │ │ └── tsne.ml
│ │ │ └── README.md
│ │ ├── lib/
│ │ │ ├── .ocamlformat-ignore
│ │ │ ├── backend/
│ │ │ │ ├── dune
│ │ │ │ └── nx_backend.mli
│ │ │ ├── backend_c/
│ │ │ │ ├── config/
│ │ │ │ │ ├── discover.ml
│ │ │ │ │ └── dune
│ │ │ │ ├── dune
│ │ │ │ ├── nx_backend.ml
│ │ │ │ ├── nx_c_binary.c
│ │ │ │ ├── nx_c_cast.c
│ │ │ │ ├── nx_c_cholesky.c
│ │ │ │ ├── nx_c_eig.c
│ │ │ │ ├── nx_c_index.c
│ │ │ │ ├── nx_c_matmul.c
│ │ │ │ ├── nx_c_memory.c
│ │ │ │ ├── nx_c_qr.c
│ │ │ │ ├── nx_c_random.c
│ │ │ │ ├── nx_c_reduce.c
│ │ │ │ ├── nx_c_scan.c
│ │ │ │ ├── nx_c_shape.c
│ │ │ │ ├── nx_c_shared.h
│ │ │ │ ├── nx_c_solve.c
│ │ │ │ ├── nx_c_sort.c
│ │ │ │ ├── nx_c_svd.c
│ │ │ │ ├── nx_c_ternary.c
│ │ │ │ ├── nx_c_unary.c
│ │ │ │ └── nx_c_window.c
│ │ │ ├── buffer/
│ │ │ │ ├── dune
│ │ │ │ ├── nx_buffer.ml
│ │ │ │ ├── nx_buffer.mli
│ │ │ │ ├── nx_buffer_stubs.c
│ │ │ │ ├── nx_buffer_stubs.h
│ │ │ │ ├── nx_buffer_stubs.js
│ │ │ │ └── test/
│ │ │ │ ├── dune
│ │ │ │ └── test_nx_buffer.ml
│ │ │ ├── core/
│ │ │ │ ├── backend_intf.ml
│ │ │ │ ├── dtype.ml
│ │ │ │ ├── dtype.mli
│ │ │ │ ├── dune
│ │ │ │ ├── frontend.ml
│ │ │ │ ├── nx_core.ml
│ │ │ │ ├── nx_core.mli
│ │ │ │ ├── rng.ml
│ │ │ │ ├── rng.mli
│ │ │ │ ├── shape.ml
│ │ │ │ ├── shape.mli
│ │ │ │ ├── view.ml
│ │ │ │ └── view.mli
│ │ │ ├── dune
│ │ │ ├── effect/
│ │ │ │ ├── dune
│ │ │ │ └── nx_effect.ml
│ │ │ ├── io/
│ │ │ │ ├── dune
│ │ │ │ ├── error.ml
│ │ │ │ ├── npy.ml
│ │ │ │ ├── nx_io.ml
│ │ │ │ ├── nx_io.mli
│ │ │ │ ├── nx_npy.ml
│ │ │ │ ├── nx_safetensors.ml
│ │ │ │ ├── nx_txt.ml
│ │ │ │ ├── packed_nx.ml
│ │ │ │ └── safetensors.ml
│ │ │ ├── nx.ml
│ │ │ ├── nx.mli
│ │ │ └── prelude.ml
│ │ ├── test/
│ │ │ ├── dune
│ │ │ ├── failing/
│ │ │ │ ├── bug_blit_overlapping.ml
│ │ │ │ └── dune
│ │ │ ├── fixtures/
│ │ │ │ ├── bf16_bit_exact.safetensors
│ │ │ │ ├── f16_bit_exact.safetensors
│ │ │ │ └── generate.py
│ │ │ ├── props/
│ │ │ │ ├── dune
│ │ │ │ ├── test_nx_props.ml
│ │ │ │ └── test_nx_props_support.ml
│ │ │ ├── test_nx_basics.ml
│ │ │ ├── test_nx_extended_dtypes.ml
│ │ │ ├── test_nx_fft.ml
│ │ │ ├── test_nx_indexing.ml
│ │ │ ├── test_nx_io.ml
│ │ │ ├── test_nx_linalg.ml
│ │ │ ├── test_nx_manipulation.ml
│ │ │ ├── test_nx_ops.ml
│ │ │ ├── test_nx_rng.ml
│ │ │ ├── test_nx_sanity.ml
│ │ │ ├── test_nx_sorting.ml
│ │ │ └── test_nx_support.ml
│ │ ├── top/
│ │ │ ├── dune
│ │ │ └── nx_top.ml
│ │ └── vendor/
│ │ ├── camlzip/
│ │ │ ├── LICENSE
│ │ │ ├── config/
│ │ │ │ ├── discover.ml
│ │ │ │ └── dune
│ │ │ ├── dune
│ │ │ ├── gzip.ml
│ │ │ ├── gzip.mli
│ │ │ ├── zip.ml
│ │ │ ├── zip.mli
│ │ │ ├── zlib.ml
│ │ │ ├── zlib.mli
│ │ │ └── zlibstubs.c
│ │ ├── dune
│ │ ├── ocaml-pocketfft/
│ │ │ ├── config/
│ │ │ │ ├── discover.ml
│ │ │ │ └── dune
│ │ │ ├── dune
│ │ │ ├── pocketfft/
│ │ │ │ ├── LICENSE
│ │ │ │ └── pocketfft_hdronly.h
│ │ │ ├── pocketfft.ml
│ │ │ └── pocketfft_stubs.cpp
│ │ ├── stb_image/
│ │ │ ├── dune
│ │ │ ├── ml_stb_image.c
│ │ │ ├── stb_image.h
│ │ │ ├── stb_image.ml
│ │ │ └── stb_image.mli
│ │ └── stb_image_write/
│ │ ├── dune
│ │ ├── ml_stb_image_write.c
│ │ ├── stb_image_write.h
│ │ ├── stb_image_write.ml
│ │ └── stb_image_write.mli
│ ├── nx-oxcaml/
│ │ ├── .ocamlformat
│ │ ├── AGENTS.md
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── README.md
│ │ │ ├── bench_nx_c.ml
│ │ │ ├── bench_nx_common.ml
│ │ │ ├── bench_nx_oxcaml.ml
│ │ │ └── dune
│ │ ├── dune-project
│ │ ├── dune-workspace
│ │ ├── lib/
│ │ │ ├── binary_ops/
│ │ │ │ ├── op_add.ml
│ │ │ │ ├── op_atan2.ml
│ │ │ │ ├── op_fdiv.ml
│ │ │ │ ├── op_idiv.ml
│ │ │ │ ├── op_max.ml
│ │ │ │ ├── op_min.ml
│ │ │ │ ├── op_mod.ml
│ │ │ │ ├── op_mul.ml
│ │ │ │ ├── op_pow.ml
│ │ │ │ └── op_sub.ml
│ │ │ ├── comparison_ops/
│ │ │ │ ├── op_cmpeq.ml
│ │ │ │ ├── op_cmple.ml
│ │ │ │ ├── op_cmplt.ml
│ │ │ │ └── op_cmpne.ml
│ │ │ ├── dune
│ │ │ ├── import.ml
│ │ │ ├── logical_ops/
│ │ │ │ ├── op_and.ml
│ │ │ │ ├── op_or.ml
│ │ │ │ └── op_xor.ml
│ │ │ ├── nx_backend.ml
│ │ │ ├── nx_oxcaml_stubs.c
│ │ │ ├── op_argmax.ml
│ │ │ ├── op_associative_scan.ml
│ │ │ ├── op_cast.ml
│ │ │ ├── op_cat.ml
│ │ │ ├── op_fold.ml
│ │ │ ├── op_gather.ml
│ │ │ ├── op_matmul.ml
│ │ │ ├── op_pad.ml
│ │ │ ├── op_scatter.ml
│ │ │ ├── op_sort.ml
│ │ │ ├── op_threefry.ml
│ │ │ ├── op_unfold.ml
│ │ │ ├── parallel.ml
│ │ │ ├── reduce_ops.ml
│ │ │ ├── simd_neon.ml
│ │ │ ├── simd_sse.ml
│ │ │ ├── simd_stubs.c
│ │ │ ├── ternary_ops/
│ │ │ │ └── op_where.ml
│ │ │ └── unary_ops/
│ │ │ ├── op_abs.ml
│ │ │ ├── op_acos.ml
│ │ │ ├── op_asin.ml
│ │ │ ├── op_atan.ml
│ │ │ ├── op_ceil.ml
│ │ │ ├── op_cos.ml
│ │ │ ├── op_cosh.ml
│ │ │ ├── op_erf.ml
│ │ │ ├── op_exp.ml
│ │ │ ├── op_floor.ml
│ │ │ ├── op_log.ml
│ │ │ ├── op_neg.ml
│ │ │ ├── op_recip.ml
│ │ │ ├── op_round.ml
│ │ │ ├── op_sign.ml
│ │ │ ├── op_sin.ml
│ │ │ ├── op_sinh.ml
│ │ │ ├── op_sqrt.ml
│ │ │ ├── op_tan.ml
│ │ │ ├── op_tanh.ml
│ │ │ └── op_trunc.ml
│ │ ├── nx-oxcaml.opam
│ │ ├── test/
│ │ │ ├── dune
│ │ │ └── test_nx_oxcaml.ml
│ │ └── vendor/
│ │ └── dune
│ ├── quill/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-notebook-format.md
│ │ │ ├── 03-execution-modes.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── hello.md
│ │ │ └── mnist.md
│ │ ├── lib/
│ │ │ ├── quill/
│ │ │ │ ├── cell.ml
│ │ │ │ ├── cell.mli
│ │ │ │ ├── doc.ml
│ │ │ │ ├── doc.mli
│ │ │ │ ├── dune
│ │ │ │ ├── eval.ml
│ │ │ │ ├── eval.mli
│ │ │ │ ├── kernel.ml
│ │ │ │ ├── kernel.mli
│ │ │ │ ├── quill.ml
│ │ │ │ ├── quill.mli
│ │ │ │ ├── session.ml
│ │ │ │ └── session.mli
│ │ │ ├── quill-book/
│ │ │ │ ├── build.ml
│ │ │ │ ├── build.mli
│ │ │ │ ├── dune
│ │ │ │ ├── quill_book.ml
│ │ │ │ ├── quill_book.mli
│ │ │ │ ├── render.ml
│ │ │ │ ├── render.mli
│ │ │ │ └── theme.ml
│ │ │ ├── quill-markdown/
│ │ │ │ ├── dune
│ │ │ │ ├── edit.ml
│ │ │ │ ├── edit.mli
│ │ │ │ ├── quill_markdown.ml
│ │ │ │ └── quill_markdown.mli
│ │ │ ├── quill-project/
│ │ │ │ ├── dune
│ │ │ │ ├── quill_project.ml
│ │ │ │ └── quill_project.mli
│ │ │ ├── quill-server/
│ │ │ │ ├── dune
│ │ │ │ ├── frontend/
│ │ │ │ │ ├── .gitignore
│ │ │ │ │ ├── css/
│ │ │ │ │ │ └── notebook.css
│ │ │ │ │ ├── dist/
│ │ │ │ │ │ ├── app.css
│ │ │ │ │ │ └── app.js
│ │ │ │ │ ├── dune
│ │ │ │ │ ├── esbuild.config.mjs
│ │ │ │ │ ├── index.html
│ │ │ │ │ ├── package.json
│ │ │ │ │ └── src/
│ │ │ │ │ ├── app.js
│ │ │ │ │ ├── cell.js
│ │ │ │ │ ├── editor.js
│ │ │ │ │ ├── math.js
│ │ │ │ │ ├── notebook.js
│ │ │ │ │ ├── output.js
│ │ │ │ │ ├── shortcuts.js
│ │ │ │ │ ├── store.js
│ │ │ │ │ └── ws.js
│ │ │ │ ├── httpd.ml
│ │ │ │ ├── httpd.mli
│ │ │ │ ├── protocol.ml
│ │ │ │ ├── protocol.mli
│ │ │ │ ├── quill_server.ml
│ │ │ │ ├── quill_server.mli
│ │ │ │ └── support/
│ │ │ │ └── gen_assets.ml
│ │ │ ├── quill-top/
│ │ │ │ ├── dune
│ │ │ │ ├── quill_top.ml
│ │ │ │ └── quill_top.mli
│ │ │ └── quill-tui/
│ │ │ ├── dune
│ │ │ ├── quill_tui.ml
│ │ │ └── quill_tui.mli
│ │ └── test/
│ │ ├── dune
│ │ ├── test_cell.ml
│ │ ├── test_doc.ml
│ │ ├── test_markdown.ml
│ │ └── test_session.ml
│ ├── rune/
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── README.md
│ │ │ ├── bench_grad_pytorch.py
│ │ │ ├── bench_grad_rune.ml
│ │ │ ├── dune
│ │ │ └── rune_grad.thumper
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-transformations.md
│ │ │ ├── 03-how-it-works.md
│ │ │ ├── 04-jax-comparison.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-mlp/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ └── xx-higher-derivative/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── lib/
│ │ │ ├── autodiff.ml
│ │ │ ├── custom_diff.ml
│ │ │ ├── debug.ml
│ │ │ ├── dune
│ │ │ ├── finite_diff.ml
│ │ │ ├── gradcheck.ml
│ │ │ ├── jacobian.ml
│ │ │ ├── jit.ml
│ │ │ ├── jit.mli
│ │ │ ├── jvp.ml
│ │ │ ├── rune.ml
│ │ │ ├── rune.mli
│ │ │ ├── vjp.ml
│ │ │ └── vmap.ml
│ │ └── test/
│ │ ├── dune
│ │ ├── golden/
│ │ │ ├── jit_grad/
│ │ │ │ ├── dune
│ │ │ │ ├── generate_actual.ml
│ │ │ │ ├── generate_expected.py
│ │ │ │ ├── grad_cube.expected
│ │ │ │ ├── grad_polynomial.expected
│ │ │ │ ├── grad_sin.expected
│ │ │ │ ├── grad_square.expected
│ │ │ │ └── grad_sum.expected
│ │ │ └── jit_trace/
│ │ │ ├── add_const.expected
│ │ │ ├── chain.expected
│ │ │ ├── dune
│ │ │ ├── generate_actual.ml
│ │ │ ├── generate_expected.py
│ │ │ ├── mul_self.expected
│ │ │ └── sum.expected
│ │ ├── support/
│ │ │ ├── dune
│ │ │ └── test_rune_support.ml
│ │ ├── test_custom_diff.ml
│ │ ├── test_gradcheck.ml
│ │ ├── test_jacobian.ml
│ │ ├── test_jit.ml
│ │ ├── test_jit_grad.ml
│ │ ├── test_jit_vmap.ml
│ │ ├── test_jvp.ml
│ │ ├── test_vjp.ml
│ │ └── test_vmap.ml
│ ├── sowilo/
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── README.md
│ │ │ ├── bench_sowilo.ml
│ │ │ ├── bench_sowilo.py
│ │ │ ├── dune
│ │ │ ├── scripts/
│ │ │ │ └── generate_fixtures.py
│ │ │ └── sowilo.thumper
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-operations.md
│ │ │ ├── 03-pipelines.md
│ │ │ ├── 04-opencv-comparison.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-grayscale/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-gaussian-blur/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-median-blur/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 04-threshold/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 05-sobel/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 06-canny/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ └── 07-morphology/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── lib/
│ │ │ ├── color.ml
│ │ │ ├── dune
│ │ │ ├── edge.ml
│ │ │ ├── filter.ml
│ │ │ ├── helpers.ml
│ │ │ ├── morphology.ml
│ │ │ ├── sowilo.ml
│ │ │ ├── sowilo.mli
│ │ │ └── transform.ml
│ │ └── test/
│ │ ├── dune
│ │ └── test_sowilo.ml
│ ├── talon/
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── README.md
│ │ │ ├── bench_talon.ml
│ │ │ ├── bench_talon.py
│ │ │ ├── data/
│ │ │ │ ├── customers.csv
│ │ │ │ └── transactions.csv
│ │ │ ├── dune
│ │ │ ├── scripts/
│ │ │ │ └── generate_fixtures.py
│ │ │ └── talon.thumper
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-row-operations.md
│ │ │ ├── 03-pandas-comparison.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-quickstart/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-wide-features/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-selectors/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 04-row-reduce/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ └── 05-sorting-and-grouping/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── lib/
│ │ │ ├── col.ml
│ │ │ ├── csv/
│ │ │ │ ├── csv_io.ml
│ │ │ │ ├── dune
│ │ │ │ ├── talon_csv.ml
│ │ │ │ └── talon_csv.mli
│ │ │ ├── dune
│ │ │ ├── talon.ml
│ │ │ └── talon.mli
│ │ └── test/
│ │ ├── dune
│ │ ├── test_talon.ml
│ │ └── test_talon_csv.ml
│ ├── tolk/
│ │ ├── .gitignore
│ │ ├── .ocamlformat
│ │ ├── LICENSE-tinygrad
│ │ ├── README.md
│ │ ├── doc/
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── lib/
│ │ │ ├── codegen/
│ │ │ │ ├── codegen.ml
│ │ │ │ ├── codegen.mli
│ │ │ │ ├── codegen_lower.ml
│ │ │ │ ├── codegen_lower.mli
│ │ │ │ ├── gpudims.ml
│ │ │ │ ├── gpudims.mli
│ │ │ │ ├── late/
│ │ │ │ │ ├── devectorizer.ml
│ │ │ │ │ ├── devectorizer.mli
│ │ │ │ │ ├── expander.ml
│ │ │ │ │ ├── expander.mli
│ │ │ │ │ ├── images.ml
│ │ │ │ │ ├── images.mli
│ │ │ │ │ ├── linearizer.ml
│ │ │ │ │ └── linearizer.mli
│ │ │ │ ├── opt/
│ │ │ │ │ ├── heuristic.ml
│ │ │ │ │ ├── heuristic.mli
│ │ │ │ │ ├── postrange.ml
│ │ │ │ │ ├── postrange.mli
│ │ │ │ │ ├── search.ml
│ │ │ │ │ ├── search.mli
│ │ │ │ │ ├── tc.ml
│ │ │ │ │ └── tc.mli
│ │ │ │ ├── simplify.ml
│ │ │ │ └── simplify.mli
│ │ │ ├── compiler.ml
│ │ │ ├── compiler.mli
│ │ │ ├── device.ml
│ │ │ ├── device.mli
│ │ │ ├── diskcache.ml
│ │ │ ├── diskcache.mli
│ │ │ ├── dune
│ │ │ ├── engine/
│ │ │ │ ├── allocations.ml
│ │ │ │ ├── allocations.mli
│ │ │ │ ├── jit.ml
│ │ │ │ ├── jit.mli
│ │ │ │ ├── memory.ml
│ │ │ │ ├── memory.mli
│ │ │ │ ├── realize.ml
│ │ │ │ ├── realize.mli
│ │ │ │ └── schedule.ml
│ │ │ ├── gpu_target.ml
│ │ │ ├── gpu_target.mli
│ │ │ ├── helpers.ml
│ │ │ ├── ir/
│ │ │ │ ├── axis_kind.ml
│ │ │ │ ├── axis_kind.mli
│ │ │ │ ├── const.ml
│ │ │ │ ├── const.mli
│ │ │ │ ├── decomposition.ml
│ │ │ │ ├── decomposition.mli
│ │ │ │ ├── divandmod.ml
│ │ │ │ ├── divandmod.mli
│ │ │ │ ├── dtype.ml
│ │ │ │ ├── dtype.mli
│ │ │ │ ├── dune
│ │ │ │ ├── hashcons.ml
│ │ │ │ ├── hashcons.mli
│ │ │ │ ├── kernel.ml
│ │ │ │ ├── kernel.mli
│ │ │ │ ├── op.ml
│ │ │ │ ├── op.mli
│ │ │ │ ├── program.ml
│ │ │ │ ├── program.mli
│ │ │ │ ├── shape.ml
│ │ │ │ ├── shape.mli
│ │ │ │ ├── special_dim.ml
│ │ │ │ ├── special_dim.mli
│ │ │ │ ├── symbolic.ml
│ │ │ │ ├── symbolic.mli
│ │ │ │ ├── tensor.ml
│ │ │ │ ├── tensor.mli
│ │ │ │ ├── tolk_ir.ml
│ │ │ │ └── tolk_ir.mli
│ │ │ ├── program_spec.ml
│ │ │ ├── program_spec.mli
│ │ │ ├── renderer/
│ │ │ │ ├── cstyle.ml
│ │ │ │ └── cstyle.mli
│ │ │ ├── renderer.ml
│ │ │ ├── renderer.mli
│ │ │ ├── runtime/
│ │ │ │ ├── cpu/
│ │ │ │ │ ├── compiler_cpu.ml
│ │ │ │ │ ├── compiler_cpu.mli
│ │ │ │ │ ├── dune
│ │ │ │ │ ├── elf_cpu_loader.ml
│ │ │ │ │ ├── elf_cpu_loader.mli
│ │ │ │ │ ├── tolk_cpu.ml
│ │ │ │ │ ├── tolk_cpu.mli
│ │ │ │ │ └── tolk_cpu_stubs.c
│ │ │ │ ├── metal/
│ │ │ │ │ ├── dune
│ │ │ │ │ ├── tolk_metal.ml
│ │ │ │ │ ├── tolk_metal.mli
│ │ │ │ │ └── tolk_metal_stubs.c
│ │ │ │ └── support/
│ │ │ │ ├── elf.ml
│ │ │ │ ├── elf.mli
│ │ │ │ ├── tlsf.ml
│ │ │ │ └── tlsf.mli
│ │ │ └── schedule/
│ │ │ ├── allreduce.ml
│ │ │ ├── allreduce.mli
│ │ │ ├── indexing.ml
│ │ │ ├── indexing.mli
│ │ │ ├── multi.ml
│ │ │ ├── multi.mli
│ │ │ ├── rangeify.ml
│ │ │ └── rangeify.mli
│ │ └── test/
│ │ ├── golden/
│ │ │ ├── codegen/
│ │ │ │ ├── clang_dot_product.expected
│ │ │ │ ├── clang_elementwise_add.expected
│ │ │ │ ├── clang_elementwise_cast_f16.expected
│ │ │ │ ├── clang_elementwise_int32.expected
│ │ │ │ ├── clang_elementwise_sqrt.expected
│ │ │ │ ├── clang_elementwise_where.expected
│ │ │ │ ├── clang_gated_store.expected
│ │ │ │ ├── clang_max_reduce.expected
│ │ │ │ ├── clang_multi_output.expected
│ │ │ │ ├── clang_no_optimize.expected
│ │ │ │ ├── clang_parallel_reduce.expected
│ │ │ │ ├── clang_reduce_rows.expected
│ │ │ │ ├── clang_sum_reduce.expected
│ │ │ │ ├── cuda_dot_product.expected
│ │ │ │ ├── cuda_elementwise_2d.expected
│ │ │ │ ├── cuda_elementwise_add.expected
│ │ │ │ ├── cuda_elementwise_cast_f16.expected
│ │ │ │ ├── cuda_elementwise_int32.expected
│ │ │ │ ├── cuda_elementwise_sqrt.expected
│ │ │ │ ├── cuda_elementwise_where.expected
│ │ │ │ ├── cuda_gated_store.expected
│ │ │ │ ├── cuda_matmul_small.expected
│ │ │ │ ├── cuda_max_reduce.expected
│ │ │ │ ├── cuda_multi_output.expected
│ │ │ │ ├── cuda_no_optimize.expected
│ │ │ │ ├── cuda_parallel_reduce.expected
│ │ │ │ ├── cuda_reduce_rows.expected
│ │ │ │ ├── cuda_sum_reduce.expected
│ │ │ │ ├── dune
│ │ │ │ ├── generate_actual.ml
│ │ │ │ ├── generate_expected.py
│ │ │ │ ├── metal_dot_product.expected
│ │ │ │ ├── metal_elementwise_2d.expected
│ │ │ │ ├── metal_elementwise_add.expected
│ │ │ │ ├── metal_elementwise_cast_f16.expected
│ │ │ │ ├── metal_elementwise_int32.expected
│ │ │ │ ├── metal_elementwise_sqrt.expected
│ │ │ │ ├── metal_elementwise_where.expected
│ │ │ │ ├── metal_gated_store.expected
│ │ │ │ ├── metal_matmul_small.expected
│ │ │ │ ├── metal_max_reduce.expected
│ │ │ │ ├── metal_multi_output.expected
│ │ │ │ ├── metal_no_optimize.expected
│ │ │ │ ├── metal_parallel_reduce.expected
│ │ │ │ ├── metal_reduce_rows.expected
│ │ │ │ ├── metal_sum_reduce.expected
│ │ │ │ ├── opencl_dot_product.expected
│ │ │ │ ├── opencl_elementwise_2d.expected
│ │ │ │ ├── opencl_elementwise_add.expected
│ │ │ │ ├── opencl_elementwise_cast_f16.expected
│ │ │ │ ├── opencl_elementwise_int32.expected
│ │ │ │ ├── opencl_elementwise_sqrt.expected
│ │ │ │ ├── opencl_elementwise_where.expected
│ │ │ │ ├── opencl_gated_store.expected
│ │ │ │ ├── opencl_matmul_small.expected
│ │ │ │ ├── opencl_max_reduce.expected
│ │ │ │ ├── opencl_multi_output.expected
│ │ │ │ ├── opencl_no_optimize.expected
│ │ │ │ ├── opencl_parallel_reduce.expected
│ │ │ │ ├── opencl_reduce_rows.expected
│ │ │ │ └── opencl_sum_reduce.expected
│ │ │ ├── cstyle/
│ │ │ │ ├── clang_bitcast_f32_to_i32.expected
│ │ │ │ ├── clang_cast_f16_to_f32.expected
│ │ │ │ ├── clang_conditional.expected
│ │ │ │ ├── clang_const_inf_nan.expected
│ │ │ │ ├── clang_gated_load.expected
│ │ │ │ ├── clang_loop.expected
│ │ │ │ ├── clang_multi_param.expected
│ │ │ │ ├── clang_nested_loops.expected
│ │ │ │ ├── clang_simple_add_f32.expected
│ │ │ │ ├── clang_simple_mul_i32.expected
│ │ │ │ ├── clang_unary_sqrt_f16.expected
│ │ │ │ ├── clang_unary_sqrt_f32.expected
│ │ │ │ ├── clang_vectorize_gep.expected
│ │ │ │ ├── clang_where_select.expected
│ │ │ │ ├── cuda_bitcast_f32_to_i32.expected
│ │ │ │ ├── cuda_cast_f16_to_f32.expected
│ │ │ │ ├── cuda_conditional.expected
│ │ │ │ ├── cuda_const_inf_nan.expected
│ │ │ │ ├── cuda_gated_load.expected
│ │ │ │ ├── cuda_loop.expected
│ │ │ │ ├── cuda_multi_param.expected
│ │ │ │ ├── cuda_nested_loops.expected
│ │ │ │ ├── cuda_shared_memory.expected
│ │ │ │ ├── cuda_simple_add_f32.expected
│ │ │ │ ├── cuda_simple_mul_i32.expected
│ │ │ │ ├── cuda_special_dims.expected
│ │ │ │ ├── cuda_unary_sqrt_f16.expected
│ │ │ │ ├── cuda_unary_sqrt_f32.expected
│ │ │ │ ├── cuda_vectorize_gep.expected
│ │ │ │ ├── cuda_where_select.expected
│ │ │ │ ├── dune
│ │ │ │ ├── generate_actual.ml
│ │ │ │ ├── generate_expected.py
│ │ │ │ ├── metal_bitcast_f32_to_i32.expected
│ │ │ │ ├── metal_cast_f16_to_f32.expected
│ │ │ │ ├── metal_conditional.expected
│ │ │ │ ├── metal_const_inf_nan.expected
│ │ │ │ ├── metal_gated_load.expected
│ │ │ │ ├── metal_loop.expected
│ │ │ │ ├── metal_multi_param.expected
│ │ │ │ ├── metal_nested_loops.expected
│ │ │ │ ├── metal_shared_memory.expected
│ │ │ │ ├── metal_simple_add_f32.expected
│ │ │ │ ├── metal_simple_mul_i32.expected
│ │ │ │ ├── metal_special_dims.expected
│ │ │ │ ├── metal_unary_sqrt_f16.expected
│ │ │ │ ├── metal_unary_sqrt_f32.expected
│ │ │ │ ├── metal_vectorize_gep.expected
│ │ │ │ ├── metal_where_select.expected
│ │ │ │ ├── opencl_bitcast_f32_to_i32.expected
│ │ │ │ ├── opencl_cast_f16_to_f32.expected
│ │ │ │ ├── opencl_conditional.expected
│ │ │ │ ├── opencl_const_inf_nan.expected
│ │ │ │ ├── opencl_gated_load.expected
│ │ │ │ ├── opencl_loop.expected
│ │ │ │ ├── opencl_multi_param.expected
│ │ │ │ ├── opencl_nested_loops.expected
│ │ │ │ ├── opencl_shared_memory.expected
│ │ │ │ ├── opencl_simple_add_f32.expected
│ │ │ │ ├── opencl_simple_mul_i32.expected
│ │ │ │ ├── opencl_special_dims.expected
│ │ │ │ ├── opencl_unary_sqrt_f16.expected
│ │ │ │ ├── opencl_unary_sqrt_f32.expected
│ │ │ │ ├── opencl_vectorize_gep.expected
│ │ │ │ └── opencl_where_select.expected
│ │ │ ├── debug/
│ │ │ │ ├── dune
│ │ │ │ ├── elementwise_add.expected
│ │ │ │ ├── elementwise_add_opt.expected
│ │ │ │ ├── generate_actual.ml
│ │ │ │ └── generate_expected.py
│ │ │ └── rangeify/
│ │ │ ├── clang_binop_permute.expected
│ │ │ ├── clang_binop_reshape.expected
│ │ │ ├── clang_contiguous_add.expected
│ │ │ ├── clang_diamond.expected
│ │ │ ├── clang_elementwise_3way.expected
│ │ │ ├── clang_elementwise_add.expected
│ │ │ ├── clang_expand_permute.expected
│ │ │ ├── clang_mulacc.expected
│ │ │ ├── clang_multistage_reduce.expected
│ │ │ ├── clang_permute_through_reshape.expected
│ │ │ ├── clang_reduce_permute_binop.expected
│ │ │ ├── clang_reduce_reshape_binop.expected
│ │ │ ├── clang_reduce_shrink.expected
│ │ │ ├── clang_reduce_unary.expected
│ │ │ ├── clang_reshape_chain.expected
│ │ │ ├── clang_shrink_fuse.expected
│ │ │ ├── clang_two_sum.expected
│ │ │ ├── cuda_binop_permute.expected
│ │ │ ├── cuda_binop_reshape.expected
│ │ │ ├── cuda_contiguous_add.expected
│ │ │ ├── cuda_diamond.expected
│ │ │ ├── cuda_elementwise_3way.expected
│ │ │ ├── cuda_elementwise_add.expected
│ │ │ ├── cuda_expand_permute.expected
│ │ │ ├── cuda_mulacc.expected
│ │ │ ├── cuda_multistage_reduce.expected
│ │ │ ├── cuda_permute_through_reshape.expected
│ │ │ ├── cuda_reduce_permute_binop.expected
│ │ │ ├── cuda_reduce_reshape_binop.expected
│ │ │ ├── cuda_reduce_shrink.expected
│ │ │ ├── cuda_reduce_unary.expected
│ │ │ ├── cuda_reshape_chain.expected
│ │ │ ├── cuda_shrink_fuse.expected
│ │ │ ├── cuda_two_sum.expected
│ │ │ ├── dune
│ │ │ ├── generate_actual.ml
│ │ │ ├── generate_expected.py
│ │ │ ├── metal_binop_permute.expected
│ │ │ ├── metal_binop_reshape.expected
│ │ │ ├── metal_contiguous_add.expected
│ │ │ ├── metal_diamond.expected
│ │ │ ├── metal_elementwise_3way.expected
│ │ │ ├── metal_elementwise_add.expected
│ │ │ ├── metal_expand_permute.expected
│ │ │ ├── metal_mulacc.expected
│ │ │ ├── metal_multistage_reduce.expected
│ │ │ ├── metal_permute_through_reshape.expected
│ │ │ ├── metal_reduce_permute_binop.expected
│ │ │ ├── metal_reduce_reshape_binop.expected
│ │ │ ├── metal_reduce_shrink.expected
│ │ │ ├── metal_reduce_unary.expected
│ │ │ ├── metal_reshape_chain.expected
│ │ │ ├── metal_shrink_fuse.expected
│ │ │ ├── metal_two_sum.expected
│ │ │ ├── opencl_binop_permute.expected
│ │ │ ├── opencl_binop_reshape.expected
│ │ │ ├── opencl_contiguous_add.expected
│ │ │ ├── opencl_diamond.expected
│ │ │ ├── opencl_elementwise_3way.expected
│ │ │ ├── opencl_elementwise_add.expected
│ │ │ ├── opencl_expand_permute.expected
│ │ │ ├── opencl_mulacc.expected
│ │ │ ├── opencl_multistage_reduce.expected
│ │ │ ├── opencl_permute_through_reshape.expected
│ │ │ ├── opencl_reduce_permute_binop.expected
│ │ │ ├── opencl_reduce_reshape_binop.expected
│ │ │ ├── opencl_reduce_shrink.expected
│ │ │ ├── opencl_reduce_unary.expected
│ │ │ ├── opencl_reshape_chain.expected
│ │ │ ├── opencl_shrink_fuse.expected
│ │ │ └── opencl_two_sum.expected
│ │ └── unit/
│ │ ├── dune
│ │ ├── test_codegen_devectorizer.ml
│ │ ├── test_codegen_expander.ml
│ │ ├── test_codegen_gpudims.ml
│ │ ├── test_codegen_heuristic.ml
│ │ ├── test_codegen_images.ml
│ │ ├── test_codegen_linearizer.ml
│ │ ├── test_codegen_postrange.ml
│ │ ├── test_codegen_simplify.ml
│ │ ├── test_codegen_tc.ml
│ │ ├── test_cstyle.ml
│ │ ├── test_elf.ml
│ │ ├── test_ir_dtype.ml
│ │ ├── test_ir_kernel.ml
│ │ ├── test_ir_program.ml
│ │ ├── test_ir_symbolic.ml
│ │ ├── test_ir_tensor.ml
│ │ ├── test_program_spec.ml
│ │ ├── test_runtime_cpu.ml
│ │ ├── test_runtime_metal.ml
│ │ ├── test_runtime_search.ml
│ │ └── test_schedule_rangeify.ml
│ └── vega/
│ ├── README.md
│ ├── bench/
│ │ ├── bench_vega.ml
│ │ ├── dune
│ │ └── vega.thumper
│ ├── doc/
│ │ ├── 01-getting-started.md
│ │ ├── 02-composing-transforms.md
│ │ ├── 03-schedules.md
│ │ ├── 04-optax-comparison.md
│ │ ├── dune
│ │ └── index.md
│ ├── examples/
│ │ ├── 01-basic-optimizers/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 02-composing-transforms/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 03-learning-rate-schedules/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ └── README.md
│ ├── lib/
│ │ ├── dune
│ │ ├── schedule.ml
│ │ ├── schedule.mli
│ │ ├── vega.ml
│ │ └── vega.mli
│ └── test/
│ ├── dune
│ └── test_vega.ml
├── scripts/
│ └── ubench.py
└── www/
├── .gitignore
├── README.md
├── dune
├── dune-project
├── generate/
│ ├── api.ml
│ ├── dune
│ ├── generate.ml
│ └── site.ml
├── process/
│ ├── dream_process.ml
│ ├── dune
│ ├── generate_api_rules.ml
│ ├── index.ml
│ └── sidebar.ml
├── site/
│ ├── docs.css
│ ├── index.html
│ ├── odoc.css
│ └── styles.css
└── templates/
├── layout_docs.html
├── layout_docs_lib.html
└── main.html
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/changelog.yml
================================================
name: Changelog Check
on:
pull_request:
branches:
- main
jobs:
changelog:
name: Ensure changelog updated
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify changelog entry
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
git fetch --depth=1 origin "$BASE_SHA"
changed=$(git diff --name-only "$BASE_SHA"...HEAD | grep '^CHANGES\.md$' || true)
if [ -z "$changed" ]; then
echo "::error::Missing changelog entry. Update CHANGES.md to describe your changes."
exit 1
fi
================================================
FILE: .github/workflows/ci.yml
================================================
name: Build and test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
# - windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout tree
uses: actions/checkout@v4
- name: Set-up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: 5
- name: Install dependencies
run: opam install . --deps-only --with-test
- name: Build and test nx
run: |
opam exec -- dune build --release packages/nx
opam exec -- dune build --release @packages/nx/runtest
- name: Build and test brot
run: |
opam exec -- dune build --release packages/brot
opam exec -- dune build --release @packages/brot/runtest
- name: Build and test talon
run: |
opam exec -- dune build --release packages/talon
opam exec -- dune build --release @packages/talon/runtest
- name: Build and test rune
run: |
opam exec -- dune build --release packages/rune
opam exec -- dune build --release @packages/rune/runtest
- name: Build and test kaun
run: |
opam exec -- dune build --release packages/kaun
opam exec -- dune build --release @packages/kaun/runtest
- name: Build and test fehu
run: |
opam exec -- dune build --release packages/fehu
opam exec -- dune build --release @packages/fehu/runtest
- name: Build and test sowilo
run: |
opam exec -- dune build --release packages/sowilo
opam exec -- dune build --release @packages/sowilo/runtest
- name: Build and test hugin
run: |
opam exec -- dune build --release packages/hugin
opam exec -- dune build --release @packages/hugin/runtest
- name: Build and test quill
run: |
opam exec -- dune build --release packages/quill
opam exec -- dune build --release @packages/quill/runtest
================================================
FILE: .gitignore
================================================
# Opam swtich
_opam/
# Build output directory
_build/
# Catch-all for _*/ directories
_*/
# Dune lock files
dune.lock/
dune-tsan.lock/
# Development tools lock files
dev-tools.locks/
# VSCode editor configuration directory
.vscode/
# Python virtual environment directory
.venv/
# Environment variable files
.env
# Development packages
dev.opam
# Agent files
CLAUDE.local.md
# Run logs
runs/
# Agents
.agents/
.claude/
================================================
FILE: .ocamlformat
================================================
# OCamlFormat configuration file
# Pin the version of OCamlFormat to ensure consistent formatting across different environments.
# Uncomment and update this line to specify a version:
# version = 0.26.2
# The formatting style to use. Options include 'default', 'ocamlformat', and 'janestreet'.
# 'default' is a good starting point for most projects.
profile = default
# Parse and format comments in docstrings
parse-docstrings = true
# Wrap comments and docstrings to fit within the 'max-width'
wrap-comments = true
================================================
FILE: AGENTS.md
================================================
# agents.md
raven is an ecosystem of packages that brings modern machine learning capabilities to ocaml. it provides familiar equivalent of python packages.
## philosophy
raven is inspired by unix's philosophy of doing one thing well, and tinygrad's philosophy of minimalism and clarity. while our scope is larger than tinygrad's, we aim for the same beautiful and minimal code that covers python equivalent use cases.
- strive for the "right", principled implementations and designs that stand the test of time.
- every line must have purpose. choose clarity over cleverness.
- public apis stay small and modern. no legacy layers, no extra knobs.
- do not maintain compatibility for its own sake. breaking changes are fine when they move us toward the correct design.
- focus on _modern_ numerical computing and machine learning. old or classic apis from numpy, pandas, jax, etc are out of scope.
- minimize api surface as much as possible and offer the most elegant apis that cover user needs.
## projects
- **nx**: n-dimensional arrays with pluggable backend architecture - equivalent to numpy.
the backend interface is defined at `packages/nx/lib/core/backend.mli`. NEVER add a backend operation without being asked to do so.
frontend apis are defined in a single file `packages/nx/lib/frontend.ml` using the backend operations.
nx comes with a default c backend in `packages/nx/lib/backend_c/`.
- **rune**: tensor computation with automatic differentiation and jit compilation - equivalent to jax.
rune is architected as a backend for nx in `packages/rune/lib/nx_rune.ml`, where each backend operation raises an effect, or, if the effect is unhandled, falls back to the nx c backend.
this allows us to provide an nx-like api, while providing additional features such as automatic differentiation and jit compilation:
- for automatic differentiation in `packages/rune/lib/autodiff.ml`, effects are caught once re-executed, alongside their gradient calculations in the effect handler, the new calls are not caught by the effect handler (unless the user nests `grad` calls), so the operations are executed as normal on the c backend.
- for jit compilation, all effects are handled to build a computation graph, which is then jitted using `rune.jit`.
- and similar for other features such as debug, vmap.
- **kaun**: neural networks and training utilities built on rune - equivalent to flax.
kaun builds on rune to provide high-level neural network abstractions such as ptree, layers, optimizer, training loops, datasets, metrics, etc.
it also provides ready-to-use models in `packages/kaun/lib/kaun-models` and datasets in `packages/kaun/lib/kaun-datasets`.
- **fehu**: reinforcement learning environment and algorithms built on rune and kaun - equivalent to gym and stable baselines.
- **talon**: dataframe library for data manipulation and analysis - equivalent to pandas and polars.
- **brot**: tokenization and text processing - equivalent to huggingface tokenizers and parts of huggingface transformers.
- **hugin**: visualization library for plotting and rendering - equivalent to matplotlib and plotly.
- **quill**: interactive computing environment for ocaml - equivalent to jupyter notebooks and ipython.
- **sowilo**: image processing and computer vision built on rune - equivalent to opencv with differentiable operations.
## project structure
- packages live in `packages/` such as `packages/nx/`, `packages/rune/`, `packages/kaun/`, `packages/sowilo/`, `packages/talon/`, `packages/hugin/`, `packages/quill/`, and `packages/fehu/`, each with `lib/` sources and `test/` suites.
- documentation assets live under `www/` (static site).
## guidelines
- modules and variants are `Capitalized_snake_case`. values and functions use `snake_case`.
- docstrings are only used in `mli` files. they start with `(** [function_name args...] ... *)`.
- operations that match on dtypes need explicit type annocations, e.g. `let nonzero (type a b) (t : (a, b) t) =`.
## performance
- keep allocations to a minimum. allocate outside of loops and reuse buffers when possible.
- prefer loop-based implementations over higher-order functions for performance-critical code.
- use unsafe Bigarray and Bytes functions (e.g. `Bigarray.Array1.unsafe_get`) when safety checks are redundant.
## changelog
every user-facing commit MUST include a corresponding entry in `CHANGES.md`. if a commit adds a feature, fixes a bug, changes an API, or improves performance in a way that users would notice, update the changelog as part of that commit.
entries go under the current unreleased version, grouped by package with `### Package` headers. add new entries at the top of the relevant package section.
writing style:
- lead with what changed from the user's perspective, not what code was modified.
- explain *why* when the reason isn't obvious (e.g. a bug fix should say what was wrong).
- name the affected functions or types so users can find them.
- keep each entry to 1-3 lines. use backticks for code identifiers.
- do not include internal refactors, style changes, or test-only changes.
## important rules
- NEVER stage or commit changes unless explicitly requested
- NEVER run `dune clean`
- NEVER use the `--force` argument
- NEVER run dune build with DUNE_CACHE=disabled
- NEVER try to remove the dune lock file
- NEVER use git stash, git checkout, git reset, git restore, or ANY git command that modifies the working tree
- NEVER use git commands to "test" or "isolate" changes — reason about the code instead
- NEVER add new backend operations to nx unless explicitly requested
- NEVER hide warnings and NEVER hide unused variables by adding an underscore. ALWAYS treat warnings as errors that need a proper fix.
- ALWAYS add changelog entry(ies) in `CHANGES.md` when committing user-facing changes.
================================================
FILE: CHANGES.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
- Only document user-facing changes (features, bug fixes, performance improvements, API changes, etc.)
- Add new entries at the top of the appropriate section (most recent first)
## [1.0.0~beta1] - Unreleased
### Munin (new)
Local experiment tracking for Raven. Evolves `kaun-board` into a full
experiment tracker — the Raven equivalent of W&B or MLFlow, without a server.
Log metrics and artifacts from your training script, monitor runs live in the
terminal with `munin watch`, then compare results with `munin compare`. Data
is plain JSON on disk, so `jq` and shell scripts work out of the box. Git
commit, command line, and system info are captured automatically. The
`munin.sys` sub-library adds opt-in CPU and memory monitoring in a background
thread.
### Norn (new)
- New package: Markov chain Monte Carlo sampling with automatic gradients via
Rune. Provides HMC and NUTS samplers with Stan-style window adaptation (dual
averaging for step size, Welford estimation for mass matrix). Includes
symplectic integrators (leapfrog, mclachlan, yoshida), mass matrix metrics
(unit, diagonal, dense), and convergence diagnostics (ESS, split R-hat).
Equivalent to BlackJAX/PyMC in Python.
### Vega (new)
- New package: per-parameter gradient-based optimizers (SGD, Adam, AdamW,
RMSprop, Adagrad) and learning-rate schedules. Built on Nx with no autodiff
dependency. Optimizers compose via `Vega.chain` and schedules are plain
`int -> float` functions. Equivalent to Optax in JAX.
### Nx
- Remove `~out` parameter from all backend compute operations. Operations now
allocate and return their result instead of writing to a caller-provided
buffer. This simplifies the effect system, fixes vmap, and prepares the
architecture for JIT compilation.
- Add `Shape.reduce_output_shape` for computing output shapes after axis
reduction.
- Add machine learning examples: PCA, K-Means, DBSCAN, and t-SNE implemented
from Nx primitives.
- Fix incorrect results for views and slices in binary, unary, ternary, cast,
and shape C stubs. The `iterate_inner_dims` helpers did not account for the
ndarray offset, producing wrong results when the data starts at a non-zero
offset in the underlying buffer.
### Rune
- Add `Rune.jacfwd` and `Rune.jacrev` for computing full Jacobian matrices.
`jacfwd` uses forward-mode AD (column-by-column via JVP); `jacrev` uses
reverse-mode AD (row-by-row via VJP). Prefer `jacfwd` when inputs are smaller
than outputs, and `jacrev` otherwise.
- Guard against in-place tensor mutation inside `grad`, `vjp`, `jvp`, and
`vmap`. Using `set_item`, `set_slice`, `blit`, or `assign` inside these
transformations now raises `Invalid_argument` with a message directing users
to use `scatter` instead.
### Kaun
- Optimizers extracted to the new Vega package. `Kaun.Optim` now delegates to
Vega for per-leaf updates across parameter trees. `Train.make` accepts a
`Vega.t` directly instead of `Optim.algorithm`. Learning-rate schedules move
from `Optim.Schedule` to `Vega.Schedule`.
### Talon
- Add `to_html` and `pp_display` for rich table rendering in Quill notebooks.
Tables display as styled HTML in the web UI and published books, and as inline
HTML in markdown output files.
- Add `Talon.take` for selecting rows by an array of indices. Indices may repeat
and need not be sorted.
- Fix CSV auto-detection defaulting numeric columns to float32. Parsed values go
through `float_of_string` which produces 64-bit floats; defaulting to float32
silently truncated precision. Now defaults to float64.
### Hugin
- Fix contour rendering. The marching squares implementation produced disconnected
2-point line segments instead of joined polylines. Contour lines now render as
smooth connected curves, and filled contours (`~filled:true`) produce correct
closed polygons instead of degenerate 2-point fills.
### Quill
- Allow `quill file.md` without requiring `quill -- file.md` or `quill run file.md`.
The CLI now detects file arguments and routes them to the default TUI command.
- Fix image Display outputs showing raw base64 text in markdown files. Images now
render as inline `<img>` tags with data URIs, visible in any markdown viewer.
- Add `--figures-dir` flag to `quill run` for writing images to disk and
referencing them by path instead of inlining base64 data.
- Add rich table display for Talon dataframes in liveview and published books.
- Improve table styling in the web notebook and book build with clean borders,
monospace font, and proper header treatment.
- Resolve relative notebook paths to absolute and change into the notebook
directory before execution, so that relative file references in code cells
work correctly.
- Add `vega` to the default Raven packages loaded in Quill kernels.
## [1.0.0~alpha3] - 2026-03-14
This release reshapes raven's foundations. Every package received API
improvements, several were rewritten, and two new packages — nx-oxcaml and
kaun-board — were built as part of our Outreachy internships.
### Highlights
- **Unified tensor type** — `Nx.t` and `Rune.t` are now the same type.
Downstream packages no longer need to choose between them or convert at
boundaries. Rune is now a pure transformation library (grad, vjp, vmap)
over standard Nx tensors.
- **nx-oxcaml** (new, Outreachy) — Pure-OCaml tensor backend using OxCaml's
unboxed types and SIMD intrinsics. Performance approaches the C backend —
in pure OCaml.
- **kaun-board** (new, Outreachy) — TUI dashboard for monitoring training
runs in the terminal. Live metrics, loss curves, and system stats.
- **quill** — Rewritten from the ground up with two interfaces: a terminal UI
with syntax highlighting and code completion, and a web frontend via
`quill serve` with a CodeMirror 6 editor, WebSocket-based execution,
autocompletion, and diagnostics.
- **brot** — The tokenization library formerly known as saga. Complete rewrite
with a cleaner API. [1.3-6x faster than HuggingFace Tokenizers](packages/brot/bench/)
on most benchmarks.
- **nx** — Redesigned backend interface, RNG with effect-based scoping.
Einsum **8-20x** faster, matmul dispatch at BLAS parity with NumPy.
### Breaking changes
- **nx**: Redesigned backend interface with new `Nx_buffer` type. Removed
`nx.datasets` library. Moved NN functions to Kaun (use `Kaun.Fn`). Renamed
`im2col`/`col2im` to `extract_patches`/`combine_patches`. RNG uses
effect-based implicit scoping instead of explicit key threading. Removed
in-place mutation operations (`ifill`, `iadd`, `isub`, `imul`, `idiv`,
`ipow`, `imod`, `imaximum`, `iminimum` and `_s` variants). Removed
`Symbolic_shape` module; shapes are concrete `int array` throughout.
Removed `Instrumentation` module.
- **rune**: `Rune.t` no longer exists — use `Nx.t` everywhere. `Rune` no
longer re-exports tensor operations; use `open Nx` for tensor ops and
`Rune.grad`, `Rune.vjp`, etc. for autodiff. Remove any `Rune.to_nx` /
`Rune.of_nx` calls. Removed `enable_debug`, `disable_debug`, `with_debug`;
use `Rune.debug f x` instead.
- **rune**: Removed JIT/LLVM backend. This will come back in a future
release with a proper ML compiler.
- **kaun**: Rewritten core modules API, datasets, and HuggingFace integration.
Removed `kaun-models`.
- **brot**: Renamed from saga. Rewritten API focused on tokenization.
### Nx
- Unify `Nx.t` and `Rune.t` into a single tensor type. A new `nx.effect` library (`Nx_effect`) implements the backend interface with OCaml 5 effects: each operation raises an effect that autodiff/vmap/debug handlers can intercept, falling back to the C backend when unhandled. `Nx.t` is now `Nx_effect.t` everywhere — no more type conversions between Nx and Rune.
- Make transcendental, trigonometric, and hyperbolic operations (`exp`, `log`, `sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `atan2`, `sinh`, `cosh`, `tanh`, `asinh`, `acosh`, `atanh`, `erf`, `sigmoid`) polymorphic over all numeric types including complex, matching the backend and effect definitions.
- Make `isinf`, `isfinite`, `ceil`, `floor`, `round` polymorphic (non-float dtypes return all-false/all-true or no-op as appropriate).
- Redesign backend interface with more granular operations (e.g. dedicated unary and binary kernels). This improves performance by letting backends optimize individual ops directly, and prepares for the JIT pipeline which will decompose composite operations at the compiler level instead of the frontend.
- Rewrite `Nx_buffer` module with new interface. The backend now returns `Nx_buffer.t` instead of raw bigarrays.
- Add new C kernels for unary, binary, and sort operations, and route new backend ops to C kernels.
- Add scipy-style `correlate`, `convolve`, and sliding window filters.
- Generalize `unfold`/`fold` to arbitrary leading dimensions.
- Remove neural-network functions from Nx (softmax, log_softmax, relu, gelu, silu, sigmoid, tanh). These now live in `Kaun.Fn`.
- Rename `im2col`/`col2im` to `extract_patches`/`combine_patches`.
- Remove `nx.datasets` module. Datasets are now in `kaun.datasets`.
- Simplify `Nx_io` interface. Inline vendor libraries (safetensors, and npy) directly into nx_io.
- Move the `Rng` module from Rune into Nx with effect-based implicit scoping. Random number generation uses `Nx.Rng.run` to scope RNG state instead of explicit key threading.
- Reduce matmul dispatch overhead to reach BLAS parity with NumPy.
- Fix Threefry2x32 to match the Random123 standard.
- Fix `save_image` crash on multi-dimensional genarray.
- Pre-reduce independent axes in einsum to avoid OOM on large contractions.
- Make Nx backends pluggable via Dune virtual libraries. The new `nx.backend` virtual library defines the backend interface, with the C backend (`nx.c`) as the default implementation. Alternative backends (e.g., `nx-oxcaml`) can be swapped in at link time. The `Nx_c` module is renamed to `Nx_backend`.
- Fix `.top` libraries failing to load in utop with "Reference to undefined compilation unit `Parse`".
- Fix OpenMP flag filtering in `discover.ml`: strip `-Xpreprocessor -fopenmp` as a pair on macOS to prevent dangling `-Xpreprocessor` from consuming subsequent flags and causing linker failures. (@Alizter)
- Add missing bool→low-precision cast support (f16/bf16/fp8) in the C backend.
- Add UInt32/UInt64 dtypes, rename complex dtypes to Complex64/Complex128, and drop Complex16/QInt8/QUInt8/Int/NativeInt as tensor element dtypes.
- Remove in-place mutation operations (`ifill`, `iadd`, `isub`, `imul`, `idiv`, `ipow`, `imod`, `imaximum`, `iminimum` and `_s` variants). Use functional operations instead.
- Remove `Symbolic_shape` module; shapes are now concrete `int array` throughout.
- Remove `Instrumentation` module. Nx no longer wraps operations in tracing spans. Debugging tensor operations is handled by Rune's effect-based debug handler.
- Fix critical correctness issue in fancy slicing (`L`) where permutations were ignored if the number of indices matched the dimension size (e.g., `slice [L [1; 0]] x` returned `x` unmodified).
- Rewrite `slice` implementation to use `as_strided` for contiguous operations, reducing overhead to **O(1)** for view-based slices and separating gather operations for better performance.
- Optimize `set_slice` by replacing scalar-loop index calculations with vectorized coordinate arithmetic, significantly improving performance for fancy index assignments.
- Improve `einsum` performance **8–20×** with greedy contraction path optimizer (e.g., MatMul 100×100 f32 207.83 µs → 10.76 µs, **19×**; BatchMatMul 200×200 f32 8.78 ms → 435.39 µs, **20×**)
- Rewrite `diagonal` using flatten + gather approach instead of O(N²) eye matrix masking, reducing memory from O(N²) to O(N)
- Improve error messages for shape operations (`broadcast`, `reshape`, `blit`) with per-dimension detail and element counts.
### nx-oxcaml (new)
New pure-OCaml tensor backend that can be swapped in at link time via Dune virtual libraries. Uses OxCaml's unboxed types for zero-cost tensor element access, SIMD intrinsics for vectorized kernels, and parallel matmul. Performance approaches the native C backend — in pure OCaml. Supports the full Nx operation set: elementwise, reductions, matmul, gather/scatter, sort/argsort, argmax/argmin, unfold/fold, pad, cat, associative scan, and threefry RNG. (@nirnayroy, @tmattio)
### Rune
- Unify tensor types: `Rune.t` is now `Nx.t`. Rune no longer re-exports the Nx frontend — it is a pure transformation library exporting only `grad`, `grads`, `value_and_grad`, `vjp`, `jvp`, `vmap`, `no_grad`, `detach`, and debugging/gradcheck utilities. All tensor creation and manipulation uses `Nx` directly.
- Remove `Tensor` module and `Nx_rune` backend. Effect definitions moved to the new `nx.effect` library shared with Nx.
- Remove `Rune.to_nx` / `Rune.of_nx` (no longer needed — types are identical).
- Remove `Rune.enable_debug`, `Rune.disable_debug`, `Rune.with_debug`. Use `Rune.debug f x` to run a computation with debug logging enabled.
- Remove JIT compilation support from Rune. The `Rune.Jit` module and LLVM/Metal backends have been removed and will be re-introduced later as a standalone package.
- Update to new `Nx_buffer.t` type.
- Propagate new backend operations through effects and autodiff.
- Rewrite `Autodiff` module to fix critical JVP correctness issues, enable higher-order derivatives (nested gradients), and introduce `vjp` as a first-class primitive.
- Fix pointer-based hashing in autodiff, correcting nested JVP handler behavior.
- Add autodiff support for `as_strided`, enabling gradients through slicing and indexing operations
- Add autodiff support for `cummax` and `cummin` cumulative operations
- Add autodiff support for FFT operations
- Add autodiff support for some linear algebra operations: QR decomposition (`qr`), Cholesky decomposition (`cholesky`), and triangular solve (`triangular_solve`).
### Kaun
- Simplify and redesign the core API for better discoverability and composability. Layers, optimizers, and training utilities now follow consistent patterns and compose more naturally.
- Add `Fn` module with `conv1d`, `conv2d`, `max_pool`, `avg_pool` — neural network operations that were previously in Nx now live here with a cleaner, more focused API.
- Redesign datasets and HuggingFace integration with simpler, more composable APIs.
- Remove `kaun-models` library. Pre-built models now live in examples.
- Reinitialize dataset each epoch to avoid iterator exhaustion (#147, @Shocker444, @tmattio)
### kaun-board (new)
TUI dashboard for monitoring training runs in the terminal. Displays live metrics, loss curves, and system stats. Extracted from kaun's console module into a standalone package. (#166, #167, #170, @Arsalaan-Alam)
### Brot
- Rename the library from saga to brot.
- Simplify brot to a tokenization-only library. Remove the sampler, n-gram models, and I/O utilities. The sampler is rewritten with nx tensors and moved to `dev/mimir` as the seed of an experimental inference engine.
- Merge `brot.tokenizers` sub-library into `brot`.
- Remove dependency on Nx.
- Use `Buffer.add_substring` instead of char-by-char loop in whitespace pre-tokenizer.
- Compact BPE symbols in-place after merges, avoiding an intermediate array allocation.
- Replace list cons + reverse with forward `List.init` in BPE `word_to_tokens`.
- Use pre-allocated arrays with `Array.blit` instead of `Array.append` in encoding merge and padding, halving per-field allocations.
- Avoid allocating an unused `words` array in post-processor encoding conversion.
- Reduce WordPiece substring allocations from O(n²) to O(n) per word by building the prefixed candidate string once per position.
- Add `encode_ids` fast path that bypasses `Encoding.t` construction entirely when only token IDs are needed.
- Add ASCII property table for O(1) character classification in pre-tokenizers, replacing O(log n) binary search for `is_alphabetic` (600 ranges), `is_numeric` (230 ranges), and `is_whitespace` (10 ranges). Yields 12-27% speedup on encode benchmarks with ~30% allocation reduction.
- Add inline ASCII fast paths in all pre-tokenizer loops, skipping UTF-8 decoding and using `Buffer.add_char` instead of `String.sub` for single-byte characters. Combined with the property table, yields 20-30% total speedup and 36-55% allocation reduction vs baseline.
- Parallelize batch encoding with OCaml 5 domains.
- Optimize BPE merge loop with open-addressing hash, flat arrays, and shift-based heap.
- Add trie-based WordPiece lookup and normalizer fast path.
- Remove dependency on `str` library.
- Generate unicode data offline, removing runtime dependency on `uucp`.
- Remove unused `Grapheme` module. Grapheme cluster segmentation is not needed for tokenization.
- Remove `uutf` dependency in favour of OCaml `Stdlib` unicode support.
### Fehu
- Simplify and redesign the core API. Environments and training utilities now follow consistent functional patterns that are easier to use and compose.
- Remove `fehu.algorithms` — fehu now only depends on rune, and users bring their own algorithms. Examples provided for well-known RL algorithms like DQN and REINFORCE.
### Sowilo
- Cleaner public API — internal implementation split into focused submodules while the public surface stays small.
- Faster grayscale conversion, edge detection, and gaussian blur.
### Quill
Rewritten from the ground up. Terminal UI with syntax highlighting, code completion, and a compact single-line footer. Web frontend via `quill serve` with a CodeMirror 6 editor, WebSocket-based execution, autocompletion, and diagnostics. Markdown notebook format shared across both interfaces.
Interactive REPL: `quill` with no file argument launches a toplevel with syntax highlighting, tab completion, persistent history, smart phrase-aware submission, and piped mode.
### Hugin
Rewritten from the ground up with a declarative, composable API. Plots are
built by combining inert mark descriptions (`line`, `point`, `bar`, `hist`,
`heatmap`, `contour`, `errorbar`, etc.) with `layers`, decorating them
(`title`, `xlabel`, `legend`, etc.), and laying them out (`grid`, `hstack`,
`vstack`). A compilation pass resolves data to a Scene IR that separate
backends render.
- New declarative specification API replacing the imperative figure/axes/artist
architecture. Marks compose with `layers`, decorations chain functionally,
and grid layouts nest arbitrarily.
- **ucairo** — Minimal Cairo FFI bindings (36 C stubs) replacing the `cairo2`
opam dependency.
- Dual-backend rendering: Cairo (PNG, PDF, interactive SDL window) and SVG from
a shared Scene IR.
- OKLCH perceptual color space with `Color.oklch`, `Color.hex`, named CSS
colors, and alpha support.
- Curated colormaps (`Cmap.viridis`, `plasma`, `inferno`, `magma`, `cividis`,
`turbo`, `coolwarm`, `spectral`).
- Theme system with `light`, `dark`, and `minimal` presets.
- Linear, log, and symlog axis scaling with automatic tick generation.
- Legend placement with configurable location and multi-column layout.
- Interactive `show` with SDL window resizing, Escape/Q to close.
- Rewritten examples and documentation.
### Talon
- Remove `jsont`, `bytesrw`, and `csv` dependencies from Talon. CSV support is now built-in via the `talon.csv` sub-library with a minimal RFC 4180 parser.
- Remove `talon.json` sub-library.
## [1.0.0~alpha2] - 2025-11-03
We're excited to announce the release of Raven 1.0.0~alpha2! Less than a month after alpha1, this release notably includes contributions from Outreachy applicants in preparation for the upcoming _two_ internships.
Some highlights from this release include:
- NumPy-compatible text I/O with `Nx_io.{save,load}_text`
- Lots of new functions in Nx/Rune, including neural-net ones `dropout`, `log_softmax`, `batch_norm`, `layer_norm`, and activation functions like `celu` and `celu`, and generic ones like `conjugate`, `index_put`, and more.
- Addition of `.top` libraries for `nx`, `rune`, and `hugin` that auto-install pretty-printers in the OCaml toplevel. You can run e.g. `#require "nx.top"`.
- Addition of a visualization API in Fehu via the new `fehu.visualize` library, supporting video recording.
- Redesign of Kaun core datastructure and checkpointing subsystem for complete snapshotting.
- Many, many bug fixes and correctness improvements.
We've also made numerous performance improvements across the board:
- Nx elementwise ops: 5–50× faster (e.g., Add 50×50 f32 88.81 µs → 1.83 µs, **48×**; Mul 100×100 f32 78.51 µs → 2.41 µs, **33×**).
- Nx conv2d: **4–5×** faster on common shapes; up to **115×** on heavy f64 batched cases (e.g., B16 C64→128 16×16 K3 f64 1.61 s → 13.96 ms).
- Rune autodiff: **1.2–3.7×** faster on core grads (e.g., MatMulGrad Medium 34.04 ms → 11.91 ms, **2.86×**; Large 190.19 ms → 50.97 ms, **3.73×**).
- Talon dataframes: big wins in joins and group-bys (Join 805.35 ms → 26.10 ms, **31×**; Group-by 170.80 ms → 19.03 ms, **9×**; Filter 9.93 ms → 3.39 ms, **3×**).
- Brot tokenizers: realistic workloads **4–17%** faster (e.g., WordPiece encode single 136.05 µs → 115.92 µs, **1.17×**; BPE batch_32 24.52 ms → 22.27 ms, **1.10×**)
We're closing 8 user-reported issues or feature requests and are totalling 30 community contributions from 8 unique contributors.
### Nx
- Fix einsum output axis ordering for free axes (e.g., `i,jk->jki`, `ij,klj->kli`) by correcting final transpose permutation and intermediate left-axis reordering.
- Add `Nx_io.Cache_dir` module with consolidated cache directory utilities respecting `RAVEN_CACHE_ROOT`, `XDG_CACHE_HOME`, and `HOME` fallback, replacing project-specific cache logic across the whole raven ecosystem (#134, @Arsalaan-Alam)
- Add `Nx_io.save_txt` / `Nx_io.load_txt` with NumPy-compatible formatting, comments, and dtype support (#120, @six-shot)
- Optimize `multi_dot` for matrix chains, reducing intermediate allocations and improving performance
- Add public `index_put` function for indexed updates
- Clarify `reshape` documentation to match its view-only semantics
- Provide `nx.top`, `rune.top`, and `hugin.top` libraries that auto-install pretty printers in the OCaml toplevel and update Quill to load them
- Add `ifill` for explicit in-place fills and make `fill` return a copied tensor
- Speed up contiguous elementwise ops via vectorized loops
- Fast-path contiguous single-axis reductions to avoid iterator fallback
- Speed up float reductions with contiguous multi-axis fast paths
- Fast-path padding-free `unfold` to lower conv2d overhead
- Move neural-network operations (softmax, log_softmax, relu, gelu, silu, sigmoid, tanh) from Kaun to Nx
- Add public `conjugate` function for complex number conjugation (#125, @Arsalaan-Alam)
- Fix complex vdot to conjugate first tensor before multiplication, ensuring correct mathematical behavior (#123, @Arsalaan-Alam)
- Update comparison and conditional operations to use boolean tensors (#115, @nirnayroy)
- Add support for rcond parameter and underdetermined systems to `lstsq` (#102, @Shocker444)
- Fix `matrix_rank`/`pinv` Hermitian fast paths to use eigen-decomposition and match NumPy for complex inputs (#96, @six-shot, @tmattio)
- Optimize matmul BLAS dispatch for strided tensors, improving matrix multiplication performance
- Fix slow builds reported since alpha1 (#88, @tmattio)
- Fix macOS ARM crash when loading extended bigarray kinds
- Add float16 and bfloat16 support to safetensors I/O, including precise conversions that preserve denormals/NaNs (#84, @six-shot, @tmattio)
- Refined `View` internals for leaner contiguity checks and stride handling, cutting redundant materialization on hot paths
- Merge `Lazy_view` into the core `View` API so movement ops operate on a single composed view
- Documented the reworked `View` interface
- Documented the `Symbolic_shape` interface
- Added Accelerate framework flag when compiling on macOS, fixing issues in some environments (#129, @nirnayroy)
### Hugin
- Fix random `SIGBUS`/bus errors on macOS when closing `Hugin.show` windows by
destroying SDL windows with the correct pointer in the finalizer.
- Let `Hugin.show` windows close cleanly via the window button or `Esc`/`q`, avoiding frozen macOS REPL sessions
### Rune
- Add `Rune.no_grad` and `Rune.detach` to mirror JAX stop-gradient semantics
- Improve gradient performance slightly by replace the reverse-mode tape's linear PhysicalTbl with an identity hash table
- Fix `Rune.Rng.shuffle` flattening outputs for multi-dimensional tensors; the
shuffle now gathers along axis 0 and keeps shapes intact
- Replace `Rune.Rng.truncated_normal` clipping with rejection sampling so
samples stay inside the requested interval without boundary spikes
- Add support for categorical sampling with `Rune.Rng.categorical` (#89, @nirnayroy)
- Allow plain `llvm-config` in discovery, fixing build in some platforms (#71, @stepbrobd)
### Kaun
- Added Similarity and Polysemy analysis to the BERT example (#137, @nirnayroy)
- Support attention masks via the new `Kaun.Attention` module
- Support loading sharded Hugging Face safetensors
- Fix BERT and GPT‑2 model loading
- API simplification: removed type parameters from public types; `Ptree` now supports mixed‑dtype trees via packed tensors with typed getters.
- Checkpointing overhaul: versioned `Train_state` with schema tagging, explicit `Checkpoint.{Snapshot,Artifact,Manifest,Repository}` (retention, tags, metadata), and simple save/load helpers for snapshots and params.
- Overhaul dataset combinators: derive tensor specs from Rune dtype, fix sampling/window bugs, validate weighted sampling, and respect `drop_remainder`
- Make dataset `prefetch` truly asynchronous with background domains and allow reusing an external Domainslib pool via `parallel_map ~pool`
- Use `Dataset.iter` for epoch batches to reduce overhead
- Update BERT and GPT-2 tokenizer cache to use `Nx.Cache` for consistent cache directory resolution (#134, @Arsalaan-Alam)
- Honor text dataset encodings via incremental Uutf decoding (#122, @Satarupa22-SD).
- Preserve empty sequential modules when unflattening so indices stay aligned for checkpoint round-tripping
- Prevent `Training.fit`/`evaluate` from consuming entire datasets eagerly and fail fast when a dataset yields no batches, avoiding hangs and division-by-zero crashes
- Allow metric history to tolerate metrics that appear or disappear between epochs so dynamic metric sets no longer raise during training
- Make `Optimizer.clip_by_global_norm` robust to zero gradients and empty parameter trees to avoid NaNs during training
- Split CSV loader into `from_csv` and `from_csv_with_labels` to retain labels when requested (#114, @Satarupa22-SD)
- Implement AUC-ROC and AUC-PR in Kaun metrics and simplify their signatures (#124, #131, @Shocker444)
- Add mean absolute percentage error, explained variance, R² (with optional adjustment), KL-divergence, and top-k accuracy to Kaun metrics
- Add NDCG, MAP, and MRR ranking metrics to Kaun metrics
- Add BLEU, ROUGE, and METEOR metrics to Kaun for pre-tokenized sequences, removing tokenizer dependencies
- Add SSIM, IoU, and Dice metrics for vision workloads in Kaun
### Talon
- Remove automatic sentinel-based null detection for numeric columns; explicit masks (via [_opt] constructors) now define missing data semantics
- Replace join nested loops with hashed join indices, cutting lookup from O(n·m) to near O(n)
- Reuse a shared Nx-based column reindexer so filter/sample paths avoid repeated array copies
- Fix `fillna` to honor column null masks and replacements, restoring expected nullable semantics
- Preserve null masks when reindexing during joins so sentinel values remain valid data
- Handle numeric index columns in `pivot`, preventing distinct keys from collapsing into a single bucket
- Respect null masks when serializing numeric columns to JSON, emitting JSON `null` instead of sentinel values
- Detect big integers as int64 in Talon CSV loader (#121, @Arsalaan-Alam)
- Allow forcing column types in Talon JSON loader (#104, @nirnayroy)
- Add documentation to compare Talon and Pandas (#154, Satarupa22-SD)
### Saga
- Remove legacy `Normalizers.nmt` and `Normalizers.precompiled` constructors (and their JSON serializers) so the public surface only advertises supported normalizers
- Tighten template processor JSON parsing: require integer type ids, drop the legacy special-token list format, and ensure multi-id special tokens round-trip with the new record fields
- Make tokenizer JSON loading tolerant of HuggingFace quirks (missing `model.type`, string-encoded merges), restoring compatibility with upstream `tokenizer.json` files
- Cache byte-level encode/decode lookup tables to avoid rebuilding them during tokenization, trimming avoidable allocations
- Skip BPE dropout sampling when dropout is disabled, removing redundant RNG work on common hot paths
- Fix Unigram tokenization so longest matches are emitted without aborting the sequence when a vocab hit occurs
- Recompute pad token ids when the pad special string changes, preventing padding with stale ids
- Fix Unigram `token_to_id`/`id_to_token` vocabulary lookups (#117, @RidwanAdebosin)
- Optimize `Pre_tokenizers.whitespace` to reduce allocations and improve tokenization performance
- Simplify tokenizers interface
### Sowilo
- Add `resize` (nearest & bilinear) that works for 2D, batched, and NHWC tensors
- Update grayscale conversion and RGB/BGR channel swaps to run entirely on Rune ops, keeping batched inputs compatible with JIT backends
- Make `median_blur` compute the true median so salt-and-pepper noise is removed as expected
- Fix `erode`/`dilate` so custom structuring elements (e.g. cross vs. square) and batched tensors produce the correct morphology result
### Fehu
- Added snapshot-based save/load for DQN and REINFORCE agents (#127, @RidwanAdebosin, @tmattio)
- Added typed `Render` payloads with enforced `render_mode` selection in `Env.create`, auto human-mode rendering, and vectorized `Env.render` accessors so environments consistently expose frames for downstream tooling
- Introduced the `Fehu_visualize` library with ffmpeg/gif/W&B sinks, overlay combinators, rollout/evaluation recorders, and video wrappers for single and vectorized environments, providing a cohesive visualization stack for Fehu
- Added a `Fehu.Policy` helper module (random/deterministic/greedy) and sink `with_*` guards so visualization sinks handle directory creation and cleanup automatically
- Added `Buffer.Replay.sample_tensors` to streamline batched training loops and exploration handling
- Reworked `Fehu_algorithms.Dqn` around `init`/`step`/`train` primitives with functional state, warmup control, and snapshotting helpers
- Rebuilt `Fehu_algorithms.Reinforce` on the same `init`/`step`/`train` interface with optional baselines, tensor-based rollouts, snapshot save/load, and updated tests/examples/docs using the new workflow
- Upgraded the GridWorld environment to return ANSI and RGB-array frames using the new render types, and updated the DQN example to optionally record pre- and post-training rollouts via `FEHU_DQN_RECORD_DIR` using `Fehu_visualize` sinks
- Reworked space sampling to return `(value, next_rng)` and split keys internally, fixing correlated draws in Box/Multi-discrete/Tuple/Dict/Sequence/Text samplers while adding `Space.boundary_values` for deterministic compatibility checks
- Extended vectorized environments to reuse space boundary probes and now store structured `final_observation` payloads in `Info`, improving downstream consumption
- Added `Buffer.Replay.add_many` and `Buffer.Replay.sample_arrays`, preserved backing storage on `clear`, and exposed struct-of-arrays batches for vectorised learners
- Tightened `Env.create` diagnostics with contextual error messages and an optional `~validate_transition` hook for custom invariants
- Enriched `Wrapper` utilities with `map_info`, Box `clip_action`/`clip_observation`, and time-limit info reporting elapsed steps
- Upgraded `Info` values to carry int/float/bool arrays with stable JSON round-tripping (handling NaN/∞) and sorted metadata serialization for deterministic diffs
- Improved training helpers: Welford-based normalization with optional unbiased variance, documented `done = terminated || truncated`, and returned `nan` when explained variance is undefined
- Treat time-limit truncations as terminals when computing rollout advantages and expose the `truncated` flag in buffer steps
- Require callers of `Training.compute_gae` to pass final bootstrapping values and ensure `Training.evaluate` feeds the current observation to policies
- Allow `Space.Sequence.create` to omit `max_length`, keeping sequences unbounded above while preserving validation and sampling semantics
- Validate vectorized environments by round-tripping sample actions/observations across every instance, preventing incompatible spaces from slipping through
- Finish clipped value loss support in Fehu.Training (#119, @nirnayroy)
### Nx-datasets
- Migrate to `Nx.Cache` for cache directory resolution, enabling consistent behavior. (#133, @Arsalaan-Alam)
- Fix cache directory resolution to respect `RAVEN_CACHE_ROOT` (or fall back to `XDG_CACHE_HOME`/`HOME`), allowing custom cache locations. (#128, @Arsalaan-Alam)
- Switch CIFAR-10 loader to the binary archive so parsing succeeds again
- Add a CIFAR-10 example
- Standardize dataset examples on `Logs`
- Use `Logs` for dataset loader logging (#95, @Satarupa22-SD)
## [1.0.0~alpha1] - 2025-10-02
This release expands the Raven ecosystem with three new libraries (Talon, Saga, Fehu) and significant enhancements to existing ones. `alpha1` focuses on breadth—adding foundational capabilities across data processing, NLP, and reinforcement learning—while continuing to iterate on core infrastructure.
### New Libraries
#### Talon - DataFrame Processing
We've added Talon, a new DataFrame library inspired by pandas and polars:
- Columnar data structures that support mixed types (integers, floats, strings, etc.) within a single table (aka heterogeneous datasets)
- Operations: filter rows, group by columns, join tables, compute aggregates
- Load and save data in CSV and JSON formats
- Seamless conversion to/from Nx arrays for numerical operations
#### Saga - NLP & Text Processing
Saga is a new text processing library for building language models. It provides:
- Tokenizers: Byte-pair encoding (BPE), WordPiece subword tokenization, and character-level splitting
- Text generation: Control output with temperature scaling, top-k filtering, nucleus (top-p) sampling, and custom sampling strategies
- Language models: Train and generate text with statistical n-gram models (bigrams, trigrams, etc.)
- I/O: Read large text files line-by-line and batch-process corpora
#### Fehu - Reinforcement Learning
Fehu brings reinforcement learning to Raven, with an API inspired by Gymnasium and Stable-Baselines3:
- Standard RL environment interface (reset, step, render) with example environments like Random Walk and CartPole
- Environment wrappers to modify observations, rewards, or episode termination conditions
- Vectorized environments to collect experience from multiple parallel rollouts
- Training utilities: Generalized advantage estimation (GAE), trajectory collection and management
- RL algorithms: Policy gradient method (REINFORCE), deep Q-learning (DQN) with replay buffer
- Use Kaun neural networks as function approximators for policies and value functions
### Major Enhancements
#### Nx - Array Computing
We've significantly expanded Nx's following early user feedback from alpha0:
- Complete linear algebra suite: LAPACK-backed operations matching NumPy including singular value decomposition (SVD), QR factorization, Cholesky decomposition, eigenvalue/eigenvector computation, matrix inverse, and solving linear systems
- FFT operations: Fast Fourier transforms (FFT/IFFT) for frequency domain analysis and signal processing
- Advanced operations: Einstein summation notation (`einsum`) for complex tensor operations, extract/construct diagonal matrices (`diag`), cumulative sums and products along axes
- Extended dtypes: Machine learning-focused types including bfloat16 (brain floating point), complex16, and float8 for reduced-precision training
- Symbolic shapes: Internal infrastructure for symbolic shape inference to enable dynamic shapes in future releases (not yet exposed in public API)
- Lazy views: Array views only copy and reorder memory when stride patterns require it, avoiding unnecessary allocations
#### Rune - Autodiff & JIT
We've continued iterating on Rune's autodiff capabilities, and made progress on upcoming features:
- Forward-mode AD: Compute Jacobian-vector products (`jvp`) for forward-mode automatic differentiation, complementing existing reverse-mode
- JIT: Ongoing development of LLVM-based just-in-time compilation for Rune computations (currently in prototype stage)
- vmap: Experimental support for vectorized mapping to automatically batch operations (work-in-progress, not yet stable)
- LLVM backend: Added compilation backend with support for LLVM versions 19, 20, and 21
- Metal backend: Continued work on GPU acceleration for macOS using Metal compute shaders
#### Kaun - Deep Learning
We've expanded Kaun with high-level APIs for deep learning. These APIs are inspired by popular Python frameworks like TensorFlow, PyTorch, and Flax, and should feel familiar to users building models in Python:
- High-level training: Keras-style `fit()` function to train models with automatic batching, gradient computation, and parameter updates
- Training state: Encapsulated training state (TrainState) holding parameters, optimizer state, and step count; automatic history tracking of loss and metrics
- Checkpoints: Save and load model weights to disk for model persistence and transfer learning
- Metrics: Automatic metric computation during training including accuracy, precision, recall, F1 score, mean absolute error (MAE), and mean squared error (MSE)
- Data pipeline: Composable dataset operations (map, filter, batch, shuffle, cache) inspired by TensorFlow's `tf.data` for building input pipelines
- Model zoo: Reference implementations of classic and modern architectures (LeNet5 for basic CNNs, BERT for masked language modeling, GPT2 for autoregressive generation) including reusable transformer components
- Ecosystem integration: Load HuggingFace model architectures (`kaun.huggingface`), access common datasets like MNIST and CIFAR-10 (`kaun.datasets`), and use standardized model definitions (`kaun.models`)
### Contributors
Thanks to everyone who contributed to this release:
- @adamchol (Adam Cholewi) - Implemented the initial `associative_scan` native backend operation for cumulative operations
- @akshay-gulab (Akshay Gulabrao)
- @dhruvmakwana (Dhruv Makwana) - Implemented `einsum` for Einstein summation notation
- @gabyfle (Gabriel Santamaria) - Built PocketFFT bindings that replaced our custom FFT kernels
- @lukstafi (Lukasz Stafiniak) - Major contributions to Fehu and FunOCaml workshop on training Sokoban agents
- @nickbetteridge
- @sidkshatriya (Sidharth Kshatriya)
## [1.0.0~alpha0] - 2025-07-05
### Initial Alpha Release
We're excited to release the zeroth alpha of Raven, an OCaml machine learning ecosystem bringing modern scientific computing to OCaml.
### Added
#### Core Libraries
- **Nx** - N-dimensional array library with NumPy-like API
- Multi-dimensional tensors with support for several data types.
- Zero-copy operations: slicing, reshaping, broadcasting
- Element-wise and linear algebra operations
- Swappable backends: Native OCaml, C, Metal
- I/O support for images (PNG, JPEG) and NumPy files (.npy, .npz)
- **Hugin** - Publication-quality plotting library
- 2D plots: line, scatter, bar, histogram, step, error bars, fill-between
- 3D plots: line3d, scatter3d
- Image visualization: imshow, matshow
- Contour plots with customizable levels
- Text annotations and legends
- **Quill** - Interactive notebook environment
- Markdown-based notebooks with live formatting
- OCaml code execution with persistent session state
- Integrated data visualization via Hugin
- Web server mode for browser-based editing
#### ML/AI Components
- **Rune** - Automatic differentiation and JIT compilation framework
- Reverse-mode automatic differentiation
- Functional API for pure computations
- Basic JIT infrastructure (in development)
- **Kaun** - Deep learning framework (experimental)
- Flax-inspired functional API
- Basic neural network components
- Example implementations for XOR and MNIST
- **Sowilo** - Computer vision library
- Image manipulation: flip, crop, color conversions
- Filtering: gaussian_blur, median_blur
- Morphological operations and edge detection
#### Supporting Libraries
- **Nx-datasets** - Common ML datasets (MNIST, Iris, California Housing)
- **Nx-text** - Text processing and tokenization utilities
### Known Issues
This is an alpha release with several limitations:
- Quill editor has UI bugs being addressed
- APIs may change significantly before stable release
### Contributors
Initial development by the Raven team. Special thanks to all early testers and contributors.
@axrwl
@gabyfle
@hesterjeng
@ghennequin
@blueavee
And to our early sponsors:
@daemonfire300
@gabyfle
@sabine
[1.0.0~alpha0]: https://github.com/raven-ocaml/raven/releases/tag/v1.0.0~alpha0
[1.0.0~alpha1]: https://github.com/raven-ocaml/raven/releases/tag/v1.0.0~alpha1
[1.0.0~alpha2]: https://github.com/raven-ocaml/raven/releases/tag/v1.0.0~alpha2
================================================
FILE: CONTRIBUTING.md
================================================
# Contributing to Raven
## Documentation Style
### Overview
This guide establishes documentation conventions for the raven. We follow the Unix philosophy: terse, precise, no fluff. Document contracts and invariants, not implementation details.
### General Principles
1. **Be imperative and active** - "Creates tensor" not "This function creates a tensor"
2. **Document invariants, not implementation** - What must be true, not how it works
3. **Mention performance only when surprising** - O(1) views vs O(n) copies
4. **No redundant information** - If it's obvious from the type, don't repeat it
### Documentation Template
```ocaml
val zeros : ('a, 'b) dtype -> int array -> ('a, 'b) t
(** [zeros dtype shape] creates zero-filled tensor. (* <-- function application pattern *)
Extended description if needed. State invariants. (* <-- optional extended info *)
@raise Exception_name if [condition] (* <-- exceptions *)
Example creating a 2x3 matrix of zeros: (* <-- example with description *)
{[
let t = Nx.zeros Nx.float32 [|2; 3|] in
Nx.to_array t = [|0.; 0.; 0.; 0.; 0.; 0.|]
]} *)
```
### Formatting Conventions
#### Code References
- Use `[code]` for inline code: parameter names, function names, expressions
- Use `{[ ... ]}` for code blocks
- No backticks - this is odoc, not Markdown
#### First Line
Always start with: `[function_name arg1 arg2] does X`
Not: "Creates a tensor with..." or "This function..."
#### Mathematical Notation
- Use ASCII: `a * b`, not `a × b`
- Use `x^2` or `x ** 2` for powers
- Use `[start, stop)` for half-open intervals
### What to Document
✓ **Invariants and preconditions**: "Length of [data] must equal product of [shape]."
✓ **Surprising performance**: "Returns view if possible (O(1)), otherwise copies (O(n))."
✓ **Shape transformations**: "Result has shape [|m; n|] where m = length of [a]."
✗ **Not**: obvious information, implementation details, or redundant parameter descriptions
### Code Examples
Must be valid, compilable OCaml:
- Use qualified names (`Nx.function` not `open Nx`)
- Show expected results with `=`
- Each example in its own `{[ ... ]}` block with a description before it
- Self-contained (independently executable)
### Examples
#### Function with Constraints
```ocaml
val arange : ('a, 'b) dtype -> int -> int -> int -> ('a, 'b) t
(** [arange dtype start stop step] generates values from [start] to [stop).
Step must be non-zero. Result length is [(stop - start) / step] rounded
toward zero.
@raise Failure if [step = 0]
Generating even numbers from 0 to 10:
{[
let t1 = Nx.arange Nx.int32 0 10 2 in
Nx.to_array t1 = [|0l; 2l; 4l; 6l; 8l|]
]} *)
```
#### Function with Multiple Behaviors
```ocaml
val dot : ('a, 'b) t -> ('a, 'b) t -> ('a, 'b) t
(** [dot a b] computes generalized dot product.
For 1-D tensors, returns inner product (scalar). For 2-D, performs
matrix multiplication. Otherwise, contracts last axis of [a] with
second-last of [b].
@raise Invalid_argument if contraction axes have different sizes
Computing inner product of two vectors:
{[
let v1 = Nx.of_array Nx.float32 [|1.; 2.|] in
let v2 = Nx.of_array Nx.float32 [|3.; 4.|] in
let scalar = Nx.dot v1 v2 in
Nx.to_scalar scalar = 11.
]} *)
```
#### Optional Parameters
```ocaml
val sum : ?axes:int array -> ?keepdims:bool -> ('a, 'b) t -> ('a, 'b) t
(** [sum ?axes ?keepdims t] sums elements along specified axes.
Default sums all axes. If [keepdims] is true, retains reduced
dimensions with size 1.
@raise Invalid_argument if any axis is out of bounds
Summing all elements:
{[
let t = Nx.of_array Nx.float32 ~shape:[|2; 2|] [|1.; 2.; 3.; 4.|] in
Nx.to_scalar (Nx.sum t) = 10.
]}
Summing along rows (axis 0):
{[
let t = Nx.of_array Nx.float32 ~shape:[|2; 2|] [|1.; 2.; 3.; 4.|] in
let sum_axis0 = Nx.sum ~axes:[|0|] t in
Nx.to_array sum_axis0 = [|4.; 6.|]
]} *)
```
### Special Documentation Cases
**Broadcasting**: Always explain compatibility rules
```ocaml
(** [add t1 t2] computes element-wise sum with broadcasting.
Shapes must be broadcast-compatible: each dimension must be equal
or one of them must be 1. *)
```
**Memory behavior**: Be explicit about views vs copies
```ocaml
(** [transpose t] returns view with swapped axes (no copy). *)
(** [flatten t] returns new 1-D tensor (always copies). *)
(** [reshape shape t] returns view if possible, otherwise copies. *)
```
**Complex shapes**: Use examples to clarify
```ocaml
(** [stack axis tensors] stacks along new axis at position [axis].
All tensors must have identical shape. Result has rank + 1.
Stacking two 2x2 matrices along a new first axis:
{[
let t1 = Nx.of_array Nx.int32 ~shape:[|2; 2|] [|1l; 2l; 3l; 4l|] in
let t2 = Nx.of_array Nx.int32 ~shape:[|2; 2|] [|5l; 6l; 7l; 8l|] in
let stacked = Nx.stack ~axis:0 [t1; t2] in
Nx.shape stacked = [|2; 2; 2|] &&
Nx.to_array stacked = [|1l; 2l; 3l; 4l; 5l; 6l; 7l; 8l|]
]} *)
```
### Module-level Documentation
```ocaml
(** N-dimensional array operations.
This module provides NumPy-style tensor operations for OCaml.
Tensors are immutable views over mutable buffers, supporting
broadcasting, slicing, and efficient memory layout transformations.
{1 Creating Tensors}
Use {!create}, {!zeros}, {!ones}, or {!arange} to construct tensors... *)
```
Remember: If the Unix manual wouldn't say it, neither should we.
## Error Message
### Format
```
operation: cannot <action> <from> to <to> (<specific problem>)
hint: <guidance>
```
All lowercase except dtypes. Hints are optional.
**Alternative formats when needed:**
```
operation: invalid <thing> (<specific problem>)
operation: <what failed> (<specific problem>)
```
### Examples
```
reshape: cannot reshape [10,10] to [12,10] (100→120 elements)
broadcast: cannot broadcast [2,3] with [4,5] (dim 0: 2≠4, dim 1: 3≠5)
hint: broadcasting requires dimensions to be either equal or 1
empty: invalid shape [-1, 10] (negative dimension)
matmul: cannot multiply Float32 @ Int64 (dtype mismatch)
hint: cast one array to match the other's dtype
```
### Rules
#### Always include:
- **Operation name** - what function failed
- **Full context** - complete shapes, not just sizes
- **Specific problem** - which dimension/axis failed and why
#### Structure consistently:
- For transformations: `[10,10] to [12,10]`
- For operations: `[2,3] with [4,5]`
- For access: `[5,2] in shape [3,4]`
- For invalid inputs: `invalid X (reason)`
#### Make problems obvious:
- Show comparisons: `2≠4`, `5≥3`, `100→120`
- Point to location: `dim 0:`, `axis 1:`
- State violations: `axis 2 repeated`, `multiple -1`
#### Multiple issues:
```
conv2d: invalid configuration
- input channels: 3 ≠ 5 (weight expects 5)
- kernel [6,6] > input [5,5] with 'valid' padding
```
#### Add hints when:
- The fix is non-obvious
- There's a specific function to call
- The rule isn't clear from context
- Backend limitations exist
### Special Cases
**Performance warnings:**
```
reshape: requires copy from strided view [100,10] to [1000]
hint: call contiguous() first to avoid copy
```
**Empty/scalar edge cases:**
```
squeeze: cannot squeeze scalar (already rank 0)
argmax: empty axis returns no indices (size 0)
```
**Backend limitations:**
```
gather: indices dtype Int64 not supported (backend uses Int32)
hint: cast indices to Int32
```
### Common Patterns
**Shape changes:**
```
reshape: cannot reshape [2,5,10] to [4,26] (100→104 elements)
```
**Invalid access:**
```
slice: cannot slice [(0,5), (2,12)] in shape [10,10] (axis 1: 12>10)
```
**Type/value errors:**
```
pad: invalid padding [-1, 2] (negative values)
hint: use shrink() to remove elements
```
**Configuration errors:**
```
permute: invalid axes [0,2,2] (axis 2 repeated)
arange: invalid range [10, 5, 1] (start > stop with positive step)
```
### Don'ts
❌ Vague errors: `invalid shape`
❌ Missing context: `100 != 120`
❌ Redundant hints: `shapes must be compatible (incompatible shapes)`
❌ Teaching basics: `broadcasting requires...` (save for hints)
### Summary
Show exactly what they tried, what failed, and where. Use the standard format when possible, adapt when needed. Include hints only when they add value.
================================================
FILE: LICENSE
================================================
ISC License
Copyright (c) 2025, Thibaut Mattio
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
================================================
FILE: README.md
================================================
<p align="center">
<img src="www/site/raven.svg" width="80" alt="raven">
</p>
<h3 align="center">modern scientific computing for OCaml</h3>
<p align="center">
<a href="https://raven-ml.dev/docs/">docs</a> ·
<a href="https://raven-ml.dev/docs/installation/">install</a> ·
<a href="https://github.com/raven-ml/raven/issues">issues</a>
</p>
---
Raven is an ecosystem of OCaml libraries for numerical computing, machine learning, and data science. Everything you know from Python — NumPy, JAX, PyTorch, Matplotlib, Jupyter — rebuilt with type safety.
> Raven is **alpha**. APIs will change. [Feedback welcome.](https://github.com/raven-ml/raven/issues)
```ocaml
(* nx — n-dimensional arrays *)
let x = Nx.linspace float32 0. 10. 100
let y = Nx.sin x
(* rune — automatic differentiation *)
let grad_f = Rune.grad (fun x -> Rune.sum (Rune.mul x x)) x
(* brot — tokenization *)
let tokenizer = Brot.from_file "tokenizer.json" |> Result.get_ok
let ids = Brot.encode_ids tokenizer "The meaning of life is"
(* kaun — neural networks *)
let model = Kaun.Layer.sequential [
Kaun.Layer.linear ~in_features:768 ~out_features:128 ();
Kaun.Layer.relu ();
Kaun.Layer.linear ~in_features:128 ~out_features:10 ();
]
(* talon — dataframes *)
let df = Talon.create [
"name", Talon.Col.string_list [ "Alice"; "Bob"; "Charlie" ];
"score", Talon.Col.float64_list [ 85.5; 92.0; 78.5 ];
]
(* hugin — plotting *)
let () = Hugin.(figure () |> subplot |> Plotting.plot ~x ~y |> ignore; show ())
```
## Packages
| | Package | Like | What it does |
| --- | ------------------------------ | ----------------- | -------------------------------------------------------- |
| | [**nx**](packages/nx/) | NumPy | N-dimensional arrays with linear algebra operations |
| ᛏ | [**tolk**](packages/tolk/) | tinygrad | Minimal ML compiler for GPU tensor computation |
| ᚱ | [**rune**](packages/rune/) | JAX | Automatic differentiation and functional transformations |
| ᚲ | [**kaun**](packages/kaun/) | Flax | Neural networks and training |
| ᚹ | [**vega**](packages/vega/) | Optax | Composable gradient-based optimizers |
| ᚾ | [**norn**](packages/norn/) | BlackJAX | MCMC sampling with automatic gradients |
| ᚨ | [**brot**](packages/brot/) | HF Tokenizers | Fast, HuggingFace-compatible tokenization |
| ᛃ | [**talon**](packages/talon/) | Polars | Fast and elegant dataframes with type-safe operations |
| ᛞ | [**hugin**](packages/hugin/) | Matplotlib | Publication-quality plotting |
| ᛈ | [**quill**](packages/quill/) | Jupyter + IPython | Interactive REPL and markdown notebooks |
| ᚠ | [**fehu**](packages/fehu/) | Gymnasium | Reinforcement learning environments |
| ᛋ | [**sowilo**](packages/sowilo/) | OpenCV | Differentiable computer vision |
| ᛗ | [**munin**](packages/munin/) | W&B / MLFlow | Local experiment tracking with live TUI dashboard |
## Getting started
```bash
opam install raven
```
This installs the full ecosystem. You can also install only what you need — e.g. `opam install kaun` for neural networks, or `opam install nx` for just arrays.
Add to your `dune` file:
```dune
(executable
(name main)
(libraries raven))
```
See the [installation guide](https://raven-ml.dev/docs/installation/) for system dependencies and editor setup.
## Support
Building a scientific computing ecosystem takes sustained effort. Sponsorships help us ship JIT compilation, distributed training, better developer tooling, and production deployment through MirageOS.
**[Support Raven →](https://raven-ml.dev/docs/support-raven/)**
Thanks to our sponsors [Ahrefs](https://ahrefs.com) and [Tarides](https://tarides.com).
## License
[ISC](LICENSE)
================================================
FILE: TODO.md
================================================
# todo
## beta (jit)
goalpost: jit-compiled gpt2 matching pytorch performance
perf:
- close rune grad performance gap (within <2x of pytorch)
- close nx performance gaps (within <2x of numpy)
tolk:
- integrate tolk as rune jit transformation
- kernel fusion and optimization
- cpu, cuda, metal backends
## v1 (production)
goalpost: end-to-end train -> deploy as unikernel or static binary
training:
- gradient accumulation
- mixed precision (fp16/bf16 forward, fp32 master weights, loss scaling)
- gradient checkpointing (rune.checkpoint, recompute activations in backward)
- flash attention (tolk kernel and/or kaun.fn primitive)
- parallel data loading (ocaml 5 domains, background prefetch)
- layer completions: transposed conv, group norm, full conv2d stride/dilation/padding
- onnx import (onnx -> tolk ir adapter, cover resnet/bert/gpt2/llama/vit/whisper ops)
deployment:
- aot compilation: cpu (c via clang, musl static linking) and gpu (cuda/metal/opencl)
- mimir: kv cache, continuous batching, pagedattention
- mimir: http server (rest api, /health, /metrics, sigterm, structured logging)
- post-training quantization (int8/int4, tolk quantized kernels)
- mirageos unikernel deployment (raven-mirage package)
- no blas dep (tolk aot generates all compute)
- weight loading via network (mirage-http)
- verify ocaml 5 effects on mirageos runtime
- http server on mirageos network stack
docs/website:
- landing page rewrite with benchmarks
- deployment guide (aot, static binary, docker, mirageos, gpu)
- end-to-end examples (serving, onnx+deploy workflow)
================================================
FILE: dev/README.md
================================================
# dev
Development sandbox for experiments and prototypes that support the Raven ecosystem.
## Projects
| Name | Description |
| ---- | ----------- |
| [mimir](mimir/) | Experimental inference engine |
| [tolk](tolk/) | ML compiler inspired by tinygrad |
================================================
FILE: dev/mimir/README.md
================================================
# mimir
Experimental inference engine for raven.
The gap between "I can run a forward pass" and "I can serve a model in production" is large. mimir is where we figure out what the OCaml answer to that gap looks like.
## Current state
The sampling layer: composable logits processors (temperature, top-k, top-p, repetition penalty, n-gram blocking), stopping criteria, and the autoregressive generation loop operating on nx tensors.
This is the outermost piece of the inference puzzle — the part that turns model logits into actual token sequences. Everything below is open.
## What we want to explore
**Memory management for KV cache.** The attention mechanism produces intermediate state (keys and values) that grows linearly with sequence length. Naive allocation wastes memory; the interesting question is whether we can apply OS-style virtual memory ideas — fixed-size blocks, deferred allocation, reference-counted sharing — to make long sequences and shared prefixes cheap. This is the core idea behind PagedAttention.
**Request scheduling.** A single request is simple. Thousands of concurrent requests with different prompt lengths, generation limits, and priority levels is a scheduling problem. Batching amortizes GPU overhead but introduces latency trade-offs. Continuous batching (letting new requests join mid-batch as others finish) changes the calculus further. OCaml's algebraic types and pattern matching may give us a cleaner expression of scheduling policies than the typical mutable-state approach.
**Prefill/decode asymmetry.** The two phases of autoregressive generation have opposite performance characteristics — one is compute-bound, the other memory-bound. An engine that treats them identically leaves performance on the table.
**JIT compilation of decode steps.** The decode phase repeats the same computation graph with different inputs. If rune's JIT can capture and replay these graphs, we avoid per-step compilation overhead — similar in spirit to CUDA graph capture.
**Structured generation.** Constraining the sampling step so that output conforms to a grammar, regex, or JSON schema. This means masking logits at each step based on what the constraint automaton allows, which interacts with the sampling pipeline we already have.
**Tensor parallelism.** Splitting a model across multiple devices. This is a rune-level concern more than a mimir concern, but the inference engine needs to coordinate it.
## References
- [Nano-vLLM](https://github.com/GeeeekExplworker/nano-vllm) — minimal (~1,200 lines) inference engine by a DeepSeek contributor, good for understanding the essential moving parts
- [vLLM: PagedAttention paper](https://arxiv.org/abs/2309.06180)
- [SGLang](https://github.com/sgl-project/sglang) — alternative engine with RadixAttention for prefix sharing
================================================
FILE: dev/mimir/dune-project
================================================
(lang dune 3.21)
(name mimir)
(package
(name mimir)
(synopsis "Experimental inference engine for Raven")
(description
"Mimir is an inference engine for the Raven ecosystem. It provides sampling, KV cache management, request scheduling, and structured generation for serving ML models.")
(depends
(ocaml
(>= 5.2))))
================================================
FILE: dev/mimir/lib/dune
================================================
(library
(name mimir)
(public_name mimir)
(libraries nx unix))
================================================
FILE: dev/mimir/lib/mimir.ml
================================================
(*---------------------------------------------------------------------------
Copyright (c) 2026 The Raven authors. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)
include Sampler
================================================
FILE: dev/mimir/lib/mimir.mli
================================================
(*---------------------------------------------------------------------------
Copyright (c) 2026 The Raven authors. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)
(** Mimir - Text generation with composable logits processors.
Experimental inference/generation library for the Raven ML ecosystem.
Provides the autoregressive decode loop, composable logits processors,
stopping criteria, and generation configuration. *)
include module type of Sampler
================================================
FILE: dev/mimir/lib/sampler.ml
================================================
(*---------------------------------------------------------------------------
Copyright (c) 2026 The Raven authors. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)
(* ───── Core Types ───── *)
type logits = (float, Bigarray.float32_elt) Nx.t
type token_ids = int array
(* ───── Logits Processors ───── *)
type logits_processor = {
name : string;
process : prompt_length:int -> token_ids -> logits -> logits;
}
type logits_processor_list = logits_processor list
(* ───── Stopping Criteria ───── *)
type stopping_criterion = {
name : string;
should_stop : prompt_length:int -> start_time:float -> token_ids -> bool;
}
type stopping_criteria_list = stopping_criterion list
(* ───── Generation Configuration ───── *)
type generation_config = {
max_length : int;
max_new_tokens : int option;
min_length : int;
min_new_tokens : int;
do_sample : bool;
temperature : float;
top_k : int;
top_p : float;
repetition_penalty : float;
no_repeat_ngram_size : int;
bad_words_ids : int list list;
force_words_ids : int list list;
pad_token_id : int option;
bos_token_id : int option;
eos_token_id : int option;
eos_token_ids : int list;
}
let default =
{
max_length = 100;
max_new_tokens = None;
min_length = 0;
min_new_tokens = 0;
do_sample = false;
temperature = 1.0;
top_k = 0;
top_p = 1.0;
repetition_penalty = 1.0;
no_repeat_ngram_size = 0;
bad_words_ids = [];
force_words_ids = [];
pad_token_id = None;
bos_token_id = None;
eos_token_id = None;
eos_token_ids = [];
}
(* ───── Builder Pattern ───── *)
let with_temperature temperature config = { config with temperature }
let with_top_k top_k config = { config with top_k }
let with_top_p top_p config = { config with top_p }
let with_repetition_penalty repetition_penalty config =
{ config with repetition_penalty }
let with_max_length max_length config = { config with max_length }
let with_max_new_tokens max_new_tokens config =
{ config with max_new_tokens = Some max_new_tokens }
let with_min_length min_length config = { config with min_length }
let with_min_new_tokens min_new_tokens config = { config with min_new_tokens }
let with_no_repeat_ngram no_repeat_ngram_size config =
{ config with no_repeat_ngram_size }
let with_do_sample do_sample config = { config with do_sample }
(* ───── Preset Configurations ───── *)
let creative_writing =
default |> with_do_sample true |> with_temperature 0.8 |> with_top_p 0.9
|> with_repetition_penalty 1.2
|> with_no_repeat_ngram 3 |> with_max_new_tokens 512
let chat =
default |> with_do_sample true |> with_temperature 0.7 |> with_top_p 0.95
|> with_repetition_penalty 1.1
|> with_max_new_tokens 512
let code_generation =
default |> with_do_sample true |> with_temperature 0.2 |> with_top_k 5
|> with_repetition_penalty 1.0
|> with_max_new_tokens 1024
let factual =
default |> with_do_sample true |> with_temperature 0.3 |> with_top_k 10
|> with_repetition_penalty 1.1
|> with_max_new_tokens 256
let from_preset = function
| "creative_writing" -> creative_writing
| "chat" -> chat
| "code_generation" -> code_generation
| "factual" -> factual
| _ -> default
(* ───── Logits Processors ───── *)
let neg_infinity = Float.neg_infinity
let temperature_warper ~temperature =
{
name = Printf.sprintf "temperature(%.2f)" temperature;
process =
(fun ~prompt_length:_ _tokens logits ->
if temperature = 1.0 then logits else Nx.div_s logits temperature);
}
let top_k_warper ~k =
{
name = Printf.sprintf "top_k(%d)" k;
process =
(fun ~prompt_length:_ _tokens logits ->
if k <= 0 then logits
else
let sorted_values, _sorted_indices =
Nx.sort ~descending:true logits
in
let vocab_size = Nx.numel logits in
let cutoff_k = min k vocab_size in
let threshold = Nx.item [ cutoff_k - 1 ] sorted_values in
let mask = Nx.less_s logits threshold in
Nx.where mask (Nx.full_like logits neg_infinity) logits);
}
let top_p_warper ~p =
{
name = Printf.sprintf "top_p(%.2f)" p;
process =
(fun ~prompt_length:_ _tokens logits ->
if p >= 1.0 then logits
else
let probs = Nx.softmax logits in
let sorted_probs, sorted_indices = Nx.sort ~descending:true probs in
let cumulative = Nx.cumsum sorted_probs in
(* Find where cumulative exceeds p, keeping at least 1 token *)
let cutoff_mask = Nx.greater_s cumulative p in
(* Shift mask right by 1 so the token that crosses p is kept *)
let n = Nx.numel logits in
let shifted_arr = Nx.to_array cutoff_mask in
let new_mask_arr = Array.make n false in
for i = 1 to n - 1 do
new_mask_arr.(i) <- shifted_arr.(i - 1)
done;
let shifted_mask = Nx.create Nx.bool [| n |] new_mask_arr in
(* Map mask back to original token order *)
let result = Nx.copy logits in
let sorted_idx_arr = Nx.to_array sorted_indices in
let shifted_mask_arr = Nx.to_array shifted_mask in
for i = 0 to n - 1 do
if shifted_mask_arr.(i) then
Nx.set_item
[ Int32.to_int sorted_idx_arr.(i) ]
neg_infinity result
done;
result);
}
let repetition_penalty ~penalty =
{
name = Printf.sprintf "repetition_penalty(%.2f)" penalty;
process =
(fun ~prompt_length:_ previous_tokens logits ->
if penalty = 1.0 then logits
else
let result = Nx.copy logits in
let vocab_size = Nx.numel result in
Array.iter
(fun token_id ->
if token_id < vocab_size then begin
let score = Nx.item [ token_id ] result in
let penalized =
if score < 0.0 then score *. penalty else score /. penalty
in
Nx.set_item [ token_id ] penalized result
end)
previous_tokens;
result);
}
let no_repeat_ngram ~ngram_size =
{
name = Printf.sprintf "no_repeat_ngram(%d)" ngram_size;
process =
(fun ~prompt_length:_ previous_tokens logits ->
let len = Array.length previous_tokens in
if ngram_size <= 0 || len < ngram_size - 1 then logits
else
let result = Nx.copy logits in
(* Get the last (ngram_size - 1) tokens as the current prefix *)
let prefix_start = len - (ngram_size - 1) in
let prefix =
Array.sub previous_tokens prefix_start (ngram_size - 1)
in
(* Scan history for matching prefixes *)
for i = 0 to len - ngram_size do
let matches = ref true in
for j = 0 to ngram_size - 2 do
if previous_tokens.(i + j) <> prefix.(j) then matches := false
done;
if !matches then begin
let blocked_token = previous_tokens.(i + ngram_size - 1) in
if blocked_token < Nx.numel result then
Nx.set_item [ blocked_token ] neg_infinity result
end
done;
result);
}
let min_length ~min_length ~eos_token_ids =
{
name = Printf.sprintf "min_length(%d)" min_length;
process =
(fun ~prompt_length:_ tokens logits ->
if Array.length tokens >= min_length then logits
else
let result = Nx.copy logits in
let vocab_size = Nx.numel result in
List.iter
(fun eos_id ->
if eos_id < vocab_size then
Nx.set_item [ eos_id ] neg_infinity result)
eos_token_ids;
result);
}
let min_new_tokens ~min_new_tokens ~eos_token_ids =
{
name = Printf.sprintf "min_new_tokens(%d)" min_new_tokens;
process =
(fun ~prompt_length tokens logits ->
let new_tokens = Array.length tokens - prompt_length in
if new_tokens >= min_new_tokens then logits
else
let result = Nx.copy logits in
let vocab_size = Nx.numel result in
List.iter
(fun eos_id ->
if eos_id < vocab_size then
Nx.set_item [ eos_id ] neg_infinity result)
eos_token_ids;
result);
}
let bad_words ~bad_words_ids =
{
name = "bad_words";
process =
(fun ~prompt_length:_ tokens logits ->
let result = Nx.copy logits in
let len = Array.length tokens in
let vocab_size = Nx.numel result in
List.iter
(fun bad_sequence ->
let seq_len = List.length bad_sequence in
if seq_len > 0 && len >= seq_len - 1 then (
let prefix_len = seq_len - 1 in
let matches = ref true in
let prefix = List.rev (List.tl (List.rev bad_sequence)) in
List.iteri
(fun i expected ->
if tokens.(len - prefix_len + i) <> expected then
matches := false)
prefix;
if !matches then begin
let bad_token = List.nth bad_sequence (seq_len - 1) in
if bad_token < vocab_size then
Nx.set_item [ bad_token ] neg_infinity result
end))
bad_words_ids;
result);
}
let force_words ~force_words_ids ~iteration =
{
name = "force_words";
process =
(fun ~prompt_length:_ _tokens logits ->
if iteration >= List.length force_words_ids then logits
else
let forced_tokens = List.nth force_words_ids iteration in
let result = Nx.full_like logits neg_infinity in
List.iter
(fun token_id ->
if token_id < Nx.numel result then
Nx.set_item [ token_id ] (Nx.item [ token_id ] logits) result)
forced_tokens;
result);
}
let custom ~name ~process = { name; process }
(* ───── Stopping Criteria ───── *)
let max_length_criteria ~max_length =
{
name = Printf.sprintf "max_length(%d)" max_length;
should_stop =
(fun ~prompt_length:_ ~start_time:_ tokens ->
Array.length tokens >= max_length);
}
let max_new_tokens_criteria ~max_new_tokens =
{
name = Printf.sprintf "max_new_tokens(%d)" max_new_tokens;
should_stop =
(fun ~prompt_length ~start_time:_ tokens ->
Array.length tokens - prompt_length >= max_new_tokens);
}
let eos_token_criteria ~eos_token_ids =
{
name = "eos_token";
should_stop =
(fun ~prompt_length:_ ~start_time:_ tokens ->
let len = Array.length tokens in
if len = 0 then false else List.mem tokens.(len - 1) eos_token_ids);
}
let max_time_criteria ~max_time =
{
name = Printf.sprintf "max_time(%.1fs)" max_time;
should_stop =
(fun ~prompt_length:_ ~start_time _tokens ->
Unix.gettimeofday () -. start_time > max_time);
}
let stop_strings_criteria ~stop_strings ~decoder =
{
name = "stop_strings";
should_stop =
(fun ~prompt_length:_ ~start_time:_ tokens ->
let text = decoder tokens in
List.exists
(fun stop_str -> String_util.contains_substring text stop_str)
stop_strings);
}
let custom_criteria ~name ~should_stop = { name; should_stop }
(* ───── Utilities ───── *)
let apply_processors ~processors ~prompt_length ~tokens ~logits =
List.fold_left
(fun acc processor -> processor.process ~prompt_length tokens acc)
logits processors
let check_stopping ~criteria ~prompt_length ~start_time ~tokens =
List.exists
(fun criterion -> criterion.should_stop ~prompt_length ~start_time tokens)
criteria
(* ───── Main Generation Functions ───── *)
type generation_output = {
sequences : int array list;
scores : float list list option;
}
let sample_from_logits logits =
let probs = Nx.softmax logits in
let probs_arr = Nx.to_array probs in
let r = Random.float 1.0 in
let cumsum = ref 0.0 in
let result = ref 0 in
(try
for i = 0 to Array.length probs_arr - 1 do
cumsum := !cumsum +. probs_arr.(i);
if !cumsum > r then begin
result := i;
raise_notrace Exit
end
done
with Exit -> ());
!result
let argmax logits = Int32.to_int (Nx.item [ 0 ] (Nx.argmax logits))
let generate ~model ?(input_ids = [||]) ?(generation_config = default)
?(logits_processor = []) ?(stopping_criteria = []) () =
let start_time = Unix.gettimeofday () in
let prompt_length = Array.length input_ids in
let processors =
let ps = [] in
let ps =
if generation_config.temperature <> 1.0 then
temperature_warper ~temperature:generation_config.temperature :: ps
else ps
in
let ps =
if generation_config.top_k > 0 then
top_k_warper ~k:generation_config.top_k :: ps
else ps
in
let ps =
if generation_config.top_p < 1.0 then
top_p_warper ~p:generation_config.top_p :: ps
else ps
in
let ps =
if generation_config.repetition_penalty <> 1.0 then
repetition_penalty ~penalty:generation_config.repetition_penalty :: ps
else ps
in
let ps =
if generation_config.no_repeat_ngram_size > 0 then
no_repeat_ngram ~ngram_size:generation_config.no_repeat_ngram_size :: ps
else ps
in
let eos_ids =
match generation_config.eos_token_id with
| Some id -> id :: generation_config.eos_token_ids
| None -> generation_config.eos_token_ids
in
let ps =
if generation_config.min_length > 0 then
min_length ~min_length:generation_config.min_length
~eos_token_ids:eos_ids
:: ps
else ps
in
let ps =
if generation_config.min_new_tokens > 0 then
min_new_tokens ~min_new_tokens:generation_config.min_new_tokens
~eos_token_ids:eos_ids
:: ps
else ps
in
ps @ logits_processor
in
let criteria =
let cs = [] in
let cs =
max_length_criteria ~max_length:generation_config.max_length :: cs
in
let cs =
match generation_config.max_new_tokens with
| Some max_new -> max_new_tokens_criteria ~max_new_tokens:max_new :: cs
| None -> cs
in
let eos_ids =
match generation_config.eos_token_id with
| Some id -> id :: generation_config.eos_token_ids
| None -> generation_config.eos_token_ids
in
let cs =
if eos_ids <> [] then eos_token_criteria ~eos_token_ids:eos_ids :: cs
else cs
in
cs @ stopping_criteria
in
let tokens_ref = ref (Array.copy input_ids) in
let rec generate_loop () =
let current_tokens = !tokens_ref in
if
Array.length current_tokens > prompt_length
&& check_stopping ~criteria ~prompt_length ~start_time
~tokens:current_tokens
then current_tokens
else begin
let raw_logits = model current_tokens in
let processed =
apply_processors ~processors ~prompt_length ~tokens:current_tokens
~logits:raw_logits
in
let next_token =
if generation_config.do_sample then sample_from_logits processed
else argmax processed
in
tokens_ref := Array.append current_tokens [| next_token |];
generate_loop ()
end
in
let sequences = generate_loop () in
{ sequences = [ sequences ]; scores = None }
let generate_text ~model ~tokenizer ~decoder ?(prompt = "")
?(generation_config = default) ?(logits_processor = [])
?(stopping_criteria = []) () =
let input_ids = tokenizer prompt in
let output =
generate ~model ~input_ids ~generation_config ~logits_processor
~stopping_criteria ()
in
match output.sequences with seq :: _ -> decoder seq | [] -> ""
================================================
FILE: dev/mimir/lib/sampler.mli
================================================
(*---------------------------------------------------------------------------
Copyright (c) 2026 The Raven authors. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)
(** Text generation with composable logits processors.
Provides the autoregressive decode loop, composable logits processors,
stopping criteria, and generation configuration for language model
inference. Operates on nx tensors for logits. *)
(** {1 Core Types} *)
type logits = (float, Bigarray.float32_elt) Nx.t
(** 1D float32 tensor of unnormalized token probabilities. Length equals
vocabulary size. *)
type token_ids = int array
(** Sequence of token IDs representing encoded text. *)
type logits_processor = {
name : string;
process : prompt_length:int -> token_ids -> logits -> logits;
}
(** Transforms logits before sampling. *)
type logits_processor_list = logits_processor list
type stopping_criterion = {
name : string;
should_stop : prompt_length:int -> start_time:float -> token_ids -> bool;
}
(** Determines when to end generation. *)
type stopping_criteria_list = stopping_criterion list
(** {1 Generation Configuration} *)
type generation_config = {
max_length : int;
max_new_tokens : int option;
min_length : int;
min_new_tokens : int;
do_sample : bool;
temperature : float;
top_k : int;
top_p : float;
repetition_penalty : float;
no_repeat_ngram_size : int;
bad_words_ids : int list list;
force_words_ids : int list list;
pad_token_id : int option;
bos_token_id : int option;
eos_token_id : int option;
eos_token_ids : int list;
}
val default : generation_config
(** {2 Builder Pattern} *)
val with_temperature : float -> generation_config -> generation_config
val with_top_k : int -> generation_config -> generation_config
val with_top_p : float -> generation_config -> generation_config
val with_repetition_penalty : float -> generation_config -> generation_config
val with_max_length : int -> generation_config -> generation_config
val with_max_new_tokens : int -> generation_config -> generation_config
val with_min_length : int -> generation_config -> generation_config
val with_min_new_tokens : int -> generation_config -> generation_config
val with_no_repeat_ngram : int -> generation_config -> generation_config
val with_do_sample : bool -> generation_config -> generation_config
(** {2 Presets} *)
val creative_writing : generation_config
val chat : generation_config
val code_generation : generation_config
val factual : generation_config
val from_preset : string -> generation_config
(** {1 Logits Processors} *)
val temperature_warper : temperature:float -> logits_processor
val top_k_warper : k:int -> logits_processor
val top_p_warper : p:float -> logits_processor
val repetition_penalty : penalty:float -> logits_processor
val no_repeat_ngram : ngram_size:int -> logits_processor
val min_length : min_length:int -> eos_token_ids:int list -> logits_processor
val min_new_tokens :
min_new_tokens:int -> eos_token_ids:int list -> logits_processor
val bad_words : bad_words_ids:int list list -> logits_processor
val force_words :
force_words_ids:int list list -> iteration:int -> logits_processor
val custom :
name:string ->
process:(prompt_length:int -> token_ids -> logits -> logits) ->
logits_processor
(** {1 Stopping Criteria} *)
val max_length_criteria : max_length:int -> stopping_criterion
val max_new_tokens_criteria : max_new_tokens:int -> stopping_criterion
val eos_token_criteria : eos_token_ids:int list -> stopping_criterion
val max_time_criteria : max_time:float -> stopping_criterion
val stop_strings_criteria :
stop_strings:string list ->
decoder:(token_ids -> string) ->
stopping_criterion
val custom_criteria :
name:string ->
should_stop:(prompt_length:int -> start_time:float -> token_ids -> bool) ->
stopping_criterion
(** {1 Generation} *)
type generation_output = {
sequences : int array list;
scores : float list list option;
}
val generate :
model:(token_ids -> logits) ->
?input_ids:token_ids ->
?generation_config:generation_config ->
?logits_processor:logits_processor_list ->
?stopping_criteria:stopping_criteria_list ->
unit ->
generation_output
val generate_text :
model:(token_ids -> logits) ->
tokenizer:(string -> token_ids) ->
decoder:(token_ids -> string) ->
?prompt:string ->
?generation_config:generation_config ->
?logits_processor:logits_processor_list ->
?stopping_criteria:stopping_criteria_list ->
unit ->
string
(** {1 Utilities} *)
val apply_processors :
processors:logits_processor_list ->
prompt_length:int ->
tokens:token_ids ->
logits:logits ->
logits
val check_stopping :
criteria:stopping_criteria_list ->
prompt_length:int ->
start_time:float ->
tokens:token_ids ->
bool
================================================
FILE: dev/mimir/lib/string_util.ml
================================================
(*---------------------------------------------------------------------------
Copyright (c) 2026 The Raven authors. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)
let contains_substring s sub =
let len_s = String.length s in
let len_sub = String.length sub in
if len_sub = 0 then true
else if len_sub > len_s then false
else
let rec check i =
if i > len_s - len_sub then false
else if String.sub s i len_sub = sub then true
else check (i + 1)
in
check 0
================================================
FILE: dev/umbra/README.md
================================================
# Umbra
Computational astronomy for OCaml, powered by [Nx](../../packages/nx/) and [Rune](../../packages/rune/)
Umbra provides dimensionally-typed physical quantities, cosmological distances,
spectral energy distributions, dust extinction, synthetic photometry, coordinate
transforms, time scales, catalog cross-matching, and weak lensing survey science.
All computations operate on Nx tensors and are differentiable through Rune --
fit cosmological parameters, propagate uncertainties via Jacobians, or sample
posteriors with HMC, all from the same forward model.
## Quick Start
Compute the luminosity distance to a galaxy at redshift 0.5:
```ocaml
open Umbra
let () =
let f64 = Nx.float64 in
let z = Nx.scalar f64 0.5 in
let dl = Cosmo.luminosity_distance ~p:Cosmo.planck18 z in
Printf.printf "d_L(z=0.5) = %.1f Mpc\n"
(Nx.item [] (Unit.Length.in_mpc dl))
```
Fit stellar temperature from photometry with automatic derivatives:
```ocaml
let model params =
let temp = Unit.Temperature.of_kelvin (Nx.exp (Nx.slice [ I 0 ] params)) in
let av = Nx.reshape [||] (Nx.slice [ I 1 ] params) in
let rv = Nx.scalar Nx.float64 3.1 in
List.map (fun bp ->
let wave = Photometry.wavelength bp in
let sed =
Spectrum.blackbody ~temperature:temp ~wavelength:wave
|> Extinction.apply (Extinction.ccm89 ~rv) ~av
|> Spectrum.as_flux_density
in
Photometry.ab_mag bp sed) bands
|> Nx.stack ~axis:0
(* Rune differentiates through the entire pipeline *)
let loss, grad = Rune.value_and_grad chi2 params
```
## Features
- **Dimensional types**: `Unit.Length`, `Unit.Mass`, `Unit.Time`, `Unit.Angle`, etc. with compile-time safety
- **Physical constants**: CODATA 2022 and IAU 2015 via `Const`
- **Cosmology**: LCDM, wCDM, w0waCDM distances, growth factors, and matter power spectra via `Cosmo`
- **Spectra**: blackbody, power-law, and line profiles (Gaussian, Lorentzian, Voigt) via `Spectrum`
- **Extinction**: CCM89, Fitzpatrick99, O'Donnell94, Calzetti00 dust laws via `Extinction`
- **Photometry**: AB, ST, and Vega magnitudes through standard filter bandpasses via `Photometry`
- **Filters**: SDSS, Johnson-Cousins, 2MASS, Gaia DR3, Rubin/LSST, Euclid via `Filters`
- **Coordinates**: ICRS, Galactic, Ecliptic, Supergalactic frame transforms and kd-tree cross-matching via `Coord`
- **Time**: UTC, TAI, TT, TDB time scales with phantom-typed safety via `Time`
- **Observer geometry**: altitude-azimuth coordinates and airmass via `Altaz`
- **Survey science**: angular power spectra and Fisher forecasting via `Survey`
- **FITS I/O**: image and table read/write via `Umbra_fits`
- **Fully differentiable**: all forward models work with Rune's autodiff, Jacobians, and MCMC
## Examples
| Example | Concept |
|---------|---------|
| [`01-constants-and-units`](examples/01-constants-and-units/) | Type-safe physical quantities and conversions |
| [`02-cosmological-distances`](examples/02-cosmological-distances/) | LCDM distances and SN Ia fitting |
| [`03-blackbody-fitting`](examples/03-blackbody-fitting/) | Fit stellar temperature from photometry |
| [`04-extinction-and-magnitudes`](examples/04-extinction-and-magnitudes/) | Dust extinction, magnitude systems, K-corrections |
| [`05-sed-fitting`](examples/05-sed-fitting/) | Full SED pipeline: blackbody, extinction, photometry |
| [`06-coordinates-and-time`](examples/06-coordinates-and-time/) | Frame transforms, time scales, observer geometry |
| [`07-batch-photometry`](examples/07-batch-photometry/) | Batched operations over parameter grids |
| [`08-photometric-redshifts`](examples/08-photometric-redshifts/) | Two-stage photo-z: grid search + gradient refinement |
| [`09-gravitational-lensing`](examples/09-gravitational-lensing/) | Point-mass lens model parameter fitting |
| [`10-uncertainty-propagation`](examples/10-uncertainty-propagation/) | AD Jacobians for error propagation vs Monte Carlo |
| [`11-bayesian-sed`](examples/11-bayesian-sed/) | Fisher matrix + HMC posterior sampling |
| [`12-survey-optimization`](examples/12-survey-optimization/) | Differentiable Fisher forecasting for survey design |
## Papers
- [**Perlmutter et al. 1999**](papers/perlmutter1999/) -- Reproducing the Nobel Prize-winning discovery of cosmic acceleration using the Pantheon+ dataset
## Contributing
See the [Raven monorepo README](../../README.md) for guidelines.
## License
ISC License. See [LICENSE](../../LICENSE) for details.
================================================
FILE: dev/umbra/dune-project
================================================
(lang dune 3.21)
(name umbra)
(package
(name umbra)
(synopsis "Astronomy library for OCaml")
(description
"Physical units, celestial coordinates, FITS I/O, cosmological distances, and catalog cross-matching. Built on Nx and Talon.")
(depends
(ocaml
(>= 5.2.0))
dune
(nx
(>= 1.0.0~alpha3))
(talon
(>= 1.0.0~alpha3))
(windtrap :with-test)))
================================================
FILE: dev/umbra/examples/01-constants-and-units/README.md
================================================
# `01-constants-and-units`
Introduction to Umbra's type-safe unit system and physical constants. Creates
quantities in different units, converts between them, and demonstrates how
phantom types prevent mixing incompatible dimensions at compile time.
```bash
dune exec dev/umbra/examples/01-constants-and-units/main.exe
```
## What You'll Learn
- Creating quantities with scalar constructors (`Length.pc`, `Angle.deg`, `Mass.solar_mass`)
- Converting between units (`Length.in_ly`, `Angle.in_arcsec`)
- Adding quantities of the same dimension (`Unit.(+)`)
- Using physical constants (`Const.c`, `Const.h_si`, `Const.k_b_si`)
- Cross-dimension conversions (`parallax_to_distance`, `wavelength_to_frequency`)
- Batch operations on tensor-valued quantities
## Key Functions
| Function | Purpose |
| --------------------------- | -------------------------------------------- |
| `Length.pc`, `Length.au` | Create length quantities in parsecs, AU |
| `Length.in_m`, `Length.in_ly`| Extract values in metres, light-years |
| `Angle.deg`, `Angle.arcsec` | Create angles in degrees, arcseconds |
| `Temperature.kelvin` | Create temperature quantities |
| `Mass.solar_mass` | Create mass in solar masses |
| `Const.c`, `Const.h_si` | Speed of light, Planck constant |
| `parallax_to_distance` | Convert stellar parallax to distance |
| `wavelength_to_frequency` | Convert wavelength to frequency via c/lambda |
## Try It
1. Compute the Schwarzschild radius of the Sun using `Const.g_si`, `Const.solar_mass`, and `Const.c`.
2. Add `Length.ly 4.246` (Proxima Centauri) and check it matches the parallax-derived distance.
3. Use `Unit.doppler_optical` to compute the observed wavelength of H-alpha at a radial velocity of 100 km/s.
## Next Steps
Continue to [02-cosmological-distances](../02-cosmological-distances/) to compute
distances and times in an expanding universe.
================================================
FILE: dev/umbra/examples/01-constants-and-units/dune
================================================
(executable
(name main)
(libraries nx umbra))
================================================
FILE: dev/umbra/examples/01-constants-and-units/main.ml
================================================
(*---------------------------------------------------------------------------
Copyright (c) 2026 The Raven authors. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)
(* Type-safe units and physical constants.
Introduces Umbra's dimensional type system: quantities carry phantom types
that prevent mixing incompatible dimensions at compile time. Shows how to
create, convert, and combine quantities in different units, and how to use
physical and astronomical constants. *)
open Nx
open Umbra
let f64 = Nx.float64
let () =
Printf.printf "Type-safe units and physical constants\n";
Printf.printf "======================================\n\n";
(* --- Length: metres, parsecs, AU, light-years --- *)
Printf.printf "Length conversions\n";
Printf.printf "------------------\n";
let d_pc = Unit.Length.pc 1.0 in
Printf.printf " 1 parsec = %.4e m\n" (item [] (Unit.Length.in_m d_pc));
Printf.printf " 1 parsec = %.6f ly\n" (item [] (Unit.Length.in_ly d_pc));
Printf.printf " 1 parsec = %.0f AU\n" (item [] (Unit.Length.in_au d_pc));
let d_au = Unit.Length.au 1.0 in
Printf.printf " 1 AU = %.4e m\n" (item [] (Unit.Length.in_m d_au));
Printf.printf " 1 AU = %.4e pc\n\n" (item [] (Unit.Length.in_pc d_au));
(* Adding lengths of different units — the type system ensures consistency *)
let d_total = Unit.( + ) (Unit.Length.kpc 10.0) (Unit.Length.pc 500.0) in
Printf.printf " 10 kpc + 500 pc = %.3f kpc\n\n"
(item [] (Unit.Length.in_kpc d_total));
(* --- Angle: degrees, radians, arcseconds --- *)
Printf.printf "Angle conversions\n";
Printf.printf "-----------------\n";
let a_deg = Unit.Angle.deg 1.0 in
Printf.printf " 1 degree = %.6f rad\n" (item [] (Unit.Angle.in_rad a_deg));
Printf.printf " 1 degree = %.1f arcmin\n"
(item [] (Unit.Angle.in_arcmin a_deg));
Printf.printf " 1 degree = %.1f arcsec\n"
(item [] (Unit.Angle.in_arcsec a_deg));
let a_mas = Unit.Angle.mas 1.0 in
Printf.printf " 1 mas = %.4e arcsec\n\n"
(item [] (Unit.Angle.in_arcsec a_mas));
(* --- Temperature --- *)
Printf.printf "Temperature\n";
Printf.printf "-----------\n";
let sun_t = Unit.Temperature.kelvin 5778.0 in
Printf.printf " Sun surface: %.0f K\n"
(item [] (Unit.Temperature.in_kelvin sun_t));
let sirius_t = Unit.Temperature.kelvin 9940.0 in
Printf.printf " Sirius: %.0f K\n\n"
(item [] (Unit.Temperature.in_kelvin sirius_t));
(* --- Time durations --- *)
Printf.printf "Time durations\n";
Printf.printf "--------------\n";
let t_yr = Unit.Time.yr 1.0 in
Printf.printf " 1 Julian year = %.0f days\n"
(item [] (Unit.Time.in_day t_yr));
Printf.printf " 1 Julian year = %.2f s\n" (item [] (Unit.Time.in_s t_yr));
let t_gyr = Unit.Time.gyr 13.8 in
Printf.printf " Age of universe ~ %.2e yr\n\n"
(item [] (Unit.Time.in_yr t_gyr));
(* --- Mass: kg, solar masses, Earth masses --- *)
Printf.printf "Mass conversions\n";
Printf.printf "----------------\n";
let m_sun = Unit.Mass.solar_mass 1.0 in
Printf.printf " 1 solar mass = %.4e kg\n" (item [] (Unit.Mass.in_kg m_sun));
Printf.printf " 1 solar mass = %.0f Earth masses\n"
(item [] (Unit.Mass.in_earth_mass m_sun));
Printf.printf " 1 solar mass = %.1f Jupiter masses\n\n"
(item [] (Unit.Mass.in_jupiter_mass m_sun));
(* --- Physical constants --- *)
Printf.printf "Physical constants\n";
Printf.printf "------------------\n";
Printf.printf " c = %.0f m/s\n" (Unit.to_float Const.c);
Printf.printf " h = %.4e J s\n" Const.h_si;
Printf.printf " k_B = %.4e J/K\n" Const.k_b_si;
Printf.printf " G = %.4e m^3 kg^-1 s^-2\n" Const.g_si;
Printf.printf " sigma = %.4e W m^-2 K^-4\n\n" Const.sigma_sb_si;
(* --- Astronomical constants --- *)
Printf.printf "Astronomical constants\n";
Printf.printf "----------------------\n";
Printf.printf " L_sun = %.4e W\n"
(item [] (Unit.Power.in_w Const.solar_luminosity));
Printf.printf " R_sun = %.4e m\n"
(item [] (Unit.Length.in_m Const.solar_radius));
Printf.printf " M_sun = %.4e kg\n"
(item [] (Unit.Mass.in_kg Const.solar_mass));
Printf.printf " 1 AU = %.4e m\n" (item [] (Unit.Length.in_m Const.au));
Printf.printf " 1 pc = %.4e m\n\n" (item [] (Unit.Length.in_m Const.pc));
(* --- Cross-dimension: parallax to distance --- *)
Printf.printf "Parallax to distance\n";
Printf.printf "--------------------\n";
let parallax = Unit.Angle.arcsec 1.0 in
let dist = Unit.parallax_to_distance parallax in
Printf.printf " 1 arcsec parallax -> %.3f pc\n"
(item [] (Unit.Length.in_pc dist));
let proxima_parallax = Unit.Angle.mas 768.5 in
let proxima_dist = Unit.parallax_to_distance proxima_parallax in
Printf.printf " Proxima Cen (768.5 mas) -> %.3f pc\n"
(item [] (Unit.Length.in_pc proxima_dist));
(* --- Tensor operations: batch unit conversions --- *)
Printf.printf "\nBatch operations\n";
Printf.printf "----------------\n";
let wavelengths_nm =
create f64 [| 5 |] [| 380.0; 450.0; 550.0; 650.0; 750.0 |]
in
let wavelengths = Unit.Length.of_nm wavelengths_nm in
let wavelengths_angstrom = Unit.Length.in_angstrom wavelengths in
Printf.printf " Wavelengths (nm): %s\n"
(Nx.data_to_string wavelengths_nm);
Printf.printf " Wavelengths (angstrom): %s\n"
(Nx.data_to_string wavelengths_angstrom);
(* Convert wavelength to frequency *)
let freqs = Unit.wavelength_to_frequency wavelengths in
Printf.printf " Frequencies (Hz): %s\n"
(Nx.data_to_string (Unit.Frequency.in_hz freqs));
(* Wien's law: peak wavelength of a blackbody *)
Printf.printf "\nWien's displacement law\n";
Printf.printf "----------------------\n";
let b_wien = Const.b_wien_si in
let sun_peak_m = b_wien /. item [] (Unit.Temperature.in_kelvin sun_t) in
Printf.printf " Sun (T=%.0f K): peak at %.0f nm\n"
(item [] (Unit.Temperature.in_kelvin sun_t))
(sun_peak_m *. 1e9);
let sirius_peak_m = b_wien /. item [] (Unit.Temperature.in_kelvin sirius_t) in
Printf.printf " Sirius (T=%.0f K): peak at %.0f nm\n"
(item [] (Unit.Temperature.in_kelvin sirius_t))
(sirius_peak_m *. 1e9)
================================================
FILE: dev/umbra/examples/02-cosmological-distances/README.md
================================================
# `02-cosmological-distances`
Cosmological distance calculations and parameter fitting. First prints a
distance table for the Planck 2018 cosmology, then fits H0 and Omega_m from
synthetic Type Ia supernova distance moduli using gradient descent.
```bash
dune exec dev/umbra/examples/02-cosmological-distances/main.exe
```
## What You'll Learn
- Using preset cosmologies (`Cosmo.planck18`)
- Computing distances (`comoving_distance`, `luminosity_distance`, `angular_diameter_distance`)
- Computing distance modulus and lookback time
- Building differentiable cosmological models with `create_flat_lcdm`
- Fitting cosmological parameters with Rune autodiff and Vega optimizers
## Key Functions
| Function | Purpose |
| ----------------------------- | --------------------------------------------- |
| `Cosmo.planck18` | Planck 2018 flat LCDM preset |
| `Cosmo.comoving_distance` | Line-of-sight comoving distance |
| `Cosmo.luminosity_distance` | Luminosity distance at redshift z |
| `Cosmo.distance_modulus` | Distance modulus mu = 5 log10(d_L/Mpc) + 25 |
| `Cosmo.lookback_time` | Time since light was emitted |
| `Cosmo.age` | Age of the universe at redshift z |
| `Cosmo.create_flat_lcdm` | Tensor-parameterized cosmology for autodiff |
| `Rune.value_and_grads` | Forward pass + gradient computation |
## How It Works
The distance modulus forward model uses `Cosmo.distance_modulus`, which
internally integrates E(z) via 16-point Gauss-Legendre quadrature. Since all
operations are Nx tensor ops, gradients flow through the entire pipeline
automatically via Rune.
The optimizer starts from H0=65, Omega_m=0.25 and converges toward the true
values (H0~73, Omega_m~0.3) that generated the synthetic data.
## Try It
1. Change the preset to `Cosmo.wmap9` and compare the distance table.
2. Add `Omega_L` as a free parameter using `create_lcdm` for a non-flat model.
3. Use `Cosmo.z_at_value` to find the redshift where the lookback time is 10 Gyr.
## Next Steps
Continue to [03-blackbody-fitting](../03-blackbody-fitting/) to fit stellar
temperatures from photometry.
================================================
FILE: dev/umbra/examples/02-cosmological-distances/dune
================================================
(executable
(name main)
(libraries nx rune vega umbra))
================================================
FILE: dev/umbra/examples/02-cosmological-distances/main.ml
================================================
(*---------------------------------------------------------------------------
Copyright (c) 2026 The Raven authors. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)
(* Differentiable cosmological parameter fitting from Type Ia supernova distance
moduli.
Fits H0 (Hubble constant) and Omega_m (matter density fraction) by gradient
descent on the distance modulus residuals. The forward model uses
Umbra.Cosmo.distance_modulus directly -- its Gauss-Legendre quadrature,
luminosity distance, and distance modulus are all Nx tensor operations,
making them natively differentiable through Rune's autodiff.
Also demonstrates basic cosmological distance queries: comoving distance,
luminosity distance, angular diameter distance, lookback time, and the age of
the universe at various redshifts. *)
open Nx
open Umbra
let f64 = Nx.float64
(* --- Part 1: Distance table for the Planck 2018 cosmology --- *)
let print_distance_table () =
Printf.printf "Cosmological distances (Planck 2018)\n";
Printf.printf "====================================\n\n";
let p = Cosmo.planck18 in
Printf.printf " H0 = %.2f km/s/Mpc\n" (item [] (Cosmo.h0 p));
Printf.printf " Omega_m = %.4f\n" (item [] (Cosmo.omega_m p));
Printf.printf " Omega_L = %.4f\n\n" (item [] (Cosmo.omega_l p));
Printf.printf "%6s %10s %10s %10s %8s %8s\n" "z" "d_C (Mpc)" "d_L (Mpc)"
"d_A (Mpc)" "mu" "t_lb (Gyr)";
Printf.printf "%6s %10s %10s %10s %8s %8s\n" "------" "----------"
"----------" "----------" "--------" "----------";
let redshifts = [| 0.01; 0.1; 0.3; 0.5; 1.0; 2.0; 3.0; 5.0 |] in
Array.iter
(fun z ->
let zv = scalar f64 z in
let d_c = item [] (Unit.Length.in_mpc (Cosmo.comoving_distance ~p zv)) in
let d_l =
item [] (Unit.Length.in_mpc (Cosmo.luminosity_distance ~p zv))
in
let d_a =
item [] (Unit.Length.in_mpc (Cosmo.angular_diameter_distance ~p zv))
in
let mu = item [] (Cosmo.distance_modulus ~p zv) in
let t_lb = item [] (Unit.Time.in_gyr (Cosmo.lookback_time ~p zv)) in
Printf.printf "%6.2f %10.1f %10.1f %10.1f %8.2f %8.2f\n" z d_c d_l
d_a mu t_lb)
redshifts;
Printf.printf "\n";
(* Age of the universe *)
let age_now = item [] (Unit.Time.in_gyr (Cosmo.age ~p (scalar f64 0.0))) in
Printf.printf " Age of the universe (z=0): %.2f Gyr\n\n" age_now
(* --- Part 2: Fit H0 and Omega_m from SN Ia data --- *)
(* Representative SN Ia data points (z, observed distance modulus). Based on
Pantheon+ compilation values for flat LCDM with H0 ~ 73, Omega_m ~ 0.3. *)
let z_arr = [| 0.01; 0.03; 0.08; 0.15; 0.25; 0.40; 0.55; 0.70; 0.85; 1.00 |]
let n_sn = Array.length z_arr
let mu_obs =
[| 33.07; 35.47; 37.62; 39.07; 40.24; 41.42; 42.23; 42.85; 43.34; 43.74 |]
(* Forward model: compute distance modulus for all SNe. The differentiable
parameters are H0 and Omega_m, which flow through Cosmo.distance_modulus via
Nx tensor operations. *)
let loss params =
match params with
| [ h0; omega_m ] ->
let p = Cosmo.create_flat_lcdm ~h0 ~omega_m in
let total = ref (scalar f64 0.0) in
for i = 0 to n_sn - 1 do
let z_i = scalar f64 z_arr.(i) in
let mu_pred = Cosmo.distance_modulus ~p z_i in
let mu_obs_i = scalar f64 mu_obs.(i) in
let residual = sub mu_pred mu_obs_i in
total := add !total (square residual)
done;
div_s !total (Float.of_int n_sn)
| _ -> failwith "expected [h0; omega_m]"
let fit_cosmology () =
Printf.printf "Fitting H0 and Omega_m from Type Ia supernovae\n";
Printf.printf "===============================================\n";
Printf.printf " Data: %d distance moduli (Pantheon+-like)\n" n_sn;
Printf.printf " Method: Adam optimizer, 300 steps\n";
Printf.printf " Model: flat LCDM via Cosmo.distance_modulus\n\n";
let algo = Vega.adam (Vega.Schedule.constant 0.5) in
let h0 = ref (scalar f64 65.0) in
let omega_m = ref (scalar f64 0.25) in
let states = [| Vega.init algo !h0; Vega.init algo !omega_m |] in
let steps = 300 in
Printf.printf "%5s %10s %8s %8s\n" "step" "loss" "H0" "Omega_m";
Printf.printf "%5s %10s %8s %8s\n" "-----" "----------" "--------"
"--------";
let refs = [| h0; omega_m |] in
for i = 0 to steps - 1 do
let loss_val, grads = Rune.value_and_grads loss [ !h0; !omega_m ] in
List.iteri
(fun j g ->
let p, s = Vega.step states.(j) ~grad:g ~param:!(refs.(j)) in
refs.(j) := p;
states.(j) <- s)
grads;
if i mod 50 = 0 || i = steps - 1 then
Printf.printf "%5d %10.6f %8.2f %8.4f\n" i (item [] loss_val)
(item [] !h0) (item [] !omega_m)
done;
Printf.printf "\nFitted parameters:\n";
Printf.printf " H0 = %.2f km/s/Mpc\n" (item [] !h0);
Printf.printf " Omega_m = %.4f\n" (item [] !omega_m)
let () =
print_distance_table ();
fit_cosmology ()
================================================
FILE: dev/umbra/examples/03-blackbody-fitting/README.md
================================================
# `03-blackbody-fitting`
Fits the effective temperature and luminosity normalization of a star from
synthetic UGRIZ broadband photometry using gradient descent on a blackbody
model.
```bash
dune exec dev/umbra/examples/03-blackbody-fitting/main.exe
```
## What You'll Learn
- Using physical constants (`Const.h_si`, `Const.k_b_si`, `Const.c`)
- Building a differentiable Planck function from Nx tensor operations
- Parameterizing in log-space for numerical stability
- Fitting chi-squared with Rune autodiff and Vega's Adam optimizer
## Key Functions
| Function | Purpose |
| --------------------- | -------------------------------------------------- |
| `Const.h_si` | Planck constant (J s) |
| `Const.k_b_si` | Boltzmann constant (J/K) |
| `Const.c` | Speed of light (typed velocity) |
| `Unit.to_float` | Extract scalar SI value from a typed constant |
| `Rune.value_and_grads`| Compute loss and gradients in one pass |
| `Vega.adam` | Adam optimizer |
| `Vega.step` | Apply one optimization step |
## How It Works
The Planck spectral radiance B(lambda, T) = 2hc^2 / lambda^5 / (exp(hc /
lambda k T) - 1) is implemented entirely with Nx tensor operations. Since Rune
can differentiate any Nx computation, gradients of chi-squared with respect to
log(T) and log(A) are computed automatically.
The optimizer starts from T=5000 K and converges toward the true temperature
of 5800 K (Sun-like star). Log-space parameterization ensures positivity and
improves gradient conditioning.
## Try It
1. Change the true temperature to 10000 K (A-type star) and observe how the
SED shape changes.
2. Add a third parameter for a dust extinction term.
3. Replace the central-wavelength approximation with proper filter integration
using `Photometry.ab_mag` (see example 05).
## Next Steps
Continue to [04-extinction-and-magnitudes](../04-extinction-and-magnitudes/) to
learn about dust extinction, K-corrections, and magnitude systems.
================================================
FILE: dev/umbra/examples/03-blackbody-fitting/dune
================================================
(executable
(name main)
(libraries nx rune vega umbra))
================================================
FILE: dev/umbra/examples/03-blackbody-fitting/main.ml
================================================
(*---------------------------------------------------------------------------
Copyright (c) 2026 The Raven authors. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)
(* Differentiable blackbody SED fitting.
Given broadband photometric measurements in UGRIZ bands, fit the stellar
effective temperature and luminosity normalization by gradient descent on the
chi-squared statistic. The Planck function is evaluated as Nx tensor
operations, making it fully differentiable through Rune.
Uses Umbra.Const for physical constants. *)
open Nx
open Umbra
let f64 = Nx.float64
(* Central wavelengths of SDSS UGRIZ bands in meters *)
let lambda =
create f64 [| 5 |] [| 3.551e-7; 4.686e-7; 6.166e-7; 7.480e-7; 8.932e-7 |]
(* Physical constants from Umbra *)
let h_planck = Const.h_si
let c_light = Unit.to_float Const.c
let k_boltz = Const.k_b_si
(* Pre-computed constant tensors *)
let two_hc2 = scalar f64 (2.0 *. h_planck *. c_light *. c_light)
let hc_over_k = scalar f64 (h_planck *. c_light /. k_boltz)
let lam5 = pow_s lambda 5.0
(* Generate synthetic observations from a Sun-like star *)
let true_temp = 5800.0
let true_log_norm = -50.0
let planck_scalar lam_m temp =
let x = h_planck *. c_light /. (lam_m *. k_boltz *. temp) in
2.0 *. h_planck *. c_light *. c_light
/. (lam_m *. lam_m *. lam_m *. lam_m *. lam_m)
/. (Float.exp x -. 1.0)
let flux_obs =
let norm = Float.exp true_log_norm in
let fluxes =
Array.init 5 (fun i ->
let lam_m =
[| 3.551e-7; 4.686e-7; 6.166e-7; 7.480e-7; 8.932e-7 |].(i)
in
norm
*. planck_scalar lam_m true_temp
*. (1.0 +. (0.02 *. (Float.of_int i -. 2.0))))
in
create f64 [| 5 |] fluxes
(* Fractional errors: 5% photometry *)
let flux_err = mul_s flux_obs 0.05
let band_names = [| "U"; "G"; "R"; "I"; "Z" |]
(* Differentiable forward model: Planck function at 5 wavelengths. Parameterized
in log-space for positivity and gradient conditioning.
B(lambda, T) = 2hc^2 / lambda^5 / (exp(hc / (lambda * k * T)) - 1) *)
let loss params =
match params with
| [ log_temp; log_norm ] ->
let temp = exp log_temp in
let norm = exp log_norm in
let exponent = div hc_over_k (mul lambda temp) in
let planck =
div (div two_hc2 lam5) (sub (exp exponent) (scalar f64 1.0))
in
let flux_pred = mul norm planck in
let residual = div (sub flux_pred flux_obs) flux_err in
sum (square residual)
| _ -> failwith "expected [log_temp; log_norm]"
let () =
Printf.printf "Differentiable blackbody SED fitting\n";
Printf.printf "====================================\n";
Printf.printf "Fitting temperature and normalization to UGRIZ photometry\n\n";
Printf.printf "True parameters:\n";
Printf.printf " T = %.0f K\n" true_temp;
Printf.printf " logA = %.1f\n\n" true_log_norm;
Printf.printf "Synthetic observations (5%% errors):\n";
for i = 0 to 4 do
Printf.printf " %s: %.4e +/- %.4e\n" band_names.(i) (item [ i ] flux_obs)
(item [ i ] flux_err)
done;
Printf.printf "\n";
(* Start from a guess *)
let algo = Vega.adam (Vega.Schedule.constant 1e-2) in
let log_temp = ref (scalar f64 (Float.log 5000.0)) in
let log_norm = ref (scalar f64 (-52.0)) in
let states = [| Vega.init algo !log_temp; Vega.init algo !log_norm |] in
let steps = 500 in
Printf.printf "%5s %12s %8s %10s\n" "step" "chi2" "T (K)" "log_norm";
Printf.printf "%5s %12s %8s %10s\n" "-----" "------------" "--------"
"----------";
let refs = [| log_temp; log_norm |] in
for i = 0 to steps - 1 do
let loss_val, grads = Rune.value_and_grads loss [ !log_temp; !log_norm ] in
List.iteri
(fun j g ->
let p, s = Vega.step states.(j) ~grad:g ~param:!(refs.(j)) in
refs.(j) := p;
states.(j) <- s)
grads;
if i mod 100 = 0 || i = steps - 1 then
Printf.printf "%5d %12.4f %8.1f %10.3f\n" i (item [] loss_val)
(Float.exp (item [] !log_temp))
(item [] !log_norm)
done;
Printf.printf "\nFitted parameters:\n";
Printf.printf " T = %.1f K (true: %.0f K)\n"
(Float.exp (item [] !log_temp))
true_temp;
Printf.printf " logA = %.3f (true: %.1f)\n" (item [] !log_norm)
true_log_norm
================================================
FILE: dev/umbra/examples/04-extinction-and-magnitudes/README.md
================================================
# `04-extinction-and-magnitudes`
Explores three key photometric concepts: magnitude systems (AB, ST, Vega),
K-corrections from redshift, and interstellar dust extinction. Shows how to
compose `Spectrum`, `Extinction`, `Photometry`, and `Filters` modules.
```bash
dune exec dev/umbra/examples/04-extinction-and-magnitudes/main.exe
```
## What You'll Learn
- Computing AB, ST, and Vega magnitudes through real SDSS filters
- Understanding K-corrections from redshift-shifted SEDs
- Applying extinction laws (CCM89, Fitzpatrick99, O'Donnell94)
- Measuring colors and color excess from dust reddening
## Key Functions
| Function | Purpose |
| --------------------------- | ---------------------------------------------- |
| `Photometry.ab_mag` | AB magnitude through a bandpass |
| `Photometry.st_mag` | ST magnitude through a bandpass |
| `Photometry.vega_mag` | Vega magnitude through a bandpass |
| `Photometry.color` | Color index (mag difference between two bands) |
| `Spectrum.blackbody` | Planck spectral radiance |
| `Spectrum.redshift` | Apply cosmological redshift to an SED |
| `Spectrum.as_flux_density` | Cast spectrum to flux density kind |
| `Extinction.ccm89` | Cardelli, Clayton & Mathis (1989) dust law |
| `Extinction.fitzpatrick99` | Fitzpatrick (1999) dust law |
| `Extinction.apply` | Redden a spectrum by A_V magnitudes |
| `Filters.sdss_r` | Pre-built SDSS r-band bandpass |
## How It Works
**Magnitude systems** differ in their reference flux:
- AB: constant f_nu = 3631 Jy
- ST: constant f_lambda = 3.63e-9 erg/s/cm^2/A
- Vega: the spectrum of alpha Lyrae
**K-corrections** arise because redshift moves the SED across the bandpass,
changing the measured flux even without distance dimming. K(z) = m_obs - m_rest.
**Extinction** attenuates and reddens starlight. The extinction curve
A_lambda/A_V depends on wavelength and the dust grain properties (encoded in
R_V). Higher A_V means more dimming; bluer bands are affected more, producing
reddening.
## Try It
1. Compare Galactic extinction (CCM89, R_V=3.1) with starburst attenuation
(`Extinction.calzetti00`).
2. Apply both redshift and extinction to see their combined effect on colors.
3. Use `Extinction.unredden` to recover the intrinsic SED from a reddened
observation.
## Next Steps
Continue to [05-sed-fitting](../05-sed-fitting/) to fit temperature, extinction,
and normalization simultaneously.
================================================
FILE: dev/umbra/examples/04-extinction-and-magnitudes/dune
================================================
(executable
(name main)
(libraries nx rune umbra))
================================================
FILE: dev/umbra/examples/04-extinction-and-magnitudes/main.ml
================================================
(*---------------------------------------------------------------------------
Copyright (c) 2026 The Raven authors. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)
(* K-corrections, extinction, and magnitude systems.
Demonstrates three key photometric concepts:
1. Magnitude systems: AB, ST, and Vega magnitudes through real SDSS filters.
2. K-corrections: the difference between observed and rest-frame magnitudes
due to redshift shifting the SED across the bandpass. 3. Extinction: how
interstellar dust reddens and dims stellar light, comparing CCM89 and
Fitzpatrick99 extinction laws. *)
open Nx
open Umbra
let f64 = Nx.float64
let () =
Printf.printf "Extinction, K-corrections, and magnitude systems\n";
Printf.printf "=================================================\n\n";
(* --- Part 1: Magnitude systems --- *)
Printf.printf "Part 1: AB, ST, and Vega magnitudes\n";
Printf.printf "------------------------------------\n\n";
let temp = Unit.Temperature.of_kelvin (Nx.scalar f64 6000.0) in
let norm = Nx.scalar f64 (Float.exp (-50.0)) in
let bands =
[|
("SDSS u", Filters.sdss_u);
("SDSS g", Filters.sdss_g);
("SDSS r", Filters.sdss_r);
("SDSS i", Filters.sdss_i);
("SDSS z", Filters.sdss_z);
|]
in
Printf.printf " Source: T=6000 K blackbody\n\n";
Printf.printf "%8s %8s %8s %8s\n" "Band" "AB" "ST" "Vega";
Printf.printf "%8s %8s %8s %8s\n" "--------" "--------" "--------"
"--------";
Array.iter
(fun (name, bp) ->
let bp_wave = Photometry.wavelength bp in
let sed =
Spectrum.blackbody ~temperature:temp ~wavelength:bp_wave
|> Spectrum.scale norm |> Spectrum.as_flux_density
in
let m_ab = item [] (Photometry.ab_mag bp sed) in
let m_st = item [] (Photometry.st_mag bp sed) in
let m_vega = item [] (Photometry.vega_mag bp sed) in
Printf.printf "%8s %+8.3f %+8.3f %+8.3f\n" name m_ab m_st m_vega)
bands;
Printf.printf "\n Note: AB and ST systems are defined by reference flux\n";
Printf.printf " densities; Vega magnitudes use the alpha Lyr spectrum.\n\n";
(* --- Part 2: K-corrections --- *)
Printf.printf "Part 2: K-corrections\n";
Printf.printf "---------------------\n\n";
let bp = Filters.sdss_r in
let bp_wave = Photometry.wavelength bp in
let rest_sed =
Spectrum.blackbody ~temperature:temp ~wavelength:bp_wave
|> Spectrum.scale norm |> Spectrum.as_flux_density
in
let m_ab_rest = item [] (Photometry.ab_mag bp rest_sed) in
let m_st_rest = item [] (Photometry.st_mag bp rest_sed) in
let m_vega_rest = item [] (Photometry.vega_mag bp rest_sed) in
Printf.printf " Rest-frame SDSS r-band:\n";
Printf.printf " AB = %.3f\n" m_ab_rest;
Printf.printf " ST = %.3f\n" m_st_rest;
Printf.printf " Vega = %.3f\n\n" m_vega_rest;
Printf.printf " K-correction = m_obs(z) - m_rest\n\n";
Printf.printf "%6s %8s %8s %8s\n" "z" "K_AB" "K_ST" "K_Vega";
Printf.printf "%6s %8s %8s %8s\n" "------" "--------" "--------" "--------";
let redshifts = [| 0.1; 0.2; 0.3; 0.5; 0.7; 1.0 |] in
Array.iter
(fun z ->
let zv = Nx.scalar f64 z in
let obs_sed =
Spectrum.blackbody ~temperature:temp ~wavelength:bp_wave
|> Spectrum.scale norm |> Spectrum.as_flux_density
|> Spectrum.redshift ~z:zv
in
let k_ab = item [] (Photometry.ab_mag bp obs_sed) -. m_ab_rest in
let k_st = item [] (Photometry.st_mag bp obs_sed) -. m_st_rest in
let k_vega = item [] (Photometry.vega_mag bp obs_sed) -. m_vega_rest in
Printf.printf "%6.2f %+8.3f %+8.3f %+8.3f\n" z k_ab k_st k_vega)
redshifts;
Printf.printf "\n";
(* --- Part 3: Color evolution with redshift --- *)
Printf.printf "Part 3: Color evolution (u-r) with redshift\n";
Printf.printf "-------------------------------------------\n\n";
Printf.printf "%6s %8s\n" "z" "u-r (AB)";
Printf.printf "%6s %8s\n" "------" "--------";
Array.iter
(fun z ->
let zv = Nx.scalar f64 z in
let color =
item []
(Photometry.color Filters.sdss_u Filters.sdss_r
(Spectrum.blackbody ~temperature:temp ~wavelength:bp_wave
|> Spectrum.scale norm |> Spectrum.as_flux_density
|> Spectrum.redshift ~z:zv))
in
Printf.printf "%6.2f %+8.3f\n" z color)
redshifts;
Printf.printf "\n";
(* --- Part 4: Extinction --- *)
Printf.printf "Part 4: Dust extinction\n";
Printf.printf "-----------------------\n\n";
let rv = Nx.scalar f64 3.1 in
let av_values = [| 0.0; 0.5; 1.0; 2.0; 3.0 |] in
Printf.printf " CCM89 extinction law (R_V = 3.1)\n";
Printf.printf " Reddening a T=6000 K blackbody through SDSS r-band\n\n";
Printf.printf "%6s %8s %8s %8s\n" "A_V" "m_AB" "delta_m" "E(u-r)";
Printf.printf "%6s %8s %8s %8s\n" "------" "--------" "--------" "--------";
let unreddened_sed =
Spectrum.blackbody ~temperature:temp ~wavelength:bp_wave
|> Spectrum.scale norm |> Spectrum.as_flux_density
in
let m0 = item [] (Photometry.ab_mag bp unreddened_sed) in
let color0 =
item [] (Photometry.color Filters.sdss_u Filters.sdss_r unreddened_sed)
in
Array.iter
(fun av_f ->
let av = Nx.scalar f64 av_f in
let reddened =
Spectrum.blackbody ~temperature:temp ~wavelength:bp_wave
|> Spectrum.scale norm
|> Extinction.apply (Extinction.ccm89 ~rv) ~av
|> Spectrum.as_flux_density
in
let m = item [] (Photometry.ab_mag bp reddened) in
let color =
item [] (Photometry.color Filters.sdss_u Filters.sdss_r reddened)
in
Printf.printf "%6.1f %8.3f %+8.3f %+8.3f\n" av_f m (m -. m0)
(color -. color0))
av_values;
Printf.printf "\n";
(* Compare extinction laws *)
Printf.printf " Comparing extinction laws at A_V = 1.0:\n\n";
Printf.printf "%16s %8s %8s\n" "Law" "r-band" "E(u-r)";
Printf.printf "%16s %8s %8s\n" "----------------" "--------" "--------";
let av_one = Nx.scalar f64 1.0 in
let laws =
[|
("CCM89", Extinction.ccm89 ~rv);
("Fitzpatrick99", Extinction.fitzpatrick99 ~rv);
("O'Donnell94", Extinction.odonnell94 ~rv);
|]
in
Array.iter
(fun (name, law) ->
let reddened =
Spectrum.blackbody ~temperature:temp ~wavelength:bp_wave
|> Spectrum.scale norm
|> Extinction.apply law ~av:av_one
|> Spectrum.as_flux_density
in
let m = item [] (Photometry.ab_mag bp reddened) in
let color =
item [] (Photometry.color Filters.sdss_u Filters.sdss_r reddened)
in
Printf.printf "%16s %+8.3f %+8.3f\n" name (m -. m0) (color -. color0))
laws
================================================
FILE: dev/umbra/examples/05-sed-fitting/README.md
================================================
# `05-sed-fitting`
Full SED fitting pipeline: fits stellar temperature, dust extinction (A_V), and
flux normalization simultaneously from UGRIZ photometry. Demonstrates the
composable differentiable pipeline through Spectrum, Extinction, and Photometry.
```bash
dune exec dev/umbra/examples/05-sed-fitting/main.exe
```
## What You'll Learn
- Building a full astrophysical forward model from composable modules
- How the blackbody -> extinction -> photometry pipeline is end-to-end differentiable
- Creating custom bandpasses with `Photometry.tophat`
- Fitting multiple correlated parameters (T, A_V, normalization) simultaneously
## Key Functions
| Function | Purpose |
| ---------------------------- | --------------------------------------------- |
| `Spectrum.blackbody` | Planck spectral radiance at given wavelengths |
| `Spectrum.scale` | Scale spectrum values by a factor |
| `Spectrum.as_flux_density` | Cast to flux density kind for photometry |
| `Extinction.ccm89` | Create CCM89 extinction law with R_V |
| `Extinction.apply` | Apply dust reddening to a spectrum |
| `Photometry.tophat` | Create a rectangular bandpass |
| `Photometry.ab_mag` | Compute AB magnitude through a bandpass |
| `Rune.value_and_grads` | Autodiff through the entire pipeline |
## How It Works
The forward model constructs a synthetic SED at each optimization step:
1. **Spectrum.blackbody** generates the Planck function at temperature T
2. **Spectrum.scale** applies the flux normalization
3. **Extinction.apply** reddens the spectrum using CCM89 with extinction A_V
4. **Photometry.ab_mag** integrates through each bandpass to produce magnitudes
Since every step is built from Nx tensor operations, Rune computes gradients
of chi-squared with respect to all three parameters (log T, A_V, log norm) in
a single backward pass.
The temperature and normalization are parameterized in log-space for positivity
and better gradient conditioning. A_V is left in linear space since it can
meaningfully be zero or negative (de-reddening).
## Try It
1. Replace tophat filters with real SDSS filters from `Filters.sdss_u`, etc.
2. Add a redshift parameter to fit photometric redshifts.
3. Try `Extinction.fitzpatrick99` instead of `ccm89` and compare results.
4. Increase the photometric noise and observe how parameter uncertainties grow.
## Next Steps
Continue to [06-coordinates-and-time](../06-coordinates-and-time/) to work with
celestial coordinates, time scales, and observing conditions.
================================================
FILE: dev/umbra/examples/05-sed-fitting/dune
================================================
(executable
(name main)
(libraries nx rune vega umbra))
================================================
FILE: dev/umbra/examples/05-sed-fitting/main.ml
================================================
(*---------------------------------------------------------------------------
Copyright (c) 2026 The Raven authors. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)
(* Differentiable SED fitting: temperature + extinction from photometry.
Demonstrates the composable differentiable pipeline: Spectrum.blackbody ->
Extinction.apply -> Photometry.ab_mag
All operations flow through Nx tensor ops, making the entire pipeline
differentiable via Rune's autodiff. We fit stellar temperature, dust
extinction, and flux normalization simultaneously by gradient descent on
photometric residuals. *)
open Nx
open Umbra
let f64 = Nx.float64
(* Define 5 broadband filters (UGRIZ-like tophats) *)
let n_bp = 100
let band_u =
Photometry.tophat ~lo:(Unit.Length.m 3.0e-7) ~hi:(Unit.Length.m 4.0e-7)
~n:n_bp
let band_g =
Photometry.tophat ~lo:(Unit.Length.m 4.0e-7) ~hi:(Unit.Length.m 5.5e-7)
~n:n_bp
let band_r =
Photometry.tophat ~lo:(Unit.Length.m 5.5e-7) ~hi:(Unit.Length.m 7.0e-7)
~n:n_bp
let band_i =
Photometry.tophat ~lo:(Unit.Length.m 7.0e-7) ~hi:(Unit.Length.m 8.5e-7)
~n:n_bp
let band_z =
Photometry.tophat ~lo:(Unit.Length.m 8.5e-7) ~hi:(Unit.Length.m 1.0e-6)
~n:n_bp
let bands = [ band_u; band_g; band_r; band_i; band_z ]
let band_names = [| "U"; "G"; "R"; "I"; "Z" |]
(* True parameters *)
let true_temp = 6500.0 (* K -- F-type star *)
let true_av = 0.5 (* moderate extinction *)
let true_log_norm = -50.0
(* Generate synthetic observations *)
let rv = Nx.scalar f64 3.1
let obs_mags =
let temp = Unit.Temperature.of_kelvin (Nx.scalar f64 true_temp) in
let av = Nx.scalar f64 true_av in
let norm = Nx.scalar f64 (Float.exp true_log_norm) in
let mags =
List.map
(fun bp ->
let bp_wave = Photometry.wavelength bp in
let sed =
Spectrum.blackbody ~temperature:temp ~wavelength:bp_wave
|> Spectrum.scale norm
|> Extinction.apply (Extinction.ccm89 ~rv) ~av
|> Spectrum.as_flux_density
in
Photometry.ab_mag bp sed)
bands
in
(* Add 3% photometric noise *)
let noise = [| 0.03; -0.02; 0.01; -0.01; 0.02 |] in
List.mapi (fun i m -> Nx.add_s m noise.(i)) mags
let obs_errs = List.init 5 (fun _ -> Nx.scalar f64 0.05)
(* Forward model: generate magnitudes from parameters *)
let forward_model log_temp av log_norm =
let temp = Unit.Temperature.of_kelvin (exp log_temp) in
let norm = exp log_norm in
List.map
(fun bp ->
let bp_wave = Photometry.wavelength bp in
let sed =
Spectrum.blackbody ~temperature:temp ~wavelength:bp_wave
|> Spectrum.scale norm
|> Extinction.apply (Extinction.ccm89 ~rv) ~av
|> Spectrum.as_flux_density
in
Photometry.ab_mag bp sed)
bands
(* Loss function: chi-squared *)
let loss params =
match params with
| [ log_temp; av; log_norm ] ->
let pred = forward_model log_temp av log_norm in
List.fold_left2
(fun acc p (o, e) ->
let residual = div (sub p o) e in
add acc (square residual))
(scalar f64 0.0) pred
(List.combine obs_mags obs_errs)
| _ -> failwith "expected [log_temp; av; log_norm]"
let () =
Printf.printf "Differentiable SED Fitting\n";
Printf.printf "=========================\n";
Printf.printf
"Pipeline: Spectrum.blackbody -> Extinction.ccm89 -> Photometry.ab_mag\n\n";
Printf.printf "True parameters:\n";
Printf.printf " T = %.0f K\n" true_temp;
Printf.printf " A_V = %.2f mag\n" true_av;
Printf.printf " logN = %.1f\n\n" true_log_norm;
Printf.printf "Observed magnitudes (with noise):\n";
List.iteri
(fun i m ->
Printf.printf " %s = %.3f +/- %.3f\n" band_names.(i) (item [] m)
(item [] (List.nth obs_errs i)))
obs_mags;
Printf.printf "\n";
(* Initial guesses *)
let algo = Vega.adam (Vega.Schedule.constant 1e-3) in
let log_temp = ref (scalar f64 (Float.log 7000.0)) in
let av = ref (scalar f64 0.3) in
let log_norm = ref (scalar f64 (-50.5)) in
let states =
[| Vega.init algo !log_temp; Vega.init algo !av; Vega.init algo !log_norm |]
in
let steps = 1000 in
Printf.printf "%5s %10s %8s %8s %8s\n" "step" "chi2" "T (K)" "A_V"
"log_norm";
Printf.printf "%5s %10s %8s %8s %8s\n" "-----" "----------" "--------"
"--------" "--------";
let refs = [| log_temp; av; log_norm |] in
for i = 0 to steps - 1 do
let loss_val, grads =
Rune.value_and_grads loss [ !log_temp; !av; !log_norm ]
in
if i mod 200 = 0 || i = steps - 1 then
Printf.printf "%5d %10.4f %8.1f %8.3f %8.3f\n" i (item [] loss_val)
(Float.exp (item [] !log_temp))
(item [] !av) (item [] !log_norm);
List.iteri
(fun j g ->
let p, s = Vega.step states.(j) ~grad:g ~param:!(refs.(j)) in
refs.(j) := p;
states.(j) <- s)
grads
done;
Printf.printf "\nFitted parameters:\n";
Printf.printf " T = %.1f K (true: %.0f K)\n"
(Float.exp (item [] !log_temp))
true_temp;
Printf.printf " A_V = %.3f (true: %.2f)\n" (item [] !av) true_av;
Printf.printf " logN = %.3f (true: %.1f)\n" (item [] !log_norm)
true_log_norm;
(* Show fitted vs observed magnitudes *)
Printf.printf "\nFitted vs observed magnitudes:\n";
let fitted_mags = forward_model !log_temp !av !log_norm in
Printf.printf "%5s %8s %8s %8s\n" "Band" "Observed" "Fitted" "Residual";
Printf.printf "%5s %8s %8s %8s\n" "-----" "--------" "--------" "--------";
List.iteri
(fun i (obs, fit) ->
let o = item [] obs in
let f = item [] fit in
Printf.printf "%5s %8.3f %8.3f %+8.3f\n" band_names.(i) o f (f -. o))
(List.combine obs_mags fitted_mags)
================================================
FILE: dev/umbra/examples/06-coordinates-and-time/README.md
================================================
# `06-coordinates-and-time`
Celestial coordinates, astronomical time scales, and survey selection.
Demonstrates frame transforms (ICRS, Galactic), angular separation, time scale
conversions (UTC, TAI, TT, TDB), altitude-azimuth coordinates, airmass, and
a practical survey selection function.
```bash
dune exec dev/umbra/examples/06-coordinates-and-time/main.exe
```
## What You'll Learn
- Creating celestial coordinates in ICRS and converting to Galactic frame
- Computing angular separations between objects
- Parsing ISO 8601 dates and converting between time scales
- Computing horizontal coordinates for a ground-based observer
- Building a survey selection function from airmass, altitude, and magnitude cuts
## Key Functions
| Function | Purpose |
| ---------------------------- | --------------------------------------------- |
| `Coord.of_radec` | Create ICRS coordinates from RA/Dec |
| `Coord.galactic` | Convert to Galactic coordinates |
| `Coord.separation` | Angular separation between positions |
| `Time.of_iso` | Parse ISO 8601 date-time as UTC |
| `Time.utc_to_tai` | Convert UTC to TAI |
| `Time.tai_to_tt` | Convert TAI to Terrestrial Time |
| `Time.tt_to_tdb` | Convert TT to Barycentric Dynamical Time |
| `Time.to_jd`, `Time.to_mjd` | Extract Julian Date / Modified Julian Date |
| `Altaz.make_observer` | Create a ground-based observer location |
| `Altaz.of_coord` | Convert celestial to horizontal coordinates |
| `Altaz.alt`, `Altaz.az` | Extract altitude and azimuth |
| `Altaz.airmass` | Compute airmass at given altitude |
| `Filters.rubin_r` | Pre-built Rubin/LSST r-band filter |
## How It Works
**Coordinates**: Positions are stored as (longitude, latitude) pairs in typed
angle quantities. Frame transforms use 3x3 rotation matrices to convert
between ICRS, Galactic, Ecliptic, and Supergalactic systems. Angular separation
uses the Vincenty formula for numerical stability.
**Time**: Julian Dates carry phantom type tags (UTC, TAI, TT, TDB) that
enforce correct scale conversions at compile time. UTC-TAI uses the IERS
leap-second table; TT = TAI + 32.184s exactly; TDB-TT uses the Fairhead &
Bretagnon series.
**Altaz**: Converts ICRS to horizontal coordinates using IAU 2006 precession
and the Earth Rotation Angle. Airmass uses the Pickering (2002) formula.
**Selection**: Combines altitude (above horizon), airmass (atmospheric
extinction), and magnitude limit into a boolean selection function -- a
building block for survey simulations.
## Try It
1. Add atmospheric refraction with `Altaz.of_coord ~refraction:true`.
2. Compute the position angle from Vega to Deneb with `Coord.position_angle`.
3. Use `Coord.of_galactic` to create coordinates in the Galactic plane and
convert to ICRS.
4. Change the observer location and time to see how visibility changes.
## Next Steps
Explore the other Umbra examples for more advanced topics: catalog
cross-matching with `Coord.nearest`, cosmological power spectra with
`Cosmo.linear_power`, and Fisher matrix forecasts.
================================================
FILE: dev/umbra/examples/06-coordinates-and-time/dune
================================================
(executable
(name main)
(libraries nx rune umbra))
================================================
FILE: dev/umbra/examples/06-coordinates-and-time/main.ml
================================================
(*---------------------------------------------------------------------------
Copyright (c) 2026 The Raven authors. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)
(* Coordinates, time scales, and survey selection.
Demonstrates Umbra's coordinate, time, and observing modules: - Coord:
celestial coordinates with frame transforms (ICRS, Galactic, Ecliptic,
Supergalactic) and angular separation. - Time: astronomical time with
type-safe scale conversions (UTC, TAI, TT, TDB) and ISO 8601 parsing. -
Altaz: horizontal coordinates, airmass, and atmospheric refraction.
Combines these into a survey selection function that determines which targets
are observable given an observer, time, and observing constraints. *)
open Nx
open Umbra
let f64 = Nx.float64
let () =
Printf.printf "Coordinates, time scales, and survey selection\n";
Printf.printf "===============================================\n\n";
(* --- Part 1: Coordinate frames --- *)
Printf.printf "Part 1: Coordinate frame transforms\n";
Printf.printf "------------------------------------\n\n";
let targets =
[|
("Galactic center", 266.417, -28.936);
("Vega", 279.235, 38.784);
("North Galactic Pole", 192.860, 27.128);
("LMC", 80.894, -69.756);
("M31 (Andromeda)", 10.685, 41.269);
|]
in
Printf.printf "%20s %8s %8s %8s %8s\n" "Object" "RA" "Dec" "l" "b";
Printf.printf "%20s %8s %8s %8s %8s\n" "--------------------" "--------"
"--------" "--------" "--------";
Array.iter
(fun (name, ra_deg, dec_deg) ->
let coord =
Coord.of_radec
~ra:(Unit.Angle.of_deg (Nx.create f64 [| 1 |] [| ra_deg |]))
~dec:(Unit.Angle.of_deg (Nx.create f64 [| 1 |] [| dec_deg |]))
in
let gal = Coord.galactic coord in
let l = item [ 0 ] (Unit.Angle.in_deg (Coord.lon gal)) in
let b = item [ 0 ] (Unit.Angle.in_deg (Coord.lat gal)) in
Printf.printf "%20s %8.2f %+8.2f %8.2f %+8.2f\n" name ra_deg dec_deg l
b)
targets;
Printf.printf "\n";
(* Angular separation *)
Printf.printf "Angular separations:\n";
let vega =
Coord.of_radec
~ra:(Unit.Angle.of_deg (Nx.create f64 [| 1 |] [| 279.235 |]))
~dec:(Unit.Angle.of_deg (Nx.create f64 [| 1 |] [| 38.784 |]))
in
let altair =
Coord.of_radec
~ra:(Unit.Angle.of_deg (Nx.create f64 [| 1 |] [| 297.696 |]))
~dec:(Unit.Angle.of_deg (Nx.create f64 [| 1 |] [| 8.868 |]))
in
let deneb =
Coord.of_radec
~ra:(Unit.Angle.of_deg (Nx.create f64 [| 1 |] [| 310.358 |]))
~dec:(Unit.Angle.of_deg (Nx.create f64 [| 1 |] [| 45.280 |]))
in
let sep_va = item [ 0 ] (Unit.Angle.in_deg (Coord.separation vega altair)) in
let sep_vd = item [ 0 ] (Unit.Angle.in_deg (Coord.separation vega deneb)) in
let sep_ad = item [ 0 ] (Unit.Angle.in_deg (Coord.separation altair deneb)) in
Printf.printf " Vega - Altair: %.2f deg\n" sep_va;
Printf.printf " Vega - Deneb: %.2f deg\n" sep_vd;
Printf.printf " Altair - Deneb: %.2f deg\n" sep_ad;
Printf.printf " (Summer Triangle)\n\n";
(* --- Part 2: Time scales --- *)
Printf.printf "Part 2: Astronomical time scales\n";
Printf.printf "--------------------------------\n\n";
let t_utc = Time.of_iso "2024-06-21T04:00:00" in
let t_tai = Time.utc_to_tai t_utc in
let t_tt = Time.tai_to_tt t_tai in
let t_tdb = Time.tt_to_tdb t_tt in
Printf.printf " UTC: %s\n" (Time.to_iso t_utc);
Printf.printf " JD (UTC): %.6f\n" (Time.to_jd t_utc);
Printf.printf " MJD (UTC): %.6f\n" (Time.to_mjd t_utc);
Printf.printf " JD (TAI): %.6f\n" (Time.to_jd t_tai);
Printf.printf " JD (TT): %.6f\n" (Time.to_jd t_tt);
Printf.printf " JD (TDB): %.6f\n" (Time.to_jd t_tdb);
let dt_tai_utc =
Unit.to_float (Time.diff t_tai (Time.unsafe_of_jd (Time.to_jd t_utc)))
in
Printf.printf "\n TAI - UTC = %.1f s (leap seconds)\n" (dt_tai_utc *. 86400.0);
let t_j2000 = Time.of_iso "2000-01-01T12:00:00" in
let dt_j2000 = Unit.to_float (Time.diff t_utc t_j2000) in
Printf.printf " Days since J2000.0: %.2f\n\n" (dt_j2000 *. 86400.0 /. 86400.0);
(* --- Part 3: Horizontal coordinates and airmass --- *)
Printf.printf "Part 3: Altitude-azimuth and airmass\n";
Printf.printf "------------------------------------\n\n";
(* Observer at Cerro Pachon (Rubin site) *)
let obs =
Altaz.make_observer
~lat:(Unit.Angle.deg (-30.2444))
~lon:(Unit.Angle.deg (-70.7494))
~height:(Unit.Length.m 2663.0) ()
in
let obstime = Time.of_iso "2024-06-21T04:00:00" in
Printf.printf " Observer: Cerro Pachon (Rubin Observatory)\n";
Printf.printf " Lat: %.4f deg\n" (-30.2444);
Printf.printf " Lon: %.4f deg\n" (-70.7494);
Printf.printf " Elevation: %.0f m\n" 2663.0;
Printf.printf " Time: 2024-06-21 04:00 UTC\n\n";
let stars =
[|
("Vega", 279.235, 38.784);
("Sirius", 101.287, -16.716);
("Canopus", 95.988, -52.696);
("Alpha Cen", 219.902, -60.834);
("Fomalhaut", 344.413, -29.622);
|]
in
Printf.printf "%12s %7s %7s %8s\n" "Star" "Alt" "Az" "Airmass";
Printf.printf "%12s %7s %7s %8s\n" "------------" "-------" "-------"
"--------";
Array.iter
(fun (name, ra_deg, dec_deg) ->
let coord =
Coord.of_radec
~ra:(Unit.Angle.of_deg (Nx.create f64 [| 1 |] [| ra_deg |]))
~dec:(Unit.Angle.of_deg (Nx.create f64 [| 1 |] [| dec_deg |]))
in
let hz = Altaz.of_coord ~obstime ~observer:obs coord in
let alt_deg =
item [ 0 ] (Unit.Angle.to_tensor (Altaz.alt hz)) *. 180.0 /. Float.pi
in
let az_deg =
item [ 0 ] (Unit.Angle.to_tensor (Altaz.az hz)) *. 180.0 /. Float.pi
in
let am = item [ 0 ] (Altaz.airmass hz) in
Printf.printf "%12s %+7.1f %7.1f %8.2f\n" name alt_deg az_deg am)
stars;
Printf.printf "\n";
(* --- Part 4: Survey selection --- *)
Printf.printf "Part 4: Survey selection function\n";
Printf.printf "---------------------------------\n\n";
let mag_limit = 20.0 in
let airmass_cut = 2.0 in
Printf.printf " Selection criteria:\n";
Printf.printf " Magnitude limit: r < %.1f (AB)\n" mag_limit;
Printf.printf " Airmass cut: X < %.1f\n" airmass_cut;
Printf.printf " Above horizon: alt > 0 deg\n\n";
let bp = Filters.rubin_r in
let norm = Nx.scalar f64 (Float.exp (-49.0)) in
let star_data =
[|
("Vega", 279.235, 38.784, 5800.0);
("Sirius", 101.287, -16.716, 9940.0);
("Canopus", 95.988, -52.696, 7350.0);
("Alpha Cen", 219.902, -60.834, 5790.0);
("Fomalhaut", 344.413, -29.622, 8590.0);
|]
in
Printf.printf "%12s %7s %8s %6s %s\n" "Star" "Alt" "Airmass" "r_mag"
"Select?";
Printf.printf "%12s %7s %8s %6s %s\n" "------------" "-------" "--------"
"------" "-------";
Array.iter
(fun (name, ra_deg, dec_deg, temp_k) ->
let coord =
Coord.of_radec
~ra:(Unit.Angle.of_deg (Nx.create f64 [| 1 |] [| ra_deg |]))
~dec:(Unit.Angle.of_deg (Nx.create f64 [| 1 |] [| dec_deg |]))
in
let hz = Altaz.of_coord ~obstime ~observer:obs coord in
let alt_deg =
item [ 0 ] (Unit.Angle.to_tensor (Altaz.alt hz)) *. 180.0 /. Float.pi
in
let am = item [ 0 ] (Altaz.airmass hz) in
(* Synthetic magnitude through Rubin r-band *)
let temp = Unit.Temperature.of_kelvin (Nx.scalar f64 temp_k) in
let bp_wave = Photometry.wavelength bp in
let sed =
Spectrum.blackbody ~temperature:temp ~wavelength:bp_wave
|> Spectrum.scale norm |> Spectrum.as_flux_density
in
let r_mag = item [] (Photometry.ab_mag bp sed) in
let selected = alt_deg > 0.0 && am < airmass_cut && r_mag < mag_limit in
Printf.printf "%12s %+7.1f %8.2f %6.2f %s\n" name alt_deg am r_mag
(if selected then "YES" else "no"))
star_data;
Printf.printf "\n Height stored: %.0f m\n"
(item [] (Unit.Length.to_tensor (Altaz.observer_height obs)))
================================================
FILE: dev/umbra/examples/07-batch-photometry/README.md
================================================
# `07-batch-photometry`
Computes SDSS g-r colors for a grid of blackbody templates at different
temperatures and dust extinctions in a single pass using batch operations.
Instead of looping over individual spectra, the values tensor has a leading
batch dimension and all photometry operations broadcast over it.
```bash
cd dev/umbra
dune exec --root . examples/07-batch-photometry/main.exe
```
## What You'll Learn
- Constructing batched spectra by stacking blackbodies into a leading dimension
- Broadcasting extinction across a batch of SEDs with per-spectrum A_V
- Computing synthetic SDSS photometry with AB magnitudes
- Exploring color-temperature and color-extinction relations
## Key Functions
| Function | Purpose |
| -------------------------- | ------------------------------------------------ |
| `Spectrum.blackbody` | Generate Planck spectrum at a given temperature |
| `Spectrum.create` | Build a spectrum from wavelength and value arrays |
| `Spectrum.as_flux_density` | Cast to flux density kind for photometry |
| `Nx.stack` | Stack individual spectra into a batch dimension |
| `Extinction.ccm89` | Create CCM89 dust extinction law |
| `Extinction.apply` | Apply reddening with per-spectrum A_V broadcast |
| `Photometry.ab_mag` | Compute AB magnitude through a bandpass |
| `Filters.sdss_g` | SDSS g-band filter response |
## How It Works
The example first builds a grid of 20 blackbody spectra from 3000 K to 30000 K
by stacking individual `Spectrum.blackbody` outputs into a `[n_temp; 500]`
values tensor. When this batch spectrum is passed to `Photometry.ab_mag`, the
integration broadcasts over the leading dimension, producing one magnitude per
temperature in a single call.
The second half demonstrates per-spectrum extinction. A T=6000 K blackbody is
replicated into 10 copies, and `Extinction.apply` is called with an A_V tensor
of shape `[n_av; 1]` that broadcasts against the `[n_av; 500]` flux values.
This yields reddened g-r colors across a range of dust columns without any
explicit loop.
## Try It
1. Increase the temperature grid to 100 points and plot the g-r color curve to
see where the blue turnover occurs.
2. Add a third band (sdss_i) and compute the g-r vs r-i color-color diagram.
3. Replace the blackbody with a power-law spectrum and observe how the color
trends differ.
## Next Steps
Continue to [08-photometric-redshifts](../08-photometric-redshifts/) to learn
how to estimate galaxy redshifts by combining grid search with gradient-based
refinement through the differentiable photometry pipeline.
================================================
FILE: dev/umbra/examples/07-batch-photometry/dune
================================================
(executable
(name main)
(libraries nx rune umbra))
================================================
FILE: dev/umbra/examples/07-batch-photometry/main.ml
================================================
(*---------------------------------------------------------------------------
Copyright (c) 2026 The Raven authors. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)
(* Batch template photometry.
Computes SDSS g-r colors for a grid of blackbody templates at different
temperatures and dust extinctions in a single pass, demonstrating batched
spectra. Instead of looping over individual spectra, the values tensor has a
leading batch dimension and all photometry operations broadcast over it. *)
open Nx
open Umbra
let f64 = Nx.float64
let () =
Printf.printf "Batch Template Photometry\n";
Printf.printf "=========================\n\n";
(* Temperature grid: 20 blackbodies from 3000K to 30000K *)
let n_temp = 20 in
let temps =
Array.init n_temp (fun i ->
3000.0
+. (Float.of_int i *. (30000.0 -. 3000.0) /. Float.of_int (n_temp - 1)))
in
(* Shared wavelength grid covering SDSS g and r *)
let wavelength = Unit.Length.of_m (Nx.linspace f64 3e-7 1.1e-6 500) in
(* Build batch spectrum: stack individual blackbodies into [n_temp; 500] *)
let values =
Nx.stack
(List.init n_temp (fun i ->
let temp = Unit.Temperature.of_kelvin (Nx.scalar f64 temps.(i)) in
Spectrum.values (Spectrum.blackbody ~temperature:temp ~wavelength)))
in
let batch = Spectrum.create ~wavelength ~values |> Spectrum.as_flux_density in
(* AB magnitudes in g and r — returns shape [n_temp] each *)
let g_mag = Photometry.ab_mag Filters.sdss_g batch in
let r_mag = Photometry.ab_mag Filters.sdss_r batch in
let g_r = Nx.sub g_mag r_mag in
Printf.printf "Unreddened blackbody colors (SDSS g-r):\n";
Printf.printf "%8s %8s %8s %8s\n" "T (K)" "g" "r" "g-r";
Printf.printf "%8s %8s %8s %8s\n" "--------" "--------" "--------"
"--------";
Array.iteri
(fun i t ->
if i mod 4 = 0 || i = n_temp - 1 then
Printf.printf "%8.0f %+8.3f %+8.3f %+8.3f\n" t (item [ i ] g_mag)
(item [ i ] r_mag) (item [ i ] g_r))
temps;
(* Now apply per-spectrum extinction: A_V from 0.0 to 2.0 *)
Printf.printf "\nReddening a T=6000K blackbody (SDSS g-r vs A_V):\n";
let n_av = 10 in
let av_values = Nx.linspace f64 0.0 2.0 n_av in
(* Single-temperature spectrum, batched over A_V *)
let temp_6k = Unit.Temperature.of_kelvin (Nx.scalar f64 6000.0) in
let sed_1d =
Spectrum.blackbody ~temperature:temp_6k ~wavelength
|> Spectrum.as_flux_density
in
(* Replicate into [n_av; 500] *)
let sed_values =
Nx.stack (List.init n_av (fun _ -> Spectrum.values sed_1d))
in
let sed_batch =
Spectrum.create ~wavelength ~values:sed_values |> Spectrum.as_flux_density
in
(* Per-spectrum A_V: reshape to [n_av; 1] to broadcast with [n_av; 500] *)
let rv = Nx.scalar f64 3.1 in
let av_col = Nx.reshape [| n_av; 1 |] av_values in
let reddened = Extinction.apply (Extinction.ccm89 ~rv) ~av:av_col sed_batch in
let g_red = Photometry.ab_mag Filters.sdss_g reddened in
let r_red = Photometry.ab_mag Filters.sdss_r reddened in
let g_r_red = Nx.sub g_red r_red in
Printf.printf "%8s %8s\n" "A_V" "g-r";
Printf.printf "%8s %8s\n" "--------" "--------";
for i = 0 to n_av - 1 do
Printf.printf "%8.2f %+8.3f\n" (item [ i ] av_values) (item [ i ] g_r_red)
done
================================================
FILE: dev/umbra/examples/08-photometric-redshifts/README.md
================================================
# `08-photometric-redshifts`
Two-stage photometric redshift estimation: coarse grid search followed by
gradient-based refinement using Adam. The full pipeline (blackbody -> redshift
-> extinction -> photometry) is differentiable through Rune, enabling gradient
descent on redshift and normalization parameters against synthetic SDSS ugriz
observations.
```bash
cd dev/umbra
dune exec --root . examples/08-photometric-redshifts/main.exe
```
## What You'll Learn
- Building an end-to-end differentiable photometric pipeline through SDSS ugriz filters
- Composing spectrum redshifting, dust extinction, and synthetic photometry
- Combining grid search initialization with autodiff gradient refinement
- Using multi-parameter gradients to jointly fit redshift and normalization
## Key Functions
| Function | Purpose |
| -------------------------- | ---------------------------------------------------- |
| `Spectrum.blackbody` | Generate a template SED at given temperature |
| `Spectrum.redshift` | Apply cosmological redshift to a spectrum |
| `Spectrum.scale` | Scale spectrum by a normalization factor |
| `Extinction.apply` | Apply dust reddening with CCM89 law |
| `Photometry.ab_mag` | Compute AB magnitude through a bandpass |
| `Photometry.wavelength` | Extract the wavelength grid of a bandpass filter |
| `Rune.value_and_grads` | Compute loss and parameter gradients in one pass |
| `Vega.adam` | Adam optimizer for gradient refinement |
## How It Works
The example generates synthetic observed magnitudes for a galaxy at z=0.3 with
T=5500 K, A_V=0.2, by pushing a blackbody through the full pipeline:
`blackbody -> scale -> extinction -> redshift -> ab_mag` in each of the five
SDSS bands. These serve as the "data" to fit against.
Stage 1 performs a coarse grid search over 30 redshift values from 0.01 to
0.90, computing chi-squared at each point with a fixed template. This
identifies a rough minimum without requiring gradients.
Stage 2 takes the best grid redshift and refines it with 500 Adam optimizer
steps. The loss function (sum of squared magnitude residuals) flows through
`Spectrum.redshift` and `Photometry.ab_mag`, so Rune provides exact gradients
with respect to log(1+z) and log(normalization). The parameterization in
log-space ensures positivity and improves conditioning.
## Try It
1. Change the true redshift to z=0.7 and observe how the grid search coarseness
affects the initial estimate.
2. Add temperature as a third free parameter in the refinement stage.
3. Replace the single blackbody template with a composite SED that includes an
emission line.
## Next Steps
Continue to [09-gravitational-lensing](../09-gravitational-lensing/) to see how
Rune's autodiff can fit physical parameters of a gravitational lens model from
observed image positions.
================================================
FILE: dev/umbra/examples/08-photometric-redshifts/dune
================================================
(executable
(name main)
(libraries nx rune vega umbra))
================================================
FILE: dev/umbra/examples/08-photometric-redshifts/main.ml
================================================
(*---------------------------------------------------------------------------
Copyright (c) 2026 The Raven authors. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)
(* Photometric redshift estimation via template fitting.
Demonstrates composing Spectrum.redshift -> Extinction.apply ->
Photometry.ab_mag through real SDSS filters, with gradient refinement via
Rune's autodiff. Auto-resampling makes the pipeline seamless.
Stage 1: Grid search over redshift to find a coarse estimate. Stage 2: Adam
optimizer refines z and normalization using AD gradients. *)
open Nx
open Umbra
let f64 = Nx.float64
let bands =
[
Filters.sdss_u;
Filters.sdss_g;
Filters.sdss_r;
Filters.sdss_i;
Filters.sdss_z;
]
let band_names = [| "u"; "g"; "r"; "i"; "z" |]
(* True parameters for synthetic galaxy *)
let true_z = 0.3
let true_temp = 5500.0
let true_av = 0.2
let true_log_norm = -50.0
let rv = Nx.scalar f64 3.1
(* Synthetic observed magnitudes *)
let obs_mags =
let temp = Unit.Temperature.of_kelvin (Nx.scalar f64 true_temp) in
let z = Nx.scalar f64 true_z in
let av = Nx.scalar f64 true_av in
let norm = Nx.scalar f64 (Float.exp true_log_norm) in
List.map
(fun bp ->
let bp_wave = Photometry.wavelength bp in
let sed =
Spectrum.blackbody ~temperature:temp ~wavelength:bp_wave
|> Spectrum.scale norm
|> Extinction.apply (Extinction.ccm89 ~rv) ~av
|> Spectrum.as_flux_density |> Spectrum.redshift ~z
in
Photometry.ab_mag bp sed)
bands
(* Grid search: coarse scan over z *)
let grid_search () =
let best_z = ref 0.0 in
let best_chi2 = ref Float.infinity in
let n_z = 30 in
for iz = 0 to n_z - 1 do
let z = Nx.scalar f64 (0.01 +. (Float.of_int iz *. 0.03)) in
let temp = Unit.Temperature.of_kelvin (Nx.scalar f64 5000.0) in
let norm = Nx.scalar f64 (Float.exp (-50.0)) in
let pred =
List.map
(fun bp ->
let bp_wave = Photometry.wavelength bp in
let sed =
Spectrum.blackbody ~temperature:temp ~wavelength:bp_wave
|> Spectrum.scale norm |> Spectrum.as_flux_density
|> Spectrum.redshift ~z
in
Photometry.ab_mag bp sed)
bands
in
(* Color-based chi-squared: compare color differences *)
let chi2 =
List.fold_left2
(fun acc p o -> add acc (square (sub p o)))
(scalar f64 0.0) pred obs_mags
in
let chi2_v = item [] chi2 in
if chi2_v < !best_chi2 then begin
best_chi2 := chi2_v;
best_z := item [] z
end
done;
!best_z
(* Gradient refinement around grid minimum *)
let refine z0 =
let loss params =
match params with
| [ log_z1; log_norm ] ->
let z = sub (exp log_z1) (scalar f64 1.0) in
let temp = Unit.Temperature.of_kelvin (Nx.scalar f64 5500.0) in
let norm = exp log_norm in
let pred =
List.map
(fun bp ->
let bp_wave = Photometry.wavelength bp in
let sed =
Spectrum.blackbody ~temperature:temp ~wavelength:bp_wave
|> Spectrum.scale norm |> Spectrum.as_flux_density
|> Spectrum.redshift ~z
in
Photometry.ab_mag bp sed)
bands
in
List.fold_left2
(fun acc p o -> add acc (square (sub p o)))
(scalar f64 0.0) pred obs_mags
| _ -> failwith "expected [log_z1; log_norm]"
in
let algo = Vega.adam (Vega.Schedule.constant 5e-4) in
let log_z1 = ref (scalar f64 (Float.log (1.0 +. z0))) in
let log_norm = ref (scalar f64 (-50.0)) in
let states = [| Vega.init algo !log_z1; Vega.init algo !log_norm |] in
let refs = [| log_z1; log_norm |] in
for _ = 0 to 499 do
let _loss_val, grads = Rune.value_and_grads loss [ !log_z1; !log_norm ] in
List.iteri
(fun j g ->
let p, s = Vega.step states.(j) ~grad:g ~param:!(refs.(j)) in
refs.(j) := p;
states.(j) <- s)
grads
done;
Float.exp (item [] !log_z1) -. 1.0
let () =
Printf.printf "Photometric Redshift Estimation\n";
Printf.printf "===============================\n";
Printf.printf
"Pipeline: blackbody -> redshift -> extinction -> ab_mag (SDSS)\n\n";
Printf.printf "True: z=%.3f T=%.0fK A_V=%.2f\n\n" true_z true_temp true_av;
Printf.printf "Observed magnitudes:\n";
List.iteri
(fun i m -> Printf.printf " %s = %.3f\n" band_names.(i) (item [] m))
obs_mags;
Printf.printf "\nStep 1: Grid search (z = 0.01 to 0.90)...\n";
let z_grid = grid_search () in
Printf.printf " Best grid z = %.3f\n" z_grid;
Printf.printf "\nStep 2: Gradient refinement (500 Adam steps)...\n";
let z_fit = refine z_grid in
Printf.printf " Refined z = %.4f (true: %.3f)\n" z_fit true_z;
Printf.printf " Error = %.4f\n" (Float.abs (z_fit -. true_z))
================================================
FILE: dev/umbra/examples/09-gravitational-lensing/README.md
================================================
# `09-gravitational-lensing`
Fits gravitational lens parameters (lens center and Einstein radius) from
observed image positions of a quadruply-imaged quasar. The point-mass lens
equation is expressed as Nx tensor operations, making the model fully
differentiable through Rune for gradient-based fitting with Adam.
```bash
cd dev/umbra
dune exec --root . examples/09-gravitational-lensing/main.exe
```
## What You'll Learn
- Expressing the gravitational lens equation as differentiable tensor operations
- Minimizing source-plane variance to fit lens parameters
- Fitting physical parameters (lens position, Einstein radius) via Adam optimizer
- Using autodiff gradients with a physics-based loss function
## Key Functions
| Function | Purpose |
| ----------------------- | ------------------------------------------------------ |
| `Nx.square` | Squared distances for radial computation |
| `Nx.sqrt` | Radial distance from lens center |
| `Nx.mean` | Mean source position across images |
| `Rune.value_and_grads` | Compute loss and gradients for all lens parameters |
| `Vega.adam` | Adam optimizer for parameter fitting |
| `Vega.step` | Apply one optimization update |
## How It Works
A point-mass gravitational lens deflects light according to the lens equation:
beta = theta - theta_E^2 * theta_hat / |theta|, where beta is the true source
position, theta is the observed image position, and theta_E is the Einstein
radius. If the lens model is correct, all observed images should map back to the
same source position in the source plane.
The example generates synthetic image positions for a quadruply-imaged quasar
with known lens parameters (x_L=0.1, y_L=-0.05, theta_E=1.0) plus small noise.
The loss function maps each image back to the source plane using the current
lens parameters and computes the variance of the inferred source positions. A
correct lens model yields zero variance.
Starting from an initial guess of (x_L=0, y_L=0, theta_E=0.5), the Adam
optimizer runs for 500 steps. Rune differentiates through the entire lens
equation -- including the division by |theta|, the square root, and the
mean/variance -- to provide exact gradients that drive convergence to the true
parameters.
## Try It
1. Increase the noise level from 0.005 to 0.05 and observe how parameter
uncertainties grow.
2. Add a shear term (gamma_1, gamma_2) to the lens model for external
tidal perturbation.
3. Replace the point-mass with a singular isothermal sphere (SIS) profile
where the deflection is constant: alpha = theta_E * theta_hat.
## Next Steps
Continue to [10-uncertainty-propagation](../10-uncertainty-propagation/) to
learn how to automatically propagate parameter uncertainties through
cosmological distance calculations using exact AD Jacobians.
================================================
FILE: dev/umbra/examples/09-gravitational-lensing/dune
================================================
(executable
(name main)
(libraries nx rune vega umbra))
================================================
FILE: dev/umbra/examples/09-gravitational-lensing/main.ml
================================================
(*---------------------------------------------------------------------------
Copyright (c) 2026 The Raven authors. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)
(* Differentiable gravitational lens parameter fitting.
A point-mass gravitational lens produces multiple images of a background
source. Given the observed image positions, we fit the lens center and
Einstein radius by requiring that all images map back to the same source
position. The lens equation and source-plane mapping are expressed as Nx
tensor operations, making the entire model differentiable through Rune. *)
open Nx
let f64 = Nx.float64
(* True lens parameters (for generating synthetic data) *)
let true_x_l = 0.1
let true_y_l = -0.05
let true_theta_e = 1.0
(* Generate synthetic image positions for a quadruply-imaged quasar. Source at
(0.15, 0.08), lens at (true_x_l, true_y_l). *)
let source_x = 0.15
let source_y = 0.08
let () = Printf.printf "Differentiable gravitational lens modeling\n"
let () = Printf.printf "==========================================\n\n"
(* Solve lens equation: beta = theta - theta_E^2 * theta / |theta|^2 for point
mass (where theta is relative to lens center). We generate 4 image positions
by solving analytically + adding noise. *)
let img_x, img_y =
(* For a point mass, images lie along the source-lens axis. Place 4 images at
realistic positions around the lens. *)
let dx = source_x -. true_x_l in
let dy = source_y -. true_y_l in
let beta = Float.sqrt ((dx *. dx) +. (dy *. dy)) in
let cos_a = dx /. beta and sin_a = dy /. beta in
(* Two images along the axis *)
let theta_p =
(beta
+. Float.sqrt ((beta *. beta) +. (4.0 *. true_theta_e *. true_theta_e)))
/. 2.0
in
let theta_m =
(beta
-. Float.sqrt ((beta *. beta) +. (4.0 *. true_theta_e *. true_theta_e)))
/. 2.0
in
(* Image positions in 2D (along and perpendicular to axis, with noise) *)
let noise = 0.005 in
let x1 = true_x_l +. (theta_p *. cos_a) +. (noise *. 0.3) in
let y1 = true_y_l +. (theta_p *. sin_a) -. (noise *. 0.2) in
let x2 = true_x_l +. (theta_m *. cos_a) -. (noise *. 0.5) in
let y2 = true_y_l +. (theta_m *. sin_a) +. (noise *. 0.4) in
(* Add two more images from slight perturbation (simulating extended
source) *)
let x3 = true_x_l +. (theta_p *. 0.7 *. cos_a) +. (theta_p *. 0.3 *. sin_a) in
let y3 = true_y_l +. (theta_p *. 0.7 *. sin_a) -. (theta_p *. 0.3 *. cos_a) in
let x4 = true_x_l -. (theta_p *. 0.5 *. cos_a) +. (theta_p *. 0.4 *. sin_a) in
let y4 = true_y_l -. (theta_p *. 0.5 *. sin_a) -. (theta_p *. 0.4 *. cos_a) in
( create f64 [| 4 |] [| x1; x2; x3; x4 |],
create f64 [| 4 |] [| y1; y2; y3; y4 |] )
(* Loss: given lens params, map each image back to the source plane. All images
should map to the same source -> minimize variance of inferred source
positions. *)
let loss params =
match params with
| [ x_l; y_l; theta_e ] ->
(* Displacement from lens center *)
let dx = sub img_x x_l in
let dy = sub img_y y_l in
(* Distance from lens center *)
let r_sq = add (square dx) (square dy) in
let r = sqrt r_sq in
(* Point-mass deflection: alpha = theta_E^2 / r *)
let alpha = div (square theta_e) r in
(* Source position for each image: beta = theta - alpha * hat(theta) *)
let beta_x = sub img_x (mul alpha (div dx r)) in
let beta_y = sub img_y (mul alpha (div dy r)) in
(* Variance of source positions (should be ~0 if lens model is correct) *)
let mean_bx = mean beta_x in
let mean_by = mean beta_y in
let var_x = mean (square (sub beta_x mean_bx)) in
let var_y = mean (square (sub beta_y mean_by)) in
add var_x var_y
| _ -> failwith "expected [x_l; y_l; theta_e]"
let () =
Printf.printf "True parameters:\n";
Printf.printf " x_L = %.3f arcsec\n" true_x_l;
Printf.printf " y_L = %.3f arcsec\n" true_y_l;
Printf.printf " theta_E = %.3f arcsec\n\n" true_theta_e;
let algo = Vega.adam (Vega.Schedule.constant 1e-2) in
let x_l = ref (scalar f64 0.0) in
let y_l = ref (scalar f64 0.0) in
let theta_e = ref (scalar f64 0.5) in
let states =
[| Vega.init algo !x_l; Vega.init algo !y_l; Vega.init algo !theta_e |]
in
let steps = 500 in
Printf.printf "%5s %12s %8s %8s %8s\n" "step" "loss" "x_L" "y_L" "theta_E";
Printf.printf "%5s %12s %8s %8s %8s\n" "-----" "------------" "--------"
"--------" "--------";
let refs = [| x_l; y_l; theta_e |] in
for i = 0 to steps - 1 do
let loss_val, grads = Rune.value_and_grads loss [ !x_l; !y_l; !theta_e ] in
List.iteri
(fun j g ->
let p, s = Vega.step states.(j) ~grad:g ~param:!(refs.(j)) in
refs.(j) := p;
states.(j) <- s)
grads;
if i mod 100 = 0 || i = steps - 1 then
Printf.printf "%5d %12.8f %8.4f %8.4f %8.4f\n" i (item [] loss_val)
(item [] !x_l) (item [] !y_l) (item [] !theta_e)
done;
Printf.printf "\nFitted parameters:\n";
Printf.printf " x_L = %.4f (true: %.4f)\n" (item [] !x_l) true_x_l;
Printf.printf " y_L = %.4f (true: %.4f)\n" (item [] !y_l) true_y_l;
Printf.printf " theta_E = %.4f (true: %.4f)\n" (item [] !theta_e)
true_theta_e
================================================
FILE: dev/umbra/examples/10-uncertainty-propagation/README.md
================================================
# `10-uncertainty-propagation`
Automatic uncertainty propagation through cosmological distance calculations.
Propagates H0 and Omega_m uncertainties through distance modulus using exact
AD Jacobians via forward-mode differentiation. The linear error propagation
formula (Sigma_out = J Sigma_in J^T) is validated against Monte Carlo sampling
with 50,000 draws.
```bash
cd dev/umbra
dune exec --root . examples/10-uncertainty-propagation/main.exe
```
## What You'll Learn
- Computing exact Jacobians automatically with forward-mode AD (`Rune.jacfwd`)
- Applying linear error propagation via the Jacobian covariance formula
- Validating analytical uncertainty estimates with Monte Carlo sampling
- Propagating scalar uncertainties through cosmological models with JVP
## Key Functions
| Function | Purpose |
| ---------------------------- | ------------------------------------------------ |
| `Cosmo.create_flat_lcdm` | Create a flat Lambda-CDM cosmology |
| `Cosmo.distance_modulus` | Compute distance modulus at a given redshift |
| `Rune.jacfwd` | Forward-mode Jacobian of a function |
| `Rune.jvp` | Jacobian-vector product for scalar propagation |
| `Nx.cholesky` | Cholesky decomposition for MC sampling |
| `Nx.matmul` | Matrix multiply for J Sigma J^T |
| `Nx.diag` | Build diagonal covariance from variances |
## How It Works
Given input parameters with uncertainties (H0 = 70 +/- 1 km/s/Mpc, Omega_m =
0.30 +/- 0.01), the example propagates these through `Cosmo.distance_modulus`
at five redshifts (z = 0.1 to 1.0). The propagation uses the standard linear
formula: Sigma_out = J Sigma_in J^T, where J is the Jacobian of the distance
modulus with respect to [H0, Omega_m]. Rather than deriving J analytically,
`Rune.jacfwd` computes it automatically with just two JVP evaluations (one per
input parameter).
For validation, the example draws 50,000 Monte Carlo samples from the input
covariance via Cholesky decomposition, evaluates the model at each sample, and
computes empirical output statistics. Agreement below 1% between AD and MC
confirms that linear propagation is accurate for these parameter ranges.
A scalar API demo shows the simpler case: propagating redshift uncertainty
(z = 0.5 +/- 0.01) through a single `jvp` call, which returns both the output
value and its sensitivity to the input perturbation.
## Try It
1. Add correlation between H0 and Omega_m by putting off-diagonal terms in the
input covariance matrix.
2. Increase the uncertainties to see where linear propagation breaks down and
MC diverges from AD.
3. Propagate uncertainties through `Cosmo.luminosity_distance` instead of
distance modulus and compare the relative errors.
## Next Steps
Continue to [11-bayesian-sed](../11-bayesian-sed/) to see how Fisher information
and Hamiltonian Monte Carlo provide both theoretical bounds and full Bayesian
posteriors for SED parameter estimation.
================================================
FILE: dev/umbra/examples/10-uncertainty-propagation/dune
================================================
(executable
(name main)
(libraries nx rune umbra))
================================================
FILE: dev/umbra/examples/10-uncertainty-propagation/main.ml
================================================
(*---------------------------------------------------------------------------
Copyright (c) 2026 The Raven authors. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)
(* Automatic uncertainty propagation through cosmological distances.
Demonstrates propagating H0 and Omega_m uncertainties through
Umbra.Cosmo.distance_modulus using exact AD Jacobians. The linear error
propagation formula (Sigma_out = J Sigma_in J^T) is computed automatically
via Rune.jacfwd. Results are validated against Monte Carlo sampling.
Fisher, propagation, and Monte Carlo are all trivial given Rune's jacfwd --
no dedicated library needed. *)
open Nx
open Umbra
let f64 = Nx.float64
(* Redshifts to evaluate *)
let redshifts = [| 0.1; 0.3; 0.5; 0.7; 1.0 |]
(* Forward model: given [H0; Omega_m], compute distance modulus at z *)
let distance_modulus_at z p =
let h0 = Nx.reshape [||] (Nx.slice [ I 0 ] p) in
let om = Nx.reshape [||] (Nx.slice [ I 1 ] p) in
let cosmo = Cosmo.create_flat_lcdm ~h0 ~omega_m:om in
Cosmo.distance_modulus ~p:cosmo (Nx.scalar f64 z)
(* Linear error propagation: Sigma_out = J Sigma_in J^T *)
let propagate f ~mean ~cov =
let j = Rune.jacfwd f mean in
let mean_out = f mean in
let cov_out = Nx.matmul (Nx.matmul j cov) (Nx.matrix_transpose j) in
let cov_out = Nx.div_s (Nx.add cov_out (Nx.matrix_transpose cov_out)) 2.0 in
(mean_out, cov_out)
(* Monte Carlo validation *)
let monte_carlo ?(n_samples = 50_000) f ~mean ~cov =
let n = Nx.numel mean in
let l = Nx.cholesky cov in
let z = Nx.randn f64 [| n_samples; n |] in
let samples = Nx.add (Nx.matmul z (Nx.matrix_transpose l)) mean in
let y0 = f (Nx.slice [ I 0 ] samples) in
let m = Nx.numel y0 in
let outputs = Nx.zeros f64 [| n_samples; m |] in
Nx.set_slice [ I 0 ] outputs y0;
for i = 1 to n_samples - 1 do
Nx.set_slice [ I i ] outputs (f (Nx.slice [ I i ] samples))
done;
let mean_out = Nx.mean ~axes:[ 0 ] outputs in
let centered = Nx.sub outputs mean_out in
let cov_out =
Nx.div_s
(Nx.matmul (Nx.matrix_transpose centered) centered)
(Float.of_int (n_samples - 1))
in
(mean_out, cov_out)
let () =
Printf.printf "Automatic Uncertainty Propagation through Cosmology\n";
Printf.printf "====================================================\n\n";
(* Parameters with uncertainties *)
let h0_mean = 70.0 and h0_std = 1.0 in
let om_mean = 0.30 and om_std = 0.01 in
Printf.printf "Input parameters:\n";
Printf.printf " H0 = %.1f +/- %.1f km/s/Mpc\n" h0_mean h0_std;
Printf.printf " Omega_m = %.2f +/- %.2f\n\n" om_mean om_std;
let mean = Nx.create f64 [| 2 |] [| h0_mean; om_mean |] in
let std = Nx.create f64 [| 2 |] [| h0_std; om_std |] in
let cov = Nx.diag (Nx.square std) in
Printf.printf "%5s %10s %10s %10s %10s\n" "z" "mu (AD)" "sigma (AD)"
"sigma (MC)" "agreement";
Printf.printf "%5s %10s %10s %10s %10s\n" "-----" "----------"
"----------" "----------" "----------";
Array.iter
(fun z ->
(* AD-based propagation *)
let f p = Nx.reshape [| 1 |] (distance_modulus_at z p) in
let mean_ad, cov_ad = propagate f ~mean ~cov in
let mu_ad = item [ 0 ] mean_ad in
let std_ad = Float.sqrt (item [ 0; 0 ] cov_ad) in
(* Monte Carlo validation *)
let _, cov_mc = monte_carlo f ~mean ~cov in
let std_mc = Float.sqrt (item [ 0; 0 ] cov_mc) in
let agreement = Float.abs (std_ad -. std_mc) /. std_mc *. 100.0 in
Printf.printf "%5.1f %10.4f %10.4f %10.4f %9.1f%%\n" z mu_ad std_ad
std_mc agreement)
redshifts;
Printf.printf "\n";
Printf.printf "AD uses exact Jacobians (2 JVP calls for 2 parameters).\n";
Printf.printf "MC uses 50,000 samples for validation.\n";
Printf.printf "Agreement < 1%% confirms linear propagation is accurate.\n";
(* Also demonstrate the simple scalar API *)
Printf.printf "\n--- Scalar API demo ---\n\n";
Printf.printf "Propagating z = 0.5 +/- 0.01 through distance_modulus:\n";
let x = Nx.scalar f64 0.5 in
let y, dy =
Rune.jvp (fun z -> Cosmo.distance_modulus z) x (Nx.scalar f64 1.0)
in
let mu_mean = Nx.item [] y in
let mu_std = Float.abs (Nx.item [] dy) *. 0.01 in
Printf.printf " mu = %.4f +/- %.4f\n" mu_mean mu_std
================================================
FILE: dev/umbra/examples/11-bayesian-sed/README.md
================================================
# `11-bayesian-sed`
Fisher information matrix analysis and Hamiltonian Monte Carlo sampling for
Bayesian SED parameter estimation. Computes Cramer-Rao bounds (theoretical
minimum uncertainties) from the Fisher matrix, then samples the full posterior
via HMC through the differentiable spectrum -> extinction -> photometry pipeline.
```bash
cd dev/umbra
dune exec --root . examples/11-bayesian-sed/main.exe
```
## What You'll Learn
- Computing the Fisher information matrix via reverse-mode Jacobians
- Deriving Cramer-Rao bounds on SED parameters (temperature, extinction)
- Sampling full Bayesian posteriors with Hamiltonian Monte Carlo
- Comparing Fisher-predicted vs HMC-sampled uncertainties
- Building differentiable forward models through tophat bandpasses
## Key Functions
| Function | Purpose |
| -------------------------- | --------------------------------------------------- |
| `Rune.jacrev` | Reverse-mode Jacobian for Fisher matrix computation |
| `Nx.inv` | Matrix inverse for Fisher -> covariance |
| `Nx.diagonal` | Extract diagonal (marginal variances) |
| `Spectrum.blackbody` | Generate Planck SED at given temperature |
| `Extinction.apply` | Apply CCM89 dust reddening |
| `Photometry.tophat` | Create rectangular bandpass filters |
| `Photometry.ab_mag` | Compute AB magnitude through a bandpass |
| `Norn.hmc` | Hamiltonian Monte Carlo posterior sampling |
## How It Works
The forward model maps two parameters -- log(T) and A_V -- to five broadband
magnitudes through the pipeline: `blackbody -> extinction -> ab_mag`. Synthetic
observations are generated at T=6500 K, A_V=0.5 with realistic photometric
errors (0.03-0.05 mag).
The Fisher information matrix F = J^T C^-1 J is computed from the Jacobian of
the model (via `Rune.jacrev`) and the observational covariance C. Inverting F
gives the Cramer-Rao lower bound -- the best achievable 1-sigma uncertainty on
each parameter for a given dataset, regardless of estimation method.
The example then samples the actual Bayesian posterior using `Norn.hmc`. The
log-posterior is a Gaussian likelihood with flat priors, and HMC uses Rune's
gradients to efficiently explore the parameter space with 500 post-warmup
samples. Comparing the HMC posterior width to the Fisher prediction validates
that the model is well-behaved: when they agree, the posterior is approximately
Gaussian and the Fisher bound is tight.
## Try It
1. Reduce the photometric errors to 0.01 mag and observe how both Fisher bounds
and HMC posteriors tighten.
2. Add a third parameter (redshift) and examine the resulting parameter
degeneracies in the Fisher matrix.
3. Replace the flat prior with an informative Gaussian prior on A_V and see
how the posterior shifts.
## Next Steps
Continue to [12-survey-optimization](../12-survey-optimization/) to see how
differentiable Fisher forecasting enables gradient-based optimization of survey
design parameters for weak gravitational lensing.
================================================
FILE: dev/umbra/examples/11-bayesian-sed/dune
================================================
(executable
(name main)
(libraries nx rune vega norn umbra))
================================================
FILE: dev/umbra/examples/11-bayesian-sed/main.ml
================================================
(*---------------------------------------------------------------------------
Copyright (c) 2026 The Raven authors. All rights reserved.
SPDX-License-Identifier: ISC
---------------------------------------------------------------------------*)
(* Fisher information and HMC sampling for SED parameter estimation.
Demonstrates two capabilities:
1. Fisher matrix: compute the Cramer-Rao bounds on temperature and extinction
-- "how well CAN I constrain these parameters from UGRIZ photometry?" --
before taking any data. Computed inline from Rune.jacrev + linear algebra.
2. HMC sampling: full Bayesian posterior through the differentiable Spectrum
-> Extinction -> Photometry pipeline, via Norn.hmc. *)
open Nx
open Umbra
let f64 = Nx.float64
(* Bandpasses *)
let n_bp = 20
let bands =
[
Photometry.tophat ~lo:(Unit.Length.m 3.0e-7) ~hi:(Unit.Length.m 4.0e-7)
~n:n_bp;
Photometry.tophat ~lo:(Unit.Length.m 4.0e-7) ~hi:(Unit.Length.m 5.5e-7)
~n:n_bp;
Photometry.tophat ~lo:(Unit.Length.m 5.5e-7) ~hi:(Unit.Length.m 7.0e-7)
~n:n_bp;
Photometry.tophat ~lo:(Unit.Length.m 7.0e-7) ~hi:(Unit.Length.m 8.5e-7)
~n:n_bp;
Photometry.tophat ~lo:(Unit.Length.m 8.5e-7) ~hi:(Unit.Length.m 1.0e-6)
~n:n_bp;
]
let band_names = [| "U"; "G"; "R"; "I"; "Z" |]
let rv = Nx.scalar f64 3.1
(* Forward model: [log_T, A_V] -> 5 magnitudes *)
let model params =
let log_temp = Nx.reshape [||] (Nx.slice [ I 0 ] params) in
let av = Nx.reshape [||] (Nx.slice [ I 1 ] params) in
let temp = Unit.Temperature.of_kelvin (Nx.exp log_temp) in
let mags =
List.map
(fun bp ->
let wave = Photometry.wavelength bp in
let sed =
Spectrum.blackbody ~temperature:temp ~wavelength:wave
|> Extinction.apply (Extinction.ccm89 ~rv) ~av
|> Spectrum.as_flux_density
in
Photometry.ab_mag bp sed)
bands
in
Nx.stack ~axis:0 mags
(* True parameters *)
let true_log_temp = Float.log 6500.0
let true_av = 0.5
let true_params = Nx.create f64 [| 2 |] [| true_log_temp; true_av |]
(* Synthetic observations *)
let obs_errs = Nx.create f64 [| 5 |] [| 0.05; 0.03; 0.03; 0.04; 0.05 |]
let obs_mags =
let true_mags = model true_params in
let noise = Nx.create f64 [| 5 |] [| 0.03; -0.02; 0.01; -0.01; 0.02 |] in
Nx.add true_mags noise
(* Fisher information: F = J^T C^-1 J *)
let fisher f ~params ~obs_cov =
let j = Rune.jacrev f params in
let jt = Nx.matrix_transpose j in
Nx.matmul (Nx.matmul jt (Nx.inv obs_cov)) j
(* Cramer-Rao bounds: sigma = sqrt(diag(F^-1)) *)
let marginal_sigma f = Nx.sqrt (Nx.diagonal (Nx.inv f))
let () =
Printf.printf "Fisher Information & HMC for SED Fitting\n";
Printf.printf "=========================================\n\n";
Printf.printf "True parameters:\n";
Printf.printf " T = %.0f K (log_T = %.4f)\n" (Float.exp true_log_temp)
true_log_temp;
Printf.printf " A_V = %.2f\n\n" true_av;
Printf.printf "Observed magnitudes:\n";
Array.iteri
(fun i name ->
Printf.printf " %s = %.3f +/- %.3f\n" name (item [ i ] obs_mags)
(item [ i ] obs_errs))
band_names;
Printf.printf "\n";
(* --- Fisher Information --- *)
Printf.printf "=== Fisher Information ===\n\n";
let obs_cov = Nx.diag (Nx.square obs_errs) in
let f = fisher model ~params:true_params ~obs_cov in
let sigma = marginal_sigma f in
Printf.printf "Fisher matrix:\n";
Printf.printf " F = [[ %10.2f %10.2f ]\n"
(item [ 0; 0 ] f)
(item [ 0; 1 ] f);
Printf.printf " [ %10.2f %10.2f ]]\n\n"
(item [ 1; 0 ] f)
(item [ 1; 1 ] f);
Printf.printf "Cramer-Rao bounds (best achievable 1-sigma):\n";
let sigma_log_t = item [ 0 ] sigma in
let sigma_av = item [ 1 ] sigma in
Printf.printf " sigma(log_T) = %.4f -> sigma(T) ~ %.0f K\n" sigma_log_t
(sigma_log_t *. Float.exp true_log_temp);
Printf.printf " sigma(A_V) = %.4f\n\n" sigma_av;
(* --- HMC Sampling --- *)
Printf.printf "=== HMC Posterior Sampling ===\n\n";
(* Log-posterior: Gaussian likelihood, flat prior *)
let log_posterior params =
let pred = model params in
let residuals = Nx.div (Nx.sub pred obs_mags) obs_errs in
Nx.mul_s (Nx.sum (Nx.square residuals)) (-0.5)
in
let init = Nx.create f64 [| 2 |] [| Float.log 7000.0; 0.3 |] in
let result =
Norn.hmc ~step_size:0.001 ~num_leapfrog:10 ~num_warmup:200 ~n:500
log_posterior init
in
Printf.printf "HMC diagnostics:\n";
Printf.printf " Accept rate: %.1f%%\n\n" (result.stats.accept_rate *. 100.);
(* Sample statistics *)
let sample_mean = Nx.mean ~axes:[ 0 ] result.samples in
let centered = Nx.sub result.samples sample_mean in
let sample_cov =
Nx.div_s
(Nx.matmul (Nx.matrix_transpose centered) centered)
(Float.of_int 499)
in
let sample_std = Nx.sqrt (Nx.diagonal sample_cov) in
let hmc_log_t = item [ 0 ] sample_mean in
let hmc_av = item [ 1 ] sample_mean in
let hmc_sigma_log_t = item [ 0 ] sample_std in
let hmc_sigma_av = item [ 1 ] sample_std in
Printf.printf "Posterior (HMC):\n";
Printf.printf " log_T = %.4f +/- %.4f -> T ~ %.0f K\n" hmc_log_t
hmc_sigma_log_t (Float.exp hmc_log_t);
Printf.printf " A_V = %.4f +/- %.4f\n\n" hmc_av hmc_sigma_av;
(* --- Comparison --- *)
Printf.printf "=== Fisher vs HMC Comparison ===\n\n";
Printf.printf " %12s %10s %10s\n" "" "Fisher s" "HMC s";
Printf.printf " %12s %10s %10s\n" "------------" "----------" "----------";
Printf.printf " %12s %10.4f %10.4f\n" "s(log_T)" sigma_log_t
hmc_sigma_log_t;
Printf.printf " %12s %10.4f %10.4f\n\n" "s(A_V)" sigma_av hmc_sigma_av;
Printf.printf "Fisher gives the theoretical minimum uncertainty.\n";
Printf.printf "HMC gives the actual posterior width.\n";
Printf.printf "Agreement confirms the model is well-behaved (near-linear).\n"
================================================
FILE: dev/umbra/examples/12-survey-optimization/README.md
================================================
# `12-survey-optimization`
Differentiable survey optimization for a Stage IV weak lensing survey. Uses
exact autodiff gradients to optimize survey parameters that minimize the
uncertainty on S8 = sigma8 * sqrt(Omega_m / 0.3), replacing traditional grid
search with gradient-based Fisher forecasting. Demonstrates both a single-bin
area/depth tradeoff and joint optimization of sky fraction with tomographic bin
edges.
```bash
cd dev/umbra
dune exec --root . examples/12-survey-optimization/main.exe
```
## What You'll Learn
- Computing differentiable Fisher information matrices for survey forecasting
- Optimizing the area/depth tradeoff for sky coverage vs galaxy density
- Jointly optimizing sky fraction and tomographic bin edges with gradient descent
- Using sigmoid-windowed bins for smooth gradient flow through discrete boundaries
- Comparing gradient-based optimization against brute-force grid search
## Key Functions
| Function | Purpose |
| --------------------------- | ---------------------------------------------------- |
| `Survey.angular_cl` | Compute angular power spectra for tracer pairs |
| `Survey.weak_lensing` | Create a weak lensing tracer from n(z) |
| `Survey.smail` | Smail redshift distribution for source galaxies |
| `Cosmo.planck18` | Planck 2018 fiducial cosmology |
| `Cosmo.linear_power` | Linear matter power spectrum P(k, z) |
| `Cosmo.comoving_distance` | Comoving distance for lensing kernel computation |
| `Rune.value_and_grad` | Loss and gradient for survey parameter optimization |
| `Vega.adam` | Adam optimizer for continuous parameter search |
## How It Works
Part 1 tackles the area/depth tradeoff for a single tomographic bin. A fixed
galaxy budget (n_gal * f_sky = constant) means wider surveys are shallower. The
Fisher matrix for [Omega_m, sigma8] is computed from Limber-integrated angular
power spectra, with shape noise that depends on galaxy density. The objective
function -- sigma(S8) derived from the 2x2 Fisher inverse -- is fully
differentiable through f_sky via sigmoid parameterization. Adam finds the
optimal sky fraction in 300 steps with exact gradients, verified by a
finite-difference check.
Part 2 extends to joint optimization of sky fraction and two tomographic bin
edges that divide galaxies into three redshift bins. The bin boundaries use
sigmoid window functions (with width delta=0.03) so that gradients flow smoothly
through the discrete bin assignment. Narrower bins concentrate signal but
increase shot noise; the optimizer balances this tradeoff automatically. The
Limber integral uses precomputed cosmological grids (comoving distances, Hubble
rates, power spectra) evaluated at five cosmology perturbations for numerical
derivatives of C_l with respect to Omega_m and sigma8, while gradients with
respect to survey parameters (f_sky, z1, z2) flow through Rune's autodiff.
A brute-force grid search over 12 x 15 x 15 = 2700 parameter combinations
validates the gradient result, demonstrating that 500 Adam steps achieve equal
or better precision with orders of magnitude fewer function evaluations.
## Try It
1. Increase the galaxy budget from 10 to 50 gal/arcmin2 and observe how the
optimal sky fraction shifts toward wider coverage.
2. Add a fourth tomographic bin and compare the improvement in sigma(S8).
3. Replace the Smail n(z) with a sharper distribution and see how the optimal
bin edges respond.
## Next Steps
This is the final example in the Umbra series. For earlier topics, revisit
[01-constants-and-units](../01-constants-and-units/) for physical constants and
unit handling, or [05-sed-fitting](../05-sed-fitting/) for the foundations of
differentiable spectral energy distribution fitting that this example builds on.
================================================
FILE: dev/umbra/examples/12-survey-optimization/dune
================================================
(executable
(name main)
(lib
gitextract__969s3jl/
├── .github/
│ └── workflows/
│ ├── changelog.yml
│ └── ci.yml
├── .gitignore
├── .ocamlformat
├── AGENTS.md
├── CHANGES.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── TODO.md
├── dev/
│ ├── README.md
│ ├── mimir/
│ │ ├── README.md
│ │ ├── dune-project
│ │ └── lib/
│ │ ├── dune
│ │ ├── mimir.ml
│ │ ├── mimir.mli
│ │ ├── sampler.ml
│ │ ├── sampler.mli
│ │ └── string_util.ml
│ └── umbra/
│ ├── README.md
│ ├── dune-project
│ ├── examples/
│ │ ├── 01-constants-and-units/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 02-cosmological-distances/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 03-blackbody-fitting/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 04-extinction-and-magnitudes/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 05-sed-fitting/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 06-coordinates-and-time/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 07-batch-photometry/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 08-photometric-redshifts/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 09-gravitational-lensing/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 10-uncertainty-propagation/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 11-bayesian-sed/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 12-survey-optimization/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ └── README.md
│ ├── lib/
│ │ ├── altaz.ml
│ │ ├── altaz.mli
│ │ ├── const.ml
│ │ ├── const.mli
│ │ ├── coord.ml
│ │ ├── coord.mli
│ │ ├── cosmo.ml
│ │ ├── cosmo.mli
│ │ ├── dune
│ │ ├── extinction.ml
│ │ ├── extinction.mli
│ │ ├── filter_data.ml
│ │ ├── filters.ml
│ │ ├── filters.mli
│ │ ├── fits/
│ │ │ ├── dune
│ │ │ ├── fits_parser.ml
│ │ │ ├── fits_parser.mli
│ │ │ ├── umbra_fits.ml
│ │ │ └── umbra_fits.mli
│ │ ├── galactocentric.ml
│ │ ├── galactocentric.mli
│ │ ├── kdtree.ml
│ │ ├── kdtree.mli
│ │ ├── photometry.ml
│ │ ├── photometry.mli
│ │ ├── spectrum.ml
│ │ ├── spectrum.mli
│ │ ├── survey.ml
│ │ ├── survey.mli
│ │ ├── time.ml
│ │ ├── time.mli
│ │ ├── umbra.ml
│ │ ├── umbra.mli
│ │ ├── unit.ml
│ │ ├── unit.mli
│ │ └── vega_data.ml
│ ├── papers/
│ │ └── perlmutter1999/
│ │ ├── .gitignore
│ │ ├── download_data.sh
│ │ └── perlmutter1999.md
│ └── test/
│ ├── dune
│ └── test_umbra.ml
├── doc/
│ ├── coming-from-python.md
│ ├── ecosystem-overview.md
│ ├── index.md
│ ├── installation.md
│ ├── introduction.md
│ ├── quickstart.md
│ ├── roadmap.md
│ └── support-raven.md
├── dune-project
├── dune-workspace.tsan
├── opam/
│ ├── brot.opam
│ ├── fehu.opam
│ ├── hugin.opam
│ ├── kaun-board.opam
│ ├── kaun.opam
│ ├── munin.opam
│ ├── norn.opam
│ ├── nx.opam
│ ├── nx.opam.template
│ ├── quill.opam
│ ├── raven.opam
│ ├── rune.opam
│ ├── sowilo.opam
│ ├── talon.opam
│ ├── tolk.opam
│ └── vega.opam
├── packages/
│ ├── brot/
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── README.md
│ │ │ ├── bench_brot.ml
│ │ │ ├── bench_rust/
│ │ │ │ ├── .gitignore
│ │ │ │ ├── Cargo.toml
│ │ │ │ └── main.rs
│ │ │ ├── bench_tokenizers.py
│ │ │ ├── brot.thumper
│ │ │ ├── data/
│ │ │ │ ├── .gitignore
│ │ │ │ ├── news_1k.txt
│ │ │ │ └── wiki_64k.txt
│ │ │ ├── download_data.sh
│ │ │ └── dune
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-pipeline.md
│ │ │ ├── 03-pretrained.md
│ │ │ ├── 04-batch-processing.md
│ │ │ ├── 05-algorithms.md
│ │ │ ├── 06-hf-tokenizers-comparison.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-encode-decode/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-encoding-fields/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-normalizers/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 04-pre-tokenizers/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 05-algorithms/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 06-special-tokens/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 07-padding-truncation/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 08-decoders/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 09-training/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 10-bert-pipeline/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── README.md
│ │ │ └── x-gpt2-tokenizer/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── lib/
│ │ │ ├── bpe.ml
│ │ │ ├── bpe.mli
│ │ │ ├── brot.ml
│ │ │ ├── brot.mli
│ │ │ ├── chars.ml
│ │ │ ├── chars.mli
│ │ │ ├── decoder.ml
│ │ │ ├── decoder.mli
│ │ │ ├── dune
│ │ │ ├── encoding.ml
│ │ │ ├── encoding.mli
│ │ │ ├── normalizer.ml
│ │ │ ├── normalizer.mli
│ │ │ ├── post_processor.ml
│ │ │ ├── post_processor.mli
│ │ │ ├── pre_tokenizer.ml
│ │ │ ├── pre_tokenizer.mli
│ │ │ ├── unigram.ml
│ │ │ ├── unigram.mli
│ │ │ ├── word_level.ml
│ │ │ ├── word_level.mli
│ │ │ ├── wordpiece.ml
│ │ │ └── wordpiece.mli
│ │ └── test/
│ │ ├── dune
│ │ ├── fixtures/
│ │ │ └── .gitignore
│ │ ├── scripts/
│ │ │ └── download_hf_tokenizers.py
│ │ ├── test_bpe.ml
│ │ ├── test_encoding.ml
│ │ ├── test_hf_tokenizers.ml
│ │ ├── test_pretokenizers.ml
│ │ ├── test_processors.ml
│ │ ├── test_tokenization.ml
│ │ ├── test_unicode.ml
│ │ ├── test_vocab.ml
│ │ └── test_wordpiece.ml
│ ├── dune
│ ├── fehu/
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── bench_fehu.ml
│ │ │ ├── dune
│ │ │ └── fehu.thumper
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-environments.md
│ │ │ ├── 03-collection-and-evaluation.md
│ │ │ ├── 04-gymnasium-comparison.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-random-agent/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-q-learning/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-reinforce/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ └── 04-dqn/
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── lib/
│ │ │ ├── buffer.ml
│ │ │ ├── buffer.mli
│ │ │ ├── collect.ml
│ │ │ ├── collect.mli
│ │ │ ├── dune
│ │ │ ├── env.ml
│ │ │ ├── env.mli
│ │ │ ├── envs/
│ │ │ │ ├── cartpole.ml
│ │ │ │ ├── dune
│ │ │ │ ├── fehu_envs.ml
│ │ │ │ ├── fehu_envs.mli
│ │ │ │ ├── grid_world.ml
│ │ │ │ ├── mountain_car.ml
│ │ │ │ └── random_walk.ml
│ │ │ ├── eval.ml
│ │ │ ├── eval.mli
│ │ │ ├── fehu.ml
│ │ │ ├── fehu.mli
│ │ │ ├── gae.ml
│ │ │ ├── gae.mli
│ │ │ ├── info.ml
│ │ │ ├── info.mli
│ │ │ ├── render.ml
│ │ │ ├── render.mli
│ │ │ ├── space.ml
│ │ │ ├── space.mli
│ │ │ ├── value.ml
│ │ │ ├── value.mli
│ │ │ ├── vec_env.ml
│ │ │ └── vec_env.mli
│ │ └── test/
│ │ ├── dune
│ │ ├── test_buffer.ml
│ │ ├── test_collect.ml
│ │ ├── test_env.ml
│ │ ├── test_env_wrappers.ml
│ │ ├── test_envs.ml
│ │ ├── test_eval.ml
│ │ ├── test_gae.ml
│ │ ├── test_info.ml
│ │ ├── test_render.ml
│ │ ├── test_space.ml
│ │ ├── test_value.ml
│ │ └── test_vec_env.ml
│ ├── hugin/
│ │ ├── README.md
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-marks-and-styling.md
│ │ │ ├── 03-layout-and-decorations.md
│ │ │ ├── 04-colors-and-colormaps.md
│ │ │ ├── 05-matplotlib-comparison.md
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-line-plot/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-styling/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-scatter/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 04-bar-chart/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 05-histogram/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 06-layers/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 07-decorations/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 08-grid-layout/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 09-themes/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 10-showcase/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 11-errorbar/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ └── README.md
│ │ ├── lib/
│ │ │ ├── axis.ml
│ │ │ ├── axis.mli
│ │ │ ├── cairo_backend.ml
│ │ │ ├── cairo_backend.mli
│ │ │ ├── cairo_sdl.ml
│ │ │ ├── cairo_sdl.mli
│ │ │ ├── cmap.ml
│ │ │ ├── cmap.mli
│ │ │ ├── cmap_data.ml
│ │ │ ├── color.ml
│ │ │ ├── color.mli
│ │ │ ├── dune
│ │ │ ├── hugin.ml
│ │ │ ├── hugin.mli
│ │ │ ├── image_util.ml
│ │ │ ├── image_util.mli
│ │ │ ├── prepared.ml
│ │ │ ├── prepared.mli
│ │ │ ├── resolve.ml
│ │ │ ├── resolve.mli
│ │ │ ├── scale.ml
│ │ │ ├── scale.mli
│ │ │ ├── scene.ml
│ │ │ ├── scene.mli
│ │ │ ├── spec.ml
│ │ │ ├── spec.mli
│ │ │ ├── svg_backend.ml
│ │ │ ├── svg_backend.mli
│ │ │ ├── theme.ml
│ │ │ ├── theme.mli
│ │ │ ├── ticks.ml
│ │ │ └── ticks.mli
│ │ ├── test/
│ │ │ ├── dune
│ │ │ ├── test_cmap.ml
│ │ │ ├── test_color.ml
│ │ │ ├── test_image_util.ml
│ │ │ ├── test_resolve.ml
│ │ │ ├── test_scale.ml
│ │ │ ├── test_svg_backend.ml
│ │ │ └── test_ticks.ml
│ │ ├── top/
│ │ │ ├── dune
│ │ │ └── hugin_top.ml
│ │ ├── ucairo/
│ │ │ ├── discover/
│ │ │ │ ├── discover.ml
│ │ │ │ └── dune
│ │ │ ├── dune
│ │ │ ├── ucairo.ml
│ │ │ ├── ucairo.mli
│ │ │ └── ucairo_stubs.c
│ │ └── usdl/
│ │ ├── discover/
│ │ │ ├── discover.ml
│ │ │ └── dune
│ │ ├── dune
│ │ ├── usdl.ml
│ │ ├── usdl.mli
│ │ └── usdl_stubs.c
│ ├── kaun/
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── bench_kaun.ml
│ │ │ ├── dune
│ │ │ └── kaun.thumper
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-layers-and-models.md
│ │ │ ├── 03-training.md
│ │ │ ├── 04-checkpoints-and-pretrained.md
│ │ │ ├── 06-pytorch-comparison.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-xor/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-mnist/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-bert/
│ │ │ │ ├── bert.ml
│ │ │ │ ├── bert.mli
│ │ │ │ ├── dune
│ │ │ │ ├── main.ml
│ │ │ │ └── reference_hf_output.py
│ │ │ └── 04-gpt2/
│ │ │ ├── dune
│ │ │ ├── gpt2.ml
│ │ │ ├── gpt2.mli
│ │ │ ├── main.ml
│ │ │ └── reference_hf_output.py
│ │ ├── lib/
│ │ │ ├── activation.ml
│ │ │ ├── activation.mli
│ │ │ ├── attention.ml
│ │ │ ├── attention.mli
│ │ │ ├── checkpoint.ml
│ │ │ ├── checkpoint.mli
│ │ │ ├── context.ml
│ │ │ ├── context.mli
│ │ │ ├── data.ml
│ │ │ ├── data.mli
│ │ │ ├── datasets/
│ │ │ │ ├── cifar10.ml
│ │ │ │ ├── dataset_utils.ml
│ │ │ │ ├── dune
│ │ │ │ ├── kaun_datasets.ml
│ │ │ │ ├── kaun_datasets.mli
│ │ │ │ └── mnist.ml
│ │ │ ├── dune
│ │ │ ├── fn.ml
│ │ │ ├── fn.mli
│ │ │ ├── grad.ml
│ │ │ ├── grad.mli
│ │ │ ├── hf/
│ │ │ │ ├── dune
│ │ │ │ ├── kaun_hf.ml
│ │ │ │ └── kaun_hf.mli
│ │ │ ├── init.ml
│ │ │ ├── init.mli
│ │ │ ├── layer.ml
│ │ │ ├── layer.mli
│ │ │ ├── loss.ml
│ │ │ ├── loss.mli
│ │ │ ├── metric.ml
│ │ │ ├── metric.mli
│ │ │ ├── optim.ml
│ │ │ ├── optim.mli
│ │ │ ├── ptree.ml
│ │ │ ├── ptree.mli
│ │ │ ├── train.ml
│ │ │ └── train.mli
│ │ └── test/
│ │ ├── dune
│ │ ├── test_attention.ml
│ │ ├── test_checkpoint.ml
│ │ ├── test_data.ml
│ │ ├── test_fn.ml
│ │ ├── test_grad.ml
│ │ ├── test_init.ml
│ │ ├── test_layer.ml
│ │ ├── test_loss.ml
│ │ ├── test_metric.ml
│ │ ├── test_optim.ml
│ │ ├── test_ptree.ml
│ │ └── test_train.ml
│ ├── munin/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-tracking.md
│ │ │ ├── 03-artifacts.md
│ │ │ ├── 04-cli.md
│ │ │ ├── 05-dashboard.md
│ │ │ ├── 06-system-monitoring.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-basic/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-metrics/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-artifacts/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 04-media/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 05-parameter-sweep/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 06-inspect/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 07-system-monitor/
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── README.md
│ │ │ └── x-kaun-mnist/
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── lib/
│ │ │ ├── artifact.ml
│ │ │ ├── artifact.mli
│ │ │ ├── dune
│ │ │ ├── env.ml
│ │ │ ├── event_log.ml
│ │ │ ├── fs.ml
│ │ │ ├── index.ml
│ │ │ ├── json_utils.ml
│ │ │ ├── munin.ml
│ │ │ ├── munin.mli
│ │ │ ├── run.ml
│ │ │ ├── run.mli
│ │ │ ├── run_monitor.ml
│ │ │ ├── run_monitor.mli
│ │ │ ├── session.ml
│ │ │ ├── session.mli
│ │ │ ├── store.ml
│ │ │ ├── store.mli
│ │ │ ├── sys/
│ │ │ │ ├── config/
│ │ │ │ │ ├── discover.ml
│ │ │ │ │ └── dune
│ │ │ │ ├── dune
│ │ │ │ ├── munin_sys.ml
│ │ │ │ ├── munin_sys.mli
│ │ │ │ ├── sysstat.ml
│ │ │ │ ├── sysstat.mli
│ │ │ │ └── sysstat_stubs.c
│ │ │ ├── tui/
│ │ │ │ ├── detail.ml
│ │ │ │ ├── dune
│ │ │ │ ├── footer.ml
│ │ │ │ ├── header.ml
│ │ │ │ ├── info.ml
│ │ │ │ ├── metrics.ml
│ │ │ │ ├── munin_tui.ml
│ │ │ │ ├── munin_tui.mli
│ │ │ │ ├── overview.ml
│ │ │ │ ├── system.ml
│ │ │ │ └── theme.ml
│ │ │ ├── value.ml
│ │ │ └── value.mli
│ │ └── test/
│ │ ├── dune
│ │ └── test_munin.ml
│ ├── norn/
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── bench_norn.ml
│ │ │ ├── dune
│ │ │ └── norn.thumper
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-adaptation-and-diagnostics.md
│ │ │ ├── 03-advanced-usage.md
│ │ │ ├── 04-pymc-comparison.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-sampling-basics/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-bayesian-regression/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-diagnostics/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ └── README.md
│ │ ├── lib/
│ │ │ ├── adapt.ml
│ │ │ ├── dune
│ │ │ ├── internal.ml
│ │ │ ├── norn.ml
│ │ │ ├── norn.mli
│ │ │ └── nuts.ml
│ │ └── test/
│ │ ├── debug_nuts.ml
│ │ ├── dune
│ │ ├── test_blackjax_ref.py
│ │ └── test_norn.ml
│ ├── nx/
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── README.md
│ │ │ ├── bench_numpy.py
│ │ │ ├── bench_nx.ml
│ │ │ ├── conv2d/
│ │ │ │ ├── README.md
│ │ │ │ ├── bench_conv2d_nx.ml
│ │ │ │ ├── bench_conv2d_pytorch.py
│ │ │ │ ├── dune
│ │ │ │ └── nx_conv2d.thumper
│ │ │ ├── dune
│ │ │ ├── einsum/
│ │ │ │ ├── README.md
│ │ │ │ ├── bench_einsum_numpy.py
│ │ │ │ ├── bench_einsum_nx.ml
│ │ │ │ ├── dune
│ │ │ │ └── nx_einsum.thumper
│ │ │ ├── matmul/
│ │ │ │ ├── README.md
│ │ │ │ ├── bench_matmul_numpy.py
│ │ │ │ ├── bench_matmul_nx.ml
│ │ │ │ ├── dune
│ │ │ │ └── nx_matmul.thumper
│ │ │ └── nx.thumper
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-array-operations.md
│ │ │ ├── 03-linear-algebra.md
│ │ │ ├── 04-io.md
│ │ │ ├── 05-numpy-comparison.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-creating-arrays/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-infix-and-arithmetic/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-indexing-and-slicing/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 04-reshaping-and-broadcasting/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 05-reductions-and-statistics/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 06-random-numbers/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 07-linear-algebra/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 08-signal-processing/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 09-image-processing/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 10-machine-learning/
│ │ │ │ ├── README.md
│ │ │ │ ├── dbscan.ml
│ │ │ │ ├── dune
│ │ │ │ ├── kmeans.ml
│ │ │ │ ├── pca.ml
│ │ │ │ └── tsne.ml
│ │ │ └── README.md
│ │ ├── lib/
│ │ │ ├── .ocamlformat-ignore
│ │ │ ├── backend/
│ │ │ │ ├── dune
│ │ │ │ └── nx_backend.mli
│ │ │ ├── backend_c/
│ │ │ │ ├── config/
│ │ │ │ │ ├── discover.ml
│ │ │ │ │ └── dune
│ │ │ │ ├── dune
│ │ │ │ ├── nx_backend.ml
│ │ │ │ ├── nx_c_binary.c
│ │ │ │ ├── nx_c_cast.c
│ │ │ │ ├── nx_c_cholesky.c
│ │ │ │ ├── nx_c_eig.c
│ │ │ │ ├── nx_c_index.c
│ │ │ │ ├── nx_c_matmul.c
│ │ │ │ ├── nx_c_memory.c
│ │ │ │ ├── nx_c_qr.c
│ │ │ │ ├── nx_c_random.c
│ │ │ │ ├── nx_c_reduce.c
│ │ │ │ ├── nx_c_scan.c
│ │ │ │ ├── nx_c_shape.c
│ │ │ │ ├── nx_c_shared.h
│ │ │ │ ├── nx_c_solve.c
│ │ │ │ ├── nx_c_sort.c
│ │ │ │ ├── nx_c_svd.c
│ │ │ │ ├── nx_c_ternary.c
│ │ │ │ ├── nx_c_unary.c
│ │ │ │ └── nx_c_window.c
│ │ │ ├── buffer/
│ │ │ │ ├── dune
│ │ │ │ ├── nx_buffer.ml
│ │ │ │ ├── nx_buffer.mli
│ │ │ │ ├── nx_buffer_stubs.c
│ │ │ │ ├── nx_buffer_stubs.h
│ │ │ │ ├── nx_buffer_stubs.js
│ │ │ │ └── test/
│ │ │ │ ├── dune
│ │ │ │ └── test_nx_buffer.ml
│ │ │ ├── core/
│ │ │ │ ├── backend_intf.ml
│ │ │ │ ├── dtype.ml
│ │ │ │ ├── dtype.mli
│ │ │ │ ├── dune
│ │ │ │ ├── frontend.ml
│ │ │ │ ├── nx_core.ml
│ │ │ │ ├── nx_core.mli
│ │ │ │ ├── rng.ml
│ │ │ │ ├── rng.mli
│ │ │ │ ├── shape.ml
│ │ │ │ ├── shape.mli
│ │ │ │ ├── view.ml
│ │ │ │ └── view.mli
│ │ │ ├── dune
│ │ │ ├── effect/
│ │ │ │ ├── dune
│ │ │ │ └── nx_effect.ml
│ │ │ ├── io/
│ │ │ │ ├── dune
│ │ │ │ ├── error.ml
│ │ │ │ ├── npy.ml
│ │ │ │ ├── nx_io.ml
│ │ │ │ ├── nx_io.mli
│ │ │ │ ├── nx_npy.ml
│ │ │ │ ├── nx_safetensors.ml
│ │ │ │ ├── nx_txt.ml
│ │ │ │ ├── packed_nx.ml
│ │ │ │ └── safetensors.ml
│ │ │ ├── nx.ml
│ │ │ ├── nx.mli
│ │ │ └── prelude.ml
│ │ ├── test/
│ │ │ ├── dune
│ │ │ ├── failing/
│ │ │ │ ├── bug_blit_overlapping.ml
│ │ │ │ └── dune
│ │ │ ├── fixtures/
│ │ │ │ ├── bf16_bit_exact.safetensors
│ │ │ │ ├── f16_bit_exact.safetensors
│ │ │ │ └── generate.py
│ │ │ ├── props/
│ │ │ │ ├── dune
│ │ │ │ ├── test_nx_props.ml
│ │ │ │ └── test_nx_props_support.ml
│ │ │ ├── test_nx_basics.ml
│ │ │ ├── test_nx_extended_dtypes.ml
│ │ │ ├── test_nx_fft.ml
│ │ │ ├── test_nx_indexing.ml
│ │ │ ├── test_nx_io.ml
│ │ │ ├── test_nx_linalg.ml
│ │ │ ├── test_nx_manipulation.ml
│ │ │ ├── test_nx_ops.ml
│ │ │ ├── test_nx_rng.ml
│ │ │ ├── test_nx_sanity.ml
│ │ │ ├── test_nx_sorting.ml
│ │ │ └── test_nx_support.ml
│ │ ├── top/
│ │ │ ├── dune
│ │ │ └── nx_top.ml
│ │ └── vendor/
│ │ ├── camlzip/
│ │ │ ├── LICENSE
│ │ │ ├── config/
│ │ │ │ ├── discover.ml
│ │ │ │ └── dune
│ │ │ ├── dune
│ │ │ ├── gzip.ml
│ │ │ ├── gzip.mli
│ │ │ ├── zip.ml
│ │ │ ├── zip.mli
│ │ │ ├── zlib.ml
│ │ │ ├── zlib.mli
│ │ │ └── zlibstubs.c
│ │ ├── dune
│ │ ├── ocaml-pocketfft/
│ │ │ ├── config/
│ │ │ │ ├── discover.ml
│ │ │ │ └── dune
│ │ │ ├── dune
│ │ │ ├── pocketfft/
│ │ │ │ ├── LICENSE
│ │ │ │ └── pocketfft_hdronly.h
│ │ │ ├── pocketfft.ml
│ │ │ └── pocketfft_stubs.cpp
│ │ ├── stb_image/
│ │ │ ├── dune
│ │ │ ├── ml_stb_image.c
│ │ │ ├── stb_image.h
│ │ │ ├── stb_image.ml
│ │ │ └── stb_image.mli
│ │ └── stb_image_write/
│ │ ├── dune
│ │ ├── ml_stb_image_write.c
│ │ ├── stb_image_write.h
│ │ ├── stb_image_write.ml
│ │ └── stb_image_write.mli
│ ├── nx-oxcaml/
│ │ ├── .ocamlformat
│ │ ├── AGENTS.md
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── README.md
│ │ │ ├── bench_nx_c.ml
│ │ │ ├── bench_nx_common.ml
│ │ │ ├── bench_nx_oxcaml.ml
│ │ │ └── dune
│ │ ├── dune-project
│ │ ├── dune-workspace
│ │ ├── lib/
│ │ │ ├── binary_ops/
│ │ │ │ ├── op_add.ml
│ │ │ │ ├── op_atan2.ml
│ │ │ │ ├── op_fdiv.ml
│ │ │ │ ├── op_idiv.ml
│ │ │ │ ├── op_max.ml
│ │ │ │ ├── op_min.ml
│ │ │ │ ├── op_mod.ml
│ │ │ │ ├── op_mul.ml
│ │ │ │ ├── op_pow.ml
│ │ │ │ └── op_sub.ml
│ │ │ ├── comparison_ops/
│ │ │ │ ├── op_cmpeq.ml
│ │ │ │ ├── op_cmple.ml
│ │ │ │ ├── op_cmplt.ml
│ │ │ │ └── op_cmpne.ml
│ │ │ ├── dune
│ │ │ ├── import.ml
│ │ │ ├── logical_ops/
│ │ │ │ ├── op_and.ml
│ │ │ │ ├── op_or.ml
│ │ │ │ └── op_xor.ml
│ │ │ ├── nx_backend.ml
│ │ │ ├── nx_oxcaml_stubs.c
│ │ │ ├── op_argmax.ml
│ │ │ ├── op_associative_scan.ml
│ │ │ ├── op_cast.ml
│ │ │ ├── op_cat.ml
│ │ │ ├── op_fold.ml
│ │ │ ├── op_gather.ml
│ │ │ ├── op_matmul.ml
│ │ │ ├── op_pad.ml
│ │ │ ├── op_scatter.ml
│ │ │ ├── op_sort.ml
│ │ │ ├── op_threefry.ml
│ │ │ ├── op_unfold.ml
│ │ │ ├── parallel.ml
│ │ │ ├── reduce_ops.ml
│ │ │ ├── simd_neon.ml
│ │ │ ├── simd_sse.ml
│ │ │ ├── simd_stubs.c
│ │ │ ├── ternary_ops/
│ │ │ │ └── op_where.ml
│ │ │ └── unary_ops/
│ │ │ ├── op_abs.ml
│ │ │ ├── op_acos.ml
│ │ │ ├── op_asin.ml
│ │ │ ├── op_atan.ml
│ │ │ ├── op_ceil.ml
│ │ │ ├── op_cos.ml
│ │ │ ├── op_cosh.ml
│ │ │ ├── op_erf.ml
│ │ │ ├── op_exp.ml
│ │ │ ├── op_floor.ml
│ │ │ ├── op_log.ml
│ │ │ ├── op_neg.ml
│ │ │ ├── op_recip.ml
│ │ │ ├── op_round.ml
│ │ │ ├── op_sign.ml
│ │ │ ├── op_sin.ml
│ │ │ ├── op_sinh.ml
│ │ │ ├── op_sqrt.ml
│ │ │ ├── op_tan.ml
│ │ │ ├── op_tanh.ml
│ │ │ └── op_trunc.ml
│ │ ├── nx-oxcaml.opam
│ │ ├── test/
│ │ │ ├── dune
│ │ │ └── test_nx_oxcaml.ml
│ │ └── vendor/
│ │ └── dune
│ ├── quill/
│ │ ├── README.md
│ │ ├── bin/
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-notebook-format.md
│ │ │ ├── 03-execution-modes.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── hello.md
│ │ │ └── mnist.md
│ │ ├── lib/
│ │ │ ├── quill/
│ │ │ │ ├── cell.ml
│ │ │ │ ├── cell.mli
│ │ │ │ ├── doc.ml
│ │ │ │ ├── doc.mli
│ │ │ │ ├── dune
│ │ │ │ ├── eval.ml
│ │ │ │ ├── eval.mli
│ │ │ │ ├── kernel.ml
│ │ │ │ ├── kernel.mli
│ │ │ │ ├── quill.ml
│ │ │ │ ├── quill.mli
│ │ │ │ ├── session.ml
│ │ │ │ └── session.mli
│ │ │ ├── quill-book/
│ │ │ │ ├── build.ml
│ │ │ │ ├── build.mli
│ │ │ │ ├── dune
│ │ │ │ ├── quill_book.ml
│ │ │ │ ├── quill_book.mli
│ │ │ │ ├── render.ml
│ │ │ │ ├── render.mli
│ │ │ │ └── theme.ml
│ │ │ ├── quill-markdown/
│ │ │ │ ├── dune
│ │ │ │ ├── edit.ml
│ │ │ │ ├── edit.mli
│ │ │ │ ├── quill_markdown.ml
│ │ │ │ └── quill_markdown.mli
│ │ │ ├── quill-project/
│ │ │ │ ├── dune
│ │ │ │ ├── quill_project.ml
│ │ │ │ └── quill_project.mli
│ │ │ ├── quill-server/
│ │ │ │ ├── dune
│ │ │ │ ├── frontend/
│ │ │ │ │ ├── .gitignore
│ │ │ │ │ ├── css/
│ │ │ │ │ │ └── notebook.css
│ │ │ │ │ ├── dist/
│ │ │ │ │ │ ├── app.css
│ │ │ │ │ │ └── app.js
│ │ │ │ │ ├── dune
│ │ │ │ │ ├── esbuild.config.mjs
│ │ │ │ │ ├── index.html
│ │ │ │ │ ├── package.json
│ │ │ │ │ └── src/
│ │ │ │ │ ├── app.js
│ │ │ │ │ ├── cell.js
│ │ │ │ │ ├── editor.js
│ │ │ │ │ ├── math.js
│ │ │ │ │ ├── notebook.js
│ │ │ │ │ ├── output.js
│ │ │ │ │ ├── shortcuts.js
│ │ │ │ │ ├── store.js
│ │ │ │ │ └── ws.js
│ │ │ │ ├── httpd.ml
│ │ │ │ ├── httpd.mli
│ │ │ │ ├── protocol.ml
│ │ │ │ ├── protocol.mli
│ │ │ │ ├── quill_server.ml
│ │ │ │ ├── quill_server.mli
│ │ │ │ └── support/
│ │ │ │ └── gen_assets.ml
│ │ │ ├── quill-top/
│ │ │ │ ├── dune
│ │ │ │ ├── quill_top.ml
│ │ │ │ └── quill_top.mli
│ │ │ └── quill-tui/
│ │ │ ├── dune
│ │ │ ├── quill_tui.ml
│ │ │ └── quill_tui.mli
│ │ └── test/
│ │ ├── dune
│ │ ├── test_cell.ml
│ │ ├── test_doc.ml
│ │ ├── test_markdown.ml
│ │ └── test_session.ml
│ ├── rune/
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── README.md
│ │ │ ├── bench_grad_pytorch.py
│ │ │ ├── bench_grad_rune.ml
│ │ │ ├── dune
│ │ │ └── rune_grad.thumper
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-transformations.md
│ │ │ ├── 03-how-it-works.md
│ │ │ ├── 04-jax-comparison.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-mlp/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ └── xx-higher-derivative/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── lib/
│ │ │ ├── autodiff.ml
│ │ │ ├── custom_diff.ml
│ │ │ ├── debug.ml
│ │ │ ├── dune
│ │ │ ├── finite_diff.ml
│ │ │ ├── gradcheck.ml
│ │ │ ├── jacobian.ml
│ │ │ ├── jit.ml
│ │ │ ├── jit.mli
│ │ │ ├── jvp.ml
│ │ │ ├── rune.ml
│ │ │ ├── rune.mli
│ │ │ ├── vjp.ml
│ │ │ └── vmap.ml
│ │ └── test/
│ │ ├── dune
│ │ ├── golden/
│ │ │ ├── jit_grad/
│ │ │ │ ├── dune
│ │ │ │ ├── generate_actual.ml
│ │ │ │ ├── generate_expected.py
│ │ │ │ ├── grad_cube.expected
│ │ │ │ ├── grad_polynomial.expected
│ │ │ │ ├── grad_sin.expected
│ │ │ │ ├── grad_square.expected
│ │ │ │ └── grad_sum.expected
│ │ │ └── jit_trace/
│ │ │ ├── add_const.expected
│ │ │ ├── chain.expected
│ │ │ ├── dune
│ │ │ ├── generate_actual.ml
│ │ │ ├── generate_expected.py
│ │ │ ├── mul_self.expected
│ │ │ └── sum.expected
│ │ ├── support/
│ │ │ ├── dune
│ │ │ └── test_rune_support.ml
│ │ ├── test_custom_diff.ml
│ │ ├── test_gradcheck.ml
│ │ ├── test_jacobian.ml
│ │ ├── test_jit.ml
│ │ ├── test_jit_grad.ml
│ │ ├── test_jit_vmap.ml
│ │ ├── test_jvp.ml
│ │ ├── test_vjp.ml
│ │ └── test_vmap.ml
│ ├── sowilo/
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── README.md
│ │ │ ├── bench_sowilo.ml
│ │ │ ├── bench_sowilo.py
│ │ │ ├── dune
│ │ │ ├── scripts/
│ │ │ │ └── generate_fixtures.py
│ │ │ └── sowilo.thumper
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-operations.md
│ │ │ ├── 03-pipelines.md
│ │ │ ├── 04-opencv-comparison.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-grayscale/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-gaussian-blur/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-median-blur/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 04-threshold/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 05-sobel/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 06-canny/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ └── 07-morphology/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── lib/
│ │ │ ├── color.ml
│ │ │ ├── dune
│ │ │ ├── edge.ml
│ │ │ ├── filter.ml
│ │ │ ├── helpers.ml
│ │ │ ├── morphology.ml
│ │ │ ├── sowilo.ml
│ │ │ ├── sowilo.mli
│ │ │ └── transform.ml
│ │ └── test/
│ │ ├── dune
│ │ └── test_sowilo.ml
│ ├── talon/
│ │ ├── README.md
│ │ ├── bench/
│ │ │ ├── README.md
│ │ │ ├── bench_talon.ml
│ │ │ ├── bench_talon.py
│ │ │ ├── data/
│ │ │ │ ├── customers.csv
│ │ │ │ └── transactions.csv
│ │ │ ├── dune
│ │ │ ├── scripts/
│ │ │ │ └── generate_fixtures.py
│ │ │ └── talon.thumper
│ │ ├── doc/
│ │ │ ├── 01-getting-started.md
│ │ │ ├── 02-row-operations.md
│ │ │ ├── 03-pandas-comparison.md
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── examples/
│ │ │ ├── 01-quickstart/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 02-wide-features/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 03-selectors/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ ├── 04-row-reduce/
│ │ │ │ ├── README.md
│ │ │ │ ├── dune
│ │ │ │ └── main.ml
│ │ │ └── 05-sorting-and-grouping/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── lib/
│ │ │ ├── col.ml
│ │ │ ├── csv/
│ │ │ │ ├── csv_io.ml
│ │ │ │ ├── dune
│ │ │ │ ├── talon_csv.ml
│ │ │ │ └── talon_csv.mli
│ │ │ ├── dune
│ │ │ ├── talon.ml
│ │ │ └── talon.mli
│ │ └── test/
│ │ ├── dune
│ │ ├── test_talon.ml
│ │ └── test_talon_csv.ml
│ ├── tolk/
│ │ ├── .gitignore
│ │ ├── .ocamlformat
│ │ ├── LICENSE-tinygrad
│ │ ├── README.md
│ │ ├── doc/
│ │ │ ├── dune
│ │ │ └── index.md
│ │ ├── lib/
│ │ │ ├── codegen/
│ │ │ │ ├── codegen.ml
│ │ │ │ ├── codegen.mli
│ │ │ │ ├── codegen_lower.ml
│ │ │ │ ├── codegen_lower.mli
│ │ │ │ ├── gpudims.ml
│ │ │ │ ├── gpudims.mli
│ │ │ │ ├── late/
│ │ │ │ │ ├── devectorizer.ml
│ │ │ │ │ ├── devectorizer.mli
│ │ │ │ │ ├── expander.ml
│ │ │ │ │ ├── expander.mli
│ │ │ │ │ ├── images.ml
│ │ │ │ │ ├── images.mli
│ │ │ │ │ ├── linearizer.ml
│ │ │ │ │ └── linearizer.mli
│ │ │ │ ├── opt/
│ │ │ │ │ ├── heuristic.ml
│ │ │ │ │ ├── heuristic.mli
│ │ │ │ │ ├── postrange.ml
│ │ │ │ │ ├── postrange.mli
│ │ │ │ │ ├── search.ml
│ │ │ │ │ ├── search.mli
│ │ │ │ │ ├── tc.ml
│ │ │ │ │ └── tc.mli
│ │ │ │ ├── simplify.ml
│ │ │ │ └── simplify.mli
│ │ │ ├── compiler.ml
│ │ │ ├── compiler.mli
│ │ │ ├── device.ml
│ │ │ ├── device.mli
│ │ │ ├── diskcache.ml
│ │ │ ├── diskcache.mli
│ │ │ ├── dune
│ │ │ ├── engine/
│ │ │ │ ├── allocations.ml
│ │ │ │ ├── allocations.mli
│ │ │ │ ├── jit.ml
│ │ │ │ ├── jit.mli
│ │ │ │ ├── memory.ml
│ │ │ │ ├── memory.mli
│ │ │ │ ├── realize.ml
│ │ │ │ ├── realize.mli
│ │ │ │ └── schedule.ml
│ │ │ ├── gpu_target.ml
│ │ │ ├── gpu_target.mli
│ │ │ ├── helpers.ml
│ │ │ ├── ir/
│ │ │ │ ├── axis_kind.ml
│ │ │ │ ├── axis_kind.mli
│ │ │ │ ├── const.ml
│ │ │ │ ├── const.mli
│ │ │ │ ├── decomposition.ml
│ │ │ │ ├── decomposition.mli
│ │ │ │ ├── divandmod.ml
│ │ │ │ ├── divandmod.mli
│ │ │ │ ├── dtype.ml
│ │ │ │ ├── dtype.mli
│ │ │ │ ├── dune
│ │ │ │ ├── hashcons.ml
│ │ │ │ ├── hashcons.mli
│ │ │ │ ├── kernel.ml
│ │ │ │ ├── kernel.mli
│ │ │ │ ├── op.ml
│ │ │ │ ├── op.mli
│ │ │ │ ├── program.ml
│ │ │ │ ├── program.mli
│ │ │ │ ├── shape.ml
│ │ │ │ ├── shape.mli
│ │ │ │ ├── special_dim.ml
│ │ │ │ ├── special_dim.mli
│ │ │ │ ├── symbolic.ml
│ │ │ │ ├── symbolic.mli
│ │ │ │ ├── tensor.ml
│ │ │ │ ├── tensor.mli
│ │ │ │ ├── tolk_ir.ml
│ │ │ │ └── tolk_ir.mli
│ │ │ ├── program_spec.ml
│ │ │ ├── program_spec.mli
│ │ │ ├── renderer/
│ │ │ │ ├── cstyle.ml
│ │ │ │ └── cstyle.mli
│ │ │ ├── renderer.ml
│ │ │ ├── renderer.mli
│ │ │ ├── runtime/
│ │ │ │ ├── cpu/
│ │ │ │ │ ├── compiler_cpu.ml
│ │ │ │ │ ├── compiler_cpu.mli
│ │ │ │ │ ├── dune
│ │ │ │ │ ├── elf_cpu_loader.ml
│ │ │ │ │ ├── elf_cpu_loader.mli
│ │ │ │ │ ├── tolk_cpu.ml
│ │ │ │ │ ├── tolk_cpu.mli
│ │ │ │ │ └── tolk_cpu_stubs.c
│ │ │ │ ├── metal/
│ │ │ │ │ ├── dune
│ │ │ │ │ ├── tolk_metal.ml
│ │ │ │ │ ├── tolk_metal.mli
│ │ │ │ │ └── tolk_metal_stubs.c
│ │ │ │ └── support/
│ │ │ │ ├── elf.ml
│ │ │ │ ├── elf.mli
│ │ │ │ ├── tlsf.ml
│ │ │ │ └── tlsf.mli
│ │ │ └── schedule/
│ │ │ ├── allreduce.ml
│ │ │ ├── allreduce.mli
│ │ │ ├── indexing.ml
│ │ │ ├── indexing.mli
│ │ │ ├── multi.ml
│ │ │ ├── multi.mli
│ │ │ ├── rangeify.ml
│ │ │ └── rangeify.mli
│ │ └── test/
│ │ ├── golden/
│ │ │ ├── codegen/
│ │ │ │ ├── clang_dot_product.expected
│ │ │ │ ├── clang_elementwise_add.expected
│ │ │ │ ├── clang_elementwise_cast_f16.expected
│ │ │ │ ├── clang_elementwise_int32.expected
│ │ │ │ ├── clang_elementwise_sqrt.expected
│ │ │ │ ├── clang_elementwise_where.expected
│ │ │ │ ├── clang_gated_store.expected
│ │ │ │ ├── clang_max_reduce.expected
│ │ │ │ ├── clang_multi_output.expected
│ │ │ │ ├── clang_no_optimize.expected
│ │ │ │ ├── clang_parallel_reduce.expected
│ │ │ │ ├── clang_reduce_rows.expected
│ │ │ │ ├── clang_sum_reduce.expected
│ │ │ │ ├── cuda_dot_product.expected
│ │ │ │ ├── cuda_elementwise_2d.expected
│ │ │ │ ├── cuda_elementwise_add.expected
│ │ │ │ ├── cuda_elementwise_cast_f16.expected
│ │ │ │ ├── cuda_elementwise_int32.expected
│ │ │ │ ├── cuda_elementwise_sqrt.expected
│ │ │ │ ├── cuda_elementwise_where.expected
│ │ │ │ ├── cuda_gated_store.expected
│ │ │ │ ├── cuda_matmul_small.expected
│ │ │ │ ├── cuda_max_reduce.expected
│ │ │ │ ├── cuda_multi_output.expected
│ │ │ │ ├── cuda_no_optimize.expected
│ │ │ │ ├── cuda_parallel_reduce.expected
│ │ │ │ ├── cuda_reduce_rows.expected
│ │ │ │ ├── cuda_sum_reduce.expected
│ │ │ │ ├── dune
│ │ │ │ ├── generate_actual.ml
│ │ │ │ ├── generate_expected.py
│ │ │ │ ├── metal_dot_product.expected
│ │ │ │ ├── metal_elementwise_2d.expected
│ │ │ │ ├── metal_elementwise_add.expected
│ │ │ │ ├── metal_elementwise_cast_f16.expected
│ │ │ │ ├── metal_elementwise_int32.expected
│ │ │ │ ├── metal_elementwise_sqrt.expected
│ │ │ │ ├── metal_elementwise_where.expected
│ │ │ │ ├── metal_gated_store.expected
│ │ │ │ ├── metal_matmul_small.expected
│ │ │ │ ├── metal_max_reduce.expected
│ │ │ │ ├── metal_multi_output.expected
│ │ │ │ ├── metal_no_optimize.expected
│ │ │ │ ├── metal_parallel_reduce.expected
│ │ │ │ ├── metal_reduce_rows.expected
│ │ │ │ ├── metal_sum_reduce.expected
│ │ │ │ ├── opencl_dot_product.expected
│ │ │ │ ├── opencl_elementwise_2d.expected
│ │ │ │ ├── opencl_elementwise_add.expected
│ │ │ │ ├── opencl_elementwise_cast_f16.expected
│ │ │ │ ├── opencl_elementwise_int32.expected
│ │ │ │ ├── opencl_elementwise_sqrt.expected
│ │ │ │ ├── opencl_elementwise_where.expected
│ │ │ │ ├── opencl_gated_store.expected
│ │ │ │ ├── opencl_matmul_small.expected
│ │ │ │ ├── opencl_max_reduce.expected
│ │ │ │ ├── opencl_multi_output.expected
│ │ │ │ ├── opencl_no_optimize.expected
│ │ │ │ ├── opencl_parallel_reduce.expected
│ │ │ │ ├── opencl_reduce_rows.expected
│ │ │ │ └── opencl_sum_reduce.expected
│ │ │ ├── cstyle/
│ │ │ │ ├── clang_bitcast_f32_to_i32.expected
│ │ │ │ ├── clang_cast_f16_to_f32.expected
│ │ │ │ ├── clang_conditional.expected
│ │ │ │ ├── clang_const_inf_nan.expected
│ │ │ │ ├── clang_gated_load.expected
│ │ │ │ ├── clang_loop.expected
│ │ │ │ ├── clang_multi_param.expected
│ │ │ │ ├── clang_nested_loops.expected
│ │ │ │ ├── clang_simple_add_f32.expected
│ │ │ │ ├── clang_simple_mul_i32.expected
│ │ │ │ ├── clang_unary_sqrt_f16.expected
│ │ │ │ ├── clang_unary_sqrt_f32.expected
│ │ │ │ ├── clang_vectorize_gep.expected
│ │ │ │ ├── clang_where_select.expected
│ │ │ │ ├── cuda_bitcast_f32_to_i32.expected
│ │ │ │ ├── cuda_cast_f16_to_f32.expected
│ │ │ │ ├── cuda_conditional.expected
│ │ │ │ ├── cuda_const_inf_nan.expected
│ │ │ │ ├── cuda_gated_load.expected
│ │ │ │ ├── cuda_loop.expected
│ │ │ │ ├── cuda_multi_param.expected
│ │ │ │ ├── cuda_nested_loops.expected
│ │ │ │ ├── cuda_shared_memory.expected
│ │ │ │ ├── cuda_simple_add_f32.expected
│ │ │ │ ├── cuda_simple_mul_i32.expected
│ │ │ │ ├── cuda_special_dims.expected
│ │ │ │ ├── cuda_unary_sqrt_f16.expected
│ │ │ │ ├── cuda_unary_sqrt_f32.expected
│ │ │ │ ├── cuda_vectorize_gep.expected
│ │ │ │ ├── cuda_where_select.expected
│ │ │ │ ├── dune
│ │ │ │ ├── generate_actual.ml
│ │ │ │ ├── generate_expected.py
│ │ │ │ ├── metal_bitcast_f32_to_i32.expected
│ │ │ │ ├── metal_cast_f16_to_f32.expected
│ │ │ │ ├── metal_conditional.expected
│ │ │ │ ├── metal_const_inf_nan.expected
│ │ │ │ ├── metal_gated_load.expected
│ │ │ │ ├── metal_loop.expected
│ │ │ │ ├── metal_multi_param.expected
│ │ │ │ ├── metal_nested_loops.expected
│ │ │ │ ├── metal_shared_memory.expected
│ │ │ │ ├── metal_simple_add_f32.expected
│ │ │ │ ├── metal_simple_mul_i32.expected
│ │ │ │ ├── metal_special_dims.expected
│ │ │ │ ├── metal_unary_sqrt_f16.expected
│ │ │ │ ├── metal_unary_sqrt_f32.expected
│ │ │ │ ├── metal_vectorize_gep.expected
│ │ │ │ ├── metal_where_select.expected
│ │ │ │ ├── opencl_bitcast_f32_to_i32.expected
│ │ │ │ ├── opencl_cast_f16_to_f32.expected
│ │ │ │ ├── opencl_conditional.expected
│ │ │ │ ├── opencl_const_inf_nan.expected
│ │ │ │ ├── opencl_gated_load.expected
│ │ │ │ ├── opencl_loop.expected
│ │ │ │ ├── opencl_multi_param.expected
│ │ │ │ ├── opencl_nested_loops.expected
│ │ │ │ ├── opencl_shared_memory.expected
│ │ │ │ ├── opencl_simple_add_f32.expected
│ │ │ │ ├── opencl_simple_mul_i32.expected
│ │ │ │ ├── opencl_special_dims.expected
│ │ │ │ ├── opencl_unary_sqrt_f16.expected
│ │ │ │ ├── opencl_unary_sqrt_f32.expected
│ │ │ │ ├── opencl_vectorize_gep.expected
│ │ │ │ └── opencl_where_select.expected
│ │ │ ├── debug/
│ │ │ │ ├── dune
│ │ │ │ ├── elementwise_add.expected
│ │ │ │ ├── elementwise_add_opt.expected
│ │ │ │ ├── generate_actual.ml
│ │ │ │ └── generate_expected.py
│ │ │ └── rangeify/
│ │ │ ├── clang_binop_permute.expected
│ │ │ ├── clang_binop_reshape.expected
│ │ │ ├── clang_contiguous_add.expected
│ │ │ ├── clang_diamond.expected
│ │ │ ├── clang_elementwise_3way.expected
│ │ │ ├── clang_elementwise_add.expected
│ │ │ ├── clang_expand_permute.expected
│ │ │ ├── clang_mulacc.expected
│ │ │ ├── clang_multistage_reduce.expected
│ │ │ ├── clang_permute_through_reshape.expected
│ │ │ ├── clang_reduce_permute_binop.expected
│ │ │ ├── clang_reduce_reshape_binop.expected
│ │ │ ├── clang_reduce_shrink.expected
│ │ │ ├── clang_reduce_unary.expected
│ │ │ ├── clang_reshape_chain.expected
│ │ │ ├── clang_shrink_fuse.expected
│ │ │ ├── clang_two_sum.expected
│ │ │ ├── cuda_binop_permute.expected
│ │ │ ├── cuda_binop_reshape.expected
│ │ │ ├── cuda_contiguous_add.expected
│ │ │ ├── cuda_diamond.expected
│ │ │ ├── cuda_elementwise_3way.expected
│ │ │ ├── cuda_elementwise_add.expected
│ │ │ ├── cuda_expand_permute.expected
│ │ │ ├── cuda_mulacc.expected
│ │ │ ├── cuda_multistage_reduce.expected
│ │ │ ├── cuda_permute_through_reshape.expected
│ │ │ ├── cuda_reduce_permute_binop.expected
│ │ │ ├── cuda_reduce_reshape_binop.expected
│ │ │ ├── cuda_reduce_shrink.expected
│ │ │ ├── cuda_reduce_unary.expected
│ │ │ ├── cuda_reshape_chain.expected
│ │ │ ├── cuda_shrink_fuse.expected
│ │ │ ├── cuda_two_sum.expected
│ │ │ ├── dune
│ │ │ ├── generate_actual.ml
│ │ │ ├── generate_expected.py
│ │ │ ├── metal_binop_permute.expected
│ │ │ ├── metal_binop_reshape.expected
│ │ │ ├── metal_contiguous_add.expected
│ │ │ ├── metal_diamond.expected
│ │ │ ├── metal_elementwise_3way.expected
│ │ │ ├── metal_elementwise_add.expected
│ │ │ ├── metal_expand_permute.expected
│ │ │ ├── metal_mulacc.expected
│ │ │ ├── metal_multistage_reduce.expected
│ │ │ ├── metal_permute_through_reshape.expected
│ │ │ ├── metal_reduce_permute_binop.expected
│ │ │ ├── metal_reduce_reshape_binop.expected
│ │ │ ├── metal_reduce_shrink.expected
│ │ │ ├── metal_reduce_unary.expected
│ │ │ ├── metal_reshape_chain.expected
│ │ │ ├── metal_shrink_fuse.expected
│ │ │ ├── metal_two_sum.expected
│ │ │ ├── opencl_binop_permute.expected
│ │ │ ├── opencl_binop_reshape.expected
│ │ │ ├── opencl_contiguous_add.expected
│ │ │ ├── opencl_diamond.expected
│ │ │ ├── opencl_elementwise_3way.expected
│ │ │ ├── opencl_elementwise_add.expected
│ │ │ ├── opencl_expand_permute.expected
│ │ │ ├── opencl_mulacc.expected
│ │ │ ├── opencl_multistage_reduce.expected
│ │ │ ├── opencl_permute_through_reshape.expected
│ │ │ ├── opencl_reduce_permute_binop.expected
│ │ │ ├── opencl_reduce_reshape_binop.expected
│ │ │ ├── opencl_reduce_shrink.expected
│ │ │ ├── opencl_reduce_unary.expected
│ │ │ ├── opencl_reshape_chain.expected
│ │ │ ├── opencl_shrink_fuse.expected
│ │ │ └── opencl_two_sum.expected
│ │ └── unit/
│ │ ├── dune
│ │ ├── test_codegen_devectorizer.ml
│ │ ├── test_codegen_expander.ml
│ │ ├── test_codegen_gpudims.ml
│ │ ├── test_codegen_heuristic.ml
│ │ ├── test_codegen_images.ml
│ │ ├── test_codegen_linearizer.ml
│ │ ├── test_codegen_postrange.ml
│ │ ├── test_codegen_simplify.ml
│ │ ├── test_codegen_tc.ml
│ │ ├── test_cstyle.ml
│ │ ├── test_elf.ml
│ │ ├── test_ir_dtype.ml
│ │ ├── test_ir_kernel.ml
│ │ ├── test_ir_program.ml
│ │ ├── test_ir_symbolic.ml
│ │ ├── test_ir_tensor.ml
│ │ ├── test_program_spec.ml
│ │ ├── test_runtime_cpu.ml
│ │ ├── test_runtime_metal.ml
│ │ ├── test_runtime_search.ml
│ │ └── test_schedule_rangeify.ml
│ └── vega/
│ ├── README.md
│ ├── bench/
│ │ ├── bench_vega.ml
│ │ ├── dune
│ │ └── vega.thumper
│ ├── doc/
│ │ ├── 01-getting-started.md
│ │ ├── 02-composing-transforms.md
│ │ ├── 03-schedules.md
│ │ ├── 04-optax-comparison.md
│ │ ├── dune
│ │ └── index.md
│ ├── examples/
│ │ ├── 01-basic-optimizers/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 02-composing-transforms/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ ├── 03-learning-rate-schedules/
│ │ │ ├── README.md
│ │ │ ├── dune
│ │ │ └── main.ml
│ │ └── README.md
│ ├── lib/
│ │ ├── dune
│ │ ├── schedule.ml
│ │ ├── schedule.mli
│ │ ├── vega.ml
│ │ └── vega.mli
│ └── test/
│ ├── dune
│ └── test_vega.ml
├── scripts/
│ └── ubench.py
└── www/
├── .gitignore
├── README.md
├── dune
├── dune-project
├── generate/
│ ├── api.ml
│ ├── dune
│ ├── generate.ml
│ └── site.ml
├── process/
│ ├── dream_process.ml
│ ├── dune
│ ├── generate_api_rules.ml
│ ├── index.ml
│ └── sidebar.ml
├── site/
│ ├── docs.css
│ ├── index.html
│ ├── odoc.css
│ └── styles.css
└── templates/
├── layout_docs.html
├── layout_docs_lib.html
└── main.html
Showing preview only (303K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3192 symbols across 68 files)
FILE: packages/brot/bench/bench_rust/main.rs
constant WARMUP (line 6) | const WARMUP: usize = 4;
constant TIME_QUOTA (line 7) | const TIME_QUOTA: Duration = Duration::from_millis(300);
constant MIN_MEASUREMENTS (line 8) | const MIN_MEASUREMENTS: usize = 3;
type BenchResult (line 10) | struct BenchResult {
function bench (line 16) | fn bench<F: FnMut()>(name: &str, mut f: F) -> BenchResult {
function format_duration (line 63) | fn format_duration(d: Duration) -> String {
function run_suite (line 76) | fn run_suite(label: &str, tokenizer: &Tokenizer, short_text: &str, long_...
function main (line 112) | fn main() {
FILE: packages/brot/bench/bench_tokenizers.py
function load_tokenizer (line 28) | def load_tokenizer(filename: str) -> Tokenizer:
function make_suite (line 33) | def make_suite(label: str, tokenizer: Tokenizer) -> Any:
function build_benchmarks (line 46) | def build_benchmarks() -> List[Any]:
function default_config (line 54) | def default_config() -> ubench.Config:
function main (line 58) | def main() -> None:
FILE: packages/brot/test/scripts/download_hf_tokenizers.py
function download (line 38) | def download(url: str, dest: Path) -> None:
function sha256 (line 52) | def sha256(path: Path) -> str:
function summarize (line 60) | def summarize(path: Path) -> None:
function main (line 72) | def main() -> int:
FILE: packages/hugin/ucairo/ucairo_stubs.c
function finalize_context (line 27) | static void finalize_context(value v)
type custom_operations (line 33) | struct custom_operations
function value (line 43) | static value alloc_context(cairo_t *cr)
function finalize_surface (line 54) | static void finalize_surface(value v)
type custom_operations (line 60) | struct custom_operations
function value (line 70) | static value alloc_surface(cairo_surface_t *s)
function cairo_t (line 81) | static inline cairo_t *check_context(value v, const char *fn)
function cairo_surface_t (line 88) | static inline cairo_surface_t *check_surface(value v, const char *fn)
function CAMLprim (line 99) | CAMLprim value caml_ucairo_create(value vsurf)
function CAMLprim (line 116) | CAMLprim value caml_ucairo_save(value vcr)
function CAMLprim (line 123) | CAMLprim value caml_ucairo_restore(value vcr)
function CAMLprim (line 134) | CAMLprim value caml_ucairo_translate(value vcr, value vtx, value vty)
function CAMLprim (line 142) | CAMLprim value caml_ucairo_scale(value vcr, value vsx, value vsy)
function CAMLprim (line 150) | CAMLprim value caml_ucairo_rotate(value vcr, value vangle)
function CAMLprim (line 162) | CAMLprim value caml_ucairo_set_source_rgba(value vcr, value vr, value vg,
function CAMLprim (line 172) | CAMLprim value caml_ucairo_set_source_surface(value vcr, value vsurf,
function CAMLprim (line 187) | CAMLprim value caml_ucairo_set_line_width(value vcr, value vw)
function CAMLprim (line 195) | CAMLprim value caml_ucairo_set_line_cap(value vcr, value vcap)
function CAMLprim (line 206) | CAMLprim value caml_ucairo_set_line_join(value vcr, value vjoin)
function CAMLprim (line 217) | CAMLprim value caml_ucairo_set_dash(value vcr, value varr)
function CAMLprim (line 236) | CAMLprim value caml_ucairo_set_antialias(value vcr, value vaa)
function CAMLprim (line 252) | CAMLprim value caml_ucairo_select_font_face(value vcr, value vfamily,
function CAMLprim (line 265) | CAMLprim value caml_ucairo_set_font_size(value vcr, value vsize)
function CAMLprim (line 273) | CAMLprim value caml_ucairo_text_extents(value vcr, value vstr)
function CAMLprim (line 290) | CAMLprim value caml_ucairo_show_text(value vcr, value vstr)
function CAMLprim (line 302) | CAMLprim value caml_ucairo_move_to(value vcr, value vx, value vy)
function CAMLprim (line 310) | CAMLprim value caml_ucairo_line_to(value vcr, value vx, value vy)
function CAMLprim (line 318) | CAMLprim value caml_ucairo_arc_native(value vcr, value vxc, value vyc,
function CAMLprim (line 329) | CAMLprim value caml_ucairo_arc_bytecode(value *argv, int argc)
function CAMLprim (line 336) | CAMLprim value caml_ucairo_rectangle(value vcr, value vx, value vy,
function CAMLprim (line 346) | CAMLprim value caml_ucairo_path_close(value vcr)
function CAMLprim (line 353) | CAMLprim value caml_ucairo_path_clear(value vcr)
function CAMLprim (line 364) | CAMLprim value caml_ucairo_fill(value vcr)
function CAMLprim (line 371) | CAMLprim value caml_ucairo_fill_preserve(value vcr)
function CAMLprim (line 378) | CAMLprim value caml_ucairo_stroke(value vcr)
function CAMLprim (line 385) | CAMLprim value caml_ucairo_paint(value vcr)
function CAMLprim (line 392) | CAMLprim value caml_ucairo_clip(value vcr)
function CAMLprim (line 403) | CAMLprim value caml_ucairo_surface_finish(value vsurf)
function CAMLprim (line 411) | CAMLprim value caml_ucairo_surface_flush(value vsurf)
function CAMLprim (line 422) | CAMLprim value caml_ucairo_image_create(value vw, value vh)
function CAMLprim (line 435) | CAMLprim value caml_ucairo_image_create_for_data8(value vdata, value vw,
function CAMLprim (line 450) | CAMLprim value caml_ucairo_image_stride_for_width(value vw)
function CAMLprim (line 459) | CAMLprim value caml_ucairo_pdf_create(value vfilename, value vw, value vh)
function CAMLprim (line 476) | CAMLprim value caml_ucairo_png_write(value vsurf, value vfilename)
function cairo_status_t (line 486) | static cairo_status_t
function CAMLprim (line 501) | CAMLprim value caml_ucairo_png_write_to_stream(value vsurf, value vcallb...
FILE: packages/hugin/usdl/usdl_stubs.c
function finalize_window (line 26) | static void finalize_window(value v)
type custom_operations (line 32) | struct custom_operations
function value (line 42) | static value alloc_window(SDL_Window *w)
function finalize_renderer (line 53) | static void finalize_renderer(value v)
type custom_operations (line 59) | struct custom_operations
function value (line 69) | static value alloc_renderer(SDL_Renderer *r)
function finalize_surface (line 80) | static void finalize_surface(value v)
type custom_operations (line 86) | struct custom_operations
function value (line 96) | static value alloc_surface(SDL_Surface *s)
function finalize_texture (line 107) | static void finalize_texture(value v)
type custom_operations (line 113) | struct custom_operations
function value (line 123) | static value alloc_texture(SDL_Texture *t)
type custom_operations (line 134) | struct custom_operations
function CAMLprim (line 146) | CAMLprim value caml_usdl_init(value vunit)
function CAMLprim (line 155) | CAMLprim value caml_usdl_quit(value vunit)
function CAMLprim (line 164) | CAMLprim value caml_usdl_window_create(value vtitle, value vw, value vh)
function CAMLprim (line 177) | CAMLprim value caml_usdl_window_destroy(value vwin)
function CAMLprim (line 187) | CAMLprim value caml_usdl_renderer_create(value vwin)
function CAMLprim (line 198) | CAMLprim value caml_usdl_renderer_output_size(value vren)
function CAMLprim (line 213) | CAMLprim value caml_usdl_renderer_clear(value vren)
function CAMLprim (line 222) | CAMLprim value caml_usdl_renderer_copy(value vren, value vtex)
function CAMLprim (line 234) | CAMLprim value caml_usdl_renderer_present(value vren)
function CAMLprim (line 243) | CAMLprim value caml_usdl_renderer_destroy(value vren)
function CAMLprim (line 253) | CAMLprim value caml_usdl_surface_create_argb8888(value vw, value vh)
function CAMLprim (line 262) | CAMLprim value caml_usdl_surface_destroy(value vsurf)
function CAMLprim (line 270) | CAMLprim value caml_usdl_surface_pitch(value vsurf)
function CAMLprim (line 278) | CAMLprim value caml_usdl_surface_pixels(value vsurf)
function CAMLprim (line 291) | CAMLprim value caml_usdl_texture_of_surface(value vren, value vsurf)
function CAMLprim (line 303) | CAMLprim value caml_usdl_texture_destroy(value vtex)
function CAMLprim (line 313) | CAMLprim value caml_usdl_event_create(value vunit)
function CAMLprim (line 321) | CAMLprim value caml_usdl_event_wait(value vev)
function CAMLprim (line 332) | CAMLprim value caml_usdl_event_type(value vev)
function CAMLprim (line 337) | CAMLprim value caml_usdl_event_window_id(value vev)
function CAMLprim (line 345) | CAMLprim value caml_usdl_event_keycode(value vev)
FILE: packages/kaun/examples/03-bert/reference_hf_output.py
function main (line 8) | def main():
FILE: packages/munin/lib/sys/sysstat_stubs.c
function value (line 51) | static value alloc_cpu_row(int64_t user, int64_t nice, int64_t sys,
function CAMLprim (line 66) | CAMLprim value caml_sysstat_get_cpu_load(value unit) {
function CAMLprim (line 121) | CAMLprim value caml_sysstat_get_memory(value unit) {
function CAMLprim (line 185) | CAMLprim value caml_sysstat_get_network_io(value unit) {
function CAMLprim (line 245) | CAMLprim value caml_sysstat_get_disk_io(value unit) {
function CAMLprim (line 342) | CAMLprim value caml_sysstat_list_pids(value unit) {
function macos_state_char (line 386) | static char macos_state_char(int p_stat) {
function get_proc_cmdline (line 404) | static int get_proc_cmdline(pid_t pid, char* buf, size_t bufsize) {
function CAMLprim (line 468) | CAMLprim value caml_sysstat_get_proc_info(value v_pid) {
function CAMLprim (line 574) | CAMLprim value caml_sysstat_get_timebase(value unit) {
function CAMLprim (line 598) | CAMLprim value caml_sysstat_get_loadavg(value unit) {
function CAMLprim (line 616) | CAMLprim value caml_sysstat_get_uptime(value unit) {
function CAMLprim (line 651) | CAMLprim value caml_sysstat_getpagesize(value unit) {
function CAMLprim (line 657) | CAMLprim value caml_sysstat_statvfs(value v_path) {
function CAMLprim (line 681) | CAMLprim value caml_sysstat_proc_self_mem(value unit) {
function CAMLprim (line 710) | CAMLprim value caml_sysstat_clk_tck(value unit) {
function CAMLprim (line 719) | CAMLprim value caml_sysstat_getmounts(value unit) {
FILE: packages/norn/test/test_blackjax_ref.py
function log_prob (line 10) | def log_prob(x):
FILE: packages/nx-oxcaml/lib/nx_oxcaml_stubs.c
function CAMLprim (line 15) | CAMLprim value caml_ba_to_unboxed_float64_array(value v_ba)
function CAMLprim (line 37) | CAMLprim value caml_ba_to_unboxed_float32_array(value v_ba)
function CAMLprim (line 59) | CAMLprim value caml_ba_to_unboxed_int64_array(value v_ba)
function CAMLprim (line 81) | CAMLprim value caml_ba_to_unboxed_int32_array(value v_ba)
function CAMLprim (line 103) | CAMLprim value caml_ba_to_unboxed_int8_array(value v_ba)
function CAMLprim (line 125) | CAMLprim value caml_ba_to_unboxed_int16_array(value v_ba)
function CAMLprim (line 149) | CAMLprim value caml_unboxed_float64_array_to_ba(value v_arr, value v_len)
function CAMLprim (line 163) | CAMLprim value caml_unboxed_float32_array_to_ba(value v_arr, value v_len)
function CAMLprim (line 177) | CAMLprim value caml_unboxed_int64_array_to_ba(value v_arr, value v_len)
function CAMLprim (line 191) | CAMLprim value caml_unboxed_int32_array_to_ba(value v_arr, value v_len)
function CAMLprim (line 205) | CAMLprim value caml_unboxed_int8_array_to_ba(value v_arr, value v_len)
function CAMLprim (line 219) | CAMLprim value caml_unboxed_int16_array_to_ba(value v_arr, value v_len)
FILE: packages/nx-oxcaml/lib/simd_stubs.c
function caml_prefetch_ignore (line 15) | void caml_prefetch_ignore() { }
function BUILTIN (line 18) | BUILTIN(caml_vec128_cast)
FILE: packages/nx/bench/bench_numpy.py
function _dtype_label (line 25) | def _dtype_label(dtype: np.dtype) -> str:
function _benchmark_name (line 33) | def _benchmark_name(op_name: str, size: int, dtype: np.dtype) -> str:
function _numpy_operations (line 37) | def _numpy_operations(
function build_benchmarks (line 57) | def build_benchmarks() -> List[Any]:
function default_config (line 67) | def default_config() -> ubench.Config:
function main (line 80) | def main() -> None:
FILE: packages/nx/bench/conv2d/bench_conv2d_pytorch.py
function _dtype_label (line 31) | def _dtype_label(dtype: torch.dtype) -> str:
function _benchmark_name (line 39) | def _benchmark_name(
class ConvSpec (line 54) | class ConvSpec:
method __init__ (line 57) | def __init__(
function create_conv_specs (line 74) | def create_conv_specs() -> List[ConvSpec]:
function build_benchmarks (line 82) | def build_benchmarks() -> List[Any]:
function default_config (line 110) | def default_config() -> ubench.Config:
function main (line 124) | def main() -> None:
FILE: packages/nx/bench/einsum/bench_einsum_numpy.py
function _dtype_label (line 25) | def _dtype_label(dtype: np.dtype) -> str:
function _benchmark_name (line 33) | def _benchmark_name(op_name: str, size: int, dtype: np.dtype) -> str:
class EinsumOp (line 37) | class EinsumOp:
method __init__ (line 40) | def __init__(
function build_benchmarks (line 97) | def build_benchmarks() -> List[Any]:
function default_config (line 116) | def default_config() -> ubench.Config:
function main (line 130) | def main() -> None:
FILE: packages/nx/bench/matmul/bench_matmul_numpy.py
class MatmulCase (line 25) | class MatmulCase:
function _dtype_label (line 43) | def _dtype_label(dtype: np.dtype) -> str:
function _benchmark_name (line 51) | def _benchmark_name(case: MatmulCase, dtype: np.dtype, suffix: str = "")...
function _make_operands (line 55) | def _make_operands(case: MatmulCase, dtype: np.dtype) -> Tuple[np.ndarra...
function build_benchmarks (line 63) | def build_benchmarks() -> List[Any]:
function default_config (line 86) | def default_config() -> ubench.Config:
function main (line 100) | def main() -> None:
FILE: packages/nx/lib/backend_c/nx_c_binary.c
type binary_op_table (line 47) | typedef struct {
function iterate_inner_dims (line 96) | static inline void iterate_inner_dims(const ndarray_t *x, const ndarray_...
function nx_c_idiv_c32_kernel (line 408) | static void nx_c_idiv_c32_kernel(void *x_data, void *y_data, void *z_data,
function nx_c_idiv_c64_kernel (line 417) | static void nx_c_idiv_c64_kernel(void *x_data, void *y_data, void *z_data,
function nx_c_cmplt_f16_kernel (line 725) | static void nx_c_cmplt_f16_kernel(void *x_data, void *y_data, void *z_data,
function nx_c_cmpne_f16_kernel (line 870) | static void nx_c_cmpne_f16_kernel(void *x_data, void *y_data, void *z_data,
function nx_c_cmpne_c32_kernel (line 888) | static void nx_c_cmpne_c32_kernel(void *x_data, void *y_data, void *z_data,
function nx_c_cmpne_c64_kernel (line 897) | static void nx_c_cmpne_c64_kernel(void *x_data, void *y_data, void *z_data,
function nx_c_cmpeq_f16_kernel (line 946) | static void nx_c_cmpeq_f16_kernel(void *x_data, void *y_data, void *z_data,
function nx_c_cmpeq_c32_kernel (line 964) | static void nx_c_cmpeq_c32_kernel(void *x_data, void *y_data, void *z_data,
function nx_c_cmpeq_c64_kernel (line 973) | static void nx_c_cmpeq_c64_kernel(void *x_data, void *y_data, void *z_data,
function nx_c_cmple_f16_kernel (line 1019) | static void nx_c_cmple_f16_kernel(void *x_data, void *y_data, void *z_data,
function dispatch_binary_op (line 1187) | static void dispatch_binary_op(value v_x, value v_y, value v_z,
function dispatch_comparison_op (line 1322) | static void dispatch_comparison_op(value v_x, value v_y, value v_z,
FILE: packages/nx/lib/backend_c/nx_c_cast.c
type nx_dtype (line 21) | typedef enum {
function nx_dtype (line 46) | static nx_dtype kind_to_dtype(int kind) {
function iterate_inner_dims2 (line 97) | static inline void iterate_inner_dims2(const ndarray_t *x, const ndarray...
function nx_c_cast_bool_to_bool_kernel (line 283) | static void nx_c_cast_bool_to_bool_kernel(void *src_data, void *dst_data,
function nx_c_cast_f16_to_f16_kernel (line 404) | static void nx_c_cast_f16_to_f16_kernel(void *src_data, void *dst_data,
function nx_c_cast_c32_to_c32_kernel (line 582) | static void nx_c_cast_c32_to_c32_kernel(void *src_data, void *dst_data,
function nx_c_cast_c32_to_c64_kernel (line 590) | static void nx_c_cast_c32_to_c64_kernel(void *src_data, void *dst_data,
function nx_c_cast_c64_to_c32_kernel (line 599) | static void nx_c_cast_c64_to_c32_kernel(void *src_data, void *dst_data,
function nx_c_cast_c64_to_c64_kernel (line 607) | static void nx_c_cast_c64_to_c64_kernel(void *src_data, void *dst_data,
function nx_c_cast_i4_to_bool_kernel (line 655) | static void nx_c_cast_i4_to_bool_kernel(void *src_data, void *dst_data,
function nx_c_cast_u4_to_bool_kernel (line 669) | static void nx_c_cast_u4_to_bool_kernel(void *src_data, void *dst_data,
function nx_c_cast_bf16_to_bf16_kernel (line 881) | static void nx_c_cast_bf16_to_bf16_kernel(void *src_data, void *dst_data,
function nx_c_cast_f8e4m3_to_f8e4m3_kernel (line 889) | static void nx_c_cast_f8e4m3_to_f8e4m3_kernel(void *src_data, void *dst_...
function nx_c_cast_f8e5m2_to_f8e5m2_kernel (line 897) | static void nx_c_cast_f8e5m2_to_f8e5m2_kernel(void *src_data, void *dst_...
function nx_c_cast_i4_to_i4_kernel (line 907) | static void nx_c_cast_i4_to_i4_kernel(void *src_data, void *dst_data,
function nx_c_cast_i4_to_u4_kernel (line 926) | static void nx_c_cast_i4_to_u4_kernel(void *src_data, void *dst_data,
function nx_c_cast_u4_to_i4_kernel (line 945) | static void nx_c_cast_u4_to_i4_kernel(void *src_data, void *dst_data,
function nx_c_cast_u4_to_u4_kernel (line 963) | static void nx_c_cast_u4_to_u4_kernel(void *src_data, void *dst_data,
function dispatch_cast (line 1448) | static void dispatch_cast(value v_src, value v_dst) {
function CAMLprim (line 1497) | CAMLprim value caml_nx_cast(value v_src, value v_dst) {
FILE: packages/nx/lib/backend_c/nx_c_cholesky.c
function nx_pack_f32 (line 23) | static void nx_pack_f32(float* dst, const float* src, int m, int n,
function nx_unpack_f32 (line 32) | static void nx_unpack_f32(float* dst, const float* src, int m, int n,
function nx_pack_f64 (line 41) | static void nx_pack_f64(double* dst, const double* src, int m, int n,
function nx_unpack_f64 (line 50) | static void nx_unpack_f64(double* dst, const double* src, int m, int n,
function nx_pack_c32 (line 59) | static void nx_pack_c32(complex32* dst, const complex32* src, int m, int n,
function nx_unpack_c32 (line 68) | static void nx_unpack_c32(complex32* dst, const complex32* src, int m, i...
function nx_pack_c64 (line 77) | static void nx_pack_c64(complex64* dst, const complex64* src, int m, int n,
function nx_unpack_c64 (line 86) | static void nx_unpack_c64(complex64* dst, const complex64* src, int m, i...
function lsame (line 96) | static int lsame(char ca, char cb) {
function cholesky_float32 (line 106) | static int cholesky_float32(float* a, int n, int upper) {
function cholesky_float64 (line 130) | static int cholesky_float64(double* a, int n, int upper) {
function cholesky_complex32 (line 154) | static int cholesky_complex32(complex32* a, int n, int upper) {
function cholesky_complex64 (line 178) | static int cholesky_complex64(complex64* a, int n, int upper) {
function cholesky_float16 (line 203) | static int cholesky_float16(uint16_t* a, int n, int upper) {
function cholesky_bfloat16 (line 219) | static int cholesky_bfloat16(caml_ba_bfloat16* a, int n, int upper) {
function cholesky_f8e4m3 (line 235) | static int cholesky_f8e4m3(caml_ba_fp8_e4m3* a, int n, int upper) {
function cholesky_f8e5m2 (line 251) | static int cholesky_f8e5m2(caml_ba_fp8_e5m2* a, int n, int upper) {
function CAMLprim (line 268) | CAMLprim value caml_nx_op_cholesky(value v_in, value v_out, value v_uppe...
FILE: packages/nx/lib/backend_c/nx_c_eig.c
function nx_pack_f32 (line 24) | static void nx_pack_f32(float* dst, const float* src, int m, int n,
function nx_unpack_f32 (line 33) | static void nx_unpack_f32(float* dst, const float* src, int m, int n,
function nx_pack_f64 (line 42) | static void nx_pack_f64(double* dst, const double* src, int m, int n,
function nx_unpack_f64 (line 51) | static void nx_unpack_f64(double* dst, const double* src, int m, int n,
function nx_pack_c32 (line 60) | static void nx_pack_c32(complex32* dst, const complex32* src, int m, int n,
function nx_unpack_c32 (line 69) | static void nx_unpack_c32(complex32* dst, const complex32* src, int m, i...
function nx_pack_c64 (line 78) | static void nx_pack_c64(complex64* dst, const complex64* src, int m, int n,
function nx_unpack_c64 (line 87) | static void nx_unpack_c64(complex64* dst, const complex64* src, int m, i...
function sign_float32 (line 97) | static inline float sign_float32(float x) {
function sign_float64 (line 101) | static inline double sign_float64(double x) {
function hypot_float32 (line 105) | static inline float hypot_float32(float x, float y) {
function hypot_float64 (line 109) | static inline double hypot_float64(double x, double y) {
function givens_float32 (line 114) | static void givens_float32(float f, float g, float *c, float *s) {
function givens_float64 (line 131) | static void givens_float64(double f, double g, double *c, double *s) {
function apply_givens_right_float32 (line 149) | static void apply_givens_right_float32(float *a, int m, int n, int i, in...
function apply_givens_right_float64 (line 158) | static void apply_givens_right_float64(double *a, int m, int n, int i, i...
function apply_givens_left_float32 (line 168) | static void apply_givens_left_float32(float *a, int m, int n, int i, int j,
function apply_givens_left_float64 (line 177) | static void apply_givens_left_float64(double *a, int m, int n, int i, in...
function tridiagonalize_float32 (line 187) | static void tridiagonalize_float32(float* a, float* q, float* diag,
function tridiagonalize_float64 (line 231) | static void tridiagonalize_float64(double* a, double* q, double* diag,
function qr_iteration_tridiag_float32 (line 275) | static void qr_iteration_tridiag_float32(float* diag, float* offdiag, fl...
function qr_iteration_tridiag_float64 (line 325) | static void qr_iteration_tridiag_float64(double* diag, double* offdiag,
function eig_float32 (line 380) | static void eig_float32(float* a, complex32* eigvals, complex32* eigvecs...
function eig_float64 (line 439) | static void eig_float64(double* a, complex64* eigvals, complex64* eigvec...
function eigh_float32 (line 497) | static void eigh_float32(float* a, float* eigvals, float* eigvecs, int n) {
function eigh_float64 (line 519) | static void eigh_float64(double* a, double* eigvals, double* eigvecs, in...
function eigh_complex32 (line 541) | static void eigh_complex32(complex32* a, float* eigvals, complex32* eigv...
function eigh_complex64 (line 564) | static void eigh_complex64(complex64* a, double* eigvals, complex64* eig...
function eigh_float16 (line 587) | static void eigh_float16(uint16_t* a, uint16_t* eigvals, uint16_t* eigvecs,
function eigh_bfloat16 (line 610) | static void eigh_bfloat16(caml_ba_bfloat16* a, caml_ba_bfloat16* eigvals,
function eigh_f8e4m3 (line 633) | static void eigh_f8e4m3(caml_ba_fp8_e4m3* a, caml_ba_fp8_e4m3* eigvals,
function eigh_f8e5m2 (line 656) | static void eigh_f8e5m2(caml_ba_fp8_e5m2* a, caml_ba_fp8_e5m2* eigvals,
function CAMLprim (line 679) | CAMLprim value caml_nx_op_eig(value v_in, value v_vals, value v_vecs,
FILE: packages/nx/lib/backend_c/nx_c_index.c
function shape_equal (line 18) | static bool shape_equal(const int *shape1, const int *shape2, int ndim) {
function same_shape (line 26) | static bool same_shape(const ndarray_t *a, const ndarray_t *b) {
type elem_op_table (line 38) | typedef struct {
type multi_iterator_t (line 183) | typedef struct {
function multi_iterator_init (line 190) | static void multi_iterator_init(multi_iterator_t *it, const ndarray_t *n...
function multi_iterator_next (line 204) | static int multi_iterator_next(multi_iterator_t *it) {
function multi_iterator_destroy (line 213) | static void multi_iterator_destroy(multi_iterator_t *it) {
function compute_offset (line 218) | static long compute_offset(const ndarray_t *nd, const long *coords) {
function get_elem_byte_size (line 228) | static double get_elem_byte_size(int kind) {
function elem_size_from_kind (line 265) | static inline size_t elem_size_from_kind(int kind) {
function zero_ndarray (line 298) | static void zero_ndarray(ndarray_t *nd, void *data, int kind) {
function copy_ndarray (line 311) | static void copy_ndarray(const ndarray_t *src, ndarray_t *dst, int kind) {
function dispatch_gather (line 523) | static void dispatch_gather(value v_data, value v_indices, value v_out,
function dispatch_scatter (line 667) | static void dispatch_scatter(value v_template, value v_indices, value v_...
function CAMLprim (line 799) | CAMLprim value caml_nx_op_gather(value v_data, value v_indices, value v_...
function CAMLprim (line 806) | CAMLprim value caml_nx_op_scatter(value v_template, value v_indices,
function CAMLprim (line 817) | CAMLprim value caml_nx_op_scatter_bc(value *argv, int argn) {
FILE: packages/nx/lib/backend_c/nx_c_matmul.c
type matmul_op_table (line 23) | typedef struct {
function iterate_batch (line 39) | static inline void iterate_batch(
function nx_c_matmul_f64_kernel (line 394) | static void nx_c_matmul_f64_kernel(void *a_data, long a_off, long a_rs,
function nx_c_matmul_c32_kernel (line 463) | static void nx_c_matmul_c32_kernel(void *a_data, long a_off, long a_rs,
function nx_c_matmul_c64_kernel (line 530) | static void nx_c_matmul_c64_kernel(void *a_data, long a_off, long a_rs,
function dispatch_matmul_op (line 643) | static void dispatch_matmul_op(value v_a, value v_b, value v_c,
function CAMLprim (line 748) | CAMLprim value caml_nx_matmul(value v_a, value v_b, value v_c) {
FILE: packages/nx/lib/backend_c/nx_c_memory.c
function value (line 18) | static value copy_int_array(value v_old) {
function value (line 29) | static value create_tensor_value(value v_shape, value v_strides, value v...
function set_standard_strides (line 42) | static void set_standard_strides(int *strides, int *shape, int ndim) {
function same_shape (line 52) | static bool same_shape(const ndarray_t *a, const ndarray_t *b) {
function is_c_contiguous (line 61) | static bool is_c_contiguous(const ndarray_t *nd) {
function get_element_size (line 72) | static long get_element_size(int kind) {
function nx_c_copy (line 112) | static void nx_c_copy(const ndarray_t *src, const ndarray_t *dst, int ki...
function CAMLprim (line 179) | CAMLprim value caml_nx_assign(value v_src, value v_dst) {
function value (line 208) | static value make_contiguous(value v_src, bool force_copy) {
function CAMLprim (line 261) | CAMLprim value caml_nx_copy(value v_src) {
function CAMLprim (line 266) | CAMLprim value caml_nx_contiguous(value v_src) {
FILE: packages/nx/lib/backend_c/nx_c_qr.c
function nx_pack_f32 (line 24) | static void nx_pack_f32(float* dst, const float* src, int m, int n,
function nx_unpack_f32 (line 33) | static void nx_unpack_f32(float* dst, const float* src, int m, int n,
function nx_pack_f64 (line 42) | static void nx_pack_f64(double* dst, const double* src, int m, int n,
function nx_unpack_f64 (line 51) | static void nx_unpack_f64(double* dst, const double* src, int m, int n,
function nx_pack_c32 (line 60) | static void nx_pack_c32(complex32* dst, const complex32* src, int m, int n,
function nx_unpack_c32 (line 69) | static void nx_unpack_c32(complex32* dst, const complex32* src, int m, i...
function nx_pack_c64 (line 78) | static void nx_pack_c64(complex64* dst, const complex64* src, int m, int n,
function nx_unpack_c64 (line 87) | static void nx_unpack_c64(complex64* dst, const complex64* src, int m, i...
function qr_decompose_float32 (line 96) | static void qr_decompose_float32(float* a, float* q, float* r, int m, in...
function qr_decompose_float64 (line 154) | static void qr_decompose_float64(double* a, double* q, double* r, int m,...
function qr_decompose_complex32 (line 212) | static void qr_decompose_complex32(complex32* a, complex32* q, complex32...
function qr_decompose_complex64 (line 270) | static void qr_decompose_complex64(complex64* a, complex64* q, complex64...
function qr_decompose_float16 (line 328) | static int qr_decompose_float16(uint16_t* a, uint16_t* q, uint16_t* r, i...
function qr_decompose_bfloat16 (line 350) | static int qr_decompose_bfloat16(caml_ba_bfloat16* a, caml_ba_bfloat16* q,
function qr_decompose_f8e4m3 (line 373) | static int qr_decompose_f8e4m3(caml_ba_fp8_e4m3* a, caml_ba_fp8_e4m3* q,
function qr_decompose_f8e5m2 (line 395) | static int qr_decompose_f8e5m2(caml_ba_fp8_e5m2* a, caml_ba_fp8_e5m2* q,
function CAMLprim (line 418) | CAMLprim value caml_nx_op_qr(value v_in, value v_q, value v_r,
FILE: packages/nx/lib/backend_c/nx_c_random.c
type binary_op_table (line 23) | typedef struct {
type u32_t (line 31) | typedef uint32_t u32_t;
type tfry_ctr_t (line 33) | typedef struct {
type tfry_ctr_t (line 37) | typedef tfry_ctr_t tfry_key_t;
function tfry_ctr_t (line 41) | static tfry_ctr_t threefry2x32(tfry_key_t key, tfry_ctr_t ctr) {
function nx_c_threefry_i32 (line 71) | static void nx_c_threefry_i32(const ndarray_t *key_p, const ndarray_t *c...
function dispatch_binary_op (line 171) | static void dispatch_binary_op(value v_x, value v_y, value v_z,
function CAMLprim (line 320) | CAMLprim value caml_nx_threefry(value v_x, value v_y, value v_z) {
FILE: packages/nx/lib/backend_c/nx_c_reduce.c
type reduce_op_table (line 26) | typedef struct {
function normalize_and_sort_axes (line 47) | static inline bool normalize_and_sort_axes(int ndim, const int *axes,
function axes_are_trailing (line 71) | static inline bool axes_are_trailing(int ndim, int num_axes,
function product_of_axes (line 79) | static inline long product_of_axes(const ndarray_t *input,
function fill_zero_float (line 90) | static inline void fill_zero_float(float *dst, long count) {
function fill_zero_double (line 95) | static inline void fill_zero_double(double *dst, long count) {
function reduce_sum_single_axis_f32 (line 100) | static inline bool reduce_sum_single_axis_f32(const ndarray_t *input,
function reduce_sum_single_axis_f64 (line 147) | static inline bool reduce_sum_single_axis_f64(const ndarray_t *input,
function cmp_int (line 195) | static int cmp_int(const void *a, const void *b) {
function get_offset (line 199) | static long get_offset(const ndarray_t *nd, const int *coord) {
function get_coord_from_idx (line 207) | static void get_coord_from_idx(long idx, const ndarray_t *nd, int *coord) {
function nx_c_reduce_sum_f32 (line 605) | static void nx_c_reduce_sum_f32(const ndarray_t *input, ndarray_t *output,
function nx_c_reduce_sum_f64 (line 672) | static void nx_c_reduce_sum_f64(const ndarray_t *input, ndarray_t *output,
function nx_c_reduce_sum_f32_generic_wrap (line 770) | static void nx_c_reduce_sum_f32_generic_wrap(const ndarray_t *input,
function nx_c_reduce_sum_f64_generic_wrap (line 776) | static void nx_c_reduce_sum_f64_generic_wrap(const ndarray_t *input,
function nx_c_reduce_max_f32 (line 816) | static void nx_c_reduce_max_f32(const ndarray_t *input, ndarray_t *output,
function nx_c_reduce_max_f64 (line 844) | static void nx_c_reduce_max_f64(const ndarray_t *input, ndarray_t *output,
function nx_c_reduce_max_f32_generic_wrap (line 921) | static void nx_c_reduce_max_f32_generic_wrap(const ndarray_t *input,
function nx_c_reduce_max_f64_generic_wrap (line 927) | static void nx_c_reduce_max_f64_generic_wrap(const ndarray_t *input,
function nx_c_reduce_min_f32 (line 1028) | static void nx_c_reduce_min_f32(const ndarray_t *input, ndarray_t *output,
function nx_c_reduce_min_f64 (line 1056) | static void nx_c_reduce_min_f64(const ndarray_t *input, ndarray_t *output,
function nx_c_reduce_min_f32_generic_wrap (line 1133) | static void nx_c_reduce_min_f32_generic_wrap(const ndarray_t *input,
function nx_c_reduce_min_f64_generic_wrap (line 1139) | static void nx_c_reduce_min_f64_generic_wrap(const ndarray_t *input,
function dispatch_reduce_op (line 1167) | static void dispatch_reduce_op(value v_input, value v_output, int *axes,
FILE: packages/nx/lib/backend_c/nx_c_scan.c
type scan_plan_t (line 10) | typedef struct {
function scan_plan_t (line 20) | static scan_plan_t scan_prepare(const ndarray_t *input, const ndarray_t ...
function scan_plan_destroy (line 84) | static void scan_plan_destroy(scan_plan_t *plan) {
function advance_outer_coords (line 89) | static bool advance_outer_coords(const ndarray_t *input, const int *oute...
type scan_dispatch_table (line 248) | typedef struct {
function dispatch_scan_op (line 463) | static void dispatch_scan_op(value v_input, value v_output, int axis,
function CAMLprim (line 565) | CAMLprim value caml_nx_associative_scan(value v_input, value v_output,
FILE: packages/nx/lib/backend_c/nx_c_shape.c
function iterate_inner_dims_fill (line 21) | static inline void iterate_inner_dims_fill(const ndarray_t *z, long oute...
type fill_op_table (line 75) | typedef struct {
type copy_op_table (line 82) | typedef struct {
function get_elem_size (line 91) | static int get_elem_size(int kind) {
function iterate_inner_dims_copy (line 130) | static inline void iterate_inner_dims_copy(const ndarray_t *src,
function LOW_PREC_FILL_KERNEL (line 423) | GENERATE_FILL_OP(fill)
type caml_ba_array (line 536) | struct caml_ba_array
function CAMLprim (line 751) | CAMLprim value caml_nx_cat(value v_inputs, value v_axis, value v_output) {
FILE: packages/nx/lib/backend_c/nx_c_shared.h
type complex32 (line 45) | typedef float _Complex complex32;
type complex64 (line 46) | typedef double _Complex complex64;
function int4_get (line 52) | static inline int int4_get(const uint8_t *data, long offset, bool is_sig...
function int4_set (line 71) | static inline void int4_set(uint8_t *data, long offset, int value,
function complex32 (line 89) | static inline complex32 complex_max(complex32 a, complex32 b) {
function complex64 (line 97) | static inline complex64 complex64_max(complex64 a, complex64 b) {
function complex32 (line 105) | static inline complex32 complex_min(complex32 a, complex32 b) {
function complex64 (line 113) | static inline complex64 complex64_min(complex64 a, complex64 b) {
type ndarray_t (line 122) | typedef struct {
type nd_iterator_t (line 131) | typedef struct {
type nd_copy_iterator_t (line 141) | typedef struct {
type nd_single_iterator_t (line 150) | typedef struct {
function total_elements_safe (line 189) | static inline long total_elements_safe(const ndarray_t *arr) {
function is_fully_contiguous (line 204) | static inline bool is_fully_contiguous(const ndarray_t *x, const ndarray...
function is_contiguous (line 221) | static inline bool is_contiguous(const ndarray_t *x) {
function nd_iterator_init_safe (line 235) | static inline void nd_iterator_init_safe(nd_iterator_t *it, const ndarra...
function nd_iterator_get_offsets (line 258) | static inline void nd_iterator_get_offsets(const nd_iterator_t *it, long...
function nd_iterator_next (line 270) | static inline bool nd_iterator_next(nd_iterator_t *it) {
function nd_iterator_destroy (line 281) | static inline void nd_iterator_destroy(nd_iterator_t *it) {
function nd_iterator_init (line 289) | static inline void nd_iterator_init(nd_single_iterator_t *it, const ndar...
function nd_iterator_get_offset (line 304) | static inline void nd_iterator_get_offset(const nd_single_iterator_t *it...
function nd_single_iterator_next (line 311) | static inline bool nd_single_iterator_next(nd_single_iterator_t *it) {
function nd_single_iterator_destroy (line 322) | static inline void nd_single_iterator_destroy(nd_single_iterator_t *it) {
function nd_copy_iterator_init (line 330) | static inline void nd_copy_iterator_init(nd_copy_iterator_t *it, const n...
function nd_copy_iterator_get_offsets (line 350) | static inline void nd_copy_iterator_get_offsets(const nd_copy_iterator_t...
function nd_copy_iterator_next (line 359) | static inline bool nd_copy_iterator_next(nd_copy_iterator_t *it) {
function nd_copy_iterator_destroy (line 370) | static inline void nd_copy_iterator_destroy(nd_copy_iterator_t *it) {
function ndarray_t (line 378) | static inline ndarray_t extract_ndarray(value v_ffi_tensor) {
function cleanup_ndarray (line 410) | static inline void cleanup_ndarray(ndarray_t *arr) {
function ndarray_t (line 417) | static inline ndarray_t extract_ndarray_stack(value v_ffi_tensor,
FILE: packages/nx/lib/backend_c/nx_c_solve.c
function nx_ndim (line 23) | static inline int nx_ndim(value v_shape) { return Wosize_val(v_shape); }
function nx_shape_at (line 25) | static inline int nx_shape_at(value v_shape, int idx) {
function nx_stride_at (line 29) | static inline int nx_stride_at(value v_strides, int idx) {
function nx_batch_size (line 33) | static inline int nx_batch_size(value v_shape) {
function nx_batch_offset_elems (line 43) | static inline size_t nx_batch_offset_elems(int b, value v_shape,
function nx_pack_f32 (line 60) | static void nx_pack_f32(float* dst, const float* src, int m, int n,
function nx_unpack_f32 (line 69) | static void nx_unpack_f32(float* dst, const float* src, int m, int n,
function nx_pack_f64 (line 78) | static void nx_pack_f64(double* dst, const double* src, int m, int n,
function nx_unpack_f64 (line 87) | static void nx_unpack_f64(double* dst, const double* src, int m, int n,
function nx_pack_c32 (line 96) | static void nx_pack_c32(complex32* dst, const complex32* src, int m, int n,
function nx_unpack_c32 (line 105) | static void nx_unpack_c32(complex32* dst, const complex32* src, int m, i...
function nx_pack_c64 (line 114) | static void nx_pack_c64(complex64* dst, const complex64* src, int m, int n,
function nx_unpack_c64 (line 123) | static void nx_unpack_c64(complex64* dst, const complex64* src, int m, i...
function triangular_solve_float32 (line 133) | static void triangular_solve_float32(const float* a, const float* b, flo...
function triangular_solve_float64 (line 217) | static void triangular_solve_float64(const double* a, const double* b,
function triangular_solve_complex32 (line 301) | static void triangular_solve_complex32(const complex32* a, const complex...
function triangular_solve_complex64 (line 393) | static void triangular_solve_complex64(const complex64* a, const complex...
function triangular_solve_float16 (line 481) | static int triangular_solve_float16(const uint16_t* a, const uint16_t* b,
function triangular_solve_bfloat16 (line 504) | static int triangular_solve_bfloat16(const caml_ba_bfloat16* a,
function triangular_solve_f8e4m3 (line 528) | static int triangular_solve_f8e4m3(const caml_ba_fp8_e4m3* a,
function triangular_solve_f8e5m2 (line 552) | static int triangular_solve_f8e5m2(const caml_ba_fp8_e5m2* a,
function solve_float32 (line 581) | static void solve_float32(float* a, float* b, int n, int nrhs) {
function solve_float64 (line 614) | static void solve_float64(double* a, double* b, int n, int nrhs) {
function solve_complex32 (line 647) | static void solve_complex32(complex32* a, complex32* b, int n, int nrhs) {
function solve_complex64 (line 680) | static void solve_complex64(complex64* a, complex64* b, int n, int nrhs) {
function CAMLprim (line 718) | CAMLprim value caml_nx_op_triangular_solve(value v_a, value v_b, value v...
function CAMLprim (line 981) | CAMLprim value caml_nx_op_triangular_solve_bc(value *argv, int argn) {
FILE: packages/nx/lib/backend_c/nx_c_sort.c
type slice_sort_ctx_t (line 26) | typedef struct {
function compare_u64 (line 34) | static inline int compare_u64(uint64_t a, uint64_t b) {
function compare_i64 (line 38) | static inline int compare_i64(int64_t a, int64_t b) {
function compare_float_total (line 42) | static inline int compare_float_total(double a, double b) {
function is_nan_at (line 54) | static inline bool is_nan_at(int kind, const void* data, long off) {
function compare_values_at (line 73) | static inline int compare_values_at(int kind, const void* data, long a_off,
function copy_value_at (line 186) | static inline void copy_value_at(int kind, const void* src_data, long sr...
function kind_supported_for_sort (line 265) | static inline bool kind_supported_for_sort(int kind) {
function product_range (line 294) | static inline long product_range(const int* shape, int start, int end) {
function compute_base_offset_same_rank (line 300) | static inline long compute_base_offset_same_rank(const ndarray_t* arr,
function compute_out_offset_arg (line 321) | static inline long compute_out_offset_arg(const ndarray_t* x,
function compare_slice_indices (line 343) | static inline int compare_slice_indices(const slice_sort_ctx_t* ctx, int...
function stable_mergesort_indices (line 366) | static void stable_mergesort_indices(int* idx, int* tmp, int n,
function arg_reduce_impl (line 400) | static void arg_reduce_impl(const ndarray_t* x, ndarray_t* out, int kind,
function sort_impl (line 460) | static int sort_impl(const ndarray_t* x, ndarray_t* out, int kind, int a...
function CAMLprim (line 628) | CAMLprim value caml_nx_argmax(value v_x, value v_out, value v_axis,
function CAMLprim (line 673) | CAMLprim value caml_nx_argmin(value v_x, value v_out, value v_axis,
function CAMLprim (line 718) | CAMLprim value caml_nx_sort(value v_x, value v_out, value v_axis,
function CAMLprim (line 772) | CAMLprim value caml_nx_argsort(value v_x, value v_out, value v_axis,
FILE: packages/nx/lib/backend_c/nx_c_svd.c
function get_element_size (line 23) | static long get_element_size(int kind) {
function nx_ndim (line 60) | static inline int nx_ndim(value v_shape) { return Wosize_val(v_shape); }
function nx_shape_at (line 62) | static inline int nx_shape_at(value v_shape, int idx) {
function nx_stride_at (line 66) | static inline int nx_stride_at(value v_strides, int idx) {
function nx_batch_size (line 70) | static inline int nx_batch_size(value v_shape) {
function nx_batch_offset_elems (line 80) | static inline size_t nx_batch_offset_elems(int b, value v_shape,
function nx_pack_f32 (line 97) | static void nx_pack_f32(float* dst, const float* src, int m, int n,
function nx_unpack_f32 (line 106) | static void nx_unpack_f32(float* dst, const float* src, int m, int n,
function nx_pack_f64 (line 115) | static void nx_pack_f64(double* dst, const double* src, int m, int n,
function nx_unpack_f64 (line 124) | static void nx_unpack_f64(double* dst, const double* src, int m, int n,
function nx_pack_c32 (line 133) | static void nx_pack_c32(complex32* dst, const complex32* src, int m, int n,
function nx_unpack_c32 (line 142) | static void nx_unpack_c32(complex32* dst, const complex32* src, int m, i...
function nx_pack_c64 (line 151) | static void nx_pack_c64(complex64* dst, const complex64* src, int m, int n,
function nx_unpack_c64 (line 160) | static void nx_unpack_c64(complex64* dst, const complex64* src, int m, i...
function sign_float32 (line 170) | static inline float sign_float32(float x) { return (x >= 0.0f) ? 1.0f : ...
function sign_float64 (line 172) | static inline double sign_float64(double x) { return (x >= 0.0) ? 1.0 : ...
function hypot_float32 (line 174) | static inline float hypot_float32(float a, float b) {
function hypot_float64 (line 188) | static inline double hypot_float64(double a, double b) {
function givens_float32 (line 202) | static void givens_float32(float a, float b, float* c, float* s) {
function givens_float64 (line 219) | static void givens_float64(double a, double b, double* c, double* s) {
function apply_givens_left_float32 (line 236) | static void apply_givens_left_float32(float* a, int m, int n, int i, int j,
function apply_givens_left_float64 (line 246) | static void apply_givens_left_float64(double* a, int m, int n, int i, in...
function apply_givens_right_float32 (line 256) | static void apply_givens_right_float32(float* a, int m, int n, int i, in...
function apply_givens_right_float64 (line 266) | static void apply_givens_right_float64(double* a, int m, int n, int i, i...
function bidiagonalize_float32 (line 276) | static void bidiagonalize_float32(float* a, float* u, float* v, float* d...
function bidiagonalize_float64 (line 339) | static void bidiagonalize_float64(double* a, double* u, double* v, doubl...
function svd_qr_iteration_float32 (line 402) | static void svd_qr_iteration_float32(float* diag, float* superdiag, floa...
function svd_qr_iteration_float64 (line 432) | static void svd_qr_iteration_float64(double* diag, double* superdiag, do...
function svd_iterate_float32 (line 462) | static void svd_iterate_float32(float* diag, float* superdiag, float* u,
function svd_iterate_float64 (line 498) | static void svd_iterate_float64(double* diag, double* superdiag, double* u,
function svd_float32 (line 533) | static void svd_float32(float* a, float* u, float* s, float* vt, int m, ...
function svd_float64 (line 561) | static void svd_float64(double* a, double* u, double* s, double* vt, int m,
function complex32 (line 590) | static inline complex32 sign_complex32(complex32 x) {
function complex64 (line 595) | static inline complex64 sign_complex64(complex64 x) {
function hypot_complex32 (line 600) | static inline float hypot_complex32(complex32 a, complex32 b) {
function hypot_complex64 (line 605) | static inline double hypot_complex64(complex64 a, complex64 b) {
function givens_complex32 (line 609) | static void givens_complex32(complex32 a, complex32 b, float* c, complex...
function givens_complex64 (line 626) | static void givens_complex64(complex64 a, complex64 b, double* c,
function apply_givens_left_complex32 (line 644) | static void apply_givens_left_complex32(complex32* a, int m, int n, int i,
function apply_givens_left_complex64 (line 654) | static void apply_givens_left_complex64(complex64* a, int m, int n, int i,
function apply_givens_right_complex32 (line 664) | static void apply_givens_right_complex32(complex32* a, int m, int n, int i,
function apply_givens_right_complex64 (line 674) | static void apply_givens_right_complex64(complex64* a, int m, int n, int i,
function bidiagonalize_complex32 (line 684) | static void bidiagonalize_complex32(complex32* a, complex32* u, complex3...
function bidiagonalize_complex64 (line 756) | static void bidiagonalize_complex64(complex64* a, complex64* u, complex6...
function svd_qr_iteration_complex32 (line 828) | static void svd_qr_iteration_complex32(float* diag, float* superdiag,
function svd_qr_iteration_complex64 (line 861) | static void svd_qr_iteration_complex64(double* diag, double* superdiag,
function svd_iterate_complex32 (line 893) | static void svd_iterate_complex32(float* diag, float* superdiag, complex...
function svd_iterate_complex64 (line 924) | static void svd_iterate_complex64(double* diag, double* superdiag, compl...
function svd_complex32 (line 955) | static void svd_complex32(complex32* a, complex32* u, float* s, complex3...
function svd_complex64 (line 996) | static void svd_complex64(complex64* a, complex64* u, double* s, complex...
function svd_float16 (line 1037) | static void svd_float16(uint16_t* a, uint16_t* u, uint16_t* s, uint16_t*...
function svd_bfloat16 (line 1064) | static void svd_bfloat16(caml_ba_bfloat16* a, caml_ba_bfloat16* u,
function svd_f8e4m3 (line 1092) | static void svd_f8e4m3(caml_ba_fp8_e4m3* a, caml_ba_fp8_e4m3* u,
function svd_f8e5m2 (line 1120) | static void svd_f8e5m2(caml_ba_fp8_e5m2* a, caml_ba_fp8_e5m2* u,
function CAMLprim (line 1152) | CAMLprim value caml_nx_op_svd(value v_in, value v_u, value v_s, value v_vt,
FILE: packages/nx/lib/backend_c/nx_c_ternary.c
type ternary_op_table (line 22) | typedef struct {
type nd_iterator_ternary_t (line 30) | typedef struct {
function is_fully_contiguous_ternary (line 41) | static inline bool is_fully_contiguous_ternary(const ndarray_t *cond,
function nd_iterator_init_ternary (line 63) | static inline void nd_iterator_init_ternary(nd_iterator_ternary_t *it,
function nd_iterator_get_offsets_ternary (line 89) | static inline void nd_iterator_get_offsets_ternary(
function nd_iterator_next_ternary (line 104) | static inline bool nd_iterator_next_ternary(nd_iterator_ternary_t *it) {
function nd_iterator_destroy_ternary (line 115) | static inline void nd_iterator_destroy_ternary(nd_iterator_ternary_t *it) {
function iterate_inner_dims_ternary (line 172) | static inline void iterate_inner_dims_ternary(
function dispatch_ternary_op (line 360) | static void dispatch_ternary_op(value v_cond, value v_x, value v_y, valu...
function CAMLprim (line 519) | CAMLprim value caml_nx_where(value v_cond, value v_x, value v_y, value v...
FILE: packages/nx/lib/backend_c/nx_c_unary.c
type unary_op_table (line 23) | typedef struct {
function iterate_inner_dims_unary (line 77) | static inline void iterate_inner_dims_unary(const ndarray_t *x,
function dispatch_unary_op (line 907) | static void dispatch_unary_op(value v_x, value v_z, const unary_op_table...
FILE: packages/nx/lib/backend_c/nx_c_window.c
type type_ops_t (line 33) | typedef struct {
type type_ops_table_t (line 40) | typedef struct {
function add_elem_f16 (line 93) | static void add_elem_f16(void* out, long o_off, void* in, long i_off) {
function add_elem_bf16 (line 103) | static void add_elem_bf16(void* out, long o_off, void* in, long i_off) {
function add_elem_f8e4m3 (line 113) | static void add_elem_f8e4m3(void* out, long o_off, void* in, long i_off) {
function add_elem_f8e5m2 (line 123) | static void add_elem_f8e5m2(void* out, long o_off, void* in, long i_off) {
function zero_elem_i4 (line 132) | static void zero_elem_i4(void* out, long o_off) {
function copy_elem_i4 (line 143) | static void copy_elem_i4(void* out, long o_off, void* in, long i_off) {
function add_elem_i4 (line 159) | static void add_elem_i4(void* out, long o_off, void* in, long i_off) {
function zero_elem_u4 (line 178) | static void zero_elem_u4(void* out, long o_off) {
function copy_elem_u4 (line 189) | static void copy_elem_u4(void* out, long o_off, void* in, long i_off) {
function add_elem_u4 (line 205) | static void add_elem_u4(void* out, long o_off, void* in, long i_off) {
function get_elem_size (line 248) | static size_t get_elem_size(int kind) {
function leading_offset (line 283) | static long leading_offset(const ndarray_t* t, int leading_ndim,
function nx_c_unfold_impl (line 298) | static void nx_c_unfold_impl(const ndarray_t* in, ndarray_t* out,
function nx_c_fold_impl (line 440) | static void nx_c_fold_impl(const ndarray_t* in, ndarray_t* out,
function type_ops_t (line 518) | static const type_ops_t* get_type_ops(int kind) {
function CAMLprim (line 568) | CAMLprim value caml_nx_op_unfold(value v_in, value v_kernel_size,
function CAMLprim (line 658) | CAMLprim value caml_nx_op_fold(value v_in, value v_output_size,
function CAMLprim (line 777) | CAMLprim value caml_nx_op_unfold_bc(value* argv, int argn) {
function CAMLprim (line 786) | CAMLprim value caml_nx_op_fold_bc(value* argv, int argn) {
FILE: packages/nx/lib/buffer/nx_buffer_stubs.c
function nx_buffer_base_kind (line 22) | static int nx_buffer_base_kind(int kind) {
function nx_buffer_element_byte_size (line 38) | static int nx_buffer_element_byte_size(int kind) {
function value (line 52) | static value nx_buffer_alloc_with_kind(int kind, int layout_flag, int nu...
function umul_overflow (line 66) | static int umul_overflow(uintnat a, uintnat b, uintnat *res) {
function uintnat (line 72) | static uintnat nx_buffer_num_elts_from_dims(int num_dims, intnat *dim) {
function uintnat (line 81) | static uintnat nx_buffer_num_elts(struct caml_ba_array *b) {
function intnat (line 88) | static intnat nx_buffer_offset(struct caml_ba_array *b, intnat *index) {
function value (line 145) | static value nx_buffer_create_int4(int kind, value vlayout, value vdim) {
function CAMLprim (line 161) | CAMLprim value caml_nx_buffer_create_int4_signed(value vlayout, value vd...
function CAMLprim (line 165) | CAMLprim value caml_nx_buffer_create_int4_unsigned(value vlayout, value ...
function CAMLprim (line 173) | CAMLprim value caml_nx_buffer_get(value vb, value vind) {
function CAMLprim (line 242) | CAMLprim value caml_nx_buffer_set(value vb, value vind, value newval) {
function value (line 317) | static value nx_buffer_unsafe_get_ext(struct caml_ba_array *b, intnat of...
function CAMLprim (line 358) | CAMLprim value caml_nx_buffer_unsafe_get(value vb, value vi) {
function nx_buffer_unsafe_set_ext (line 375) | static void nx_buffer_unsafe_set_ext(struct caml_ba_array *b, intnat off...
function CAMLprim (line 429) | CAMLprim value caml_nx_buffer_unsafe_set(value vb, value vi, value newva...
function CAMLprim (line 447) | CAMLprim value caml_nx_buffer_kind(value vb) {
function CAMLprim (line 481) | CAMLprim value caml_nx_buffer_blit(value vsrc, value vdst) {
function CAMLprim (line 515) | CAMLprim value caml_nx_buffer_fill(value vb, value vinit) {
function CAMLprim (line 591) | CAMLprim value caml_nx_buffer_blit_from_bytes(value vbytes, value vsrc_off,
function CAMLprim (line 603) | CAMLprim value caml_nx_buffer_blit_to_bytes(value vsrc, value vsrc_off,
FILE: packages/nx/lib/buffer/nx_buffer_stubs.h
type caml_ba_bfloat16 (line 19) | typedef uint16_t caml_ba_bfloat16;
type caml_ba_fp8_e4m3 (line 20) | typedef uint8_t caml_ba_fp8_e4m3;
type caml_ba_fp8_e5m2 (line 21) | typedef uint8_t caml_ba_fp8_e5m2;
type caml_ba_bool (line 22) | typedef uint8_t caml_ba_bool;
type caml_ba_uint32 (line 24) | typedef uint32_t caml_ba_uint32;
type caml_ba_uint64 (line 25) | typedef uint64_t caml_ba_uint64;
type nx_ba_extended_kind (line 28) | enum nx_ba_extended_kind {
function nx_buffer_is_extended_kind (line 45) | static inline bool nx_buffer_is_extended_kind(int kind) {
function nx_buffer_get_stored_extended_kind (line 49) | static inline int nx_buffer_get_stored_extended_kind(int flags) {
function nx_buffer_store_extended_kind (line 53) | static inline int nx_buffer_store_extended_kind(int flags, int kind) {
function nx_buffer_get_kind_from_flags (line 60) | static inline int nx_buffer_get_kind_from_flags(int flags) {
function nx_buffer_get_kind (line 66) | static inline int nx_buffer_get_kind(const struct caml_ba_array *b) {
function float_to_bfloat16 (line 73) | static inline uint16_t float_to_bfloat16(float f) {
function bfloat16_to_float (line 83) | static inline float bfloat16_to_float(uint16_t bf16) {
function float_to_half (line 93) | static inline uint16_t float_to_half(float f) {
function half_to_float (line 127) | static inline float half_to_float(uint16_t h) {
function float_to_fp8_e4m3 (line 162) | static inline uint8_t float_to_fp8_e4m3(float f) {
function fp8_e4m3_to_float (line 202) | static inline float fp8_e4m3_to_float(uint8_t fp8) {
function float_to_fp8_e5m2 (line 231) | static inline uint8_t float_to_fp8_e5m2(float f) {
function fp8_e5m2_to_float (line 278) | static inline float fp8_e5m2_to_float(uint8_t fp8) {
FILE: packages/nx/lib/buffer/nx_buffer_stubs.js
function caml_unpackBfloat16 (line 20) | function caml_unpackBfloat16(bytes) {
function caml_packBfloat16 (line 30) | function caml_packBfloat16(num) {
function caml_unpackFp8_e4m3 (line 39) | function caml_unpackFp8_e4m3(byte) {
function caml_packFp8_e4m3 (line 57) | function caml_packFp8_e4m3(num) {
function caml_unpackFp8_e5m2 (line 76) | function caml_unpackFp8_e5m2(byte) {
function caml_packFp8_e5m2 (line 94) | function caml_packFp8_e5m2(num) {
function caml_nx_buffer_size_per_element (line 124) | function caml_nx_buffer_size_per_element(kind) {
function caml_nx_buffer_create_data (line 154) | function caml_nx_buffer_create_data(kind, size) {
class Ml_Nx_buffer (line 200) | class Ml_Nx_buffer extends Ml_Bigarray {
method get (line 201) | get(ofs) {
method set (line 248) | set(ofs, v) {
method fill (line 307) | fill(v) {
function caml_nx_buffer_create_unsafe (line 350) | function caml_nx_buffer_create_unsafe(kind, layout, dims, data) {
function caml_nx_buffer_create_internal (line 384) | function caml_nx_buffer_create_internal(kind, layout, dims_ml) {
function caml_nx_buffer_create_bfloat16 (line 393) | function caml_nx_buffer_create_bfloat16(layout, dims) {
function caml_nx_buffer_create_bool (line 399) | function caml_nx_buffer_create_bool(layout, dims) {
function caml_nx_buffer_create_int4_signed (line 405) | function caml_nx_buffer_create_int4_signed(layout, dims) {
function caml_nx_buffer_create_int4_unsigned (line 411) | function caml_nx_buffer_create_int4_unsigned(layout, dims) {
function caml_nx_buffer_create_float8_e4m3 (line 417) | function caml_nx_buffer_create_float8_e4m3(layout, dims) {
function caml_nx_buffer_create_float8_e5m2 (line 423) | function caml_nx_buffer_create_float8_e5m2(layout, dims) {
function caml_nx_buffer_create_uint32 (line 429) | function caml_nx_buffer_create_uint32(layout, dims) {
function caml_nx_buffer_create_uint64 (line 435) | function caml_nx_buffer_create_uint64(layout, dims) {
function caml_nx_buffer_get (line 441) | function caml_nx_buffer_get(ba, i) {
function caml_nx_buffer_set (line 453) | function caml_nx_buffer_set(ba, i, v) {
function caml_nx_buffer_unsafe_get (line 465) | function caml_nx_buffer_unsafe_get(ba, i) {
function caml_nx_buffer_unsafe_set (line 474) | function caml_nx_buffer_unsafe_set(ba, i, v) {
function caml_nx_buffer_kind (line 484) | function caml_nx_buffer_kind(ba) {
function caml_nx_buffer_blit (line 518) | function caml_nx_buffer_blit(src, dst) {
function caml_nx_buffer_fill (line 529) | function caml_nx_buffer_fill(ba, v) {
function caml_nx_buffer_blit_from_bytes (line 538) | function caml_nx_buffer_blit_from_bytes(bytes, src_off, dst, dst_off, le...
function caml_nx_buffer_blit_to_bytes (line 547) | function caml_nx_buffer_blit_to_bytes(src, src_off, bytes, dst_off, len) {
FILE: packages/nx/test/fixtures/generate.py
function main (line 18) | def main():
FILE: packages/nx/vendor/camlzip/zlibstubs.c
function camlzip_error (line 32) | static void camlzip_error(char * fn, value vzs)
function camlzip_free_dstream (line 55) | static void camlzip_free_dstream(value vzs)
type custom_operations (line 62) | struct custom_operations
function value (line 66) | value camlzip_deflateInit(value vlevel, value expect_header)
function value (line 89) | value camlzip_deflate(value vzs, value srcbuf, value srcpos, value srclen,
function value (line 115) | value camlzip_deflate_bytecode(value * arg, int nargs)
function value (line 121) | value camlzip_deflateEnd(value vzs)
function camlzip_free_istream (line 128) | static void camlzip_free_istream(value vzs)
type custom_operations (line 135) | struct custom_operations
function value (line 139) | value camlzip_inflateInit(value expect_header)
function value (line 158) | value camlzip_inflate(value vzs, value srcbuf, value srcpos, value srclen,
function value (line 185) | value camlzip_inflate_bytecode(value * arg, int nargs)
function value (line 191) | value camlzip_inflateEnd(value vzs)
function value (line 198) | value camlzip_update_crc32(value crc, value buf, value pos, value len)
FILE: packages/nx/vendor/ocaml-pocketfft/pocketfft/pocketfft_hdronly.h
function namespace (line 94) | namespace pocketfft {
function cmplx (line 306) | static cmplx<Thigh> calc(size_t x, size_t n, Thigh ang)
type util (line 373) | struct util // hack to avoid duplicate symbols
function POCKETFFT_NOINLINE (line 387) | static POCKETFFT_NOINLINE double cost_guess (size_t n)
function POCKETFFT_NOINLINE (line 405) | static POCKETFFT_NOINLINE size_t good_size_cmplx(size_t n)
function POCKETFFT_NOINLINE (line 434) | static POCKETFFT_NOINLINE size_t good_size_real(size_t n)
function POCKETFFT_NOINLINE (line 461) | static POCKETFFT_NOINLINE size_t prev_good_size_cmplx(size_t n)
function POCKETFFT_NOINLINE (line 486) | static POCKETFFT_NOINLINE size_t prev_good_size_real(size_t n)
function prod (line 508) | static size_t prod(const shape_t &shape)
function shutdown (line 805) | void shutdown()
function restart (line 811) | void restart()
function thread_pool (line 818) | inline thread_pool & get_pool()
type fctdata (line 881) | struct fctdata
function add_factor (line 891) | void add_factor(size_t factor)
function twsize (line 1550) | size_t twsize() const
function comp_twiddle (line 1564) | void comp_twiddle()
type fctdata (line 1607) | struct fctdata
function add_factor (line 1617) | void add_factor(size_t factor)
function twsize (line 2349) | size_t twsize() const
function comp_twiddle (line 2362) | void comp_twiddle()
function exec (line 2579) | void exec(T c[], T0 fct, bool fwd) const
function exec (line 2599) | void exec(T c[], T0 fct, bool ortho,
function exec (line 2630) | void exec(T c[], T0 fct,
function exec (line 2661) | void exec(T c[], T0 fct, bool ortho,
function exec (line 2741) | void exec(T c[], T0 fct,
function find_in_cache (line 2834) | auto find_in_cache = [&]() -> std::shared_ptr<T>
function class (line 2876) | class arr_info
function advance_i (line 2924) | void advance_i()
function advance (line 2970) | void advance(size_t n)
function iofs (line 2981) | ptrdiff_t iofs(size_t i) const { return p_i[0] + ptrdiff_t(i)*str_i; }
function iofs (line 2982) | ptrdiff_t iofs(size_t j, size_t i) const { return p_i[j] + ptrdiff_t(i)*...
function oofs (line 2983) | ptrdiff_t oofs(size_t i) const { return p_o[0] + ptrdiff_t(i)*str_o; }
function oofs (line 2984) | ptrdiff_t oofs(size_t j, size_t i) const { return p_o[j] + ptrdiff_t(i)*...
function class (line 2992) | class simple_iter
function class (line 3020) | class rev_iter
type ExecC2C (line 3220) | struct ExecC2C
type ExecHartley (line 3265) | struct ExecHartley
type ExecDcst (line 3277) | struct ExecDcst
type ExecR2R (line 3420) | struct ExecR2R
function ExecDcst (line 3461) | const ExecDcst exec{ortho, type, true};
function ExecDcst (line 3479) | const ExecDcst exec{ortho, type, false};
function newaxes (line 3515) | auto newaxes = shape_t{axes.begin(), --axes.end()};
function newaxes (line 3553) | auto newaxes = shape_t{axes.begin(), --axes.end()};
FILE: packages/nx/vendor/ocaml-pocketfft/pocketfft_stubs.cpp
function POCKETFFT_HOT (line 79) | POCKETFFT_HOT POCKETFFT_INLINE value
function value (line 110) | value caml_pocketfft_c2c_f32_bytecode(value* argv, int argn) {
function POCKETFFT_HOT (line 116) | POCKETFFT_HOT POCKETFFT_INLINE value
function value (line 147) | value caml_pocketfft_r2c_f32_bytecode(value* argv, int argn) {
function POCKETFFT_HOT (line 153) | POCKETFFT_HOT POCKETFFT_INLINE value
function value (line 184) | value caml_pocketfft_c2r_f32_bytecode(value* argv, int argn) {
function POCKETFFT_HOT (line 190) | POCKETFFT_HOT POCKETFFT_INLINE value caml_pocketfft_dct_f32(
function value (line 222) | value caml_pocketfft_dct_f32_bytecode(value* argv, int argn) {
function POCKETFFT_HOT (line 228) | POCKETFFT_HOT POCKETFFT_INLINE value caml_pocketfft_dst_f32(
function value (line 260) | value caml_pocketfft_dst_f32_bytecode(value* argv, int argn) {
function POCKETFFT_HOT (line 266) | POCKETFFT_HOT POCKETFFT_INLINE value
function value (line 297) | value caml_pocketfft_c2c_f64_bytecode(value* argv, int argn) {
function POCKETFFT_HOT (line 303) | POCKETFFT_HOT POCKETFFT_INLINE value
function value (line 334) | value caml_pocketfft_r2c_f64_bytecode(value* argv, int argn) {
function POCKETFFT_HOT (line 340) | POCKETFFT_HOT POCKETFFT_INLINE value
function value (line 371) | value caml_pocketfft_c2r_f64_bytecode(value* argv, int argn) {
function POCKETFFT_HOT (line 377) | POCKETFFT_HOT POCKETFFT_INLINE value caml_pocketfft_dct_f64(
function value (line 409) | value caml_pocketfft_dct_f64_bytecode(value* argv, int argn) {
function POCKETFFT_HOT (line 415) | POCKETFFT_HOT POCKETFFT_INLINE value caml_pocketfft_dst_f64(
function value (line 447) | value caml_pocketfft_dst_f64_bytecode(value* argv, int argn) {
FILE: packages/nx/vendor/stb_image/ml_stb_image.c
function Channels_val (line 11) | static int Channels_val(value channel)
function value (line 20) | static value return_image(void *data, int ty, int x, int y, int n)
function value (line 42) | static value return_failure(void)
function CAMLprim (line 61) | CAMLprim value ml_stbi_load(value channels, value filename)
function CAMLprim (line 79) | CAMLprim value ml_stbi_loadf(value channels, value filename)
function CAMLprim (line 98) | CAMLprim value ml_stbi_load_mem(value channels, value mem)
function CAMLprim (line 119) | CAMLprim value ml_stbi_loadf_mem(value channels, value mem)
function CAMLprim (line 140) | CAMLprim value ml_stbi_image_free(value ba)
function CAMLprim (line 160) | CAMLprim value ml_stbi_mipmap(value img_in, value img_out)
function CAMLprim (line 195) | CAMLprim value ml_stbi_mipmapf(value img_in, value img_out)
function memswap (line 230) | static void memswap(void *i0, void *i1, size_t count)
function CAMLprim (line 241) | CAMLprim value ml_stbi_vflip(value img)
function CAMLprim (line 268) | CAMLprim value ml_stbi_vflipf(value img)
function expblur4 (line 324) | static void expblur4(unsigned char* ptr, int w, int h, int stride, int a...
function expblur3 (line 357) | static void expblur3(unsigned char* ptr, int w, int h, int stride, int a...
function expblur2 (line 386) | static void expblur2(unsigned char* ptr, int w, int h, int stride, int a...
function expblur1 (line 411) | static void expblur1(unsigned char* ptr, int w, int h, int stride, int a...
function expblur (line 432) | static void expblur(unsigned char* ptr, int w, int h, int channels, int ...
function CAMLprim (line 459) | CAMLprim value ml_stbi_expblur(value img, value radius)
FILE: packages/nx/vendor/stb_image/stb_image.h
type stbi_uc (line 387) | typedef unsigned char stbi_uc;
type stbi_us (line 388) | typedef unsigned short stbi_us;
type stbi_io_callbacks (line 411) | typedef struct
type stbi__uint16 (line 642) | typedef unsigned short stbi__uint16;
type stbi__int16 (line 643) | typedef signed short stbi__int16;
type stbi__uint32 (line 644) | typedef unsigned int stbi__uint32;
type stbi__int32 (line 645) | typedef signed int stbi__int32;
type stbi__uint16 (line 648) | typedef uint16_t stbi__uint16;
type stbi__int16 (line 649) | typedef int16_t stbi__int16;
type stbi__uint32 (line 650) | typedef uint32_t stbi__uint32;
type stbi__int32 (line 651) | typedef int32_t stbi__int32;
function stbi__cpuid3 (line 732) | static int stbi__cpuid3(void)
function stbi__sse2_available (line 754) | static int stbi__sse2_available(void)
function stbi__sse2_available (line 765) | static int stbi__sse2_available(void)
type stbi__context (line 805) | typedef struct
function stbi__start_mem (line 826) | static void stbi__start_mem(stbi__context *s, stbi_uc const *buffer, int...
function stbi__start_callbacks (line 836) | static void stbi__start_callbacks(stbi__context *s, stbi_io_callbacks *c...
function stbi__stdio_read (line 850) | static int stbi__stdio_read(void *user, char *data, int size)
function stbi__stdio_skip (line 855) | static void stbi__stdio_skip(void *user, int n)
function stbi__stdio_eof (line 865) | static int stbi__stdio_eof(void *user)
function stbi__start_file (line 877) | static void stbi__start_file(stbi__context *s, FILE *f)
function stbi__rewind (line 886) | static void stbi__rewind(stbi__context *s)
type stbi__result_info (line 901) | typedef struct
function STBIDEF (line 972) | STBIDEF const char *stbi_failure_reason(void)
function stbi__err (line 978) | static int stbi__err(const char *str)
function stbi__addsizes_valid (line 1002) | static int stbi__addsizes_valid(int a, int b)
function stbi__mul2sizes_valid (line 1014) | static int stbi__mul2sizes_valid(int a, int b)
function stbi__mad2sizes_valid (line 1024) | static int stbi__mad2sizes_valid(int a, int b, int add)
function stbi__mad3sizes_valid (line 1031) | static int stbi__mad3sizes_valid(int a, int b, int c, int add)
function stbi__mad4sizes_valid (line 1039) | static int stbi__mad4sizes_valid(int a, int b, int c, int d, int add)
function stbi__addints_valid (line 1070) | static int stbi__addints_valid(int a, int b)
function stbi__mul2shorts_valid (line 1078) | static int stbi__mul2shorts_valid(int a, int b)
function STBIDEF (line 1101) | STBIDEF void stbi_image_free(void *retval_from_stbi_load)
function STBIDEF (line 1116) | STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip)
function STBIDEF (line 1126) | STBIDEF void stbi_set_flip_vertically_on_load_thread(int flag_true_if_sh...
function stbi_uc (line 1190) | static stbi_uc *stbi__convert_16_to_8(stbi__uint16 *orig, int w, int h, ...
function stbi__uint16 (line 1206) | static stbi__uint16 *stbi__convert_8_to_16(stbi_uc *orig, int w, int h, ...
function stbi__vertical_flip (line 1222) | static void stbi__vertical_flip(void *image, int w, int h, int bytes_per...
function stbi__vertical_flip_slices (line 1247) | static void stbi__vertical_flip_slices(void *image, int w, int h, int z,...
function stbi__uint16 (line 1286) | static stbi__uint16 *stbi__load_and_postprocess_16bit(stbi__context *s, ...
function stbi__float_postprocess (line 1314) | static void stbi__float_postprocess(float *result, int *x, int *y, int *...
function STBIDEF (line 1331) | STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, c...
function FILE (line 1337) | static FILE *stbi__fopen(char const *filename, char const *mode)
function STBIDEF (line 1366) | STBIDEF stbi_uc *stbi_load(char const *filename, int *x, int *y, int *co...
function STBIDEF (line 1376) | STBIDEF stbi_uc *stbi_load_from_file(FILE *f, int *x, int *y, int *comp,...
function STBIDEF (line 1389) | STBIDEF stbi__uint16 *stbi_load_from_file_16(FILE *f, int *x, int *y, in...
function STBIDEF (line 1402) | STBIDEF stbi_us *stbi_load_16(char const *filename, int *x, int *y, int ...
function STBIDEF (line 1415) | STBIDEF stbi_us *stbi_load_16_from_memory(stbi_uc const *buffer, int len...
function STBIDEF (line 1422) | STBIDEF stbi_us *stbi_load_16_from_callbacks(stbi_io_callbacks const *cl...
function STBIDEF (line 1429) | STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, i...
function STBIDEF (line 1436) | STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk,...
function STBIDEF (line 1444) | STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int le...
function STBIDEF (line 1478) | STBIDEF float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, in...
function STBIDEF (line 1485) | STBIDEF float *stbi_loadf_from_callbacks(stbi_io_callbacks const *clbk, ...
function STBIDEF (line 1493) | STBIDEF float *stbi_loadf(char const *filename, int *x, int *y, int *com...
function STBIDEF (line 1503) | STBIDEF float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, ...
function STBIDEF (line 1517) | STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len)
function STBIDEF (line 1531) | STBIDEF int stbi_is_hdr (char const *filename)
function STBIDEF (line 1542) | STBIDEF int stbi_is_hdr_from_file(FILE *f)
function STBIDEF (line 1559) | STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clb...
function STBIDEF (line 1575) | STBIDEF void stbi_ldr_to_hdr_gamma(float gamma) { stbi__l2h_gamma = ga...
function STBIDEF (line 1576) | STBIDEF void stbi_ldr_to_hdr_scale(float scale) { stbi__l2h_scale = sc...
function STBIDEF (line 1581) | STBIDEF void stbi_hdr_to_ldr_gamma(float gamma) { stbi__h2l_gamma_i = ...
function STBIDEF (line 1582) | STBIDEF void stbi_hdr_to_ldr_scale(float scale) { stbi__h2l_scale_i = ...
function stbi__refill_buffer (line 1597) | static void stbi__refill_buffer(stbi__context *s)
function stbi_inline (line 1614) | stbi_inline static stbi_uc stbi__get8(stbi__context *s)
function stbi_inline (line 1628) | stbi_inline static int stbi__at_eof(stbi__context *s)
function stbi__skip (line 1644) | static void stbi__skip(stbi__context *s, int n)
function stbi__getn (line 1666) | static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n)
function stbi__get16be (line 1694) | static int stbi__get16be(stbi__context *s)
function stbi__uint32 (line 1704) | static stbi__uint32 stbi__get32be(stbi__context *s)
function stbi__get16le (line 1714) | static int stbi__get16le(stbi__context *s)
function stbi__uint32 (line 1722) | static stbi__uint32 stbi__get32le(stbi__context *s)
function stbi_uc (line 1746) | static stbi_uc stbi__compute_y(int r, int g, int b)
function stbi__uint16 (line 1803) | static stbi__uint16 stbi__compute_y_16(int r, int g, int b)
function stbi__uint16 (line 1812) | static stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_...
function stbi_uc (line 1884) | static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp)
type stbi__huffman (line 1938) | typedef struct
type stbi__jpeg (line 1949) | typedef struct
function stbi__build_huffman (line 2003) | static int stbi__build_huffman(stbi__huffman *h, int *count)
function stbi__build_fast_ac (line 2050) | static void stbi__build_fast_ac(stbi__int16 *fast_ac, stbi__huffman *h)
function stbi__grow_buffer_unsafe (line 2075) | static void stbi__grow_buffer_unsafe(stbi__jpeg *j)
function stbi_inline (line 2097) | stbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffm...
function stbi_inline (line 2153) | stbi_inline static int stbi__extend_receive(stbi__jpeg *j, int n)
function stbi_inline (line 2169) | stbi_inline static int stbi__jpeg_get_bits(stbi__jpeg *j, int n)
function stbi_inline (line 2181) | stbi_inline static int stbi__jpeg_get_bit(stbi__jpeg *j)
function stbi__jpeg_decode_block (line 2210) | static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__...
function stbi__jpeg_decode_block_prog_dc (line 2265) | static int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64]...
function stbi__jpeg_decode_block_prog_ac (line 2295) | static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64]...
function stbi_inline (line 2416) | stbi_inline static stbi_uc stbi__clamp(int x)
function stbi__idct_block (line 2467) | static void stbi__idct_block(stbi_uc *out, int out_stride, short data[64])
function stbi__idct_simd (line 2530) | static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
function stbi__idct_simd (line 2711) | static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
function stbi_uc (line 2919) | static stbi_uc stbi__get_marker(stbi__jpeg *j)
function stbi__jpeg_reset (line 2936) | static void stbi__jpeg_reset(stbi__jpeg *j)
function stbi__parse_entropy_coded_data (line 2949) | static int stbi__parse_entropy_coded_data(stbi__jpeg *z)
function stbi__jpeg_dequantize (line 3073) | static void stbi__jpeg_dequantize(short *data, stbi__uint16 *dequant)
function stbi__jpeg_finish (line 3080) | static void stbi__jpeg_finish(stbi__jpeg *z)
function stbi__process_marker (line 3099) | static int stbi__process_marker(stbi__jpeg *z, int m)
function stbi__process_scan_header (line 3203) | static int stbi__process_scan_header(stbi__jpeg *z)
function stbi__free_jpeg_components (line 3242) | static int stbi__free_jpeg_components(stbi__jpeg *z, int ncomp, int why)
function stbi__process_frame_header (line 3264) | static int stbi__process_frame_header(stbi__jpeg *z, int scan)
function stbi__decode_jpeg_header (line 3365) | static int stbi__decode_jpeg_header(stbi__jpeg *z, int scan)
function stbi_uc (line 3389) | static stbi_uc stbi__skip_jpeg_junk_at_end(stbi__jpeg *j)
function stbi__decode_jpeg_image (line 3412) | static int stbi__decode_jpeg_image(stbi__jpeg *j)
type stbi_uc (line 3451) | typedef stbi_uc *(*resample_row_func)(stbi_uc *out, stbi_uc *in0, stbi_u...
function stbi_uc (line 3456) | static stbi_uc *resample_row_1(stbi_uc *out, stbi_uc *in_near, stbi_uc *...
function stbi_uc (line 3465) | static stbi_uc* stbi__resample_row_v_2(stbi_uc *out, stbi_uc *in_near, s...
function stbi_uc (line 3475) | static stbi_uc* stbi__resample_row_h_2(stbi_uc *out, stbi_uc *in_near, ...
function stbi_uc (line 3505) | static stbi_uc *stbi__resample_row_hv_2(stbi_uc *out, stbi_uc *in_near, ...
function stbi_uc (line 3530) | static stbi_uc *stbi__resample_row_hv_2_simd(stbi_uc *out, stbi_uc *in_n...
function stbi_uc (line 3646) | static stbi_uc *stbi__resample_row_generic(stbi_uc *out, stbi_uc *in_nea...
function stbi__YCbCr_to_RGB_row (line 3660) | static void stbi__YCbCr_to_RGB_row(stbi_uc *out, const stbi_uc *y, const...
function stbi__YCbCr_to_RGB_simd (line 3686) | static void stbi__YCbCr_to_RGB_simd(stbi_uc *out, stbi_uc const *y, stbi...
function stbi__setup_jpeg (line 3821) | static void stbi__setup_jpeg(stbi__jpeg *j)
function stbi__cleanup_jpeg (line 3843) | static void stbi__cleanup_jpeg(stbi__jpeg *j)
type stbi__resample (line 3848) | typedef struct
function stbi_uc (line 3859) | static stbi_uc stbi__blinn_8x8(stbi_uc x, stbi_uc y)
function stbi_uc (line 3865) | static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, i...
function stbi__jpeg_test (line 4042) | static int stbi__jpeg_test(stbi__context *s)
function stbi__jpeg_info_raw (line 4056) | static int stbi__jpeg_info_raw(stbi__jpeg *j, int *x, int *y, int *comp)
function stbi__jpeg_info (line 4068) | static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp)
type stbi__zhuffman (line 4097) | typedef struct
function stbi_inline (line 4107) | stbi_inline static int stbi__bitreverse16(int n)
function stbi_inline (line 4116) | stbi_inline static int stbi__bit_reverse(int v, int bits)
function stbi__zbuild_huffman (line 4124) | static int stbi__zbuild_huffman(stbi__zhuffman *z, const stbi_uc *sizeli...
type stbi__zbuf (line 4177) | typedef struct
function stbi_inline (line 4192) | stbi_inline static int stbi__zeof(stbi__zbuf *z)
function stbi_inline (line 4197) | stbi_inline static stbi_uc stbi__zget8(stbi__zbuf *z)
function stbi__fill_bits (line 4202) | static void stbi__fill_bits(stbi__zbuf *z)
function stbi__zreceive (line 4214) | int stbi__zreceive(stbi__zbuf *z, int n)
function stbi__zhuffman_decode_slowpath (line 4224) | static int stbi__zhuffman_decode_slowpath(stbi__zbuf *a, stbi__zhuffman *z)
function stbi_inline (line 4243) | stbi_inline static int stbi__zhuffman_decode(stbi__zbuf *a, stbi__zhuffm...
function stbi__zexpand (line 4273) | static int stbi__zexpand(stbi__zbuf *z, char *zout, int n) // need to m...
function stbi__parse_huffman_block (line 4309) | static int stbi__parse_huffman_block(stbi__zbuf *a)
function stbi__compute_huffman_codes (line 4359) | static int stbi__compute_huffman_codes(stbi__zbuf *a)
function stbi__parse_uncompressed_block (line 4409) | static int stbi__parse_uncompressed_block(stbi__zbuf *a)
function stbi__parse_zlib_header (line 4438) | static int stbi__parse_zlib_header(stbi__zbuf *a)
function stbi__parse_zlib (line 4481) | static int stbi__parse_zlib(stbi__zbuf *a, int parse_header)
function stbi__do_zlib (line 4510) | static int stbi__do_zlib(stbi__zbuf *a, char *obuf, int olen, int exp, i...
function STBIDEF (line 4520) | STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int ...
function STBIDEF (line 4536) | STBIDEF char *stbi_zlib_decode_malloc(char const *buffer, int len, int *...
function STBIDEF (line 4541) | STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *b...
function STBIDEF (line 4557) | STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, char const ...
function STBIDEF (line 4568) | STBIDEF char *stbi_zlib_decode_noheader_malloc(char const *buffer, int l...
function STBIDEF (line 4584) | STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, co...
type stbi__pngchunk (line 4607) | typedef struct
function stbi__pngchunk (line 4613) | static stbi__pngchunk stbi__get_chunk_header(stbi__context *s)
function stbi__check_png_header (line 4621) | static int stbi__check_png_header(stbi__context *s)
type stbi__png (line 4630) | typedef struct
function stbi__paeth (line 4657) | static int stbi__paeth(int a, int b, int c)
function stbi__create_png_alpha_expand8 (line 4675) | static void stbi__create_png_alpha_expand8(stbi_uc *dest, stbi_uc *src, ...
function stbi__create_png_image_raw (line 4696) | static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__...
function stbi__create_png_image (line 4861) | static int stbi__create_png_image(stbi__png *a, stbi_uc *image_data, stb...
function stbi__compute_transparency (line 4906) | static int stbi__compute_transparency(stbi__png *z, stbi_uc tc[3], int o...
function stbi__compute_transparency16 (line 4931) | static int stbi__compute_transparency16(stbi__png *z, stbi__uint16 tc[3]...
function stbi__expand_png_palette (line 4956) | static int stbi__expand_png_palette(stbi__png *a, stbi_uc *palette, int ...
function STBIDEF (line 4996) | STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpr...
function STBIDEF (line 5001) | STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_conv...
function STBIDEF (line 5013) | STBIDEF void stbi_set_unpremultiply_on_load_thread(int flag_true_if_shou...
function STBIDEF (line 5019) | STBIDEF void stbi_convert_iphone_png_to_rgb_thread(int flag_true_if_shou...
function stbi__de_iphone (line 5033) | static void stbi__de_iphone(stbi__png *z)
function stbi__parse_png_file (line 5078) | static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)
function stbi__png_test (line 5302) | static int stbi__png_test(stbi__context *s)
function stbi__png_info_raw (line 5310) | static int stbi__png_info_raw(stbi__png *p, int *x, int *y, int *comp)
function stbi__png_info (line 5322) | static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp)
function stbi__png_is16 (line 5329) | static int stbi__png_is16(stbi__context *s)
function stbi__bmp_test_raw (line 5346) | static int stbi__bmp_test_raw(stbi__context *s)
function stbi__bmp_test (line 5361) | static int stbi__bmp_test(stbi__context *s)
function stbi__high_bit (line 5370) | static int stbi__high_bit(unsigned int z)
function stbi__bitcount (line 5382) | static int stbi__bitcount(unsigned int a)
function stbi__shiftsigned (line 5395) | static int stbi__shiftsigned(unsigned int v, int shift, int bits)
type stbi__bmp_data (line 5415) | typedef struct
function stbi__bmp_set_mask_defaults (line 5422) | static int stbi__bmp_set_mask_defaults(stbi__bmp_data *info, int compress)
function stbi__tga_get_comp (line 5739) | static int stbi__tga_get_comp(int bits_per_pixel, int is_grey, int* is_r...
function stbi__tga_info (line 5755) | static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp)
function stbi__tga_test (line 5820) | static int stbi__tga_test(stbi__context *s)
function stbi__tga_read_rgb16 (line 5852) | static void stbi__tga_read_rgb16(stbi__context *s, stbi_uc* out)
function stbi__psd_test (line 6081) | static int stbi__psd_test(stbi__context *s)
function stbi__psd_decode_rle (line 6088) | static int stbi__psd_decode_rle(stbi__context *s, stbi_uc *p, int pixelC...
function stbi__pic_is4 (line 6336) | static int stbi__pic_is4(stbi__context *s,const char *str)
function stbi__pic_test_core (line 6346) | static int stbi__pic_test_core(stbi__context *s)
type stbi__pic_packet (line 6362) | typedef struct
function stbi_uc (line 6367) | static stbi_uc *stbi__readval(stbi__context *s, int channel, stbi_uc *dest)
function stbi__copyval (line 6381) | static void stbi__copyval(int channel,stbi_uc *dest,const stbi_uc *src)
function stbi_uc (line 6390) | static stbi_uc *stbi__pic_load_core(stbi__context *s,int width,int heigh...
function stbi__pic_test (line 6541) | static int stbi__pic_test(stbi__context *s)
type stbi__gif_lzw (line 6553) | typedef struct
type stbi__gif (line 6560) | typedef struct
function stbi__gif_test_raw (line 6580) | static int stbi__gif_test_raw(stbi__context *s)
function stbi__gif_test (line 6590) | static int stbi__gif_test(stbi__context *s)
function stbi__gif_parse_colortable (line 6597) | static void stbi__gif_parse_colortable(stbi__context *s, stbi_uc pal[256...
function stbi__gif_header (line 6608) | static int stbi__gif_header(stbi__context *s, stbi__gif *g, int *comp, i...
function stbi__gif_info_raw (line 6639) | static int stbi__gif_info_raw(stbi__context *s, int *x, int *y, int *comp)
function stbi__out_gif_code (line 6654) | static void stbi__out_gif_code(stbi__gif *g, stbi__uint16 code)
function stbi_uc (line 6691) | static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g)
function stbi_uc (line 6778) | static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int ...
function stbi__gif_info (line 7077) | static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp)
function stbi__hdr_test_core (line 7087) | static int stbi__hdr_test_core(stbi__context *s, const char *signature)
function stbi__hdr_test (line 7097) | static int stbi__hdr_test(stbi__context* s)
function stbi__hdr_convert (line 7131) | static void stbi__hdr_convert(float *output, stbi_uc *input, int req_comp)
function stbi__hdr_info (line 7289) | static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp)
function stbi__bmp_info (line 7335) | static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp)
function stbi__psd_info (line 7359) | static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp)
function stbi__psd_is16 (line 7394) | static int stbi__psd_is16(stbi__context *s)
function stbi__pic_info (line 7423) | static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp)
function stbi__pnm_test (line 7494) | static int stbi__pnm_test(stbi__context *s)
function stbi__pnm_isspace (line 7543) | static int stbi__pnm_isspace(char c)
function stbi__pnm_skip_whitespace (line 7548) | static void stbi__pnm_skip_whitespace(stbi__context *s, char *c)
function stbi__pnm_isdigit (line 7562) | static int stbi__pnm_isdigit(char c)
function stbi__pnm_getinteger (line 7567) | static int stbi__pnm_getinteger(stbi__context *s, char *c)
function stbi__pnm_info (line 7581) | static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp)
function stbi__pnm_is16 (line 7624) | static int stbi__pnm_is16(stbi__context *s)
function stbi__info_main (line 7632) | static int stbi__info_main(stbi__context *s, int *x, int *y, int *comp)
function stbi__is_16_main (line 7674) | static int stbi__is_16_main(stbi__context *s)
function STBIDEF (line 7691) | STBIDEF int stbi_info(char const *filename, int *x, int *y, int *comp)
function STBIDEF (line 7701) | STBIDEF int stbi_info_from_file(FILE *f, int *x, int *y, int *comp)
function STBIDEF (line 7712) | STBIDEF int stbi_is_16_bit(char const *filename)
function STBIDEF (line 7722) | STBIDEF int stbi_is_16_bit_from_file(FILE *f)
function STBIDEF (line 7734) | STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x...
function STBIDEF (line 7741) | STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *u...
function STBIDEF (line 7748) | STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len)
function STBIDEF (line 7755) | STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *c, vo...
FILE: packages/nx/vendor/stb_image_write/ml_stb_image_write.c
function validate_dim (line 11) | static int validate_dim(value ba, value w, value h, value comp, int byte)
function CAMLprim (line 18) | CAMLprim value ml_stbi_write_png(value filename, value w, value h, value...
function CAMLprim (line 32) | CAMLprim value ml_stbi_write_bmp(value filename, value w, value h, value...
function CAMLprim (line 46) | CAMLprim value ml_stbi_write_tga(value filename, value w, value h, value...
function CAMLprim (line 60) | CAMLprim value ml_stbi_write_hdr(value filename, value w, value h, value...
function CAMLprim (line 74) | CAMLprim value ml_stbi_write_jpg_native(value filename, value w, value h...
function CAMLprim (line 89) | CAMLprim value ml_stbi_write_jpg_bytecode(value * argv, int nargs)
FILE: packages/nx/vendor/stb_image_write/stb_image_write.h
function STBIWDEF (line 262) | STBIWDEF void stbi_flip_vertically_on_write(int flag)
type stbi__write_context (line 267) | typedef struct
function stbi__start_write_callbacks (line 276) | static void stbi__start_write_callbacks(stbi__write_context *s, stbi_wri...
function stbi__stdio_write (line 284) | static void stbi__stdio_write(void *context, void *data, int size)
function STBIWDEF (line 298) | STBIWDEF int stbiw_convert_wchar_to_utf8(char *buffer, size_t bufferlen,...
function FILE (line 304) | static FILE *stbiw__fopen(char const *filename, char const *mode)
function stbi__start_write_file (line 332) | static int stbi__start_write_file(stbi__write_context *s, const char *fi...
function stbi__end_write_file (line 339) | static void stbi__end_write_file(stbi__write_context *s)
type stbiw_uint32 (line 346) | typedef unsigned int stbiw_uint32;
function stbiw__writefv (line 349) | static void stbiw__writefv(stbi__write_context *s, const char *fmt, va_l...
function stbiw__writef (line 378) | static void stbiw__writef(stbi__write_context *s, const char *fmt, ...)
function stbiw__write_flush (line 386) | static void stbiw__write_flush(stbi__write_context *s)
function stbiw__putc (line 394) | static void stbiw__putc(stbi__write_context *s, unsigned char c)
function stbiw__write1 (line 399) | static void stbiw__write1(stbi__write_context *s, unsigned char a)
function stbiw__write3 (line 406) | static void stbiw__write3(stbi__write_context *s, unsigned char a, unsig...
function stbiw__write_pixel (line 418) | static void stbiw__write_pixel(stbi__write_context *s, int rgb_dir, int ...
function stbiw__write_pixels (line 451) | static void stbiw__write_pixels(stbi__write_context *s, int rgb_dir, int...
function stbiw__outfile (line 478) | static int stbiw__outfile(stbi__write_context *s, int rgb_dir, int vdir,...
function stbi_write_bmp_core (line 492) | static int stbi_write_bmp_core(stbi__write_context *s, int x, int y, int...
function STBIWDEF (line 512) | STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context...
function STBIWDEF (line 520) | STBIWDEF int stbi_write_bmp(char const *filename, int x, int y, int comp...
function stbi_write_tga_core (line 532) | static int stbi_write_tga_core(stbi__write_context *s, int x, int y, int...
function STBIWDEF (line 611) | STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context...
function STBIWDEF (line 619) | STBIWDEF int stbi_write_tga(char const *filename, int x, int y, int comp...
function stbiw__linear_to_rgbe (line 639) | static void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear)
function stbiw__write_run_data (line 656) | static void stbiw__write_run_data(stbi__write_context *s, int length, un...
function stbiw__write_dump_data (line 664) | static void stbiw__write_dump_data(stbi__write_context *s, int length, u...
function stbiw__write_hdr_scanline (line 672) | static void stbiw__write_hdr_scanline(stbi__write_context *s, int width,...
function stbi_write_hdr_core (line 761) | static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int...
function STBIWDEF (line 787) | STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context...
function STBIWDEF (line 794) | STBIWDEF int stbi_write_hdr(char const *filename, int x, int y, int comp...
function stbiw__zlib_bitrev (line 849) | static int stbiw__zlib_bitrev(int code, int codebits)
function stbiw__zlib_countm (line 859) | static unsigned int stbiw__zlib_countm(unsigned char *a, unsigned char *...
function stbiw__zhash (line 867) | static unsigned int stbiw__zhash(unsigned char *data)
function stbiw__crc32 (line 1024) | static unsigned int stbiw__crc32(unsigned char *buffer, int len)
function stbiw__wpcrc (line 1077) | static void stbiw__wpcrc(unsigned char **data, int len)
function stbiw__paeth (line 1083) | static unsigned char stbiw__paeth(int a, int b, int c)
function stbiw__encode_png_line (line 1092) | static void stbiw__encode_png_line(unsigned char *pixels, int stride_byt...
function STBIWDEF (line 1215) | STBIWDEF int stbi_write_png(char const *filename, int x, int y, int comp...
function STBIWDEF (line 1231) | STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context...
function stbiw__jpg_writeBits (line 1253) | static void stbiw__jpg_writeBits(stbi__write_context *s, int *bitBufP, i...
function stbiw__jpg_DCT (line 1270) | static void stbiw__jpg_DCT(float *d0p, float *d1p, float *d2p, float *d3...
function stbiw__jpg_calcBits (line 1318) | static void stbiw__jpg_calcBits(int val, unsigned short bits[2]) {
function stbiw__jpg_processDU (line 1328) | static int stbiw__jpg_processDU(stbi__write_context *s, int *bitBuf, int...
function stbi_write_jpg_core (line 1398) | static int stbi_write_jpg_core(stbi__write_context *s, int width, int he...
function STBIWDEF (line 1607) | STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context...
function STBIWDEF (line 1616) | STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp...
FILE: packages/quill/lib/quill-server/frontend/dist/app.js
method constructor (line 1) | constructor(){this.cells=[],this.focusedCellId=null,this.kernelStatus="c...
method on (line 1) | on(e,t){this._listeners.has(e)||this._listeners.set(e,[]),this._listener...
method off (line 1) | off(e,t){let r=this._listeners.get(e);if(r){let n=r.indexOf(t);n!==-1&&r...
method emit (line 1) | emit(e,t){let r=this._listeners.get(e);r&&r.forEach(n=>n(t))}
method loadNotebook (line 1) | loadNotebook(e){if(this.cells=e.cells,this.canUndo=e.can_undo,this.canRe...
method findCell (line 1) | findCell(e){return this.cells.find(t=>t.id===e)}
method findCellIndex (line 1) | findCellIndex(e){return this.cells.findIndex(t=>t.id===e)}
method setCellStatus (line 1) | setCellStatus(e,t){let r=this.findCell(e);r&&(r.status=t,this.emit("cell...
method finishExecution (line 1) | finishExecution(e,t){let r=this.findCell(e);r&&(r.lastRunSuccess=t,r.sta...
method appendOutput (line 1) | appendOutput(e,t){let r=this.findCell(e);r&&(r.outputs||(r.outputs=[]),r...
method clearOutputs (line 1) | clearOutputs(e){let t=this.findCell(e);t&&t.outputs&&(t.outputs=[],this....
method updateCell (line 1) | updateCell(e,t){let r=this.findCellIndex(e);if(r!==-1){let n=this.cells[...
method insertCell (line 1) | insertCell(e,t){this.cells.splice(e,0,t),this.emit("cell:inserted",{pos:...
method deleteCell (line 1) | deleteCell(e){let t=this.findCellIndex(e);if(t!==-1&&(this.cells.splice(...
method moveCell (line 1) | moveCell(e,t){let r=this.findCellIndex(e);if(r!==-1){let[n]=this.cells.s...
method setUndoRedo (line 1) | setUndoRedo(e,t){this.canUndo=e,this.canRedo=t,this.emit("undo-redo:chan...
method setConnectionStatus (line 1) | setConnectionStatus(e){this.kernelStatus=e,this.emit("connection:changed...
method setFocus (line 1) | setFocus(e){let t=this.focusedCellId;this.focusedCellId=e,this.emit("foc...
method clearFocus (line 1) | clearFocus(){if(this.focusedCellId){let e=this.focusedCellId;this.focuse...
method focusNext (line 1) | focusNext(){let e=this.findCellIndex(this.focusedCellId);e<this.cells.le...
method focusPrev (line 1) | focusPrev(){let e=this.findCellIndex(this.focusedCellId);e>0&&this.setFo...
method constructor (line 1) | constructor(e){this.store=e,this.ws=null,this.reconnectDelay=1e3,this._p...
method connect (line 1) | connect(){let t=`${location.protocol==="https:"?"wss:":"ws:"}//${locatio...
method reconnect (line 1) | reconnect(){this.reconnectDelay=Math.min(this.reconnectDelay*2,3e4),this...
method send (line 1) | send(e){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON....
method _onMessage (line 1) | _onMessage(e){switch(e.type){case"notebook":this.store.loadNotebook(e);b...
method updateSource (line 1) | updateSource(e,t){let r=this._sourceDebounceTimers.get(e);r&&clearTimeou...
method cancelPendingSource (line 1) | cancelPendingSource(e){let t=this._sourceDebounceTimers.get(e);t&&(clear...
method checkpoint (line 1) | checkpoint(){this.send({type:"checkpoint"})}
method executeCell (line 1) | executeCell(e){this.cancelPendingSource(e);let t=this.store.findCell(e);...
method executeCells (line 1) | executeCells(e){for(let t of e){this.cancelPendingSource(t);let r=this.s...
method executeAll (line 1) | executeAll(){for(let[e,t]of this._sourceDebounceTimers){clearTimeout(t);...
method interrupt (line 1) | interrupt(){this.send({type:"interrupt"})}
method insertCell (line 1) | insertCell(e,t){this.send({type:"insert_cell",pos:e,kind:t})}
method deleteCell (line 1) | deleteCell(e){this.send({type:"delete_cell",cell_id:e})}
method moveCell (line 1) | moveCell(e,t){this.send({type:"move_cell",cell_id:e,pos:t})}
method setCellKind (line 1) | setCellKind(e,t){this.send({type:"set_cell_kind",cell_id:e,kind:t})}
method setCellAttrs (line 1) | setCellAttrs(e,t){this.send({type:"set_cell_attrs",cell_id:e,...t})}
method clearOutputs (line 1) | clearOutputs(e){this.send({type:"clear_outputs",cell_id:e})}
method clearAllOutputs (line 1) | clearAllOutputs(){this.send({type:"clear_all_outputs"})}
method save (line 1) | save(){this.send({type:"save"})}
method undo (line 1) | undo(){this.send({type:"undo"})}
method redo (line 1) | redo(){this.send({type:"redo"})}
method complete (line 1) | complete(e,t){let r=`req_${++this._requestCounter}`;return new Promise(n...
method typeAt (line 1) | typeAt(e,t){let r=`req_${++this._requestCounter}`;return new Promise(n=>...
method diagnostics (line 1) | diagnostics(e){let t=`req_${++this._requestCounter}`;return new Promise(...
function wp (line 1) | function wp(i){if(i<768)return!1;for(let e=0,t=rl.length;;){let r=e+t>>1...
function zh (line 1) | function zh(i){return i>=127462&&i<=127487}
function Ph (line 1) | function Ph(i,e,t=!0,r=!0){return(t?Nh:kp)(i,e,r)}
function Nh (line 1) | function Nh(i,e,t){if(e==i.length)return e;e&&Fh(i.charCodeAt(e))&&Hh(i....
function kp (line 1) | function kp(i,e,t){for(;e>0;){let r=Nh(i,e-2,t);if(r<e)return r;e--}retu...
function tl (line 1) | function tl(i,e){let t=i.charCodeAt(e);if(!Hh(t)||e+1==i.length)return t...
function Fh (line 1) | function Fh(i){return i>=56320&&i<57344}
function Hh (line 1) | function Hh(i){return i>=55296&&i<56320}
function Ih (line 1) | function Ih(i){return i<65536?1:2}
method lineAt (line 1) | lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position $...
method line (line 1) | line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number $...
method replace (line 1) | replace(e,t,r){[e,t]=hi(this,e,t);let n=[];return this.decompose(0,e,n,2...
method append (line 1) | append(e){return this.replace(this.length,this.length,e)}
method slice (line 1) | slice(e,t=this.length){[e,t]=hi(this,e,t);let r=[];return this.decompose...
method eq (line 1) | eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)...
method iter (line 1) | iter(e=1){return new Nr(this,e)}
method iterRange (line 1) | iterRange(e,t=this.length){return new Kn(this,e,t)}
method iterLines (line 1) | iterLines(e,t){let r;if(e==null)r=this.iter();else{t==null&&(t=this.line...
method toString (line 1) | toString(){return this.sliceString(0)}
method toJSON (line 1) | toJSON(){let e=[];return this.flatten(e),e}
method constructor (line 1) | constructor(){}
method of (line 1) | static of(e){if(e.length==0)throw new RangeError("A document must have a...
method constructor (line 1) | constructor(e,t=Sp(e)){super(),this.text=e,this.length=t}
method lines (line 1) | get lines(){return this.text.length}
method children (line 1) | get children(){return null}
method lineInner (line 1) | lineInner(e,t,r,n){for(let s=0;;s++){let o=this.text[s],l=n+o.length;if(...
method decompose (line 1) | decompose(e,t,r,n){let s=e<=0&&t>=this.length?this:new i(qh(this.text,e,...
method replace (line 1) | replace(e,t,r){if(!(r instanceof i))return super.replace(e,t,r);[e,t]=hi...
method sliceString (line 1) | sliceString(e,t=this.length,r=`
method flatten (line 2) | flatten(e){for(let t of this.text)e.push(t)}
method scanIdentical (line 2) | scanIdentical(){return 0}
method split (line 2) | static split(e,t){let r=[],n=-1;for(let s of e)r.push(s),n+=s.length+1,r...
method constructor (line 2) | constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(...
method lineInner (line 2) | lineInner(e,t,r,n){for(let s=0;;s++){let o=this.children[s],l=n+o.length...
method decompose (line 2) | decompose(e,t,r,n){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let...
method replace (line 2) | replace(e,t,r){if([e,t]=hi(this,e,t),r.lines<this.lines)for(let n=0,s=0;...
method sliceString (line 2) | sliceString(e,t=this.length,r=`
method flatten (line 3) | flatten(e){for(let t of this.children)t.flatten(e)}
method scanIdentical (line 3) | scanIdentical(e,t){if(!(e instanceof i))return 0;let r=0,[n,s,o,l]=t>0?[...
method from (line 3) | static from(e,t=e.reduce((r,n)=>r+n.length+1,-1)){let r=0;for(let p of e...
function Sp (line 3) | function Sp(i){let e=-1;for(let t of i)e+=t.length+1;return e}
function Un (line 3) | function Un(i,e,t=0,r=1e9){for(let n=0,s=0,o=!0;s<i.length&&n<=r;s++){le...
function qh (line 3) | function qh(i,e,t){return Un(i,[""],e,t)}
method constructor (line 3) | constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value=...
method nextInner (line 3) | nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.lengt...
method next (line 4) | next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length)...
method constructor (line 4) | constructor(e,t,r){this.value="",this.done=!1,this.cursor=new Nr(e,t>r?-...
method nextInner (line 4) | nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this....
method next (line 4) | next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e...
method lineBreak (line 4) | get lineBreak(){return this.cursor.lineBreak&&this.value!=""}
method constructor (line 4) | constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}
method next (line 4) | next(e=0){let{done:t,lineBreak:r,value:n}=this.inner.next(e);return t&&t...
method lineBreak (line 4) | get lineBreak(){return!1}
method constructor (line 4) | constructor(e,t,r,n){this.from=e,this.to=t,this.number=r,this.text=n}
method length (line 4) | get length(){return this.to-this.from}
function hi (line 4) | function hi(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max...
function Ie (line 4) | function Ie(i,e,t=!0,r=!0){return Ph(i,e,t,r)}
function Cp (line 4) | function Cp(i){return i>=56320&&i<57344}
function Ap (line 4) | function Ap(i){return i>=55296&&i<56320}
function Xe (line 4) | function Xe(i,e){let t=i.charCodeAt(e);if(!Ap(t)||e+1==i.length)return t...
function qi (line 4) | function qi(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.f...
function vt (line 4) | function vt(i){return i<65536?1:2}
method constructor (line 4) | constructor(e){this.sections=e}
method length (line 4) | get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sec...
method newLength (line 4) | get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let r=t...
method empty (line 4) | get empty(){return this.sections.length==0||this.sections.length==2&&thi...
method iterGaps (line 4) | iterGaps(e){for(let t=0,r=0,n=0;t<this.sections.length;){let s=this.sect...
method iterChangedRanges (line 4) | iterChangedRanges(e,t=!1){ol(this,e,t)}
method invertedDesc (line 4) | get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=t...
method composeDesc (line 4) | composeDesc(e){return this.empty?e:e.empty?this:Uh(this,e)}
method mapDesc (line 4) | mapDesc(e,t=!1){return e.empty?this:ll(this,e,t)}
method mapPos (line 4) | mapPos(e,t=-1,r=We.Simple){let n=0,s=0;for(let o=0;o<this.sections.lengt...
method touchesRange (line 4) | touchesRange(e,t=e){for(let r=0,n=0;r<this.sections.length&&n<=t;){let s...
method toString (line 4) | toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sect...
method toJSON (line 4) | toJSON(){return this.sections}
method fromJSON (line 4) | static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!...
method create (line 4) | static create(e){return new i(e)}
method constructor (line 4) | constructor(e,t){super(e),this.inserted=t}
method apply (line 4) | apply(e){if(this.length!=e.length)throw new RangeError("Applying change ...
method mapDesc (line 4) | mapDesc(e,t=!1){return ll(this,e,t,!0)}
method invert (line 4) | invert(e){let t=this.sections.slice(),r=[];for(let n=0,s=0;n<t.length;n+...
method compose (line 4) | compose(e){return this.empty?e:e.empty?this:Uh(this,e,!0)}
method map (line 4) | map(e,t=!1){return e.empty?this:ll(this,e,t,!0)}
method iterChanges (line 4) | iterChanges(e,t=!1){ol(this,e,t)}
method desc (line 4) | get desc(){return nr.create(this.sections)}
method filter (line 4) | filter(e){let t=[],r=[],n=[],s=new Fr(this);e:for(let o=0,l=0;;){let a=o...
method toJSON (line 4) | toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let r=this.se...
method of (line 4) | static of(e,t,r){let n=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!n.len...
method empty (line 4) | static empty(e){return new i(e?[e,-1]:[],[])}
method fromJSON (line 4) | static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JS...
method createSet (line 4) | static createSet(e,t){return new i(e,t)}
function $e (line 4) | function $e(i,e,t,r=!1){if(e==0&&t<=0)return;let n=i.length-2;n>=0&&t<=0...
function gr (line 4) | function gr(i,e,t){if(t.length==0)return;let r=e.length-2>>1;if(r<i.leng...
function ol (line 4) | function ol(i,e,t){let r=i.inserted;for(let n=0,s=0,o=0;o<i.sections.len...
function ll (line 4) | function ll(i,e,t,r=!1){let n=[],s=r?[]:null,o=new Fr(i),l=new Fr(e);for...
function Uh (line 4) | function Uh(i,e,t=!1){let r=[],n=t?[]:null,s=new Fr(i),o=new Fr(e);for(l...
method constructor (line 4) | constructor(e){this.set=e,this.i=0,this.next()}
method next (line 4) | next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],th...
method done (line 4) | get done(){return this.ins==-2}
method len2 (line 4) | get len2(){return this.ins<0?this.len:this.ins}
method text (line 4) | get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?se....
method textBit (line 4) | textBit(e){let{inserted:t}=this.set,r=this.i-2>>1;return r>=t.length&&!e...
method forward (line 4) | forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}
method forward2 (line 4) | forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.i...
method constructor (line 4) | constructor(e,t,r){this.from=e,this.to=t,this.flags=r}
method anchor (line 4) | get anchor(){return this.flags&32?this.to:this.from}
method head (line 4) | get head(){return this.flags&32?this.from:this.to}
method empty (line 4) | get empty(){return this.from==this.to}
method assoc (line 4) | get assoc(){return this.flags&8?-1:this.flags&16?1:0}
method bidiLevel (line 4) | get bidiLevel(){let e=this.flags&7;return e==7?null:e}
method goalColumn (line 4) | get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}
method map (line 4) | map(e,t=-1){let r,n;return this.empty?r=n=e.mapPos(this.from,t):(r=e.map...
method extend (line 4) | extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return R.range(e,t);let ...
method eq (line 4) | eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalCol...
method toJSON (line 4) | toJSON(){return{anchor:this.anchor,head:this.head}}
method fromJSON (line 4) | static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="num...
method create (line 4) | static create(e,t,r){return new i(e,t,r)}
method constructor (line 4) | constructor(e,t){this.ranges=e,this.mainIndex=t}
method map (line 4) | map(e,t=-1){return e.empty?this:i.create(this.ranges.map(r=>r.map(e,t)),...
method eq (line 4) | eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mai...
method main (line 4) | get main(){return this.ranges[this.mainIndex]}
method asSingle (line 4) | asSingle(){return this.ranges.length==1?this:new i([this.main],0)}
method addRange (line 4) | addRange(e,t=!0){return i.create([e].concat(this.ranges),t?0:this.mainIn...
method replaceRange (line 4) | replaceRange(e,t=this.mainIndex){let r=this.ranges.slice();return r[t]=e...
method toJSON (line 4) | toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}
method fromJSON (line 4) | static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="numb...
method single (line 4) | static single(e,t=e){return new i([i.range(e,t)],0)}
method create (line 4) | static create(e,t=0){if(e.length==0)throw new RangeError("A selection ne...
method cursor (line 4) | static cursor(e,t=0,r,n){return si.create(e,e,(t==0?0:t<0?8:16)|(r==null...
method range (line 4) | static range(e,t,r,n){let s=(r??16777215)<<6|(n==null?7:Math.min(6,n));r...
method normalized (line 4) | static normalized(e,t=0){let r=e[t];e.sort((n,s)=>n.from-s.from),t=e.ind...
function Kh (line 4) | function Kh(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("S...
method constructor (line 4) | constructor(e,t,r,n,s){this.combine=e,this.compareInput=t,this.compare=r...
method reader (line 4) | get reader(){return this}
method define (line 4) | static define(e={}){return new i(e.combine||(t=>t),e.compareInput||((t,r...
method of (line 4) | of(e){return new li([],this,0,e)}
method compute (line 4) | compute(e,t){if(this.isStatic)throw new Error("Can't compute a static fa...
method computeN (line 4) | computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static f...
method from (line 4) | from(e,t){return t||(t=r=>r),this.compute([e],r=>t(r.field(e)))}
function bl (line 4) | function bl(i,e){return i==e||i.length==e.length&&i.every((t,r)=>t===e[r])}
method constructor (line 4) | constructor(e,t,r,n){this.dependencies=e,this.facet=t,this.type=r,this.v...
method dynamicSlot (line 4) | dynamicSlot(e){var t;let r=this.value,n=this.facet.compareInput,s=this.i...
function Wh (line 4) | function Wh(i,e,t){if(i.length!=e.length)return!1;for(let r=0;r<i.length...
function al (line 4) | function al(i,e){let t=!1;for(let r of e)Pi(i,r)&1&&(t=!0);return t}
function Mp (line 4) | function Mp(i,e,t){let r=t.map(a=>i[a.id]),n=t.map(a=>a.type),s=r.filter...
method constructor (line 4) | constructor(e,t,r,n,s){this.id=e,this.createF=t,this.updateF=r,this.comp...
method define (line 4) | static define(e){let t=new i(vl++,e.create,e.update,e.compare||((r,n)=>r...
method create (line 4) | create(e){let t=e.facet(Vn).find(r=>r.field==this);return(t?.create||thi...
method slot (line 4) | slot(e){let t=e[this.id]>>1;return{create:r=>(r.values[t]=this.create(r)...
method init (line 4) | init(e){return[this,Vn.of({field:this,create:e})]}
method extension (line 4) | get extension(){return this}
function Ri (line 4) | function Ri(i){return e=>new Yn(e,i)}
method constructor (line 4) | constructor(e,t){this.inner=e,this.prec=t}
method of (line 4) | of(e){return new Ni(this,e)}
method reconfigure (line 4) | reconfigure(e){return i.reconfigure.of({compartment:this,extension:e})}
method get (line 4) | get(e){return e.config.compartments.get(this)}
method constructor (line 4) | constructor(e,t){this.compartment=e,this.inner=t}
method constructor (line 4) | constructor(e,t,r,n,s,o){for(this.base=e,this.compartments=t,this.dynami...
method staticFacet (line 4) | staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.st...
method resolve (line 4) | static resolve(e,t,r){let n=[],s=Object.create(null),o=new Map;for(let d...
function Tp (line 4) | function Tp(i,e,t){let r=[[],[],[],[],[]],n=new Map;function s(o,l){let ...
function Pi (line 4) | function Pi(i,e){if(e&1)return 2;let t=e>>1,r=i.status[t];if(r==4)throw ...
function Jn (line 4) | function Jn(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}
method constructor (line 4) | constructor(e,t){this.type=e,this.value=t}
method define (line 4) | static define(){return new cl}
method of (line 4) | of(e){return new rt(this,e)}
method constructor (line 4) | constructor(e){this.map=e}
method of (line 4) | of(e){return new te(this,e)}
method constructor (line 4) | constructor(e,t){this.type=e,this.value=t}
method map (line 4) | map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==thi...
method is (line 4) | is(e){return this.type==e}
method define (line 4) | static define(e={}){return new ul(e.map||(t=>t))}
method mapEffects (line 4) | static mapEffects(e,t){if(!e.length)return e;let r=[];for(let n of e){le...
method constructor (line 4) | constructor(e,t,r,n,s,o){this.startState=e,this.changes=t,this.selection...
method create (line 4) | static create(e,t,r,n,s,o){return new i(e,t,r,n,s,o)}
method newDoc (line 4) | get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startS...
method newSelection (line 4) | get newSelection(){return this.selection||this.startState.selection.map(...
method state (line 4) | get state(){return this._state||this.startState.applyTransaction(this),t...
method annotation (line 4) | annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}
method docChanged (line 4) | get docChanged(){return!this.changes.empty}
method reconfigured (line 4) | get reconfigured(){return this.startState.config!=this.state.config}
method isUserEvent (line 4) | isUserEvent(e){let t=this.annotation(i.userEvent);return!!(t&&(t==e||t.l...
function Dp (line 4) | function Dp(i,e){let t=[];for(let r=0,n=0;;){let s,o;if(r<i.length&&(n==...
function Qh (line 4) | function Qh(i,e,t){var r;let n,s,o;return t?(n=e.changes,s=Ye.empty(e.ch...
function fl (line 4) | function fl(i,e,t){let r=e.selection,n=ai(e.annotations);return e.userEv...
function ec (line 4) | function ec(i,e,t){let r=fl(i,e.length?e[0]:{},i.doc.length);e.length&&e...
function Bp (line 4) | function Bp(i){let e=i.startState,t=!0;for(let n of e.facet(Xh)){let s=n...
function Ep (line 4) | function Ep(i){let e=i.startState,t=e.facet(Jh),r=i;for(let n=t.length-1...
function ai (line 4) | function ai(i){return i==null?Op:Array.isArray(i)?i:[i]}
function Lp (line 4) | function Lp(i){if(dl)return dl.test(i);for(let e=0;e<i.length;e++){let t...
function Ip (line 4) | function Ip(i){return e=>{if(!/\S/.test(e))return Ee.Space;if(Lp(e))retu...
method constructor (line 4) | constructor(e,t,r,n,s,o){this.config=e,this.doc=t,this.selection=r,this....
method field (line 4) | field(e,t=!0){let r=this.config.address[e.id];if(r==null){if(t)throw new...
method update (line 4) | update(...e){return ec(this,e,!0)}
method applyTransaction (line 4) | applyTransaction(e){let t=this.config,{base:r,compartments:n}=t;for(let ...
method replaceSelection (line 4) | replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.c...
method changeByRange (line 4) | changeByRange(e){let t=this.selection,r=e(t.ranges[0]),n=this.changes(r....
method changes (line 4) | changes(e=[]){return e instanceof Ye?e:Ye.of(e,this.doc.length,this.face...
method toText (line 4) | toText(e){return se.of(e.split(this.facet(i.lineSeparator)||sl))}
method sliceDoc (line 4) | sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lin...
method facet (line 4) | facet(e){let t=this.config.address[e.id];return t==null?e.default:(Pi(th...
method toJSON (line 4) | toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};...
method fromJSON (line 4) | static fromJSON(e,t={},r){if(!e||typeof e.doc!="string")throw new RangeE...
method create (line 4) | static create(e={}){let t=_n.resolve(e.extensions||[],new Map),r=e.doc i...
method tabSize (line 4) | get tabSize(){return this.facet(i.tabSize)}
method lineBreak (line 4) | get lineBreak(){return this.facet(i.lineSeparator)||`
method readOnly (line 5) | get readOnly(){return this.facet(Zh)}
method phrase (line 5) | phrase(e,...t){for(let r of this.facet(i.phrases))if(Object.prototype.ha...
method languageDataAt (line 5) | languageDataAt(e,t,r=-1){let n=[];for(let s of this.facet(jh))for(let o ...
method charCategorizer (line 5) | charCategorizer(e){let t=this.languageDataAt("wordChars",e);return Ip(t....
method wordAt (line 5) | wordAt(e){let{text:t,from:r,length:n}=this.doc.lineAt(e),s=this.charCate...
method compare (line 5) | compare(i,e){let t=Object.keys(i),r=Object.keys(e);return t.length==r.le...
function it (line 5) | function it(i,e,t={}){let r={};for(let n of i)for(let s of Object.keys(n...
method eq (line 5) | eq(e){return this==e}
method range (line 5) | range(e,t=e){return Fi.create(e,t,this)}
function yl (line 5) | function yl(i,e){return i==e||i.constructor==e.constructor&&i.eq(e)}
method constructor (line 5) | constructor(e,t,r){this.from=e,this.to=t,this.value=r}
method create (line 5) | static create(e,t,r){return new i(e,t,r)}
function ml (line 5) | function ml(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}
method constructor (line 5) | constructor(e,t,r,n){this.from=e,this.to=t,this.value=r,this.maxPoint=n}
method length (line 5) | get length(){return this.to[this.to.length-1]}
method findIndex (line 5) | findIndex(e,t,r,n=0){let s=r?this.to:this.from;for(let o=n,l=s.length;;)...
method between (line 5) | between(e,t,r,n){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(r,...
method map (line 5) | map(e,t){let r=[],n=[],s=[],o=-1,l=-1;for(let a=0;a<this.value.length;a+...
method constructor (line 5) | constructor(e,t,r,n){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this....
method create (line 5) | static create(e,t,r,n){return new i(e,t,r,n)}
method length (line 5) | get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkE...
method size (line 5) | get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t ...
method chunkEnd (line 5) | chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}
method update (line 5) | update(e){let{add:t=[],sort:r=!1,filterFrom:n=0,filterTo:s=this.length}=...
method map (line 5) | map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],n=-1;for(let o...
method between (line 5) | between(e,t,r){if(!this.isEmpty){for(let n=0;n<this.chunk.length;n++){le...
method iter (line 5) | iter(e=0){return Hi.from([this]).goto(e)}
method isEmpty (line 5) | get isEmpty(){return this.nextLayer==this}
method iter (line 5) | static iter(e,t=0){return Hi.from(e).goto(t)}
method compare (line 5) | static compare(e,t,r,n,s=-1){let o=e.filter(u=>u.maxPoint>0||!u.isEmpty&...
method eq (line 5) | static eq(e,t,r=0,n){n==null&&(n=999999999);let s=e.filter(c=>!c.isEmpty...
method spans (line 5) | static spans(e,t,r,n,s=-1){let o=new Pr(e,null,s).goto(t),l=t,a=o.openSt...
method of (line 5) | static of(e,t=!1){let r=new Et;for(let n of e instanceof Fi?[e]:t?Rp(e):...
method join (line 5) | static join(e){if(!e.length)return i.empty;let t=e[e.length-1];for(let r...
function Rp (line 5) | function Rp(i){if(i.length>1)for(let e=i[0],t=1;t<i.length;t++){let r=i[...
method finishChunk (line 5) | finishChunk(e){this.chunks.push(new pl(this.from,this.to,this.value,this...
method constructor (line 5) | constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.la...
method add (line 5) | add(e,t,r){this.addInner(e,t,r)||(this.nextLayer||(this.nextLayer=new i)...
method addInner (line 5) | addInner(e,t,r){let n=e-this.lastTo||r.startSide-this.last.endSide;if(n<...
method addChunk (line 5) | addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)...
method finish (line 5) | finish(){return this.finishInner(le.empty)}
method finishInner (line 5) | finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.len...
function Vh (line 5) | function Vh(i,e,t){let r=new Map;for(let s of i)for(let o=0;o<s.chunk.le...
method constructor (line 5) | constructor(e,t,r,n=0){this.layer=e,this.skip=t,this.minPoint=r,this.ran...
method startSide (line 5) | get startSide(){return this.value?this.value.startSide:0}
method endSide (line 5) | get endSide(){return this.value?this.value.endSide:0}
method goto (line 5) | goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e...
method gotoInner (line 5) | gotoInner(e,t,r){for(;this.chunkIndex<this.layer.chunk.length;){let n=th...
method forward (line 5) | forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}
method next (line 5) | next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=thi...
method setRangeIndex (line 5) | setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){i...
method nextChunk (line 5) | nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}
method compare (line 5) | compare(e){return this.from-e.from||this.startSide-e.startSide||this.ran...
method constructor (line 5) | constructor(e){this.heap=e}
method from (line 5) | static from(e,t=null,r=-1){let n=[];for(let s=0;s<e.length;s++)for(let o...
method startSide (line 5) | get startSide(){return this.value?this.value.startSide:0}
method goto (line 5) | goto(e,t=-1e9){for(let r of this.heap)r.goto(e,t);for(let r=this.heap.le...
method forward (line 5) | forward(e,t){for(let r of this.heap)r.forward(e,t);for(let r=this.heap.l...
method next (line 5) | next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this...
function il (line 5) | function il(i,e){for(let t=i[e];;){let r=(e<<1)+1;if(r>=i.length)break;l...
method constructor (line 5) | constructor(e,t,r){this.minPoint=r,this.active=[],this.activeTo=[],this....
method goto (line 5) | goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.acti...
method forward (line 5) | forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||t...
method removeActive (line 5) | removeActive(e){$n(this.active,e),$n(this.activeTo,e),$n(this.activeRank...
method addActive (line 5) | addActive(e){let t=0,{value:r,to:n,rank:s}=this.cursor;for(;t<this.activ...
method next (line 5) | next(){let e=this.to,t=this.point;this.point=null;let r=this.openStart<0...
method activeForPoint (line 5) | activeForPoint(e){if(!this.active.length)return this.active;let t=[];for...
method openEnd (line 5) | openEnd(e){let t=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[...
function $h (line 5) | function $h(i,e,t,r,n,s){i.goto(e),t.goto(r);let o=r+n,l=r,a=r-e,h=!!s.b...
function gl (line 5) | function gl(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t...
function $n (line 5) | function $n(i,e){for(let t=e,r=i.length-1;t<r;t++)i[t]=i[t+1];i.pop()}
function Gn (line 5) | function Gn(i,e,t){for(let r=i.length-1;r>=e;r--)i[r+1]=i[r];i[e]=t}
function Gh (line 5) | function Gh(i,e){let t=-1,r=1e9;for(let n=0;n<e.length;n++)(e[n]-r||i[n]...
function vr (line 5) | function vr(i,e,t=i.length){let r=0;for(let n=0;n<t&&n<i.length;)i.charC...
function tc (line 5) | function tc(i,e,t,r){for(let n=0,s=0;;){if(s>=e)return n;if(n==i.length)...
method constructor (line 5) | constructor(e,t){this.rules=[];let{finish:r}=t||{};function n(o){return/...
method getRules (line 5) | getRules(){return this.rules.join(`
method newName (line 6) | static newName(){let e=ic[rc]||1;return ic[rc]=e+1,xl+e.toString(36)}
method mount (line 6) | static mount(e,t,r){let n=e[wl],s=r&&r.nonce;n?s&&n.setNonce(s):n=new kl...
method constructor (line 6) | constructor(e,t){let r=e.ownerDocument||e,n=r.defaultView;if(!e.head&&e....
method mount (line 6) | mount(e,t){let r=this.sheet,n=0,s=0;for(let o=0;o<e.length;o++){let l=e[...
method setNonce (line 7) | setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this....
function sc (line 7) | function sc(i){var e=Pp&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||N...
function nt (line 7) | function nt(){var i=arguments[0];typeof i=="string"&&(i=document.createE...
function oc (line 7) | function oc(i,e){if(typeof e=="string")i.appendChild(document.createText...
function Aa (line 7) | function Aa(i,e){for(let t in i)t=="class"&&e.class?e.class+=" "+i.class...
function Ma (line 7) | function Ma(i,e,t){if(i==e)return!0;i||(i=ps),e||(e=ps);let r=Object.key...
function Fp (line 7) | function Fp(i,e){for(let t=i.attributes.length-1;t>=0;t--){let r=i.attri...
function cc (line 7) | function cc(i,e,t){let r=!1;if(e)for(let n in e)t&&n in t||(r=!0,n=="sty...
function Hp (line 7) | function Hp(i){let e=Object.create(null);for(let t=0;t<i.attributes.leng...
method eq (line 7) | eq(e){return!1}
method updateDOM (line 7) | updateDOM(e,t){return!1}
method compare (line 7) | compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}
method estimatedHeight (line 7) | get estimatedHeight(){return-1}
method lineBreaks (line 7) | get lineBreaks(){return 0}
method ignoreEvent (line 7) | ignoreEvent(e){return!0}
method coordsAt (line 7) | coordsAt(e,t,r){return null}
method isHidden (line 7) | get isHidden(){return!1}
method editable (line 7) | get editable(){return!1}
method destroy (line 7) | destroy(e){}
method constructor (line 7) | constructor(e,t,r,n){super(),this.startSide=e,this.endSide=t,this.widget...
method heightRelevant (line 7) | get heightRelevant(){return!1}
method mark (line 7) | static mark(e){return new Qi(e)}
method widget (line 7) | static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.bloc...
method replace (line 7) | static replace(e){let t=!!e.block,r,n;if(e.isBlockGap)r=-5e8,n=4e8;else{...
method line (line 7) | static line(e){return new en(e)}
method set (line 7) | static set(e,t=!1){return le.of(e,t)}
method hasHeight (line 7) | hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}
method constructor (line 7) | constructor(e){let{start:t,end:r}=Uc(e);super(t?-1:5e8,r?1:-6e8,null,e),...
method eq (line 7) | eq(e){return this==e||e instanceof i&&this.tagName==e.tagName&&Ma(this.a...
method range (line 7) | range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be e...
method constructor (line 7) | constructor(e){super(-2e8,-2e8,null,e)}
method eq (line 7) | eq(e){return e instanceof i&&this.spec.class==e.spec.class&&Ma(this.spec...
method range (line 7) | range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must b...
method constructor (line 7) | constructor(e,t,r,n,s,o){super(t,r,s,e),this.block=n,this.isReplace=o,th...
method type (line 7) | get type(){return this.startSide!=this.endSide?Ve.WidgetRange:this.start...
method heightRelevant (line 7) | get heightRelevant(){return this.block||!!this.widget&&(this.widget.esti...
method eq (line 7) | eq(e){return e instanceof i&&qp(this.widget,e.widget)&&this.block==e.blo...
method range (line 7) | range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSi...
function Uc (line 7) | function Uc(i,e=!1){let{inclusiveStart:t,inclusiveEnd:r}=i;return t==nul...
function qp (line 7) | function qp(i,e){return i==e||!!(i&&e&&i.compare(e))}
function pi (line 7) | function pi(i,e,t,r=0){let n=t.length-1;n>=0&&t[n]+r>=i?t[n]=Math.max(t[...
method constructor (line 7) | constructor(e,t){super(),this.tagName=e,this.attributes=t}
method eq (line 7) | eq(e){return e==this||e instanceof i&&this.tagName==e.tagName&&Ma(this.a...
method create (line 7) | static create(e){return new i(e.tagName,e.attributes||ps)}
method set (line 7) | static set(e,t=!1){return le.of(e,t)}
function tn (line 7) | function tn(i){let e;return i.nodeType==11?e=i.getSelection?i:i.ownerDoc...
function Rl (line 7) | function Rl(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e)...
function Ui (line 7) | function Ui(i,e){if(!e.anchorNode)return!1;try{return Rl(i,e.anchorNode)...
function hs (line 7) | function hs(i){return i.nodeType==3?rn(i,0,i.nodeValue.length).getClient...
function Ki (line 7) | function Ki(i,e,t,r){return t?uc(i,e,t,r,-1)||uc(i,e,t,r,1):!1}
function xr (line 7) | function xr(i){for(var e=0;;e++)if(i=i.previousSibling,!i)return e}
function vs (line 7) | function vs(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|...
function uc (line 7) | function uc(i,e,t,r,n){for(;;){if(i==t&&e==r)return!0;if(e==(n<0?0:ar(i)...
function ar (line 7) | function ar(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}
function bs (line 7) | function bs(i,e){let t=e?i.left:i.right;return{left:t,right:t,top:i.top,...
function Wp (line 7) | function Wp(i){let e=i.visualViewport;return e?{left:0,right:e.width,top...
function Kc (line 7) | function Kc(i,e){let t=e.width/i.offsetWidth,r=e.height/i.offsetHeight;r...
function Vp (line 7) | function Vp(i,e,t,r,n,s,o,l){let a=i.ownerDocument,h=a.defaultView||wind...
function $p (line 7) | function $p(i){let e=i.ownerDocument,t,r;for(let n=i.parentNode;n&&!(n==...
method constructor (line 7) | constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=nu...
method eq (line 7) | eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorO...
method setRange (line 7) | setRange(e){let{anchorNode:t,focusNode:r}=e;this.set(t,Math.min(e.anchor...
method set (line 7) | set(e,t,r,n){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this...
function jc (line 7) | function jc(i){if(i.setActive)return i.setActive();if(Hr)return i.focus(...
function rn (line 7) | function rn(i,e,t=e){let r=fc||(fc=document.createRange());return r.setE...
function gi (line 7) | function gi(i,e,t,r){let n={key:e,code:e,keyCode:t,which:t,cancelable:!0...
function Gp (line 7) | function Gp(i){for(;i;){if(i&&(i.nodeType==9||i.nodeType==11&&i.host))re...
function Up (line 7) | function Up(i,e){let t=e.focusNode,r=e.focusOffset;if(!t||e.anchorNode!=...
function Yc (line 7) | function Yc(i){return i.scrollTop>Math.max(1,i.scrollHeight-i.clientHeig...
function Xc (line 7) | function Xc(i,e){for(let t=i,r=e;;){if(t.nodeType==3&&r>0)return{node:t,...
function _c (line 7) | function _c(i,e){for(let t=i,r=e;;){if(t.nodeType==3&&r<t.nodeValue.leng...
method constructor (line 7) | constructor(e,t,r=!0){this.node=e,this.offset=t,this.precise=r}
method before (line 7) | static before(e,t){return new i(e.parentNode,xr(e),t)}
method after (line 7) | static after(e,t){return new i(e.parentNode,xr(e)+1,t)}
function Jc (line 7) | function Jc(i){let e=[];for(let t=0;t<i.length;t++)e.push(1<<+i[t]);retu...
function Zc (line 7) | function Zc(i){return i<=247?Kp[i]:1424<=i&&i<=1524?2:1536<=i&&i<=1785?j...
method dir (line 7) | get dir(){return this.level%2?Ta:Vr}
method constructor (line 7) | constructor(e,t,r){this.from=e,this.to=t,this.level=r}
method side (line 7) | side(e,t){return this.dir==t==e?this.to:this.from}
method forward (line 7) | forward(e,t){return e==(this.dir==t)}
method find (line 7) | static find(e,t,r,n){let s=-1;for(let o=0;o<e.length;o++){let l=e[o];if(...
function Qc (line 7) | function Qc(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t...
function Xp (line 7) | function Xp(i,e,t,r,n){for(let s=0;s<=r.length;s++){let o=s?r[s-1].to:e,...
function _p (line 7) | function _p(i,e,t,r,n){let s=n==1?2:1;for(let o=0,l=0,a=0;o<=r.length;o+...
function Jp (line 7) | function Jp(i,e,t,r){for(let n=0,s=r;n<=t.length;n++){let o=n?t[n-1].to:...
function Fl (line 7) | function Fl(i,e,t,r,n,s,o){let l=r%2?2:1;if(r%2==n%2)for(let a=e,h=0;a<t...
function Hl (line 7) | function Hl(i,e,t,r,n,s,o){let l=e%2?2:1;Xp(i,n,s,r,l),_p(i,n,s,r,l),Jp(...
function Zp (line 7) | function Zp(i,e,t){if(!i)return[new wt(0,0,e==Ta?1:0)];if(e==Vr&&!t.leng...
function eu (line 7) | function eu(i){return[new wt(0,i,0)]}
function Qp (line 7) | function Qp(i,e,t,r,n){var s;let o=r.head-i.from,l=wt.find(e,o,(s=r.bidi...
function e1 (line 7) | function e1(i,e,t){for(let r=e;r<t;r++){let n=Zc(i.charCodeAt(r));if(n==...
method constructor (line 7) | constructor(e,t="nearest",r="nearest",n=5,s=5,o=!1){this.range=e,this.y=...
method map (line 7) | map(e){return e.empty?this:new i(this.range.map(e),this.y,this.x,this.yM...
method clip (line 7) | clip(e){return this.range.to<=e.doc.length?this:new i(R.cursor(e.doc.len...
function Fe (line 7) | function Fe(i,e,t){let r=i.facet(su);r.length?r[0](e):window.onerror&&wi...
method combine (line 7) | combine(i){return i.filter((e,t)=>{for(let r=0;r<t;r++)if(i[r].plugin==e...
method constructor (line 7) | constructor(e,t,r,n,s){this.id=e,this.create=t,this.domEventHandlers=r,t...
method of (line 7) | of(e){return this.baseExtensions.concat(ui.of({plugin:this,arg:e}))}
method define (line 7) | static define(e,t){let{eventHandlers:r,eventObservers:n,provide:s,decora...
method fromClass (line 7) | static fromClass(e,t){return i.define((r,n)=>new e(r,n),t)}
method constructor (line 7) | constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}
method plugin (line 7) | get plugin(){return this.spec&&this.spec.plugin}
method update (line 7) | update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(th...
method destroy (line 7) | destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{...
method deactivate (line 7) | deactivate(){this.spec=this.value=null}
function dc (line 7) | function dc(i,e){let t=i.state.facet(mu);if(!t.length)return t;let r=t.m...
function za (line 7) | function za(i){let e=0,t=0,r=0,n=0;for(let s of i.state.facet(pu)){let o...
method constructor (line 7) | constructor(e,t,r,n){this.fromA=e,this.toA=t,this.fromB=r,this.toB=n}
method join (line 7) | join(e){return new i(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.to...
method addToSet (line 7) | addToSet(e){let t=e.length,r=this;for(;t>0;t--){let n=e[t-1];if(!(n.from...
method extendWithRanges (line 7) | static extendWithRanges(e,t){if(t.length==0)return e;let r=[];for(let n=...
method constructor (line 7) | constructor(e,t,r){this.view=e,this.state=t,this.transactions=r,this.fla...
method create (line 7) | static create(e,t,r){return new i(e,t,r)}
method viewportChanged (line 7) | get viewportChanged(){return(this.flags&4)>0}
method viewportMoved (line 7) | get viewportMoved(){return(this.flags&8)>0}
method heightChanged (line 7) | get heightChanged(){return(this.flags&2)>0}
method geometryChanged (line 7) | get geometryChanged(){return this.docChanged||(this.flags&18)>0}
method focusChanged (line 7) | get focusChanged(){return(this.flags&1)>0}
method docChanged (line 7) | get docChanged(){return!this.changes.empty}
method selectionSet (line 7) | get selectionSet(){return this.transactions.some(e=>e.selection)}
method empty (line 7) | get empty(){return this.flags==0&&this.transactions.length==0}
method constructor (line 7) | constructor(e,t,r=0){this.dom=e,this.length=t,this.flags=r,this.parent=n...
method breakAfter (line 7) | get breakAfter(){return this.flags&1}
method children (line 7) | get children(){return r1}
method isWidget (line 7) | isWidget(){return!1}
method isHidden (line 7) | get isHidden(){return!1}
method isComposite (line 7) | isComposite(){return!1}
method isLine (line 7) | isLine(){return!1}
method isText (line 7) | isText(){return!1}
method isBlock (line 7) | isBlock(){return!1}
method domAttrs (line 7) | get domAttrs(){return null}
method sync (line 7) | sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttr...
method toString (line 7) | toString(){return this.constructor.name+(this.children.length?`(${this.c...
method destroy (line 7) | destroy(){this.parent=null}
method setDOM (line 7) | setDOM(e){this.dom=e,e.cmTile=this}
method posAtStart (line 7) | get posAtStart(){return this.parent?this.parent.posBefore(this):0}
method posAtEnd (line 7) | get posAtEnd(){return this.posAtStart+this.length}
method posBefore (line 7) | posBefore(e,t=this.posAtStart){let r=t;for(let n of this.children){if(n=...
method posAfter (line 7) | posAfter(e){return this.posBefore(e)+e.length}
method covers (line 7) | covers(e){return!0}
method coordsIn (line 7) | coordsIn(e,t){return null}
method domPosFor (line 7) | domPosFor(e,t){let r=xr(this.dom),n=this.length?e>0:t>0;return new $t(th...
method markDirty (line 7) | markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent....
method overrideDOMText (line 7) | get overrideDOMText(){return null}
method root (line 7) | get root(){for(let e=this;e;e=e.parent)if(e instanceof bi)return e;retur...
method get (line 7) | static get(e){return e.cmTile}
method constructor (line 7) | constructor(e){super(e,0),this._children=[]}
method isComposite (line 7) | isComposite(){return!0}
method children (line 7) | get children(){return this._children}
method lastChild (line 7) | get lastChild(){return this.children.length?this.children[this.children....
method append (line 7) | append(e){this.children.push(e),e.parent=this}
method sync (line 7) | sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,r=null,n,s=e...
function mc (line 7) | function mc(i){let e=i.nextSibling;return i.parentNode.removeChild(i),e}
method constructor (line 7) | constructor(e,t){super(t),this.view=e}
method owns (line 7) | owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}
method isBlock (line 7) | isBlock(){return!0}
method nearest (line 7) | nearest(e){for(;;){if(!e)return null;let t=ke.get(e);if(t&&this.owns(t))...
method blockTiles (line 7) | blockTiles(e){for(let t=[],r=this,n=0,s=0;;)if(n==r.children.length){if(...
method resolveBlock (line 7) | resolveBlock(e,t){let r,n=-1,s,o=-1;if(this.blockTiles((l,a)=>{let h=a+l...
method constructor (line 7) | constructor(e,t){super(e),this.wrapper=t}
method isBlock (line 7) | isBlock(){return!0}
method covers (line 7) | covers(e){return this.children.length?e<0?this.children[0].covers(-1):th...
method domAttrs (line 7) | get domAttrs(){return this.wrapper.attributes}
method of (line 7) | static of(e,t){let r=new i(t||document.createElement(e.tagName),e);retur...
method constructor (line 7) | constructor(e,t){super(e),this.attrs=t}
method isLine (line 7) | isLine(){return!0}
method start (line 7) | static start(e,t,r){let n=new i(t||document.createElement("div"),e);retu...
method domAttrs (line 7) | get domAttrs(){return this.attrs}
method resolveInline (line 7) | resolveInline(e,t,r){let n=null,s=-1,o=null,l=-1;function a(c,u){for(let...
method coordsIn (line 7) | coordsIn(e,t){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(...
method domIn (line 7) | domIn(e,t){let r=this.resolveInline(e,t);if(r){let{tile:n,offset:s}=r;if...
function i1 (line 7) | function i1(i){let e=i.dom.lastChild;if(!e)return i.dom.getBoundingClien...
function n1 (line 7) | function n1(i,e){let t=i.coordsIn(0,1),r=e.coordsIn(0,1);return t&&r&&r....
method constructor (line 7) | constructor(e,t){super(e),this.mark=t}
method domAttrs (line 7) | get domAttrs(){return this.mark.attrs}
method of (line 7) | static of(e,t){let r=new i(t||document.createElement(e.tagName),e);retur...
method constructor (line 7) | constructor(e,t){super(e,t.length),this.text=t}
method sync (line 7) | sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&...
method isText (line 7) | isText(){return!0}
method toString (line 7) | toString(){return JSON.stringify(this.text)}
method coordsIn (line 7) | coordsIn(e,t){let r=this.dom.nodeValue.length;e>r&&(e=r);let n=e,s=e,o=0...
method of (line 7) | static of(e,t){let r=new i(t||document.createTextNode(e),e);return t||(r...
method constructor (line 7) | constructor(e,t,r,n){super(e,t,n),this.widget=r}
method isWidget (line 7) | isWidget(){return!0}
method isHidden (line 7) | get isHidden(){return this.widget.isHidden}
method covers (line 7) | covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}
method coordsIn (line 7) | coordsIn(e,t){return this.coordsInWidget(e,t,!1)}
method coordsInWidget (line 7) | coordsInWidget(e,t,r){let n=this.widget.coordsAt(this.dom,e,t);if(n)retu...
method overrideDOMText (line 7) | get overrideDOMText(){if(!this.length)return se.empty;let{root:e}=this;i...
method destroy (line 7) | destroy(){super.destroy(),this.widget.destroy(this.dom)}
method of (line 7) | static of(e,t,r,n,s){return s||(s=e.toDOM(t),e.editable||(s.contentEdita...
method constructor (line 7) | constructor(e){let t=document.createElement("img");t.className="cm-widge...
method isHidden (line 7) | get isHidden(){return!0}
method overrideDOMText (line 7) | get overrideDOMText(){return se.empty}
method coordsIn (line 7) | coordsIn(e){return this.dom.getBoundingClientRect()}
method constructor (line 7) | constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.til...
method advance (line 7) | advance(e,t,r){let{tile:n,index:s,beforeBreak:o,parents:l}=this;for(;e||...
method root (line 7) | get root(){return this.parents.length?this.parents[0].tile:this.tile}
method constructor (line 7) | constructor(e,t,r,n){this.from=e,this.to=t,this.wrapper=r,this.rank=n}
method constructor (line 7) | constructor(e,t,r){this.cache=e,this.root=t,this.blockWrappers=r,this.cu...
method addText (line 7) | addText(e,t,r,n){var s;this.flushBuffer();let o=this.ensureMarks(t,r),l=...
method addComposition (line 7) | addComposition(e,t){let r=this.curLine;r.dom!=t.line.dom&&(r.setDOM(this...
method addInlineWidget (line 7) | addInlineWidget(e,t,r){let n=this.afterWidget&&e.flags&48&&(this.afterWi...
method addMark (line 7) | addMark(e,t,r){this.flushBuffer(),this.ensureMarks(t,r).append(e),this.p...
method addBlockWidget (line 7) | addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.l...
method continueWidget (line 7) | continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,thi...
method addLineStart (line 7) | addLineStart(e,t){var r;e||(e=gu);let n=yi.start(e,t||((r=this.cache.fin...
method addLine (line 7) | addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBloc...
method addBreak (line 7) | addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}
method addLineStartIfNotCovered (line 7) | addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}
method ensureLine (line 7) | ensureLine(e){this.curLine||this.addLineStart(e)}
method ensureMarks (line 7) | ensureMarks(e,t){var r;let n=this.curLine;for(let s=e.length-1;s>=0;s--)...
method endLine (line 7) | endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChi...
method updateBlockWrappers (line 7) | updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers....
method getBlockPos (line 7) | getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let r...
method blockPosCovered (line 7) | blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!...
method getBuffer (line 7) | getBuffer(e){let t=2|(e<0?16:32),r=this.cache.find(xi,void 0,1);return r...
method flushBuffer (line 7) | flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afte...
method constructor (line 7) | constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=...
method skip (line 7) | skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount...
method next (line 7) | next(e){if(this.textOff==this.text.length){let{value:n,lineBreak:s,done:...
method constructor (line 7) | constructor(e){this.view=e,this.buckets=xs.map(()=>[]),this.index=xs.map...
method add (line 7) | add(e){let t=e.constructor.bucket,r=this.buckets[t];r.length<6?r.push(e)...
method find (line 7) | find(e,t,r=2){let n=e.bucket,s=this.buckets[n],o=this.index[n];for(let l...
method findWidget (line 7) | findWidget(e,t,r){let n=this.buckets[0];if(n.length)for(let s=0,o=0;;s++...
method reuse (line 7) | reuse(e){return this.reused.set(e,1),e}
method maybeReuse (line 7) | maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}
method clear (line 7) | clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=thi...
method constructor (line 7) | constructor(e,t,r,n,s){this.view=e,this.decorations=n,this.disallowBlock...
method run (line 7) | run(e,t){let r=t&&this.getCompositionContext(t.text);for(let n=0,s=0,o=0...
method preserve (line 7) | preserve(e,t,r){let n=l1(this.old),s=this.openMarks;this.old.advance(e,r...
method emit (line 7) | emit(e,t){let r=null,n=this.builder,s=0,o=le.spans(this.decorations,e,t,...
method forward (line 7) | forward(e,t,r=1){t-e<=10?this.old.advance(t-e,r,this.reuseWalker):(this....
method getCompositionContext (line 7) | getCompositionContext(e){let t=[],r=null;for(let n=e.parentNode;;n=n.par...
function pc (line 7) | function pc(i,e){let t=r=>{for(let n of r.children)if((e?n.isText():n.le...
function s1 (line 7) | function s1(i){let e=i.isReplace?(i.startSide<0?64:0)|(i.endSide>0?128:0...
function o1 (line 7) | function o1(i,e){let t=e.spec.attributes,r=e.spec.class;return!t&&!r||(i...
function l1 (line 7) | function l1(i){let e=[];for(let t=i.parents.length;t>1;t--){let r=t==i.p...
function Cl (line 7) | function Cl(i){let e=ke.get(i);return e&&e.setDOM(i.cloneNode()),i}
method constructor (line 7) | constructor(e){super(),this.tag=e}
method eq (line 7) | eq(e){return e.tag==this.tag}
method toDOM (line 7) | toDOM(){return document.createElement(this.tag)}
method updateDOM (line 7) | updateDOM(e){return e.nodeName.toLowerCase()==this.tag}
method isHidden (line 7) | get isHidden(){return!0}
method toDOM (line 7) | toDOM(){return document.createElement("br")}
method isHidden (line 7) | get isHidden(){return!0}
method editable (line 7) | get editable(){return!0}
method constructor (line 7) | constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],thi...
method update (line 7) | update(e){var t;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.ever...
method updateInner (line 7) | updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:...
method updateEditContextFormatting (line 7) | updateEditContextFormatting(e){this.editContextFormatting=this.editConte...
method updateSelection (line 7) | updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusN...
method suppressWidgetCursorChange (line 7) | suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ki(...
method enforceCursorAssoc (line 7) | enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e....
method posFromDOM (line 7) | posFromDOM(e,t){let r=this.tile.nearest(e);if(!r)return this.tile.dom.co...
method domAtPos (line 7) | domAtPos(e,t){let{tile:r,offset:n}=this.tile.resolveBlock(e,t);return r....
method inlineDOMNearPos (line 7) | inlineDOMNearPos(e,t){let r,n=-1,s=!1,o,l=-1,a=!1;return this.tile.block...
method coordsAt (line 7) | coordsAt(e,t){let{tile:r,offset:n}=this.tile.resolveBlock(e,t);return r....
method lineAt (line 7) | lineAt(e,t){let{tile:r}=this.tile.resolveBlock(e,t);return r.isLine()?r:...
method coordsForChar (line 7) | coordsForChar(e){let{tile:t,offset:r}=this.tile.resolveBlock(e,1);if(!t....
method measureVisibleLineHeights (line 7) | measureVisibleLineHeights(e){let t=[],{from:r,to:n}=e,s=this.view.conten...
method textDirectionAt (line 7) | textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getCom...
method measureTextSize (line 7) | measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.childr...
method computeBlockGapDeco (line 7) | computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let r=0,n=0;;n+...
method updateDeco (line 7) | updateDeco(){let e=1,t=this.view.state.facet(Is).map(s=>(this.dynamicDec...
method scrollIntoView (line 7) | scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt...
method lineHasWidget (line 7) | lineHasWidget(e){let t=r=>r.isWidget()||r.children.some(t);return t(this...
method destroy (line 7) | destroy(){jl(this.tile)}
function jl (line 7) | function jl(i,e){let t=e?.get(i);if(t!=1){t==null&&i.destroy();for(let r...
function a1 (line 7) | function a1(i){return i.node.nodeType==1&&i.node.firstChild&&(i.offset==...
function vu (line 7) | function vu(i,e){let t=i.observer.selectionRange;if(!t.focusNode)return ...
function h1 (line 7) | function h1(i,e,t){let r=vu(i,t);if(!r)return null;let{node:n,from:s,to:...
function c1 (line 7) | function c1(i,e){return i.nodeType!=1?0:(e&&i.childNodes[e-1].contentEdi...
method constructor (line 7) | constructor(){this.changes=[]}
method compareRange (line 7) | compareRange(e,t){pi(e,t,this.changes)}
method comparePoint (line 7) | comparePoint(e,t){pi(e,t,this.changes)}
method boundChange (line 7) | boundChange(e){pi(e,e,this.changes)}
function f1 (line 7) | function f1(i,e,t){let r=new u1;return le.compare(i,e,t,r),r.changes}
method constructor (line 7) | constructor(){this.changes=[]}
method compareRange (line 7) | compareRange(e,t){pi(e,t,this.changes)}
method comparePoint (line 7) | comparePoint(){}
method boundChange (line 7) | boundChange(e){pi(e,e,this.changes)}
function d1 (line 7) | function d1(i,e,t){let r=new Yl;return le.compare(i,e,t,r),r.changes}
function m1 (line 7) | function m1(i,e){for(let t=i;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t...
function p1 (line 7) | function p1(i,e){let t=!1;return e&&i.iterChangedRanges((r,n)=>{r<e.to&&...
method constructor (line 7) | constructor(e){super(),this.height=e}
method toDOM (line 7) | toDOM(){let e=document.createElement("div");return e.className="cm-gap",...
method eq (line 7) | eq(e){return e.height==this.height}
method updateDOM (line 7) | updateDOM(e){return e.style.height=this.height+"px",!0}
method editable (line 7) | get editable(){return!0}
method estimatedHeight (line 7) | get estimatedHeight(){return this.height}
method ignoreEvent (line 7) | ignoreEvent(){return!1}
function g1 (line 7) | function g1(i,e,t=1){let r=i.charCategorizer(e),n=i.doc.lineAt(e),s=e-n....
function v1 (line 7) | function v1(i,e,t,r,n){let s=Math.round((r-e.left)*i.defaultCharacterWid...
function Xl (line 7) | function Xl(i,e,t){let r=i.lineBlockAt(e);if(Array.isArray(r.type)){let ...
function b1 (line 7) | function b1(i,e,t,r){let n=Xl(i,e.head,e.assoc||-1),s=!r||n.type!=Ve.Tex...
function gc (line 7) | function gc(i,e,t,r){let n=i.state.doc.lineAt(e.head),s=i.bidiSpans(n),o...
function y1 (line 8) | function y1(i,e,t){let r=i.state.charCategorizer(e),n=r(t);return s=>{le...
function x1 (line 8) | function x1(i,e,t,r){let n=e.head,s=t?1:-1;if(n==(t?i.state.doc.length:0...
function _i (line 8) | function _i(i,e,t){for(;;){let r=0;for(let n of i)n.between(e-1,e+1,(s,o...
function bu (line 8) | function bu(i,e){let t=null;for(let r=0;r<e.ranges.length;r++){let n=e.r...
function Ml (line 8) | function Ml(i,e,t){let r=_i(i.state.facet(ln).map(n=>n(i)),t.from,e.head...
method constructor (line 8) | constructor(e,t){this.pos=e,this.assoc=t}
function _l (line 8) | function _l(i,e,t,r){let n=i.contentDOM.getBoundingClientRect(),s=n.top+...
method constructor (line 8) | constructor(e,t,r,n){this.view=e,this.x=t,this.y=r,this.baseDir=n,this.l...
method bidiSpansAt (line 8) | bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(th...
method baseDirAt (line 8) | baseDirAt(e,t){let{line:r,spans:n}=this.bidiSpansAt(e);return n[wt.find(...
method dirAt (line 8) | dirAt(e,t){let{line:r,spans:n}=this.bidiSpansAt(e);return n[wt.find(n,e-...
method bidiIn (line 8) | bidiIn(e,t){let{spans:r,line:n}=this.bidiSpansAt(e);return r.length>1||r...
method scan (line 8) | scan(e,t){let r=0,n=e.length-1,s=new Set,o=this.bidiIn(e[0],e[n]),l,a,h=...
method scanText (line 8) | scanText(e,t){let r=[];for(let s=0;s<e.length;s=Ie(e.text,s))r.push(t+s)...
method scanTile (line 8) | scanTile(e,t){if(!e.length)return new xt(t,1);if(e.children.length==1){l...
method constructor (line 8) | constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparat...
method append (line 8) | append(e){this.text+=e}
method lineBreak (line 8) | lineBreak(){this.text+=Vi}
method readRange (line 8) | readRange(e,t){if(!e)return this;let r=e.parentNode;for(let n=e;;){this....
method readTextNode (line 8) | readTextNode(e){let t=e.nodeValue;for(let r of this.points)r.node==e&&(r...
method readNode (line 8) | readNode(e){let t=ke.get(e),r=t&&t.overrideDOMText;if(r!=null){this.find...
method findPointBefore (line 8) | findPointBefore(e,t){for(let r of this.points)r.node==e&&e.childNodes[r....
method findPointInside (line 8) | findPointInside(e,t){for(let r of this.points)(e.nodeType==3?r.node==e:e...
function w1 (line 8) | function w1(i,e,t){for(;;){if(!e||t<ar(e))return!1;if(e==i)return!0;t=xr...
function k1 (line 8) | function k1(i,e){let t;for(;!(i==e||!i);i=i.nextSibling){let r=ke.get(i)...
method constructor (line 8) | constructor(e,t){this.node=e,this.offset=t,this.pos=-1}
method constructor (line 8) | constructor(e,t,r,n){this.typeOver=n,this.bounds=null,this.text="",this....
function yu (line 8) | function yu(i,e,t,r){if(i.isComposite()){let n=-1,s=-1,o=-1,l=-1;for(let...
function xu (line 8) | function xu(i,e){let t,{newSel:r}=e,n=i.state.selection.main,s=i.inputSt...
function La (line 9) | function La(i,e,t,r=-1){if(W.ios&&i.inputState.flushIOSKey(e))return!0;l...
function S1 (line 9) | function S1(i,e,t){let r,n=i.state,s=n.selection.main,o=-1;if(e.from==e....
function wu (line 9) | function wu(i,e,t,r){let n=Math.min(i.length,e.length),s=0;for(;s<n&&i.c...
function C1 (line 9) | function C1(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;l...
function A1 (line 9) | function A1(i,e){if(i.length==0)return null;let t=i[0].pos,r=i.length==2...
function Ss (line 9) | function Ss(i,e){return e.head==i.main.head&&e.anchor==i.main.anchor}
method setSelectionOrigin (line 9) | setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=...
method constructor (line 9) | constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.la...
method handleEvent (line 9) | handleEvent(e){!z1(this.view,e)||this.ignoreDuringComposition(e)||e.type...
method runHandlers (line 9) | runHandlers(e,t){let r=this.handlers[e];if(r){for(let n of r.observers)n...
method ensureHandlers (line 9) | ensureHandlers(e){let t=M1(e),r=this.handlers,n=this.view.contentDOM;for...
method keydown (line 9) | keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.k...
method flushIOSKey (line 9) | flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.f...
method ignoreDuringComposition (line 9) | ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:th...
method startMouseSelection (line 9) | startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(...
method update (line 9) | update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSe...
method destroy (line 9) | destroy(){this.mouseSelection&&this.mouseSelection.destroy()}
function vc (line 9) | function vc(i,e){return(t,r)=>{try{return e.call(i,r,t)}catch(n){Fe(t.st...
function M1 (line 9) | function M1(i){let e=Object.create(null);function t(r){return e[r]||(e[r...
function rs (line 9) | function rs(i){return Math.max(0,i)*.7+8}
function D1 (line 9) | function D1(i,e){return Math.max(Math.abs(i.clientX-e.clientX),Math.abs(...
method constructor (line 9) | constructor(e,t,r,n){this.view=e,this.startEvent=t,this.style=r,this.mus...
method start (line 9) | start(e){this.dragging===!1&&this.select(e)}
method move (line 9) | move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dra...
method up (line 9) | up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e....
method destroy (line 9) | destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocum...
method setScrollSpeed (line 9) | setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(t...
method scroll (line 9) | scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.sc...
method select (line 9) | select(e){let{view:t}=this,r=bu(this.atoms,this.style.get(e,this.extend,...
method update (line 9) | update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destr...
function B1 (line 9) | function B1(i,e){let t=i.state.facet(ru);return t.length?t[0](e):W.mac?e...
function E1 (line 9) | function E1(i,e){let t=i.state.facet(iu);return t.length?t[0](e):W.mac?!...
function O1 (line 9) | function O1(i,e){let{main:t}=i.state.selection;if(t.empty)return!1;let r...
function z1 (line 9) | function z1(i,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;f...
function L1 (line 9) | function L1(i){let e=i.dom.parentNode;if(!e)return;let t=e.appendChild(d...
function Rs (line 9) | function Rs(i,e,t){for(let r of i.facet(e))t=r(t,i);return t}
function Au (line 9) | function Au(i,e){e=Rs(i.state,Da,e);let{state:t}=i,r,n=1,s=t.toText(e),o...
function bc (line 9) | function bc(i,e,t,r){if(r==1)return R.cursor(e,t);if(r==2)return g1(i.st...
function Mu (line 9) | function Mu(i){if(!I1)return i.detail;let e=yc,t=wc;return yc=i,wc=Date....
function R1 (line 9) | function R1(i,e){let t=i.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1...
function P1 (line 9) | function P1(i,e){for(let t=0;t<i.ranges.length;t++){let{from:r,to:n}=i.r...
function kc (line 9) | function kc(i,e,t,r){if(t=Rs(i.state,Da,t),!t)return;let n=i.posAtCoords...
function N1 (line 9) | function N1(i,e){let t=i.dom.parentNode;if(!t)return;let r=t.appendChild...
function F1 (line 9) | function F1(i){let e=[],t=[],r=!1;for(let n of i.selection.ranges)n.empt...
function Du (line 9) | function Du(i,e){let t=[];for(let r of i.facet(lu)){let n=r(i,e);n&&t.pu...
function Bu (line 9) | function Bu(i){setTimeout(()=>{let e=i.hasFocus;if(e!=i.inputState.notif...
function H1 (line 9) | function H1(i){Sc.has(i)||(Sc.add(i),i.addEventListener("copy",()=>{}),i...
function Ac (line 9) | function Ac(){wi=!1}
method constructor (line 9) | constructor(e){this.lineWrapping=e,this.doc=se.empty,this.heightSamples=...
method heightForGap (line 9) | heightForGap(e,t){let r=this.doc.lineAt(t).number-this.doc.lineAt(e).num...
method heightForLine (line 9) | heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-thi...
method setDoc (line 9) | setDoc(e){return this.doc=e,this}
method mustRefreshForWrapping (line 9) | mustRefreshForWrapping(e){return Cc.indexOf(e)>-1!=this.lineWrapping}
method mustRefreshForHeights (line 9) | mustRefreshForHeights(e){let t=!1;for(let r=0;r<e.length;r++){let n=e[r]...
method refresh (line 9) | refresh(e,t,r,n,s,o){let l=Cc.indexOf(e)>-1,a=Math.abs(t-this.lineHeight...
method constructor (line 9) | constructor(e,t){this.from=e,this.heights=t,this.index=0}
method more (line 9) | get more(){return this.index<this.heights.length}
method constructor (line 9) | constructor(e,t,r,n,s){this.from=e,this.length=t,this.top=r,this.height=...
method type (line 9) | get type(){return typeof this._content=="number"?Ve.Text:Array.isArray(t...
method to (line 9) | get to(){return this.from+this.length}
method bottom (line 9) | get bottom(){return this.top+this.height}
method widget (line 9) | get widget(){return this._content instanceof Wr?this._content.widget:null}
method widgetLineBreaks (line 9) | get widgetLineBreaks(){return typeof this._content=="number"?this._conte...
method join (line 9) | join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat...
method constructor (line 9) | constructor(e,t,r=2){this.length=e,this.height=t,this.flags=r}
method outdated (line 9) | get outdated(){return(this.flags&2)>0}
method outdated (line 9) | set outdated(e){this.flags=(e?2:0)|this.flags&-3}
method setHeight (line 9) | setHeight(e){this.height!=e&&(Math.abs(this.height-e)>cs&&(wi=!0),this.h...
method replace (line 9) | replace(e,t,r){return i.of(r)}
method decomposeLeft (line 9) | decomposeLeft(e,t){t.push(this)}
method decomposeRight (line 9) | decomposeRight(e,t){t.push(this)}
method applyChanges (line 9) | applyChanges(e,t,r,n){let s=this,o=r.doc;for(let l=n.length-1;l>=0;l--){...
method empty (line 9) | static empty(){return new yt(0,0,0)}
method of (line 9) | static of(e){if(e.length==1)return e[0];let t=0,r=e.length,n=0,s=0;for(;...
function Cs (line 9) | function Cs(i,e){return i==e?i:(i.constructor!=e.constructor&&(wi=!0),e)}
method constructor (line 9) | constructor(e,t,r){super(e,t),this.deco=r,this.spaceAbove=0}
method mainBlock (line 9) | mainBlock(e,t){return new Ot(t,this.length,e+this.spaceAbove,this.height...
method blockAt (line 9) | blockAt(e,t,r,n){return this.spaceAbove&&e<r+this.spaceAbove?new Ot(n,0,...
method lineAt (line 9) | lineAt(e,t,r,n,s){let o=this.mainBlock(n,s);return this.spaceAbove?this....
method forEachLine (line 9) | forEachLine(e,t,r,n,s,o){e<=s+this.length&&t>=s&&o(this.lineAt(0,de.ByPo...
method setMeasuredHeight (line 9) | setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,...
method updateHeight (line 9) | updateHeight(e,t=0,r=!1,n){return n&&n.from<=t&&n.more&&this.setMeasured...
method toString (line 9) | toString(){return`block(${this.length})`}
method constructor (line 9) | constructor(e,t,r){super(e,t,null),this.collapsed=0,this.widgetHeight=0,...
method mainBlock (line 9) | mainBlock(e,t){return new Ot(t,this.length,e+this.spaceAbove,this.height...
method replace (line 9) | replace(e,t,r){let n=r[0];return r.length==1&&(n instanceof i||n instanc...
method updateHeight (line 9) | updateHeight(e,t=0,r=!1,n){return n&&n.from<=t&&n.more?this.setMeasuredH...
method toString (line 9) | toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""...
method constructor (line 9) | constructor(e){super(e,0)}
method heightMetrics (line 9) | heightMetrics(e,t){let r=e.doc.lineAt(t).number,n=e.doc.lineAt(t+this.le...
method blockAt (line 9) | blockAt(e,t,r,n){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.he...
method lineAt (line 9) | lineAt(e,t,r,n,s){if(t==de.ByHeight)return this.blockAt(e,r,n,s);if(t==d...
method forEachLine (line 9) | forEachLine(e,t,r,n,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let...
method replace (line 9) | replace(e,t,r){let n=this.length-t;if(n>0){let s=r[r.length-1];s instanc...
method decomposeLeft (line 9) | decomposeLeft(e,t){t.push(new i(e-1),null)}
method decomposeRight (line 9) | decomposeRight(e,t){t.push(null,new i(this.length-e-1))}
method updateHeight (line 9) | updateHeight(e,t=0,r=!1,n){let s=t+this.length;if(n&&n.from<=t+this.leng...
method toString (line 9) | toString(){return`gap(${this.length})`}
method constructor (line 9) | constructor(e,t,r){super(e.length+t+r.length,e.height+r.height,t|(e.outd...
method break (line 9) | get break(){return this.flags&1}
method blockAt (line 9) | blockAt(e,t,r,n){let s=r+this.left.height;return e<s?this.left.blockAt(e...
method lineAt (line 9) | lineAt(e,t,r,n,s){let o=n+this.left.height,l=s+this.left.length+this.bre...
method forEachLine (line 9) | forEachLine(e,t,r,n,s,o){let l=n+this.left.height,a=s+this.left.length+t...
method replace (line 9) | replace(e,t,r){let n=this.left.length+this.break;if(t<n)return this.bala...
method decomposeLeft (line 9) | decomposeLeft(e,t){let r=this.left.length;if(e<=r)return this.left.decom...
method decomposeRight (line 9) | decomposeRight(e,t){let r=this.left.length,n=r+this.break;if(e>=n)return...
method balanced (line 9) | balanced(e,t){return e.size>2*t.size||t.size>2*e.size?ft.of(this.break?[...
method updateHeight (line 9) | updateHeight(e,t=0,r=!1,n){let{left:s,right:o}=this,l=t+s.length+this.br...
method toString (line 9) | toString(){return this.left+(this.break?" ":"-")+this.right}
function Mc (line 9) | function Mc(i,e){let t,r;i[e]==null&&(t=i[e-1])instanceof yr&&(r=i[e+1])...
method constructor (line 9) | constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-...
method isCovered (line 9) | get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==t...
method span (line 9) | span(e,t){if(this.lineStart>-1){let r=Math.min(t,this.lineEnd),n=this.no...
method point (line 9) | point(e,t,r){if(e<t||r.heightRelevant){let n=r.widget?r.widget.estimated...
method enterLine (line 9) | enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc...
method blankContent (line 9) | blankContent(e,t){let r=new yr(t-e);return this.oracle.doc.lineAt(e).to=...
method ensureLine (line 9) | ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.no...
method addBlock (line 9) | addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCove...
method addLineDeco (line 9) | addLineDeco(e,t,r){let n=this.ensureLine();n.length+=r,n.collapsed+=r,n....
method finish (line 9) | finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1...
method build (line 9) | static build(e,t,r,n){let s=new i(r,e);return le.spans(t,r,n,s,0),s.fini...
function V1 (line 9) | function V1(i,e,t){let r=new la;return le.compare(i,e,t,r,0),r.changes}
method constructor (line 9) | constructor(){this.changes=[]}
method compareRange (line 9) | compareRange(){}
method comparePoint (line 9) | comparePoint(e,t,r,n){(e<t||r&&r.heightRelevant||n&&n.heightRelevant)&&p...
function $1 (line 9) | function $1(i,e){let t=i.getBoundingClientRect(),r=i.ownerDocument,n=r.d...
function G1 (line 9) | function G1(i){let e=i.getBoundingClientRect(),t=i.ownerDocument.default...
function U1 (line 9) | function U1(i,e){let t=i.getBoundingClientRect();return{left:0,right:t.r...
method constructor (line 9) | constructor(e,t,r,n){this.from=e,this.to=t,this.size=r,this.displaySize=n}
method same (line 9) | static same(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r...
method draw (line 9) | draw(e,t){return X.replace({widget:new aa(this.displaySize*(t?e.scaleY:e...
method constructor (line 9) | constructor(e,t){super(),this.size=e,this.vertical=t}
method eq (line 9) | eq(e){return e.size==this.size&&e.vertical==this.vertical}
method toDOM (line 9) | toDOM(){let e=document.createElement("div");return this.vertical?e.style...
method estimatedHeight (line 9) | get estimatedHeight(){return this.vertical?this.size:-1}
method constructor (line 9) | constructor(e){this.state=e,this.pixelViewport={left:0,right:window.inne...
method updateForViewport (line 9) | updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;...
method updateScaler (line 9) | updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.heigh...
method updateViewportLines (line 9) | updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(t...
method update (line 9) | update(e,t=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=...
method measure (line 9) | measure(e){let t=e.contentDOM,r=window.getComputedStyle(t),n=this.height...
method visibleTop (line 9) | get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}
method visibleBottom (line 9) | get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}
method getViewport (line 9) | getViewport(e,t){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),n=this.heig...
method mapViewport (line 9) | mapViewport(e,t){let r=t.mapPos(e.from,-1),n=t.mapPos(e.to,1);return new...
method viewportIsAppropriate (line 9) | viewportIsAppropriate({from:e,to:t},r=0){if(!this.inView)return!0;let{to...
method mapLineGaps (line 9) | mapLineGaps(e,t){if(!e.length||t.empty)return e;let r=[];for(let n of e)...
method ensureLineGaps (line 9) | ensureLineGaps(e,t){let r=this.heightOracle.lineWrapping,n=r?1e4:2e3,s=n...
method gapSize (line 9) | gapSize(e,t,r,n){let s=ns(n,r)-ns(n,t);return this.heightOracle.lineWrap...
method updateLineGaps (line 9) | updateLineGaps(e){Ji.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGa...
method computeVisibleRanges (line 9) | computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t....
method lineBlockAt (line 9) | lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.v...
method lineBlockAtHeight (line 9) | lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewpo...
method scrollAnchorAt (line 9) | scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this....
method elementAtHeight (line 9) | elementAtHeight(e){return $i(this.heightMap.blockAt(this.scaler.fromDOM(...
method docHeight (line 9) | get docHeight(){return this.scaler.toDOM(this.heightMap.height)}
method contentHeight (line 9) | get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBo...
method constructor (line 9) | constructor(e,t){this.from=e,this.to=t}
function K1 (line 9) | function K1(i,e,t){let r=[],n=i,s=0;return le.spans(t,i,e,{span(){},poin...
function is (line 9) | function is({total:i,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)retur...
function ns (line 9) | function ns(i,e){let t=0;for(let{from:r,to:n}of i.ranges){if(e<=n){t+=e-...
function j1 (line 9) | function j1(i,e){for(let t of i)if(e(t))return t}
method toDOM (line 9) | toDOM(i){return i}
method fromDOM (line 9) | fromDOM(i){return i}
method eq (line 9) | eq(i){return i==this}
function Dc (line 9) | function Dc(i){let e=i.facet(Is).filter(r=>typeof r!="function"),t=i.fac...
method constructor (line 9) | constructor(e,t,r){let n=0,s=0,o=0;this.viewports=r.map(({from:l,to:a})=...
method toDOM (line 9) | toDOM(e){for(let t=0,r=0,n=0;;t++){let s=t<this.viewports.length?this.vi...
method fromDOM (line 9) | fromDOM(e){for(let t=0,r=0,n=0;;t++){let s=t<this.viewports.length?this....
method eq (line 9) | eq(e){return e instanceof i?this.scale==e.scale&&this.viewports.length==...
function $i (line 9) | function $i(i,e){if(e.scale==1)return i;let t=e.toDOM(i.top),r=e.toDOM(i...
function fa (line 9) | function fa(i,e,t){return new bt(e,{finish(r){return/&/.test(r)?r.replac...
method constructor (line 9) | constructor(e){this.view=e,this.active=!1,this.editContext=null,this.sel...
method onScrollChanged (line 9) | onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.int...
method onScroll (line 9) | onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.vie...
method onResize (line 9) | onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{thi...
method onPrint (line 9) | onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState...
method updateGaps (line 9) | updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this...
method onSelectionChange (line 9) | onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionR...
method readSelectionRange (line 9) | readSelectionRange(){let{view:e}=this,t=tn(e.root);if(!t)return!1;let r=...
method setSelectionRange (line 9) | setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t....
method clearSelectionRange (line 9) | clearSelectionRange(){this.selectionRange.set(null,0,null,0)}
method listenForScroll (line 9) | listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let r=this.dom;...
method ignore (line 9) | ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{...
method start (line 9) | start(){this.active||(this.observer.observe(this.dom,X1),Tl&&this.dom.ad...
method stop (line 9) | stop(){this.active&&(this.active=!1,this.observer.disconnect(),Tl&&this....
method clear (line 9) | clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}
method delayAndroidKey (line 9) | delayAndroidKey(e,t){var r;if(!this.delayedAndroidKey){let n=()=>{let s=...
method clearDelayedAndroidKey (line 9) | clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndr...
method flushSoon (line 9) | flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.reques...
method forceFlush (line 9) | forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(t...
method pendingRecords (line 9) | pendingRecords(){for(let e of this.observer.takeRecords())this.queue.pus...
method processRecords (line 9) | processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);l...
method readChange (line 9) | readChange(){let{from:e,to:t,typeOver:r}=this.processRecords(),n=this.se...
method flush (line 9) | flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&...
method readMutation (line 9) | readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t....
method setWindow (line 9) | setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win...
method addWindowListeners (line 9) | addWindowListeners(e){e.addEventListener("resize",this.onResize),this.pr...
method removeWindowListeners (line 9) | removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e...
method update (line 9) | update(e){this.editContext&&(this.editContext.update(e),e.startState.fac...
method destroy (line 9) | destroy(){var e,t,r;this.stop(),(e=this.intersection)===null||e===void 0...
function Bc (line 9) | function Bc(i,e,t){for(;e;){let r=ke.get(e);if(r&&r.parent==i)return r;l...
function Ec (line 9) | function Ec(i,e){let t=e.startContainer,r=e.startOffset,n=e.endContainer...
function _1 (line 9) | function _1(i,e){if(e.getComposedRanges){let n=e.getComposedRanges(i.roo...
method constructor (line 9) | constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this...
method applyEdits (line 10) | applyEdits(e){let t=0,r=!1,n=this.pendingContextChange;return e.changes....
method update (line 10) | update(e){let t=this.pendingContextChange,r=e.startState.selection.main;...
method resetRange (line 10) | resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),t...
method reset (line 10) | reset(e){this.resetRange(e),this.editContext.updateText(0,this.editConte...
method revertPending (line 10) | revertPending(e){let t=this.pendingContextChange;this.pendingContextChan...
method setSelection (line 10) | setSelection(e){let{main:t}=e.selection,r=this.toContextPos(Math.max(thi...
method rangeIsValid (line 10) | rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this...
method toEditorPos (line 10) | toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let r=this.composing;...
method toContextPos (line 10) | toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(...
method destroy (line 10) | destroy(){for(let e in this.handlers)this.editContext.removeEventListene...
method state (line 10) | get state(){return this.viewState.state}
method viewport (line 10) | get viewport(){return this.viewState.viewport}
method visibleRanges (line 10) | get visibleRanges(){return this.viewState.visibleRanges}
method inView (line 10) | get inView(){return this.viewState.inView}
method composing (line 10) | get composing(){return!!this.inputState&&this.inputState.composing>0}
method compositionStarted (line 10) | get compositionStarted(){return!!this.inputState&&this.inputState.compos...
method root (line 10) | get root(){return this._root}
method win (line 10) | get win(){return this.dom.ownerDocument.defaultView||window}
method constructor (line 10) | constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.edit...
method dispatch (line 10) | dispatch(...e){let t=e.length==1&&e[0]instanceof Le?e:e.length==1&&Array...
method update (line 10) | update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.up...
method setState (line 10) | setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView....
method updatePlugins (line 10) | updatePlugins(e){let t=e.startState.facet(ui),r=e.state.facet(ui);if(t!=...
method docViewUpdate (line 10) | docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docView...
method measure (line 10) | measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this...
method themeClasses (line 10) | get themeClasses(){return ua+" "+(this.state.facet(ca)?Ou:Eu)+" "+this.s...
method updateAttrs (line 10) | updateAttrs(){let e=zc(this,fu,{class:"cm-editor"+(this.hasFocus?" cm-fo...
method showAnnouncements (line 10) | showAnnouncements(e){let t=!0;for(let r of e)for(let n of r.effects)if(n...
method mountStyles (line 10) | mountStyles(){this.styleModules=this.state.facet(Wi);let e=this.state.fa...
method readMeasured (line 10) | readMeasured(){if(this.updateState==2)throw new Error("Reading the edito...
method requestMeasure (line 10) | requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=thi...
method plugin (line 10) | plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)...
method documentTop (line 10) | get documentTop(){return this.contentDOM.getBoundingClientRect().top+thi...
method documentPadding (line 10) | get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.v...
method scaleX (line 10) | get scaleX(){return this.viewState.scaleX}
method scaleY (line 10) | get scaleY(){return this.viewState.scaleY}
method elementAtHeight (line 10) | elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHe...
method lineBlockAtHeight (line 10) | lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlock...
method viewportLineBlocks (line 10) | get viewportLineBlocks(){return this.viewState.viewportLines}
method lineBlockAt (line 10) | lineBlockAt(e){return this.viewState.lineBlockAt(e)}
method contentHeight (line 10) | get contentHeight(){return this.viewState.contentHeight}
method moveByChar (line 10) | moveByChar(e,t,r){return Ml(this,e,gc(this,e,t,r))}
method moveByGroup (line 10) | moveByGroup(e,t){return Ml(this,e,gc(this,e,t,r=>y1(this,e.head,r)))}
method visualLineSide (line 10) | visualLineSide(e,t){let r=this.bidiSpans(e),n=this.textDirectionAt(e.fro...
method moveToLineBoundary (line 10) | moveToLineBoundary(e,t,r=!0){return b1(this,e,t,r)}
method moveVertically (line 10) | moveVertically(e,t,r){return Ml(this,e,x1(this,e,t,r))}
method domAtPos (line 10) | domAtPos(e,t=1){return this.docView.domAtPos(e,t)}
method posAtDOM (line 10) | posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}
method posAtCoords (line 10) | posAtCoords(e,t=!0){this.readMeasured();let r=_l(this,e,t);return r&&r.pos}
method posAndSideAtCoords (line 10) | posAndSideAtCoords(e,t=!0){return this.readMeasured(),_l(this,e,t)}
method coordsAtPos (line 10) | coordsAtPos(e,t=1){this.readMeasured();let r=this.docView.coordsAt(e,t);...
method coordsForChar (line 10) | coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}
method defaultCharacterWidth (line 10) | get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}
method defaultLineHeight (line 10) | get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}
method textDirection (line 10) | get textDirection(){return this.viewState.defaultTextDirection}
method textDirectionAt (line 10) | textDirectionAt(e){return!this.state.facet(au)||e<this.viewport.from||e>...
method lineWrapping (line 10) | get lineWrapping(){return this.viewState.heightOracle.lineWrapping}
method bidiSpans (line 10) | bidiSpans(e){if(e.length>J1)return eu(e.length);let t=this.textDirection...
method hasFocus (line 10) | get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||W.safari&...
method focus (line 10) | focus(){this.observer.ignore(()=>{jc(this.contentDOM),this.docView.updat...
method setRoot (line 10) | setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeT...
method destroy (line 10) | destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur...
method scrollIntoView (line 10) | static scrollIntoView(e,t={}){return es.of(new ji(typeof e=="number"?R.c...
method scrollSnapshot (line 10) | scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,r=this.vie...
method setTabFocusMode (line 10) | setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState....
method domEventHandlers (line 10) | static domEventHandlers(e){return Se.define(()=>({}),{eventHandlers:e})}
method domEventObservers (line 10) | static domEventObservers(e){return Se.define(()=>({}),{eventObservers:e})}
method theme (line 10) | static theme(e,t){let r=bt.newName(),n=[ss.of(r),Wi.of(fa(`.${r}`,e))];r...
method baseTheme (line 10) | static baseTheme(e){return Wt.lowest(Wi.of(fa("."+ua,e,zu)))}
method findFromDOM (line 10) | static findFromDOM(e){var t;let r=e.querySelector(".cm-content"),n=r&&ke...
method constructor (line 10) | constructor(e,t,r,n,s,o){this.from=e,this.to=t,this.dir=r,this.isolates=...
method update (line 10) | static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let r=[],n=e...
function zc (line 10) | function zc(i,e,t){for(let r=i.state.facet(e),n=r.length-1;n>=0;n--){let...
function Q1 (line 10) | function Q1(i,e){let t=i.split(/-(?!$)/),r=t[t.length-1];r=="Space"&&(r=...
function os (line 10) | function os(i,e,t){return e.altKey&&(i="Alt-"+i),e.ctrlKey&&(i="Ctrl-"+i...
method keydown (line 10) | keydown(i,e){return ng(tg(e.state),i,e,"editor")}
function tg (line 10) | function tg(i){let e=i.facet(an),t=Lc.get(e);return t||Lc.set(e,t=ig(e.r...
function ig (line 10) | function ig(i,e=Z1){let t=Object.create(null),r=Object.create(null),n=(o...
function ng (line 10) | function ng(i,e,t,r){pa=e;let n=sc(e),s=Xe(n,0),o=vt(s)==n.length&&n!=" ...
method constructor (line 10) | constructor(e,t,r,n,s){this.className=e,this.left=t,this.top=r,this.widt...
method draw (line 10) | draw(){let e=document.createElement("div");return e.className=this.class...
method update (line 10) | update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}
method adjust (line 10) | adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.wid...
method eq (line 10) | eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&th...
method forRange (line 10) | static forRange(e,t,r){if(r.empty){let n=e.coordsAtPos(r.head,r.assoc||1...
function Lu (line 10) | function Lu(i){let e=i.scrollDOM.getBoundingClientRect();return{left:(i....
function Ic (line 10) | function Ic(i,e,t,r){let n=i.coordsAtPos(e,t*2);if(!n)return r;let s=i.d...
function sg (line 10) | function sg(i,e,t){if(t.to<=i.viewport.from||t.from>=i.viewport.to)retur...
function og (line 10) | function og(i,e){return i.constructor==e.constructor&&i.eq(e)}
method constructor (line 10) | constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,th...
method update (line 10) | update(e){e.startState.facet(us)!=e.state.facet(us)&&this.setOrder(e.sta...
method docViewUpdate (line 10) | docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure...
method setOrder (line 10) | setOrder(e){let t=0,r=e.facet(us);for(;t<r.length&&r[t]!=this.layer;)t++...
method measure (line 10) | measure(){return this.layer.markers(this.view)}
method scale (line 10) | scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY...
method draw (line 10) | draw(e){if(e.length!=this.drawn.length||e.some((t,r)=>!og(t,this.drawn[r...
method destroy (line 10) | destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),thi...
function Iu (line 10) | function Iu(i){return[Se.define(e=>new ga(e,i)),us.of(i)]}
method combine (line 10) | combine(i){return it(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursor...
function Ru (line 10) | function Ru(i={}){return[sn.of(i),lg,ag,hg,hu.of(!0)]}
function Pu (line 10) | function Pu(i){return i.startState.facet(sn)!=i.state.facet(sn)}
method markers (line 10) | markers(i){let{state:e}=i,t=e.facet(sn),r=[];for(let n of e.selection.ra...
method update (line 10) | update(i,e){i.transactions.some(r=>r.selection)&&(e.style.animationName=...
method mount (line 10) | mount(i,e){Rc(e.state,i)}
function Rc (line 10) | function Rc(i,e){e.style.animationDuration=i.facet(sn).cursorBlinkRate+"...
method markers (line 10) | markers(i){return i.state.selection.ranges.map(e=>e.empty?[]:nn.forRange...
method update (line 10) | update(i,e){return i.docChanged||i.selectionSet||i.viewportChanged||Pu(i)}
method map (line 10) | map(i,e){return i==null?null:e.mapPos(i)}
method create (line 10) | create(){return null}
method update (line 10) | update(i,e){return i!=null&&(i=e.changes.mapPos(i)),e.effects.reduce((t,...
method constructor (line 10) | constructor(i){this.view=i,this.cursor=null,this.measureReq={read:this.r...
method update (line 10) | update(i){var e;let t=i.state.field(Gi);t==null?this.cursor!=null&&((e=t...
method readPos (line 10) | readPos(){let{view:i}=this,e=i.state.field(Gi),t=e!=null&&i.coordsAtPos(...
method drawCursor (line 10) | drawCursor(i){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;i?(this.c...
method destroy (line 10) | destroy(){this.cursor&&this.cursor.remove()}
method setDropPos (line 10) | setDropPos(i){this.view.state.field(Gi)!=i&&this.view.dispatch({effects:...
method dragover (line 10) | dragover(i){this.setDropPos(this.view.posAtCoords({x:i.clientX,y:i.clien...
method dragleave (line 10) | dragleave(i){(i.target==this.view.contentDOM||!this.view.contentDOM.cont...
method dragend (line 10) | dragend(){this.setDropPos(null)}
method drop (line 10) | drop(){this.setDropPos(null)}
function Fu (line 10) | function Fu(){return[Gi,cg]}
function Pc (line 10) | function Pc(i,e,t,r,n){e.lastIndex=0;for(let s=i.iterRange(t,r),o=t,l;!s...
function ug (line 10) | function ug(i,e){let t=i.visibleRanges;if(t.length==1&&t[0].from==i.view...
method constructor (line 10) | constructor(e){let{regexp:t,decoration:r,decorate:n,boundary:s,maxLength...
method createDeco (line 10) | createDeco(e){let t=new Et,r=t.add.bind(t);for(let{from:n,to:s}of ug(e,t...
method updateDeco (line 10) | updateDeco(e,t){let r=1e9,n=-1;return e.docChanged&&e.changes.iterChange...
method updateRange (line 10) | updateRange(e,t,r,n){for(let s of e.visibleRanges){let o=Math.max(s.from...
function mg (line 11) | function mg(){var i;if(Dl==null&&typeof document<"u"&&document.body){let...
method combine (line 11) | combine(i){let e=it(i,{render:null,specialChars:fg,addSpecialChars:null}...
function Hu (line 11) | function Hu(i={}){return[fs.of(i),pg()]}
function pg (line 11) | function pg(){return Nc||(Nc=Se.fromClass(class{constructor(i){this.view...
function vg (line 11) | function vg(i){return i>=32?gg:i==10?"\u2424":String.fromCharCode(9216+i)}
method constructor (line 11) | constructor(e,t){super(),this.options=e,this.code=t}
method eq (line 11) | eq(e){return e.code==this.code}
method toDOM (line 11) | toDOM(e){let t=vg(this.code),r=e.state.phrase("Control character")+" "+(...
method ignoreEvent (line 11) | ignoreEvent(){return!1}
method constructor (line 11) | constructor(e){super(),this.width=e}
method eq (line 11) | eq(e){return e.width==this.width}
method toDOM (line 11) | toDOM(){let e=document.createElement("span");return e.textContent=" ",e....
method ignoreEvent (line 11) | ignoreEvent(){return!1}
function qu (line 11) | function qu(){return yg}
method constructor (line 11) | constructor(i){this.decorations=this.getDeco(i)}
method update (line 11) | update(i){(i.docChanged||i.selectionSet)&&(this.decorations=this.getDeco...
method getDeco (line 11) | getDeco(i){let e=-1,t=[];for(let r of i.state.selection.ranges){let n=i....
method constructor (line 11) | constructor(e,t,r,n){this.facet=t,this.createTooltipView=r,this.removeTo...
method update (line 11) | update(e,t){var r;let n=e.state.facet(this.facet),s=n.filter(a=>a);if(n=...
function xg (line 11) | function xg(i){let e=i.dom.ownerDocument.documentElement;return{top:0,le...
method constructor (line 11) | constructor(i){this.view=i,this.above=[],this.inView=!0,this.madeAbsolut...
method createContainer (line 11) | createContainer(){this.parent?(this.container=document.createElement("di...
method observeIntersection (line 11) | observeIntersection(){if(this.intersectionObserver){this.intersectionObs...
method measureSoon (line 11) | measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=...
method update (line 11) | update(i){i.transactions.length&&(this.lastTransaction=Date.now());let e...
method createTooltip (line 11) | createTooltip(i,e){let t=i.create(this.view),r=e?e.dom:null;if(t.dom.cla...
method destroy (line 11) | destroy(){var i,e,t;this.view.win.removeEventListener("resize",this.meas...
method readMeasure (line 11) | readMeasure(){let i=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.t...
method writeMeasure (line 11) | writeMeasure(i){var e;if(i.makeAbsolute){this.madeAbsolute=!0,this.posit...
method maybeMeasure (line 11) | maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this....
method scroll (line 11) | scroll(){this.maybeMeasure()}
function Hc (line 11) | function Hc(i,e){let t=parseInt(i.style.left,10);(isNaN(t)||Math.abs(e-t...
method create (line 11) | static create(e){return new i(e)}
method constructor (line 11) | constructor(e){this.view=e,this.mounted=!1,this.dom=document.createEleme...
method createHostedView (line 11) | createHostedView(e,t){let r=e.create(this.view);return r.dom.classList.a...
method mount (line 11) | mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this...
method positioned (line 11) | positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.pos...
method update (line 11) | update(e){this.manager.update(e)}
method destroy (line 11) | destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===n...
method passProp (line 11) | passProp(e){let t;for(let r of this.manager.tooltipViews){let n=r[e];if(...
method offset (line 11) | get offset(){return this.passProp("offset")}
method getCoords (line 11) | get getCoords(){return this.passProp("getCoords")}
method overlap (line 11) | get overlap(){return this.passProp("overlap")}
method resize (line 11) | get resize(){return this.passProp("resize")}
method constructor (line 11) | constructor(e,t,r,n,s){this.view=e,this.source=t,this.field=r,this.setHo...
method update (line 11) | update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeo...
method active (line 11) | get active(){return this.view.state.field(this.field)}
method checkHover (line 11) | checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Dat...
method startHover (line 11) | startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=th...
method tooltip (line 11) | get tooltip(){let e=this.view.plugin(Ia),t=e?e.manager.tooltips.findInde...
method mousemove (line 11) | mousemove(e){var t,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.tar...
method mouseleave (line 11) | mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{a...
method watchTooltipLeave (line 11) | watchTooltipLeave(e){let t=r=>{e.removeEventListener("mouseleave",t),thi...
method destroy (line 11) | destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeo...
function Cg (line 11) | function Cg(i,e){let{left:t,right:r,top:n,bottom:s}=i.getBoundingClientR...
function Ag (line 11) | function Ag(i,e,t,r,n,s){let o=i.scrollDOM.getBoundingClientRect(),l=i.d...
function Ps (line 11) | function Ps(i,e={}){let t=te.define(),r=Re.define({create(){return[]},up...
function Ra (line 11) | function Ra(i,e){let t=i.plugin(Ia);if(!t)return null;let r=t.manager.to...
method combine (line 11) | combine(i){let e,t;for(let r of i)e=e||r.topContainer,t=t||r.bottomConta...
method constructor (line 11) | constructor(i){this.input=i.state.facet(on),this.specs=this.input.filter...
method update (line 11) | update(i){let e=i.state.facet(qc);this.top.container!=e.topContainer&&(t...
method destroy (line 11) | destroy(){this.top.sync([]),this.bottom.sync([])}
method constructor (line 11) | constructor(e,t,r){this.view=e,this.top=t,this.container=r,this.dom=void...
method sync (line 11) | sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();...
method syncDOM (line 11) | syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.do...
method scrollMargin (line 11) | scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?thi...
method syncClasses (line 11) | syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses...
function Wc (line 11) | function Wc(i){let e=i.nextSibling;return i.remove(),e}
method compare (line 11) | compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}
method eq (line 11) | eq(e){return!1}
method destroy (line 11) | destroy(e){}
function Bg (line 11) | function Bg(i){let e=[Eg];return i&&i.fixed===!1&&e.push(ka.of(!0)),e}
method constructor (line 11) | constructor(i){this.view=i,this.domAfter=null,this.prevViewport=i.viewpo...
method getDOMAfter (line 11) | getDOMAfter(){return this.domAfter||(this.domAfter=document.createElemen...
method update (line 11) | update(i){if(this.updateGutters(i)){let e=this.prevViewport,t=i.view.vie...
method syncGutters (line 11) | syncGutters(i){let e=this.dom.nextSibling;i&&(this.dom.remove(),this.dom...
method updateGutters (line 11) | updateGutters(i){let e=i.startState.facet(ms),t=i.state.facet(ms),r=i.do...
method destroy (line 11) | destroy(){for(let i of this.gutters)i.destroy();this.dom.remove(),this.d...
function Vc (line 11) | function Vc(i){return Array.isArray(i)?i:[i]}
function Sa (line 11) | function Sa(i,e,t){for(;i.value&&i.from<=t;)i.from==t&&e.push(i.value),i...
method constructor (line 11) | constructor(e,t,r){this.gutter=e,this.height=r,this.i=0,this.cursor=le.i...
method addElement (line 11) | addElement(e,t,r){let{gutter:n}=this,s=(t.top-this.height)/e.scaleY,o=t....
method line (line 11) | line(e,t,r){let n=[];Sa(this.cursor,n,t.from),r.length&&(n=n.concat(r));...
method widget (line 11) | widget(e,t){let r=this.gutter.config.widgetMarker(e,t.widget,t),n=r?[r]:...
method finish (line 11) | finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.eleme...
method constructor (line 11) | constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=...
method update (line 11) | update(e){let t=this.markers;if(this.markers=Vc(this.config.markers(e.vi...
method destroy (line 11) | destroy(){for(let e of this.elements)e.destroy()}
method constructor (line 11) | constructor(e,t,r,n){this.height=-1,this.above=0,this.markers=[],this.do...
method update (line 11) | update(e,t,r,n){this.height!=t&&(this.height=t,this.dom.style.height=t+"...
method setMarkers (line 11) | setMarkers(e,t){let r="cm-gutterElement",n=this.dom.firstChild;for(let s...
method destroy (line 11) | destroy(){this.setMarkers(null,[])}
function Og (line 11) | function Og(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t...
method combine (line 11) | combine(i){return it(i,{formatNumber:String,domEventHandlers:{}},{domEve...
method constructor (line 11) | constructor(e){super(),this.number=e}
method eq (line 11) | eq(e){return this.number==e.number}
method toDOM (line 11) | toDOM(){return document.createTextNode(this.number)}
function El (line 11) | function El(i,e){return i.state.facet(mi).formatNumber(e,i.state)}
method markers (line 11) | markers(e){return e.state.facet(zg)}
method lineMarker (line 11) | lineMarker(e,t,r){return r.some(n=>n.toDOM)?null:new Zi(El(e,e.state.doc...
method initialSpacer (line 11) | initialSpacer(e){return new Zi(El(e,$c(e.state.doc.lines)))}
method updateSpacer (line 11) | updateSpacer(e,t){let r=El(t.view,$c(t.view.state.doc.lines));return r==...
function Wu (line 11) | function Wu(i={}){return[mi.of(i),Bg(),Ig]}
function $c (line 11) | function $c(i){let e=9;for(;e<i;)e=e*10+9;return e}
method constructor (line 11) | constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}
function Vu (line 11) | function Vu(){return Pg}
method constructor (line 11) | constructor(e,t){this.from=e,this.to=t}
method constructor (line 11) | constructor(e={}){this.id=Ng++,this.perNode=!!e.perNode,this.deserialize...
method add (line 11) | add(e){if(this.perNode)throw new RangeError("Can't add per-node props to...
method constructor (line 11) | constructor(e,t,r,n=!1){this.tree=e,this.overlay=t,this.parser=r,this.br...
method get (line 11) | static get(e){return e&&e.props&&e.props[ee.mounted.id]}
method constructor (line 11) | constructor(e,t,r,n=0){this.name=e,this.props=t,this.id=r,this.flags=n}
method define (line 11) | static define(e){let t=e.props&&e.props.length?Object.create(null):Fg,r=...
method prop (line 11) | prop(e){return this.props[e.id]}
method isTop (line 11) | get isTop(){return(this.flags&1)>0}
method isSkipped (line 11) | get isSkipped(){return(this.flags&2)>0}
method isError (line 11) | get isError(){return(this.flags&4)>0}
method isAnonymous (line 11) | get isAnonymous(){return(this.flags&8)>0}
method is (line 11) | is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(ee...
method match (line 11) | static match(e){let t=Object.create(null);for(let r in e)for(let n of r....
method constructor (line 11) | constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)thr...
method extend (line 11) | extend(...e){let t=[];for(let r of this.types){let n=null;for(let s of e...
method constructor (line 11) | constructor(e,t,r,n,s){if(this.type=e,this.children=t,this.positions=r,t...
method toString (line 11) | toString(){let e=Gr.get(this);if(e&&!e.overlay)return e.tree.toString();...
m
Copy disabled (too large)
Download .json
Condensed preview — 1398 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (13,317K chars).
[
{
"path": ".github/workflows/changelog.yml",
"chars": 706,
"preview": "name: Changelog Check\n\non:\n pull_request:\n branches:\n - main\n\njobs:\n changelog:\n name: Ensure changelog upd"
},
{
"path": ".github/workflows/ci.yml",
"chars": 2137,
"preview": "name: Build and test\n\non:\n push:\n branches: [ main ]\n pull_request:\n branches: [ main ]\n\njobs:\n build:\n stra"
},
{
"path": ".gitignore",
"chars": 428,
"preview": "# Opam swtich\n_opam/\n\n# Build output directory\n_build/\n\n# Catch-all for _*/ directories\n_*/\n\n# Dune lock files\ndune.lock"
},
{
"path": ".ocamlformat",
"chars": 520,
"preview": "# OCamlFormat configuration file\n\n# Pin the version of OCamlFormat to ensure consistent formatting across different envi"
},
{
"path": "AGENTS.md",
"chars": 5841,
"preview": "# agents.md\n\nraven is an ecosystem of packages that brings modern machine learning capabilities to ocaml. it provides fa"
},
{
"path": "CHANGES.md",
"chars": 41758,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\n- Only document user-facing changes ("
},
{
"path": "CONTRIBUTING.md",
"chars": 8406,
"preview": "# Contributing to Raven\n\n## Documentation Style\n\n### Overview\n\nThis guide establishes documentation conventions for the "
},
{
"path": "LICENSE",
"chars": 745,
"preview": "ISC License\n\nCopyright (c) 2025, Thibaut Mattio\n\nPermission to use, copy, modify, and/or distribute this software for an"
},
{
"path": "README.md",
"chars": 4132,
"preview": "<p align=\"center\">\n <img src=\"www/site/raven.svg\" width=\"80\" alt=\"raven\">\n</p>\n\n<h3 align=\"center\">modern scientific co"
},
{
"path": "TODO.md",
"chars": 1581,
"preview": "# todo\n\n## beta (jit)\n\ngoalpost: jit-compiled gpt2 matching pytorch performance\n\nperf:\n- close rune grad performance gap"
},
{
"path": "dev/README.md",
"chars": 257,
"preview": "# dev\n\nDevelopment sandbox for experiments and prototypes that support the Raven ecosystem.\n\n## Projects\n\n| Name | Descr"
},
{
"path": "dev/mimir/README.md",
"chars": 2820,
"preview": "# mimir\n\nExperimental inference engine for raven.\n\nThe gap between \"I can run a forward pass\" and \"I can serve a model i"
},
{
"path": "dev/mimir/dune-project",
"chars": 328,
"preview": "(lang dune 3.21)\n\n(name mimir)\n\n(package\n (name mimir)\n (synopsis \"Experimental inference engine for Raven\")\n (descripti"
},
{
"path": "dev/mimir/lib/dune",
"chars": 66,
"preview": "(library\n (name mimir)\n (public_name mimir)\n (libraries nx unix))\n"
},
{
"path": "dev/mimir/lib/mimir.ml",
"chars": 267,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/mimir/lib/mimir.mli",
"chars": 552,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/mimir/lib/sampler.ml",
"chars": 15906,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/mimir/lib/sampler.mli",
"chars": 4868,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/mimir/lib/string_util.ml",
"chars": 582,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/README.md",
"chars": 4442,
"preview": "# Umbra\n\nComputational astronomy for OCaml, powered by [Nx](../../packages/nx/) and [Rune](../../packages/rune/)\n\nUmbra "
},
{
"path": "dev/umbra/dune-project",
"chars": 366,
"preview": "(lang dune 3.21)\n\n(name umbra)\n\n(package\n (name umbra)\n (synopsis \"Astronomy library for OCaml\")\n (description\n \"Physic"
},
{
"path": "dev/umbra/examples/01-constants-and-units/README.md",
"chars": 2039,
"preview": "# `01-constants-and-units`\n\nIntroduction to Umbra's type-safe unit system and physical constants. Creates\nquantities in "
},
{
"path": "dev/umbra/examples/01-constants-and-units/dune",
"chars": 48,
"preview": "(executable\n (name main)\n (libraries nx umbra))\n"
},
{
"path": "dev/umbra/examples/01-constants-and-units/main.ml",
"chars": 6261,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/examples/02-cosmological-distances/README.md",
"chars": 2292,
"preview": "# `02-cosmological-distances`\n\nCosmological distance calculations and parameter fitting. First prints a\ndistance table f"
},
{
"path": "dev/umbra/examples/02-cosmological-distances/dune",
"chars": 58,
"preview": "(executable\n (name main)\n (libraries nx rune vega umbra))\n"
},
{
"path": "dev/umbra/examples/02-cosmological-distances/main.ml",
"chars": 5019,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/examples/03-blackbody-fitting/README.md",
"chars": 2202,
"preview": "# `03-blackbody-fitting`\n\nFits the effective temperature and luminosity normalization of a star from\nsynthetic UGRIZ bro"
},
{
"path": "dev/umbra/examples/03-blackbody-fitting/dune",
"chars": 58,
"preview": "(executable\n (name main)\n (libraries nx rune vega umbra))\n"
},
{
"path": "dev/umbra/examples/03-blackbody-fitting/main.ml",
"chars": 4344,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/examples/04-extinction-and-magnitudes/README.md",
"chars": 2669,
"preview": "# `04-extinction-and-magnitudes`\n\nExplores three key photometric concepts: magnitude systems (AB, ST, Vega),\nK-correctio"
},
{
"path": "dev/umbra/examples/04-extinction-and-magnitudes/dune",
"chars": 53,
"preview": "(executable\n (name main)\n (libraries nx rune umbra))\n"
},
{
"path": "dev/umbra/examples/04-extinction-and-magnitudes/main.ml",
"chars": 6815,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/examples/05-sed-fitting/README.md",
"chars": 2689,
"preview": "# `05-sed-fitting`\n\nFull SED fitting pipeline: fits stellar temperature, dust extinction (A_V), and\nflux normalization s"
},
{
"path": "dev/umbra/examples/05-sed-fitting/dune",
"chars": 58,
"preview": "(executable\n (name main)\n (libraries nx rune vega umbra))\n"
},
{
"path": "dev/umbra/examples/05-sed-fitting/main.ml",
"chars": 5827,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/examples/06-coordinates-and-time/README.md",
"chars": 3355,
"preview": "# `06-coordinates-and-time`\n\nCelestial coordinates, astronomical time scales, and survey selection.\nDemonstrates frame t"
},
{
"path": "dev/umbra/examples/06-coordinates-and-time/dune",
"chars": 53,
"preview": "(executable\n (name main)\n (libraries nx rune umbra))\n"
},
{
"path": "dev/umbra/examples/06-coordinates-and-time/main.ml",
"chars": 8113,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/examples/07-batch-photometry/README.md",
"chars": 2744,
"preview": "# `07-batch-photometry`\n\nComputes SDSS g-r colors for a grid of blackbody templates at different\ntemperatures and dust e"
},
{
"path": "dev/umbra/examples/07-batch-photometry/dune",
"chars": 53,
"preview": "(executable\n (name main)\n (libraries nx rune umbra))\n"
},
{
"path": "dev/umbra/examples/07-batch-photometry/main.ml",
"chars": 3385,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/examples/08-photometric-redshifts/README.md",
"chars": 3012,
"preview": "# `08-photometric-redshifts`\n\nTwo-stage photometric redshift estimation: coarse grid search followed by\ngradient-based r"
},
{
"path": "dev/umbra/examples/08-photometric-redshifts/dune",
"chars": 58,
"preview": "(executable\n (name main)\n (libraries nx rune vega umbra))\n"
},
{
"path": "dev/umbra/examples/08-photometric-redshifts/main.ml",
"chars": 4955,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/examples/09-gravitational-lensing/README.md",
"chars": 3010,
"preview": "# `09-gravitational-lensing`\n\nFits gravitational lens parameters (lens center and Einstein radius) from\nobserved image p"
},
{
"path": "dev/umbra/examples/09-gravitational-lensing/dune",
"chars": 58,
"preview": "(executable\n (name main)\n (libraries nx rune vega umbra))\n"
},
{
"path": "dev/umbra/examples/09-gravitational-lensing/main.ml",
"chars": 5352,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/examples/10-uncertainty-propagation/README.md",
"chars": 3124,
"preview": "# `10-uncertainty-propagation`\n\nAutomatic uncertainty propagation through cosmological distance calculations.\nPropagates"
},
{
"path": "dev/umbra/examples/10-uncertainty-propagation/dune",
"chars": 53,
"preview": "(executable\n (name main)\n (libraries nx rune umbra))\n"
},
{
"path": "dev/umbra/examples/10-uncertainty-propagation/main.ml",
"chars": 4346,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/examples/11-bayesian-sed/README.md",
"chars": 3203,
"preview": "# `11-bayesian-sed`\n\nFisher information matrix analysis and Hamiltonian Monte Carlo sampling for\nBayesian SED parameter "
},
{
"path": "dev/umbra/examples/11-bayesian-sed/dune",
"chars": 63,
"preview": "(executable\n (name main)\n (libraries nx rune vega norn umbra))\n"
},
{
"path": "dev/umbra/examples/11-bayesian-sed/main.ml",
"chars": 5894,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/examples/12-survey-optimization/README.md",
"chars": 3943,
"preview": "# `12-survey-optimization`\n\nDifferentiable survey optimization for a Stage IV weak lensing survey. Uses\nexact autodiff g"
},
{
"path": "dev/umbra/examples/12-survey-optimization/dune",
"chars": 58,
"preview": "(executable\n (name main)\n (libraries nx rune vega umbra))\n"
},
{
"path": "dev/umbra/examples/12-survey-optimization/main.ml",
"chars": 22101,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/examples/README.md",
"chars": 2999,
"preview": "# Umbra Examples\n\nLearn Umbra through progressively complex examples. Start with\n`01-constants-and-units` and work throu"
},
{
"path": "dev/umbra/lib/altaz.ml",
"chars": 8809,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/altaz.mli",
"chars": 3728,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/const.ml",
"chars": 1444,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/const.mli",
"chars": 3513,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/coord.ml",
"chars": 11224,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/coord.mli",
"chars": 7208,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/cosmo.ml",
"chars": 32893,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/cosmo.mli",
"chars": 10744,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/dune",
"chars": 114,
"preview": "(library\n (name umbra)\n (public_name umbra)\n (private_modules kdtree filter_data vega_data)\n (libraries nx unix))\n"
},
{
"path": "dev/umbra/lib/extinction.ml",
"chars": 11384,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/extinction.mli",
"chars": 2944,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/filter_data.ml",
"chars": 39632,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/filters.ml",
"chars": 2500,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/filters.mli",
"chars": 3398,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/fits/dune",
"chars": 119,
"preview": "(library\n (name umbra_fits)\n (public_name umbra.fits)\n (private_modules fits_parser)\n (libraries nx nx.io talon unix))\n"
},
{
"path": "dev/umbra/lib/fits/fits_parser.ml",
"chars": 9477,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/fits/fits_parser.mli",
"chars": 1067,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/fits/umbra_fits.ml",
"chars": 20722,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/fits/umbra_fits.mli",
"chars": 3743,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/galactocentric.ml",
"chars": 3059,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/galactocentric.mli",
"chars": 2674,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/kdtree.ml",
"chars": 3185,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/kdtree.mli",
"chars": 1110,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/photometry.ml",
"chars": 5591,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/photometry.mli",
"chars": 5201,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/spectrum.ml",
"chars": 8019,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/spectrum.mli",
"chars": 7810,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/survey.ml",
"chars": 14126,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/survey.mli",
"chars": 7729,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/time.ml",
"chars": 6961,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/time.mli",
"chars": 4138,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/umbra.ml",
"chars": 549,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/umbra.mli",
"chars": 2525,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/unit.ml",
"chars": 11066,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/unit.mli",
"chars": 19963,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/lib/vega_data.ml",
"chars": 12839,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "dev/umbra/papers/perlmutter1999/.gitignore",
"chars": 7,
"preview": "/data/\n"
},
{
"path": "dev/umbra/papers/perlmutter1999/download_data.sh",
"chars": 1138,
"preview": "#!/usr/bin/env bash\n# Download Pantheon+ Type Ia supernova data (Scolnic et al. 2022, Brout et al. 2022).\n#\n# The Panthe"
},
{
"path": "dev/umbra/papers/perlmutter1999/perlmutter1999.md",
"chars": 81629,
"preview": "# The Accelerating Universe\n\nReproducing the key result of Perlmutter et al. (1999), \"Measurements of\n$\\Omega$ and $\\Lam"
},
{
"path": "dev/umbra/test/dune",
"chars": 80,
"preview": "(test\n (name test_umbra)\n (libraries umbra umbra.fits nx nx.io talon windtrap))\n"
},
{
"path": "dev/umbra/test/test_umbra.ml",
"chars": 65762,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "doc/coming-from-python.md",
"chars": 4585,
"preview": "# Coming from Python\n\nThis page maps Python scientific computing concepts to their Raven equivalents. It assumes you alr"
},
{
"path": "doc/ecosystem-overview.md",
"chars": 6719,
"preview": "# The Raven Ecosystem\n\nRaven is nine libraries that share one data type: `Nx.t`, the\nn-dimensional array. Each library d"
},
{
"path": "doc/index.md",
"chars": 1600,
"preview": "# Documentation\n\nWelcome to Raven's documentation. Raven is an ecosystem of OCaml libraries for numerical computing, mac"
},
{
"path": "doc/installation.md",
"chars": 2530,
"preview": "# Installation\n\n## Prerequisites\n\nRaven requires **OCaml 5.2** or later and **opam**.\n\nIf you don't have opam installed,"
},
{
"path": "doc/introduction.md",
"chars": 8554,
"preview": "# Introduction\n\nRaven is a project to bring modern scientific computing to the OCaml programming language. We're buildin"
},
{
"path": "doc/quickstart.md",
"chars": 3328,
"preview": "# Quickstart\n\nThis gets you from zero to computing gradients and training a model in five minutes.\n\n## Setup\n\n<!-- $MDX "
},
{
"path": "doc/roadmap.md",
"chars": 2350,
"preview": "# Roadmap\n\n## Current Status\n\nRaven is in **alpha**. The core stack (Nx -> Rune -> Kaun) works end-to-end: we have succe"
},
{
"path": "doc/support-raven.md",
"chars": 3965,
"preview": "# Support Raven\n\n## Raven in One Minute\n\nPython's monopoly on scientific computing forces an impossible choice: ship eve"
},
{
"path": "dune-project",
"chars": 7738,
"preview": "(lang dune 3.21)\n\n(name raven)\n\n(source\n (github raven-ml/raven))\n\n(authors \"Thibaut Mattio <thibaut.mattio@gmail.com>\")"
},
{
"path": "dune-workspace.tsan",
"chars": 514,
"preview": "(lang dune 3.21)\n\n(lock_dir\n (path dune.lock))\n\n; Pin ocaml-variants to the 5.4 branch which includes the\n; __tsan_func_"
},
{
"path": "opam/brot.opam",
"chars": 1153,
"preview": "# This file is generated by dune, edit dune-project instead\nopam-version: \"2.0\"\nversion: \"1.0.0~alpha3\"\nsynopsis: \"Token"
},
{
"path": "opam/fehu.opam",
"chars": 1087,
"preview": "# This file is generated by dune, edit dune-project instead\nopam-version: \"2.0\"\nversion: \"1.0.0~alpha3\"\nsynopsis: \"Reinf"
},
{
"path": "opam/hugin.opam",
"chars": 1041,
"preview": "# This file is generated by dune, edit dune-project instead\nopam-version: \"2.0\"\nversion: \"1.0.0~alpha3\"\nsynopsis: \"Decla"
},
{
"path": "opam/kaun-board.opam",
"chars": 1176,
"preview": "# This file is generated by dune, edit dune-project instead\nopam-version: \"2.0\"\nversion: \"1.0.0~alpha3\"\nsynopsis: \"Train"
},
{
"path": "opam/kaun.opam",
"chars": 1097,
"preview": "# This file is generated by dune, edit dune-project instead\nopam-version: \"2.0\"\nversion: \"1.0.0~alpha3\"\nsynopsis: \"Neura"
},
{
"path": "opam/munin.opam",
"chars": 1203,
"preview": "# This file is generated by dune, edit dune-project instead\nopam-version: \"2.0\"\nversion: \"1.0.0~alpha3\"\nsynopsis: \"Local"
},
{
"path": "opam/norn.opam",
"chars": 1034,
"preview": "# This file is generated by dune, edit dune-project instead\nopam-version: \"2.0\"\nversion: \"1.0.0~alpha3\"\nsynopsis: \"MCMC "
},
{
"path": "opam/nx.opam",
"chars": 1894,
"preview": "# This file is generated by dune, edit dune-project instead\nopam-version: \"2.0\"\nversion: \"1.0.0~alpha3\"\nsynopsis: \"N-dim"
},
{
"path": "opam/nx.opam.template",
"chars": 705,
"preview": "depexts: [\n [\"libc-dev\" \"openblas-dev\" \"lapack-dev\"] {os-distribution = \"alpine\"}\n [\"epel-release\" \"openblas-devel\"] {"
},
{
"path": "opam/quill.opam",
"chars": 1181,
"preview": "# This file is generated by dune, edit dune-project instead\nopam-version: \"2.0\"\nversion: \"1.0.0~alpha3\"\nsynopsis: \"Inter"
},
{
"path": "opam/raven.opam",
"chars": 1304,
"preview": "# This file is generated by dune, edit dune-project instead\nopam-version: \"2.0\"\nversion: \"1.0.0~alpha3\"\nsynopsis: \"Moder"
},
{
"path": "opam/rune.opam",
"chars": 1184,
"preview": "# This file is generated by dune, edit dune-project instead\nopam-version: \"2.0\"\nversion: \"1.0.0~alpha3\"\nsynopsis: \"Funct"
},
{
"path": "opam/sowilo.opam",
"chars": 1167,
"preview": "# This file is generated by dune, edit dune-project instead\nopam-version: \"2.0\"\nversion: \"1.0.0~alpha3\"\nsynopsis: \"Diffe"
},
{
"path": "opam/talon.opam",
"chars": 1066,
"preview": "# This file is generated by dune, edit dune-project instead\nopam-version: \"2.0\"\nversion: \"1.0.0~alpha3\"\nsynopsis: \"Dataf"
},
{
"path": "opam/tolk.opam",
"chars": 963,
"preview": "# This file is generated by dune, edit dune-project instead\nopam-version: \"2.0\"\nversion: \"1.0.0~alpha3\"\nsynopsis: \"A min"
},
{
"path": "opam/vega.opam",
"chars": 1058,
"preview": "# This file is generated by dune, edit dune-project instead\nopam-version: \"2.0\"\nversion: \"1.0.0~alpha3\"\nsynopsis: \"Per-p"
},
{
"path": "packages/brot/README.md",
"chars": 1674,
"preview": "# Brot\n\nFast tokenization library for OCaml.\n\nBrot tokenizes text into token IDs for language models and reverses the\npr"
},
{
"path": "packages/brot/bench/README.md",
"chars": 3156,
"preview": "# Brot Benchmarks\n\nThis directory contains micro-benchmarks for the `brot` library.\nThe suite mirrors HuggingFace's `tok"
},
{
"path": "packages/brot/bench/bench_brot.ml",
"chars": 2266,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/bench/bench_rust/.gitignore",
"chars": 8,
"preview": "/target\n"
},
{
"path": "packages/brot/bench/bench_rust/Cargo.toml",
"chars": 151,
"preview": "[package]\nname = \"bench_tokenizers_rust\"\nedition = \"2021\"\n\n[[bin]]\nname = \"bench_tokenizers_rust\"\npath = \"main.rs\"\n\n[dep"
},
{
"path": "packages/brot/bench/bench_rust/main.rs",
"chars": 4119,
"preview": "use std::fs;\nuse std::path::Path;\nuse std::time::{Duration, Instant};\nuse tokenizers::Tokenizer;\n\nconst WARMUP: usize = "
},
{
"path": "packages/brot/bench/bench_tokenizers.py",
"chars": 1811,
"preview": "from __future__ import annotations\n\nfrom pathlib import Path\nfrom typing import Any, Callable, List\n\nfrom tokenizers imp"
},
{
"path": "packages/brot/bench/brot.thumper",
"chars": 3520,
"preview": "# thumper baseline\n# version: 1\n# suite_name: brot\n# host: 1480401c3b76ed18\n# cpu: Apple M1 Max\n# ocaml: 5.4.1\n# git: 31"
},
{
"path": "packages/brot/bench/data/.gitignore",
"chars": 36,
"preview": "gpt2.json\nbert_base.json\nllama.json\n"
},
{
"path": "packages/brot/bench/data/news_1k.txt",
"chars": 1349,
"preview": "City officials confirmed on Tuesday that the riverside park will reopen this summer after a two-year renovation.\nCrews i"
},
{
"path": "packages/brot/bench/data/wiki_64k.txt",
"chars": 65536,
"preview": "== Early History ==\n\nThe settlement traces its roots to a trading village documented in the 12th-century annals of the S"
},
{
"path": "packages/brot/bench/download_data.sh",
"chars": 640,
"preview": "#!/usr/bin/env bash\nset -euo pipefail\n\nDATA_DIR=\"$(cd \"$(dirname \"$0\")/data\" && pwd)\"\n\necho \"Downloading real-world toke"
},
{
"path": "packages/brot/bench/dune",
"chars": 212,
"preview": "(data_only_dirs data)\n\n(executable\n (name bench_brot)\n (libraries brot thumper unix))\n\n(rule\n (alias runtest)\n (action\n "
},
{
"path": "packages/brot/doc/01-getting-started.md",
"chars": 7085,
"preview": "# Getting Started\n\nThis guide covers the basics: encoding text to token IDs, decoding back\nto text, configuring the pipe"
},
{
"path": "packages/brot/doc/02-pipeline.md",
"chars": 10580,
"preview": "# The Tokenization Pipeline\n\nBrot processes text through up to 5 stages, each optional and independently\nconfigurable:\n\n"
},
{
"path": "packages/brot/doc/03-pretrained.md",
"chars": 5968,
"preview": "# Pretrained Tokenizers\n\nMost users start by loading an existing tokenizer rather than building one\nfrom scratch. Brot r"
},
{
"path": "packages/brot/doc/04-batch-processing.md",
"chars": 9582,
"preview": "# Batch Processing\n\nReal-world usage requires encoding multiple texts into uniform-length\nsequences for model input. Thi"
},
{
"path": "packages/brot/doc/05-algorithms.md",
"chars": 7168,
"preview": "# Choosing a Tokenization Algorithm\n\nBrot supports 5 tokenization algorithms. The three subword algorithms\n(BPE, WordPie"
},
{
"path": "packages/brot/doc/06-hf-tokenizers-comparison.md",
"chars": 25980,
"preview": "# Brot vs. HuggingFace Tokenizers -- A Practical Comparison\n\nThis guide explains how Brot relates to Python's [HuggingFa"
},
{
"path": "packages/brot/doc/dune",
"chars": 54,
"preview": "(mdx\n (files *.md)\n (package brot)\n (libraries brot))\n"
},
{
"path": "packages/brot/doc/index.md",
"chars": 2715,
"preview": "# Brot\n\nBrot tokenizes text into token IDs for language models and reverses the\nprocess. It supports BPE, WordPiece, Uni"
},
{
"path": "packages/brot/examples/01-encode-decode/README.md",
"chars": 1626,
"preview": "# `01-encode-decode`\n\nYour first tokenizer. This example shows the minimal steps to encode text into\ntoken IDs and decod"
},
{
"path": "packages/brot/examples/01-encode-decode/dune",
"chars": 44,
"preview": "(executable\n (name main)\n (libraries brot))\n"
},
{
"path": "packages/brot/examples/01-encode-decode/main.ml",
"chars": 2097,
"preview": "(* Encode and decode.\n\n The simplest possible tokenization: convert text to token IDs and back.\n Demonstrates creati"
},
{
"path": "packages/brot/examples/02-encoding-fields/README.md",
"chars": 1983,
"preview": "# `02-encoding-fields`\n\nUnderstanding encodings. An `Encoding.t` bundles token IDs with alignment\nmetadata: byte offsets"
},
{
"path": "packages/brot/examples/02-encoding-fields/dune",
"chars": 44,
"preview": "(executable\n (name main)\n (libraries brot))\n"
},
{
"path": "packages/brot/examples/02-encoding-fields/main.ml",
"chars": 2379,
"preview": "(* Understanding encodings.\n\n An Encoding bundles token IDs with alignment metadata: byte offsets, word\n indices, se"
},
{
"path": "packages/brot/examples/03-normalizers/README.md",
"chars": 1945,
"preview": "# `03-normalizers`\n\nText normalization before tokenization. Normalizers clean and standardize text\nso that surface varia"
},
{
"path": "packages/brot/examples/03-normalizers/dune",
"chars": 44,
"preview": "(executable\n (name main)\n (libraries brot))\n"
},
{
"path": "packages/brot/examples/03-normalizers/main.ml",
"chars": 2343,
"preview": "(* Text normalization.\n\n Normalizers transform text before tokenization: lowercasing, accent removal,\n Unicode norma"
},
{
"path": "packages/brot/examples/04-pre-tokenizers/README.md",
"chars": 2278,
"preview": "# `04-pre-tokenizers`\n\nPre-tokenization: splitting text into fragments before vocabulary lookup. Each\nfragment carries b"
},
{
"path": "packages/brot/examples/04-pre-tokenizers/dune",
"chars": 44,
"preview": "(executable\n (name main)\n (libraries brot))\n"
},
{
"path": "packages/brot/examples/04-pre-tokenizers/main.ml",
"chars": 1675,
"preview": "(* Pre-tokenization.\n\n Pre-tokenizers split text into fragments before vocabulary-based\n tokenization. Each fragment"
},
{
"path": "packages/brot/examples/05-algorithms/README.md",
"chars": 2050,
"preview": "# `05-algorithms`\n\nFive tokenization algorithms compared side-by-side. Each algorithm splits text\ndifferently based on i"
},
{
"path": "packages/brot/examples/05-algorithms/dune",
"chars": 44,
"preview": "(executable\n (name main)\n (libraries brot))\n"
},
{
"path": "packages/brot/examples/05-algorithms/main.ml",
"chars": 3186,
"preview": "(* Tokenization algorithms.\n\n Five algorithms compared side-by-side: BPE (merge-based), WordPiece (greedy\n longest-m"
},
{
"path": "packages/brot/examples/06-special-tokens/README.md",
"chars": 1908,
"preview": "# `06-special-tokens`\n\nSpecial tokens and post-processing. Post-processors insert tokens like `[CLS]`\nand `[SEP]` after "
},
{
"path": "packages/brot/examples/06-special-tokens/dune",
"chars": 44,
"preview": "(executable\n (name main)\n (libraries brot))\n"
},
{
"path": "packages/brot/examples/06-special-tokens/main.ml",
"chars": 2434,
"preview": "(* Special tokens and post-processing.\n\n Special tokens like [CLS] and [SEP] are inserted by post-processors after\n "
},
{
"path": "packages/brot/examples/07-padding-truncation/README.md",
"chars": 1733,
"preview": "# `07-padding-truncation`\n\nPadding and truncation for batch processing. Models require uniform sequence\nlengths. Padding"
},
{
"path": "packages/brot/examples/07-padding-truncation/dune",
"chars": 44,
"preview": "(executable\n (name main)\n (libraries brot))\n"
},
{
"path": "packages/brot/examples/07-padding-truncation/main.ml",
"chars": 2110,
"preview": "(* Padding and truncation.\n\n Batch processing requires uniform sequence lengths. Padding extends short\n sequences wi"
},
{
"path": "packages/brot/examples/08-decoders/README.md",
"chars": 1815,
"preview": "# `08-decoders`\n\nDecoders convert token strings back to natural text. Different tokenization\nschemes require different d"
},
{
"path": "packages/brot/examples/08-decoders/dune",
"chars": 44,
"preview": "(executable\n (name main)\n (libraries brot))\n"
},
{
"path": "packages/brot/examples/08-decoders/main.ml",
"chars": 2356,
"preview": "(* Decoders.\n\n Decoders convert token strings back to natural text by reversing\n encoding-specific transformations: "
},
{
"path": "packages/brot/examples/09-training/README.md",
"chars": 1538,
"preview": "# `09-training`\n\nTraining tokenizers from scratch. Given a text corpus, each algorithm learns a\nvocabulary tailored to t"
},
{
"path": "packages/brot/examples/09-training/dune",
"chars": 44,
"preview": "(executable\n (name main)\n (libraries brot))\n"
},
{
"path": "packages/brot/examples/09-training/main.ml",
"chars": 3548,
"preview": "(* Training tokenizers.\n\n Train new tokenizers from a text corpus. Each algorithm learns a different\n vocabulary: BP"
},
{
"path": "packages/brot/examples/10-bert-pipeline/README.md",
"chars": 2389,
"preview": "# `10-bert-pipeline`\n\nComplete BERT-style tokenizer pipeline. Assembles all stages: normalizer,\npre-tokenizer, WordPiece"
},
{
"path": "packages/brot/examples/10-bert-pipeline/dune",
"chars": 44,
"preview": "(executable\n (name main)\n (libraries brot))\n"
},
{
"path": "packages/brot/examples/10-bert-pipeline/main.ml",
"chars": 3362,
"preview": "(* BERT-style pipeline.\n\n Assembles all pipeline stages into a complete BERT-style tokenizer:\n normalizer, pre-token"
},
{
"path": "packages/brot/examples/README.md",
"chars": 2381,
"preview": "# Brot Examples\n\nLearn Brot through progressively complex examples. Start with `01-encode-decode`\nand work through the n"
},
{
"path": "packages/brot/examples/x-gpt2-tokenizer/README.md",
"chars": 2832,
"preview": "# `x-gpt2-tokenizer`\n\nLoading a real GPT-2 tokenizer from HuggingFace model files. This example\ndownloads GPT-2's vocabu"
},
{
"path": "packages/brot/examples/x-gpt2-tokenizer/dune",
"chars": 52,
"preview": "(executable\n (name main)\n (libraries brot nx unix))\n"
},
{
"path": "packages/brot/examples/x-gpt2-tokenizer/main.ml",
"chars": 3361,
"preview": "(* Loading a real GPT-2 tokenizer.\n\n Downloads GPT-2's vocabulary and merge files from HuggingFace, builds the\n full"
},
{
"path": "packages/brot/lib/bpe.ml",
"chars": 39748,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/bpe.mli",
"chars": 6306,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/brot.ml",
"chars": 33947,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/brot.mli",
"chars": 21963,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/chars.ml",
"chars": 938,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/chars.mli",
"chars": 1418,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/decoder.ml",
"chars": 14303,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/decoder.mli",
"chars": 4390,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/dune",
"chars": 147,
"preview": "(library\n (name brot)\n (public_name brot)\n (private_modules bpe wordpiece word_level unigram chars)\n (libraries re jsont"
},
{
"path": "packages/brot/lib/encoding.ml",
"chars": 7162,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/encoding.mli",
"chars": 4936,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/normalizer.ml",
"chars": 15625,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/normalizer.mli",
"chars": 3952,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/post_processor.ml",
"chars": 24099,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/post_processor.mli",
"chars": 3149,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/pre_tokenizer.ml",
"chars": 34914,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/pre_tokenizer.mli",
"chars": 5270,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/unigram.ml",
"chars": 8176,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/unigram.mli",
"chars": 2852,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
},
{
"path": "packages/brot/lib/word_level.ml",
"chars": 4588,
"preview": "(*---------------------------------------------------------------------------\n Copyright (c) 2026 The Raven authors. Al"
}
]
// ... and 1198 more files (download for full content)
About this extraction
This page contains the full source code of the raven-ml/raven GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 1398 files (12.2 MB), approximately 3.3M tokens, and a symbol index with 3192 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.