applicationlayer.linearalgebra
Class CMatrix

java.lang.Object
  extended by applicationlayer.linearalgebra.AbstractMatrix
      extended by applicationlayer.linearalgebra.CMatrix

public class CMatrix
extends AbstractMatrix

Matice s prvky typu CFloat.


Field Summary
 
Fields inherited from class applicationlayer.linearalgebra.AbstractMatrix
column, CRAMERS_RULE, GAUSS_ELIMINATION, GAUSS_JORDAN, GAUSS_PARTIAL_PIVOT, INVERSION, precision, row
 
Constructor Summary
CMatrix(AbstractMatrix matrix)
          Vytvoří kopie z dané matice.
CMatrix(CFloat[][] data)
          Vytvoří novou matici s danými prvky.
CMatrix(int row, int column)
          Vytvoří prázdnou matici velikosti row×column.
CMatrix(java.lang.String matrix)
          Vytvoří matici z textového řetězce.
 
Method Summary
 AbstractMatrix add(AbstractMatrix operand)
          Vrací součet dvou matic (this + operand)
 java.lang.Object cond()
          Vrací číslo podmíněnosti této matice.
 AbstractMatrix cramersRule(AbstractMatrix a, AbstractMatrix b)
          Řeší soustavu rovnic s cramerovým pravidem.
 java.lang.Object determinant()
          Vrácí determinant této matice.
 CFloat determinantSarrus()
          Vrací determinant této matice pomocí Sarrusovovým pravidlem
 AbstractMatrix gaussElimination()
          Vrací tuto matici upravenou Gaussovou eliminací.
 AbstractMatrix gaussJordan()
          Vrací tuto matici upravenou Gauss-Jordanovou eliminací.
 AbstractMatrix gaussPartial()
          Vrací tuto matici upravenou Gaussovou eliminací s parciální pivotací.
static CMatrix identityMatrix(int row)
          Vrací jednotkovou matici velikosti row×row.
 AbstractMatrix inverse()
          Vrácí inverzní matici - metoda Gaussova eliminační
 AbstractMatrix joinMatrix(AbstractMatrix operand)
          Vrací matici (this + operand).
 AbstractMatrix multiply(AbstractMatrix operand)
          Vrací součin dvou matic (this * operand)
 java.lang.Object normCol()
          Sloupcová norma.
 java.lang.Object normRow()
          Řádková norma.
static CMatrix oneMatrix(int row, int column)
          Vrací jedničkovou matici velikosti row×column.
static void setPrecision(int precision)
          Nastaví přesnost prvků matice.
 AbstractMatrix solve(AbstractMatrix a, AbstractMatrix b, int method)
          Řeší soustavu rovnic s danou metodou.
 AbstractMatrix subtract(AbstractMatrix operand)
          Vrací rozdíl dvou matic (this - operand).
protected  void swap(int index1, int index2)
          Prohodí dva řádky.
 java.lang.String toString()
          Vrácí řetězcovou reprezentaci této matice
 AbstractMatrix transpose()
          Vrací transpanovanou matici.
static CMatrix zeroMatrix(int row, int column)
          Vrací nulovou matici velikosti row×column.
 
Methods inherited from class applicationlayer.linearalgebra.AbstractMatrix
getColumn, getRow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CMatrix

public CMatrix(java.lang.String matrix)
Vytvoří matici z textového řetězce. Oddělovač řádků je nový řádek "\n" a jednotlivé prvky v jednom řádku se oddělují mezerou.

Parameters:
matrix - textový řetězec reprezentující prvky matice.

CMatrix

public CMatrix(CFloat[][] data)
Vytvoří novou matici s danými prvky.

Parameters:
data - pole CFloat, která obsahuje prvky matice.

CMatrix

public CMatrix(int row,
               int column)
Vytvoří prázdnou matici velikosti row×column.

Parameters:
row - počet řádků
column - počet sloupců

CMatrix

public CMatrix(AbstractMatrix matrix)
Vytvoří kopie z dané matice.

Parameters:
matrix - instance, ze které má být vytvořena kopie
Method Detail

identityMatrix

public static CMatrix identityMatrix(int row)
Vrací jednotkovou matici velikosti row×row.

Parameters:
row - počet sloupců a rádků
Returns:
jednotková matice

oneMatrix

public static CMatrix oneMatrix(int row,
                                int column)
Vrací jedničkovou matici velikosti row×column.

Parameters:
row - počet řádků
column - počet sloupců
Returns:
jedničková matice

zeroMatrix

public static CMatrix zeroMatrix(int row,
                                 int column)
Vrací nulovou matici velikosti row×column.

Parameters:
row - počet řádků
column - počet sloupců
Returns:
nulová matice

swap

protected void swap(int index1,
                    int index2)
