Class SquareRootMatrix

java.lang.Object
  extended by SquareRootMatrix

 class SquareRootMatrix
extends Object

This class introduces matrices of square roots of fractions (SquareRootFraction or SRF). It also features basic necessary operations with them.

Since:
2014-04-01
Version:
1.0
Author:
Pavel Sikora

Constructor Summary
SquareRootMatrix()
          Constructs a null matrix of dimension 0.
SquareRootMatrix(Fraction[] M, int r, int c)
          Constructs a matrix from a field of Fractions.
SquareRootMatrix(int r, int c)
          Constructs a zero matrix of given dimensions.
 
Method Summary
(package private)  void copy(SquareRootMatrix I)
          Copies another matrix onto this matrix.
(package private)  SquareRootFraction 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)  int getR()
          Number of rows of this Matrix.
(package private)  void set(SquareRootFraction F, int r, int c)
          The setter of this class - sets given element ar,c to a given value.
(package private)  Jama.Matrix toRealMatrix()
          Converts all elements to real numbers.
(package private)  String toTeX()
          Prints this matrix formatted as TeX code.
(package private)  String toText()
          Prints this matrix formatted as text.
 
Methods inherited from class
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SquareRootMatrix

SquareRootMatrix()
Constructs a null matrix of dimension 0.


SquareRootMatrix

SquareRootMatrix(Fraction[] M,
                 int r,
                 int c)
Constructs a matrix from a field of Fractions. The Fractions will be converted to SquareRootFractions without changing their value (ie. the root will not be extracted).

Parameters:
M - field of Fractions, containing the matrix's elements
r - number of matrix's rows
c - number of matrix's columns

SquareRootMatrix

SquareRootMatrix(int r,
                 int c)
Constructs a zero matrix of given dimensions.

Parameters:
r - number of matrix's rows
c - number of matrix's columns
Method Detail

copy

void copy(SquareRootMatrix I)
Copies another matrix onto this matrix. This is the correct way of assigning matrices, not by =.

Parameters:
I - the image matrix

get

SquareRootFraction get(int r,
                       int c)
The getter of this class - returns the value of a given element ar,c.

Parameters:
r - the row index of the desired element
c - the column index of the desired element
Returns:
the value (a SquareRootFraction) of the element on the rth row and the cth column
Throws:
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>.

getC

int getC()
Number of columns of this Matrix.

Returns:
a number of columns

getR

int getR()
Number of rows of this Matrix.

Returns:
a number of rows

set

void set(SquareRootFraction F,
         int r,
         int c)
The setter of this class - sets given element ar,c to a given value.

Parameters:
F - the desired value (a SquareRootFraction) of the element on the rth row and the cth column
r - the row index of the desired element
c - the column index of the desired element
Throws:
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>.

toRealMatrix

Jama.Matrix toRealMatrix()
Converts all elements to real numbers.

Returns:
the copy of this matrix with elements represented as real numbers (double) instead SquareRootFractions

toTeX

String toTeX()
Prints this matrix formatted as TeX code.

Returns:
TeX code for this matrix

toText

String toText()
Prints this matrix formatted as text.

Returns:
plain text description of this matrix; the rows will begin with ( and end with ).