org.apache.commons.math.linear

## Class ArrayFieldVector<T extends FieldElement<T>>

- java.lang.Object
- - org.apache.commons.math.linear.ArrayFieldVector<T>

Type Parameters:
  `T` - the type of the field elements

All Implemented Interfaces:
  Serializable, FieldVector<T>

    public class ArrayFieldVector<T extends FieldElement<T>>
    extends Object
    implements FieldVector<T>, Serializable

This class implements the `FieldVector` interface with a `FieldElement` array.

Since:
  2.0
Version:
  $Revision: 1003997 $ $Date: 2010-10-03 18:45:55 +0200 (dim. 03 oct. 2010) $
See Also:
  Serialized Form

### Field Summary

Fields
`protected T[]` `data` Entries of the vector.
`private Field<T>` `field` Field to which the elements belong.
`private static long` `serialVersionUID` Serializable version identifier.

### Constructor Summary

Constructors
Constructor and Description
`ArrayFieldVector(ArrayFieldVector<T> v)` Construct a vector from another vector, using a deep copy.
`ArrayFieldVector(ArrayFieldVector<T> v1, ArrayFieldVector<T> v2)` Construct a vector by appending one vector to another vector.
`ArrayFieldVector(ArrayFieldVector<T> v, boolean deep)` Construct a vector from another vector.
`ArrayFieldVector(ArrayFieldVector<T> v1, T[] v2)` Construct a vector by appending one vector to another vector.
`ArrayFieldVector(Field<T> field)` Build a 0-length vector.
`ArrayFieldVector(Field<T> field, int size)` Construct a (size)-length vector of zeros.
`ArrayFieldVector(Field<T> field, T[] d)` Construct a vector from an array, copying the input array.
`ArrayFieldVector(Field<T> field, T[] d, boolean copyArray)` Create a new ArrayFieldVector using the input array as the underlying data array.
`ArrayFieldVector(Field<T> field, T[] v1, T[] v2)` Construct a vector by appending one vector to another vector.
`ArrayFieldVector(FieldVector<T> v)` Construct a vector from another vector, using a deep copy.
`ArrayFieldVector(int size, T preset)` Construct an (size)-length vector with preset values.
`ArrayFieldVector(T[] d)` Construct a vector from an array, copying the input array.
`ArrayFieldVector(T[] v1, ArrayFieldVector<T> v2)` Construct a vector by appending one vector to another vector.
`ArrayFieldVector(T[] d, boolean copyArray)` Create a new ArrayFieldVector using the input array as the underlying data array.
`ArrayFieldVector(T[] d, int pos, int size)` Construct a vector from part of a array.
`ArrayFieldVector(T[] v1, T[] v2)` Construct a vector by appending one vector to another vector.

### Method Summary

