redimension the arrays
502274
private void redimNodeArrays(int newsize) {
        int len = newsize < lo.length ? newsize : lo.length;
        char[] na = new char[newsize];
        System.arraycopy(lo, 0, na, 0, len);
        lo = na;
        na = new char[newsize];
        System.arraycopy(hi, 0, na, 0, len);
        hi = na;
        na = new char[newsize];
        System.arraycopy(eq, 0, na, 0, len);
        eq = na;
        na = new char[newsize];
        System.arraycopy(sc, 0, na, 0, len);
        sc = na;
    }
499096
function flatten() {
    var arr = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        arr[_i] = arguments[_i];
    }
    var i = 0;
    var result = [];
    while (i < arr.length) {
        var itm = arr[i];
        if (is_1.isArray(itm))
            result = result.concat(flatten.apply(void 0, itm));
        else
            result = result.concat([itm]);
        i++;
    }
    return result;
}
524214
def array_to_ranges(ar)
      prev = ar[0]

      ranges = ar.slice_before do |e|
        prev2 = prev
        prev = e
        prev2 + 1 != e
      end.map { |a| a[0]..a[-1] }

      ranges
    end
125847
function _reduce (mat, dim, callback) {
  let i, ret, val, tran

  if (dim <= 0) {
    if (!Array.isArray(mat[0])) {
      val = mat[0]
      for (i = 1; i < mat.length; i++) {
        val = callback(val, mat[i])
      }
      return val
    } else {
      tran = _switch(mat)
      ret = []
      for (i = 0; i < tran.length; i++) {
        ret[i] = _reduce(tran[i], dim - 1, callback)
      }
      return ret
    }
  } else {
    ret = []
    for (i = 0; i < mat.length; i++) {
      ret[i] = _reduce(mat[i], dim - 1, callback)
    }
    return ret
  }
}
1102316
def _call(self, x, out):
        """"""
        with writable_array(out) as out_arr:
            resize_array(x.asarray(), self.range.shape, offset=self.offset,
                         pad_mode=self.pad_mode, pad_const=self.pad_const,
                         direction='forward', out=out_arr)
720203
function getCommonArray(array1, array2, width) {
  var newArray = [[], []];
  var pos2 = 0;
  width /= 2;
  var j = 0;
  var array1Length = array1[0] ? array1[0].length : 0;
  var array2Length = array2[0] ? array2[0].length : 0;

  for (var i = 0; i < array1Length; i++) {
    while (pos2 < array2Length && (array1[0][i] > (array2[0][pos2] + width))) {
      pos2++;
    }
    if ((pos2 < array2Length) && (array1[0][i] > array2[0][pos2] - width)) {
      newArray[0][j] = array1[0][i];
      newArray[1][j] = array1[1][i];
      j++;
    }
  }
  return newArray;
}
770409
def array_window(array, window_size)
      window_size < 1 and raise ArgumentError, "window_size = #{window_size} < 1"
      window_size = window_size.to_i
      window_size += 1 if window_size % 2 == 0
      radius = window_size / 2
      array.each_index do |i|
        ws = window_size
        from = i - radius
        negative_from = false
        if from < 0
          negative_from = true
          ws += from
          from = 0
        end
        a = array[from, ws]
        if (diff = window_size - a.size) > 0
          mean = a.inject(0.0) { |s, x| s + x } / a.size
          a = if negative_from
            [ mean ] * diff + a
          else
            a + [ mean ] * diff
          end
        end
        yield a
      end
      nil
    end
761323
def array(self, size_chunk, start, bytesize):
        ''' 
        '''

        with open(self.img, 'rb') as f1:
            f1.seek(self.start_byte + start * self.bytesize)
            data = f1.read(size_chunk * self.bytesize)
            Z = np.fromstring(data, dtype=self.dtype, count=size_chunk)
            if self.grid == 'LOLA':
                return Z * float(self.SCALING_FACTOR)
            else:
                return Z
1182312
def updateArray(self, array, indices, value):
        
        lin = np.arange(array.size)
        new_array = array.flatten()
        new_array[lin[indices]] = value
        return new_array.reshape(array.shape)
