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

Class ADenseArrayVector

    • Method Detail

      • getStride

        public final int getStride()
        ADenseArrayVector has a fixed stride of 1, which enables efficient operations on arrays
        Specified by:
        getStride in class AStridedVector
        Returns:
      • 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 position)
        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
      • selectView

        public AVector selectView(int... inds)
        Description copied from class: AVector
        Selects a subset of indices from a vector, returning a view
        Overrides:
        selectView in class AStridedVector
        Returns:
        a view of the selected indices
      • 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:
      • 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
      • dense

        public ADenseArrayVector dense()
        Description copied from interface: INDArray
        Coerces this INDArray to a dense format, without changing its element values. May return the same INDArray if already dense. 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 dense array may not be fully mutable in all elements.
        Specified by:
        dense in interface INDArray
        Overrides:
        dense in class AVector
      • fillRange

        public void fillRange(int offset,
                              int length,
                              double value)
        Overrides:
        fillRange in class AVector
      • set

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

        public void set(AVector src,
                        int srcOffset)
        Description copied from class: AVector
        Set the vector equal to an offset into another vector
        Overrides:
        set in class AVector
      • 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.
      • get

        public abstract 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 abstract 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 abstract 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 abstract 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
      • add

        public void add(AVector src)
        Description copied from class: AVector
        Adds another vector to this one
        Overrides:
        add in class AVector
      • add

        public void add(AVector src,
                        int srcOffset)
        Description copied from class: AVector
        Adds part another vector to this one, starting at the specified offset in the source vector
        Overrides:
        add in class AVector
      • add

        public void add(int offset,
                        AVector src,
                        int srcOffset,
                        int length)
        Description copied from class: AVector
        Adds a segment of another vector into this one, at the specified offset
        Overrides:
        add in class AStridedVector
      • add

        public void add(int offset,
                        ADenseArrayVector src,
                        int srcOffset,
                        int length)
      • addMultiple

        public void addMultiple(AVector v,
                                double factor)
        Description copied from class: AVector
        Adds a scaled multiple of another vector to this vector
        Overrides:
        addMultiple in class AVector
      • scaleAdd

        public void scaleAdd(double factor,
                             double constant)
        Description copied from class: AVector
        Scales this vector and adds a constant to every element
        Specified by:
        scaleAdd in interface INDArray
        Overrides:
        scaleAdd in class AVector
      • add

        public void add(double constant)
        Description copied from interface: INDArray
        Adds a double value to all elements in this array. Implementations may optimize the case of 0.0
        Specified by:
        add in interface INDArray
        Overrides:
        add in class AVector
      • addProduct

        public void addProduct(AVector a,
                               int aOffset,
                               AVector b,
                               int bOffset,
                               double factor)
        Description copied from class: AVector
        Adds the scaled elementwise product of two vectors to this vector
        Overrides:
        addProduct in class AVector
      • addToArray

        public void addToArray(int offset,
                               double[] destData,
                               int destOffset,
                               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
      • addToArray

        public void addToArray(double[] dest,
                               int destOffset,
                               int destStride)
        Description copied from class: AVector
        Adds this vector to a double[] array, using the specified offset and stride into the destination array
        Overrides:
        addToArray in class AStridedVector
      • addProduct

        public void addProduct(AVector a,
                               AVector b)
        Description copied from class: AVector
        Adds the element-wise product of two vectors to this vector. Mutates this vector.
        Overrides:
        addProduct in class AVector
      • addProduct

        public void addProduct(AVector a,
                               AVector b,
                               double factor)
        Description copied from class: AVector
        Adds the element-wise product of two vectors and a constant factor to this vector. Mutates this vector.
        Overrides:
        addProduct in class AVector
      • addMultipleToArray

        public void addMultipleToArray(double factor,
                                       double[] array,
                                       int arrayOffset)
        Description copied from class: AVector
        Adds a multiple of this vector into a double array at the specified offset
        Overrides:
        addMultipleToArray in class AVector
      • 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
      • addProductToArray

        public void addProductToArray(double factor,
                                      int offset,
                                      AVector other,
                                      int otherOffset,
                                      double[] array,
                                      int arrayOffset,
                                      int length)
        Overrides:
        addProductToArray in class AVector
      • addProductToArray

        public void addProductToArray(double factor,
                                      int offset,
                                      ADenseArrayVector other,
                                      int otherOffset,
                                      double[] array,
                                      int arrayOffset,
                                      int length)
        Description copied from class: AVector
        Adds the scaled elementwise product of this vector and another vector to the destimation array
        Overrides:
        addProductToArray in class AVector
      • add

        public void add(double[] data,
                        int offset)
        Description copied from class: AVector
        Adds to this vector from a given double array.
        Overrides:
        add 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
        Overrides:
        dotProduct in class AStridedVector
      • dotProduct

        public double dotProduct(double[] src,
                                 int srcOffset,
                                 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:
      • log

        public void log()
        Description copied from interface: INDArray
        Computes the natural logarithm (in-place) for all array elements
        Specified by:
        log in interface INDArray
        Overrides:
        log in class AVector
      • exp

        public void exp()
        Description copied from interface: INDArray
        Computes the function e^x (in-place) for all array elements
        Specified by:
        exp in interface INDArray
        Overrides:
        exp in class AbstractArray<java.lang.Double>
      • applyOp

        public void applyOp(Op2 op,
                            AVector b)
        Description copied from class: AVector
        Applies a binary operator to this vector and a second vector
        Overrides:
        applyOp in class AVector
      • reduce

        public double reduce(Op2 op,
                             double init)
        Description copied from interface: INDArray
        Reduces over all elements of the array in row-major order. Applies the operator to the initial/previous result at each step. Returns the final result.
        Specified by:
        reduce in interface INDArray
        Overrides:
        reduce in class AStridedVector
      • reduce

        public double reduce(Op2 op)
        Description copied from interface: INDArray
        Reduces over all elements of the array in row-major order. Applies the operator to the previous result at each step. Returns the final result.
        Specified by:
        reduce in interface INDArray
        Overrides:
        reduce in class AStridedVector
      • elementPowSum

        public double elementPowSum(double exponent)
        Description copied from class: AbstractArray
        Returns the sum of all the elements raised to a specified power
        Specified by:
        elementPowSum in interface INDArray
        Overrides:
        elementPowSum in class AVector
        Returns:
      • elementAbsPowSum

        public double elementAbsPowSum(double exponent)
        Description copied from class: AbstractArray
        Returns the sum of the absolute values of all the elements raised to a specified power
        Specified by:
        elementAbsPowSum in interface INDArray
        Overrides:
        elementAbsPowSum in class AVector
        Returns:
      • elementMax

        public double elementMax()
        Description copied from interface: INDArray
        Returns the maximum element value in this array. Throws an error if there are no elements.
        Specified by:
        elementMax in interface INDArray
        Overrides:
        elementMax in class AStridedVector
      • elementMin

        public double elementMin()
        Description copied from interface: INDArray
        Returns the maximum element value in this array. Throws an error if there are no elements.
        Specified by:
        elementMin in interface INDArray
        Overrides:
        elementMin in class AStridedVector
      • maxAbsElement

        public double maxAbsElement()
        Description copied from class: AVector
        Returns the maximum absolute element value of a vector
        Overrides:
        maxAbsElement in class AArrayVector
        Returns:
      • minElementIndex

        public int minElementIndex()
        Description copied from class: AVector
        Returns the index of the minimum element of a vector
        Overrides:
        minElementIndex in class AVector
      • maxElementIndex

        public int maxElementIndex()
        Description copied from class: AVector
        Returns the index of the maximum element of a vector
        Overrides:
        maxElementIndex in class AVector
        Returns:
      • maxAbsElementIndex

        public int maxAbsElementIndex()
        Description copied from class: AVector
        Returns the index of the maximum absolute element of a vector
        Overrides:
        maxAbsElementIndex in class AVector
        Returns:
      • nonZeroCount

        public long nonZeroCount()
        Description copied from interface: INDArray
        Returns the number of non-zero elements in the array.
        Specified by:
        nonZeroCount in interface INDArray
        Overrides:
        nonZeroCount in class AVector
      • nonZeroIndices

        public int[] nonZeroIndices()
        Description copied from class: AVector
        Return an int array specifying the positions in this vector which are non-zero
        Overrides:
        nonZeroIndices in class AVector
        Returns:
      • visitNonZero

        public double visitNonZero(IndexedElementVisitor elementVisitor)
        Description copied from class: AVector
        Visits all non-zero elements of this vector. Visitor may return a non-zero value to terminate early, which will return the given value. Returns 0.0 otherwise.
        Overrides:
        visitNonZero in class AStridedVector
      • square

        public void square()
        Description copied from interface: INDArray
        Squares all elements of the array in place
        Specified by:
        square in interface INDArray
        Overrides:
        square in class AVector
      • sqrt

        public void sqrt()
        Description copied from interface: INDArray
        Computes the square root of all elements in the array
        Specified by:
        sqrt in interface INDArray
        Overrides:
        sqrt in class AbstractArray<java.lang.Double>
      • signum

        public void signum()
        Description copied from interface: INDArray
        Calculates the signum of all elements of this mutable array Sets each component of the array to its sign value (-1, 0 or 1)
        Specified by:
        signum in interface INDArray
        Overrides:
        signum in class AVector
      • multiply

        public void multiply(AVector v)
        Description copied from class: AVector
        Multiplies this vector by another vector, elementwise.
        Overrides:
        multiply in class AVector
      • multiply

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

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

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

        public void copyTo(int start,
                           AVector dest,
                           int destOffset,
                           int length)
        Description copied from class: AVector
        Copies a subset of this vector to a vector at the specified offset
        Overrides:
        copyTo in class AVector
      • copyTo

        public void copyTo(int offset,
                           ADenseArrayVector dest,
                           int destOffset,
                           int length)
      • 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 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
      • addMultiple

        public void addMultiple(int offset,
                                AVector src,
                                int srcOffset,
                                int length,
                                double factor)
        Overrides:
        addMultiple in class AVector
      • scaleAdd

        public void scaleAdd(double factor,
                             AVector v,
                             double vfactor,
                             double constant)
        Description copied from class: AVector
        Scales all elements of the array by a given double value, adds a scaled second vector and adds a constant value
        Overrides:
        scaleAdd in class AVector
      • magnitude

        public double magnitude()
        Description copied from class: AVector
        Returns the magnitude (Euclidean length) of the vector
        Overrides:
        magnitude in class AVector
        Returns:
      • fill

        public void fill(double value)
        Description copied from class: AVector
        Fills the entire vector with a given value
        Specified by:
        fill in interface INDArray
        Overrides:
        fill in class AVector
      • pow

        public void pow(double exponent)
        Description copied from interface: INDArray
        Raises all elements of the array to a specified power in place
        Specified by:
        pow in interface INDArray
        Overrides:
        pow in class AVector
      • reciprocal

        public void reciprocal()
        Description copied from class: AVector
        Computes the reciprocal of all elements in this vector. Mutates this vector
        Specified by:
        reciprocal in interface INDArray
        Overrides:
        reciprocal in class AVector
      • clamp

        public void clamp(double min,
                          double max)
        Description copied from class: AVector
        Clamps all values in the vector to a given range
        Specified by:
        clamp in interface INDArray
        Overrides:
        clamp in class AVector
      • multiply

        public void multiply(double factor)
        Description copied from class: AVector
        Multiplies the vector by a constant factor
        Specified by:
        multiply in interface INDArray
        Overrides:
        multiply in class AVector
        Parameters:
        factor - Factor by which to multiply each component of the vector
      • tryEfficientJoin

        public AVector tryEfficientJoin(AVector v)
        Description copied from class: AVector
        Attempts to perform an efficient join with a second vector. An efficient join is guaranteed to be better than a simple JoinedVector(left,right) If possible, returns the joined vector. If not, returns null
        Overrides:
        tryEfficientJoin in class AVector
      • equals

        public boolean equals(INDArray v)
        Description copied from interface: INDArray
        Checks if two arrays are equal exactly in terms of both value and shape Element equality checks are consistent with compareTo
        Specified by:
        equals in interface INDArray
        Overrides:
        equals 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:
      • elementsEqual

        public boolean elementsEqual(double value)
        Description copied from interface: INDArray
        Returns true if all elements are equal to a specific value
        Specified by:
        elementsEqual in interface INDArray
        Overrides:
        elementsEqual in class AVector
      • 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

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.