Methods
`ArrayFieldVector<T>` `add(ArrayFieldVector<T> v)` Compute the sum of this and v.
`FieldVector<T>` `add(FieldVector<T> v)` Compute the sum of this and v.
`FieldVector<T>` `add(T[] v)` Compute the sum of this and v.
`ArrayFieldVector<T>` `append(ArrayFieldVector<T> v)` Construct a vector by appending a vector to this vector.
`FieldVector<T>` `append(FieldVector<T> v)` Construct a vector by appending a vector to this vector.
`FieldVector<T>` `append(T in)` Construct a vector by appending a T to this vector.
`FieldVector<T>` `append(T[] in)` Construct a vector by appending a T array to this vector.
`private T[]` `buildArray(int length)` Build an array of elements.
`private void` `checkIndex(int index)` Check if an index is valid.
`protected void` `checkVectorDimensions(FieldVector<T> v)` Check if instance and specified vectors have the same dimension.
`protected void` `checkVectorDimensions(int n)` Check if instance dimension is equal to some expected value.
`FieldVector<T>` `copy()` Returns a (deep) copy of this.
`T` `dotProduct(ArrayFieldVector<T> v)` Compute the dot product.
`T` `dotProduct(FieldVector<T> v)` Compute the dot product.
`T` `dotProduct(T[] v)` Compute the dot product.
`ArrayFieldVector<T>` `ebeDivide(ArrayFieldVector<T> v)` Element-by-element division.
`FieldVector<T>` `ebeDivide(FieldVector<T> v)` Element-by-element division.
`FieldVector<T>` `ebeDivide(T[] v)` Element-by-element division.
`ArrayFieldVector<T>` `ebeMultiply(ArrayFieldVector<T> v)` Element-by-element multiplication.
`FieldVector<T>` `ebeMultiply(FieldVector<T> v)` Element-by-element multiplication.
`FieldVector<T>` `ebeMultiply(T[] v)` Element-by-element multiplication.
`boolean` `equals(Object other)` Test for the equality of two real vectors.
`T[]` `getData()` Returns vector entries as a T array.
`T[]` `getDataRef()` Returns a reference to the underlying data array.
`int` `getDimension()` Returns the size of the vector.
`T` `getEntry(int index)` Returns the entry in the specified index.
`Field<T>` `getField()` Get the type of field elements of the vector.
`FieldVector<T>` `getSubVector(int index, int n)` Get a subvector from consecutive elements.
`int` `hashCode()` Get a hashCode for the real vector.
`FieldVector<T>` `mapAdd(T d)` Map an addition operation to each entry.
`FieldVector<T>` `mapAddToSelf(T d)` Map an addition operation to each entry.
`FieldVector<T>` `mapDivide(T d)` Map a division operation to each entry.
`FieldVector<T>` `mapDivideToSelf(T d)` Map a division operation to each entry.
`FieldVector<T>` `mapInv()` Map the 1/x function to each entry.
`FieldVector<T>` `mapInvToSelf()` Map the 1/x function to each entry.
`FieldVector<T>` `mapMultiply(T d)` Map a multiplication operation to each entry.
`FieldVector<T>` `mapMultiplyToSelf(T d)` Map a multiplication operation to each entry.
`FieldVector<T>` `mapSubtract(T d)` Map a subtraction operation to each entry.
`FieldVector<T>` `mapSubtractToSelf(T d)` Map a subtraction operation to each entry.
`FieldMatrix<T>` `outerProduct(ArrayFieldVector<T> v)` Compute the outer product.
`FieldMatrix<T>` `outerProduct(FieldVector<T> v)` Compute the outer product.
`FieldMatrix<T>` `outerProduct(T[] v)` Compute the outer product.
`ArrayFieldVector<T>` `projection(ArrayFieldVector<T> v)` Find the orthogonal projection of this vector onto another vector.
`FieldVector<T>` `projection(FieldVector<T> v)` Find the orthogonal projection of this vector onto another vector.
`FieldVector<T>` `projection(T[] v)` Find the orthogonal projection of this vector onto another vector.
`void` `set(int index, ArrayFieldVector<T> v)` Set a set of consecutive elements.
`void` `set(T value)` Set all elements to a single value.
`void` `setEntry(int index, T value)` Set a single element.
`void` `setSubVector(int index, FieldVector<T> v)` Set a set of consecutive elements.
`void` `setSubVector(int index, T[] v)` Set a set of consecutive elements.
`ArrayFieldVector<T>` `subtract(ArrayFieldVector<T> v)` Compute this minus v.
`FieldVector<T>` `subtract(FieldVector<T> v)` Compute this minus v.
`FieldVector<T>` `subtract(T[] v)` Compute this minus v.
`T[]` `toArray()` Convert the vector to a T array.

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

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

### Field Detail

#### serialVersionUID

    private static final long serialVersionUID

Serializable version identifier.

See Also:
  Constant Field Values

#### data

    protected T extends FieldElement<T>[] data

Entries of the vector.

#### field

    private final Field<T extends FieldElement<T>> field

Field to which the elements belong.

### Constructor Detail

#### ArrayFieldVector

    public ArrayFieldVector(Field<T> field)

Build a 0-length vector.

