# underscore-matrix

> Module which contains the standard operation of the square matrices

Latest version **0.1.0** (published 2014-10-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install underscore-matrix
pnpm add underscore-matrix
yarn add underscore-matrix
bun add underscore-matrix
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2014-10-28 |
| First published | 2014-10-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Anton Nosenko |
| Maintainers | nos.anton |
| Keywords | matrix, math, underscore-matrix |

## Links

- npm: https://www.npmjs.com/package/underscore-matrix
- Repository: https://github.com/voogryk/underscore-matrix
- Issues: https://github.com/voogryk/underscore-matrix/issues
- npm.io page: https://npm.io/package/underscore-matrix

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2014-10-28
- 0.0.5 — 2014-10-27
- 0.0.4 — 2014-10-27
- 0.0.3 — 2014-10-27
- 0.0.2 — 2014-10-27
- 0.0.1 — 2014-10-27

## README

underscore-matrix
=================

Module which contains the standard operation of the square matrices.

Version
------

0.1.0

Installation
------------

```sh
$ npm install underscore-matrix
```

Initialization
----------------

```
var _matrix = require("underscore-matrix");
```

Functions
--------------

 - Determinant
 - Summary
 - Scalar summary
 - Multiply
 - Scalar multiply
 - Matrix inversion
 - Minor
 - Identity matrix
 - Check is array square matrix

    ###Determinant
    
    ```javscript
    _matrix.determinant(matrix);
    ```
    It will return object:
    
    ```javascript
    {
        error:"Some error message",  //or false if no errors
        value:1.23                   //Float number - determinant of matrix (can be undefinde if error)
    }
    ```
    ###Summary
    ```javascript
    _matrix.summary(matrixA,matrixB);
    //or
    _matrix.sum(matrixA,matrixB);
    ```
    It will return object:
    
    ```javascript
    {
        error:"Some error message",       //or false if no errors
        value:[[1,1,1],[2,2,2],[3,3,3]]   //Result matrix with float numbers - summary of matrixA and matrixB (can be undefinde if error)
    }
    ```
    **IMPORTANT!**  *'matrixA' and 'matrixB' must be square with the same size* 
    ###Scalar summary
    ```javascript
    _matrix.sSummary(scalarNumber,matrix);
    //or
    _matrix.ssum(scalarNumber,matrix);
    ```
    It will return object:
    
    ```javascript
    {
        error:"Some error message",       //or false if no errors
        value:[[1,1,1],[2,2,2],[3,3,3]]   //Result matrix with float numbers - summary of scalarNumber and matrix (can be undefinde if error)
    }
    ```
    Sample:
    ```javascript
    var sum = _matrix.ssum(1,[
        [1,2,3],
        [4,5,6],
        [7,8,9]
    ]).value;
    
    //sum = [
    //          [2,3,4],
    //          [5,6,7],
    //          [8,9,10]
    //      ]
    ```
    ###Multiply
    ```javascript
    _matrix.multiply(matrixA,matrixB);
    //or
    _matrix.mult(matrixA,matrixB);
    ```
    It will return object:
    
    ```javascript
    {
        error:"Some error message",       //or false if no errors
        value:[[1,1,1],[2,2,2],[3,3,3]]   //Result matrix with float numbers - multiply of matrixA*matrixB (can be undefinde if error)
    }
    ```
    **IMPORTANT!**  *'matrixA' and 'matrixB' must be square with the same size* 
    ###Scalar multiply
    ```javascript
    _matrix.sMultiply(scalarNumber,matrix);
    //or
    _matrix.smul(scalarNumber,matrix);
    ```
    It will return object:
    
    ```javascript
    {
        error:"Some error message",       //or false if no errors
        value:[[1,1,1],[2,2,2],[3,3,3]]   //Result matrix with float numbers - multiply of scalarNumber and matrix (can be undefinde if error)
    }
    ```
    Sample:
    ```javascript
    var mul = _matrix.ssum(2,[
        [1,2,3],
        [4,5,6],
        [7,8,9]
    ]).value;
    
    //mul = [
    //          [2,4,6],
    //          [8,10,12],
    //          [14,16,18]
    //      ]
    ```
    ###Matrix inversion
    ```javascript
    _matrix.inverse(matrix);
    ```
     It will return object:
    
    ```javascript
    {
        error:"Some error message",       //or false if no errors
        value:[[1,1,1],[2,2,2],[3,3,3]]   //Inverse of a matrix (can be undefinde if error)
    }
    ```
     **IMPORTANT!**  *determinant of matrix can't be 0* 
    ###Minor
    Return minor of matrix
    ```javascript
    _matrix.minor(di,dj,matrix);
    ```
    It will return object:
    
    ```javascript
    {
        error:"Some error message",       //or false if no errors
        value:[[1,1,1],[2,2,2],[3,3,3]]   //Minor matrix or undefinde if error
    }
    ```
    Sample:
    ```javascript
    var minor = _matrix.minor(0,1,[
                                    [1,2,3],
                                    [11,12,13],
                                    [21,22,23]
                                ]).value;
    
    // minor = [ 
    //          [ 11, 13 ], 
    //          [ 21, 23 ] 
    //        ]
    ```
    ###Identity matrix
    ```javascript
    _matrix.I(n);
    ```
    It will return object:
    
    ```javascript
    {
        error:"Some error message",       //or false if no errors
        value:[[1,0,0],[0,1,0],[0,0,1]]   //n-size identity matrix (can be undefinde if error)
    }
    ```
    ###Check is array square matrix
    ```javascript
    _matrix.isSquareMatrix(matrix);
    ```
      It will return object:
    
    ```javascript
    {
        error:"Some error message",       //or false if matrix is square
        value:[[1,1,1],[2,2,2],[3,3,3]]   //matrix 
    }
    ```  
   If some of matrix elements is numeric string, this function will convert them to float numbers and return matrix with only float type elements.

License
---------
MIT

####Enjoy!

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