initialize the ansiWidths array (for winAnsiEncoding)
and fill with the missingwidth
558709
private void initAnsiWidths() {
        ansiWidth = new int[256];
        for (int i = 0; i < 256; i++) {
            ansiWidth[i] = mtxTab[0].getWx();
        }

        // Create an index hash to the ansiWidth
        // Can't just index the winAnsiEncoding when inserting widths
        // same char (eg bullet) is repeated more than one place
        ansiIndex = new java.util.HashMap();
        for (int i = 32; i < Glyphs.WINANSI_ENCODING.length; i++) {
            Integer ansi = new Integer(i);
            Integer uni = new Integer(Glyphs.WINANSI_ENCODING[i]);

            List v = (List)ansiIndex.get(uni);
            if (v == null) {
                v = new java.util.ArrayList();
                ansiIndex.put(uni, v);
            }
            v.add(ansi);
        }
    }
768967
private static void initializeNNCache(double[] scratch, double[] bestd, int[] besti) {
    final int size = bestd.length;
    Arrays.fill(bestd, Double.POSITIVE_INFINITY);
    Arrays.fill(besti, -1);
    for(int x = 0, p = 0; x < size; x++) {
      assert (p == MatrixParadigm.triangleSize(x));
      double bestdx = Double.POSITIVE_INFINITY;
      int bestix = -1;
      for(int y = 0; y < x; y++, p++) {
        final double v = scratch[p];
        if(v < bestd[y]) {
          bestd[y] = v;
          besti[y] = x;
        }
        if(v < bestdx) {
          bestdx = v;
          bestix = y;
        }
      }
      bestd[x] = bestdx;
      besti[x] = bestix;
    }
  }
529673
def _init_vertical(self):
        """"""
        self.scale.grid(row=0, sticky='ns')
        # showvalue
        padx1, padx2 = 0, 0
        pady1, pady2 = 0, 0
        if self._showvalue:
            self.label.configure(text=self._formatter.format(self._start))
            if self._labelpos == 'w':
                self.label.place(in_=self.scale, bordermode='outside',
                                 relx=0, y=0, anchor='e')
                self.update_idletasks()
                padx1 = self.label.winfo_width()
                self.label.configure(text=self._formatter.format(self._start + self._extent))
                self.update_idletasks()
                padx1 = max(self.label.winfo_width(), padx1)
            elif self._labelpos == 'e':
                self.label.place(in_=self.scale, bordermode='outside',
                                 relx=1, y=1, anchor='w')
                self.update_idletasks()
                padx2 = self.label.winfo_width()
                self.label.configure(text=self._formatter.format(self._start + self._extent))
                self.update_idletasks()
                padx2 = max(self.label.winfo_width(), padx2)
            else:  # self._labelpos in ['n', 's']:
                if self._labelpos == 'n':
                    rely = 0
                    anchor = 's'
                    pady1 = self.label.winfo_reqheight()
                else:
                    rely = 1
                    anchor = 'n'
                    pady2 = self.label.winfo_reqheight()
                self.label.place(in_=self.scale, bordermode='outside', relx=0.5,
                                 rely=rely, anchor=anchor)
                self.update_idletasks()
                w = self.label.winfo_width()
                self.label.configure(text=self._formatter.format(self._start + self._extent))
                self.update_idletasks()
                w = max(w, self.label.winfo_width())
                ws = self.scale.winfo_reqwidth()
                if w > ws:
                    padx = (w - ws) // 2
                    if self._tickinterval:
                        if self._tickpos == 'e':
                            padx1 = padx
                        else:   # self._tickpos == 'w'
                            padx2 = padx
                    else:
                        padx1, padx2 = padx, padx
        # ticks
        padx1_2, padx2_2 = 0, 0
        if self._tickinterval:
            nb_interv = int(self._extent / self._tickinterval)
            if self._tickpos == 'w':
                for i in range(nb_interv + 1):
                    tick = self._start + i * self._tickinterval
                    self.ticks.append(tick)
                    self.ticklabels.append(ttk.Label(self,
                                                     style=self._style_name + ".TLabel",
                                                     text=self._formatter.format(tick)))
                    self.ticklabels[i].place(in_=self.scale, bordermode='outside',
                                             x=-1 - padx1, y=0,
                                             anchor='e')
                    self.update_idletasks()
                    padx1_2 = max(self.ticklabels[i].winfo_width(), padx1_2)
            else:  # self._tickpos == 'e'
                w = self.scale.winfo_reqwidth()
                for i in range(nb_interv + 1):
                    tick = self._start + i * self._tickinterval
                    self.ticks.append(tick)
                    self.ticklabels.append(ttk.Label(self,
                                                     style=self._style_name + ".TLabel",
                                                     text=self._formatter.format(tick)))
                    self.ticklabels[i].place(in_=self.scale, bordermode='outside',
                                             x=w + 1 + padx2, y=0,
                                             anchor='w')
                    self.update_idletasks()
                    padx2_2 = max(self.ticklabels[i].winfo_width(), padx2_2)
        self.scale.grid_configure(padx=(padx1 + padx1_2 + 1, padx2 + padx2_2 + 1),
                                  pady=(pady1, pady2))
