org.apache.commons.math.linear

## Interface RealVector

All Known Subinterfaces:
  SparseRealVector

All Known Implementing Classes:
  AbstractRealVector, ArrayRealVector, OpenMapRealVector

    public interface RealVector

Interface defining a real-valued vector with basic algebraic operations.

vector element indexing is 0-based -- e.g., `getEntry(0)` returns the first element of the vector.

The various `mapXxx` and `mapXxxToSelf` methods operate on vectors element-wise, i.e. they perform the same operation (adding a scalar, applying a function ...) on each element in turn. The `mapXxx` versions create a new vector to hold the result and do not change the instance. The `mapXxxToSelf` versions use the instance itself to store the results, so the instance is changed by these methods. In both cases, the result vector is returned by the methods, this allows to use the fluent API style, like this:

       RealVector result = v.mapAddToSelf(3.0).mapTanToSelf().mapSquareToSelf();

Remark on the deprecated `mapXxx` and `mapXxxToSelf` methods: In Commons-Math v3.0, the same functionality will be achieved by directly using the `map(UnivariateRealFunction)` and `mapToSelf(UnivariateRealFunction)` together with new function objects (not available in v2.2).

Since:
  2.0
Version:
  $Revision: 1070725 $ $Date: 2011-02-15 02:31:12 +0100 (mar. 15 févr. 2011) $

### Nested Class Summary

Nested Classes
`static class` `RealVector.Entry` Class representing a modifiable entry in the vector.

### Method Summary

