Class NormComputer

java.lang.Object
com.irurueta.algebra.NormComputer
Direct Known Subclasses:
FrobeniusNormComputer, InfinityNormComputer, OneNormComputer

public abstract class NormComputer extends Object
Class in charge of computing norms of arrays and matrices. Norms can be computed in different ways depending on the desired norm measure. For that purpose subclass implementations of this class attempt to work on different norm types. By default, Frobenius norm is used for arrays and matrices, which consists on computing the square root of summation of all the squared elements within a given matrix or array.
  • Field Details

    • DEFAULT_NORM_TYPE

      public static final NormType DEFAULT_NORM_TYPE
      Constant defining default norm type to be used.
  • Constructor Details

    • NormComputer

      protected NormComputer()
      Constructor of this class.
  • Method Details

    • getNormType

      public abstract NormType getNormType()
      Returns norm type being used by this class.
      Returns:
      Norm type being used by this class.
    • getNorm

      public abstract double getNorm(Matrix m)
      Computes norm of provided matrix.
      Parameters:
      m - Matrix being used for norm computation.
      Returns:
      Norm of provided matrix.
    • getNorm

      public abstract double getNorm(double[] array)
      Computes norm of provided array.
      Parameters:
      array - Array being used for norm computation.
      Returns:
      Norm of provided vector.
    • getNorm

      public double getNorm(double[] array, Matrix jacobian) throws WrongSizeException
      Computes norm of provided array and stores the jacobian into provided instance.
      Parameters:
      array - array being used for norm computation.
      jacobian - instance where jacobian will be stored. Must be 1xN, where N is length of array.
      Returns:
      norm of provided vector.
      Throws:
      WrongSizeException - if provided jacobian is not 1xN, where N is length of array.
    • create

      public static NormComputer create(NormType normType)
      Factory method. Returns a new instance of NormComputer prepared to compute norms using provided NormType.
      Parameters:
      normType - Norm type to be used by returned instance.
      Returns:
      New instance of NormComputer.
    • create

      public static NormComputer create()
      Factory method. Returns a new instance of NormComputer prepared to compute norms using provided NormType.
      Returns:
      New instance of NormComputer.