本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}