Methods
`RealVector` `add(double[] v)` Compute the sum of this vector and `v`.
`RealVector` `add(RealVector v)` Compute the sum of this vector and `v`.
`RealVector` `append(double d)` Construct a vector by appending a double to this vector.
`RealVector` `append(double[] a)` Construct a vector by appending a double array to this vector.
`RealVector` `append(RealVector v)` Construct a vector by appending a vector to this vector.
`RealVector` `copy()` Returns a (deep) copy of this vector.
`double` `dotProduct(double[] v)` Compute the dot product.
`double` `dotProduct(RealVector v)` Compute the dot product.
`RealVector` `ebeDivide(double[] v)` Element-by-element division.
`RealVector` `ebeDivide(RealVector v)` Element-by-element division.
`RealVector` `ebeMultiply(double[] v)` Element-by-element multiplication.
`RealVector` `ebeMultiply(RealVector v)` Element-by-element multiplication.
`double[]` `getData()` Returns vector entries as a double array.
`int` `getDimension()` Returns the size of the vector.
`double` `getDistance(double[] v)` Distance between two vectors.
`double` `getDistance(RealVector v)` Distance between two vectors.
`double` `getEntry(int index)` Returns the entry in the specified index.
`double` `getL1Distance(double[] v)` Distance between two vectors.
`double` `getL1Distance(RealVector v)` Distance between two vectors.
`double` `getL1Norm()` Returns the L1 norm of the vector.
`double` `getLInfDistance(double[] v)` Distance between two vectors.
`double` `getLInfDistance(RealVector v)` Distance between two vectors.
`double` `getLInfNorm()` Returns the L∞ norm of the vector.
`double` `getNorm()` Returns the L2 norm of the vector.
`RealVector` `getSubVector(int index, int n)` Get a subvector from consecutive elements.
`boolean` `isInfinite()` Check whether any coordinate of this vector is infinite and none are `NaN`.
`boolean` `isNaN()` Check whether any coordinate of this vector is `NaN`.
`java.util.Iterator<RealVector.Entry>` `iterator()` Generic dense iterator.
`RealVector` `map(UnivariateRealFunction function)` Acts as if implemented as:
`RealVector` `mapAbs()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapAbsToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapAcos()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapAcosToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapAdd(double d)` Add a value to each entry.
`RealVector` `mapAddToSelf(double d)` Add a value to each entry.
`RealVector` `mapAsin()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapAsinToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapAtan()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapAtanToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapCbrt()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapCbrtToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapCeil()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapCeilToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapCos()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapCosh()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapCoshToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapCosToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapDivide(double d)` Divide each entry.
`RealVector` `mapDivideToSelf(double d)` Divide each entry.
`RealVector` `mapExp()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapExpm1()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapExpm1ToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapExpToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapFloor()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapFloorToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapInv()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapInvToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapLog()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapLog10()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapLog10ToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapLog1p()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapLog1pToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapLogToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapMultiply(double d)` Multiply each entry.
`RealVector` `mapMultiplyToSelf(double d)` Multiply each entry.
`RealVector` `mapPow(double d)` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapPowToSelf(double d)` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapRint()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapRintToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapSignum()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapSignumToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapSin()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapSinh()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapSinhToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapSinToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapSqrt()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapSqrtToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapSubtract(double d)` Subtract a value from each entry.
`RealVector` `mapSubtractToSelf(double d)` Subtract a value from each entry.
`RealVector` `mapTan()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapTanh()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapTanhToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapTanToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapToSelf(UnivariateRealFunction function)` Acts as if it is implemented as:
`RealVector` `mapUlp()` Deprecated. in 2.2 (to be removed in 3.0).
`RealVector` `mapUlpToSelf()` Deprecated. in 2.2 (to be removed in 3.0).
`RealMatrix` `outerProduct(double[] v)` Compute the outer product.
`RealMatrix` `outerProduct(RealVector v)` Compute the outer product.
`RealVector` `projection(double[] v)` Find the orthogonal projection of this vector onto another vector.
`RealVector` `projection(RealVector v)` Find the orthogonal projection of this vector onto another vector.
`void` `set(double value)` Set all elements to a single value.
`void` `setEntry(int index, double value)` Set a single element.
`void` `setSubVector(int index, double[] v)` Set a set of consecutive elements.
`void` `setSubVector(int index, RealVector v)` Set a set of consecutive elements.
`java.util.Iterator<RealVector.Entry>` `sparseIterator()` Specialized implementations may choose to not iterate over all dimensions, either because those values are unset, or are equal to defaultValue(), or are small enough to be ignored for the purposes of iteration.
`RealVector` `subtract(double[] v)` Subtract `v` from this vector.
`RealVector` `subtract(RealVector v)` Subtract `v` from this vector.
`double[]` `toArray()` Convert the vector to a double array.
`void` `unitize()` Converts this vector into a unit vector.
`RealVector` `unitVector()` Creates a unit vector pointing in the direction of this vector.

### Method Detail

#### mapToSelf

    RealVector mapToSelf(UnivariateRealFunction function)
                         throws FunctionEvaluationException

Acts as if it is implemented as:

      Entry e = null;
      for(Iterator<Entry> it = iterator(); it.hasNext(); e = it.next()) {
          e.setValue(function.value(e.getValue()));
      }

Parameters:
  `function` - Function to apply to each entry.
Returns:
  this vector.
Throws:
  `FunctionEvaluationException` - if the function throws it.

#### map

    RealVector map(UnivariateRealFunction function)
                   throws FunctionEvaluationException

Acts as if implemented as:

      return copy().map(function);

Parameters:
  `function` - Function to apply to each entry.
Returns:
  a new vector.
Throws:
  `FunctionEvaluationException` - if the function throws it.

#### iterator

    java.util.Iterator<RealVector.Entry> iterator()

Generic dense iterator. It iterates in increasing order of the vector index.

Returns:
  a dense iterator

#### sparseIterator

    java.util.Iterator<RealVector.Entry> sparseIterator()

Specialized implementations may choose to not iterate over all dimensions, either because those values are unset, or are equal to defaultValue(), or are small enough to be ignored for the purposes of iteration. No guarantees are made about order of iteration. In dense implementations, this method will often delegate to `iterator()`.

Returns:
  a sparse iterator

#### copy

    RealVector copy()

