Skip to main content

Crate scirs2_wasm

Crate scirs2_wasm 

Source
Expand description

§SciRS2-WASM: WebAssembly Bindings for SciRS2

High-performance scientific computing in the browser and Node.js.

§Features

  • Pure Rust: 100% safe Rust code compiled to WASM
  • SIMD Support: Optional WASM SIMD (wasm32-simd128) acceleration
  • Async Operations: Non-blocking computations with async/await
  • TypeScript Support: Full TypeScript type definitions
  • Memory Efficient: Optimized memory management for browser environments
  • Zero-copy: Direct array buffer access when possible

§Modules

  • array: N-dimensional array operations
  • linalg: Linear algebra (matrix operations, decompositions)
  • stats: Statistical functions (distributions, tests, descriptive stats)
  • fft: Fast Fourier Transform operations
  • signal: Signal processing (filtering, convolution, wavelets)
  • integrate: Numerical integration and ODE solvers
  • interpolate: Interpolation (linear, spline, Lagrange, PCHIP, Akima)
  • optimize: Optimization algorithms (minimize, curve fitting)
  • random: Random number generation and distributions

§Example Usage (JavaScript)

import * as scirs2 from 'scirs2-wasm';

// Initialize the library
await scirs2.default();

// Create arrays
const a = scirs2.array([1, 2, 3, 4]);
const b = scirs2.array([5, 6, 7, 8]);

// Perform operations
const sum = scirs2.add(a, b);
const dot = scirs2.dot(a, b);

// Statistical operations
const mean = scirs2.mean(a);
const std = scirs2.std(a);

// Linear algebra
const matrix = scirs2.array2d([[1, 2], [3, 4]]);
const inv = scirs2.inv(matrix);
const det = scirs2.det(matrix);

Modules§

array
N-dimensional array operations for WASM
error
Error types for WASM bindings
fft
Fast Fourier Transform (FFT) operations for WASM
integrate
Numerical integration and ODE solver functions for WASM
interpolate
Interpolation functions for WASM
linalg
Linear algebra operations for WASM
optimize
Optimization algorithms for WASM
random
Random number generation for WASM
signal
Signal processing operations for WASM
stats
Statistical functions for WASM
utils
Utility functions for WASM bindings

Structs§

PerformanceTimer
Performance timing utilities for benchmarking WASM operations

Functions§

capabilities
Get system capabilities and features available in this build
has_simd_support
Check if WASM SIMD is supported in the current environment
init
Initialize the WASM module with panic hooks and logging
log
Log a message to the browser console
memory_usage
Memory usage information for the WASM module
version
Get the version of SciRS2-WASM