Pad an ideal/nadir estimate. This is mainly useful for padding the nadir
    estimated by a payoff table for safety purposes.
6045
def pad(idnad: Tuple[List[float], List[float]], pad_nadir=0.05, pad_ideal=0.0):
    
    ideal, nadir = idnad
    ideal_arr = np.array(ideal)
    nadir_arr = np.array(nadir)
    idnad_range = nadir_arr - ideal_arr
    nadir_arr += pad_nadir * idnad_range
    ideal_arr -= pad_ideal * idnad_range
    return list(ideal_arr), list(nadir_arr)
155652
public BaseTableLayout<C, T> padBottom(float padBottom) {
        this.padBottom = new FixedValue<C, T>(toolkit, padBottom);
        sizeInvalid = true;
        return this;
    }
648073
def _pad(arr, n, dir='right'):
    
    assert dir in ('left', 'right')
    if n < 0:
        raise ValueError("'n' must be positive: {0}.".format(n))
    elif n == 0:
        return np.zeros((0,) + arr.shape[1:], dtype=arr.dtype)
    n_arr = arr.shape[0]
    shape = (n,) + arr.shape[1:]
    if n_arr == n:
        assert arr.shape == shape
        return arr
    elif n_arr < n:
        out = np.zeros(shape, dtype=arr.dtype)
        if dir == 'left':
            out[-n_arr:, ...] = arr
        elif dir == 'right':
            out[:n_arr, ...] = arr
        assert out.shape == shape
        return out
    else:
        if dir == 'left':
            out = arr[-n:, ...]
        elif dir == 'right':
            out = arr[:n, ...]
        assert out.shape == shape
        return out
1225184
def pad(a, desiredlength):
    

    if len(a) >= desiredlength:
        return a

    islist = isinstance(a, list)
    a = np.array(a)
    diff = desiredlength - len(a)
    shape = list(a.shape)
    shape[0] = diff

    padded = np.concatenate([a, np.zeros(shape, dtype=a.dtype)])
    return padded.tolist() if islist else padded
311390
public BaseTableLayout<C, T> pad(float pad) {
        padTop = new FixedValue<C, T>(toolkit, pad);
        padLeft = new FixedValue<C, T>(toolkit, pad);
        padBottom = new FixedValue<C, T>(toolkit, pad);
        padRight = new FixedValue<C, T>(toolkit, pad);
        sizeInvalid = true;
        return this;
    }
836354
def range_pad(lower, upper, padding=None, log=False):
    
    if padding is not None and not isinstance(padding, tuple):
        padding = (padding, padding)
    if is_number(lower) and is_number(upper) and padding is not None:
        if not isinstance(lower, datetime_types) and log and lower > 0 and upper > 0:
            log_min = np.log(lower) / np.log(10)
            log_max = np.log(upper) / np.log(10)
            lspan = (log_max-log_min)*(1+padding[0]*2)
            uspan = (log_max-log_min)*(1+padding[1]*2)
            center = (log_min+log_max) / 2.0
            start, end = np.power(10, center-lspan/2.), np.power(10, center+uspan/2.)
        else:
            if isinstance(lower, datetime_types) and not isinstance(lower, cftime_types):
                # Ensure timedelta can be safely divided
                lower, upper = np.datetime64(lower), np.datetime64(upper)
                span = (upper-lower).astype('>m8[ns]')
            else:
                span = (upper-lower)
            lpad = span*(padding[0])
            upad = span*(padding[1])
            start, end = lower-lpad, upper+upad
    else:
        start, end = lower, upper

    return start, end
1126314
def padding_sizes(number_size)
      left_padding_size = internal_padding_size = right_padding_size = 0
      padding_size = width - number_size
      if padding_size > 0 && padded?
        case adjust
        when :left
          left_padding_size = padding_size
        when :right
          right_padding_size = padding_size
        when :internal
          internal_padding_size = padding_size
        when :center
          left_padding_size = (padding_size + 1) / 2
          right_padding_size = padding_size - left_padding_size
        end
      end
      [left_padding_size, internal_padding_size, right_padding_size]
    end