Returns a (deep) copy of this vector.

Returns:
  a vector copy.

#### add

    RealVector add(RealVector v)

Compute the sum of this vector and `v`.

Parameters:
  `v` - Vector to be added.
Returns:
  `this` + `v`.
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.

#### add

    RealVector add(double[] v)

Compute the sum of this vector and `v`.

Parameters:
  `v` - Vector to be added.
Returns:
  `this` + `v`.
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.

#### subtract

    RealVector subtract(RealVector v)

Subtract `v` from this vector.

Parameters:
  `v` - Vector to be subtracted.
Returns:
  `this` - `v`.
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.

#### subtract

    RealVector subtract(double[] v)

Subtract `v` from this vector.

Parameters:
  `v` - Vector to be subtracted.
Returns:
  `this` - `v`.
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.

#### mapAdd

    RealVector mapAdd(double d)

Add a value to each entry.

Parameters:
  `d` - Value to be added to each entry.
Returns:
  `this` + `d`.

#### mapAddToSelf

    RealVector mapAddToSelf(double d)

Add a value to each entry. The instance is changed in-place.

Parameters:
  `d` - Value to be added to each entry.
Returns:
  `this`.

#### mapSubtract

    RealVector mapSubtract(double d)

Subtract a value from each entry.

Parameters:
  `d` - Value to be subtracted.
Returns:
  `this` - `d`.

#### mapSubtractToSelf

    RealVector mapSubtractToSelf(double d)

Subtract a value from each entry. The instance is changed in-place.

Parameters:
  `d` - Value to be subtracted.
Returns:
  `this`.

#### mapMultiply

    RealVector mapMultiply(double d)

Multiply each entry.

Parameters:
  `d` - Multiplication factor.
Returns:
  `this` * `d`.

#### mapMultiplyToSelf

    RealVector mapMultiplyToSelf(double d)

Multiply each entry. The instance is changed in-place.

Parameters:
  `d` - Multiplication factor.
Returns:
  `this`.

#### mapDivide

    RealVector mapDivide(double d)

Divide each entry.

Parameters:
  `d` - Value to divide by.
Returns:
  `this` / `d`.

#### mapDivideToSelf

    RealVector mapDivideToSelf(double d)

Divide each entry. The instance is changed in-place.

Parameters:
  `d` - Value to divide by.
Returns:
  `this`.

#### mapPow

    @Deprecated
    RealVector mapPow(double d)

Deprecated. in 2.2 (to be removed in 3.0).
Map a power operation to each entry.

Parameters:
  `d` - Operator value.
Returns:
  a mapped copy of the vector.

#### mapPowToSelf

    @Deprecated
    RealVector mapPowToSelf(double d)

Deprecated. in 2.2 (to be removed in 3.0).
Map a power operation to each entry. The instance is changed in-place.

Parameters:
  `d` - Operator value.
Returns:
  the mapped vector.

