Documentation of 'org.nd4j.linalg.indexing.Indices' Java class
Indices
org.nd4j.linalg.indexing

Class Indices



  • public class Indices
    extends java.lang.Object
    Indexing util.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Indices() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static NDArrayIndex[] adjustIndices(int[] originalShape, NDArrayIndex... indexes)
      Prunes indices of greater length than the shape and fills in missing indices if there are any
      static NDArrayIndex[] fillIn(int[] shape, NDArrayIndex... indexes)
      Fill in the missing indices to be the same length as the original shape.
      static boolean isContiguous(int[] indices)
      Returns whether the indices are contiguous by one or not
      static boolean isContiguous(int[] indices, int diff)
      Returns whether indices are contiguous by a certain amount or not
      static boolean isContiguous(int diff, NDArrayIndex... indexes)
      Returns whether indices are contiguous by a certain amount or not
      static boolean isContiguous(NDArrayIndex... indexes)
      Returns whether the indices are contiguous by one or not
      static int[] offsets(NDArrayIndex... indices)
      The offsets (begin index) for each index
      static int[] shape(int[] shape, NDArrayIndex... indices)
      Calculate the shape for the given set of indices.
      static int[] shape(NDArrayIndex... indices)
      Calculate the shape for the given set of indices.
      static int[] strides(char ordering, NDArrayIndex... indexes)
      Calculate the strides based on the given indices
      • Methods inherited from class java.lang.Object

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

      • Indices

        public Indices()
    • Method Detail

      • offsets

        public static int[] offsets(NDArrayIndex... indices)
        The offsets (begin index) for each index
        Parameters:
        indices - the indices
        Returns:
        the offsets for the given set of indices
      • fillIn

        public static NDArrayIndex[] fillIn(int[] shape,
                                            NDArrayIndex... indexes)
        Fill in the missing indices to be the same length as the original shape. Think of this as what fills in the indices for numpy or matlab: Given a which is (4,3,2) in numpy: a[1:3] is filled in by the rest to give back the full slice This algorithm fills in that delta
        Parameters:
        shape - the original shape
        indexes - the indexes to start from
        Returns:
        the filled in indices
      • adjustIndices

        public static NDArrayIndex[] adjustIndices(int[] originalShape,
                                                   NDArrayIndex... indexes)
        Prunes indices of greater length than the shape and fills in missing indices if there are any
        Parameters:
        originalShape - the original shape to adjust to
        indexes - the indexes to adjust
        Returns:
        the adjusted indices
      • strides

        public static int[] strides(char ordering,
                                    NDArrayIndex... indexes)
        Calculate the strides based on the given indices
        Parameters:
        ordering - the ordering to calculate strides for
        indexes - the indices to calculate stride for
        Returns:
        the strides for the given indices
      • shape

        public static int[] shape(NDArrayIndex... indices)
        Calculate the shape for the given set of indices. The shape is defined as (for each dimension) the difference between the end index + 1 and the begin index
        Parameters:
        indices - the indices to calculate the shape for
        Returns:
        the shape for the given indices
      • isContiguous

        public static boolean isContiguous(NDArrayIndex... indexes)
        Returns whether the indices are contiguous by one or not
        Parameters:
        indexes - the indices to test
        Returns:
        whether the indices are contiguous by one or not
      • isContiguous

        public static boolean isContiguous(int diff,
                                           NDArrayIndex... indexes)
        Returns whether indices are contiguous by a certain amount or not
        Parameters:
        indexes - the indices to test
        diff - the difference considered to be contiguous
        Returns:
        whether the given indices are contiguous or not
      • isContiguous

        public static boolean isContiguous(int[] indices)
        Returns whether the indices are contiguous by one or not
        Parameters:
        indices - the indices to test
        Returns:
        whether the indices are contiguous by one or not
      • isContiguous

        public static boolean isContiguous(int[] indices,
                                           int diff)
        Returns whether indices are contiguous by a certain amount or not
        Parameters:
        indices - the indices to test
        diff - the difference considered to be contiguous
        Returns:
        whether the given indices are contiguous or not
      • shape

        public static int[] shape(int[] shape,
                                  NDArrayIndex... indices)
        Calculate the shape for the given set of indices. The shape is defined as (for each dimension) the difference between the end index + 1 and the begin index If specified, this will check for whether any of the indices are >= to end - 1 and if so, prune it down
        Parameters:
        shape - the original shape
        indices - the indices to calculate the shape for
        Returns:
        the shape for the given indices

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.