Zero-length vectors may be used to initialized construction of vectors by data gathering. We start with zero-length and use either the `ArrayFieldVector(ArrayFieldVector, ArrayFieldVector)` constructor or one of the `append` methods (`append(FieldElement[])`, `add(FieldVector)`, `append(ArrayFieldVector)`) to gather data into this vector.

Parameters:
  `field` - field to which the elements belong

#### ArrayFieldVector

    public ArrayFieldVector(Field<T> field,
                    int size)

Construct a (size)-length vector of zeros.

Parameters:
  `field` - field to which the elements belong
  `size` - size of the vector

#### ArrayFieldVector

    public ArrayFieldVector(int size,
                    T preset)

Construct an (size)-length vector with preset values.

Parameters:
  `size` - size of the vector
  `preset` - fill the vector with this scalar value

#### ArrayFieldVector

    public ArrayFieldVector(T[] d)
                     throws IllegalArgumentException

Construct a vector from an array, copying the input array.

This constructor needs a non-empty `d` array to retrieve the field from its first element. This implies it cannot build 0 length vectors. To build vectors from any size, one should use the `ArrayFieldVector(Field, FieldElement[])` constructor.

Parameters:
  `d` - array of Ts.
Throws:
  `IllegalArgumentException` - if `d` is empty
See Also:
  `ArrayFieldVector(Field, FieldElement[])`

#### ArrayFieldVector

    public ArrayFieldVector(Field<T> field,
                    T[] d)

Construct a vector from an array, copying the input array.

Parameters:
  `field` - field to which the elements belong
  `d` - array of Ts.
See Also:
  `ArrayFieldVector(FieldElement[])`

#### ArrayFieldVector

    public ArrayFieldVector(T[] d,
                    boolean copyArray)
                     throws NullPointerException,
                            IllegalArgumentException

Create a new ArrayFieldVector using the input array as the underlying data array.

If an array is built specially in order to be embedded in a ArrayFieldVector and not used directly, the `copyArray` may be set to `false</code. This will prevent the copying and improve performance as no new array will be built and no data will be copied.</p>`

This constructor needs a non-empty `d` array to retrieve the field from its first element. This implies it cannot build 0 length vectors. To build vectors from any size, one should use the `ArrayFieldVector(Field, FieldElement[], boolean)` constructor.

Parameters:
  `d` - data for new vector
  `copyArray` - if true, the input array will be copied, otherwise it will be referenced
Throws:
  `IllegalArgumentException` - if `d` is empty
  `NullPointerException` - if `d` is null
See Also:
  `ArrayFieldVector(FieldElement[])`, `ArrayFieldVector(Field, FieldElement[], boolean)`

#### ArrayFieldVector

    public ArrayFieldVector(Field<T> field,
                    T[] d,
                    boolean copyArray)

Create a new ArrayFieldVector using the input array as the underlying data array.

If an array is built specially in order to be embedded in a ArrayFieldVector and not used directly, the `copyArray` may be set to `false</code. This will prevent the copying and improve performance as no new array will be built and no data will be copied.</p>`

Parameters:
  `field` - field to which the elements belong
  `d` - data for new vector
  `copyArray` - if true, the input array will be copied, otherwise it will be referenced
See Also:
  `ArrayFieldVector(FieldElement[], boolean)`

#### ArrayFieldVector

    public ArrayFieldVector(T[] d,
                    int pos,
                    int size)

Construct a vector from part of a array.

Parameters:
  `d` - array of Ts.
  `pos` - position of first entry
  `size` - number of entries to copy

#### ArrayFieldVector

    public ArrayFieldVector(FieldVector<T> v)

Construct a vector from another vector, using a deep copy.

Parameters:
  `v` - vector to copy

#### ArrayFieldVector

    public ArrayFieldVector(ArrayFieldVector<T> v)

Construct a vector from another vector, using a deep copy.

Parameters:
  `v` - vector to copy

#### ArrayFieldVector

    public ArrayFieldVector(ArrayFieldVector<T> v,
                    boolean deep)

Construct a vector from another vector.