#### mapExp

    @Deprecated
    RealVector mapExp()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.exp(double)` function to each entry.

Returns:
  a mapped copy of the vector.

#### mapExpToSelf

    @Deprecated
    RealVector mapExpToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map `Math.exp(double)` operation to each entry. The instance is changed in-place.

Returns:
  the mapped vector.

#### mapExpm1

    @Deprecated
    RealVector mapExpm1()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.expm1(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapExpm1ToSelf

    @Deprecated
    RealVector mapExpm1ToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.expm1(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapLog

    @Deprecated
    RealVector mapLog()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.log(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapLogToSelf

    @Deprecated
    RealVector mapLogToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.log(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapLog10

    @Deprecated
    RealVector mapLog10()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.log10(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapLog10ToSelf

    @Deprecated
    RealVector mapLog10ToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.log10(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapLog1p

    @Deprecated
    RealVector mapLog1p()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.log1p(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapLog1pToSelf

    @Deprecated
    RealVector mapLog1pToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.log1p(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapCosh

    @Deprecated
    RealVector mapCosh()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.cosh(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapCoshToSelf

    @Deprecated
    RealVector mapCoshToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.cosh(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapSinh

    @Deprecated
    RealVector mapSinh()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.sinh(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapSinhToSelf

    @Deprecated
    RealVector mapSinhToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.sinh(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapTanh

    @Deprecated
    RealVector mapTanh()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.tanh(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapTanhToSelf

    @Deprecated
    RealVector mapTanhToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.tanh(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapCos

    @Deprecated
    RealVector mapCos()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.cos(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapCosToSelf

    @Deprecated
    RealVector mapCosToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.cos(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapSin

    @Deprecated
    RealVector mapSin()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.sin(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapSinToSelf

    @Deprecated
    RealVector mapSinToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.sin(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapTan

    @Deprecated
    RealVector mapTan()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.tan(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapTanToSelf

    @Deprecated
    RealVector mapTanToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.tan(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapAcos

    @Deprecated
    RealVector mapAcos()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.acos(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapAcosToSelf

    @Deprecated
    RealVector mapAcosToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.acos(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapAsin

    @Deprecated
    RealVector mapAsin()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.asin(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapAsinToSelf

    @Deprecated
    RealVector mapAsinToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.asin(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapAtan

    @Deprecated
    RealVector mapAtan()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.atan(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapAtanToSelf

    @Deprecated
    RealVector mapAtanToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.atan(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapInv

    @Deprecated
    RealVector mapInv()

Deprecated. in 2.2 (to be removed in 3.0).
Map the 1/x function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapInvToSelf

    @Deprecated
    RealVector mapInvToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the 1/x function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapAbs

    @Deprecated
    RealVector mapAbs()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.abs(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapAbsToSelf

    @Deprecated
    RealVector mapAbsToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.abs(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapSqrt

    @Deprecated
    RealVector mapSqrt()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.sqrt(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapSqrtToSelf

    @Deprecated
    RealVector mapSqrtToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.sqrt(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapCbrt

    @Deprecated
    RealVector mapCbrt()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.cbrt(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapCbrtToSelf

    @Deprecated
    RealVector mapCbrtToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.cbrt(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapCeil

    @Deprecated
    RealVector mapCeil()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.ceil(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapCeilToSelf

    @Deprecated
    RealVector mapCeilToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.ceil(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapFloor

    @Deprecated
    RealVector mapFloor()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.floor(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapFloorToSelf

    @Deprecated
    RealVector mapFloorToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.floor(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapRint

    @Deprecated
    RealVector mapRint()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.rint(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapRintToSelf

    @Deprecated
    RealVector mapRintToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.rint(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapSignum

    @Deprecated
    RealVector mapSignum()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.signum(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapSignumToSelf

    @Deprecated
    RealVector mapSignumToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.signum(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### mapUlp

    @Deprecated
    RealVector mapUlp()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.ulp(double)` function to each entry.

Returns:
  a vector containing the result of applying the function to each entry

#### mapUlpToSelf

    @Deprecated
    RealVector mapUlpToSelf()

Deprecated. in 2.2 (to be removed in 3.0).
Map the `Math.ulp(double)` function to each entry.

The instance is changed by this method.

Returns:
  for convenience, return this

#### ebeMultiply

    RealVector ebeMultiply(RealVector v)

Element-by-element multiplication.

Parameters:
  `v` - vector by which instance elements must be multiplied
Returns:
  a vector containing this[i] * v[i] for all i
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.

#### ebeMultiply

    RealVector ebeMultiply(double[] v)

Element-by-element multiplication.

Parameters:
  `v` - vector by which instance elements must be multiplied
Returns:
  a vector containing this[i] * v[i] for all i
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.

#### ebeDivide

    RealVector ebeDivide(RealVector v)

Element-by-element division.

Parameters:
  `v` - vector by which instance elements must be divided
Returns:
  a vector containing this[i] / v[i] for all i
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.

