Standard Library

The AodhML standard library provides core functionality organized into modules.

Prototype Status: The standard library is partially implemented. Listed modules marked "Planned" are not yet available.

Core Modules

ModuleDescriptionStatus
std:ioConsole I/O, file operationsPartial
std:mathMathematical functionsPartial
std:randomPseudo-random number generationPartial
std:stringString manipulationPartial
std:arrayArray/List operationsPartial
std:mapMap/dictionary operationsPlanned

AI/ML Modules

ModuleDescriptionStatus
std:tensorTensor creation and operationsPartial
std:nnNeural network layersPlanned
std:optimOptimization algorithmsPlanned
std:lossLoss functionsPlanned
std:datasetDataset loading and batchingPlanned

IO Functions

fn println(...args)              // Print to stdout with newline
fn print(...args)               // Print to stdout without newline
fn read_line() -> String        // Read a line from stdin
fn read_file(path: String) -> Result<String, Error>
fn write_file(path: String, content: String) -> Result<void, Error>

Math Functions

fn abs(x: f64) -> f64
fn sqrt(x: f64) -> f64
fn pow(base: f64, exp: f64) -> f64
fn sin(x: f64) -> f64
fn cos(x: f64) -> f64
fn tan(x: f64) -> f64
fn log(x: f64) -> f64
fn exp(x: f64) -> f64
fn floor(x: f64) -> f64
fn ceil(x: f64) -> f64
fn round(x: f64) -> f64

const PI: f64 = 3.141592653589793
const E: f64 = 2.718281828459045

Tensor Functions

fn zeros(shape: [u32]) -> Tensor<f32>
fn ones(shape: [u32]) -> Tensor<f32>
fn randn(shape: [u32]) -> Tensor<f32>
fn matmul(a: Tensor<f32>, b: Tensor<f32>) -> Tensor<f32>
fn transpose(t: Tensor<f32>) -> Tensor<f32>
fn stack(tensors: [Tensor<f32>]) -> Tensor<f32>
fn concat(tensors: [Tensor<f32>], axis: u32) -> Tensor<f32>