Class GenVector<C extends RingElem<C>>

java.lang.Object
edu.jas.vector.GenVector<C>
All Implemented Interfaces:
AbelianGroupElem<GenVector<C>>, Element<GenVector<C>>, ModulElem<GenVector<C>,C>, Serializable, Comparable<GenVector<C>>

public class GenVector<C extends RingElem<C>> extends Object implements ModulElem<GenVector<C>,C>
GenVector implements generic vectors with RingElem entries. Vectors of n columns over C.
See Also:
  • Field Details

  • Constructor Details

    • GenVector

      public GenVector(GenVectorModul<C> m)
      Constructor for zero GenVector.
    • GenVector

      public GenVector(GenVectorModul<C> m, List<C> v)
      Constructor for GenVector.
    • GenVector

      public GenVector(GenVectorModul<C> m, C[] v)
      Constructor for GenVector.
  • Method Details

    • toString

      public String toString()
      Get the String representation as RingElem.
      Overrides:
      toString in class Object
      See Also:
    • toScript

      public String toScript()
      Get a scripting compatible string representation.
      Specified by:
      toScript in interface Element<C extends RingElem<C>>
      Returns:
      script compatible representation for this Element.
      See Also:
    • toScriptFactory

      public String toScriptFactory()
      Get a scripting compatible string representation of the factory.
      Specified by:
      toScriptFactory in interface Element<C extends RingElem<C>>
      Returns:
      script compatible representation for this ElemFactory.
      See Also:
    • factory

      public GenVectorModul<C> factory()
      Get the corresponding element factory.
      Specified by:
      factory in interface Element<C extends RingElem<C>>
      Returns:
      factory for this Element.
      See Also:
    • copy

      public GenVector<C> copy()
      clone method.
      Specified by:
      copy in interface Element<C extends RingElem<C>>
      Returns:
      Creates and returns a copy of this Element.
      See Also:
    • isZERO

      public boolean isZERO()
      test if this is equal to a zero vector.
      Specified by:
      isZERO in interface AbelianGroupElem<C extends RingElem<C>>
      Returns:
      true if this is 0, else false.
    • equals

      public boolean equals(Object other)
      equals method.
      Specified by:
      equals in interface Element<C extends RingElem<C>>
      Overrides:
      equals in class Object
      Parameters:
      other -
      Returns:
      true if this is equal to b, else false.
    • hashCode

      public int hashCode()
      Hash code for this GenVector.
      Specified by:
      hashCode in interface Element<C extends RingElem<C>>
      Overrides:
      hashCode in class Object
      Returns:
      the hashCode.
      See Also:
    • compareTo

      public int compareTo(GenVector<C> b)
      compareTo, lexicographical comparison.
      Specified by:
      compareTo in interface Comparable<C extends RingElem<C>>
      Specified by:
      compareTo in interface Element<C extends RingElem<C>>
      Parameters:
      b - other
      Returns:
      1 if (this < b), 0 if (this == b) or -1 if (this > b).
    • get

      public C get(int i)
      get element.
      Parameters:
      i - index
      Returns:
      e with e = this(i).
    • setMutate

      public C setMutate(int i, C e)
      set element, mutate this.
      Parameters:
      i - index
      e - value
      Returns:
      this with this(i) = e.
    • signum

      public int signum()
      sign of vector.
      Specified by:
      signum in interface AbelianGroupElem<C extends RingElem<C>>
      Returns:
      1 if (this < 0), 0 if (this == 0) or -1 if (this > 0).
    • sum

      public GenVector<C> sum(GenVector<C> b)
      Sum of vectors.
      Specified by:
      sum in interface AbelianGroupElem<C extends RingElem<C>>
      Parameters:
      b - other vector.
      Returns:
      this+b
    • subtract

      public GenVector<C> subtract(GenVector<C> b)
      Difference of vectors.
      Specified by:
      subtract in interface AbelianGroupElem<C extends RingElem<C>>
      Parameters:
      b - other vector.
      Returns:
      this-b
    • negate

      public GenVector<C> negate()
      Negative of this vector.
      Specified by:
      negate in interface AbelianGroupElem<C extends RingElem<C>>
      Returns:
      -this
    • abs

      public GenVector<C> abs()
      Absolute value of this vector.
      Specified by:
      abs in interface AbelianGroupElem<C extends RingElem<C>>
      Returns:
      abs(this)
    • multiply

      public GenVector<C> multiply(C s)
      Product of this vector with scalar.
      Parameters:
      s - scalar.
      Returns:
      this*s
    • scalarMultiply

      public GenVector<C> scalarMultiply(C s)
      Product of this vector with scalar.
      Specified by:
      scalarMultiply in interface ModulElem<GenVector<C extends RingElem<C>>,C extends RingElem<C>>
      Parameters:
      s - scalar.
      Returns:
      this*s
    • leftScalarMultiply

      public GenVector<C> leftScalarMultiply(C s)
      Left product of this vector with scalar.
      Parameters:
      s - scalar.
      Returns:
      s*this
    • linearCombination

      public GenVector<C> linearCombination(C s, GenVector<C> b, C t)
      Linear combination of this vector with scalar multiple of other vector.
      Specified by:
      linearCombination in interface ModulElem<GenVector<C extends RingElem<C>>,C extends RingElem<C>>
      Parameters:
      s - scalar.
      b - other vector.
      t - scalar.
      Returns:
      this*s+b*t
    • linearCombination

      public GenVector<C> linearCombination(GenVector<C> b, C t)
      Linear combination of this vector with scalar multiple of other vector.
      Specified by:
      linearCombination in interface ModulElem<GenVector<C extends RingElem<C>>,C extends RingElem<C>>
      Parameters:
      b - other vector.
      t - scalar.
      Returns:
      this+b*t
    • linearCombination

      public GenVector<C> linearCombination(C t, GenVector<C> b)
      Left linear combination of this vector with scalar multiple of other vector.
      Parameters:
      t - scalar.
      b - other vector.
      Returns:
      this+t*b
    • leftLinearCombination

      public GenVector<C> leftLinearCombination(C s, C t, GenVector<C> b)
      left linear combination of this vector with scalar multiple of other vector.
      Parameters:
      s - scalar.
      t - scalar.
      b - other vector.
      Returns:
      s*this+t*b
    • scalarProduct

      public C scalarProduct(GenVector<C> b)
      scalar / dot product of this vector with other vector.
      Specified by:
      scalarProduct in interface ModulElem<GenVector<C extends RingElem<C>>,C extends RingElem<C>>
      Parameters:
      b - other vector.
      Returns:
      this . b
    • scalarProduct

      public GenVector<C> scalarProduct(List<GenVector<C>> B)
      scalar / dot product of this vector with list of other vectors.
      Specified by:
      scalarProduct in interface ModulElem<GenVector<C extends RingElem<C>>,C extends RingElem<C>>
      Parameters:
      B - list of vectors.
      Returns:
      this * b
    • rightScalarProduct

      public GenVector<C> rightScalarProduct(List<GenVector<C>> B)
      right scalar / dot product of this vector with list of other vectors.
      Parameters:
      B - list of vectors.
      Returns:
      b * this