792707
def _position_encoding_init(max_length, dim):
    
    position_enc = np.arange(max_length).reshape((-1, 1)) \
                   / (np.power(10000, (2. / dim) * np.arange(dim).reshape((1, -1))))
    # Apply the cosine to even columns and sin to odds.
    position_enc[:, 0::2] = np.sin(position_enc[:, 0::2])  # dim 2i
    position_enc[:, 1::2] = np.cos(position_enc[:, 1::2])  # dim 2i+1
    return position_enc
1235268
def generateForSize(width, height, dimOrder, maxWindowSize, overlapPercent, transforms = []):
	
	
	# If the input data is smaller than the specified window size,
	# clip the window size to the input size on both dimensions
	windowSizeX = min(maxWindowSize, width)
	windowSizeY = min(maxWindowSize, height)
	
	# Compute the window overlap and step size
	windowOverlapX = int(math.floor(windowSizeX * overlapPercent))
	windowOverlapY = int(math.floor(windowSizeY * overlapPercent))
	stepSizeX = windowSizeX - windowOverlapX
	stepSizeY = windowSizeY - windowOverlapY
	
	# Determine how many windows we will need in order to cover the input data
	lastX = width - windowSizeX
	lastY = height - windowSizeY
	xOffsets = list(range(0, lastX+1, stepSizeX))
	yOffsets = list(range(0, lastY+1, stepSizeY))
	
	# Unless the input data dimensions are exact multiples of the step size,
	# we will need one additional row and column of windows to get 100% coverage
	if len(xOffsets) == 0 or xOffsets[-1] != lastX:
		xOffsets.append(lastX)
	if len(yOffsets) == 0 or yOffsets[-1] != lastY:
		yOffsets.append(lastY)
	
	# Generate the list of windows
	windows = []
	for xOffset in xOffsets:
		for yOffset in yOffsets:
			for transform in [None] + transforms:
				windows.append(SlidingWindow(
					x=xOffset,
					y=yOffset,
					w=windowSizeX,
					h=windowSizeY,
					dimOrder=dimOrder,
					transform=transform
				))
	
	return windows
