Package elki.data

Class Subspace

  • Direct Known Subclasses:
    CLIQUESubspace

    public class Subspace
    extends java.lang.Object
    Represents a subspace of the original data space.
    Since:
    0.1
    Author:
    Elke Achtert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.Comparator<Subspace> DIMENSION_COMPARATOR
      A comparator for subspaces based on their involved dimensions.
      private int dimensionality
      The dimensionality of this subspace.
      private long[] dimensions
      The dimensions building this subspace.
    • Constructor Summary

      Constructors 
      Constructor Description
      Subspace​(int dimension)
      Creates a new one-dimensional subspace of the original data space.
      Subspace​(long[] dimensions)
      Creates a new k-dimensional subspace of the original data space.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int dimensionality()
      Returns the dimensionality of this subspace.
      java.lang.String dimensionsToString()
      Returns a string representation of the dimensions of this subspace separated by comma.
      java.lang.String dimensonsToString​(java.lang.String sep)
      Returns a string representation of the dimensions of this subspace.
      boolean equals​(java.lang.Object obj)  
      long[] getDimensions()
      Returns the BitSet representing the dimensions of this subspace.
      int hashCode()
      Returns the hash code value of the dimensions of this subspace.
      boolean isSubspace​(Subspace subspace)
      Returns true if this subspace is a subspace of the specified subspace, i.e.
      Subspace join​(Subspace other)
      Joins this subspace with the specified subspace.
      protected long[] joinLastDimensions​(Subspace other)
      Joins the dimensions of this subspace with the dimensions of the specified subspace.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • dimensions

        private final long[] dimensions
        The dimensions building this subspace.
      • dimensionality

        private final int dimensionality
        The dimensionality of this subspace.
      • DIMENSION_COMPARATOR

        public static final java.util.Comparator<Subspace> DIMENSION_COMPARATOR
        A comparator for subspaces based on their involved dimensions. The subspaces are ordered according to the ordering of their dimensions.

        If the two subspaces have different dimensionalities a negative integer or a positive integer will be returned if the dimensionality of the first subspace is less than or greater than the dimensionality of the second subspace. Otherwise the comparison works as follows: Let d1 and d2 be the first occurrences of pairwise unequal dimensions in the specified subspaces. Then a negative integer or a positive integer will be returned if d1 is less than or greater than d2. Otherwise the two subspaces have equal dimensions and zero will be returned.

    • Constructor Detail

      • Subspace

        public Subspace​(int dimension)
        Creates a new one-dimensional subspace of the original data space.
        Parameters:
        dimension - the dimension building this subspace
      • Subspace

        public Subspace​(long[] dimensions)
        Creates a new k-dimensional subspace of the original data space.
        Parameters:
        dimensions - the dimensions building this subspace
    • Method Detail

      • getDimensions

        public final long[] getDimensions()
        Returns the BitSet representing the dimensions of this subspace.
        Returns:
        the dimensions of this subspace
      • dimensionality

        public final int dimensionality()
        Returns the dimensionality of this subspace.
        Returns:
        the number of dimensions this subspace contains
      • join

        public Subspace join​(Subspace other)
        Joins this subspace with the specified subspace. The join is only successful if both subspaces have the first k-1 dimensions in common (where k is the number of dimensions) and the last dimension of this subspace is less than the last dimension of the specified subspace.
        Parameters:
        other - the subspace to join
        Returns:
        the join of this subspace with the specified subspace if the join condition is fulfilled, null otherwise.
        See Also:
        joinLastDimensions(Subspace)
      • toString

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

        public java.lang.String dimensionsToString()
        Returns a string representation of the dimensions of this subspace separated by comma.
        Returns:
        a string representation of the dimensions of this subspace
      • dimensonsToString

        public java.lang.String dimensonsToString​(java.lang.String sep)
        Returns a string representation of the dimensions of this subspace.
        Parameters:
        sep - the separator between the dimensions
        Returns:
        a string representation of the dimensions of this subspace
      • isSubspace

        public boolean isSubspace​(Subspace subspace)
        Returns true if this subspace is a subspace of the specified subspace, i.e. if the set of dimensions building this subspace are contained in the set of dimensions building the specified subspace.
        Parameters:
        subspace - the subspace to test
        Returns:
        true if this subspace is a subspace of the specified subspace, false otherwise
      • joinLastDimensions

        protected long[] joinLastDimensions​(Subspace other)
        Joins the dimensions of this subspace with the dimensions of the specified subspace. The join is only successful if both subspaces have the first k-1 dimensions in common (where k is the number of dimensions) and the last dimension of this subspace is less than the last dimension of the specified subspace.
        Parameters:
        other - the subspace to join
        Returns:
        the joined dimensions of this subspace with the dimensions of the specified subspace if the join condition is fulfilled, null otherwise.
      • hashCode

        public int hashCode()
        Returns the hash code value of the dimensions of this subspace.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code value for this subspace
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object