Next: Linear Codes
Up: Matrices and Vectors
Previous: Vectors and Vector Operations
  Contents
Matrices can be defined as two-dimensional vectors. Visually, a
matrix is a block of data with a given number of rows and columns.
Each spot in the matrix can hold a data element. As such, addition
and multiplication of matrices is similar to that of vectors.
We can add matrices as follows:
=
We can multiply matrices as follows, make a note that the columns of the first matrix must match the rows of the second:
=
Scalar multiplication of matrices is the same as with vectors, where
each element of the matrix is multiplied by a given
scalar,
.
Matrix Class
The Matrix Class is a super class of Vector. This means that all of
the methods in Matrix are also in Vector. The only large difference
in these classes is that Matrix only has one constructor, which sets
the number of rows and columns in the matrix.
Below is a link to the java file for the Matrix class.
Matrix.java
MatrixOps Class
The MatrixOps class is much more complicated than the VectorOps
class. MatrixOps contains most of the regular operations that can be
preformed on matrices in linear algebra. Of particular importance
are the methods that put a given matrix in row echelon or reduced
row echelon form. These methods are necessary for implementing the
linear codes discussed later. Also the MatrixOps class is a little
different then the other operations classes because several of its
methods alter the matrix argument that is passed to the method
instead of returning a new matrix.
Below is a link to the java file for the MatrixOps class.
MatrixOps.java
Next: Linear Codes
Up: Matrices and Vectors
Previous: Vectors and Vector Operations
  Contents
Frederick Leitner
2004-09-01