Top Description Fields Constructors Methods
org.bouncycastle.pqc.legacy.math.linearalgebra

public Class GF2mVector

extends Vector
Class Inheritance
Imports
org.bouncycastle.util.Arrays

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

Modifier and TypeField and Description
private GF2mField
field

the finite field this vector is defined over

private int[]
vector

the element array

Inherited from org.bouncycastle.pqc.legacy.math.linearalgebra.Vector:
length

Constructor Summary

AccessConstructor and Description
public
GF2mVector(GF2mField
finite field
field
,
byte[]
array with elements of vector
v
)

creates the vector over GF(2^m) of given length and with elements from array v (beginning at the first bit)

public
GF2mVector(GF2mField
the finite field GF(2m)
field
,
int[]
the element array
vector
)

Create a new vector over GF(2m) of the given length and element array.

public
GF2mVector(GF2mVector
another GF2mVector
other
)

Copy constructor.

Method Summary

Modifier and TypeMethod and Description
public Vector

Returns:

this + addend
add
(Vector
the other vector
addend
)

Implements abstract org.bouncycastle.pqc.legacy.math.linearalgebra.Vector.add.

Add another vector to this vector.
public boolean

Returns:

the result of the comparison
equals
(Object
the other object
other
)

Implements abstract org.bouncycastle.pqc.legacy.math.linearalgebra.Vector.equals.

Compare this vector with another object.
public byte[]

Returns:

a byte array encoding of this vector
getEncoded
()

Implements abstract org.bouncycastle.pqc.legacy.math.linearalgebra.Vector.getEncoded.

public GF2mField

Returns:

the finite field this vector is defined over
getField
()

public int[]

Returns:

int[] form of this vector
getIntArrayForm
()

public int

Returns:

the hash code of this vector
hashCode
()

Implements abstract org.bouncycastle.pqc.legacy.math.linearalgebra.Vector.hashCode.

Returns a hash code value for the object.
public boolean

Returns:

whether this is the zero vector (i.e., all elements are zero)
isZero
()

Implements abstract org.bouncycastle.pqc.legacy.math.linearalgebra.Vector.isZero.

Return whether this is the zero vector (i.e., all elements are zero).
public Vector

Returns:

this*p = p*this
multiply
(Permutation
the permutation
p
)

Implements abstract org.bouncycastle.pqc.legacy.math.linearalgebra.Vector.multiply.

Multiply this vector with a permutation.
public String

Returns:

a human readable form of this vector
toString
()

Implements abstract org.bouncycastle.pqc.legacy.math.linearalgebra.Vector.toString.

Returns a string representation of the object.
Inherited from org.bouncycastle.pqc.legacy.math.linearalgebra.Vector:
getLength

Field Detail

fieldback to summary
private GF2mField field

the finite field this vector is defined over

vectorback to summary
private int[] vector

the element array

Constructor Detail

GF2mVectorback to summary
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:GF2mField

finite field

v:byte[]

array with elements of vector

GF2mVectorback to summary
public GF2mVector(GF2mField field, int[] vector)

Create a new vector over GF(2m) of the given length and element array.

Parameters
field:GF2mField

the finite field GF(2m)

vector:int[]

the element array

GF2mVectorback to summary
public GF2mVector(GF2mVector other)

Copy constructor.

Parameters
other:GF2mVector

another GF2mVector

Method Detail

addback to summary
public Vector add(Vector addend)

Implements abstract org.bouncycastle.pqc.legacy.math.linearalgebra.Vector.add.

Add another vector to this vector. Method is not yet implemented.

Parameters
addend:Vector

the other vector

Returns:Vector

this + addend

Exceptions
ArithmeticException:
if the other vector is not defined over the same field as this vector.

TODO: implement this method

equalsback to summary
public boolean equals(Object other)

Implements abstract org.bouncycastle.pqc.legacy.math.linearalgebra.Vector.equals.

Compare this vector with another object.

Parameters
other:Object

the other object

Returns:boolean

the result of the comparison

getEncodedback to summary
public byte[] getEncoded()

Implements abstract org.bouncycastle.pqc.legacy.math.linearalgebra.Vector.getEncoded.

Returns:byte[]

a byte array encoding of this vector

getFieldback to summary
public GF2mField getField()
Returns:GF2mField

the finite field this vector is defined over

getIntArrayFormback to summary
public int[] getIntArrayForm()
Returns:int[]

int[] form of this vector

hashCodeback to summary
public int hashCode()

Implements abstract org.bouncycastle.pqc.legacy.math.linearalgebra.Vector.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

the hash code of this vector

isZeroback to summary
public boolean isZero()

Implements abstract org.bouncycastle.pqc.legacy.math.linearalgebra.Vector.isZero.

Doc from org.bouncycastle.pqc.legacy.math.linearalgebra.Vector.isZero.

Return whether this is the zero vector (i.e., all elements are zero).

Returns:boolean

whether this is the zero vector (i.e., all elements are zero)

multiplyback to summary
public Vector multiply(Permutation p)

Implements abstract org.bouncycastle.pqc.legacy.math.linearalgebra.Vector.multiply.

Multiply this vector with a permutation.

Parameters
p:Permutation

the permutation

Returns:Vector

this*p = p*this

toStringback to summary
public String toString()

Implements abstract org.bouncycastle.pqc.legacy.math.linearalgebra.Vector.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a human readable form of this vector