Class Matrices.Simplex

Enclosing class:
Matrices

public static final class Matrices.Simplex extends Matrices.ConvexHyperpolyhedron

Simplex: the simplest n-dimensional hyperpolyhedron with n+1 vertices. In 1-dimensional case it is a segment, in 2-dimensional case it is a triangle, in 3-dimensional case it is a tetrahedron.

Simplex is a particular case of the convex hyperpolyhedron.

Simplex is specified by its vertices and can be created by the following methods:

Note: degenerated simplexes, when all vertices lie in the same (n−1)-dimensional hyperplane, are not allowed. (In 1-dimensional it means that 2 vertices are identical, in 2-dimensional — that 3 vertices lie in the same straight line, in 2-dimensional — that 4 vertices lie in the same plane.) Such simplexes cannot be constructed by the methods above: DegeneratedSimplexException is thrown in these cases.

This class is immutable and thread-safe: there are no ways to modify settings of the created instance.

  • Method Details

    • isSimplexDegenerated

      public static boolean isSimplexDegenerated(double[][] vertices)
      Returns true if and only if the specified vertices lies in the same (n−1)-dimensional hyperplane, as far as it can be detected by analysing the coordinates via calculations with standard Java double numbers. Here n=vertices[k].length; this length must be same for all k, and vertices.length must be equal to n+1.

      Matrices.Region.getSimplex(double[][] vertices) method throws DegeneratedSimplexException if and only if this method returns true for the same argument.

      Parameters:
      vertices - coordinates of all vertices.
      Returns:
      whether the simplex with the specified vertices is degenerated and cannot be described by this class.
      Throws:
      NullPointerException - if the vertices array or some of its elements is null.
      IllegalArgumentException - if the vertices array or some of its elements is empty (has zero length), or if the length of some vertices[k] array is not equal to vertices[0].length+1.
    • vertices

      public double[][] vertices()
      Returns the coordinates of all vertices of the simplex. The returned arrays is identical to an array, passed to Matrices.Region.getSimplex(double[][] vertices) method.

      The returned array is a deep clone of the internal data stored in this object: no references, maintained by this object, are returned.

      Returns:
      the coordinates of all vertices of the simplex: the element (line) #k of the returned 2-dimensional array contains n coordinates of the vertex #k.
    • toString

      public String toString()
      Returns a brief string description of this object.

      The result of this method may depend on implementation.

      Overrides:
      toString in class Matrices.ConvexHyperpolyhedron
      Returns:
      a brief string description of this object.