GF2mVector (Bouncy Castle Library 1.54 API Specification)
Date: 2015-12-29

org.bouncycastle.pqc.math.linearalgebra

## Class GF2mVector

- java.lang.Object
- - org.bouncycastle.pqc.math.linearalgebra.Vector
  - - org.bouncycastle.pqc.math.linearalgebra.GF2mVector

-     public class GF2mVector
      extends Vector

  This class implements vectors over the finite field `GF(2m)` for small `m` (i.e., `1<m<32`). It extends the abstract class `Vector`.

- - ### Field Summary

    - ### Fields inherited from class org.bouncycastle.pqc.math.linearalgebra.Vector

      `length`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GF2mVector(GF2mField field, byte[] v)` creates the vector over GF(2^m) of given length and with elements from array v (beginning at the first bit)
    `GF2mVector(GF2mField field, int[] vector)` Create a new vector over `GF(2m)` of the given length and element array.
    `GF2mVector(GF2mVector other)` Copy constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Vector` | `add(Vector addend)` Add another vector to this vector.
    `boolean` | `equals(java.lang.Object other)` Compare this vector with another object.
    `byte[]` | `getEncoded()`
    `GF2mField` | `getField()`
    `int[]` | `getIntArrayForm()`
    `int` | `hashCode()`
    `boolean` | `isZero()` Return whether this is the zero vector (i.e., all elements are zero).
    `Vector` | `multiply(Permutation p)` Multiply this vector with a permutation.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class org.bouncycastle.pqc.math.linearalgebra.Vector

      `getLength`

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

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

- - ### Constructor Detail

    - #### GF2mVector

          public GF2mVector(GF2mField field,
                    byte[] v)

      creates the vector over GF(2^m) of given length and with elements from array v (beginning at the first bit)
      Parameters:
        `field` - finite field
        `v` - array with elements of vector

    - #### GF2mVector

          public GF2mVector(GF2mField field,
                    int[] vector)

      Create a new vector over `GF(2m)` of the given length and element array.
      Parameters:
        `field` - the finite field `GF(2m)`
        `vector` - the element array

    - #### GF2mVector

          public GF2mVector(GF2mVector other)

      Copy constructor.
      Parameters:
        `other` - another `GF2mVector`

  - ### Method Detail

    - #### getField

          public GF2mField getField()

      Returns:
        the finite field this vector is defined over

    - #### getIntArrayForm

          public int[] getIntArrayForm()

      Returns:
        int[] form of this vector

    - #### getEncoded

          public byte[] getEncoded()

      Specified by:
        `getEncoded` in class `Vector`
      Returns:
        a byte array encoding of this vector

    - #### isZero

          public boolean isZero()

      Description copied from class: `Vector`
      Return whether this is the zero vector (i.e., all elements are zero).
      Specified by:
        `isZero` in class `Vector`
      Returns:
        whether this is the zero vector (i.e., all elements are zero)

    - #### add

          public Vector add(Vector addend)

      Add another vector to this vector. Method is not yet implemented.
      Specified by:
        `add` in class `Vector`
      Parameters:
        `addend` - the other vector
      Returns:
        `this + addend`
      Throws:
        `java.lang.ArithmeticException` - if the other vector is not defined over the same field as this vector.

        TODO: implement this method

    - #### multiply

          public Vector multiply(Permutation p)

      Multiply this vector with a permutation.
      Specified by:
        `multiply` in class `Vector`
      Parameters:
        `p` - the permutation
      Returns:
        `this*p = p*this`

    - #### equals

          public boolean equals(java.lang.Object other)

      Compare this vector with another object.
      Specified by:
        `equals` in class `Vector`
      Parameters:
        `other` - the other object
      Returns:
        the result of the comparison

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in class `Vector`
      Returns:
        the hash code of this vector

    - #### toString

          public java.lang.String toString()

      Specified by:
        `toString` in class `Vector`
      Returns:
        a human readable form of this vector