figure.matrix
クラス SparseMatrixSolver

java.lang.Object
  上位を拡張 figure.AbstractMatrix
      上位を拡張 figure.SparseMatrix
          上位を拡張 figure.matrix.SparseMatrixSolver
すべての実装されたインタフェース:
Matrix, MatrixSolver, java.lang.Cloneable

public class SparseMatrixSolver
extends SparseMatrix
implements MatrixSolver

連立方程式の解を求めるための疎行列クラス


入れ子のクラスの概要
 
クラス figure.SparseMatrix から継承された入れ子のクラス/インタフェース
SparseMatrix.Data, SparseMatrix.RowData
 
フィールドの概要
 
クラス figure.SparseMatrix から継承されたフィールド
columnCount, rowCount, rowdata
 
クラス figure.AbstractMatrix から継承されたフィールド
dataMax, TOLERANCE
 
コンストラクタの概要
SparseMatrixSolver(int size)
          正方行列を構築する
 
メソッドの概要
 MatrixSolver extruct(int size, int[] rows, int[] columns)
          指定した行・列を取り出した行列を返す
 Matrix extructRowColumn(int size, int[] rows, int[] columns)
          指定した行・列を取り出した行列を返す
 Matrix getILU(double tolerance)
          不完全 LU 分解をする
 Matrix getLU(double tolerance)
          LU 分解をする
 MatrixSolver inverse()
          逆行列を求める
static MatrixSolver inverse(SparseMatrix lu, double tolerance)
          LU 分解法で逆行列を求める
 Vector solve(Vector p, MatrixSolveMethod method)
          連立方程式の解を求める
 Vector solveByCG(Vector p, double tolerance)
          共役勾配法で連立方程式の解を求める
 Vector solveByCG(Vector p, double tolerance, int iterMax)
          共役勾配法で連立方程式の解を求める
 Vector solveByGauss(Vector p, double tolerance)
          ガウス消去法で連立方程式の解を求める
 Vector solveByGaussJordan(Vector p, double tolerance)
          Gauss - Jordan 法で連立方程式の解を求める
 Vector solveByILUCG(SparseMatrix lu, Vector p, double tolerance, int iterMax)
          不完全 LU 分解共役勾配法で連立方程式の解を求める
 Vector solveByILUCG(Vector p, double tolerance)
          不完全 LU 分解共役勾配法で連立方程式の解を求める
 Vector solveByILUCG(Vector p, double tolerance, int iterMax)
          不完全 LU 分解共役勾配法で連立方程式の解を求める
static Vector solveByLU(SparseMatrix lu, Vector p, double tolerance)
          LU 分解法で連立方程式の解を求める
 Vector solveByLU(Vector p, double tolerance)
          LU 分解法で連立方程式の解を求める
 Vector solveByLUNoPreserv(Vector p, double tolerance)
          LU 分解法で連立方程式の解を求める
元の行列は保持しない
 Vector solveBySOR(Vector p, double tolerance, int iterMax, double relax)
          SOR 法で連立方程式の解を求める
 
クラス figure.SparseMatrix から継承されたメソッド
add, add, clone, columnCount, columnCount, eliminateRowColumn, get, getData, getDiagonal, getDiagonalColumn, getNonZeroCount, getRowData, init, mul, mul, mul, rowCount, set, setRowData, transposition, unitMatrix
 
クラス figure.AbstractMatrix から継承されたメソッド
checkRange, determinant, equals, getColumnVector, getColumnVectors, getRowVector, getRowVectors, hashCode, isSymmetry, toString, toStrings, trace
 
クラス java.lang.Object から継承されたメソッド
finalize, getClass, notify, notifyAll, wait, wait, wait
 
インタフェース figure.Matrix から継承されたメソッド
add, add, clone, columnCount, determinant, eliminateRowColumn, get, getColumnVector, getColumnVectors, getRowVector, getRowVectors, init, isSymmetry, mul, rowCount, set, toStrings, trace, transposition
 

コンストラクタの詳細

SparseMatrixSolver

public SparseMatrixSolver(int size)
正方行列を構築する

パラメータ:
size - 行列の大きさ
メソッドの詳細

extructRowColumn

public Matrix extructRowColumn(int size,
                               int[] rows,
                               int[] columns)
指定した行・列を取り出した行列を返す

定義:
インタフェース Matrix 内の extructRowColumn
オーバーライド:
クラス SparseMatrix 内の extructRowColumn
パラメータ:
size - 正方行列の大きさ
rows - 行のインデックスを格納した配列
columns - 列のインデックスを格納した配列
戻り値:
この行列から指定された行・列を取り出した行列

extruct

public MatrixSolver extruct(int size,
                            int[] rows,
                            int[] columns)
指定した行・列を取り出した行列を返す

定義:
インタフェース MatrixSolver 内の extruct
パラメータ:
size - 正方行列の大きさ
rows - 行のインデックスを格納した配列
columns - 列のインデックスを格納した配列
戻り値:
この行列から指定された行・列を取り出した行列

solve

public Vector solve(Vector p,
                    MatrixSolveMethod method)
             throws MatrixSolveException
連立方程式の解を求める

定義:
インタフェース MatrixSolver 内の solve
パラメータ:
p - ベクトル p
method - 行列解法
戻り値:
連立方程式の解を表すベクトル
例外:
MatrixSolveException - 連立方程式の解が求まらないとき

solveByGauss

public Vector solveByGauss(Vector p,
                           double tolerance)
                    throws MatrixSolveException
ガウス消去法で連立方程式の解を求める

定義:
インタフェース MatrixSolver 内の solveByGauss
パラメータ:
p - ベクトル p
tolerance - 閾値
戻り値:
連立方程式の解を表すベクトル
例外:
MatrixSolveException - 連立方程式の解が求まらないとき

