function _fit(matrix, size, defaultValue) {
    var // copy the array
    newSize = matrix._size.slice(0);

    var changed = false; // add dimensions when needed

    while (newSize.length < size.length) {
      newSize.push(0);
      changed = true;
    } // enlarge size when needed


    for (var i = 0, ii = size.length; i < ii; i++) {
      if (size[i] > newSize[i]) {
        newSize[i] = size[i];
        changed = true;
      }
    }

    if (changed) {
      // resize only when size is changed
      _resize(matrix, newSize, defaultValue);
    }
  }
Enlarge the matrix when it is smaller than given size.
If the matrix is larger or equal sized, nothing is done.
@memberof DenseMatrix
@param {DenseMatrix} matrix           The matrix to be resized
@param {number[]} size
@param {*} defaultValue          Default value, filled in on new entries.
@private