Binsearch
Perform a 1d bin search where bins are defined by an input edge vector.
Examples
var binsearch =edges numEdges = 11idx;// Create a 1d edge array...edges = numEdges ;// Note: numBins = numEdges-1for var i = 0; i < numEdges; i++edges i = i-05;// Perform a bin search...idx = ;// returns idx = 0idx = ;// returns idx = 1idx = ;// returns idx = 5idx = ;// returns idx = 6idx = ;// returns idx = -1idx = ;// returns idx = 10
Tests
Unit tests use the Mocha test framework with Chai assertions.
Assuming you have installed Mocha, execute the following command in the top-level application directory to run the tests:
$ mocha
All new feature development should have corresponding unit tests to validate correct functionality.
License
Copyright
Copyright © 2014. Athan Reines.