Executable example center

Start from code that the build verifies

The catalog separates JDistlib scripts, ordinary .stan compatibility fixtures, and general Java APIs. Every example is exercised by ./gradlew check.

51 JDistlib scripts · 41 .stan fixtures · 15 Bayesian models

Stan source compatibility · expanded for 0.8.3

Forty-one ordinary .stan fixtures

These fixtures cover literals, multidimensional arrays and assignments, arrays of vectors/matrices, complex and tuple values, forward-declared, external, recursive, and higher-order functions, sparse/shaped matrix algorithms, structured constraints, broadcasting, probability kernels, quadrature, roots, stiff ODEs, and DAEs. They compile through ModelScript.compileStan and run on JDistlib rather than Stan's C++ runtime.

Stan-inspired modeling-language scripts · expanded in 0.8.x

Fifty-one Stan-inspired model scripts

This section—and only content explicitly carrying the same label—uses JDistlib's Stan-inspired script syntax. The catalog covers conjugate posteriors, regression links, robust and overdispersed likelihoods, control flow and locals, stable log-space mixtures, positive and bounded parameters, ordered vectors, simplexes, transformed blocks, indexing, vectorization, file-backed data, Wiener reaction times, and posterior-predictive RNGs.

General Java examples · not Stan-specific

Choose the Java workflow you need

These examples demonstrate ordinary JDistlib Java APIs. A card is labeled separately when it also includes the Stan-inspired script frontend.

Mixtures

Weighted population models

Evaluate mixture density/CDF/quantiles and generate reproducible draws from multiple regimes.

Open example →
Sparse RJMCMC · public expression array · 0.9.1+

17,000-gene mixed-model selection

Download GSE93272, prepare array expression and clinical covariates, fit a subject random-intercept target, accelerate residual-informed proposals, and resume crash-safe segments.

Read the public-data tutorial →
Open the complete Java file →
Numerical integration

Finite and infinite intervals

Integrate smooth finite functions, positive-tail laws, and whole-line kernels with explicit result diagnostics.

Open example →
Performance

Sampling smoke benchmark

Track vectorized gradient evaluation and NUTS transition throughput without mistaking a smoke run for a JMH benchmark.

Open benchmark →
Reverse autodiff · 0.8.3

Reusable tape and atomic kernels

Lower compiled scripts onto thread-local reusable tapes and compare automatic lowering with a hand-authored primitive target.

Read guide →
Open benchmark →
Java 8

Packaged-JAR compatibility

Compile and run a client against the release JAR on Java 8, independently of the build JVM.

Open smoke test →

Run locally

Compile and validate the whole catalog

./gradlew check
./gradlew validateModelScripts

# Windows
gradlew.bat check
gradlew.bat validateModelScripts

check compiles every Java example against the packaged library and invokes the model-script validator. The validator compiles all fifty-one JDistlib scripts and forty-one ordinary .stan fixtures with representative data or external bindings, checks their gradients, verifies finite initial densities, and executes generated quantities.

Learning paths

Examples are starting points, not substitutes for diagnostics

Use the learning center for conceptual tutorials, the inference guide for computational review, and the JavaDoc for complete signatures.