#### ebeDivide

    RealVector ebeDivide(double[] v)

Element-by-element division.

Parameters:
  `v` - vector by which instance elements must be divided
Returns:
  a vector containing this[i] / v[i] for all i
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.

#### getData

    double[] getData()

Returns vector entries as a double array.

Returns:
  double array of entries

#### dotProduct

    double dotProduct(RealVector v)

Compute the dot product.

Parameters:
  `v` - vector with which dot product should be computed
Returns:
  the scalar dot product between instance and v
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.

#### dotProduct

    double dotProduct(double[] v)

Compute the dot product.

Parameters:
  `v` - vector with which dot product should be computed
Returns:
  the scalar dot product between instance and v
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.

#### getNorm

    double getNorm()

Returns the L2 norm of the vector.

The L2 norm is the root of the sum of the squared elements.

Returns:
  norm
See Also:
  `getL1Norm()`, `getLInfNorm()`, `getDistance(RealVector)`

#### getL1Norm

    double getL1Norm()

Returns the L1 norm of the vector.

The L1 norm is the sum of the absolute values of elements.

Returns:
  norm
See Also:
  `getNorm()`, `getLInfNorm()`, `getL1Distance(RealVector)`

#### getLInfNorm

    double getLInfNorm()

Returns the L∞ norm of the vector.

The L∞ norm is the max of the absolute values of elements.

Returns:
  norm
See Also:
  `getNorm()`, `getL1Norm()`, `getLInfDistance(RealVector)`

#### getDistance

    double getDistance(RealVector v)

Distance between two vectors.

This method computes the distance consistent with the L2 norm, i.e. the square root of the sum of elements differences, or euclidian distance.

Parameters:
  `v` - vector to which distance is requested
Returns:
  distance between two vectors.
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.
See Also:
  `getL1Distance(RealVector)`, `getLInfDistance(RealVector)`, `getNorm()`

#### getDistance

    double getDistance(double[] v)

Distance between two vectors.

This method computes the distance consistent with the L2 norm, i.e. the square root of the sum of elements differences, or euclidian distance.

Parameters:
  `v` - vector to which distance is requested
Returns:
  distance between two vectors.
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.
See Also:
  `getL1Distance(double[])`, `getLInfDistance(double[])`, `getNorm()`

#### getL1Distance

    double getL1Distance(RealVector v)

Distance between two vectors.

This method computes the distance consistent with L1 norm, i.e. the sum of the absolute values of elements differences.

Parameters:
  `v` - vector to which distance is requested
Returns:
  distance between two vectors.
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.
See Also:
  `getDistance(RealVector)`, `getLInfDistance(RealVector)`, `getL1Norm()`

#### getL1Distance

    double getL1Distance(double[] v)

Distance between two vectors.

This method computes the distance consistent with L1 norm, i.e. the sum of the absolute values of elements differences.

Parameters:
  `v` - vector to which distance is requested
Returns:
  distance between two vectors.
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.
See Also:
  `getDistance(double[])`, `getLInfDistance(double[])`, `getL1Norm()`

#### getLInfDistance

    double getLInfDistance(RealVector v)

Distance between two vectors.

This method computes the distance consistent with L∞ norm, i.e. the max of the absolute values of elements differences.

Parameters:
  `v` - vector to which distance is requested
Returns:
  distance between two vectors.
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.
See Also:
  `getDistance(RealVector)`, `getL1Distance(RealVector)`, `getLInfNorm()`

#### getLInfDistance

    double getLInfDistance(double[] v)

Distance between two vectors.

This method computes the distance consistent with L∞ norm, i.e. the max of the absolute values of elements differences.

Parameters:
  `v` - vector to which distance is requested
Returns:
  distance between two vectors.
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.
See Also:
  `getDistance(double[])`, `getL1Distance(double[])`, `getLInfNorm()`

#### unitVector

    RealVector unitVector()

Creates a unit vector pointing in the direction of this vector.

