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

Class ImmutableVector

    • Field Detail

      • offset

        public final int offset
    • Method Detail

      • create

        public static ImmutableVector create(AVector v)
        Create an ImmutableVector with a copy of the elements in the source vector
        Parameters:
        v -
        Returns:
      • wrap

        public static ImmutableVector wrap(double[] data)
        Wraps the given double array as an ImmutableVector. Caller should ensure that the data array is never subsequently modified
        Parameters:
        data -
        Returns:
      • wrap

        public static ImmutableVector wrap(double[] data,
                                           int offset,
                                           int length)
      • isMutable

        public boolean isMutable()
        Description copied from class: AVector
        Returns true if this vector is mutable.
        Specified by:
        isMutable in interface INDArray
        Overrides:
        isMutable in class AVector
      • isFullyMutable

        public boolean isFullyMutable()
        Description copied from class: AVector
        Returns true if this vector is fully mutable, i.e. can contain any unconstrained double values
        Specified by:
        isFullyMutable in interface INDArray
        Overrides:
        isFullyMutable in class AVector
      • 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
      • isZero

        public boolean isZero()
        Description copied from class: AVector
        Returns true if this vector is a zero vector (all components zero)
        Specified by:
        isZero in interface INDArray
        Overrides:
        isZero in class AVector
      • isRangeZero

        public boolean isRangeZero(int start,
                                   int length)
        Description copied from class: AVector
        Returns true if a sub-vector range is completely zero. Unsafe operation - does not perform bounds checking, results are undefined if sub-vector is out of range
        Overrides:
        isRangeZero in class AStridedVector
        Returns:
      • slice

        public final ImmutableScalar 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 AArrayVector
      • subVector

        public AVector subVector(int start,
                                 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
      • toDoubleBuffer

        public void toDoubleBuffer(java.nio.DoubleBuffer dest)
        Description copied from interface: INDArray
        Copies the elements of this INDArray to the specified double buffer.
        Specified by:
        toDoubleBuffer in interface INDArray
        Overrides:
        toDoubleBuffer in class AVector
      • toDoubleArray

        public double[] toDoubleArray()
        Description copied from interface: INDArray
        Copies the elements of this array to a new double[] array.
        Specified by:
        toDoubleArray in interface INDArray
        Overrides:
        toDoubleArray in class AVector
      • getElements

        public void getElements(double[] data,
                                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 AStridedVector
      • 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
      • multiplyTo

        public void multiplyTo(double[] data,
                               int offset)
        Description copied from class: AVector
        Multiplies the elements in the target array by corresponding elements in this vector
        Overrides:
        multiplyTo in class AVector
        offset - The offset into the target array
      • addToArray

        public void addToArray(double[] array,
                               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
      • addToArray

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

        public void addMultipleToArray(double factor,
                                       int offset,
                                       double[] array,
                                       int arrayOffset,
                                       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 AStridedVector
      • divideTo

        public void divideTo(double[] data,
                             int offset)
        Description copied from class: AVector
        Divides the elements in the target array by corresponding elements in this vector
        Overrides:
        divideTo in class AVector
        offset - The offset into the target array
      • 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
        Overrides:
        dotProduct in class AStridedVector
      • 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
      • dotProduct

        public double dotProduct(AVector v)
        Description copied from class: AVector
        Returns the dot product of this vector with another vector The vectors must have the same length: if not the result is undefined
        Overrides:
        dotProduct in class AStridedVector
        Returns:
      • get

        public 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
      • set

        public 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
      • unsafeGet

        public 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
      • unsafeSet

        public 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 v)
        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
        Specified by:
        addAt in class AStridedVector
      • iterator

        public java.util.Iterator<java.lang.Double> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.Double>
        Overrides:
        iterator in class AStridedVector
      • hashCode

        public int hashCode()
        Description copied from class: AVector
        Computes the hashcode of a vector. Currently defined to be equal to List.hashCode for a equivalent list of Double values, this may change in future versions.
        Overrides:
        hashCode in class AVector
      • equals

        public boolean equals(AVector v)
        Description copied from class: AbstractArray
        Returns true if this array is exactly equal to a vector.
        Overrides:
        equals in class AStridedVector
        Returns:
      • 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 AStridedVector
        Parameters:
        data - Array of double element values to check for equality
        offset - Offset into the data array
        Returns:
      • clone

        public Vector clone()
        Description copied from class: AVector
        Clones the vector, creating a new mutable copy of all data. The clone is: - not guaranteed to be of the same type. - guaranteed to be fully mutable - guaranteed not to contain a reference (i.e. is a full deep copy)
        Specified by:
        clone in interface INDArray
        Specified by:
        clone in interface IVector
        Overrides:
        clone in class AStridedVector
      • sparse

        public AVector sparse()
        Description copied from interface: INDArray
        Coerces this INDArray to a sparse format, without changing its element values. May return the same INDArray if already sparse. May also mutate the internal structure of the original NDArray, or create a view over parts of the original INDArray. You should take a defensive copy of the original NDArray if any of this concerns you. The returned sparse array may not be fully mutable in all elements.
        Specified by:
        sparse in interface INDArray
        Overrides:
        sparse in class AVector
      • exactClone

        public AVector exactClone()
        Description copied from class: AVector
        Returns an exact clone of this vector, i.e. of the same type
        Specified by:
        exactClone in interface INDArray
        Specified by:
        exactClone in class AVector
        Returns:
        A clone of the original array
      • 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
        Overrides:
        validate in class AStridedVector
      • set

        public void set(AVector v)
        Description copied from class: AVector
        Sets the vector to equal the value of another vector
        Specified by:
        set in class AStridedVector
      • setElements

        public void setElements(double[] values,
                                int offset)
        Description copied from interface: INDArray
        Sets all elements in an array using the given double values
        Specified by:
        setElements in interface INDArray
        Specified by:
        setElements in class AStridedVector
        Parameters:
        values - Element values in a double[] array. There must be at least as many element values as elements in this array.
        offset - Position in the values array from which to start taking values.
      • setElements

        public void setElements(int pos,
                                double[] values,
                                int offset,
                                int length)
        Description copied from interface: INDArray
        Sets elements in an array using the given double values. The source array must contain at least the specified length in terms of number of elements
        Specified by:
        setElements in interface INDArray
        Specified by:
        setElements in class AStridedVector
        Parameters:
        pos - Offset into this array, expressed in terms of number of elements in row major order
        values - Element values in a double[] array. There must be at least as many element values as elements in this array.
        offset - Position in the values array from which to start taking values.
        length - Number of elements to set.
      • 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
        Specified by:
        applyOp in class AStridedVector

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.