Parameters:
  `v` - vector to copy
  `deep` - if true perform a deep copy otherwise perform a shallow copy

#### ArrayFieldVector

    public ArrayFieldVector(ArrayFieldVector<T> v1,
                    ArrayFieldVector<T> v2)

Construct a vector by appending one vector to another vector.

Parameters:
  `v1` - first vector (will be put in front of the new vector)
  `v2` - second vector (will be put at back of the new vector)

#### ArrayFieldVector

    public ArrayFieldVector(ArrayFieldVector<T> v1,
                    T[] v2)

Construct a vector by appending one vector to another vector.

Parameters:
  `v1` - first vector (will be put in front of the new vector)
  `v2` - second vector (will be put at back of the new vector)

#### ArrayFieldVector

    public ArrayFieldVector(T[] v1,
                    ArrayFieldVector<T> v2)

Construct a vector by appending one vector to another vector.

Parameters:
  `v1` - first vector (will be put in front of the new vector)
  `v2` - second vector (will be put at back of the new vector)

#### ArrayFieldVector

    public ArrayFieldVector(T[] v1,
                    T[] v2)

Construct a vector by appending one vector to another vector.

This constructor needs at least one non-empty array to retrieve the field from its first element. This implies it cannot build 0 length vectors. To build vectors from any size, one should use the `ArrayFieldVector(Field, FieldElement[], FieldElement[])` constructor.

Parameters:
  `v1` - first vector (will be put in front of the new vector)
  `v2` - second vector (will be put at back of the new vector)
Throws:
  `IllegalArgumentException` - if both vectors are empty
See Also:
  `ArrayFieldVector(Field, FieldElement[], FieldElement[])`

#### ArrayFieldVector

    public ArrayFieldVector(Field<T> field,
                    T[] v1,
                    T[] v2)

Construct a vector by appending one vector to another vector.

Parameters:
  `field` - field to which the elements belong
  `v1` - first vector (will be put in front of the new vector)
  `v2` - second vector (will be put at back of the new vector)
See Also:
  `ArrayFieldVector(FieldElement[], FieldElement[])`

### Method Detail

#### buildArray

    private T[] buildArray(int length)

Build an array of elements.

Parameters:
  `length` - size of the array to build
Returns:
  a new array

#### getField

    public Field<T> getField()

Get the type of field elements of the vector.

Specified by:
  `getField` in interface `FieldVector<T extends FieldElement<T>>`
Returns:
  type of field elements of the vector

#### copy

    public FieldVector<T> copy()

Returns a (deep) copy of this.

Specified by:
  `copy` in interface `FieldVector<T extends FieldElement<T>>`
Returns:
  vector copy

#### add

    public FieldVector<T> add(FieldVector<T> v)
                                               throws IllegalArgumentException

Compute the sum of this and v.

Specified by:
  `add` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `v` - vector to be added
Returns:
  this + v
Throws:
  `IllegalArgumentException` - if v is not the same size as this

#### add

    public FieldVector<T> add(T[] v)
                                               throws IllegalArgumentException

Compute the sum of this and v.

Specified by:
  `add` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `v` - vector to be added
Returns:
  this + v
Throws:
  `IllegalArgumentException` - if v is not the same size as this

#### add

    public ArrayFieldVector<T> add(ArrayFieldVector<T> v)
                                                    throws IllegalArgumentException

Compute the sum of this and v.

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

#### subtract

    public FieldVector<T> subtract(FieldVector<T> v)
                                                    throws IllegalArgumentException

Compute this minus v.

Specified by:
  `subtract` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `v` - vector to be subtracted
Returns:
  this + v
Throws:
  `IllegalArgumentException` - if v is not the same size as this

#### subtract

    public FieldVector<T> subtract(T[] v)
                                                    throws IllegalArgumentException

Compute this minus v.

Specified by:
  `subtract` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `v` - vector to be subtracted
Returns:
  this + v
Throws:
  `IllegalArgumentException` - if v is not the same size as this