The instance is not changed by this method.

Returns:
  a unit vector pointing in direction of this vector
Throws:
  `java.lang.ArithmeticException` - if the norm is null

#### unitize

    void unitize()

Converts this vector into a unit vector.

The instance itself is changed by this method.

Throws:
  `java.lang.ArithmeticException` - if the norm is zero.

#### projection

    RealVector projection(RealVector v)

Find the orthogonal projection of this vector onto another vector.

Parameters:
  `v` - vector onto which instance must be projected
Returns:
  projection of the instance onto v
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.

#### projection

    RealVector projection(double[] v)

Find the orthogonal projection of this vector onto another vector.

Parameters:
  `v` - vector onto which instance must be projected
Returns:
  projection of the instance onto v
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.

#### outerProduct

    RealMatrix outerProduct(RealVector v)

Compute the outer product.

Parameters:
  `v` - vector with which outer product should be computed
Returns:
  the square matrix outer product between instance and v
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.

#### outerProduct

    RealMatrix outerProduct(double[] v)

Compute the outer product.

Parameters:
  `v` - vector with which outer product should be computed
Returns:
  the square matrix outer product between instance and v
Throws:
  `DimensionMismatchException` - if `v` is not the same size as this vector.

#### getEntry

    double getEntry(int index)

Returns the entry in the specified index.

Parameters:
  `index` - Index location of entry to be fetched.
Returns:
  the vector entry at `index`.
Throws:
  `OutOfRangeException` - if the index is not valid.
See Also:
  `setEntry(int, double)`

#### setEntry

    void setEntry(int index,
                double value)

Set a single element.

Parameters:
  `index` - element index.
  `value` - new value for the element.
Throws:
  `OutOfRangeException` - if the index is not valid.
See Also:
  `getEntry(int)`

#### getDimension

    int getDimension()

Returns the size of the vector.

Returns:
  size

#### append

    RealVector append(RealVector v)

Construct a vector by appending a vector to this vector.

Parameters:
  `v` - vector to append to this one.
Returns:
  a new vector

#### append

    RealVector append(double d)

Construct a vector by appending a double to this vector.

Parameters:
  `d` - double to append.
Returns:
  a new vector

#### append

    RealVector append(double[] a)

Construct a vector by appending a double array to this vector.

Parameters:
  `a` - double array to append.
Returns:
  a new vector

#### getSubVector

    RealVector getSubVector(int index,
                          int n)

Get a subvector from consecutive elements.

Parameters:
  `index` - index of first element.
  `n` - number of elements to be retrieved.
Returns:
  a vector containing n elements.
Throws:
  `OutOfRangeException` - if the index is not valid.

#### setSubVector

    void setSubVector(int index,
                    RealVector v)

Set a set of consecutive elements.

Parameters:
  `index` - index of first element to be set.
  `v` - vector containing the values to set.
Throws:
  `OutOfRangeException` - if the index is not valid.
See Also:
  `setSubVector(int, double[])`

#### setSubVector

    void setSubVector(int index,
                    double[] v)

Set a set of consecutive elements.

Parameters:
  `index` - index of first element to be set.
  `v` - vector containing the values to set.
Throws:
  `OutOfRangeException` - if the index is not valid.
See Also:
  `setSubVector(int, RealVector)`

#### set

    void set(double value)

Set all elements to a single value.

Parameters:
  `value` - single value to set for all elements

#### toArray

    double[] toArray()

Convert the vector to a double array.

The array is independent from vector data, it's elements are copied.

Returns:
  array containing a copy of vector elements

#### isNaN

    boolean isNaN()

Check whether any coordinate of this vector is `NaN`.

Returns:
  `true` if any coordinate of this vector is `NaN`, `false` otherwise.

#### isInfinite

    boolean isInfinite()

Check whether any coordinate of this vector is infinite and none are `NaN`.

Returns:
  `true` if any coordinate of this vector is infinite and none are `NaN`, `false` otherwise.