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

@antononyshch/matrixts

v1.1.4

Published

A Library for work with matrices

Downloads

16

Readme

Matrixts

Matrixts is a small library for matrices written in TypeScript with zero dependencies!

It's just a class with static methods which cover almost all operations over matrices you need to work with.

Table of content

Installation

npm install @antononyshch/matrixts

Features

  • Check if matrices are equal
  • Getting identity/unit matrices with
    • Built in; dimension 2x2, 3x3
    • Any dimension you may want
  • Multiplication
    • Built in; multiplication 3x1, 2x2, 3x3
    • Multiplications of any dimension
  • Addition
  • Subtraction
  • Power
  • Transposition
  • Exclude / Minor
  • Determinants
  • Inverse

Suppose we have some arbitrary matrices:

export const m2x2_1 = [
    [4, 7],
    [0, -4]
]
export const m2x2_2 = [
    [1, -5],
    [2, 4]
]

export const m3x3_1 = [
    [4, 7, 2],
    [0, -4, 1],
    [9, -3, 5]
]
export const m3x3_2 = [
    [1, -5, 2],
    [2, 4, -1],
    [4, 3, 9]
]
export const m4x4_1 = [
    [1, -5, 2, 5],
    [2, 4, -1, 2],
    [4, 3, 9, 1],
    [1, 2, 3, 4]
]
  1. Equality

    return Matrix.equal(m3x3_1, m3x3_1);
    // Result: true
  2. Unit/Identity matrices

    • Unit 2x2
    Matrix.getUnit2x2();
    // Result:
    <!-- [
        [1, 0],
        [0, 1]
    ] -->
    • Unit 3x3
    Matrix.getUnit3x3();
    // Result:
    <!-- [
        [1, 0, 0],
        [0, 1, 0],
        [0, 0, 1]
    ] -->
    • Arbitrary unit matrix
    Matrix.getUnit(4);
    // Result:
    <!-- [
        [1, 0, 0, 0],
        [0, 1, 0, 0],
        [0, 0, 1, 0]
        [0, 0, 0, 1]
    ] -->
  3. Multiplication

    • To number
    Matrix.mulToN(m3x3_1, 2);
    // Result:
    <!-- [
        [8, 14, 4],
        [0, -8, 2],
        [18, -6, 10]
    ] -->
    • Multiplication
    Matrix.mul(m3x3_1, m3x3_2);
    // Result:
    <!-- [
        [4, 14, 8],
        [-0, -16, 3],
        [18, 3, 45]
    ] -->
    • Multiplication 2x2
    Matrix.mul2x2(m2x2_1, m2x2_2);
    // Result:
    <!-- [
        [4, 14],
        [-0, -16]
    ] -->
    • Multiplication 3x3
    Matrix.mul3x3(m3x3_1, m3x3_2);
    // Result:
    <!-- [
        [4, 14, 8],
        [-0, -16, 3],
        [18, 3, 45]
    ] -->
    • Multiplication 3x3 to vector
    Matrix.mul3x1(m3x3_1, v);
    // Result:
    [[65, 12, 22]]
  4. Addition

    Matrix.add(m2x2_1, m2x2_2);
    // Result:
    <!-- [
        [5, 2],
        [2, 0]
    ] -->
  5. Subtraction

    Matrix.sub(m2x2_1, m2x2_2);
    // Result:
    <!-- [
        [3, 12],
        [-2, -8]
    ] -->
  6. Power

    Matrix.power(m2x2_1, 2);
    // Result:
    <!-- [
        [16, 49],
        [0, 16]
    ] -->
  7. Transposition

    Matrix.trans(m3x2_1);
    // Result:
    <!-- [
        [1, 2],
        [-5, 4],
        [2, -1]
    ] -->
  8. Exclude

    Matrix.exclude(m4x4_1, 2, 2);
    // Result: 
    [
        [1, 2, 5]
        [4, 9, 1]
        [1, 3, 4]
    ]
  9. Determinants

    • Determinant 2x2
    Matrix.determ2x2(m2x2_1);
    // Result: -16
    • Determinant 3x3
    Matrix.determ3x3(m3x3_1);
    // Result: 67
    • Determinant 4x4
    Matrix.determ4x4(m4x4_1);
    // Result: 674
  10. Inverse

    • Inverse 2x2
    Matrix.inverse2x2(m2x2_1);
    // Result:
    <!-- [
       [0.25, 0.4375],
       [0,	-0.25],
    ] -->
    • Inverse 3x3
    Matrix.inverse3x3(m3x3_1);
    // Result:
    <!-- [
        [-0.2537313401699066, -0.611940324306488, 0.2238806039094925],
        [0.13432836532592773, 0.02985074557363987, -0.05970149114727974],
        [0.5373134613037109, 1.1194030046463013, -0.23880596458911896]
    ] -->