#### subtract

    public ArrayFieldVector<T> subtract(ArrayFieldVector<T> v)
                                                         throws IllegalArgumentException

Compute this minus v.

Parameters:
  `v` - vector to be subtracted
Returns:
  this + v
Throws:
  `IllegalArgumentException` - if v is not the same size as this

#### mapAdd

    public FieldVector<T> mapAdd(T d)

Map an addition operation to each entry.

Specified by:
  `mapAdd` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `d` - value to be added to each entry
Returns:
  this + d

#### mapAddToSelf

    public FieldVector<T> mapAddToSelf(T d)

Map an addition operation to each entry.

The instance is changed by this method.

Specified by:
  `mapAddToSelf` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `d` - value to be added to each entry
Returns:
  for convenience, return this

#### mapSubtract

    public FieldVector<T> mapSubtract(T d)

Map a subtraction operation to each entry.

Specified by:
  `mapSubtract` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `d` - value to be subtracted to each entry
Returns:
  this - d

#### mapSubtractToSelf

    public FieldVector<T> mapSubtractToSelf(T d)

Map a subtraction operation to each entry.

The instance is changed by this method.

Specified by:
  `mapSubtractToSelf` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `d` - value to be subtracted to each entry
Returns:
  for convenience, return this

#### mapMultiply

    public FieldVector<T> mapMultiply(T d)

Map a multiplication operation to each entry.

Specified by:
  `mapMultiply` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `d` - value to multiply all entries by
Returns:
  this * d

#### mapMultiplyToSelf

    public FieldVector<T> mapMultiplyToSelf(T d)

Map a multiplication operation to each entry.

The instance is changed by this method.

Specified by:
  `mapMultiplyToSelf` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `d` - value to multiply all entries by
Returns:
  for convenience, return this

#### mapDivide

    public FieldVector<T> mapDivide(T d)

Map a division operation to each entry.

Specified by:
  `mapDivide` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `d` - value to divide all entries by
Returns:
  this / d

#### mapDivideToSelf

    public FieldVector<T> mapDivideToSelf(T d)

Map a division operation to each entry.

The instance is changed by this method.

Specified by:
  `mapDivideToSelf` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `d` - value to divide all entries by
Returns:
  for convenience, return this

#### mapInv

    public FieldVector<T> mapInv()

Map the 1/x function to each entry.

Specified by:
  `mapInv` in interface `FieldVector<T extends FieldElement<T>>`
Returns:
  a vector containing the result of applying the function to each entry

#### mapInvToSelf

    public FieldVector<T> mapInvToSelf()

Map the 1/x function to each entry.

The instance is changed by this method.

Specified by:
  `mapInvToSelf` in interface `FieldVector<T extends FieldElement<T>>`
Returns:
  for convenience, return this

#### ebeMultiply

    public FieldVector<T> ebeMultiply(FieldVector<T> v)
                                                       throws IllegalArgumentException

Element-by-element multiplication.

Specified by:
  `ebeMultiply` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `v` - vector by which instance elements must be multiplied
Returns:
  a vector containing this[i] * v[i] for all i
Throws:
  `IllegalArgumentException` - if v is not the same size as this

#### ebeMultiply

    public FieldVector<T> ebeMultiply(T[] v)
                                                       throws IllegalArgumentException

Element-by-element multiplication.

Specified by:
  `ebeMultiply` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `v` - vector by which instance elements must be multiplied
Returns:
  a vector containing this[i] * v[i] for all i
Throws:
  `IllegalArgumentException` - if v is not the same size as this

#### ebeMultiply

    public ArrayFieldVector<T> ebeMultiply(ArrayFieldVector<T> v)
                                                            throws IllegalArgumentException

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:
  `IllegalArgumentException` - if v is not the same size as this

#### ebeDivide

    public FieldVector<T> ebeDivide(FieldVector<T> v)
                                                     throws IllegalArgumentException

Element-by-element division.

Specified by:
  `ebeDivide` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `v` - vector by which instance elements must be divided
Returns:
  a vector containing this[i] / v[i] for all i
