View Javadoc
1   /*
2    * Copyright (C) 2016 Alberto Irurueta Carro (alberto@irurueta.com)
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *         http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package com.irurueta.numerical.robust;
17  
18  import java.util.BitSet;
19  
20  /**
21   * Base class defining inlier data for a robust estimator.
22   */
23  public abstract class InliersData {
24  
25      /**
26       * Residuals obtained for each sample of data.
27       */
28      protected double[] residuals;
29  
30      /**
31       * Number of inliers found on current iteration.
32       */
33      protected int numInliers;
34  
35      /**
36       * Returns efficient array indicating which samples are considered inliers
37       * and which ones aren't or null if inliers are not kept.
38       *
39       * @return array indicating which samples are considered inliers and which
40       * ones aren't, or null.
41       */
42      public abstract BitSet getInliers();
43  
44      /**
45       * Returns residuals obtained for each sample of data or null if residuals
46       * are not kept.
47       *
48       * @return residuals obtained for each sample of data.
49       */
50      public double[] getResiduals() {
51          return residuals;
52      }
53  
54      /**
55       * Returns number of inliers found.
56       *
57       * @return number of inliers found.
58       */
59      public int getNumInliers() {
60          return numInliers;
61      }
62  }