npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@danielsimonjr/mathts-wasm

v0.1.2

Published

MathTS WebAssembly module - high-performance numerical computing

Readme

@danielsimonjr/mathts-wasm

High-performance WebAssembly module for MathTS, built with AssemblyScript.

Features

  • SIMD Acceleration: Utilizes WebAssembly SIMD for vectorized operations
  • Zero-Copy Operations: Works directly on typed arrays for minimal overhead
  • Comprehensive Math: Scalar, array, matrix, and complex number operations
  • Cross-Platform: Works in browsers, Node.js, Deno, and edge runtimes

Building

# Install dependencies
npm install

# Build debug WASM (with debugging info)
npm run asbuild:debug

# Build release WASM (optimized)
npm run asbuild:release

# Build both
npm run asbuild

Usage

Browser

import { MathTSWasm } from '@danielsimonjr/mathts-wasm';

const wasm = await MathTSWasm.create('/path/to/mathts.wasm');

// Scalar operations
const sum = wasm.add(2, 3);       // 5
const sqrt = wasm.sqrt(16);       // 4
const sin = wasm.sin(Math.PI/2);  // 1

// For array/matrix operations, use the raw exports
const exports = wasm.raw;
// ... work with typed arrays and pointers

Node.js

import { loadWasmSync } from '@danielsimonjr/mathts-wasm';
import fs from 'fs';

const buffer = fs.readFileSync('./build/mathts.wasm');
const { exports } = loadWasmSync(buffer);

console.log(exports.add_f64(2, 3)); // 5

Module Structure

assembly/
├── src/
│   ├── index.ts          # Main entry point
│   ├── types/
│   │   └── complex.ts    # Complex number type
│   ├── ops/
│   │   ├── scalar.ts     # Scalar operations
│   │   ├── array.ts      # Array operations
│   │   ├── matrix.ts     # Matrix operations
│   │   ├── complex-ops.ts    # Complex operations
│   │   └── complex-array.ts  # Complex array operations
│   ├── env/
│   │   └── abort.ts      # Error handling
│   └── bindings/
│       └── wasm-loader.ts  # JS/TS bindings
├── build/                # WASM output
├── tests/
│   └── run.js           # Test runner
├── asconfig.json        # AssemblyScript config
└── package.json

Available Operations

Scalar Operations

  • Basic: add_f64, sub_f64, mul_f64, div_f64, mod_f64, neg_f64
  • Power: sqrt_f64, pow_f64, square_f64, cube_f64, cbrt_f64
  • Exp/Log: exp_f64, log_f64, log10_f64, log2_f64
  • Trig: sin_f64, cos_f64, tan_f64, asin_f64, acos_f64, atan_f64
  • Hyperbolic: sinh_f64, cosh_f64, tanh_f64, asinh_f64, acosh_f64, atanh_f64
  • Rounding: abs_f64, floor_f64, ceil_f64, round_f64, trunc_f64

Array Operations

  • Reductions: array_sum, array_product, array_mean, array_variance, array_min, array_max
  • Norms: array_norm, array_norm_l1, array_norm_linf
  • Element-wise: array_add, array_sub, array_mul, array_div, array_scale
  • BLAS-like: array_dot, array_axpby, array_distance

Matrix Operations

  • Creation: matrix_zeros, matrix_ones, matrix_identity, matrix_diag
  • Arithmetic: matrix_add, matrix_sub, matrix_scale, matrix_multiply
  • Properties: matrix_trace, matrix_norm_frobenius, matrix_transpose
  • BLAS: matrix_gemm, matrix_gemv, matrix_axpy

Complex Operations

  • Arithmetic: complex_add, complex_sub, complex_mul, complex_div
  • Functions: complex_exp, complex_log, complex_sqrt, complex_pow
  • Trig: complex_sin, complex_cos, complex_tan, complex_asin, complex_acos
  • Properties: complex_abs, complex_arg, complex_conj

Performance Notes

  1. SIMD: Enabled by default for vector operations
  2. Memory Layout: Matrices use row-major order
  3. Complex Arrays: Use interleaved storage [re0, im0, re1, im1, ...]

Testing

# Run tests (requires build first)
npm run asbuild:debug
npm test

License

MIT