org.apache.commons.math3.fitting

## Class WeightedObservedPoints

- java.lang.Object
- - org.apache.commons.math3.fitting.WeightedObservedPoints

- All Implemented Interfaces:
    Serializable

      public class WeightedObservedPoints
      extends Object
      implements Serializable

  Simple container for weighted observed points used in `curve fitting` algorithms.
  Since:
    3.3
  Version:
    $Id: WeightedObservedPoints.java 1516875 2013-08-23 15:01:33Z erans $
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `WeightedObservedPoints()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(double x, double y)` Adds a point to the sample.
    `void` | `add(double weight, double x, double y)` Adds a point to the sample.
    `void` | `add(WeightedObservedPoint observed)` Adds a point to the sample.
    `void` | `clear()` Removes all observations from this container.
    `List<WeightedObservedPoint>` | `toList()` Gets a snapshot of the observed points.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### WeightedObservedPoints

          public WeightedObservedPoints()

  - ### Method Detail

    - #### add

          public void add(double x,
                 double y)

      Adds a point to the sample. Calling this method is equivalent to calling `add(1.0, x, y)`.
      Parameters:
        `x` - Abscissa of the point.
        `y` - Observed value at `x`. After fitting we should have `f(x)` as close as possible to this value.
      See Also:
        `add(double, double, double)`, `add(WeightedObservedPoint)`, `toList()`

    - #### add

          public void add(double weight,
                 double x,
                 double y)

      Adds a point to the sample.
      Parameters:
        `weight` - Weight of the observed point.
        `x` - Abscissa of the point.
        `y` - Observed value at `x`. After fitting we should have `f(x)` as close as possible to this value.
      See Also:
        `add(double, double)`, `add(WeightedObservedPoint)`, `toList()`

    - #### add

          public void add(WeightedObservedPoint observed)

      Adds a point to the sample.
      Parameters:
        `observed` - Observed point to add.
      See Also:
        `add(double, double)`, `add(double, double, double)`, `toList()`

    - #### toList

          public List<WeightedObservedPoint> toList()

      Gets a snapshot of the observed points. The list of stored points is copied in order to ensure that modification of the returned instance does not affect this container. Conversely, further modification of this container (through the `add` or `clear` methods) will not affect the returned list.
      Returns:
        the observed points, in the order they were added to this container.
      See Also:
        `add(double, double)`, `add(double, double, double)`, `add(WeightedObservedPoint)`

    - #### clear

          public void clear()

      Removes all observations from this container.

Copyright © 2003–2014 The Apache Software Foundation. All rights reserved.