zetamatrix

0.0.3 • Public • Published

Zeta Matrix

Introduction

This is a simple matrix library including the following functions:

  1. Addition
  2. Subtraction
  3. Multiplication
  4. Entrywise multiplication

How to use

//Create a matrix object
var matrix = new Matrix([number of row], [number of col]);
 
//Add value to the matrix
matrix.write(1).write(2).write(3);
 
//Add all values to the matrix
matrix.writeAll(
    1, 2, 3,
    4, 5, 6,
    7, 8, 9
);
matrix.print(); //Print the matrix
 
1                 2                 3                 
4                 5                 6                 
7                 8                 9      
 
//Transpose
var matrixT = matrix.transpose(); //matrix will not changed.
 
//Matrix
1                 2                 3                 
4                 5                 6                 
7                 8                 9       
 
//MatrixT
1                 4                 7                 
2                 5                 8                 
3                 6                 9  
 
//Addition (add) / Subtraction (subtract) / Multiplication (multiply)
//Parameter [Const / Matrix]
matrix.add(3).print(); //Note that the matrix will be updated.
4                 5                 6                 
7                 8                 9                 
10                11                12       
 
matrix.add(matrixT).print();
5                 9                 13                
9                 13                17                
13                17                21
 
//Clone the matrix
var newMatrix = matrix.clone();

Readme

Keywords

none

Package Sidebar

Install

npm i zetamatrix

Weekly Downloads

1

Version

0.0.3

License

ISC

Unpacked Size

7.02 kB

Total Files

3

Last publish

Collaborators

  • zelcakok