Encodes an input array, and performs weight updates and updates to the activity 
        statistics according to the respective methods implemented below.
438021
def learn(self, x):
        """"""
        y = self.encode(x)
        self.update_statistics([y]) 
        self.update_weights([x],[y])
        return y
1286236
private void updateStateFromTypedArray(TypedArray a) {
        final LayerState state = mLayerState;

        // Account for any configuration changes.
        state.mChangingConfigurations |= TypedArrayCompat.getChangingConfigurations(a);

        // Extract the theme attributes, if any.
        state.mThemeAttrs = TypedArrayCompat.extractThemeAttrs(a);

        final int N = a.getIndexCount();
        for (int i = 0; i < N; i++) {
            int attr = a.getIndex(i);
            if (attr == R.styleable.LayerDrawable_android_opacity) {
                state.mOpacityOverride = a.getInt(attr, state.mOpacityOverride);
            } else if (attr == R.styleable.LayerDrawable_android_paddingTop) {
                state.mPaddingTop = a.getDimensionPixelOffset(attr, state.mPaddingTop);
            } else if (attr == R.styleable.LayerDrawable_android_paddingBottom) {
                state.mPaddingBottom = a.getDimensionPixelOffset(attr, state.mPaddingBottom);
            } else if (attr == R.styleable.LayerDrawable_android_paddingLeft) {
                state.mPaddingLeft = a.getDimensionPixelOffset(attr, state.mPaddingLeft);
            } else if (attr == R.styleable.LayerDrawable_android_paddingRight) {
                state.mPaddingRight = a.getDimensionPixelOffset(attr, state.mPaddingRight);
            } else if (attr == R.styleable.LayerDrawable_android_paddingStart) {
                state.mPaddingStart = a.getDimensionPixelOffset(attr, state.mPaddingStart);
            } else if (attr == R.styleable.LayerDrawable_android_paddingEnd) {
                state.mPaddingEnd = a.getDimensionPixelOffset(attr, state.mPaddingEnd);
            } else if (attr == R.styleable.LayerDrawable_android_autoMirrored) {
                state.mAutoMirrored = a.getBoolean(attr, state.mAutoMirrored);
            } else if (attr == R.styleable.LayerDrawable_android_paddingMode) {
                state.mPaddingMode = a.getInteger(attr, state.mPaddingMode);
            }
        }
    }
1040655
final byte[] hmac(final byte[] input, final int offset, final int len) {
		hMac.update(input, offset, len);
		return hMac.doFinal();
	}
478728
@Override
  public void updateAdaptiveData(final String[] tokens,
      final String[] outcomes) {

    for (int i = 0; i < tokens.length; i++) {
      this.previousMap.put(tokens[i], outcomes[i]);
    }
  }
965223
public void updateWeightAndPrune(float[] dataRow, int modelIndex, int ng, int bestIndex, float bestWeight) {
		int index = modelIndex;
		float weightTotal = 0;
		for (int i = 0; i < ng;  ) {
			float weight = dataRow[index];
//			if( ng > 1 )
//				System.out.println("["+i+"] = "+ng+"  weight "+weight);
			weight = weight - learningRate*(weight + decay); // <-- original equation
//			weight = weight - learningRate*decay;
			if( weight <= 0 ) {
				// copy the last Gaussian into this location
				int indexLast = modelIndex + (ng-1)*gaussianStride;
				for (int j = 0; j < gaussianStride; j++) {
					dataRow[index+j] = dataRow[indexLast+j];
				}

				// see if the best Gaussian just got moved to here
				if( indexLast == bestIndex )
					bestIndex = index;

				// mark it as unused by setting variance to zero
				dataRow[indexLast+1] = 0;

				// decrease the number of gaussians
				ng -= 1;
			} else {
				dataRow[index] = weight;
				weightTotal += weight;
				index += gaussianStride;
				i++;
			}
		}

		// undo the change to the best model. It was done in the for loop to avoid an if statement which would
		// have slowed it down
		if( bestIndex != -1 ) {
			weightTotal -= dataRow[bestIndex];
			weightTotal += bestWeight;
			dataRow[bestIndex] = bestWeight;
		}

		// Normalize the weight so that it sums up to one
		index = modelIndex;
		for (int i = 0; i < ng; i++, index += gaussianStride) {
			dataRow[index] /= weightTotal;
		}
	}
