Class Refiner<T>

java.lang.Object
com.irurueta.geometry.refiners.Refiner<T>
Type Parameters:
T - type of instance to be refined.
Direct Known Subclasses:
InliersDataRefiner

public abstract class Refiner<T> extends Object
Refines an instance of type T by taking into account an initial estimation. This class can be used to find a solution that minimizes error of inliers in LMSE terms. Typically, a refiner is used by a robust estimator, however it can also be useful in some other situations. This is a base abstract class to be used by any refiner implementation.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected com.irurueta.algebra.Matrix
    Estimated covariance after refinement.
    static final boolean
    Indicates whether by default covariance of estimation must be kept.
    protected T
    Initial estimation.
    protected boolean
    Indicates whether covariance of estimation must be kept after refinement.
    protected RefinerListener<T>
    Listener in charge of attending events generated by this instance.
    protected boolean
    Indicates if this estimator is locked because a refinement is being computed.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructor.
    protected
    Refiner(T initialEstimation, boolean keepCovariance)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.irurueta.algebra.Matrix
    Gets estimated covariance after refinement.
    Gets initial estimation.
    Gets listener in charge of attending events generated by this instance.
    boolean
    Indicates whether covariance of estimation must be kept after refinement or not.
    boolean
    Indicates if this estimator is locked because a refinement is being computed.
    abstract boolean
    Indicates whether this refiner is ready to start refinement computation.
    abstract T
    Refines provided initial estimation.
    abstract boolean
    refine(T result)
    Refines provided initial estimation.
    void
    setCovarianceKept(boolean keepCovariance)
    Specifies whether covariance of estimation must be kept after refinement or not.
    void
    setInitialEstimation(T initialEstimation)
    Sets initial estimation.
    void
    Sets listener in charge of attending events generated by this instance.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_KEEP_COVARIANCE

      public static final boolean DEFAULT_KEEP_COVARIANCE
      Indicates whether by default covariance of estimation must be kept.
      See Also:
    • initialEstimation

      protected T initialEstimation
      Initial estimation.
    • keepCovariance

      protected boolean keepCovariance
      Indicates whether covariance of estimation must be kept after refinement.
    • covariance

      protected com.irurueta.algebra.Matrix covariance
      Estimated covariance after refinement.
    • locked

      protected boolean locked
      Indicates if this estimator is locked because a refinement is being computed.
    • listener

      protected RefinerListener<T> listener
      Listener in charge of attending events generated by this instance.
  • Constructor Details

    • Refiner

      protected Refiner()
      Constructor.
    • Refiner

      protected Refiner(T initialEstimation, boolean keepCovariance)
      Constructor.
      Parameters:
      initialEstimation - initial estimation to be set.
      keepCovariance - true if covariance of estimation must be kept after refinement, false otherwise.
  • Method Details

    • getListener

      public RefinerListener<T> getListener()
      Gets listener in charge of attending events generated by this instance.
      Returns:
      listener in charge of attending events generated by this instance.
    • setListener

      public void setListener(RefinerListener<T> listener)
      Sets listener in charge of attending events generated by this instance.
      Parameters:
      listener - listener in charge of attending events generated by this instance.
    • getInitialEstimation

      public T getInitialEstimation()
      Gets initial estimation.
      Returns:
      initial estimation.
    • setInitialEstimation

      public void setInitialEstimation(T initialEstimation) throws LockedException
      Sets initial estimation.
      Parameters:
      initialEstimation - initial estimation.
      Throws:
      LockedException - if estimator is locked.
    • isCovarianceKept

      public boolean isCovarianceKept()
      Indicates whether covariance of estimation must be kept after refinement or not.
      Returns:
      true if covariance of estimation must be kept after refinement, false otherwise.
    • setCovarianceKept

      public void setCovarianceKept(boolean keepCovariance) throws LockedException
      Specifies whether covariance of estimation must be kept after refinement or not.
      Parameters:
      keepCovariance - true if covariance of estimation must be kept after refinement, false otherwise.
      Throws:
      LockedException - if estimator is locked.
    • isLocked

      public boolean isLocked()
      Indicates if this estimator is locked because a refinement is being computed.
      Returns:
      true if estimator is locked, false otherwise.
    • getCovariance

      public com.irurueta.algebra.Matrix getCovariance()
      Gets estimated covariance after refinement.
      Returns:
      estimated covariance after refinement.
    • isReady

      public abstract boolean isReady()
      Indicates whether this refiner is ready to start refinement computation.
      Returns:
      true if refiner is ready, false otherwise.
    • refine

      public abstract boolean refine(T result) throws NotReadyException, LockedException, RefinerException
      Refines provided initial estimation. Notice that implementations of this method might set a value into result even if error is not improved in LMSE terms.
      Parameters:
      result - instance where refined estimation will be stored.
      Returns:
      true if result improves (decreases) in LMSE terms respect to initial estimation, false if no improvement has been achieved.
      Throws:
      NotReadyException - if not enough input data has been provided.
      LockedException - if estimator is locked because refinement is already in progress.
      RefinerException - if refinement fails for some reason (e.g. unable to converge to a result).
    • refine

      public abstract T refine() throws NotReadyException, LockedException, RefinerException
      Refines provided initial estimation.
      Returns:
      refined estimation.
      Throws:
      NotReadyException - if not enough input data has been provided.
      LockedException - if estimator is locked because refinement is already in progress.
      RefinerException - if refinement fails for some reason (e.g. unable to converge to a result).