当前位置: 首页>>代码示例>>Java>>正文


Java Matrix.solve方法代码示例

本文整理汇总了Java中org.ujmp.core.Matrix.solve方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix.solve方法的具体用法?Java Matrix.solve怎么用?Java Matrix.solve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ujmp.core.Matrix的用法示例。


在下文中一共展示了Matrix.solve方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSolveRandSquareSmall

import org.ujmp.core.Matrix; //导入方法依赖的package包/类
@Test
public final void testSolveRandSquareSmall() throws Exception {
	Matrix a = createMatrixWithAnnotation(2, 2);

	a.randn(Ret.ORIG);
	Matrix x = createMatrixWithAnnotation(2, 4);
	x.randn(Ret.ORIG);
	Matrix b = a.mtimes(x);

	Matrix x2 = a.solve(b);
	Matrix prod = a.mtimes(x2);

	assertEquals(getLabel(), 0.0, prod.minus(b).getRMS(), TOLERANCE);

	if (a instanceof Erasable) {
		((Erasable) a).erase();
	}
	if (prod instanceof Erasable) {
		((Erasable) prod).erase();
	}
	if (x instanceof Erasable) {
		((Erasable) x).erase();
	}
	if (x2 instanceof Erasable) {
		((Erasable) x2).erase();
	}
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:28,代码来源:AbstractMatrixTest.java

示例2: testSolveRandSquareLarge

import org.ujmp.core.Matrix; //导入方法依赖的package包/类
@Test
public final void testSolveRandSquareLarge() throws Exception {
	if (!isTestLarge()) {
		return;
	}
	Matrix a = createMatrixWithAnnotation(125, 125);

	a.randn(Ret.ORIG);
	Matrix x = createMatrixWithAnnotation(125, 142);
	x.randn(Ret.ORIG);
	Matrix b = a.mtimes(x);

	Matrix x2 = a.solve(b);
	Matrix prod = a.mtimes(x2);

	assertEquals(getLabel(), 0.0, prod.minus(b).getRMS(), TOLERANCE);

	if (a instanceof Erasable) {
		((Erasable) a).erase();
	}
	if (prod instanceof Erasable) {
		((Erasable) prod).erase();
	}
	if (x instanceof Erasable) {
		((Erasable) x).erase();
	}
	if (x2 instanceof Erasable) {
		((Erasable) x2).erase();
	}
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:31,代码来源:AbstractMatrixTest.java

示例3: testSolveRandTallSmall

import org.ujmp.core.Matrix; //导入方法依赖的package包/类
@Test
public final void testSolveRandTallSmall() throws Exception {
	Matrix a = createMatrixWithAnnotation(6, 2);

	if (!isSupported(a, MatrixLibraries.SOLVE, MatrixLayout.TALL, Size.SMALL, EntryType.RANDN)) {
		return;
	}

	a.randn(Ret.ORIG);
	Matrix x = createMatrixWithAnnotation(2, 4);
	x.randn(Ret.ORIG);
	Matrix b = a.mtimes(x);

	Matrix x2 = a.solve(b);
	Matrix prod = a.mtimes(x2);

	assertEquals(getLabel(), 0.0, prod.minus(b).getRMS(), TOLERANCE);

	if (a instanceof Erasable) {
		((Erasable) a).erase();
	}
	if (prod instanceof Erasable) {
		((Erasable) prod).erase();
	}
	if (x instanceof Erasable) {
		((Erasable) x).erase();
	}
	if (x2 instanceof Erasable) {
		((Erasable) x2).erase();
	}
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:32,代码来源:AbstractMatrixTest.java

示例4: testSolveRandTallLarge

import org.ujmp.core.Matrix; //导入方法依赖的package包/类
@Test
public final void testSolveRandTallLarge() throws Exception {
	if (!isTestLarge()) {
		return;
	}
	Matrix a = createMatrixWithAnnotation(169, 121);

	if (!isSupported(a, MatrixLibraries.SOLVE, MatrixLayout.TALL, Size.LARGE, EntryType.RANDN)) {
		return;
	}

	a.randn(Ret.ORIG);
	Matrix x = createMatrixWithAnnotation(121, 143);
	x.randn(Ret.ORIG);
	Matrix b = a.mtimes(x);

	Matrix x2 = a.solve(b);
	Matrix prod = a.mtimes(x2);

	assertEquals(getLabel(), 0.0, prod.minus(b).getRMS(), TOLERANCE);

	if (a instanceof Erasable) {
		((Erasable) a).erase();
	}
	if (prod instanceof Erasable) {
		((Erasable) prod).erase();
	}
	if (x instanceof Erasable) {
		((Erasable) x).erase();
	}
	if (x2 instanceof Erasable) {
		((Erasable) x2).erase();
	}
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:35,代码来源:AbstractMatrixTest.java


注:本文中的org.ujmp.core.Matrix.solve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。