Package matrix
Class ProfileMatrix
java.lang.Object
matrix.ProfileMatrix
public class ProfileMatrix
extends java.lang.Object
Class Class of ProfileMatrix realisation
-
Field Summary
Fields Modifier and Type Field Description double[]alprofile rows of lower triangleprivate double[]auprofile columns of upper triangleprivate double[]dmatrix diagonalint[]iaindex array for al, au(package private) booleanisLUis matrix LU decompositionedprivate static java.lang.String[]NAME_OF_FILESSet of files for reading and setting ProfileMatrix. -
Constructor Summary
Constructors Constructor Description ProfileMatrix(java.lang.String pathOfMatrix)Constructor for ProfileMatrix, that readsreadFromPath(String)it from directory.ProfileMatrix(java.lang.String pathOfMatrix, boolean isLU)Constructor for ProfileMatrix, that readsreadFromPath(String)it from directory. -
Method Summary
Modifier and Type Method Description private voidassertLU()Asserting that matrix is LU.voidchangeToLU()Decomposition of a matrix into LUdoublegetHighTriangle(int i, int j)Getter for specified element from upper triangledoublegetIJ(int i, int j)Getter for specified element.private doublegetIJWithoutException(int i, int j)Getter for specified element.doublegetL(int i, int j)Getter for specified element from L matrix (A = LU)doublegetLowTriangle(int i, int j)Getter for specified element from lower triangledoublegetU(int i, int j)Getter for specified element from U matrix (A = LU)private doubleprofileGet(int i, int j, double[] profile)Getter for specified element from specified profileprivate voidreadFromPath(java.lang.String pathOfMatrix)Reading Matrix from directory.voidsetL(int i, int j, double value)Setter of specified element in Lprivate voidsetProfile(int i, int j, double value, double[] profile)Setter of specified profile element for specified profilevoidsetU(int i, int j, double value)Setter of specified element in UvoidshowByGetters()Writing matrix in "square" format to System.outvoidshowL()Writing L part os Matrix in "square" format to System.outvoidshowU()Writing U part os Matrix in "square" format to System.outintsize()Getter of matrix dimension.java.lang.StringtoString()
-
Field Details
-
al
public double[] alprofile rows of lower triangle -
au
private double[] auprofile columns of upper triangle -
d
private double[] dmatrix diagonal -
ia
public int[] iaindex array for al, au -
isLU
boolean isLUis matrix LU decompositioned -
NAME_OF_FILES
private static final java.lang.String[] NAME_OF_FILESSet of files for reading and setting ProfileMatrix.
-
-
Constructor Details
-
ProfileMatrix
public ProfileMatrix(java.lang.String pathOfMatrix)Constructor for ProfileMatrix, that readsreadFromPath(String)it from directory.- Parameters:
pathOfMatrix- - path to directory, that contains files for matrix
-
ProfileMatrix
public ProfileMatrix(java.lang.String pathOfMatrix, boolean isLU)Constructor for ProfileMatrix, that readsreadFromPath(String)it from directory. Can specify that matrix is already LU decompositioned- Parameters:
pathOfMatrix- - path to directory, that contains files for matrixisLU- - is matrix already LU
-
-
Method Details
-
readFromPath
private void readFromPath(java.lang.String pathOfMatrix)Reading Matrix from directory. Using following files: au.txt, al.txt, ia.txt, d.txt.- Parameters:
pathOfMatrix- - path to directory, that contains files for matrix- See Also:
MatrixGenerator
-
getIJ
public double getIJ(int i, int j)Getter for specified element. Works before LU decomposition- Parameters:
i- - rowj- - column- Returns:
- - value of ij element
-
getIJWithoutException
private double getIJWithoutException(int i, int j)Getter for specified element.- Parameters:
i- - rowj- - column- Returns:
- - value of ij element
-
size
public int size()Getter of matrix dimension.- Returns:
- - size of diagonal(=dimension)
-
profileGet
private double profileGet(int i, int j, double[] profile)Getter for specified element from specified profile- Parameters:
i- - row if match to upper trianglej- - column if match to upper triangleprofile- - upper or lower a- Returns:
- - value of ij element of a
-
getLowTriangle
public double getLowTriangle(int i, int j)Getter for specified element from lower triangle- Parameters:
i- - rowj- - column- Returns:
- - value of ij element from lower triangle
-
getHighTriangle
public double getHighTriangle(int i, int j)Getter for specified element from upper triangle- Parameters:
i- - rowj- - column- Returns:
- - value of ij element from upper triangle
-
assertLU
private void assertLU()Asserting that matrix is LU. -
getL
public double getL(int i, int j)Getter for specified element from L matrix (A = LU)- Parameters:
i- - rowj- - column- Returns:
- - value of ij element from L
-
getU
public double getU(int i, int j)Getter for specified element from U matrix (A = LU)- Parameters:
i- - rowj- - column- Returns:
- - value of ij element from U
-
setProfile
private void setProfile(int i, int j, double value, double[] profile)Setter of specified profile element for specified profile- Parameters:
i- - row if matched to upper trianglej- - column if matched to upper trianglevalue- - setting valueprofile- - upper or lower a
-
setL
public void setL(int i, int j, double value)Setter of specified element in L- Parameters:
i- - rowj- - columnvalue- - setting value
-
setU
public void setU(int i, int j, double value)Setter of specified element in U- Parameters:
i- - rowj- - columnvalue- - setting value
-
changeToLU
public void changeToLU()Decomposition of a matrix into LU -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object- Returns:
- - string representation of matrix
-
showByGetters
public void showByGetters()Writing matrix in "square" format to System.out -
showL
public void showL()Writing L part os Matrix in "square" format to System.out -
showU
public void showU()Writing U part os Matrix in "square" format to System.out
-