MaxMinAlgebra.java

// FILE. . . . . d:/hak/hlt/src/hlt/math/matrix/sources/MaxMinAlgebra.java
// EDIT BY . . . Hassan Ait-Kaci
// ON MACHINE. . Hak-Laptop
// STARTED ON. . Thu Dec  5 12:40:13 2019

package hlt.math.matrix;

package hlt.math.matrix documentation listing



This is a concrete subclass of NumberAlgebra defining its operations as the algebra defining sum as Math.max, product as Math.min, zero() as NEGATIVE_INFINITY, and one() as POSITIVE_INFINITY. The negation and difference operations are undefined.

See also:  NumberAlgebra, Matrix
Copyy:  © by the author
Author:  Hassan Aït-Kaci
Version:  Last modified on Fri Dec 13 13:12:50 2019 by hak

public class MaxMinAlgebra extends NumberAlgebra
{
  

Return the zero of this MaxMinAlgebra as NEGATIVE_INFINITY. It verifies sum(x,zero()) = sum(zero(),x) = x, for any double x.

  public double zero ()
  {
    return Double.NEGATIVE_INFINITY;
  }

  

Return the one of this algebra as POSITIVE_INFINITY. It verifies product(x,one()) = product(one(),x) = x, for any double x.

  public double one ()
  {
    return Double.POSITIVE_INFINITY;
  }

  

Return the sum of the arguments as Math.max. Verifies sum(x,zero()) = sum(zero(),x) = x, for any double x: max(x,NEGATIVE_INFINITY) = max(NEGATIVE_INFINITY,x) = x for any double x.

  public final double sum (double x, double y)
  {
    return Math.max(x,y);	
  }

  

Return the product of the arguments as Math.min. Verifies product(x,one()) = product(one(),x) = x, for any double x: min(x,POSITIVE_INFINITY) = min(POSITIVE_INFINITY,x) = x for any double x.

  public final double product (double x, double y)
  {
    return Math.min(x,y);	
  }

  

Throws a runtime exception to indicate that the negation operation is undefined for a this MaxMinAlgebra. It can be redefined to a well-defined operation in a subclass.

  public double negation (double x)
  {
    throw new RuntimeException
      ("The negation operation is undefined for a "+this);
  }

  

Throws a runtime exception to indicate that the difference operation is undefined for a this MaxMinAlgebra. It can be redefined to a well-defined operation in a subclass.

  public double difference (double x, double y)
  {
    throw new RuntimeException
      ("The difference operation is undefined for a "+this);
  }

  

Define a String form for this MaxMinAlgebra. It must be redefined in any subclass.

  public String toString ()
  {
    return "Max/Min Algebra";
  }

}


This file was generated on Wed Dec 18 03:37:41 PST 2019 from file MaxMinAlgebra.java
by the hlt.language.tools.Hilite Java tool written by Hassan Aït-Kaci