Documentation of 'jsat.linear.SubVector' Java class
SubVector
jsat.linear

Class SubVector

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<IndexValue>


    public class SubVector
    extends Vec
    SubVector takes an already existing vector and creates a new one that is a subset of and backed by the original one. Altering the sub vector will effect the original and vise versa.
    See Also:
    Serialized Form
    • Constructor Detail

      • SubVector

        public SubVector(int startPosition,
                         int length,
                         Vec vec)
        Creates a new sub vector of the input vector
        Parameters:
        startPosition - the starting index (inclusive) or the original vector
        length - the length of the new sub vector
        vec - the original vector to back this sub vector.
    • Method Detail

      • length

        public int length()
        Description copied from class: Vec
        Returns the length of this vector
        Specified by:
        length in class Vec
        Returns:
        the length of this vector
      • get

        public double get(int index)
        Description copied from class: Vec
        Gets the value stored at a specific index in the vector
        Specified by:
        get in class Vec
        Parameters:
        index - the index to access
        Returns:
        the double value in the vector
      • set

        public void set(int index,
                        double val)
        Description copied from class: Vec
        Sets the value stored at a specified index in the vector
        Specified by:
        set in class Vec
        Parameters:
        index - the index to access
        val - the value to store in the index
      • isSparse

        public boolean isSparse()
        Description copied from class: Vec
        Indicates whether or not this vector is optimized for sparce computation, meaning that most values in the vector are zero - and considered implicit. Only non-zero values are stored.
        Specified by:
        isSparse in class Vec
        Returns:
        true if the vector is sparce, false otherwise.
      • getNonZeroIterator

        public java.util.Iterator<IndexValue> getNonZeroIterator(int start)
        Description copied from class: Vec
        Returns an iterator that will go over the non zero values starting from the specified index in the given vector. The iterator does not support the Iterator.remove() method.

        This method should be overloaded for a serious implementation.
        Overrides:
        getNonZeroIterator in class Vec
        Parameters:
        start - the first index (inclusive) to start returning non-zero values from
        Returns:
        an iterator for the non zero index value pairs
      • clone

        public Vec clone()
        Specified by:
        clone in class Vec

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.