datan

## Class DatanVector

- java.lang.Object
- - datan.DatanVector

-     public class DatanVector
      extends java.lang.Object

  A class representing a vector.
  Author:
    Siegmund Brandt.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DatanVector(DatanVector b)` Creates a vector which is a copy of b.
    `DatanVector(double[] b)` Creates a vector from the array b.
    `DatanVector(int n)` Creates a vector with n elements which are all zero.
    `DatanVector(int n, double[] b)` Creates a vector with n elements from the array b.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `DatanVector` | `add(DatanVector b)` Returns sum with vector b.
    `double` | `dot(DatanVector b)` Returns scalar product with vector b.
    `double` | `getElement(int i)` Returns elements i.
    `int` | `getNumberOfElements()` Returns the number of elements.
    `DatanVector` | `getSubvector(int[] list)` Returns subvector defined by a list.
    `DatanVector` | `multiply(double s)` Returns product with scalar s.
    `double` | `norm()` Returns Euclidean norm.
    `void` | `putSubvector(DatanVector b, int[] list)` Replaces elements according to a list.
    `void` | `setElement(int i, double in)` Sets element i to in.
    `DatanVector` | `sub(DatanVector b)` Returns original vector minus vector b.
    `java.lang.String` | `toString()` Writes the DatanVector onto a string, using 5 fraction digits.
    `java.lang.String` | `toString(java.lang.String fmt)` Writes the DatanVector onto a string.
    `void` | `write()` Writes the DatanVector on standard output.

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

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

- - ### Constructor Detail

    - #### DatanVector

          public DatanVector(int n)

      Creates a vector with n elements which are all zero.

    - #### DatanVector

          public DatanVector(int n,
                     double[] b)

      Creates a vector with n elements from the array b.

    - #### DatanVector

          public DatanVector(double[] b)

      Creates a vector from the array b.

    - #### DatanVector

          public DatanVector(DatanVector b)

      Creates a vector which is a copy of b.

  - ### Method Detail

    - #### getNumberOfElements

          public int getNumberOfElements()

      Returns the number of elements.

    - #### getElement

          public double getElement(int i)

      Returns elements i.

    - #### setElement

          public void setElement(int i,
                        double in)

      Sets element i to in.

    - #### add

          public DatanVector add(DatanVector b)

      Returns sum with vector b.

    - #### sub

          public DatanVector sub(DatanVector b)

      Returns original vector minus vector b.

    - #### multiply

          public DatanVector multiply(double s)

      Returns product with scalar s.

    - #### getSubvector

          public DatanVector getSubvector(int[] list)

      Returns subvector defined by a list.
      Parameters:
        `list` - array with same number of elements as vector, element has to be 1 if corresponding element of vector is to become element of subvector.
      Returns:
        the desired subvector.

    - #### putSubvector

          public void putSubvector(DatanVector b,
                          int[] list)

      Replaces elements according to a list.
      Parameters:
        `list` - array with same number of elements as vector, element has to be 1 if corresponding element of original vector is to be replaced by element of subvector.

    - #### dot

          public double dot(DatanVector b)

      Returns scalar product with vector b.

    - #### norm

          public double norm()

      Returns Euclidean norm.

    - #### write

          public void write()

      Writes the DatanVector on standard output.

    - #### toString

          public java.lang.String toString()

      Writes the DatanVector onto a string, using 5 fraction digits.
      Overrides:
        `toString` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString(java.lang.String fmt)

      Writes the DatanVector onto a string.
      Parameters:
        `fmt` - formatstring, e.g., "%15.10f"