314683
function padRight(x, padding) {
  if (x) {
    x += '';
  } else {
    x = '';
  }
  var buf = [];
  while (buf.length + x.length < padding) {
    buf.push('0');
  }
  return x + buf.join('');
}
1030074
def top_value(padding=nil) # :nodoc:
      topval = points[0].max
      points.each do |point_set|
        topval = ( (topval < point_set.max) ? point_set.max : topval )
      end
      #topval = layers.inject(0) { |max, layer| (max = ((max < layer.top_value) ? layer.top_value : max)) unless layer.top_value.nil?; max }
      below_zero = (topval <= 0)
      topval = padding == :padded ? (topval + ((topval - bottom_value(nil)) * 0.15)) : topval
      (below_zero && topval > 0) ? 0 : topval
    end
206182
function(decimal /* , includeOffset*/) {
			var me = this;
			if (me.isHorizontal()) {
				var innerWidth = me.width - (me.paddingLeft + me.paddingRight);
				var valueOffset = (innerWidth * decimal) + me.paddingLeft;

				var finalVal = me.left + Math.round(valueOffset);
				finalVal += me.isFullWidth() ? me.margins.left : 0;
				return finalVal;
			}
			return me.top + (decimal * me.height);
		}
958028
def objective_bounds(self):
        
        if self.ideal and self.nadir:
            return self.ideal, self.nadir
        raise NotImplementedError(
            "Ideal and nadir value calculation is not yet implemented"
        )
1163565
def _estimate_delta(ntriangles, area):
    
    return np.sqrt(4./np.sqrt(3) * float(area) / float(ntriangles))
1319506
def predict_maxprob(self, x, **kwargs):
        
        return self.base_estimator_.predict(x.values, **kwargs)
1062348
public BaseTableLayout<C, T> padBottom(Value<C, T> padBottom) {
        this.padBottom = padBottom;
        sizeInvalid = true;
        return this;
    }
349417
def pad_z(pts, value=0.0):
    """"""
    pts = np.asarray(pts)
    if pts.shape[-1] < 3:
        if len(pts.shape) < 2:
            return np.asarray((pts[0], pts[1], value), dtype=pts.dtype)
        pad_col = np.full(len(pts), value, dtype=pts.dtype)
        pts = np.asarray((pts.T[0], pts.T[1], pad_col)).T
    return pts
847335
function ShouldPlayerStand(playerCards, dealerCard, handValue, handCount, options)
{
    var shouldStand = false;

    if (handValue.soft)
    {
        // Don't stand until you hit 18
        if (handValue.total > 18)
        {
            shouldStand = true;
        }
        else if (handValue.total == 18)
        {
            // Stand against dealer 2-8, and against a dealer Ace in single deck if they dealer will stand on soft 17
            shouldStand = ((dealerCard >= 2) && (dealerCard <= 8)) ||
                        ((dealerCard == 1) && (options.numberOfDecks == 1) && !options.hitSoft17);
        }
    }
    else
    {
        // Stand on 17 or above
        if (handValue.total > 16)
        {
            shouldStand = true;
        }
        else if (handValue.total > 12)
        {
            // 13-16 you should stand against dealer 2-6
            shouldStand = (dealerCard >= 2) && (dealerCard <= 6);
        }
        else if (handValue.total == 12)
        {
            // Stand on dealer 4-6
            shouldStand = (dealerCard >= 4) && (dealerCard <= 6);
        }

        // Advanced option - in single deck a pair of 7s should stand against a dealer 10
        if ((options.strategyComplexity != "simple") && (handValue.total == 14) && (playerCards[0] == 7) && (dealerCard == 10) && (options.numberOfDecks == 1))
        {
            shouldStand = true;
        }
    }

    return shouldStand;    
}
1296146
def _pad_default(x, padding:int, mode='reflection'):
    ""
    mode = _pad_mode_convert[mode]
    return F.pad(x[None], (padding,)*4, mode=mode)[0]