testhouseholderhessenbergreducer.java

来自「一个关于java 的常用工具包」· Java 代码 · 共 73 行

JAVA
73
字号
package org.jutiltest.math.matrix;import org.jutil.math.matrix.Matrix;import org.jutil.junit.JutilTest;import org.jutil.junit.CVSRevision;import org.jutil.math.matrix.QRDecomposition;import org.jutil.math.matrix.HouseholderHessenbergReducer;import org.jutil.math.matrix.HessenbergReduction;import junit.framework.*;/**  * @path    $Source: /cvsroot/org-jutil/jutil.org/src/org/jutiltest/math/matrix/TestHouseholderHessenbergReducer.java,v $ * @date    $Date: 2002/07/20 19:11:33 $ * @state   $State: Exp $ * @author  Marko van Dooren * @release $Name:  $ */public class TestHouseholderHessenbergReducer extends JutilTest{  public TestHouseholderHessenbergReducer(String name) {    super(name, new CVSRevision("1.4"));  }	private Matrix A;  	private Matrix B;       public void setUp() {		A = new Matrix(new double [][] {{ 1,0.5,2,1}, 																		{ 2,0,3,1},																		{-1,2,4,1},																		{ 7,2,4,3}																	 });  } 	public void test() {		testHessenberg(A);	}   public void tearDown() {    //nothing actually  }		public void testHessenberg(Matrix matrix) {		HouseholderHessenbergReducer reducer = new HouseholderHessenbergReducer();		HessenbergReduction reduction = reducer.reduce(matrix);		Matrix result = reduction.H();		//System.out.println("Matrix:");		//System.out.println(matrix);		//System.out.println("\nHessenberg reduction:");		//System.out.println(result);		//System.out.println("\nQ:");		//System.out.println(reduction.Q());		//System.out.println("\nQ * A * Q':");		//System.out.println(reduction.Q().times(result).times(reduction.Q().returnTranspose()));	}} /*<copyright>Copyright (C) 1997-2001. This software is copyrighted by the people and entities mentioned after the "@author" tags above, on behalf of the JUTIL.ORG Project. The copyright is dated by the dates after the "@date" tags above. All rights reserved.This software is published under the terms of the JUTIL.ORG SoftwareLicense version 1.1 or later, a copy of which has been included withthis distribution in the LICENSE file, which can also be found athttp://org-jutil.sourceforge.net/LICENSE. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the JUTIL.ORG Software License for more details. For more information,please see http://org-jutil.sourceforge.net/</copyright>/*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?