1.0.0 • Published 7 years ago

matrix-generator v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

matrix-generator

Simple generator of matrix.

Installation

npm i matrix-generator --save

Usage

const mGenerator = require('matrix-generator')
const matrix = []
const feature = ['red', 'green']

matrix[0] = 5                                 // amount
matrix[1] = [4, 7, 2, 5, 12]                  // value
matrix[2] = [0, 1, 0, 0, 1]                   // feature
matrix[3] = [[1, 2], [1, 3], [3, 4], [3, 5]]  // relationship (from, to)

const output = mGenerator(matrix, feature)

console.log('- output -----------------------------------------------------------')
console.log(output)
console.log('--------------------------------------------------------------------')

Output

- output -----------------------------------------------------------
[ [ 4, 'red', [ 1, 2 ] ],
  [ 7, 'green' ],
  [ 2, 'red', [ 3, 4 ] ],
  [ 5, 'red' ],
  [ 12, 'green' ] ]
--------------------------------------------------------------------
1.0.0

7 years ago

0.0.1

7 years ago

0.0.2

7 years ago