Throws:
  `IllegalArgumentException` - if v is not the same size as this

#### ebeDivide

    public FieldVector<T> ebeDivide(T[] v)
                                                     throws IllegalArgumentException

Element-by-element division.

Specified by:
  `ebeDivide` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `v` - vector by which instance elements must be divided
Returns:
  a vector containing this[i] / v[i] for all i
Throws:
  `IllegalArgumentException` - if v is not the same size as this

#### ebeDivide

    public ArrayFieldVector<T> ebeDivide(ArrayFieldVector<T> v)
                                                          throws IllegalArgumentException

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:
  `IllegalArgumentException` - if v is not the same size as this

#### getData

    public T[] getData()

Returns vector entries as a T array.

Specified by:
  `getData` in interface `FieldVector<T extends FieldElement<T>>`
Returns:
  T array of entries

#### getDataRef

    public T[] getDataRef()

Returns a reference to the underlying data array.

Does not make a fresh copy of the underlying data.

Returns:
  array of entries

#### dotProduct

    public T dotProduct(FieldVector<T> v)
                                         throws IllegalArgumentException

Compute the dot product.

Specified by:
  `dotProduct` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `v` - vector with which dot product should be computed
Returns:
  the scalar dot product between instance and v
Throws:
  `IllegalArgumentException` - if v is not the same size as this

#### dotProduct

    public T dotProduct(T[] v)
                                         throws IllegalArgumentException

Compute the dot product.

Specified by:
  `dotProduct` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `v` - vector with which dot product should be computed
Returns:
  the scalar dot product between instance and v
Throws:
  `IllegalArgumentException` - if v is not the same size as this

#### dotProduct

    public T dotProduct(ArrayFieldVector<T> v)
                                         throws IllegalArgumentException

Compute the dot product.

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

#### projection

    public FieldVector<T> projection(FieldVector<T> v)

Find the orthogonal projection of this vector onto another vector.

Specified by:
  `projection` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `v` - vector onto which instance must be projected
Returns:
  projection of the instance onto v

#### projection

    public FieldVector<T> projection(T[] v)

Find the orthogonal projection of this vector onto another vector.

Specified by:
  `projection` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `v` - vector onto which instance must be projected
Returns:
  projection of the instance onto v

