Builtin Functions

Builtin Functions Reference

RunMat's architecture is designed for rapid implementation of MATLAB-compatible functions. Our macro-based builtin system, combined with modern tooling and community contributions, enables efficient expansion of the function library toward full MATLAB compatibility.

50+
Functions Implemented (Week 1)
~1000
MATLAB Core Functions
Open
Community Driven

Quick Reference

Here's a quick overview of the most commonly used functions:

Mathematical Constants
piπ constant
eEuler's number
infInfinity
nanNot a Number
Array Creation
zeros(m, n) - Create m×n matrix of zeros
ones(m, n) - Create m×n matrix of ones
eye(n) - Create n×n identity matrix
rand(m, n) - Create m×n matrix of random numbers
Mathematical Functions
sin(x), cos(x), tan(x)
asin(x), acos(x), atan(x)
exp(x), log(x), log10(x)
sqrt(x), abs(x), sign(x)
round(x), floor(x), ceil(x)
min(x), max(x), sum(x)
mean(x), std(x), var(x)
real(x), imag(x), angle(x)
Plotting Functions
plot(x, y) - 2D line plot
scatter(x, y) - 2D scatter plot
bar(x, y) - Bar chart
histogram(x) - Histogram
scatter3(x, y, z) - 3D scatter plot

Macro-Based Architecture

RunMat's runtime_builtin macro dramatically simplifies how MATLAB functions are implemented. What traditionally requires complex registration code and manual type handling becomes a simple attribute on a Rust function, allowing us to implement new functions at a rapid pace.

Simple Implementation

#[runtime_builtin(name = "sin")]
fn sin_builtin(x: f64) -> Result<f64, String>
#[runtime_builtin(name = "sin")]
fn sin_matrix(x: Matrix) -> Result<Matrix, String>

Automatic Features

Function Overloading
Multiple implementations with the same name automatically dispatch based on argument types
Error Propagation
Rust's Result type integrates seamlessly with MATLAB's error handling
Runtime Registration
Functions are automatically discovered and registered at startup
Type Safety
Compile-time guarantees prevent runtime type errors

Compatibility Goals

Our roadmap targets full compatibility with MATLAB's core function set, with plans to extend support to major toolboxes. The modular architecture enables parallel development of different function categories, accelerating our path to comprehensive compatibility.

Core MATLAB Functions

Essential mathematical, statistical, and array manipulation functions that form the foundation of MATLAB compatibility

Signal Processing Toolbox

Advanced signal analysis, filtering, and transformation functions for engineering and scientific applications

Statistics & Machine Learning

Comprehensive statistical analysis and machine learning algorithms for data science workflows

Additional Toolboxes on the Roadmap

Control System Toolbox
Image Processing Toolbox
Optimization Toolbox
Symbolic Math Toolbox
Curve Fitting Toolbox
Deep Learning Toolbox
Parallel Computing Toolbox
Communications Toolbox
Financial Toolbox

Community contributions welcome for any of these toolboxes. Implementation priorities will be guided by user demand and community interest.

Join the Compatibility Effort

RunMat's builtin system is designed for community contributions. Help us achieve full MATLAB compatibility by implementing missing functions and expanding toolbox support.

High-Impact Areas:

  • • Signal processing functions (FFT, filters)
  • • Statistical analysis (regression, distributions)
  • • Linear algebra expansions (sparse matrices)
  • • Image processing operations

What We Provide:

  • • Clear implementation patterns
  • • Automated testing framework
  • • Performance benchmarking tools
  • • MATLAB compatibility validation
Browse existing patterns and contribute on GitHub. Pull requests and discussions are welcome.