/** * Construct with the given number of bins per dimension * * @param nbins * the number of bins in each dimension for the histograms */ public HistogramModel(int... nbins) { super(nbins.length); assert (nbins.length > 0); histogram = new MultidimensionalHistogram(nbins); }
/** * Construct with the given number of bins per dimension * * @param nbins * the number of bins in each dimension for the histograms */ public HistogramModel(int... nbins) { super(nbins.length); assert (nbins.length > 0); histogram = new MultidimensionalHistogram(nbins); }
/** * Construct with the given parameters * @param blocks_x the number of blocks in the x-direction * @param blocks_y the number of blocks in the y-direction * @param nbins the number of bins in each dimension for the histograms */ public BlockHistogramModel(int blocks_x, int blocks_y, int... nbins) { super(nbins.length); this.dims = nbins; this.blocks_x = blocks_x; this.blocks_y = blocks_y; this.histograms = new MultidimensionalHistogram[blocks_y][blocks_x]; for (int y=0; y<blocks_y; y++) for (int x=0; x<blocks_x; x++) histograms[y][x] = new MultidimensionalHistogram(dims); }
/** * Construct with the given parameters * @param blocks_x the number of blocks in the x-direction * @param blocks_y the number of blocks in the y-direction * @param nbins the number of bins in each dimension for the histograms */ public BlockHistogramModel(int blocks_x, int blocks_y, int... nbins) { super(nbins.length); this.dims = nbins; this.blocks_x = blocks_x; this.blocks_y = blocks_y; this.histograms = new MultidimensionalHistogram[blocks_y][blocks_x]; for (int y=0; y<blocks_y; y++) for (int x=0; x<blocks_x; x++) histograms[y][x] = new MultidimensionalHistogram(dims); }
/** * @return a flattened version of the histogram array formed by * concatenating the histograms of all the blocks in scan order. */ public MultidimensionalHistogram toSingleHistogram() { int [] newdims = new int[dims.length + 2]; for (int i=0; i<dims.length; i++) newdims[i] = dims[i]; newdims[dims.length] = blocks_x; newdims[dims.length+1] = blocks_y; MultidimensionalHistogram h = new MultidimensionalHistogram(newdims); for (int y=0; y<blocks_y; y++) { for (int x=0; x<blocks_x; x++) { int blkid = x + y*blocks_x; for (int i=0; i<histograms[y][x].values.length; i++) { h.values[i + blkid*histograms[y][x].values.length] = histograms[y][x].values[i]; } } } return h; }
/** * @return a flattened version of the histogram array formed by * concatenating the histograms of all the blocks in scan order. */ public MultidimensionalHistogram toSingleHistogram() { int [] newdims = new int[dims.length + 2]; for (int i=0; i<dims.length; i++) newdims[i] = dims[i]; newdims[dims.length] = blocks_x; newdims[dims.length+1] = blocks_y; MultidimensionalHistogram h = new MultidimensionalHistogram(newdims); for (int y=0; y<blocks_y; y++) { for (int x=0; x<blocks_x; x++) { int blkid = x + y*blocks_x; for (int i=0; i<histograms[y][x].values.length; i++) { h.values[i + blkid*histograms[y][x].values.length] = histograms[y][x].values[i]; } } } return h; }