This method returns first index matching given condition along given dimensions

PLEASE NOTE: This method will return -1 values for missing conditions

@param array
@param condition
@param dimension
@return
340397
public static INDArray firstIndex(INDArray array, Condition condition, int... dimension) {
        if (!(condition instanceof BaseCondition))
            throw new UnsupportedOperationException("Only static Conditions are supported");

        return Nd4j.getExecutioner().exec(new FirstIndex(array, condition, dimension));
    }
300127
public static final DimensionSpec mergeDimensions(int[] firstDimensionNums, int[] firstDimensionSizes,
      int[] secondDimensionNums, int[] secondDimensionSizes) {
    SortedSet<Integer> first = Sets.newTreeSet(Ints.asList(firstDimensionNums));
    SortedSet<Integer> second = Sets.newTreeSet(Ints.asList(secondDimensionNums));
    SortedSet<Integer> all = Sets.newTreeSet(first);
    all.addAll(second);
    
    int[] resultDims = Ints.toArray(all);
    int[] resultSizes = new int[resultDims.length];
    for (int i = 0; i < resultDims.length; i++) {
      int dim = resultDims[i];
      if (first.contains(dim) && second.contains(dim)) {
        int firstIndex = Ints.indexOf(firstDimensionNums, dim);
        int secondIndex = Ints.indexOf(secondDimensionNums, dim);
        int firstSize = firstDimensionSizes[firstIndex];
        int secondSize = secondDimensionSizes[secondIndex];
        Preconditions.checkArgument(firstSize == secondSize,
            "Dimension sizes do not match: dim %s, sizes %s and %s.", dim, firstSize, secondSize);
        resultSizes[i] = firstSize;
      } else if (first.contains(dim)) {
        int firstIndex = Ints.indexOf(firstDimensionNums, dim);
        int firstSize = firstDimensionSizes[firstIndex];
        resultSizes[i] = firstSize;
      } else {
        int secondIndex = Ints.indexOf(secondDimensionNums, dim);
        int secondSize = secondDimensionSizes[secondIndex];
        resultSizes[i] = secondSize;
      }
    }

    return new DimensionSpec(resultDims, resultSizes);
  }
1075028
public static INDArray eq(INDArray x, INDArray y, INDArray z, int... dimensions) {
        if(dimensions == null || dimensions.length == 0) {
            validateShapesNoDimCase(x,y,z);
            return Nd4j.getExecutioner().exec(new OldEqualTo(x,y,z));
        }
        return Nd4j.getExecutioner().exec(new BroadcastEqualTo(x,y,z,dimensions));
    }
58238
public static <T> int indexOf(T[] array, Object value) {
		if (null != array) {
			for (int i = 0; i < array.length; i++) {
				if (ObjectUtil.equal(value, array[i])) {
					return i;
				}
			}
		}
		return INDEX_NOT_FOUND;
	}
405688
public static int get2DArrayXDim(final Object array2D) {
        int dimX = 0;
        if (Array.getLength(array2D) > 0) {
            dimX = Array.getLength(Array.get(array2D, 0));
        }
        return dimX;
    }
1142265
public static int lastIndexOf(double[] array, double val) {
        for (int i=array.length-1; i >= 0; i--) {
            if (array[i] == val) {
                return i;
            }
        }
        return -1;
    }
1152140
public String getDimensionDescription(int dimension) {
        if (dimension < 0 || dimension > pathToIndex.size())
            throw new IllegalArgumentException(
                "invalid dimension: " + dimension);
        // If the cache is out of date, rebuild the reverse mapping.
        if (pathToIndex.size() > indexToPathCache.length) {
            // Lock to ensure safe iteration
            synchronized(this) {
                indexToPathCache = 
                    new String[pathToIndex.size()];
                for (Map.Entry<PathSignature,Integer> e : 
                         pathToIndex.entrySet())
                    indexToPathCache[e.getValue()] = e.getKey().toString();
            }
        }
        return indexToPathCache[dimension];
    }
665331
function getDimension (collection, dimension) {
		const first = collection[0];
		if (first && typeof first.getBoundingClientRect === "function") {
			return first.getBoundingClientRect()[dimension];
		}
	}
1293483
function findIndex (array, predicate) {
  for (let i = 0; i < array.length; i++) {
    if (predicate(array[i])) return i
  }
  return -1
}
751297
public static int indexOf(String[] arr, String value) {
	for (int i = 0; i < arr.length; i++) {
	    if (arr[i].equals(value)) return i;
	}
	return -1;
    }
683639
private function _prepareJoinCondition(array $condition)
	{
		if(count($condition) === 1)
		{
			return $this->condition = '(' . $condition[0]->getColumnName() . ')';
		}

		return $this->condition =
			$condition[0]->getTableName() . '.' . $condition[0]->getColumnName() . ' = ' . $condition[1]->getTableName()
			. '.' . $condition[1]->getColumnName();
	}
