DataPoint
jminhep.cluster

Class DataPoint

    • Constructor Detail

      • DataPoint

        public DataPoint(double[] xx,         int dim)
        Creates a new instance of a data point
        Parameters:
        xx - array of dimension dim
        dim - dimension
      • DataPoint

        public DataPoint(double[] xx)
        Creates a new instance of a data point
        Parameters:
        xx - array
    • Method Detail

      • getDimension

        public int getDimension()
        Get dimension of the point
        Returns:
        dimension (int)
      • assignToCluster

        public void assignToCluster(int _clusterNumber)
        Assigns the data point to a cluster
        Parameters:
        _clusterNumber - the cluster to which this data point is to be assigned
      • getClusterNumber

        public int getClusterNumber()
        Returns the cluster to which the data point belongs
        Returns:
        the cluster number to which the data point belongs
      • getAttribute

        public double getAttribute(int index)
        Returns the attribute of data point
        Parameters:
        index - current idex
        Returns:
        the value in many dimensions
      • showAttributes

        public void showAttributes()
        Print all attributes of a data point
      • distance

        public static double distance(DataPoint dp1,              DataPoint dp2)
        Returns the distance between two data points
        Parameters:
        dp1 - the first data point
        dp2 - the second data point
        Returns:
        the distance between the two data points (double)
      • distanceSqrt

        public static double distanceSqrt(DataPoint dp1,                  DataPoint dp2)
        Returns the squared distance between two data points
        Parameters:
        dp1 - the first data point
        dp2 - the second data point
        Returns:
        the distance between the two data points
      • toString

        public String toString()
        Returns a string representation of this DataPoint
        Overrides:
        toString in class Object
        Returns:
        a string representation of this data point
      • main

        public static void main(String[] args)
        Main method -- to test the DataPoint class
        Parameters:
        args - command line arguments

SCaVis 2.0 © jWork.ORG