Creates a kernel for the Haar wavelet "centered" around the target pixel.

@param r Radius of the box.  width is 2*r
@return Kernel for a Haar x-axis wavelet.
179141
public static IntegralKernel kernelHaarX( int r , IntegralKernel ret) {
		if( ret == null )
			ret = new IntegralKernel(2);

		ret.blocks[0].set(-r, -r, 0, r);
		ret.blocks[1].set(0,-r,r,r);
		ret.scales[0] = -1;
		ret.scales[1] = 1;

		return ret;
	}
943501
protected boolean relevantSubspace(long[] subspace, DoubleDBIDList neigh, KernelDensityEstimator kernel) {
    final double crit = K_S_CRITICAL001 / FastMath.sqrt(neigh.size() - 2);

    double[] data = new double[neigh.size()];
    Relation<? extends NumberVector> relation = kernel.relation;
    for(int dim = BitsUtil.nextSetBit(subspace, 0); dim >= 0; dim = BitsUtil.nextSetBit(subspace, dim + 1)) {
      // TODO: can/should we save this copy?
      int count = 0;
      for(DBIDIter neighbor = neigh.iter(); neighbor.valid(); neighbor.advance()) {
        data[count++] = relation.get(neighbor).doubleValue(dim);
      }
      assert (count == neigh.size());
      Arrays.sort(data);

      final double min = data[0], norm = data[data.length - 1] - min;
      // Kolmogorow-Smirnow-Test against uniform distribution:
      boolean flag = false;
      for(int j = 1, end = data.length - 1; j < end; j++) {
        if(Math.abs(j / (data.length - 2.) - (data[j] - min) / norm) > crit) {
          flag = true;
          break;
        }
      }
      if(!flag) {
        return false;
      }
    }
    return true;
  }
495810
public Matrix getMatrix(int[] r, int[] c)
    {
        Matrix X = new Matrix(r.length, c.length);
        double[][] B = X.getArray();
        try
        {
            for (int i = 0; i < r.length; i++)
            {
                for (int j = 0; j < c.length; j++)
                {
                    B[i][j] = A[r[i]][c[j]];
                }
            }
        }
        catch (ArrayIndexOutOfBoundsException e)
        {
            throw new ArrayIndexOutOfBoundsException("Submatrix indices");
        }
        return X;
    }
61940
function circleArea(r, width) {
        return r * r * Math.acos(1 - width/r) - (r - width) * Math.sqrt(width * (2 * r - width));
    }
941440
public static void horizontal(Kernel1D_S32 kernel, GrayU8 src, GrayI8 dst ) {
		InputSanityCheck.checkSameShape(src, dst);

		boolean processed = BOverrideConvolveImageNormalized.invokeNativeHorizontal(kernel,src,dst);
		
		if( !processed ) {
			if( kernel.width >= src.width ) {
				ConvolveNormalizedNaive_SB.horizontal(kernel, src, dst);
			} else {
				ConvolveImageNoBorder.horizontal(kernel, src, dst, kernel.computeSum());
				ConvolveNormalized_JustBorder_SB.horizontal(kernel, src, dst);
			}
		}
	}
990307
def kernelize(self, kernel):
    '''
    '''
    if kernel == 'none':
      return self
    if kernel == 'binary':
      if self.is_weighted():
        return self._update_edges(1, copy=True)
      return self
    if kernel == 'rbf':
      w = self.edge_weights()
      r = np.exp(-w / w.std())
      return self._update_edges(r, copy=True)
    raise ValueError('Invalid kernel type: %r' % kernel)
455576
function gaussianKernel1D(s, n) {
    if (typeof n !== 'number') n = 7;
    var kernel = new Float64Array(n),
        halfN = Math.floor(n * 0.5),
        odd = n % 2,
        i;
    if (!s || !n) return kernel;
    for (i = 0; i <= halfN; i++) {
        kernel[i] = gauss(s * (i - halfN - odd * 0.5), s);
    }
    for (; i < n; i++) {
        kernel[i] = kernel[n - 1 - i];
    }
    return kernel;
}
264906
def get_one_dimensional_kernel(self, dim):
        
        oneDkernel = GridRBF(input_dim=1, variance=self.variance.copy(), originalDimensions=dim)
        return oneDkernel
