lib/sbm.js
function(sbmA, sbmB) {
    // if not the same sizes
    if (sbmA.x != sbmB.x || sbmA.y != sbmB.y) {
      return
    }
    // create the matrix
    var mat = {}
    mat.x = sbmA.x
    mat.y = sbmA.y
    mat.data = []
    // populate
    for (var i = 0; i < mat.x; i++) {
      mat.data[i] = _.union(sbmA.data[i], sbmB.data[i]).sort()
    }
    // return matrix
    return mat
  }
function(sbmA, sbmB) {
    // if not the same sizes
    if (sbmA.x != sbmB.x || sbmA.y != sbmB.y) {
      return
    }
    // create the matrix
    var mat = {}
    mat.x = sbmA.x
    mat.y = sbmA.y
    mat.data = []
    // populate
    for (var i = 0; i < mat.x; i++) {
      mat.data[i] = _.union(sbmA.data[i], sbmB.data[i]).sort()
    }
    // return matrix
    return mat
  }
function ( sbmA , sbmB ) { // if not the same sizes if ( sbmA . x != sbmB . x || sbmA . y != sbmB . y ) { return } // create the matrix var mat = { } mat . x = sbmA . x mat . y = sbmA . y mat . data = [ ] // populate for ( var i = 0 ; i < mat . x ; i ++ ) { mat . data [ i ] = _ . union ( sbmA . data [ i ] , sbmB . data [ i ] ) . sort ( ) } // return matrix return mat }
OR the two matrices
OR the two matrices