Converts an array into array of doubles skipping specified indeces.

@param intArray the input array.
@param skipIndex skip index list.
@return array of doubles.
545497
private static double[] toDoubleAray(Integer[] intArray, HashSet<Integer> skipIndex) {
    double[] res = new double[intArray.length - skipIndex.size()];
    int skip = 0;
    for (int i = 0; i < intArray.length; i++) {
      if (skipIndex.contains(i)) {
        skip++;
        continue;
      }
      res[i - skip] = intArray[i].doubleValue();
    }
    return res;
  }
425547
public static double[] toDouble(int[] array) {
    double[] rv = new double[array.length];
    for (int i = 0; i < array.length; i++) {
      rv[i] = array[i];
    }
    return rv;
  }
672338
public static DoubleStreamEx of(Double[] array) {
        return seq(Arrays.stream(array).mapToDouble(Double::doubleValue));
    }
156760
public void readCoordinate(int[] index, double[] data) throws IOException {
        int size = index.length;
        if (size != data.length)
            throw new IllegalArgumentException(
                    "All arrays must be of the same size");
        for (int i = 0; i < size; ++i) {
            index[i] = getInt();
            data[i] = getDouble();
        }
    }
1085485
public static Double[] wrap(double... values) {
		if (null == values) {
			return null;
		}
		final int length = values.length;
		if (0 == length) {
			return new Double[0];
		}

		final Double[] array = new Double[length];
		for (int i = 0; i < length; i++) {
			array[i] = Double.valueOf(values[i]);
		}
		return array;
	}
609617
@Override
    public INDArray average(INDArray target, INDArray[] arrays) {
        if (arrays == null || arrays.length == 0)
            throw new RuntimeException("Input arrays are missing");

        if (arrays.length == 1) {
            //Edge case - average 1 array - no op
            if(target == null){
                return null;
            }
            return target.assign(arrays[0]);
        }

        long len = target != null ? target.lengthLong() : arrays[0].length();

        PointerPointer dataPointers = new PointerPointer(arrays.length);
        val firstType = arrays[0].dataType();

        for (int i = 0; i < arrays.length; i++) {
            Nd4j.getCompressor().autoDecompress(arrays[i]);

            Preconditions.checkArgument(arrays[i].dataType() == firstType, "All arrays must have the same data type");

            if (arrays[i].elementWiseStride() != 1)
                throw new ND4JIllegalStateException("Native averaging is applicable only to continuous INDArrays");

            if (arrays[i].lengthLong() != len)
                throw new ND4JIllegalStateException("All arrays should have equal length for averaging");

            dataPointers.put(i, arrays[i].data().addressPointer());
        }


        nativeOps.average(null,
                dataPointers, (LongPointer) arrays[0].shapeInfoDataBuffer().addressPointer(),
                null, null,
                target == null ? null : target.data().addressPointer(), target == null ? null : (LongPointer) target.shapeInfoDataBuffer().addressPointer(),
                null, null,
                arrays.length,
                    len,
                true);

        return target;
    }
1026619
public void readArray(double[] data) throws IOException {
        int size = data.length;
        for (int i = 0; i < size; ++i)
            data[i] = getDouble();
    }
1079716
public static double[] stringToDoubleArray( String string, String separator ) {
        if (separator == null) {
            separator = ",";
        }
        String[] stringSplit = string.trim().split(separator);
        double[] array = new double[stringSplit.length];
        for( int i = 0; i < array.length; i++ ) {
            array[i] = Double.parseDouble(stringSplit[i].trim());
        }
        return array;
    }
1180806
public static <T> void arrangeByIndex(T[] array, Integer[] indexes) {
        if(array.length != indexes.length) {
            throw new IllegalArgumentException("The length of the two arrays must match.");
        }
        
        //sort the array based on the indexes
        for(int i=0;i<array.length;i++) {
            int index = indexes[i];
            
            //swap
            T tmp = array[i];
            array[i] = array[index];
            array[index] = tmp;
        }
    }
344076
public static void sort(double[] doubleArray) {
        int index = 0;
        double value = 0.0;
        
        for(int i = 1; i < doubleArray.length; i++) {
            index = i;
            value = doubleArray[index];
            
            while(index > 0 && value < doubleArray[index - 1]) {
                doubleArray[index] = doubleArray[index - 1];
                
                index--;
            }
            
            doubleArray[index] = value;
        }
    }
1053304
public static void quickSort(double[] array, int[] idx, int from, int to) {
		if (from < to) {
			double temp = array[to];
			int tempIdx = idx[to];
			int i = from - 1;
			for (int j = from; j < to; j++) {
				if (array[j] <= temp) {
					i++;
					double tempValue = array[j];
					array[j] = array[i];
					array[i] = tempValue;
					int tempIndex = idx[j];
					idx[j] = idx[i];
					idx[i] = tempIndex;
				}
			}
			array[to] = array[i + 1];
			array[i + 1] = temp;
			idx[to] = idx[i + 1];
			idx[i + 1] = tempIdx;
			quickSort(array, idx, from, i);
			quickSort(array, idx, i + 1, to);
		}
	}
258234
private int skipDouble(int index) {
        while(index<msg.length()) {
            char c=msg.charAt(index);
            // U+221E: Allow the infinity symbol, for ChoiceFormat patterns.
            if((c<'0' && "+-.".indexOf(c)<0) || (c>'9' && c!='e' && c!='E' && c!=0x221e)) {
                break;
            }
            ++index;
        }
        return index;
    }
853002
public static double[] applyIndices (double[] vector, int[] indices) {
        // Initialize the return array:
        final double[] retval = new double[indices.length];

        // Iterate over indices and populate:
        for (int i = 0; i < retval.length; i++) {
            retval[i] = vector[indices[i]];
        }

        // Done, return the return value:
        return retval;
    }
245604
@SuppressWarnings("unchecked")
    public static List<Double> getAt(double[] array, Collection indices) {
        return primitiveArrayGet(array, indices);
    }
567113
@Override
    public double[] toDoubleArray() {
        double[] array = new double[numAttributes()];
        for (int i = 0; i < numValues(); i++) {
            array[index(i)] = valueSparse(i);
        }
        return array;
    }
1009968
public static double getDouble(INDArray arr, int[] indices) {
        long offset = getOffset(arr.shapeInfo(), ArrayUtil.toLongArray(indices));
        return arr.data().getDouble(offset);
    }
192306
public static void sort(int[] intArray) {
        int index = 0;
        int value = 0;
        
        for(int i = 1; i < intArray.length; i++) {
            index = i;
            value = intArray[index];
            

            while(index > 0 && value < intArray[index - 1]) {
                intArray[index] = intArray[index - 1];
                
                index--;
            }
            
            intArray[index] = value;
        }
    }