Class DoubleVector

  • All Implemented Interfaces:
    VectorI, java.io.Serializable

    public final class DoubleVector
    extends java.lang.Object
    implements VectorI, java.io.Serializable
    A vector where the elements are doubles
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      double[] data  
      int nrows  
    • Constructor Summary

      Constructors 
      Constructor Description
      DoubleVector​(double[] data)  
    • Field Detail

      • data

        public final double[] data
      • nrows

        public final int nrows
    • Constructor Detail

      • DoubleVector

        public DoubleVector​(double[] data)
        Parameters:
        data -
    • Method Detail

      • newInstance

        public static DoubleVector newInstance​(java.lang.Double[] in)
      • newInstance

        public static DoubleVector newInstance​(double[] in)
      • getEle

        public java.lang.Double getEle​(int i)
        Description copied from interface: VectorI
        Gets the i-th element of a vector
        Specified by:
        getEle in interface VectorI
        Parameters:
        i - index (starts from 0)
        Returns:
        the i-th element
      • getNEles

        public int getNEles()
        Description copied from interface: VectorI
        Gets the number of elements of a vector
        Specified by:
        getNEles in interface VectorI
        Returns:
        the number of elements
      • getDimensions

        public Dimensions getDimensions()
        Description copied from interface: VectorI
        Gets the dimensions of the Vector or Matrix
        Specified by:
        getDimensions in interface VectorI
        Returns:
        the dimensions
      • toArray

        public double[] toArray()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Uses the Double.equals() rather than == for compatibility with hashcode. Hence NaN equals NaN and -0.0 equals 0.0. Use eq(DoubleVector) for comparison using ==.
        Overrides:
        equals in class java.lang.Object