50754
def initialize(self, useRandomEncoder):
    
    self.setRandomSeed(self.seed)

    self.dim = numpy.shape(self.spatialConfig)[-1]

    self.spatialMap = dict( zip( map(tuple, list(self.spatialConfig)),
                              self.sensoryInputElements))

    self.lengthMotorInput1D = (2*self.maxDisplacement + 1) * \
                                                    self.numActiveBitsMotorInput

    uniqueSensoryElements = list(set(self.sensoryInputElementsPool))

    if useRandomEncoder:
      self.sensoryEncoder = SDRCategoryEncoder(n=1024,
                                w=self.numActiveBitsSensoryInput,
                                categoryList=uniqueSensoryElements,
                                forced=True)
      self.lengthSensoryInput = self.sensoryEncoder.getWidth()

    else:
      self.lengthSensoryInput = (len(self.sensoryInputElementsPool)+1) * \
                                          self.numActiveBitsSensoryInput

      self.sensoryEncoder = CategoryEncoder(w=self.numActiveBitsSensoryInput,
                            categoryList=uniqueSensoryElements, forced=True)

    motorEncoder1D =  ScalarEncoder(n=self.lengthMotorInput1D,
                                    w=self.numActiveBitsMotorInput,
                                    minval=-self.maxDisplacement,
                                    maxval=self.maxDisplacement,
                                    clipInput=True,
                                    forced=True)

    self.motorEncoder = VectorEncoder(length=self.dim, encoder=motorEncoder1D)
565906
private void initGridLabels() {
        int dim = base.getDimension();
        double[] offset = new double[dim];
        for (int j = 0; j < dim; j++) {
            if (j != index) {
                offset[j] = -(base.getUpperBounds()[j] - base.getLowerBounds()[j]) / 100;
            }
        }

        int decimal = 0;
        String label;

        gridLabels = new Label[labelsSlicing.length];

        for (int i = 0; i < gridLabels.length; i++) {

            double[] labelCoord = new double[base.getDimension()];
            System.arraycopy(base.getCoordinateSpace()[index + 1], 0, labelCoord, 0, base.getDimension());
            labelCoord[index] = labelsSlicing[i];

            if (dim == 3) {
                if (index == 0) {
                    labelCoord[2] = base.getUpperBounds()[2] - 2 * offset[2];
                } else if (index == 1) {
                    labelCoord[0] = base.getUpperBounds()[0] - 2 * offset[0];
                } else if (index == 2) {
                    labelCoord[1] = base.getUpperBounds()[1] - 2 * offset[1];
                }
            }

            decimal = base.getPrecisionDigits()[index];

            if (gridLabelStrings != null) {
                label = gridLabelStrings[i % gridLabelStrings.length];
            } else {
                String format = "%.0f";
                if (decimal < 0) {
                    format = String.format("%%.%df", -decimal);
                }
                label = String.format(format, labelsSlicing[i]);
            }

            for (int j = 0; j < dim; j++) {
                labelCoord[j] += offset[j];
            }

            if (base.getDimension() == 2) {
                if (index == 0) {
                    if (rotation == 0.0) {
                        gridLabels[i] = new Label(label, 0.5, 1.0, labelCoord);
                    } else {
                        gridLabels[i] = new Label(label, 1.0, 0.5, rotation, labelCoord);
                    }
                } else {
                    gridLabels[i] = new Label(label, 1.0, 0.5, labelCoord);
                }
            } else {
                if (index == 0) {
                    gridLabels[i] = new Label(label, 0.5, -0.5, labelCoord);
                } else if (index == 1) {
                    gridLabels[i] = new Label(label, 0.5, 1.0, labelCoord);
                } else if (index == 2) {
                    gridLabels[i] = new Label(label, 0.0, 0.5, labelCoord);
                }
            }

            gridLabels[i].setFont(gridLabelFont);
        }

        gridLabelStrings = null;
    }
279113
private void initGraphics() {
        if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 ||
            Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) {
            if (getPrefWidth() > 0 && getPrefHeight() > 0) {
                setPrefSize(getPrefWidth(), getPrefHeight());
            } else {
                setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
            }
        }

        nameText = new Text(getName());
        nameText.setTextOrigin(VPos.TOP);

        valueText = new Text(String.format(locale, formatString, getValue()));
        valueText.setTextOrigin(VPos.TOP);

        barBackground = new Rectangle();

        bar = new Rectangle();

        pane = new Pane(nameText, valueText, barBackground, bar);
        pane.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));

        getChildren().setAll(pane);
    }
