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

Class AxisVector

    • Method Detail

      • create

        public static AxisVector create(int axisIndex,
                                        int dimensions)
      • axis

        public int axis()
      • magnitude

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

        public double normalise()
        Description copied from class: AVector
        Normalises this vector to a magnitude of 1.0 Has no effect on a zero-length vector (i.e. it will remain zero)
        Specified by:
        normalise in interface IVector
        Overrides:
        normalise in class AVector
        Returns:
        the magnitude of the original vector
      • normaliseCopy

        public AVector normaliseCopy()
        Description copied from class: AVector
        Returns a copy of this vector normalised to a Euclidean length of 1.0 Has no effect on a zero-length vector (i.e. it will return a zero length vector)
        Specified by:
        normaliseCopy in interface IVector
        Overrides:
        normaliseCopy in class AVector
        Returns:
      • 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
      • abs

        public void abs()
        Description copied from interface: INDArray
        Replaces all elements of this array with their absolute values, according to Math.abs(double)
        Specified by:
        abs in interface INDArray
        Overrides:
        abs in class AVector
      • absCopy

        public AxisVector absCopy()
        Description copied from interface: INDArray
        Returns a copy of the array with the abs operator applied to each element
        Specified by:
        absCopy in interface INDArray
        Overrides:
        absCopy in class AVector
        Returns:
        A new array containing the absolute element values
      • 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>
      • sqrtCopy

        public AxisVector sqrtCopy()
        Description copied from interface: IVector
        Computes the square root for each element in this vector, returning a new vector.
        Specified by:
        sqrtCopy in interface IVector
        Overrides:
        sqrtCopy in class AVector
        Returns:
      • 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
      • signumCopy

        public AxisVector signumCopy()
        Description copied from interface: INDArray
        Returns a copy of the array with the signum operator applied to each element
        Specified by:
        signumCopy in interface INDArray
        Overrides:
        signumCopy in class AbstractArray<java.lang.Double>
        Returns:
        A new array containing the signums of element values
      • 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 AVector
      • 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 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:
      • maxAbsElement

        public double maxAbsElement()
        Description copied from class: AVector
        Returns the maximum absolute element value of a vector
        Overrides:
        maxAbsElement 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:
      • minElementIndex

        public int minElementIndex()
        Description copied from class: AVector
        Returns the index of the minimum element of a vector
        Overrides:
        minElementIndex 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 ASparseVector
      • 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 AVector
        Returns:
      • isBoolean

        public boolean isBoolean()
        Description copied from interface: INDArray
        Returns true if the array is boolean (contains only 0.0 or 1.0 values)
        Specified by:
        isBoolean in interface INDArray
        Overrides:
        isBoolean in class AbstractArray<java.lang.Double>
      • isUnitLengthVector

        public boolean isUnitLengthVector()
        Description copied from class: AVector
        Returns true if the vector has unit length
        Overrides:
        isUnitLengthVector in class AVector
        Returns:
      • 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
        Specified by:
        dotProduct in class ASingleElementVector
        Returns:
      • 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 ASingleElementVector
      • 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(Vector3 v)
      • dotProduct

        public double dotProduct(Vector2 v)
      • multiplyCopy

        public AVector multiplyCopy(double d)
        Description copied from interface: INDArray
        Returns a copy of the array with all elements multiplied by a single constant value
        Specified by:
        multiplyCopy in interface INDArray
        Overrides:
        multiplyCopy in class AVector
        Parameters:
        d - A scalar factor
        Returns:
        A new array, with all element values scaled by the given factor
      • innerProduct

        public AVector innerProduct(AMatrix m)
        Description copied from class: AVector
        Computes the inner product of this vector with a matrix
        Overrides:
        innerProduct in class ASparseVector
        Returns:
        a vector representing the inner product
      • 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
      • 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
      • 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 AVector
      • addToArray

        public void addToArray(double[] array,
                               int offset,
                               int stride)
        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 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 AVector
      • 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 ASingleElementVector
      • toNormal

        public Vector toNormal()
        Description copied from class: AVector
        Creates a new mutable vector representing the normalised value of this vector Returns null if the vector cannot be normalised (i.e. is a zero length vector)
        Overrides:
        toNormal in class AVector
        Returns:
      • toVector

        public Vector toVector()
        Description copied from class: AVector
        Coerces this vector to the standard dense Vector format. May return the same vector is this is already a dense Vector, otherwise returns a Vector containing a new clone of the vector elements.
        Specified by:
        toVector in interface INDArray
        Overrides:
        toVector in class AVector
      • 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
      • density

        public double density()
        Description copied from interface: ISparse
        Computes the density ratio of this sparse array (proportion of non-zero elements)
        Specified by:
        density in interface ISparse
        Overrides:
        density in class ASparseVector
        Returns:
      • nonSparseElementCount

        public int nonSparseElementCount()
        Description copied from class: ASparseVector
        Returns the number of non-sparse elements in the sparse vector. This will be greater or equal to the number of non-zero elements
        Overrides:
        nonSparseElementCount in class ASingleElementVector
        Returns:
      • nonSparseIndex

        public Index nonSparseIndex()
        Description copied from class: AVector
        Returns an Index indicating which elements of this vector are defined as non-sparse. A sparse index must be zero. A non-sparse element may be zero, but is typically expected be non-zero.
        Specified by:
        nonSparseIndex in interface ISparseVector
        Overrides:
        nonSparseIndex in class ASingleElementVector
        Returns:
      • 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 ASingleElementVector
        Returns:
      • nonZeroValues

        public double[] nonZeroValues()
        Description copied from class: AVector
        Return an double array specifying the values in this vector which are non-zero
        Overrides:
        nonZeroValues 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 ASparseVector
      • addCopy

        public AVector addCopy(AVector v)
        Description copied from interface: IVector
        Adds a vector element-wise to this vector, returning a new vector.
        Specified by:
        addCopy in interface IVector
        Overrides:
        addCopy in class AVector
        Returns:
      • subCopy

        public AVector subCopy(AVector v)
        Description copied from interface: IVector
        Subtracts a vector element-wise from this vector, returning a new vector.
        Specified by:
        subCopy in interface IVector
        Overrides:
        subCopy in class AVector
        Returns:
      • includesIndex

        public boolean includesIndex(int i)
        Description copied from class: ASparseVector
        Returns true iff the sparse vector contains the index i
        Specified by:
        includesIndex in class ASparseVector
        Returns:
      • 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
      • 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:
      • 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
      • exactClone

        public AxisVector 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 AVector
      • hasUncountable

        public boolean hasUncountable()
        Description copied from class: AbstractArray
        Returns true if any element is this array is NaN or infinite
        Specified by:
        hasUncountable in interface INDArray
        Overrides:
        hasUncountable in class ASparseVector
        Returns:
        True if any element is this array is NaN or infinite, false otherwise
      • elementAbsPowSum

        public double elementAbsPowSum(double p)
        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 ASparseVector
        Returns:

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.