Prohodí dva řádky.

Parameters:
index1 - první řádek
index2 - druhý řádek

joinMatrix

public AbstractMatrix joinMatrix(AbstractMatrix operand)
Description copied from class: AbstractMatrix
Vrací matici (this + operand).

Specified by:
joinMatrix in class AbstractMatrix
Parameters:
operand - matice, která má být spojena k této matici
Returns:
matice s hodnoty součtu této matice s maticí v parametru ()

add

public AbstractMatrix add(AbstractMatrix operand)
Description copied from class: AbstractMatrix
Vrací součet dvou matic (this + operand)

Specified by:
add in class AbstractMatrix
Parameters:
operand - matice, která má být přičtena k této matici
Returns:
(this + operand)

subtract

public AbstractMatrix subtract(AbstractMatrix operand)
Description copied from class: AbstractMatrix
Vrací rozdíl dvou matic (this - operand).

Specified by:
subtract in class AbstractMatrix
Parameters:
operand - matice, která má být odečtena od této matici
Returns:
(this - operand)

multiply

public AbstractMatrix multiply(AbstractMatrix operand)
Description copied from class: AbstractMatrix
Vrací součin dvou matic (this * operand)

Specified by:
multiply in class AbstractMatrix
Parameters:
operand - matice, která má být násobena touto maticí
Returns:
(this * operand)

cond

public java.lang.Object cond()
Description copied from class: AbstractMatrix
Vrací číslo podmíněnosti této matice.

Specified by:
cond in class AbstractMatrix
Returns:
číslo podmíněnosti

normCol

public java.lang.Object normCol()
Description copied from class: AbstractMatrix
Sloupcová norma.

Specified by:
normCol in class AbstractMatrix
Returns:
maximální součet ve sloupcích

normRow

public java.lang.Object normRow()
Description copied from class: AbstractMatrix
Řádková norma.

Specified by:
normRow in class AbstractMatrix
Returns:
maximální součet v řádcích

determinant

public java.lang.Object determinant()
Description copied from class: AbstractMatrix
Vrácí determinant této matice.

Specified by:
determinant in class AbstractMatrix
Returns:
determinant této matice

inverse

public AbstractMatrix inverse()
Description copied from class: AbstractMatrix
Vrácí inverzní matici - metoda Gaussova eliminační

Specified by:
inverse in class AbstractMatrix
Returns:
nová matice s hodnoty inverze této matice

transpose

public AbstractMatrix transpose()
Description copied from class: AbstractMatrix
Vrací transpanovanou matici.

Specified by:
transpose in class AbstractMatrix
Returns:
nová matice s transpanovanými hodnotami této matice

determinantSarrus

public CFloat determinantSarrus()
Vrací determinant této matice pomocí Sarrusovovým pravidlem

Returns:
determinant této matice

gaussJordan

public AbstractMatrix gaussJordan()
Description copied from class: AbstractMatrix
Vrací tuto matici upravenou Gauss-Jordanovou eliminací.

Specified by:
gaussJordan in class AbstractMatrix
Returns:
diagonální tvar této matice (this)

gaussPartial

public AbstractMatrix gaussPartial()
Description copied from class: AbstractMatrix
Vrací tuto matici upravenou Gaussovou eliminací s parciální pivotací.

Specified by:
gaussPartial in class AbstractMatrix
Returns:
horní trojuhelníkový tvar(this)

gaussElimination

public AbstractMatrix gaussElimination()
Description copied from class: AbstractMatrix
Vrací tuto matici upravenou Gaussovou eliminací.

Specified by:
gaussElimination in class AbstractMatrix
Returns:
horní trojuhelnikový tvar (this)

cramersRule

public AbstractMatrix cramersRule(AbstractMatrix a,
                                  AbstractMatrix b)
Description copied from class: AbstractMatrix
Řeší soustavu rovnic s cramerovým pravidem.

Specified by:
cramersRule in class AbstractMatrix
Parameters:
a - matice soustavy
b - pravá strana soustavy
Returns:
výsledek soustavy

solve

public AbstractMatrix solve(AbstractMatrix a,
                            AbstractMatrix b,
                            int method)
Description copied from class: AbstractMatrix
Řeší soustavu rovnic s danou metodou.

Specified by:
solve in class AbstractMatrix
Parameters:
a - matice soustavy
b - pravá strana soustavy
method - metoda, která má být použita při výpočtu řešení soustavy rovnic.
Returns:
výsledek soustavy

setPrecision

public static void setPrecision(int precision)
Nastaví přesnost prvků matice.

Parameters:
precision - nová přesnost, která má být nastavena

toString

public java.lang.String toString()
Vrácí řetězcovou reprezentaci této matice

Overrides:
toString in class java.lang.Object
Returns:
řetězec reprezentující tuto matici