Here you can find the source of min(double values[], boolean[] mask)
Parameter | Description |
---|---|
values | the vector |
mask | mask denoting from which elements the minimum should be selected |
public static double min(double values[], boolean[] mask)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w . j a v a 2s . c om*/ * Finds minimum value in the given vector. * @param values the vector * @return the minimum in the given vector */ public static double min(double values[]) { double min = Double.POSITIVE_INFINITY; for (double value : values) { if (value < min) min = value; } return min; } /** * Finds minimum value in the given vector . * @param values the vector * @param mask mask denoting from which elements the minimum should be selected * @return the minimum in the given vector (w.r.t. the given mask) */ public static double min(double values[], boolean[] mask) { double min = Double.POSITIVE_INFINITY; int i = 0; for (double value : values) { if (mask[i] && value < min) { min = value; } i++; } return min; } /** * Finds minimum value in the given vector. * @param values the vector * @return the minimum in the given vector */ public static int min(int values[]) { int min = Integer.MAX_VALUE; for (int value : values) { if (value < min) min = value; } return min; } }