76534
@PrePersist
    @PreUpdate
    final void updateStats() {
        if (!this.modified || this.statisticalSummary == null) {
            return;
        }

        // Update statistic values
        this.count = (int) this.statisticalSummary.getN();
        this.sum = this.statisticalSummary.getSum();
        this.sumsq = this.statisticalSummary.getSumsq();
        this.mean = this.statisticalSummary.getMean();
        this.standardDeviation = this.statisticalSummary.getStandardDeviation();
        this.variance = this.statisticalSummary.getVariance();
        this.populationVariance = this.statisticalSummary.getPopulationVariance();
        this.max = this.statisticalSummary.getMax();
        this.min = this.statisticalSummary.getMin();
        this.geometricMean = this.statisticalSummary.getGeometricMean();
        this.sumOfLogs = this.statisticalSummary.getSumOfLogs();
        this.secondMoment = this.statisticalSummary.getSecondMoment();

        this.modified = false;
    }
156529
def encode(input)
      input_encoding = input.encoding
      input = input.encode(Encoding::UTF_8).codepoints.to_a
      output = []

      # Initialize the state:
      n = INITIAL_N
      delta = 0
      bias = INITIAL_BIAS

      # Handle the basic code points:
      output = input.select { |char| char <= ASCII_MAX }

      h = b = output.length

      # h is the number of code points that have been handled, b is the
      # number of basic code points

      output << DELIMITER if b > 0

      # Main encoding loop:
      while h < input.length
        # All non-basic code points < n have been
        # handled already. Find the next larger one:

        m = MAXINT

        input.each do |char|
          m = char if char >= n && char < m
        end

        # Increase delta enough to advance the decoder's
        # <n,i> state to <m,0>, but guard against overflow:

        raise(ConversionError, "punycode_overflow (1)") if m - n > ((MAXINT - delta) / (h + 1)).floor

        delta += (m - n) * (h + 1)
        n = m

        input.each_with_index do |char, _|
          if char < n
            delta += 1
            raise(ConversionError, "punycode_overflow(2)") if delta > MAXINT
          end

          next unless char == n

          # Represent delta as a generalized variable-length integer:
          q = delta
          k = BASE
          loop do
            t = k <= bias ? TMIN : k >= bias + TMAX ? TMAX : k - bias
            break if q < t
            output << encode_digit(t + (q - t) % (BASE - t))
            q = ((q - t) / (BASE - t)).floor
            k += BASE
          end
          output << encode_digit(q)
          bias = adapt(delta, h + 1, h == b)
          delta = 0
          h += 1
        end

        delta += 1
        n += 1
      end
      output.collect {|c| c.chr(Encoding::UTF_8)}.join(EMPTY).encode(input_encoding)
    end
781539
public void setInput(float x[], float y[], int size) {
		if (x.length < size || y.length < size) {
			throw new IllegalArgumentException("Arrays too small for size.");
		}
		if (size < M) {
			throw new IllegalArgumentException("Not enough data points for M");
		}

		this.x = x;
		this.y = y;
		this.size = size;
		this.dj = Math.min(1, (int) Math.pow(size, 0.25));
		ascend = x[size - 1] >= x[0];
	}
499366
def _apply_to_array(self, yd, y, weights, off_slices, ref_slice, dim):
        """"""

        ndims = len(y.shape)

        all = slice(None, None, 1)

        ref_multi_slice = [all] * ndims
        ref_multi_slice[dim] = ref_slice

        for w, s in zip(weights, off_slices):
            off_multi_slice = [all] * ndims
            off_multi_slice[dim] = s
            if abs(1 - w) < 1.E-14:
                yd[ref_multi_slice] += y[off_multi_slice]
            else:
                yd[ref_multi_slice] += w * y[off_multi_slice]
761458
@Override
	public void encode(DMatrixRMaj F, double[] param) {
		// see if which columns are to be used
		selectColumns(F);
		
		// set the largest element in the first two columns and normalize
		// using that value
		double v[] = new double[]{F.get(0,col0),F.get(1,col0),F.get(2,col0),
				F.get(0,col1),F.get(1,col1),F.get(2,col1)};
		double divisor = selectDivisor(v,param);
		
		// solve for alpha and beta and put into param
		SimpleMatrix A = new SimpleMatrix(3,2);
		SimpleMatrix y = new SimpleMatrix(3,1);
		for( int i = 0; i < 3; i++ ) {
			A.set(i,0,v[i]);
			A.set(i,1,v[i+3]);
			y.set(i,0,F.get(i,col2)/divisor);
		}

		SimpleMatrix x = A.solve(y);
		
		param[5] = x.get(0);
		param[6] = x.get(1);
	}
791167
public void setInputUpdates(java.util.Collection<InputUpdate> inputUpdates) {
        if (inputUpdates == null) {
            this.inputUpdates = null;
            return;
        }

        this.inputUpdates = new java.util.ArrayList<InputUpdate>(inputUpdates);
    }
