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

@justinelliottcobb/amari-core

v0.3.0

Published

Advanced mathematical computing library with geometric algebra, tropical algebra, and automatic differentiation for JavaScript/TypeScript

Readme

@amari/core

🚀 Advanced Mathematical Computing Library for JavaScript/TypeScript

npm version CI License: MIT

Amari is a high-performance mathematical computing library that brings advanced algebraic structures to JavaScript/TypeScript through WebAssembly. It combines geometric algebra, tropical algebra, dual number automatic differentiation, and cellular automata in a unified framework.

✨ Features

  • 🔢 Geometric Algebra (Clifford Algebra): Multivectors, rotors, and geometric products for 3D rotations and spatial transformations
  • 🌴 Tropical Algebra: Max-plus semiring operations for optimization and neural network applications
  • 📈 Automatic Differentiation: Forward-mode AD with dual numbers for exact derivatives
  • 🔲 Cellular Automata: Geometric cellular automata with multivector states
  • ⚡ WebGPU Acceleration: Optional GPU acceleration for large-scale operations
  • 🦀 Pure Rust Implementation: Memory-safe, high-performance core with WASM bindings
  • 📦 TypeScript Support: Full TypeScript definitions included

📦 Installation

npm install @amari/core

Or with yarn:

yarn add @amari/core

🚀 Quick Start

import init, { WasmMultivector, WasmRotor } from '@amari/core';

async function main() {
  // Initialize the WASM module
  await init();

  // Create basis vectors
  const e1 = WasmMultivector.basis_vector(0);
  const e2 = WasmMultivector.basis_vector(1);

  // Compute geometric product
  const product = e1.geometric_product(e2);
  console.log(product.to_string()); // e12 (bivector)

  // Create a rotor for 90-degree rotation
  const rotor = WasmRotor.from_axis_angle(
    WasmMultivector.basis_vector(2), // z-axis
    Math.PI / 2
  );

  // Rotate a vector
  const vector = WasmMultivector.from_coefficients(
    new Float64Array([1, 0, 0, 0, 0, 0, 0, 0])
  );
  const rotated = rotor.rotate_vector(vector);

  // Clean up WASM memory
  e1.free();
  e2.free();
  product.free();
  rotor.free();
  vector.free();
  rotated.free();
}

main();

📚 Core Concepts

Geometric Algebra

Geometric algebra extends linear algebra with the geometric product, enabling intuitive representation of rotations, reflections, and other transformations:

// Multivector operations
const v1 = WasmMultivector.from_coefficients(coeffs);
const v2 = WasmMultivector.random();

const sum = v1.add(v2);
const product = v1.geometric_product(v2);
const wedge = v1.wedge_product(v2);
const inner = v1.inner_product(v2);

Tropical Algebra

Tropical algebra replaces addition with max and multiplication with addition, useful for optimization:

import { tropical_add, tropical_multiply } from '@amari/core';

// Tropical operations: add = max, multiply = add
const a = 5.0, b = 3.0;
const trop_sum = tropical_add(a, b); // max(5, 3) = 5
const trop_prod = tropical_multiply(a, b); // 5 + 3 = 8

Cellular Automata

Create and evolve cellular automata with geometric algebra states:

const ca = WasmGeometricCA.new(100, 100);

// Set initial configuration
ca.set_cell(50, 50, WasmMultivector.basis_vector(0));

// Evolve the system
for (let i = 0; i < 100; i++) {
  ca.step();
}

console.log(`Generation: ${ca.generation()}`);

🎯 Use Cases

  • Computer Graphics: 3D rotations and transformations using rotors
  • Physics Simulations: Geometric algebra for electromagnetic fields
  • Machine Learning: Tropical neural networks and automatic differentiation
  • Optimization: Tropical algebra for shortest path and scheduling problems
  • Scientific Computing: High-performance mathematical operations
  • Game Development: Efficient spatial transformations and physics

🔧 API Reference

Multivector Operations

  • WasmMultivector.basis_vector(index): Create a basis vector
  • WasmMultivector.scalar(value): Create a scalar multivector
  • WasmMultivector.from_coefficients(array): Create from coefficients
  • geometric_product(a, b): Compute geometric product
  • wedge_product(a, b): Compute wedge (outer) product
  • inner_product(a, b): Compute inner product

Rotor Operations

  • WasmRotor.from_axis_angle(axis, angle): Create rotation rotor
  • WasmRotor.from_bivector(bivector, angle): Create from bivector
  • rotate_vector(vector): Apply rotation to vector
  • compose(other): Compose rotations

Tropical Operations

  • tropical_add(a, b): Tropical addition (max)
  • tropical_multiply(a, b): Tropical multiplication (addition)
  • tropical_power(base, exp): Tropical exponentiation

🔍 Examples

Check out the examples directory for more detailed usage:

🏗️ Building from Source

# Clone the repository
git clone https://github.com/justinelliottcobb/Amari.git
cd Amari/amari-wasm

# Install dependencies
npm install

# Build WASM module
npm run build

# Run tests
npm test

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. See CONTRIBUTING.md for details.

📄 License

MIT License - see LICENSE for details.

🙏 Acknowledgments

  • Built with Rust and wasm-bindgen
  • Inspired by geometric algebra libraries like GAViewer and Ganja.js
  • Tropical algebra concepts from discrete mathematics

📬 Contact


Made with ❤️ and 🦀 by the Amari team