Construct an array of arrays from a Matrix.
$ npm install dstructs-to-arrayFor use in the browser, use browserify.
var toArray = require( 'dstructs-to-array' );Constructs an array of arrays. To convert a matrix,
var mat = matrix( [ 2, 2 ] );
var arr = toArray( mat )
// returns [ [ 0, 0 ], [ 0, 0 ] ]If provided an empty matrix, the function returns an empty array.
var mat, arr;
mat = matrix( [0,0] );
arr = toArray( mat );
// returns []
mat = matrix( [0,10] );
arr = toArray( mat );
// returns []
mat = matrix( [10,0] );
arr = toArray( mat );
// returns []var toArray = require( 'dstructs-to-array' ),
matrix = require( 'dstructs-matrix' );
var data, mat;
data = new Int32Array( [ 1, 2, 3, 4 ] );
mat = matrix( data, [ 2, 2 ] );
console.log( toArray( mat ) );
// returns [ [ 1, 2 ], [ 3, 4 ] ]To run the example code from the top-level application directory,
$ node ./examples/index.jsUnit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:
$ make testAll new feature development should have corresponding unit tests to validate correct functionality.
This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
$ make test-covIstanbul creates a ./reports/coverage directory. To access an HTML version of the report,
$ make view-covCopyright © 2015. The Compute.io Authors.