OgitaRumpOishiMethod.java
- /*
- * Created on 2008/01/21
- * Copyright (C) 2008 Koga Laboratory. All rights reserved.
- *
- */
- package org.mklab.cga.linear;
- import org.mklab.cga.interval.matrix.IntervalNumericalMatrix;
- import org.mklab.cga.interval.scalar.IntervalNumericalScalar;
- import org.mklab.nfc.matrix.NormType;
- import org.mklab.nfc.matrix.NumericalMatrix;
- import org.mklab.nfc.scalar.NumericalScalar;
- /**
- * 線形方程式の精度保証付き解を(丸めの変更を行わない)Ogita-Rump-Oishiの方法で求めるクラスです。
- *
- * @author yano
- * @version $Revision: 1.3 $, 2008/01/21
- * @param <IS> 区間スカラーの型
- * @param <IM> 区間行列の型
- * @param <S> 成分の型
- * @param <M> 行列の型
- */
- public class OgitaRumpOishiMethod<IS extends IntervalNumericalScalar<IS,IM,S,M>, IM extends IntervalNumericalMatrix<IS,IM,S,M>, S extends NumericalScalar<S,M>, M extends NumericalMatrix<S,M>> implements LinearEquationVerifier<IS,IM,S,M> {
- /** 係数行列 */
- private M A;
- /** 右辺係数ベクトル */
- private M b;
- /** 係数行列 */
- private IM IA;
- /** 右辺係数ベクトル */
- private IM Ib;
- /** 精度保証付き解 */
- private IM solution;
- /**
- * 新しく生成された<code>OgitaMethod</code>オブジェクトを初期化します。
- *
- * @param A 係数行列
- * @param b 右辺係数ベクトル
- */
- public OgitaRumpOishiMethod(final IM A, final IM b) {
- this.IA = A;
- this.Ib = b;
- }
- // /**
- // * {@inheritDoc}
- // */
- // public void solve(IM A, M b) {
- // throw new RuntimeException("Not implemented"); //$NON-NLS-1$
- // }
- //
- // /**
- // * @see org.mklab.cga.linear.LinearEquationVerifier#solve(org.mklab.nfc.matrix.NumericalMatrix, org.mklab.cga.interval.matrix.IntervalMatrix)
- // */
- // public void solve(M A, IM b) {
- // throw new RuntimeException("Not implemented"); //$NON-NLS-1$
- // }
- //
- // /**
- // * @see org.mklab.cga.linear.LinearEquationVerifier#solve(org.mklab.nfc.matrix.NumericalMatrix, org.mklab.nfc.matrix.NumericalMatrix)
- // */
- // public void solve(M A, M b) {
- // throw new RuntimeException("Not implemented"); //$NON-NLS-1$
- // }
- /**
- * {@inheritDoc}
- */
- public void solve() {
- //this.IA = IA;
- this.A = this.IA.getMiddle();
- //this.Ib = Ib;
- this.b = this.Ib.getMiddle();
- M R = this.A.inverse();
- M xtilde = R.multiply(this.b);
- M alpha = alphaStd(this.A, R);
- M beta = beta(this.A, xtilde, this.b, R);
- this.solution = null;
- }
- /**
- * @see org.mklab.cga.linear.LinearEquationVerifier#getSolution()
- */
- public IM getSolution() {
- return this.solution;
- }
- /**
- * @param a a
- * @param xtilde xtilde
- * @param b b
- * @param r r
- * @return beta
- */
- private M beta(M a, M xtilde, M b, M r) {
- return null;
- }
- /**
- * @param A A
- * @param R R
- * @return alphaStd
- */
- private M alphaStd(M A, M R) {
- S alpha1 = ((R.multiply(A).subtract((A.createUnit(A.getRowSize(), A.getColumnSize())))).norm(NormType.INFINITY));
- if (alpha1.isGreaterThanOrEquals(1)) {
- throw new RuntimeException("verification failed"); //$NON-NLS-1$
- }
- return null;
- }
- }