# @thomas-inst/matrix

> A matrix implementation

Latest version **1.0.1** (published 2020-10-21) · GPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install @thomas-inst/matrix
pnpm add @thomas-inst/matrix
yarn add @thomas-inst/matrix
bun add @thomas-inst/matrix
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-10-21 |
| First published | 2020-10-21 |
| Weekly downloads | 0 |
| License | GPL-3.0-or-later |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Rafael Nájera |
| Maintainers | rafaelnajera |

## Links

- npm: https://www.npmjs.com/package/@thomas-inst/matrix
- npm.io page: https://npm.io/package/@thomas-inst/matrix

## Recent versions

- 1.0.1 (latest) — 2020-10-21
- 1.0.0 — 2020-10-21

## README

## Matrix

This package provides a class with basic matrix manipulations

### Install
`npm i @thomas-inst/matrix --save`

### Usage
   
    import {Matrix} from '/your/installation/path/Matrix.js'
    
Create a matrix
    
    let m = new Matrix(20, 10, -1)
    // m contains a matrix of 20 rows x 10 columns 
    // with each element initialized to -1
   
Note: 
* Elements can have anything as their values (string, int, object, ...)
* Rows and columns are numbered starting from 0

Get / Set any value
    

    let v12 = m.getValue(1,2)
    // vl12 ==> -1

    m.setValue(1,2, 123)
    // m.getValue(1,2)  ===> 123
    
Log the matrix to the console

    m.logMatrix()
    
Compare it to other matrix


    let m2 = new Matrix(20, 10, '-')
    m.isEqualTo(m2)
    // ===> false
    
    
Get rows and columns

    let r1 = m.getRow(1)
    let c1 = m.getColumn(1)
    
Add and delete columns

    m.addColumnAfter(1, -2) 
    // m now has 11 columns, with column 2 containing the value -2
    
    m.deleteColumn(2) 
    // m has 10 columns again

Clone it!    
    
    let m3 = m.clone()
    
    
### Development

---
_Source: https://npm.io/package/@thomas-inst/matrix · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