69427
public void setDimensions(int pWidth, int pHeight) {
        destWidth = (pWidth + xSub - 1) / xSub;
        destHeight = (pHeight + ySub - 1) / ySub;

        //System.out.println("Subsampling: " + xSub + "," + ySub + "-> " + destWidth + ", " + destHeight);
        super.setDimensions(pWidth, pHeight);
    }
974132
def _init_trace(self, n,  color, style,
                    linewidth=2.5, zorder=None, marker=None, markersize=6):
        
        while n >= len(self.traces):
            self.traces.append(LineProperties())
        line = self.traces[n]
        label = "trace %i" % (n+1)
        line.label = label
        line.drawstyle = 'default'
        if zorder     is None:
            zorder = 5 * (n+1)
        line.zorder = zorder
        if color      is not None: line.color = color
        if style      is not None: line.style = style
        if linewidth  is not None: line.linewidth = linewidth
        if marker     is not None: line.marker = marker
        if markersize is not None: line.markersize = markersize
        self.traces[n] = line
1290493
public void initialize( T image , RectangleLength2D_I32 initial ) {
		if( !image.isInBounds(initial.x0,initial.y0) )
			throw new IllegalArgumentException("Initial rectangle is out of bounds!");
		if( !image.isInBounds(initial.x0+initial.width,initial.y0+initial.height) )
			throw new IllegalArgumentException("Initial rectangle is out of bounds!");


		pdf.reshape(image.width,image.height);
		ImageMiscOps.fill(pdf,-1);

		setTrackLocation(initial);

		failed = false;

		// compute the initial sum of the likelihood so that it can detect when the target is no longer visible
		minimumSum = 0;
		targetModel.setImage(image);

		for( int y = 0; y < initial.height; y++ ) {
			for( int x = 0; x < initial.width; x++ ) {
				minimumSum += targetModel.compute(x+initial.x0,y+initial.y0);
			}
		}
		minimumSum *= minFractionDrop;
	}
526739
def setwinsize(self, rows, cols):
        
        self._winsize = (rows, cols)
        self.pty.set_size(cols, rows)
975963
function init() {
    network = [];
    netindex = new Int32Array(256);
    bias = new Int32Array(netsize);
    freq = new Int32Array(netsize);
    radpower = new Int32Array(netsize >> 3);

    var i, v;
    for (i = 0; i < netsize; i++) {
      v = (i << (netbiasshift + 8)) / netsize;
      network[i] = new Float64Array([v, v, v, 0]);
      //network[i] = [v, v, v, 0]
      freq[i] = intbias / netsize;
      bias[i] = 0;
    }
  }
186298
def fillRectangle(self, x, y, width, height, color):
        """"""
        #fallback variant, use update recatngle
        #override with specialized function for better performance
        self.updateRectangle(x, y, width, height, color*width*height)
133368
def autowidth(widtharray)
      return if value.nil?
      if styles.cellXfs[style].alignment && styles.cellXfs[style].alignment.wrap_text
        first = true
        value.to_s.split(/\r?\n/, -1).each do |line|
          if first
            first = false
          else
            widtharray << 0
          end
          widtharray[-1] += string_width(line, font_size)
        end
      else
        widtharray[-1] += string_width(value.to_s, font_size)
      end
      widtharray
    end
854689
private void init() {

        m_height = -1;
        m_width = -1;
        m_maxHeight = -1;
        m_maxWidth = -1;
        m_type = 0;
        m_position = 0;
        m_renderMode = 0;
        m_quality = 0;
        m_cropX = -1;
        m_cropY = -1;
        m_cropHeight = -1;
        m_cropWidth = -1;
        m_color = Color.WHITE;
        m_filters = new ArrayList<String>();
        m_maxBlurSize = CmsImageLoader.getMaxBlurSize();
        m_isOriginalScaler = false;
    }
636316
function(w, h) {
    grid.set( space.size.$multiply( 0.1 ) ).to( space.size.$multiply( 0.9 ) ).init( 10, 10, "fix", "fix" );
    space.clear();
    buffer = [];
  }