testmatrix.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.HouseholderQRDecomposer;import junit.framework.*;/** * @path    $Source: /cvsroot/org-jutil/jutil.org/src/org/jutiltest/math/matrix/TestMatrix.java,v $ * @date    $Date: 2002/09/07 09:37:22 $ * @state   $State: Exp $ * @author  Marko van Dooren * @release $Name:  $ */public class TestMatrix extends JutilTest{  public TestMatrix(String name) {    super(name, new CVSRevision("1.19"));  }	private Matrix A;  	private Matrix B;       public void setUp() {		A = new Matrix(4,3);		A.setElementAt(1,1,3);		A.setElementAt(1,2,3);		A.setElementAt(1,3,2);		A.setElementAt(2,1,4);		A.setElementAt(2,2,4);		A.setElementAt(2,3,1);		A.setElementAt(3,1,0);		A.setElementAt(3,2,6);		A.setElementAt(3,3,2);		A.setElementAt(4,1,0);		A.setElementAt(4,2,8);		A.setElementAt(4,3,1);		B = Matrix.unity(4);  }	public void test() {		testQR(A);		testQR(B);	}    public void tearDown() {    //nothing actually  }		public void testQR(Matrix matrix) {		QRDecomposition qr = new HouseholderQRDecomposer().decompose(matrix);		Matrix product= qr.Q().times(qr.R());	}} /*<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 + -
显示快捷键?