RealSingularValueVerifier.java
/*
* Created on 2005/01/19
* Copyright (C) 2005 Koga Laboratory. All rights reserved.
*
*/
package org.mklab.cga.eigen;
import org.mklab.cga.interval.matrix.DoubleComplexIntervalMatrix;
import org.mklab.cga.interval.matrix.DoubleIntervalMatrix;
import org.mklab.cga.interval.matrix.IntervalComplexNumericalMatrix;
import org.mklab.cga.interval.matrix.IntervalRealNumericalMatrix;
import org.mklab.cga.interval.scalar.DoubleComplexIntervalNumber;
import org.mklab.cga.interval.scalar.DoubleIntervalNumber;
import org.mklab.cga.interval.scalar.IntervalComplexNumericalScalar;
import org.mklab.cga.interval.scalar.IntervalRealNumericalScalar;
import org.mklab.cga.round.FPURoundModeSelector;
import org.mklab.nfc.matrix.ComplexNumericalMatrix;
import org.mklab.nfc.matrix.DoubleComplexMatrix;
import org.mklab.nfc.matrix.DoubleMatrix;
import org.mklab.nfc.matrix.RealNumericalMatrix;
import org.mklab.nfc.scalar.ComplexNumericalScalar;
import org.mklab.nfc.scalar.DoubleComplexNumber;
import org.mklab.nfc.scalar.DoubleNumber;
import org.mklab.nfc.scalar.RealNumericalScalar;
import org.mklab.nfc.util.RoundModeManager;
/**
* 特異値の精度保証。未完成。
*
* @author hiroki
* @version $Revision: 1.6 $.2005/01/19
* @param <RIS> 実区間スカラーの型
* @param <RIM> 実区間行列の型
* @param <CIS> 複素区間スカラーの型
* @param <CIM> 複素区間行列の型
* @param <RS> 実スカラーの型
* @param <RM> 実行列の型
* @param <CS> 複素スカラーの型
* @param <CM> 複素行列の型
*/
public class RealSingularValueVerifier<RIS extends IntervalRealNumericalScalar<RIS, RIM, CIS, CIM, RS, RM, CS, CM>, RIM extends IntervalRealNumericalMatrix<RIS, RIM, CIS, CIM, RS, RM, CS, CM>, CIS extends IntervalComplexNumericalScalar<RIS, RIM, CIS, CIM, RS, RM, CS, CM>, CIM extends IntervalComplexNumericalMatrix<RIS, RIM, CIS, CIM, RS, RM, CS, CM>, RS extends RealNumericalScalar<RS, RM, CS, CM>, RM extends RealNumericalMatrix<RS, RM, CS, CM>, CS extends ComplexNumericalScalar<RS, RM, CS, CM>, CM extends ComplexNumericalMatrix<RS, RM, CS, CM>> {
/**
* コンストラクタ
*
*/
public RealSingularValueVerifier() {
//
}
/**
* @param a 行列
* @return ?
*/
public RIM solve(RIM a) {
RIM matrix = a.transpose().multiply(a);
RealEigenVerifier<RIS,RIM,CIS,CIM,RS,RM,CS,CM> verifier = new RealRumpMethod<>(matrix);
verifier.solve();
CIM eigenValue = verifier.getEigenValue();
RIM singularValue = eigenValue.getRealPart().sqrtElementWise();
return singularValue;
}
/**
* @param args コマンドライン引数
*/
public static void main(String[] args) {
RoundModeManager manager = RoundModeManager.getManager();
manager.add(new FPURoundModeSelector());
DoubleMatrix a = new DoubleMatrix(new double[][] { {1, 2}, {3, 4}});
DoubleIntervalMatrix matrix = new DoubleIntervalMatrix(a);
a.singularValue().print("Singular Value"); //$NON-NLS-1$
RealSingularValueVerifier<DoubleIntervalNumber,DoubleIntervalMatrix,DoubleComplexIntervalNumber,DoubleComplexIntervalMatrix,DoubleNumber,DoubleMatrix,DoubleComplexNumber,DoubleComplexMatrix> sv = new RealSingularValueVerifier<>();
DoubleIntervalMatrix singularValue = sv.solve(matrix);
singularValue.printInfSup("Singular Value"); //$NON-NLS-1$
}
}