Documentation of 'mikera.vectorz.util.IntArrays' Java class
IntArrays
mikera.vectorz.util

Class IntArrays



  • public class IntArrays
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int[] EMPTY_INT_ARRAY 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static void add(int[] as, int v) 
      static long arrayProduct(int[] vs)
      Computes the product of an array of integers.
      static long arrayProduct(int[] vs, int from, int to) 
      static int[] calcStrides(int[] shape)
      Computes the standard packed array strides for a given shape.
      static int[] concat(int[] as, int[] bs)
      Concatenates two integer arrays.
      static int[] consArray(int a, int[] as) 
      static double[] copyIntsToDoubles(int[] src, int srcOffset, double[] dst, int dstOffset, int length) 
      static long[] copyIntsToLongs(int[] src) 
      static long[] copyIntsToLongs(int[] src, long[] dst) 
      static int[] copyOf(int[] data) 
      static int[] copyOf(long[] xs) 
      static int[] create(double[] ls) 
      static int[] create(int size)
      Creates a new int array.
      static int[] create(java.util.List<?> ls) 
      static int[] create(java.lang.Object o) 
      static int[] decrementAll(int[] xs) 
      static int dotProduct(int[] xs, int[] ys) 
      static boolean equals(int[] as, int[] bs)
      Tests if two int array scontain equal values.
      static int[] incrementAll(int[] xs) 
      static int indexLookup(int[] data, int i)
      Finds the position of a value in a sorted index, or -1 if before the array.
      static int indexPosition(int[] data, int x) 
      static int indexPosition(int[] data, int x, int min, int max) 
      static int[] insert(int[] data, int position, int value)
      Inserts a new integer value into a specified position in an int[] array.
      static int[] intersectSorted(int[] xs, int[] ys)
      Intersects two distinct sorted integer arrays, returning the intersection of all values WARNINGS: 1.
      static boolean isRange(int[] as) 
      static boolean isZero(int[] as) 
      static int[] mergeSorted(int[] xs, int[] ys)
      Merges two distinct sorted integer arrays, returning the union of all values WARNINGS: 1.
      static int[] of(int... ints) 
      static int[] rand(int[] shape)
      Creates a randomised int[] array, each element in the range [0..max) where max is the corresponding element in the shape array
      static int[] rand(int[] shape, java.util.Random r) 
      static int[] removeIndex(int[] data, int index)
      Removes an element from a specified position in an int[] array.
      static int[] reverse(int[] data) 
      static int seekPosition(int[] data, int i) 
      static int seekPosition(int[] data, int i, int min, int max) 
      static int[] select(int[] source, int... inds) 
      static void swap(int[] inds, int a, int b) 
      static int[] tailArray(int[] as) 
      static boolean validIndex(int[] as, int[] shape) 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EMPTY_INT_ARRAY

        public static final int[] EMPTY_INT_ARRAY
    • Method Detail

      • of

        public static int[] of(int... ints)
      • create

        public static int[] create(java.lang.Object o)
      • create

        public static int[] create(int size)
        Creates a new int array. Use the default EMPTY_INT_ARRAY if requested size is zero
        Parameters:
        size -
        Returns:
      • create

        public static int[] create(double[] ls)
      • create

        public static int[] create(java.util.List<?> ls)
      • removeIndex

        public static int[] removeIndex(int[] data,
                                        int index)
        Removes an element from a specified position in an int[] array.
        Parameters:
        data -
        index -
        Returns:
        A new array copy with one element removed
      • reverse

        public static int[] reverse(int[] data)
      • consArray

        public static int[] consArray(int a,
                                      int[] as)
      • tailArray

        public static int[] tailArray(int[] as)
      • copyIntsToLongs

        public static long[] copyIntsToLongs(int[] src,
                                             long[] dst)
      • copyIntsToDoubles

        public static double[] copyIntsToDoubles(int[] src,
                                                 int srcOffset,
                                                 double[] dst,
                                                 int dstOffset,
                                                 int length)
      • copyIntsToLongs

        public static long[] copyIntsToLongs(int[] src)
      • arrayProduct

        public static long arrayProduct(int[] vs)
        Computes the product of an array of integers.
        Parameters:
        vs -
        Returns:
      • arrayProduct

        public static long arrayProduct(int[] vs,
                                        int from,
                                        int to)
      • calcStrides

        public static final int[] calcStrides(int[] shape)
        Computes the standard packed array strides for a given shape.
        Parameters:
        shape -
        Returns:
      • equals

        public static boolean equals(int[] as,
                                     int[] bs)
        Tests if two int array scontain equal values.
        Parameters:
        as -
        bs -
        Returns:
      • rand

        public static int[] rand(int[] shape)
        Creates a randomised int[] array, each element in the range [0..max) where max is the corresponding element in the shape array
        Parameters:
        shape -
        Returns:
      • rand

        public static int[] rand(int[] shape,
                                 java.util.Random r)
      • dotProduct

        public static int dotProduct(int[] xs,
                                     int[] ys)
      • indexLookup

        public static final int indexLookup(int[] data,
                                            int i)
        Finds the position of a value in a sorted index, or -1 if before the array.
      • seekPosition

        public static int seekPosition(int[] data,
                                       int i)
      • seekPosition

        public static int seekPosition(int[] data,
                                       int i,
                                       int min,
                                       int max)
      • indexPosition

        public static int indexPosition(int[] data,
                                        int x)
      • indexPosition

        public static int indexPosition(int[] data,
                                        int x,
                                        int min,
                                        int max)
      • decrementAll

        public static int[] decrementAll(int[] xs)
      • incrementAll

        public static int[] incrementAll(int[] xs)
      • swap

        public static void swap(int[] inds,
                                int a,
                                int b)
      • copyOf

        public static final int[] copyOf(int[] data)
      • isZero

        public static boolean isZero(int[] as)
      • isRange

        public static boolean isRange(int[] as)
      • insert

        public static int[] insert(int[] data,
                                   int position,
                                   int value)
        Inserts a new integer value into a specified position in an int[] array. Returns a new int[] array.
        Parameters:
        data -
        position -
        value -
        Returns:
      • mergeSorted

        public static int[] mergeSorted(int[] xs,
                                        int[] ys)
        Merges two distinct sorted integer arrays, returning the union of all values WARNINGS: 1. may return one of the original arrays. 2. Does not check for consistency of input.
        Parameters:
        xs -
        ys -
        Returns:
      • intersectSorted

        public static int[] intersectSorted(int[] xs,
                                            int[] ys)
        Intersects two distinct sorted integer arrays, returning the intersection of all values WARNINGS: 1. may return one of the original arrays. 2. Does not check for consistency of input.
        Parameters:
        xs -
        ys -
        Returns:
      • validIndex

        public static boolean validIndex(int[] as,
                                         int[] shape)
      • select

        public static int[] select(int[] source,
                                   int... inds)
      • add

        public static void add(int[] as,
                               int v)
      • copyOf

        public static int[] copyOf(long[] xs)
      • concat

        public static int[] concat(int[] as,
                                   int[] bs)
        Concatenates two integer arrays. If one is empty, returns the other unchanged.
        Parameters:
        as -
        bs -
        Returns:

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.