Browse the documentation

Preview documentation for AEL Beta 0.0.1 — launching soon

Scientific computing

Scientific work in AEL, the Agent Engineering Language, will come from optional packages. Optional packages will provide numerical arrays, complex numbers and linear algebra, and optimization, signal processing, integration and automatic differentiation. A program that does not use them will carry none of their code, and a console program that uses them will need no server.

Status

Planned for AEL Beta 0.0.1. AEL is not available yet.

Package names on this page are preview naming and may change before launch.

The packages

PackageWhat it will provide
math/arrayTyped dense arrays with views, slicing, broadcasting, an explicit memory layout and checked shape arithmetic.
math/linalgVector and matrix operations, factorizations, linear solves and eigenvalue problems.
math/sparseDeclared sparse formats, sparse arithmetic and solvers, and checked conversion to and from dense arrays.
math/optimizationConstrained and unconstrained optimization and least squares, with a convergence status on every result.
math/signalFiltering, transforms, spectral analysis and streaming signal operations with bounded state.
math/integrationNumerical quadrature and the integration of ordinary differential equations, with tolerances and event handling.
math/randomSeeded generators, independent streams derived from one seed, and common distributions.
math/autodiffForward and reverse automatic differentiation for the operations it lists.

You will add each package on its own with ael pack add (command names may change before launch):

Preview syntax — may change before launch
ael pack add math/array
ael pack add math/linalg
ael pack add math/optimization

These packages, like every AEL package, will be written in AEL and ship as compiled, verified AEL, with no bundled native code and no install scripts. Robotics and quantum packages will build on the same arrays and linear algebra.

Checked numerical results

  • Shapes will be checked. An array's element type, shape and layout will be part of its value. Mismatched dimensions, and dimensions whose size would overflow, will fail with a typed error instead of producing a wrong answer.
  • Solvers will report how they ended. Converged, did not converge, hit its iteration limit, or met an ill-conditioned input: each will be a separate outcome that your code handles.
  • Tolerances will be explicit. Integration, optimization and solvers will take the tolerances and step limits you set, and report the error estimate they reached where the method provides one.
  • Randomness will be reproducible. A seed and the package version will reproduce the same stream. The generators in math/random will be for simulation and sampling, not for secrets.
  • Relaxed modes will be opt-in. A mode that relaxes exact reproducibility, such as reordering a sum, will have to be selected explicitly.
  • Copies will be visible. Views will share memory only when ownership and layout allow it; otherwise the copy will be made and reported.

Numerical work will run within the same budgets as the rest of your program, and packages will not start threads outside them.

Agents and numerical code

A typical pattern will keep the numbers deterministic and let a model do what it is good at: a model-driven node will propose an experiment or explain a result, and deterministic nodes will compute.

Preview syntax — may change before launch
# agents/analysis.agent.ael
agent analysis(input: Dataset) -> Report {
    config {
        nodes: [fitter = fit, writer = explain];
        edges: [fit_to_explain(fitter, writer)];
        starts: [fitter];
        completion: writer.result;
    }
}
Preview syntax — may change before launch
# nodes/fit.node.ael
node fit(input: Dataset) -> FitResult {
    return fit_curve(input);
}

fn fit_curve(input: Dataset) -> FitResult {
    # Deterministic: uses the optimization package and calls no model.
}

The deterministic node will cost no model tokens, and its result will reach the model only as typed data. See Agents, nodes and edges. The body of fit_curve is a placeholder, as A first agent explains.

Honest limits

  • Floating-point and complex numbers are not yet part of the preview syntax; their widths, layout and rules will be described when the syntax is final. See Numbers.
  • Each package will list the operations it covers and those it does not. The packages will be written for AEL, not copies of another language's libraries.
  • Timing and size figures will be published only with their measurements.
  • To run scientific programs you already have in another language, call them as tools; see Calling your existing programs.