1317762
public void append(Encoder encoder, EncodingState encodingState, char[] b, int off, int len) throws IOException {
        if (b == null || len <= 0) {
            return;
        }
        if (shouldEncode(encoder, encodingState)) {
            EncodingState newEncoders = createNewEncodingState(encoder, encodingState);
            if (encoder instanceof StreamingEncoder) {
                ((StreamingEncoder)encoder).encodeToStream(encoder, CharSequences.createCharSequence(b, off, len), 0, len, this,
                        newEncoders);
            }
            else {
                encodeAndWrite(encoder, newEncoders, String.valueOf(b, off, len));
            }
        }
        else {
            write(encodingState, b, off, len);
        }
    }
1005498
void encode() {
        final int bwtLength = this.bwtLength;
        final boolean[] bwtValuesPresent = this.bwtValuesPresent;
        final int[] bwtBlock = this.bwtBlock;
        final char[] mtfBlock = this.mtfBlock;
        final int[] mtfSymbolFrequencies = this.mtfSymbolFrequencies;
        final byte[] huffmanSymbolMap = new byte[256];
        final Bzip2MoveToFrontTable symbolMTF = new Bzip2MoveToFrontTable();

        int totalUniqueValues = 0;
        for (int i = 0; i < huffmanSymbolMap.length; i++) {
            if (bwtValuesPresent[i]) {
                huffmanSymbolMap[i] = (byte) totalUniqueValues++;
            }
        }
        final int endOfBlockSymbol = totalUniqueValues + 1;

        int mtfIndex = 0;
        int repeatCount = 0;
        int totalRunAs = 0;
        int totalRunBs = 0;
        for (int i = 0; i < bwtLength; i++) {
            // Move To Front
            final int mtfPosition = symbolMTF.valueToFront(huffmanSymbolMap[bwtBlock[i] & 0xff]);
            // Run Length Encode
            if (mtfPosition == 0) {
                repeatCount++;
            } else {
                if (repeatCount > 0) {
                    repeatCount--;
                    while (true) {
                        if ((repeatCount & 1) == 0) {
                            mtfBlock[mtfIndex++] = HUFFMAN_SYMBOL_RUNA;
                            totalRunAs++;
                        } else {
                            mtfBlock[mtfIndex++] = HUFFMAN_SYMBOL_RUNB;
                            totalRunBs++;
                        }

                        if (repeatCount <= 1) {
                            break;
                        }
                        repeatCount = (repeatCount - 2) >>> 1;
                    }
                    repeatCount = 0;
                }
                mtfBlock[mtfIndex++] = (char) (mtfPosition + 1);
                mtfSymbolFrequencies[mtfPosition + 1]++;
            }
        }

        if (repeatCount > 0) {
            repeatCount--;
            while (true) {
                if ((repeatCount & 1) == 0) {
                    mtfBlock[mtfIndex++] = HUFFMAN_SYMBOL_RUNA;
                    totalRunAs++;
                } else {
                    mtfBlock[mtfIndex++] = HUFFMAN_SYMBOL_RUNB;
                    totalRunBs++;
                }

                if (repeatCount <= 1) {
                    break;
                }
                repeatCount = (repeatCount - 2) >>> 1;
            }
        }

        mtfBlock[mtfIndex] = (char) endOfBlockSymbol;
        mtfSymbolFrequencies[endOfBlockSymbol]++;
        mtfSymbolFrequencies[HUFFMAN_SYMBOL_RUNA] += totalRunAs;
        mtfSymbolFrequencies[HUFFMAN_SYMBOL_RUNB] += totalRunBs;

        mtfLength = mtfIndex + 1;
        alphabetSize = endOfBlockSymbol + 1;
    }
184500
private void initArrays() {
        if (data == null || picsize != data.length) {
            data = new int[picsize];
            magnitude = new int[picsize];

            xConv = new float[picsize];
            yConv = new float[picsize];
            xGradient = new float[picsize];
            yGradient = new float[picsize];
        }
    }
276417
public void update ( byte[] input, int offset, int len ) {
        if ( log.isTraceEnabled() ) {
            log.trace("update: " + this.updates + " " + offset + ":" + len);
            log.trace(Hexdump.toHexString(input, offset, Math.min(len, 256)));
        }
        if ( len == 0 ) {
            return; /* CRITICAL */
        }
        this.digest.update(input, offset, len);
        this.updates++;
    }
411330
private void updateStatistics() {
        final PNCounterService service = getService();
        final LocalPNCounterStatsImpl stats = service.getLocalPNCounterStats(name);
        if (delta > 0) {
            stats.incrementIncrementOperationCount();
        } else if (delta < 0) {
            stats.incrementDecrementOperationCount();
        }
        stats.setValue(getBeforeUpdate ? (response.getValue() + delta) : response.getValue());
    }
167668
function() {
		this.prgRead = new Uint8Array( 0x8000 );
		this.prgRead.set( this.prgData.subarray( 0, 0x2000 ) );

		this.chrRead = new Uint8Array( 0x2000 );
		this.chrRead.set( this.chrData.subarray( 0, 0x2000 ) );

		mappers.init( this );
	}