Documentation of 'mikera.vectorz.impl.IndexedArrayVector' Java class
IndexedArrayVector
mikera.vectorz.impl

Class IndexedArrayVector

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<java.lang.Double>, INDArray, IVector


    public final class IndexedArrayVector
    extends ASizedVector
    Vector that addresses elements indexed into double[] array. Useful for sub-selections views of array data
    See Also:
    Serialized Form
    • Method Detail

      • wrap

        public static IndexedArrayVector wrap(double[] data,
                                              int[] indexes)
        Wraps the specified indexes into a double[] array as an IndexedArrayVector The length of the vector will equal the number of indices provided.
        Parameters:
        data -
        indexes -
        Returns:
      • get

        public final double get(int i)
        Description copied from interface: INDArray
        Returns the double value at the specified position in a 1D vector
        Specified by:
        get in interface INDArray
        Specified by:
        get in interface IVector
        Specified by:
        get in class AVector
      • unsafeGet

        public final double unsafeGet(int i)
        Description copied from class: AVector
        Like get, but performs no bounds checking. Results are undefined if the index is out of range
        Overrides:
        unsafeGet in class AVector
      • selectView

        public IndexedArrayVector selectView(int... inds)
        Description copied from class: AVector
        Selects a subset of indices from a vector, returning a view
        Overrides:
        selectView in class AVector
        Returns:
        a view of the selected indices
      • set

        public final void set(int i,
                              double value)
        Description copied from interface: INDArray
        Sets a value at a given position in a mutable 1D array
        Specified by:
        set in interface INDArray
        Specified by:
        set in interface IVector
        Specified by:
        set in class AVector
      • unsafeSet

        public final void unsafeSet(int i,
                                    double value)
        Description copied from class: AVector
        Like set, but performs no bounds checking. Results are undefined if the index is out of range
        Overrides:
        unsafeSet in class AVector
      • addAt

        public void addAt(int i,
                          double value)
        Description copied from class: AVector
        Adds a value to a specific element of the vector This function does not perform bounds checking, i.e. is an unsafe operation
        Overrides:
        addAt in class AVector
      • applyOp

        public void applyOp(Op op)
        Description copied from interface: INDArray
        Applies a unary operator to all elements of the array (in-place)
        Specified by:
        applyOp in interface INDArray
        Overrides:
        applyOp in class AVector
      • subVector

        public AVector subVector(int offset,
                                 int length)
        Description copied from class: AVector
        Obtains a sub-vector view that refers to this vector. Changes to the sub-vector will be reflected in this vector
        Overrides:
        subVector in class AVector
      • slice

        public ArrayIndexScalar slice(int i)
        Description copied from interface: INDArray
        Returns the specified major slice of this array as a view (slice along dimension 0) 0 dimensional slice results are permitted, but attempting to slice a 0 dimensional array will result in an error.
        Specified by:
        slice in interface INDArray
        Overrides:
        slice in class AVector
      • getElements

        public void getElements(double[] dest,
                                int offset)
        Description copied from interface: INDArray
        Copies all elements of this array a double array at the specified offset
        Specified by:
        getElements in interface INDArray
        Overrides:
        getElements in class AVector
      • copyTo

        public void copyTo(int offset,
                           double[] dest,
                           int destOffset,
                           int length)
        Description copied from class: AVector
        Copies a subset of this vector to a specified destination array offset
        Overrides:
        copyTo in class AVector
      • copyTo

        public void copyTo(int offset,
                           double[] dest,
                           int destOffset,
                           int length,
                           int stride)
        Description copied from class: AVector
        Copies a subset of this vector to a specified destination array offset using the given stride. Unsafe operation: performs no bounds checking
        Overrides:
        copyTo in class AVector
      • addToArray

        public void addToArray(double[] dest,
                               int offset)
        Description copied from class: AVector
        Adds this vector to a double[] array, starting at the specified offset.
        Specified by:
        addToArray in interface INDArray
        Overrides:
        addToArray in class AVector
      • addMultipleToArray

        public void addMultipleToArray(double factor,
                                       int offset,
                                       double[] dest,
                                       int destOffset,
                                       int length)
        Description copied from class: AVector
        Adds a multiple of a subvector of this vector into a double array at the specified offset
        Overrides:
        addMultipleToArray in class AVector
      • dotProduct

        public double dotProduct(double[] data,
                                 int offset)
        Description copied from class: AVector
        Fast dot product with a double[] array. Performs no bounds checking. Likely to be faster than most other dot product operations
        Specified by:
        dotProduct in class AVector
      • dotProduct

        public double dotProduct(double[] data,
                                 int offset,
                                 int stride)
        Description copied from class: AVector
        Fast dot product with a double[] array and a stride. Performs no bounds checking. Likely to be faster than other dot product operations
        Overrides:
        dotProduct in class AVector
      • equalsArray

        public boolean equalsArray(double[] data,
                                   int offset)
        Description copied from class: AVector
        Returns true if this vector exactly matches the elements in double[] array, starting from the specified offset
        Specified by:
        equalsArray in interface INDArray
        Overrides:
        equalsArray in class ASizedVector
        Parameters:
        data - Array of double element values to check for equality
        offset - Offset into the data array
        Returns:
      • validate

        public void validate()
        Description copied from interface: INDArray
        Validates the internal data structure of the INDArray. Throws an exception on failure. Failure indicates a serious bug and/or data corruption.
        Specified by:
        validate in interface INDArray
      • isView

        public boolean isView()
        Description copied from class: AVector
        Returns true if this vector is of a view type that references other vectors / data.
        Specified by:
        isView in interface INDArray
        Overrides:
        isView in class AVector

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.