flipud
Flips a matrix vertically.
Installation
$ npm install compute-flipud
For use in the browser, use browserify.
Usage
var flipud = ;
flipud( x[, opts] )
Flips a matrix vertically.
var matrix = ;var mat = ;mat;/*[ 0 2 01 0 3 ]*/var ud = ;/*[ 1 0 30 2 0 ]*/
By default, the function returns a new matrix instance. To mutate the input matrix, set the copy
option to false
.
var ud =;/*[ 1 0 30 2 0 ]*/var bool = mat === ud ;// returns true
Examples
var matrix =flipud = ;var datamatud i;data = 10 ;for i = 0; i < datalength; i++data i = i;mat = ;/*[ 0 12 34 56 78 9 ]*/ud = ;/*[ 8 96 74 52 30 1 ]*/
To run the example code from the top-level application directory,
$ node ./examples/index.js
Tests
Unit
Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:
$ make test
All new feature development should have corresponding unit tests to validate correct functionality.
Test Coverage
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-cov
Istanbul creates a ./reports/coverage
directory. To access an HTML version of the report,
$ make view-cov
License
Copyright
Copyright © 2015. The Compute.io Authors.