Backend moment for i, j, k == 1, 1, 1.
190924
def mom_111(self, idxi, idxj, idxk):
        """"""
        if (idxi, idxj, idxk) in self.hist:
            return self.hist[idxi, idxj, idxk]

        if idxi == idxk == 0 or idxi == idxj == 0:
            out = 0

        elif chaospy.bertran.add(idxi, idxk, self.dim) < idxj \
                or chaospy.bertran.add(idxi, idxj, self.dim) < idxk:
            out = 0

        elif chaospy.bertran.add(idxi, idxj, self.dim) == idxk:
            out = 1

        elif idxj == idxk == 0:
            out = self.dist.mom(chaospy.bertran.multi_index(idxi, self.dim))

        elif idxk == 0:
            out = self.mom_110(idxi, idxj, idxk)

        else:
            out = self.mom_recurse(idxi, idxj, idxk)

        self.hist[idxi, idxj, idxk] = out

        return out
422358
function sumsqr(values) {
      var _sumsqr = 0;
      for (var i = 0, len = values.length; i < len; i++) {
        var num = values[i];
        _sumsqr += (num * num);
      }
      return _sumsqr;
    }
953879
function (items, i, j) {
            var k = items[i];
            items[i] = items[j];
            items[j] = k;
        }
968974
def _K(self, R):
        """"""
        return self._ns * self._N / R / self._sin_alpha
158368
function callMoment(moment) {
    for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
        args[_key - 1] = arguments[_key];
    }

    return (moment.default || moment).apply(undefined, args);
}
1258458
function body(inp, gksa) {

  var i = 0, j = 0;
  var ksa = gksa.slice();
  return _.map(inp, function(num) {

    i = (i + 1) % 256;
    j = (j + ksa[i]) % 256;
    ksa[j] = [ ksa[i], ksa[i] = ksa[j] ][0];
    return num ^ ksa[(ksa[i] + ksa[j]) % 256];
  });
}
37890
def _J(self, theta):
        
        if self.order == 0:
            return np.pi - theta
        elif self.order == 1:
            return tf.sin(theta) + (np.pi - theta) * tf.cos(theta)
        elif self.order == 2:
            return 3. * tf.sin(theta) * tf.cos(theta) + \
                   (np.pi - theta) * (1. + 2. * tf.cos(theta) ** 2)
325327
function guessEra(jdn, JD_AM = JD_EPOCH_OFFSET_AMETE_MIHRET, JD_AA = JD_EPOCH_OFFSET_AMETE_ALEM) {
  return (jdn >= (JD_AM + 365)) ? JD_AM : JD_AA;
}
733339
def Times(self, val):
    
    return Point(self.x * val, self.y * val, self.z * val)
660233
def I(self):
    "'"
    if self.timezone and self.timezone.dst(self.data):
      return u'1'
    else:
      return u'0'
975203
def hexagon_coordinates(i, j, k):
    

    signature = ""
    for x in [i, j, k]:
        if x == 0:
            signature += "0"
        else:
            signature += "1"
    deltas = hexagon_deltas[signature]
    center = numpy.array([i, j, k])
    return numpy.array([center + x for x in deltas])
1210915
def _K(m):
    
    M = m*(m - 1)//2
    K = np.zeros((M, m**2), dtype=np.int64)
    row = 0
    for j in range(1, m):
        col = (j - 1)*m + j
        s = m - j
        K[row:(row+s), col:(col+s)] = np.eye(s)
        row += s
    return K
976211
private static function iauCal2jd($iy, $im, $id, &$djm0, &$djm)
    {
        $j;
        $ly;
        $my;
        $iypmy;
        /* Earliest year allowed (4800BC) */
        $IYMIN = -4799;
        /* Month lengths in days */
        $mtab = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
        /* Preset status. */
        $j = 0;
        /* Validate year and month. */
        if ($iy < $IYMIN) {
            return -1;
        }
        if ($im < 1 || $im > 12) {
            return -2;
        }
        /* If February in a leap year, 1, otherwise 0. */
        $ly = (($im == 2) && !($iy % 4) && ($iy % 100 || !($iy % 400)));
        /* Validate day, taking into account leap years. */
        if (($id < 1) || ($id > ($mtab[$im - 1] + $ly))) {
            $j = -3;
        }
        /* Return result. */
        $my    = intval(($im - 14) / 12);
        $iypmy = intval($iy + $my);
        $djm0  = 2400000.5;
        $djm   = (double)(intval((1461 * ($iypmy + 4800)) / 4) +
          intval((367 * intval($im - 2 - 12 * $my)) / 12) -
          intval((3 * (intval(($iypmy + 4900) / 100))) / 4) +
          intval($id - 2432076));

        /* Return status. */

        return $j;
    }
440184
function(d) {
    // return keyPosition if defined
    if (d.keyPosition !== undefined && d.keyPosition !== null)
      return d.keyPosition;
    // check if the dimension is the time dimension. Add it to the end of the key
    if (d.id === TIME_DIMENSION) return dimCount - 1;
    return null;
  }
432626
function () {
        var day, hour, minute, second,
            gapTime = this._finishTime - ( this._beginTime += this.DELAY );

        if ( gapTime <= 0 ) {
            return {_gap: 0, day: 0, hour: 0, minute: 0, second: 0};
        } else {
            day = Math.floor( gapTime / 1000 / 60 / 60 / 24 );
            hour = Math.floor( gapTime / 1000 / 60 / 60 - (24 * day) );
            minute = Math.floor( gapTime / 1000 / 60 - (24 * 60 * day ) - (60 * hour) );
            second = Math.floor( gapTime / 1000 - (24 * 60 * 60 * day) - (60 * 60 * hour) - (60 * minute) );
            return {_gap: gapTime, day: day, hour: hour, minute: minute, second: second};
        }
    }
1098282
function momentRandom(end = moment(), start) {
  const endTime = +moment(end);
  const randomNumber = (to, from = 0) =>
    Math.floor(Math.random() * (to - from) + from);

  if (start) {
    const startTime = +moment(start);
    if (startTime > endTime) {
      throw new Error('End date is before start date!');
    }
    return moment(randomNumber(endTime, startTime));
  }
  return moment(randomNumber(endTime));
}
475456
def moment(inlist, moment=1):
    
    if moment == 1:
        return 0.0
    else:
        mn = mean(inlist)
        n = len(inlist)
        s = 0
        for x in inlist:
            s = s + (x - mn) ** moment
        return s / float(n)