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
See Also:
  • Constructor Details

    • 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

      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

      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 falseinvalid input: '<'/code. This will prevent the copying and improve performance as no new array will be built and no data will be copied.

      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

      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 falseinvalid input: '<'/code. This will prevent the copying and improve performance as no new array will be built and no data will be copied.

      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

      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

      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:
  • Method Details