|
Bouncy Castle Cryptography Library 1.81 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.bouncycastle.pqc.legacy.math.linearalgebra.Vector
org.bouncycastle.pqc.legacy.math.linearalgebra.GF2Vector
This class implements the abstract class Vector for the case of vectors over the finite field GF(2). For the vector representation the array of type int[] is used, thus one element of the array holds 32 elements of the vector.
Vector| Field Summary |
| Fields inherited from class org.bouncycastle.pqc.legacy.math.linearalgebra.Vector |
length |
| Constructor Summary | |
|
GF2Vector(GF2Vector other)
Copy constructor. |
|
GF2Vector(int length)
Construct the zero vector of the given length. |
protected |
GF2Vector(int[] v,
int length)
Construct a new GF2Vector of the given length and with the given
element array. |
|
GF2Vector(int length,
int[] v)
Construct a GF2Vector of the given length and with elements from the given array. |
|
GF2Vector(int length,
int t,
java.security.SecureRandom sr)
Construct a random GF2Vector of the given length with the specified number of non-zero coefficients. |
|
GF2Vector(int length,
java.security.SecureRandom sr)
Construct a random GF2Vector of the given length. |
| Method Summary | |
Vector |
add(Vector other)
Adds another GF2Vector to this vector. |
boolean |
equals(java.lang.Object other)
Check if the given object is equal to this vector. |
GF2Vector |
extractLeftVector(int k)
Return a new vector consisting of the first k elements of this vector. |
GF2Vector |
extractRightVector(int k)
Return a new vector consisting of the last k elements of this vector. |
GF2Vector |
extractVector(int[] setJ)
Return a new vector consisting of the elements of this vector with the indices given by the set setJ. |
int |
getBit(int index)
Return the value of the bit of this vector at the specified index. |
byte[] |
getEncoded()
Encode this vector as byte array. |
int |
getHammingWeight()
Return the Hamming weight of this vector, i.e., compute the number of units of this vector. |
int[] |
getVecArray()
|
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. |
static GF2Vector |
OS2VP(int length,
byte[] encVec)
Construct a new GF2Vector with the given length out of the encoded vector. |
void |
setBit(int index)
Set the coefficient at the given index to 1. |
GF2mVector |
toExtensionFieldVector(GF2mField field)
Rewrite this vector as a vector over GF(2 m) with t elements. |
java.lang.String |
toString()
|
| Methods inherited from class org.bouncycastle.pqc.legacy.math.linearalgebra.Vector |
getLength |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public GF2Vector(int length)
length - the length of the vector
public GF2Vector(int length,
java.security.SecureRandom sr)
length - the length of the vectorsr - the source of randomness
public GF2Vector(int length,
int t,
java.security.SecureRandom sr)
length - the length of the vectort - the number of non-zero coefficientssr - the source of randomness
public GF2Vector(int length,
int[] v)
length - the length of the vectorv - the element arraypublic GF2Vector(GF2Vector other)
other - another GF2Vector
protected GF2Vector(int[] v,
int length)
GF2Vector of the given length and with the given
element array. The array is not changed and only a reference to the array
is stored. No length checking is performed either.
v - the element arraylength - the length of the vector| Method Detail |
public static GF2Vector OS2VP(int length,
byte[] encVec)
length - the length of the vectorencVec - the encoded vector
public byte[] getEncoded()
getEncoded in class Vectorpublic int[] getVecArray()
public int getHammingWeight()
public boolean isZero()
Vector
isZero in class Vectorpublic int getBit(int index)
index - the index
public void setBit(int index)
index - the index of the coefficient to setpublic Vector add(Vector other)
add in class Vectorother - another GF2Vector
java.lang.ArithmeticException - if the other vector is not a GF2Vector or has another
length.public Vector multiply(Permutation p)
multiply in class Vectorp - the permutation
public GF2Vector extractVector(int[] setJ)
setJ - the set of indices of elements to extract
GF2Vector
[this_setJ[0], this_setJ[1], [], this_setJ[#setJ-1]]public GF2Vector extractLeftVector(int k)
k - the number of elements to extract
GF2Vector consisting of the first k
elements of this vectorpublic GF2Vector extractRightVector(int k)
k - the number of elements to extract
GF2Vector consisting of the last k
elements of this vectorpublic GF2mVector toExtensionFieldVector(GF2mField field)
field - the finite field GF(2 m)
public boolean equals(java.lang.Object other)
equals in class Vectorother - vector
public int hashCode()
hashCode in class Vectorpublic java.lang.String toString()
toString in class Vector
|
Bouncy Castle Cryptography Library 1.81 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||