List of usage examples for java.util Arrays stream
public static DoubleStream stream(double[] array, int startInclusive, int endExclusive)
From source file:de.tudarmstadt.ukp.dkpro.core.mallet.internal.wordembeddings.MalletEmbeddingsUtils.java
/** * Convert a single line in the expected format ({@code <token> <value1> ... <valueN>} int a pair * holding the token and the corresponding vector. * * @param line a line/*ww w. ja v a 2 s .c o m*/ * @return a {@link Pair} */ private static Pair<String, double[]> lineToEmbedding(String line) { String[] array = line.split(" "); int size = array.length; double[] vector = Arrays.stream(array, 1, size).mapToDouble(Double::parseDouble).toArray(); return Pair.of(array[0], vector); }
From source file:com.bwc.ora.models.Lrp.java
/** * Get an array containing the gray scale values of the LRP arranged from * smallest y-value to greatest y-value (i.e. top to bottom in the image). * The pixel data is taken from the transformed OCT with all appropriately * applied transformations. Each call to this method will go and grab the * pixel data allowing for updated intensity data to be grabbed immediately. * * @return// w w w. j av a2s .c om */ private int[] getIntensityValues() { BufferedImage octToProcess = transformedOctImage == null ? oct.getTransformedOct() : transformedOctImage; int[] rgbArray = octToProcess.getRGB(x, y, width, height, null, 0, width); return IntStream.range(0, height) .map(scanY -> (int) Math.round(Arrays.stream(rgbArray, width * scanY, width * (scanY + 1)) .map(ImageUtils::calculateGrayScaleValue).average().orElse(0))) .toArray(); }