RumpVerifier.java
/*
* Created on 2010/07/02
* Copyright (C) 2010 Koga Laboratory. All rights reserved.
*
*/
package org.mklab.cga.rump;
import org.mklab.cga.interval.matrix.IntervalNumericalMatrix;
import org.mklab.cga.interval.scalar.IntervalNumericalScalar;
import org.mklab.nfc.matrix.NumericalMatrix;
import org.mklab.nfc.scalar.NumericalScalar;
/**
* Rumpの例題の解を精度保証付きで求める(誤差評価する)クラスです。
*
* @author nakashima
* @version $Revision$, 2010/07/02
* @param <IS> 区間スカラーの型
* @param <IM> 区間行列の型
* @param <S> 成分の型
* @param <M> 行列の型
*/
public class RumpVerifier<IS extends IntervalNumericalScalar<IS,IM,S,M>, IM extends IntervalNumericalMatrix<IS,IM,S,M>, S extends NumericalScalar<S,M>, M extends NumericalMatrix<S,M>> {
/** 多倍長精度の変数 a */
private S aPoint;
/** 多倍長精度の変数 b */
private S bPoint;
/** 精度保証付き解 */
private IS solution;
private IS is;
/**
* 新しく生成された<code>RumpVerifier</code>オブジェクトを初期化します。
*
* @param a 変数 a
* @param b 変数 b
* @param is 区間スカラー
*/
public RumpVerifier(S a, S b, IS is) {
this.aPoint = a;
this.bPoint = b;
this.is = is;
}
/**
* Returns solution.
*
* @return solution
*/
public IS getSolution() {
return this.solution;
}
/**
* Solves.
*/
public void solve() {
IS a = this.is.create(this.aPoint);
IS b =this.is.create(this.bPoint);
IS ans1 = a.power(2).unaryMinus().add(a.create(33375).divide(100)).multiply(b.power(6));
IS ans2 = a.power(2).multiply(a.power(2).multiply(b.power(2)).multiply(11).subtract(b.power(4).multiply(121)).subtract(2));
IS ans3 = b.power(8).multiply(a.create(55).divide(10));
IS ans4 = a.divide(b.multiply(2));
this.solution = ans1.add(ans2).add(ans3).add(ans4);
IS temp = ans1.add(ans2);
IS temp2 = temp.add(ans3);
IS temp3 = temp2.add(ans4);
}
/**
* Returns a.
*
* @return a
*/
protected S getA() {
return this.aPoint;
}
/**
* Returns b.
*
* @return b
*/
protected S getB() {
return this.bPoint;
}
/**
* Returns is.
*
* @return is
*/
protected IS getIs() {
return this.is;
}
}