1261632
function (x, y, r) {
		var attr = isObject(x) ?
			x :
			{
				x: x,
				y: y,
				r: r
			};

		return this.createElement('circle').attr(attr);
	}
625492
protected double computeFractionBoundary( float pixelThreshold ) {
		// TODO ignore outer pixels from this computation.  Will require 8 regions (4 corners + top/bottom + left/right)
		final int w = square.width;
		int radius = (int) (w * borderWidthFraction);

		int innerWidth = w-2*radius;
		int total = w*w - innerWidth*innerWidth;
		int count = 0;
		for (int y = 0; y < radius; y++) {
			int indexTop = y*w;
			int indexBottom = (w - radius + y)*w;

			for (int x = 0; x < w; x++) {
				if( square.data[indexTop++] < pixelThreshold )
					count++;
				if( square.data[indexBottom++] < pixelThreshold )
					count++;
			}
		}

		for (int y = radius; y < w-radius; y++) {
			int indexLeft = y*w;
			int indexRight = y*w + w - radius;

			for (int x = 0; x < radius; x++) {
				if( square.data[indexLeft++] < pixelThreshold )
					count++;
				if( square.data[indexRight++] < pixelThreshold )
					count++;
			}
		}

		return count/(double)total;
	}
1345552
def kernel(x1, x2, method='gaussian', sigma=1, **kwargs):
    """"""
    if method.lower() in ['gaussian', 'gauss', 'rbf']:
        K = np.exp(-dist(x1, x2) / (2 * sigma**2))
    return K
1048815
private static void normalize2D(GrayU8 gray) {
		// Create a Gaussian kernel with radius of 3
		Kernel2D_S32 kernel = FactoryKernelGaussian.gaussian2D(GrayU8.class, -1, 3);
		// Note that there is a more efficient way to compute this convolution since it is a separable kernel
		// just use BlurImageOps instead.

		// Since it's normalized it can be saved inside an 8bit image
		GrayU8 output = new GrayU8(gray.width,gray.height);

		GConvolveImageOps.convolveNormalized(kernel, gray, output);
		panel.addImage(VisualizeImageData.standard(output, null), "2D Normalized Kernel");
	}
637382
public GridCoverage2D buildRaster() {
        if (makeNew) {
            GridCoverage2D coverage = buildCoverage("raster", newWR, regionMap, crs);
            return coverage;
        } else {
            throw new RuntimeException("The raster is readonly, so no new raster can be built.");
        }
    }
584507
@NonNull
    public IconicsDrawable roundedCornersRxRes(@DimenRes int sizeResId) {
        return roundedCornersRxPx(mContext.getResources().getDimensionPixelSize(sizeResId));
    }
1145937
@Override
    public DMatrixRMaj getR(DMatrixRMaj R, boolean compact) {
        if( R == null ) {
            if( compact ) {
                R = new DMatrixRMaj(minLength,numCols);
            } else
                R = new DMatrixRMaj(numRows,numCols);
        } else {
            if( compact ) {
                R.reshape(minLength,numCols);
            } else {
                R.reshape(numRows,numCols);
            }

            for( int i = 0; i < R.numRows; i++ ) {
                int min = Math.min(i,R.numCols);
                for( int j = 0; j < min; j++ ) {
                    R.set(i,j,0);
                }
            }
        }

        for( int i = 0; i < minLength; i++ ) {
            for( int j = i; j < numCols; j++ ) {
                double val = QR.get(i,j);
                R.set(i,j,val);
            }
        }

        return R;
    }
1270394
function rToW (r, x, y) {
    return { x: x * r.scale + r.center.x, y: y * r.scale + r.center.y };
}
995450
public static INDArray conv2d(INDArray input, INDArray kernel, Type type) {
        return Nd4j.getConvolution().conv2d(input, kernel, type);
    }