|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.ObjectMatrix
class Matrix
This class introduces matrices and enables basic operations with them. The elements are stored as a field of Fractions.
| Constructor Summary | |
|---|---|
Matrix()
Constructs a null matrix of dimension 0. |
|
Matrix(Fraction[] M,
int r,
int c)
Constructs a matrix from a field of Fractions. |
|
Matrix(int n)
Constructs a rectangular identity matrix of a given dimension. |
|
Matrix(int r,
int c)
Constructs a zero matrix of given dimensions. |
|
| Method Summary | |
|---|---|
(package private) void |
addColumn(int toWhich,
int which,
Fraction coeff)
Adds a multiple of one column of this matrix to another column. |
(package private) void |
addRow(int toWhich,
int which,
Fraction coeff)
Adds a multiple of one row of this matrix to another row. |
(package private) void |
copy(Matrix I)
Copies another matrix onto this matrix. |
(package private) Fraction |
det(String label,
boolean verbose)
Computes the determinant of this matrix. |
(package private) Fraction |
detGram(char label,
boolean verbose)
Computes Gram determinant of this matrix. |
(package private) Fraction |
get(int r,
int c)
The getter of this class - returns the value of a given element ar,c. |
(package private) int |
getC()
Number of columns of this Matrix. |
(package private) Matrix |
getConstTerms()
Crops the matrix of constant terms of equation system, ie. |
(package private) Matrix |
getEchelonForm()
Converts this matrix into its echelon form. |
(package private) Matrix |
getEchelonForm(boolean verbose)
Converts this matrix into its echelon form. |
(package private) Matrix |
getEchelonForm(char label,
int maxRank,
boolean verbose)
Converts this matrix into a semi-echelon form. |
(package private) Matrix |
getEchelonForm(int maxRank)
Converts this matrix into a semi-echelon form. |
(package private) int |
getR()
Number of rows of this Matrix. |
(package private) Matrix |
getSystemCoeffMatrix()
Crops the matrix of equation system coefficients, ie. |
(package private) SquareRootMatrix |
gramianMatrixForOutput(Matrix B)
Computes the Gramian matrix. |
(package private) SquareRootMatrix |
gramianMatrixProduct(Matrix B)
Computes product of Gramian matrix with its transposed self, ie. |
(package private) boolean |
isSolvable()
Checks the solvability of this matrix. |
(package private) boolean |
isSolvable(boolean verbose)
Checks the solvability of this matrix. |
(package private) void |
mergeFromBottom(Matrix N)
Merges another matrix to this matrix from bottom. |
(package private) void |
mergeFromRight(Matrix N)
Merges another matrix to this matrix from right. |
(package private) void |
multiplyColumn(int which,
Fraction coeff)
Multiplies a column of this matrix by a given coefficient. |
(package private) void |
multiplyRow(int which,
Fraction coeff)
Multiplies a row of this matrix by a given coefficient. |
(package private) Matrix |
orthogonalizeWithGramSchmidt()
Orthogonalizes sequence of vectors using the Gram-Schmidt orthogonalization process. |
(package private) int |
rank()
Rank of the matrix. |
(package private) int |
rank(boolean verbose)
Rank of the matrix. |
(package private) int |
rank(char label,
boolean verbose)
Rank of the matrix. |
(package private) Vector[] |
rowsToVectors()
Converts rows of this matrix into a field of vectors. |
(package private) void |
set(Fraction F,
int r,
int c)
The setter of this class - sets given element ar,c to a given value. |
(package private) Matrix |
solve()
Solves this matrix, or better converts it to a solved form. |
(package private) Matrix |
solve(char label,
boolean verbose)
Solves this matrix, or better converts it to a solved form. |
(package private) Matrix |
solve(char label,
boolean verbose,
boolean solveOnly)
Solves this matrix, or better converts it to a solved form. |
(package private) Matrix |
solveOnly(char label,
boolean verbose)
Solves this matrix, or better converts it to a solved form. |
(package private) Matrix |
submatrix(int rowStart,
int rowEnd,
int colStart,
int colEnd)
Crops a submatrix from this matrix. |
(package private) void |
swapColumns(int c1,
int c2)
Swaps two columns of this matrix. |
(package private) void |
swapRows(int r1,
int r2)
Swaps two rows of this matrix. |
(package private) String |
toTeX()
Prints this matrix formatted as TeX code. |
(package private) String |
toText()
Prints this matrix formatted as text. |
(package private) Matrix |
transpose()
Transposes this matrix. |
| Methods inherited from class |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
Matrix()
Matrix(Fraction[] M,
int r,
int c)
Fractions.
M - field of Fractions, containing the matrix's elementsr - number of matrix's rowsc - number of matrix's columnsMatrix(int n)
n - the dimension of the matrix, ie. number of its rows and columns
Matrix(int r,
int c)
r - number of matrix's rowsc - number of matrix's columns| Method Detail |
|---|
void addColumn(int toWhich,
int which,
Fraction coeff)
toWhich - the column which the other column is added towhich - the column which is added to the other columncoeff - the coefficient by which the added column is multiplied before it is added
void addRow(int toWhich,
int which,
Fraction coeff)
toWhich - the row which the other row is added towhich - the row which is added to the other rowcoeff - the coefficient by which the added row is multiplied before it is addedvoid copy(Matrix I)
=.
I - the image matrix
NullPointerException - Throws an exception if the image matrix has never been initiated.
Fraction det(String label,
boolean verbose)
label - label of the matrixverbose - determines, if the method “talks” (creates any text and TeX output)
UnsupportedOperationException - Throws an exception if the matrix is not rectangular.
UnsupportedOperationException - Throws an exception if the matrix is a null matrix.
Fraction detGram(char label,
boolean verbose)
verbose - determines, if the method “talks” (creates any text and TeX output)
Fraction get(int r,
int c)
r - the row index of the desired elementc - the column index of the desired element
Fraction) of the element on the rth row and the cth column
IndexOutOfBoundsException - Throws an exception if the row index isn't of <1,number of rows>.
IndexOutOfBoundsException - Throws an exception if the column index isn't of <1,number of columns>.int getC()
Matrix getConstTerms()
IllegalArgumentException - Throws an exception if the matrices has less than two columns, and therefore isn't a matrix of any equation system.Matrix getEchelonForm()
Matrix getEchelonForm(boolean verbose)
verbose - determines, if the method “talks” (creates any text and TeX output)
Matrix getEchelonForm(char label,
int maxRank,
boolean verbose)
label - label of the matrixmaxRank - the number of columns we want to have in echelon formverbose - determines, if the method “talks” (creates any text and TeX output)
maxRank columns in echelon form (ie. every row begins with more leading zeroes than its predecessor)Matrix getEchelonForm(int maxRank)
maxRank - the number of columns we want to have in echelon form
int getR()
Matrix getSystemCoeffMatrix()
IllegalArgumentException - Throws an exception if the matrices has less than two columns, and therefore isn't a matrix of any equation system.SquareRootMatrix gramianMatrixForOutput(Matrix B)
gramianMatrixProduct(Matrix B)) but is output as a text.
The input format is the same as in gramianMatrixProduct(Matrix B).)
B - the other matrix
UnsupportedOperationException - Throws an exception, if the matrices have different number of columns, ie. the dimensions of vectors are not equal.SquareRootMatrix gramianMatrixProduct(Matrix B)
B - the other matrix
UnsupportedOperationException - Throws an exception, if the matrices have different number of columns, ie. the dimensions of vectors are not equal.gramianMatrixForOutput(Matrix B)boolean isSolvable()
boolean isSolvable(boolean verbose)
verbose - determines, if the method “talks” (creates any text and TeX output)
void mergeFromBottom(Matrix N)
N - the matrix to be merged from bottom
UnsupportedOperationException - Throws an exception if the matrices don't have the same number of columns.void mergeFromRight(Matrix N)
N - the matrix to be merged from right
UnsupportedOperationException - Throws an exception if the matrices don't have the same number of rows.
void multiplyColumn(int which,
Fraction coeff)
which - the column to be multipliedcoeff - the coefficient by which the column is multiplied
void multiplyRow(int which,
Fraction coeff)
which - the row to be multipliedcoeff - the coefficient by which the row is multipliedMatrix orthogonalizeWithGramSchmidt()
int rank()
int rank(boolean verbose)
verbose - determines, if the method “talks” (creates any text and TeX output)
int rank(char label,
boolean verbose)
verbose - determines, if the method “talks” (creates any text and TeX output)
Vector[] rowsToVectors()
new Vector[0] will be returned)
void set(Fraction F,
int r,
int c)
F - the desired value (a Fraction) of the element on the rth row and the cth columnr - the row index of the desired elementc - the column index of the desired element
IndexOutOfBoundsException - Throws an exception if the row index isn't of <1,number of rows>.
IndexOutOfBoundsException - Throws an exception if the column index isn't of <1,number of columns>.Matrix solve()
UnsupportedOperationException - Throws an exception if the matrix is not solvable.
Matrix solve(char label,
boolean verbose)
verbose - determines, if the method “talks” (creates any text and TeX output); if it does, it prints full output
UnsupportedOperationException - Throws an exception if the matrix is not solvable.
Matrix solve(char label,
boolean verbose,
boolean solveOnly)
verbose - determines, if the method “talks” (creates any text and TeX output)solveOnly - determines, if the method prints only the solving stage without preparations or full solution
UnsupportedOperationException - Throws an exception if the matrix is not solvable.
Matrix solveOnly(char label,
boolean verbose)
verbose - determines, if the method “talks” (creates any text and TeX output); if it does, it prints only the solving stage without preparations
UnsupportedOperationException - Throws an exception if the matrix is not solvable.
Matrix submatrix(int rowStart,
int rowEnd,
int colStart,
int colEnd)
rowStart - the initial row of the submatrix (its row index in the original matrix)rowEnd - the terminal row of the submatrix (its row index in the original matrix)colStart - the initial column of the submatrix (its column index in the original matrix)colEnd - the terminal column of the submatrix (its column index in the original matrix)
UnsupportedOperationException - Throws an exception if the index of initial row (or column) is larger than the index of terminal row (or column).
UnsupportedOperationException - Throws an exception if the row indices aren't of <1,number of rows>.
UnsupportedOperationException - Throws an exception if the column indices aren't of <1,number of columns>.
void swapColumns(int c1,
int c2)
c1 - the first swapped columnc2 - the other swapped column
void swapRows(int r1,
int r2)
r1 - the first swapped rowr2 - the other swapped rowString toTeX()
String toText()
( and end with ).Matrix transpose()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||