705231
def arrays_to_mgr(arrays, arr_names, index, columns, dtype=None):
    
    # figure out the index, if necessary
    if index is None:
        index = extract_index(arrays)
    else:
        index = ensure_index(index)

    # don't force copy because getting jammed in an ndarray anyway
    arrays = _homogenize(arrays, index, dtype)

    # from BlockManager perspective
    axes = [ensure_index(columns), index]

    return create_block_manager_from_arrays(arrays, arr_names, axes)
173014
public function rowReductionMethod() : array
    {
        $row = $col = $swaps = 0;

        $b = $this->a;

        while ($row < $this->m and $col < $this->n) {
            $t = $b[$row];

            if ($t[$col] == 0) {
                for ($i = $row + 1; $i < $this->m; $i++) {
                    if ($b[$i][$col] != 0) {
                        $temp = $b[$i];

                        $b[$i] = $t;
                        $t = $temp;
        
                        $swaps++;

                        break 1;
                    }
                }
            }

            if ($t[$col] == 0) {
                $col++;

                continue 1;
            }

            $divisor = $t[$col];

            if ($divisor != 1) {
                for ($i = 0; $i < $this->n; $i++) {
                    $t[$i] /= $divisor;
                }
            }

            for ($i = $row + 1; $i < $this->m; $i++) {
                $scale = $b[$i][$col];

                if ($scale != 0) {
                    for ($j = 0; $j < $this->n; $j++) {
                        $b[$i][$j] += -$scale * $t[$j];
                    }
                }
            }

            $b[$row] = $t;

            $row++;
            $col++;
        }

        $b = self::quick($b);

        return [$b, $swaps];
    }
1152098
public function refreshDimensions()
    {
        if ('\\' === DIRECTORY_SEPARATOR) {
            if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) {
                // extract [w, H] from "wxh (WxH)"
                // or [w, h] from "wxh"
                $this->width = (int) $matches[1];
                $this->height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2];
            } elseif (null !== $dimensions = $this->getConsoleMode()) {
                // extract [w, h] from "wxh"
                $this->width = (int) $dimensions[0];
                $this->height = (int) $dimensions[1];
            }
        } elseif ($sttyString = $this->getSttyColumns()) {
            if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
                // extract [w, h] from "rows h; columns w;"
                $this->width = (int) $matches[2];
                $this->height = (int) $matches[1];
            } elseif (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
                // extract [w, h] from "; h rows; w columns"
                $this->width = (int) $matches[2];
                $this->height = (int) $matches[1];
            }
        }
        $this->initialised = true;
    }
241112
public void mulRow(int i, double[] arr, int offset)
    {
        int n = cols;
        for (int j=0;j<n;j++)
        {
            mul(i, j, arr[j+offset]);
        }
    }
336230
def demeshgrid(arr):
    
    dim = len(arr.shape)
    for i in range(dim):
        Slice1 = [0]*dim
        Slice2 = [1]*dim
        Slice1[i] = slice(None)
        Slice2[i] = slice(None)
        if (arr[tuple(Slice1)] == arr[tuple(Slice2)]).all():
            return arr[tuple(Slice1)]
873710
function mergeDeepArrays(array1, array2) {
  const length = Math.max(array1.length, array2.length);

  let index = -1,
      mergedArray = [];

  while (++index < length) {
    if (index < array2.length) {
      mergedArray[index] = getDeeplyMergedValues(array1[index], array2[index]);

      continue;
    }

    mergedArray[index] = array1[index];
  }

  return mergedArray;
}
136266
def toArray(self):
        
        if self.isTransposed:
            return np.asfortranarray(
                self.values.reshape((self.numRows, self.numCols)))
        else:
            return self.values.reshape((self.numRows, self.numCols), order='F')
1203782
void resizeArray(int newArraySize) {
		long[] newArray = new long[newArraySize];
		System.arraycopy(this.arrayOfBits, 0, newArray, 0,
				Math.min(this.arrayOfBits.length, newArraySize));
		this.arrayOfBits = newArray;
	}