🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More

ml-matrix

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
m

ml-matrix

Matrix manipulation and computation library

6.12.1
latest
100

Supply Chain Security

100

Vulnerability

100

Quality

87

Maintenance

100

License

Version published
Weekly downloads
447K
2.49%
Maintainers
0
Weekly downloads
 
Created
Issues
20

What is ml-matrix?

The ml-matrix npm package provides a comprehensive set of tools for matrix operations and linear algebra. It is designed to be used in machine learning and data science applications, offering a variety of functionalities such as matrix creation, manipulation, decomposition, and solving linear systems.

What are ml-matrix's main functionalities?

Matrix Creation

This feature allows you to create matrices from arrays. The code sample demonstrates how to create a 2x2 matrix and print it.

const { Matrix } = require('ml-matrix');
const A = new Matrix([[1, 2], [3, 4]]);
console.log(A.toString());

Matrix Operations

This feature supports various matrix operations such as addition, subtraction, multiplication, etc. The code sample shows how to add two matrices.

const { Matrix } = require('ml-matrix');
const A = new Matrix([[1, 2], [3, 4]]);
const B = new Matrix([[5, 6], [7, 8]]);
const C = A.add(B);
console.log(C.toString());

Matrix Decomposition

This feature provides methods for matrix decomposition like Singular Value Decomposition (SVD), LU decomposition, etc. The code sample demonstrates how to perform SVD on a matrix.

const { Matrix, SingularValueDecomposition } = require('ml-matrix');
const A = new Matrix([[1, 2], [3, 4]]);
const svd = new SingularValueDecomposition(A);
console.log(svd.diagonalMatrix.toString());

Solving Linear Systems

This feature allows solving linear systems of equations. The code sample shows how to solve the system Ax = b.

const { Matrix } = require('ml-matrix');
const A = new Matrix([[1, 2], [3, 4]]);
const b = [5, 6];
const x = A.solve(b);
console.log(x.toString());

Other packages similar to ml-matrix

FAQs

Package last updated on 11 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts