Class FieldVector<T extends Field<T>>

Type Parameters:
T - Type of the field element for the matrix.
All Implemented Interfaces:
Serializable, FieldTensorMixin<FieldVector<T>,FieldVector<T>,T>, TensorOverField<FieldVector<T>,FieldVector<T>,T[],T>, RingTensorMixin<FieldVector<T>,FieldVector<T>,T>, TensorOverRing<FieldVector<T>,FieldVector<T>,T[],T>, SemiringTensorMixin<FieldVector<T>,FieldVector<T>,T>, TensorOverSemiring<FieldVector<T>,FieldVector<T>,T[],T>, VectorMixin<FieldVector<T>,FieldMatrix<T>,FieldMatrix<T>,T>

public class FieldVector<T extends Field<T>> extends AbstractDenseFieldVector<FieldVector<T>,FieldMatrix<T>,T>

Instances of this class represents a dense vector backed by a Field array. The FieldVector class provides functionality for matrix operations whose elements are members of a field, supporting mutable data with a fixed shape.

A FieldVector is essentially equivalent to a rank-1 tensor but includes extended functionality and may offer improved performance for certain operations compared to general rank n tensors.

Key Features:

  • Support for standard vector operations like addition, subtraction, and inner/outer products.
  • Conversion methods to other representations, such as FieldMatrix, FieldTensor, or COO (Coordinate).
  • Utility methods for checking properties like being the zero vector.

Example Usage:


 // Constructing a complex matrix from an array of complex numbers
 Complex128[] complexData = {
     new Complex128(1, 2), new Complex128(3, 4),
     new Complex128(5, 6), new Complex128(7, 8)
 };
 FieldVector<Complex128> vector = new FieldVector(complexData);

 // Performing vector inner/outer product.
 Complex128 inner = vector.inner(vector);
 FieldMatrix<Complex128> outer = vector.outer(vector);

 // Checking if the vector only contains zeros.
 boolean isZero = vector.isZeros();
 
See Also:
  • Constructor Details

    • FieldVector

      public FieldVector(T... entries)
      Creates a vector with the specified data.
      Parameters:
      entries - Entries of this vector.
    • FieldVector

      public FieldVector(int size, T fillValue)
      Creates a vector with the specified size filled with the fillValue.
      Parameters:
      size -
      fillValue - Value to fill this vector with.
    • FieldVector

      public FieldVector(Shape shape, T[] entries)
      Constructs a dense complex vector with the given shape and entries.
      Parameters:
      shape - The shape of the vector. Must be rank-1 and satisfy shape.totalEntriesIntValueExact() == data.length.
      data - The entries of the vector.
      Throws:
      LinearAlgebraException - If shape.getRank() != 1
      IllegalArgumentException - If shape.totalEntriesIntValueExact() != data.length
  • Method Details