349466
public static INDArray neq(INDArray x, INDArray y, INDArray z, int... dimensions) {
        if(dimensions == null || dimensions.length == 0) {
            validateShapesNoDimCase(x,y,z);
            return Nd4j.getExecutioner().exec(new OldNotEqualTo(x,y,z));
        }

        return Nd4j.getExecutioner().exec(new BroadcastNotEqual(x,y,z,dimensions));
    }
1112220
@Override
  public SparseTensor slice(int[] dimensionNumbers, int[] key) {
    if (dimensionNumbers.length == 0) {
      return this;
    }
    // Check for an efficient case, where the dimensions are the first
    // elements of this.
    if (ArrayUtils.subarrayEquals(getDimensionNumbers(), dimensionNumbers, 0)) {
      long minKeyInt = 0;
      int numDimensions = dimensionNumbers.length;
      for (int i = 0; i < numDimensions; i++) {
        minKeyInt += indexOffsets[i] * key[i];
      }
      long maxKeyInt = minKeyInt + indexOffsets[numDimensions - 1];

      int startIndex = getNearestIndex(minKeyInt);
      int endIndex = getNearestIndex(maxKeyInt);

      long[] newKeyInts = ArrayUtils.copyOfRange(keyNums, startIndex, endIndex);
      int numKeyInts = newKeyInts.length;
      for (int i = 0; i < numKeyInts; i++) {
        newKeyInts[i] -= minKeyInt;
      }

      int[] newDimensionNumbers = ArrayUtils.copyOfRange(getDimensionNumbers(), dimensionNumbers.length, getDimensionNumbers().length);
      int[] newDimensionSizes = ArrayUtils.copyOfRange(getDimensionSizes(), dimensionNumbers.length, getDimensionSizes().length);
      double[] newValues = ArrayUtils.copyOfRange(values, startIndex, endIndex);
      return new SparseTensor(newDimensionNumbers, newDimensionSizes, newKeyInts, newValues);
    }

    // TODO(jayantk): This is an extremely naive implementation of
    // slice.
    // Figure out the appropriate sizes for the subset of dimensions.
    int[] dimensionSizes = new int[dimensionNumbers.length];
    for (int i = 0; i < dimensionNumbers.length; i++) {
      int dimIndex = getDimensionIndex(dimensionNumbers[i]);
      Preconditions.checkArgument(dimIndex >= 0);
      dimensionSizes[i] = getDimensionSizes()[dimIndex];
    }
    SparseTensorBuilder builder = new SparseTensorBuilder(dimensionNumbers, dimensionSizes);
    builder.put(key, 1.0);
    return elementwiseProduct(builder.build()).sumOutDimensions(Ints.asList(dimensionNumbers));
  }
1110964
@Override
    public void onNDArrayPartial(INDArray arr, long idx, int... dimensions) {
        INDArray get = this.arr.get();
        get.tensorAlongDimension((int) idx, dimensions).assign(arr);

    }
977071
public static INDArrayIndex[] createFromStartAndEnd(INDArray start, INDArray end) {
        if (start.length() != end.length())
            throw new IllegalArgumentException("Start length must be equal to end length");
        else {
            if (start.length() > Integer.MAX_VALUE)
                throw new ND4JIllegalStateException("Can't proceed with INDArray with length > Integer.MAX_VALUE");

            INDArrayIndex[] indexes = new INDArrayIndex[(int) start.length()];
            for (int i = 0; i < indexes.length; i++) {
                indexes[i] = NDArrayIndex.interval(start.getInt(i), end.getInt(i));
            }
            return indexes;
        }
    }
322569
public static boolean get(boolean[] array, int position) {
        return !(position < 0 || position >= Utils.sizeOf(array)) && array[position];
    }
1228047
def _get_indexers_coords_and_indexes(self, indexers):
        
        from .dataarray import DataArray

        coord_list = []
        indexes = OrderedDict()
        for k, v in indexers.items():
            if isinstance(v, DataArray):
                v_coords = v.coords
                if v.dtype.kind == 'b':
                    if v.ndim != 1:  # we only support 1-d boolean array
                        raise ValueError(
                            '{:d}d-boolean array is used for indexing along '
                            'dimension {!r}, but only 1d boolean arrays are '
                            'supported.'.format(v.ndim, k))
                    # Make sure in case of boolean DataArray, its
                    # coordinate also should be indexed.
                    v_coords = v[v.values.nonzero()[0]].coords

                coord_list.append({d: v_coords[d].variable for d in v.coords})
                indexes.update(v.indexes)

        # we don't need to call align() explicitly or check indexes for
        # alignment, because merge_variables already checks for exact alignment
        # between dimension coordinates
        coords = merge_variables(coord_list)
        assert_coordinate_consistent(self, coords)

        # silently drop the conflicted variables.
        attached_coords = OrderedDict(
            (k, v) for k, v in coords.items() if k not in self._variables
        )
        attached_indexes = OrderedDict(
            (k, v) for k, v in indexes.items() if k not in self._variables
        )
        return attached_coords, attached_indexes