    Next: Matrices and Matrix Operations Up: Matrices and Vectors Previous: Matrices and Vectors   Contents

## Vectors and Vector Operations

We can define a vector as a set of elements in the same finite field. In the LinearCodes package this means that all vector data types will hold elements declared as FieldElems. We can add vectors as follows: = We can scalar multiply by as: For further information concerning vector spaces over finite fields, consult my Spring 2004 report of same title. Vector Class Because a vector can be treated as a special kind of matrix, the vector class extends the matrix class. In the next section, the similarities between vectors and matrices will be more apparent. I wrote the vector class with an outline similar to the one I used for FieldElem and FPElem. The Vector class has two constructors. The first more fundamental constructor takes an integer argument, which sets the number of elements that given vector can hold. The second constructor makes it possible to cast a matrix as a vector by assuming that the argument matrix has only one column. The other methods in this class make it possible to change one specific element in the vector, find the number of elements in the vector, return the value of and element at a specific location, fill the vector with elements of zero value, and copy the vector. It is important to fill the vector with zero valued elements so that the vector does not contain valued elements, which can cause later complications. Below is a link to the java file for the Vector class. Vector.java VectorOps Class Like with the FieldElem class, it is important to have a static class that provides operations for the vector data type. My VectorOps class provides a few basic methods to add, multiply, and compare vectors. Like with FieldOps, the methods in VectorOps do not change their arguments. Below is a link to the java file for the VectorOps class. VectorOps.java    Next: Matrices and Matrix Operations Up: Matrices and Vectors Previous: Matrices and Vectors   Contents
Frederick Leitner 2004-09-01