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
async_streaming
Async streaming API for WASM environments.
error
Error types for WASM bindings
fft
Fast Fourier Transform (FFT) operations for WASM
incremental_pca
Incremental PCA for streaming/online dimensionality reduction in WASM
integrate
Numerical integration and ODE solver functions for WASM
interpolate
Interpolation functions for WASM
linalg
Linear algebra operations for WASM
mfcc
Mel-Frequency Cepstral Coefficients (MFCC) for WASM
optimize
Optimization algorithms for WASM
parallel
Parallel computation utilities using std::thread (compatible with wasm32-wasi / wasm-threads enabled targets).
random
Random number generation for WASM
shared_memory
SharedArrayBuffer / Atomics Rust bindings for WASM.
signal
Signal processing operations for WASM
stats
Statistical functions for WASM
streaming_fft
Streaming FFT processor for real-time audio and sensor data.
utils
Utility functions for WASM bindings
wavelets
Wavelet transform implementations for WASM
webgpu
WebGPU backend for accelerated matrix operations.

Structs§

PerformanceTimer
Performance timing utilities for benchmarking WASM operations

Functions§

alloc_f64_array
Allocate len f64 values in WASM linear memory.
capabilities
Get system capabilities and features available in this build
free_f64_array
Free a buffer previously allocated with alloc_f64_array.
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
view_f64_array
Return a Float64Array view into WASM linear memory at ptr / len.