solveByGaussJordan

public Vector solveByGaussJordan(Vector p,
                                 double tolerance)
                          throws MatrixSolveException
Gauss - Jordan 法で連立方程式の解を求める

定義:
インタフェース MatrixSolver 内の solveByGaussJordan
パラメータ:
p - ベクトル p
tolerance - 閾値
戻り値:
連立方程式の解を表すベクトル
例外:
MatrixSolveException - 連立方程式の解が求まらないとき

getLU

public Matrix getLU(double tolerance)
             throws MatrixSolveException
LU 分解をする

定義:
インタフェース MatrixSolver 内の getLU
パラメータ:
tolerance - 閾値
戻り値:
この行列を LU 分解した行列
例外:
MatrixSolveException - LU 分解ができないとき

solveByLU

public static Vector solveByLU(SparseMatrix lu,
                               Vector p,
                               double tolerance)
                        throws MatrixSolveException
LU 分解法で連立方程式の解を求める

パラメータ:
lu - LU 分解された行列
p - ベクトル p
tolerance - 閾値
戻り値:
連立方程式の解を表すベクトル
例外:
MatrixSolveException - 連立方程式の解が求まらないとき

solveByLU

public Vector solveByLU(Vector p,
                        double tolerance)
                 throws MatrixSolveException
LU 分解法で連立方程式の解を求める

定義:
インタフェース MatrixSolver 内の solveByLU
パラメータ:
p - ベクトル p
tolerance - 閾値
戻り値:
連立方程式の解を表すベクトル
例外:
MatrixSolveException - 連立方程式の解が求まらないとき

solveByLUNoPreserv

public Vector solveByLUNoPreserv(Vector p,
                                 double tolerance)
                          throws MatrixSolveException
LU 分解法で連立方程式の解を求める
元の行列は保持しない

パラメータ:
p - ベクトル p
tolerance - 閾値
戻り値:
連立方程式の解を表すベクトル
例外:
MatrixSolveException - 連立方程式の解が求まらないとき

solveBySOR

public Vector solveBySOR(Vector p,
                         double tolerance,
                         int iterMax,
                         double relax)
                  throws MatrixSolveException
SOR 法で連立方程式の解を求める

定義:
インタフェース MatrixSolver 内の solveBySOR
パラメータ:
p - ベクトル p
tolerance - 閾値
iterMax - 反復回数の上限
relax - 緩和係数
戻り値:
連立方程式の解を表すベクトル
例外:
MatrixSolveException - 連立方程式の解が求まらないとき

solveByCG

public Vector solveByCG(Vector p,
                        double tolerance)
                 throws MatrixSolveException
共役勾配法で連立方程式の解を求める

定義:
インタフェース MatrixSolver 内の solveByCG
パラメータ:
p - ベクトル p
tolerance - 閾値
戻り値:
連立方程式の解を表すベクトル
例外:
MatrixSolveException - 連立方程式の解が求まらないとき

solveByCG

public Vector solveByCG(Vector p,
                        double tolerance,
                        int iterMax)
                 throws MatrixSolveException
共役勾配法で連立方程式の解を求める

定義:
インタフェース MatrixSolver 内の solveByCG
パラメータ:
p - ベクトル p
tolerance - 閾値
iterMax - 反復回数の上限
戻り値:
連立方程式の解を表すベクトル
例外:
MatrixSolveException - 連立方程式の解が求まらないとき

solveByILUCG

public Vector solveByILUCG(Vector p,
                           double tolerance)
                    throws MatrixSolveException
不完全 LU 分解共役勾配法で連立方程式の解を求める

定義:
インタフェース MatrixSolver 内の solveByILUCG
パラメータ:
p - ベクトル p
tolerance - 閾値
戻り値:
連立方程式の解を表すベクトル
例外:
MatrixSolveException - 連立方程式の解が求まらないとき

solveByILUCG

public Vector solveByILUCG(Vector p,
                           double tolerance,
                           int iterMax)
                    throws MatrixSolveException
不完全 LU 分解共役勾配法で連立方程式の解を求める

定義:
インタフェース MatrixSolver 内の solveByILUCG
パラメータ:
p - ベクトル p
tolerance - 閾値
iterMax - 反復回数の上限
戻り値:
連立方程式の解を表すベクトル
例外:
MatrixSolveException - 連立方程式の解が求まらないとき

solveByILUCG

public Vector solveByILUCG(SparseMatrix lu,
                           Vector p,
                           double tolerance,
                           int iterMax)
                    throws MatrixSolveException
不完全 LU 分解共役勾配法で連立方程式の解を求める

パラメータ:
lu - 不完全 LU 分解された行列
p - ベクトル p
tolerance - 閾値
iterMax - 反復回数の上限
戻り値:
連立方程式の解を表すベクトル
例外:
MatrixSolveException - 連立方程式の解が求まらないとき

getILU

public Matrix getILU(double tolerance)
              throws MatrixSolveException
不完全 LU 分解をする

パラメータ:
tolerance - 閾値
戻り値:
この行列を不完全 LU 分解した行列
例外:
MatrixSolveException - 不完全 LU 分解ができないとき

inverse

public MatrixSolver inverse()
                     throws MatrixSolveException
逆行列を求める

定義:
インタフェース MatrixSolver 内の inverse
戻り値:
この行列の逆行列
例外:
MatrixSolveException - 逆行列が求まらないとき

inverse

public static MatrixSolver inverse(SparseMatrix lu,
                                   double tolerance)
                            throws MatrixSolveException
LU 分解法で逆行列を求める

パラメータ:
lu - LU 分解された行列
tolerance - 閾値
戻り値:
元の行列の逆行列
例外:
MatrixSolveException - 逆行列が求まらないとき