#### projection

    public ArrayFieldVector<T> projection(ArrayFieldVector<T> 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:
  `IllegalArgumentException` - if v is not the same size as this

#### outerProduct

    public FieldMatrix<T> outerProduct(FieldVector<T> v)
                                                        throws IllegalArgumentException

Compute the outer product.

Specified by:
  `outerProduct` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `v` - vector with which outer product should be computed
Returns:
  the square matrix outer product between instance and v
Throws:
  `IllegalArgumentException` - if v is not the same size as this

#### outerProduct

    public FieldMatrix<T> outerProduct(ArrayFieldVector<T> v)
                                                        throws IllegalArgumentException

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:
  `IllegalArgumentException` - if v is not the same size as this

#### outerProduct

    public FieldMatrix<T> outerProduct(T[] v)
                                                        throws IllegalArgumentException

Compute the outer product.

Specified by:
  `outerProduct` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `v` - vector with which outer product should be computed
Returns:
  the square matrix outer product between instance and v
Throws:
  `IllegalArgumentException` - if v is not the same size as this

#### getEntry

    public T getEntry(int index)
                                       throws MatrixIndexException

Returns the entry in the specified index.

The index start at 0 and must be lesser than the size, otherwise a `MatrixIndexException` is thrown.

Specified by:
  `getEntry` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `index` - index location of entry to be fetched
Returns:
  vector entry at index
Throws:
  `MatrixIndexException` - if the index is not valid
See Also:
  `FieldVector.setEntry(int, FieldElement)`

#### getDimension

    public int getDimension()

Returns the size of the vector.

Specified by:
  `getDimension` in interface `FieldVector<T extends FieldElement<T>>`
Returns:
  size

#### append

    public FieldVector<T> append(FieldVector<T> v)

Construct a vector by appending a vector to this vector.

Specified by:
  `append` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `v` - vector to append to this one.
Returns:
  a new vector

#### append

    public ArrayFieldVector<T> append(ArrayFieldVector<T> v)

Construct a vector by appending a vector to this vector.

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

#### append

    public FieldVector<T> append(T in)

Construct a vector by appending a T to this vector.

Specified by:
  `append` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `in` - T to append.
Returns:
  a new vector

#### append

    public FieldVector<T> append(T[] in)

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

Specified by:
  `append` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `in` - T array to append.
Returns:
  a new vector

#### getSubVector

    public FieldVector<T> getSubVector(int index,
                              int n)

Get a subvector from consecutive elements.

Specified by:
  `getSubVector` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `index` - index of first element.
  `n` - number of elements to be retrieved.
Returns:
  a vector containing n elements.

#### setEntry

    public void setEntry(int index,
                T value)

Set a single element.

Specified by:
  `setEntry` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `index` - element index.
  `value` - new value for the element.
See Also:
  `FieldVector.getEntry(int)`

#### setSubVector

    public void setSubVector(int index,
                    FieldVector<T> v)

Set a set of consecutive elements.

Specified by:
  `setSubVector` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `index` - index of first element to be set.
  `v` - vector containing the values to set.
See Also:
  `FieldVector.setSubVector(int, FieldElement[])`

#### setSubVector

    public void setSubVector(int index,
                    T[] v)

Set a set of consecutive elements.

Specified by:
  `setSubVector` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `index` - index of first element to be set.
  `v` - vector containing the values to set.
See Also:
  `FieldVector.setSubVector(int, FieldVector)`

#### set

    public void set(int index,
           ArrayFieldVector<T> v)
             throws MatrixIndexException

Set a set of consecutive elements.

Parameters:
  `index` - index of first element to be set.
  `v` - vector containing the values to set.
Throws:
  `MatrixIndexException` - if the index is inconsistent with vector size

#### set

    public void set(T value)

Set all elements to a single value.

Specified by:
  `set` in interface `FieldVector<T extends FieldElement<T>>`
Parameters:
  `value` - single value to set for all elements

#### toArray

    public T[] toArray()

Convert the vector to a T array.

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

Specified by:
  `toArray` in interface `FieldVector<T extends FieldElement<T>>`
Returns:
  array containing a copy of vector elements

#### checkVectorDimensions

    protected void checkVectorDimensions(FieldVector<T> v)
                                  throws IllegalArgumentException

Check if instance and specified vectors have the same dimension.

Parameters:
  `v` - vector to compare instance with
Throws:
  `IllegalArgumentException` - if the vectors do not have the same dimension

#### checkVectorDimensions

    protected void checkVectorDimensions(int n)
                                  throws IllegalArgumentException

Check if instance dimension is equal to some expected value.

Parameters:
  `n` - expected dimension.
Throws:
  `IllegalArgumentException` - if the dimension is inconsistent with vector size

#### equals

    public boolean equals(Object other)

Test for the equality of two real vectors.

If all coordinates of two real vectors are exactly the same, and none are `Double.NaN`, the two real vectors are considered to be equal.

`NaN` coordinates are considered to affect globally the vector and be equals to each other - i.e, if either (or all) coordinates of the real vector are equal to `Double.NaN`, the real vector is equal to a vector with all `Double.NaN` coordinates.

Overrides:
  `equals` in class `Object`
Parameters:
  `other` - Object to test for equality to this
Returns:
  true if two 3D vector objects are equal, false if object is null, not an instance of Vector3D, or not equal to this Vector3D instance

#### hashCode

    public int hashCode()

Get a hashCode for the real vector.

All NaN values have the same hash code.

Overrides:
  `hashCode` in class `Object`
Returns:
  a hash code value for this object

#### checkIndex

    private void checkIndex(int index)
                     throws MatrixIndexException

Check if an index is valid.

Parameters:
  `index` - index to check
Throws:
  `MatrixIndexException` - if index is not valid